This source file includes following definitions.
- scsw_is_tm
- scsw_key
- scsw_eswf
- scsw_cc
- scsw_ectl
- scsw_pno
- scsw_fctl
- scsw_actl
- scsw_stctl
- scsw_dstat
- scsw_cstat
- scsw_cmd_is_valid_key
- scsw_cmd_is_valid_sctl
- scsw_cmd_is_valid_eswf
- scsw_cmd_is_valid_cc
- scsw_cmd_is_valid_fmt
- scsw_cmd_is_valid_pfch
- scsw_cmd_is_valid_isic
- scsw_cmd_is_valid_alcc
- scsw_cmd_is_valid_ssi
- scsw_cmd_is_valid_zcc
- scsw_cmd_is_valid_ectl
- scsw_cmd_is_valid_pno
- scsw_cmd_is_valid_fctl
- scsw_cmd_is_valid_actl
- scsw_cmd_is_valid_stctl
- scsw_cmd_is_valid_dstat
- scsw_cmd_is_valid_cstat
- scsw_tm_is_valid_key
- scsw_tm_is_valid_eswf
- scsw_tm_is_valid_cc
- scsw_tm_is_valid_fmt
- scsw_tm_is_valid_x
- scsw_tm_is_valid_q
- scsw_tm_is_valid_ectl
- scsw_tm_is_valid_pno
- scsw_tm_is_valid_fctl
- scsw_tm_is_valid_actl
- scsw_tm_is_valid_stctl
- scsw_tm_is_valid_dstat
- scsw_tm_is_valid_cstat
- scsw_tm_is_valid_fcxs
- scsw_tm_is_valid_schxs
- scsw_is_valid_actl
- scsw_is_valid_cc
- scsw_is_valid_cstat
- scsw_is_valid_dstat
- scsw_is_valid_ectl
- scsw_is_valid_eswf
- scsw_is_valid_fctl
- scsw_is_valid_key
- scsw_is_valid_pno
- scsw_is_valid_stctl
- scsw_cmd_is_solicited
- scsw_tm_is_solicited
- scsw_is_solicited
1
2
3
4
5
6
7
8
9 #ifndef _ASM_S390_SCSW_H_
10 #define _ASM_S390_SCSW_H_
11
12 #include <linux/types.h>
13 #include <asm/css_chars.h>
14 #include <asm/cio.h>
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 struct cmd_scsw {
40 __u32 key : 4;
41 __u32 sctl : 1;
42 __u32 eswf : 1;
43 __u32 cc : 2;
44 __u32 fmt : 1;
45 __u32 pfch : 1;
46 __u32 isic : 1;
47 __u32 alcc : 1;
48 __u32 ssi : 1;
49 __u32 zcc : 1;
50 __u32 ectl : 1;
51 __u32 pno : 1;
52 __u32 res : 1;
53 __u32 fctl : 3;
54 __u32 actl : 7;
55 __u32 stctl : 5;
56 __u32 cpa;
57 __u32 dstat : 8;
58 __u32 cstat : 8;
59 __u32 count : 16;
60 } __attribute__ ((packed));
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81 struct tm_scsw {
82 u32 key:4;
83 u32 :1;
84 u32 eswf:1;
85 u32 cc:2;
86 u32 fmt:3;
87 u32 x:1;
88 u32 q:1;
89 u32 :1;
90 u32 ectl:1;
91 u32 pno:1;
92 u32 :1;
93 u32 fctl:3;
94 u32 actl:7;
95 u32 stctl:5;
96 u32 tcw;
97 u32 dstat:8;
98 u32 cstat:8;
99 u32 fcxs:8;
100 u32 ifob:1;
101 u32 sesq:7;
102 } __attribute__ ((packed));
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117 struct eadm_scsw {
118 u32 key:4;
119 u32:1;
120 u32 eswf:1;
121 u32 cc:2;
122 u32:6;
123 u32 ectl:1;
124 u32:2;
125 u32 fctl:3;
126 u32 actl:7;
127 u32 stctl:5;
128 u32 aob;
129 u32 dstat:8;
130 u32 cstat:8;
131 u32:16;
132 } __packed;
133
134
135
136
137
138
139
140 union scsw {
141 struct cmd_scsw cmd;
142 struct tm_scsw tm;
143 struct eadm_scsw eadm;
144 } __packed;
145
146 #define SCSW_FCTL_CLEAR_FUNC 0x1
147 #define SCSW_FCTL_HALT_FUNC 0x2
148 #define SCSW_FCTL_START_FUNC 0x4
149
150 #define SCSW_ACTL_SUSPENDED 0x1
151 #define SCSW_ACTL_DEVACT 0x2
152 #define SCSW_ACTL_SCHACT 0x4
153 #define SCSW_ACTL_CLEAR_PEND 0x8
154 #define SCSW_ACTL_HALT_PEND 0x10
155 #define SCSW_ACTL_START_PEND 0x20
156 #define SCSW_ACTL_RESUME_PEND 0x40
157
158 #define SCSW_STCTL_STATUS_PEND 0x1
159 #define SCSW_STCTL_SEC_STATUS 0x2
160 #define SCSW_STCTL_PRIM_STATUS 0x4
161 #define SCSW_STCTL_INTER_STATUS 0x8
162 #define SCSW_STCTL_ALERT_STATUS 0x10
163
164 #define DEV_STAT_ATTENTION 0x80
165 #define DEV_STAT_STAT_MOD 0x40
166 #define DEV_STAT_CU_END 0x20
167 #define DEV_STAT_BUSY 0x10
168 #define DEV_STAT_CHN_END 0x08
169 #define DEV_STAT_DEV_END 0x04
170 #define DEV_STAT_UNIT_CHECK 0x02
171 #define DEV_STAT_UNIT_EXCEP 0x01
172
173 #define SCHN_STAT_PCI 0x80
174 #define SCHN_STAT_INCORR_LEN 0x40
175 #define SCHN_STAT_PROG_CHECK 0x20
176 #define SCHN_STAT_PROT_CHECK 0x10
177 #define SCHN_STAT_CHN_DATA_CHK 0x08
178 #define SCHN_STAT_CHN_CTRL_CHK 0x04
179 #define SCHN_STAT_INTF_CTRL_CHK 0x02
180 #define SCHN_STAT_CHAIN_CHECK 0x01
181
182 #define SCSW_SESQ_DEV_NOFCX 3
183 #define SCSW_SESQ_PATH_NOFCX 4
184
185
186
187
188 #define SNS0_CMD_REJECT 0x80
189 #define SNS_CMD_REJECT SNS0_CMD_REJEC
190 #define SNS0_INTERVENTION_REQ 0x40
191 #define SNS0_BUS_OUT_CHECK 0x20
192 #define SNS0_EQUIPMENT_CHECK 0x10
193 #define SNS0_DATA_CHECK 0x08
194 #define SNS0_OVERRUN 0x04
195 #define SNS0_INCOMPL_DOMAIN 0x01
196
197
198
199
200 #define SNS1_PERM_ERR 0x80
201 #define SNS1_INV_TRACK_FORMAT 0x40
202 #define SNS1_EOC 0x20
203 #define SNS1_MESSAGE_TO_OPER 0x10
204 #define SNS1_NO_REC_FOUND 0x08
205 #define SNS1_FILE_PROTECTED 0x04
206 #define SNS1_WRITE_INHIBITED 0x02
207 #define SNS1_INPRECISE_END 0x01
208
209
210
211
212 #define SNS2_REQ_INH_WRITE 0x80
213 #define SNS2_CORRECTABLE 0x40
214 #define SNS2_FIRST_LOG_ERR 0x20
215 #define SNS2_ENV_DATA_PRESENT 0x10
216 #define SNS2_INPRECISE_END 0x04
217
218
219
220
221
222
223
224
225 static inline int scsw_is_tm(union scsw *scsw)
226 {
227 return css_general_characteristics.fcx && (scsw->tm.x == 1);
228 }
229
230
231
232
233
234
235
236
237 static inline u32 scsw_key(union scsw *scsw)
238 {
239 if (scsw_is_tm(scsw))
240 return scsw->tm.key;
241 else
242 return scsw->cmd.key;
243 }
244
245
246
247
248
249
250
251
252 static inline u32 scsw_eswf(union scsw *scsw)
253 {
254 if (scsw_is_tm(scsw))
255 return scsw->tm.eswf;
256 else
257 return scsw->cmd.eswf;
258 }
259
260
261
262
263
264
265
266
267 static inline u32 scsw_cc(union scsw *scsw)
268 {
269 if (scsw_is_tm(scsw))
270 return scsw->tm.cc;
271 else
272 return scsw->cmd.cc;
273 }
274
275
276
277
278
279
280
281
282 static inline u32 scsw_ectl(union scsw *scsw)
283 {
284 if (scsw_is_tm(scsw))
285 return scsw->tm.ectl;
286 else
287 return scsw->cmd.ectl;
288 }
289
290
291
292
293
294
295
296
297 static inline u32 scsw_pno(union scsw *scsw)
298 {
299 if (scsw_is_tm(scsw))
300 return scsw->tm.pno;
301 else
302 return scsw->cmd.pno;
303 }
304
305
306
307
308
309
310
311
312 static inline u32 scsw_fctl(union scsw *scsw)
313 {
314 if (scsw_is_tm(scsw))
315 return scsw->tm.fctl;
316 else
317 return scsw->cmd.fctl;
318 }
319
320
321
322
323
324
325
326
327 static inline u32 scsw_actl(union scsw *scsw)
328 {
329 if (scsw_is_tm(scsw))
330 return scsw->tm.actl;
331 else
332 return scsw->cmd.actl;
333 }
334
335
336
337
338
339
340
341
342 static inline u32 scsw_stctl(union scsw *scsw)
343 {
344 if (scsw_is_tm(scsw))
345 return scsw->tm.stctl;
346 else
347 return scsw->cmd.stctl;
348 }
349
350
351
352
353
354
355
356
357 static inline u32 scsw_dstat(union scsw *scsw)
358 {
359 if (scsw_is_tm(scsw))
360 return scsw->tm.dstat;
361 else
362 return scsw->cmd.dstat;
363 }
364
365
366
367
368
369
370
371
372 static inline u32 scsw_cstat(union scsw *scsw)
373 {
374 if (scsw_is_tm(scsw))
375 return scsw->tm.cstat;
376 else
377 return scsw->cmd.cstat;
378 }
379
380
381
382
383
384
385
386
387 static inline int scsw_cmd_is_valid_key(union scsw *scsw)
388 {
389 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
390 }
391
392
393
394
395
396
397
398
399 static inline int scsw_cmd_is_valid_sctl(union scsw *scsw)
400 {
401 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
402 }
403
404
405
406
407
408
409
410
411 static inline int scsw_cmd_is_valid_eswf(union scsw *scsw)
412 {
413 return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND);
414 }
415
416
417
418
419
420
421
422
423 static inline int scsw_cmd_is_valid_cc(union scsw *scsw)
424 {
425 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC) &&
426 (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND);
427 }
428
429
430
431
432
433
434
435
436 static inline int scsw_cmd_is_valid_fmt(union scsw *scsw)
437 {
438 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
439 }
440
441
442
443
444
445
446
447
448 static inline int scsw_cmd_is_valid_pfch(union scsw *scsw)
449 {
450 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
451 }
452
453
454
455
456
457
458
459
460 static inline int scsw_cmd_is_valid_isic(union scsw *scsw)
461 {
462 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
463 }
464
465
466
467
468
469
470
471
472 static inline int scsw_cmd_is_valid_alcc(union scsw *scsw)
473 {
474 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
475 }
476
477
478
479
480
481
482
483
484 static inline int scsw_cmd_is_valid_ssi(union scsw *scsw)
485 {
486 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
487 }
488
489
490
491
492
493
494
495
496 static inline int scsw_cmd_is_valid_zcc(union scsw *scsw)
497 {
498 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC) &&
499 (scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS);
500 }
501
502
503
504
505
506
507
508
509 static inline int scsw_cmd_is_valid_ectl(union scsw *scsw)
510 {
511 return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
512 !(scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) &&
513 (scsw->cmd.stctl & SCSW_STCTL_ALERT_STATUS);
514 }
515
516
517
518
519
520
521
522
523 static inline int scsw_cmd_is_valid_pno(union scsw *scsw)
524 {
525 return (scsw->cmd.fctl != 0) &&
526 (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
527 (!(scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) ||
528 ((scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) &&
529 (scsw->cmd.actl & SCSW_ACTL_SUSPENDED)));
530 }
531
532
533
534
535
536
537
538
539 static inline int scsw_cmd_is_valid_fctl(union scsw *scsw)
540 {
541
542 return 1;
543 }
544
545
546
547
548
549
550
551
552 static inline int scsw_cmd_is_valid_actl(union scsw *scsw)
553 {
554
555 return 1;
556 }
557
558
559
560
561
562
563
564
565 static inline int scsw_cmd_is_valid_stctl(union scsw *scsw)
566 {
567
568 return 1;
569 }
570
571
572
573
574
575
576
577
578 static inline int scsw_cmd_is_valid_dstat(union scsw *scsw)
579 {
580 return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
581 (scsw->cmd.cc != 3);
582 }
583
584
585
586
587
588
589
590
591 static inline int scsw_cmd_is_valid_cstat(union scsw *scsw)
592 {
593 return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
594 (scsw->cmd.cc != 3);
595 }
596
597
598
599
600
601
602
603
604 static inline int scsw_tm_is_valid_key(union scsw *scsw)
605 {
606 return (scsw->tm.fctl & SCSW_FCTL_START_FUNC);
607 }
608
609
610
611
612
613
614
615
616 static inline int scsw_tm_is_valid_eswf(union scsw *scsw)
617 {
618 return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND);
619 }
620
621
622
623
624
625
626
627
628 static inline int scsw_tm_is_valid_cc(union scsw *scsw)
629 {
630 return (scsw->tm.fctl & SCSW_FCTL_START_FUNC) &&
631 (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND);
632 }
633
634
635
636
637
638
639
640
641 static inline int scsw_tm_is_valid_fmt(union scsw *scsw)
642 {
643 return 1;
644 }
645
646
647
648
649
650
651
652
653 static inline int scsw_tm_is_valid_x(union scsw *scsw)
654 {
655 return 1;
656 }
657
658
659
660
661
662
663
664
665 static inline int scsw_tm_is_valid_q(union scsw *scsw)
666 {
667 return 1;
668 }
669
670
671
672
673
674
675
676
677 static inline int scsw_tm_is_valid_ectl(union scsw *scsw)
678 {
679 return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
680 !(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) &&
681 (scsw->tm.stctl & SCSW_STCTL_ALERT_STATUS);
682 }
683
684
685
686
687
688
689
690
691 static inline int scsw_tm_is_valid_pno(union scsw *scsw)
692 {
693 return (scsw->tm.fctl != 0) &&
694 (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
695 (!(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) ||
696 ((scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) &&
697 (scsw->tm.actl & SCSW_ACTL_SUSPENDED)));
698 }
699
700
701
702
703
704
705
706
707 static inline int scsw_tm_is_valid_fctl(union scsw *scsw)
708 {
709
710 return 1;
711 }
712
713
714
715
716
717
718
719
720 static inline int scsw_tm_is_valid_actl(union scsw *scsw)
721 {
722
723 return 1;
724 }
725
726
727
728
729
730
731
732
733 static inline int scsw_tm_is_valid_stctl(union scsw *scsw)
734 {
735
736 return 1;
737 }
738
739
740
741
742
743
744
745
746 static inline int scsw_tm_is_valid_dstat(union scsw *scsw)
747 {
748 return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
749 (scsw->tm.cc != 3);
750 }
751
752
753
754
755
756
757
758
759 static inline int scsw_tm_is_valid_cstat(union scsw *scsw)
760 {
761 return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
762 (scsw->tm.cc != 3);
763 }
764
765
766
767
768
769
770
771
772 static inline int scsw_tm_is_valid_fcxs(union scsw *scsw)
773 {
774 return 1;
775 }
776
777
778
779
780
781
782
783
784 static inline int scsw_tm_is_valid_schxs(union scsw *scsw)
785 {
786 return (scsw->tm.cstat & (SCHN_STAT_PROG_CHECK |
787 SCHN_STAT_INTF_CTRL_CHK |
788 SCHN_STAT_PROT_CHECK |
789 SCHN_STAT_CHN_DATA_CHK));
790 }
791
792
793
794
795
796
797
798
799
800 static inline int scsw_is_valid_actl(union scsw *scsw)
801 {
802 if (scsw_is_tm(scsw))
803 return scsw_tm_is_valid_actl(scsw);
804 else
805 return scsw_cmd_is_valid_actl(scsw);
806 }
807
808
809
810
811
812
813
814
815
816 static inline int scsw_is_valid_cc(union scsw *scsw)
817 {
818 if (scsw_is_tm(scsw))
819 return scsw_tm_is_valid_cc(scsw);
820 else
821 return scsw_cmd_is_valid_cc(scsw);
822 }
823
824
825
826
827
828
829
830
831
832 static inline int scsw_is_valid_cstat(union scsw *scsw)
833 {
834 if (scsw_is_tm(scsw))
835 return scsw_tm_is_valid_cstat(scsw);
836 else
837 return scsw_cmd_is_valid_cstat(scsw);
838 }
839
840
841
842
843
844
845
846
847
848 static inline int scsw_is_valid_dstat(union scsw *scsw)
849 {
850 if (scsw_is_tm(scsw))
851 return scsw_tm_is_valid_dstat(scsw);
852 else
853 return scsw_cmd_is_valid_dstat(scsw);
854 }
855
856
857
858
859
860
861
862
863
864 static inline int scsw_is_valid_ectl(union scsw *scsw)
865 {
866 if (scsw_is_tm(scsw))
867 return scsw_tm_is_valid_ectl(scsw);
868 else
869 return scsw_cmd_is_valid_ectl(scsw);
870 }
871
872
873
874
875
876
877
878
879
880 static inline int scsw_is_valid_eswf(union scsw *scsw)
881 {
882 if (scsw_is_tm(scsw))
883 return scsw_tm_is_valid_eswf(scsw);
884 else
885 return scsw_cmd_is_valid_eswf(scsw);
886 }
887
888
889
890
891
892
893
894
895
896 static inline int scsw_is_valid_fctl(union scsw *scsw)
897 {
898 if (scsw_is_tm(scsw))
899 return scsw_tm_is_valid_fctl(scsw);
900 else
901 return scsw_cmd_is_valid_fctl(scsw);
902 }
903
904
905
906
907
908
909
910
911
912 static inline int scsw_is_valid_key(union scsw *scsw)
913 {
914 if (scsw_is_tm(scsw))
915 return scsw_tm_is_valid_key(scsw);
916 else
917 return scsw_cmd_is_valid_key(scsw);
918 }
919
920
921
922
923
924
925
926
927
928 static inline int scsw_is_valid_pno(union scsw *scsw)
929 {
930 if (scsw_is_tm(scsw))
931 return scsw_tm_is_valid_pno(scsw);
932 else
933 return scsw_cmd_is_valid_pno(scsw);
934 }
935
936
937
938
939
940
941
942
943
944 static inline int scsw_is_valid_stctl(union scsw *scsw)
945 {
946 if (scsw_is_tm(scsw))
947 return scsw_tm_is_valid_stctl(scsw);
948 else
949 return scsw_cmd_is_valid_stctl(scsw);
950 }
951
952
953
954
955
956
957
958
959 static inline int scsw_cmd_is_solicited(union scsw *scsw)
960 {
961 return (scsw->cmd.cc != 0) || (scsw->cmd.stctl !=
962 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS));
963 }
964
965
966
967
968
969
970
971
972 static inline int scsw_tm_is_solicited(union scsw *scsw)
973 {
974 return (scsw->tm.cc != 0) || (scsw->tm.stctl !=
975 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS));
976 }
977
978
979
980
981
982
983
984
985 static inline int scsw_is_solicited(union scsw *scsw)
986 {
987 if (scsw_is_tm(scsw))
988 return scsw_tm_is_solicited(scsw);
989 else
990 return scsw_cmd_is_solicited(scsw);
991 }
992
993 #endif