1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Helper functions for scsw access.
5 * Copyright IBM Corp. 2008, 2012
9 #ifndef _ASM_S390_SCSW_H_
10 #define _ASM_S390_SCSW_H_
12 #include <linux/types.h>
13 #include <asm/css_chars.h>
17 * struct cmd_scsw - command-mode subchannel status word
18 * @key: subchannel key
19 * @sctl: suspend control
21 * @cc: deferred condition code
24 * @isic: initial-status interruption control
25 * @alcc: address-limit checking control
26 * @ssi: suppress-suspended interruption
27 * @zcc: zero condition code
28 * @ectl: extended control
29 * @pno: path not operational
31 * @fctl: function control
32 * @actl: activity control
33 * @stctl: status control
34 * @cpa: channel program address
35 * @dstat: device status
36 * @cstat: subchannel status
37 * @count: residual count
60 } __attribute__ ((packed));
63 * struct tm_scsw - transport-mode subchannel status word
64 * @key: subchannel key
66 * @cc: deferred condition code
68 * @x: IRB-format control
69 * @q: interrogate-complete
70 * @ectl: extended control
71 * @pno: path not operational
72 * @fctl: function control
73 * @actl: activity control
74 * @stctl: status control
76 * @dstat: device status
77 * @cstat: subchannel status
79 * @schxs: subchannel-extended status
102 } __attribute__ ((packed));
105 * struct eadm_scsw - subchannel status word for eadm subchannels
106 * @key: subchannel key
108 * @cc: deferred condition code
109 * @ectl: extended control
110 * @fctl: function control
111 * @actl: activity control
112 * @stctl: status control
114 * @dstat: device status
115 * @cstat: subchannel status
135 * union scsw - subchannel status word
136 * @cmd: command-mode SCSW
137 * @tm: transport-mode SCSW
143 struct eadm_scsw eadm;
146 #define SCSW_FCTL_CLEAR_FUNC 0x1
147 #define SCSW_FCTL_HALT_FUNC 0x2
148 #define SCSW_FCTL_START_FUNC 0x4
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
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
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
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
182 #define SCSW_SESQ_DEV_NOFCX 3
183 #define SCSW_SESQ_PATH_NOFCX 4
186 * architectured values for first sense byte
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
198 * architectured values for second sense byte
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
210 * architectured values for third sense byte
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
219 * scsw_is_tm - check for transport mode scsw
220 * @scsw: pointer to scsw
222 * Return non-zero if the specified scsw is a transport mode scsw, zero
225 static inline int scsw_is_tm(union scsw *scsw)
227 return css_general_characteristics.fcx && (scsw->tm.x == 1);
231 * scsw_key - return scsw key field
232 * @scsw: pointer to scsw
234 * Return the value of the key field of the specified scsw, regardless of
235 * whether it is a transport mode or command mode scsw.
237 static inline u32 scsw_key(union scsw *scsw)
239 if (scsw_is_tm(scsw))
242 return scsw->cmd.key;
246 * scsw_eswf - return scsw eswf field
247 * @scsw: pointer to scsw
249 * Return the value of the eswf field of the specified scsw, regardless of
250 * whether it is a transport mode or command mode scsw.
252 static inline u32 scsw_eswf(union scsw *scsw)
254 if (scsw_is_tm(scsw))
255 return scsw->tm.eswf;
257 return scsw->cmd.eswf;
261 * scsw_cc - return scsw cc field
262 * @scsw: pointer to scsw
264 * Return the value of the cc field of the specified scsw, regardless of
265 * whether it is a transport mode or command mode scsw.
267 static inline u32 scsw_cc(union scsw *scsw)
269 if (scsw_is_tm(scsw))
276 * scsw_ectl - return scsw ectl field
277 * @scsw: pointer to scsw
279 * Return the value of the ectl field of the specified scsw, regardless of
280 * whether it is a transport mode or command mode scsw.
282 static inline u32 scsw_ectl(union scsw *scsw)
284 if (scsw_is_tm(scsw))
285 return scsw->tm.ectl;
287 return scsw->cmd.ectl;
291 * scsw_pno - return scsw pno field
292 * @scsw: pointer to scsw
294 * Return the value of the pno field of the specified scsw, regardless of
295 * whether it is a transport mode or command mode scsw.
297 static inline u32 scsw_pno(union scsw *scsw)
299 if (scsw_is_tm(scsw))
302 return scsw->cmd.pno;
306 * scsw_fctl - return scsw fctl field
307 * @scsw: pointer to scsw
309 * Return the value of the fctl field of the specified scsw, regardless of
310 * whether it is a transport mode or command mode scsw.
312 static inline u32 scsw_fctl(union scsw *scsw)
314 if (scsw_is_tm(scsw))
315 return scsw->tm.fctl;
317 return scsw->cmd.fctl;
321 * scsw_actl - return scsw actl field
322 * @scsw: pointer to scsw
324 * Return the value of the actl field of the specified scsw, regardless of
325 * whether it is a transport mode or command mode scsw.
327 static inline u32 scsw_actl(union scsw *scsw)
329 if (scsw_is_tm(scsw))
330 return scsw->tm.actl;
332 return scsw->cmd.actl;
336 * scsw_stctl - return scsw stctl field
337 * @scsw: pointer to scsw
339 * Return the value of the stctl field of the specified scsw, regardless of
340 * whether it is a transport mode or command mode scsw.
342 static inline u32 scsw_stctl(union scsw *scsw)
344 if (scsw_is_tm(scsw))
345 return scsw->tm.stctl;
347 return scsw->cmd.stctl;
351 * scsw_dstat - return scsw dstat field
352 * @scsw: pointer to scsw
354 * Return the value of the dstat field of the specified scsw, regardless of
355 * whether it is a transport mode or command mode scsw.
357 static inline u32 scsw_dstat(union scsw *scsw)
359 if (scsw_is_tm(scsw))
360 return scsw->tm.dstat;
362 return scsw->cmd.dstat;
366 * scsw_cstat - return scsw cstat field
367 * @scsw: pointer to scsw
369 * Return the value of the cstat field of the specified scsw, regardless of
370 * whether it is a transport mode or command mode scsw.
372 static inline u32 scsw_cstat(union scsw *scsw)
374 if (scsw_is_tm(scsw))
375 return scsw->tm.cstat;
377 return scsw->cmd.cstat;
381 * scsw_cmd_is_valid_key - check key field validity
382 * @scsw: pointer to scsw
384 * Return non-zero if the key field of the specified command mode scsw is
385 * valid, zero otherwise.
387 static inline int scsw_cmd_is_valid_key(union scsw *scsw)
389 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
393 * scsw_cmd_is_valid_sctl - check sctl field validity
394 * @scsw: pointer to scsw
396 * Return non-zero if the sctl field of the specified command mode scsw is
397 * valid, zero otherwise.
399 static inline int scsw_cmd_is_valid_sctl(union scsw *scsw)
401 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
405 * scsw_cmd_is_valid_eswf - check eswf field validity
406 * @scsw: pointer to scsw
408 * Return non-zero if the eswf field of the specified command mode scsw is
409 * valid, zero otherwise.
411 static inline int scsw_cmd_is_valid_eswf(union scsw *scsw)
413 return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND);
417 * scsw_cmd_is_valid_cc - check cc field validity
418 * @scsw: pointer to scsw
420 * Return non-zero if the cc field of the specified command mode scsw is
421 * valid, zero otherwise.
423 static inline int scsw_cmd_is_valid_cc(union scsw *scsw)
425 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC) &&
426 (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND);
430 * scsw_cmd_is_valid_fmt - check fmt field validity
431 * @scsw: pointer to scsw
433 * Return non-zero if the fmt field of the specified command mode scsw is
434 * valid, zero otherwise.
436 static inline int scsw_cmd_is_valid_fmt(union scsw *scsw)
438 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
442 * scsw_cmd_is_valid_pfch - check pfch field validity
443 * @scsw: pointer to scsw
445 * Return non-zero if the pfch field of the specified command mode scsw is
446 * valid, zero otherwise.
448 static inline int scsw_cmd_is_valid_pfch(union scsw *scsw)
450 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
454 * scsw_cmd_is_valid_isic - check isic field validity
455 * @scsw: pointer to scsw
457 * Return non-zero if the isic field of the specified command mode scsw is
458 * valid, zero otherwise.
460 static inline int scsw_cmd_is_valid_isic(union scsw *scsw)
462 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
466 * scsw_cmd_is_valid_alcc - check alcc field validity
467 * @scsw: pointer to scsw
469 * Return non-zero if the alcc field of the specified command mode scsw is
470 * valid, zero otherwise.
472 static inline int scsw_cmd_is_valid_alcc(union scsw *scsw)
474 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
478 * scsw_cmd_is_valid_ssi - check ssi field validity
479 * @scsw: pointer to scsw
481 * Return non-zero if the ssi field of the specified command mode scsw is
482 * valid, zero otherwise.
484 static inline int scsw_cmd_is_valid_ssi(union scsw *scsw)
486 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
490 * scsw_cmd_is_valid_zcc - check zcc field validity
491 * @scsw: pointer to scsw
493 * Return non-zero if the zcc field of the specified command mode scsw is
494 * valid, zero otherwise.
496 static inline int scsw_cmd_is_valid_zcc(union scsw *scsw)
498 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC) &&
499 (scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS);
503 * scsw_cmd_is_valid_ectl - check ectl field validity
504 * @scsw: pointer to scsw
506 * Return non-zero if the ectl field of the specified command mode scsw is
507 * valid, zero otherwise.
509 static inline int scsw_cmd_is_valid_ectl(union scsw *scsw)
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);
517 * scsw_cmd_is_valid_pno - check pno field validity
518 * @scsw: pointer to scsw
520 * Return non-zero if the pno field of the specified command mode scsw is
521 * valid, zero otherwise.
523 static inline int scsw_cmd_is_valid_pno(union scsw *scsw)
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.actl & SCSW_ACTL_SUSPENDED));
532 * scsw_cmd_is_valid_fctl - check fctl field validity
533 * @scsw: pointer to scsw
535 * Return non-zero if the fctl field of the specified command mode scsw is
536 * valid, zero otherwise.
538 static inline int scsw_cmd_is_valid_fctl(union scsw *scsw)
540 /* Only valid if pmcw.dnv == 1*/
545 * scsw_cmd_is_valid_actl - check actl field validity
546 * @scsw: pointer to scsw
548 * Return non-zero if the actl field of the specified command mode scsw is
549 * valid, zero otherwise.
551 static inline int scsw_cmd_is_valid_actl(union scsw *scsw)
553 /* Only valid if pmcw.dnv == 1*/
558 * scsw_cmd_is_valid_stctl - check stctl field validity
559 * @scsw: pointer to scsw
561 * Return non-zero if the stctl field of the specified command mode scsw is
562 * valid, zero otherwise.
564 static inline int scsw_cmd_is_valid_stctl(union scsw *scsw)
566 /* Only valid if pmcw.dnv == 1*/
571 * scsw_cmd_is_valid_dstat - check dstat field validity
572 * @scsw: pointer to scsw
574 * Return non-zero if the dstat field of the specified command mode scsw is
575 * valid, zero otherwise.
577 static inline int scsw_cmd_is_valid_dstat(union scsw *scsw)
579 return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
584 * scsw_cmd_is_valid_cstat - check cstat field validity
585 * @scsw: pointer to scsw
587 * Return non-zero if the cstat field of the specified command mode scsw is
588 * valid, zero otherwise.
590 static inline int scsw_cmd_is_valid_cstat(union scsw *scsw)
592 return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
597 * scsw_tm_is_valid_key - check key field validity
598 * @scsw: pointer to scsw
600 * Return non-zero if the key field of the specified transport mode scsw is
601 * valid, zero otherwise.
603 static inline int scsw_tm_is_valid_key(union scsw *scsw)
605 return (scsw->tm.fctl & SCSW_FCTL_START_FUNC);
609 * scsw_tm_is_valid_eswf - check eswf field validity
610 * @scsw: pointer to scsw
612 * Return non-zero if the eswf field of the specified transport mode scsw is
613 * valid, zero otherwise.
615 static inline int scsw_tm_is_valid_eswf(union scsw *scsw)
617 return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND);
621 * scsw_tm_is_valid_cc - check cc field validity
622 * @scsw: pointer to scsw
624 * Return non-zero if the cc field of the specified transport mode scsw is
625 * valid, zero otherwise.
627 static inline int scsw_tm_is_valid_cc(union scsw *scsw)
629 return (scsw->tm.fctl & SCSW_FCTL_START_FUNC) &&
630 (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND);
634 * scsw_tm_is_valid_fmt - check fmt field validity
635 * @scsw: pointer to scsw
637 * Return non-zero if the fmt field of the specified transport mode scsw is
638 * valid, zero otherwise.
640 static inline int scsw_tm_is_valid_fmt(union scsw *scsw)
646 * scsw_tm_is_valid_x - check x field validity
647 * @scsw: pointer to scsw
649 * Return non-zero if the x field of the specified transport mode scsw is
650 * valid, zero otherwise.
652 static inline int scsw_tm_is_valid_x(union scsw *scsw)
658 * scsw_tm_is_valid_q - check q field validity
659 * @scsw: pointer to scsw
661 * Return non-zero if the q field of the specified transport mode scsw is
662 * valid, zero otherwise.
664 static inline int scsw_tm_is_valid_q(union scsw *scsw)
670 * scsw_tm_is_valid_ectl - check ectl field validity
671 * @scsw: pointer to scsw
673 * Return non-zero if the ectl field of the specified transport mode scsw is
674 * valid, zero otherwise.
676 static inline int scsw_tm_is_valid_ectl(union scsw *scsw)
678 return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
679 !(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) &&
680 (scsw->tm.stctl & SCSW_STCTL_ALERT_STATUS);
684 * scsw_tm_is_valid_pno - check pno field validity
685 * @scsw: pointer to scsw
687 * Return non-zero if the pno field of the specified transport mode scsw is
688 * valid, zero otherwise.
690 static inline int scsw_tm_is_valid_pno(union scsw *scsw)
692 return (scsw->tm.fctl != 0) &&
693 (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
694 (!(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) ||
695 ((scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) &&
696 (scsw->tm.actl & SCSW_ACTL_SUSPENDED)));
700 * scsw_tm_is_valid_fctl - check fctl field validity
701 * @scsw: pointer to scsw
703 * Return non-zero if the fctl field of the specified transport mode scsw is
704 * valid, zero otherwise.
706 static inline int scsw_tm_is_valid_fctl(union scsw *scsw)
708 /* Only valid if pmcw.dnv == 1*/
713 * scsw_tm_is_valid_actl - check actl field validity
714 * @scsw: pointer to scsw
716 * Return non-zero if the actl field of the specified transport mode scsw is
717 * valid, zero otherwise.
719 static inline int scsw_tm_is_valid_actl(union scsw *scsw)
721 /* Only valid if pmcw.dnv == 1*/
726 * scsw_tm_is_valid_stctl - check stctl field validity
727 * @scsw: pointer to scsw
729 * Return non-zero if the stctl field of the specified transport mode scsw is
730 * valid, zero otherwise.
732 static inline int scsw_tm_is_valid_stctl(union scsw *scsw)
734 /* Only valid if pmcw.dnv == 1*/
739 * scsw_tm_is_valid_dstat - check dstat field validity
740 * @scsw: pointer to scsw
742 * Return non-zero if the dstat field of the specified transport mode scsw is
743 * valid, zero otherwise.
745 static inline int scsw_tm_is_valid_dstat(union scsw *scsw)
747 return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
752 * scsw_tm_is_valid_cstat - check cstat field validity
753 * @scsw: pointer to scsw
755 * Return non-zero if the cstat field of the specified transport mode scsw is
756 * valid, zero otherwise.
758 static inline int scsw_tm_is_valid_cstat(union scsw *scsw)
760 return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
765 * scsw_tm_is_valid_fcxs - check fcxs field validity
766 * @scsw: pointer to scsw
768 * Return non-zero if the fcxs field of the specified transport mode scsw is
769 * valid, zero otherwise.
771 static inline int scsw_tm_is_valid_fcxs(union scsw *scsw)
777 * scsw_tm_is_valid_schxs - check schxs field validity
778 * @scsw: pointer to scsw
780 * Return non-zero if the schxs field of the specified transport mode scsw is
781 * valid, zero otherwise.
783 static inline int scsw_tm_is_valid_schxs(union scsw *scsw)
785 return (scsw->tm.cstat & (SCHN_STAT_PROG_CHECK |
786 SCHN_STAT_INTF_CTRL_CHK |
787 SCHN_STAT_PROT_CHECK |
788 SCHN_STAT_CHN_DATA_CHK));
792 * scsw_is_valid_actl - check actl field validity
793 * @scsw: pointer to scsw
795 * Return non-zero if the actl field of the specified scsw is valid,
796 * regardless of whether it is a transport mode or command mode scsw.
797 * Return zero if the field does not contain a valid value.
799 static inline int scsw_is_valid_actl(union scsw *scsw)
801 if (scsw_is_tm(scsw))
802 return scsw_tm_is_valid_actl(scsw);
804 return scsw_cmd_is_valid_actl(scsw);
808 * scsw_is_valid_cc - check cc field validity
809 * @scsw: pointer to scsw
811 * Return non-zero if the cc field of the specified scsw is valid,
812 * regardless of whether it is a transport mode or command mode scsw.
813 * Return zero if the field does not contain a valid value.
815 static inline int scsw_is_valid_cc(union scsw *scsw)
817 if (scsw_is_tm(scsw))
818 return scsw_tm_is_valid_cc(scsw);
820 return scsw_cmd_is_valid_cc(scsw);
824 * scsw_is_valid_cstat - check cstat field validity
825 * @scsw: pointer to scsw
827 * Return non-zero if the cstat field of the specified scsw is valid,
828 * regardless of whether it is a transport mode or command mode scsw.
829 * Return zero if the field does not contain a valid value.
831 static inline int scsw_is_valid_cstat(union scsw *scsw)
833 if (scsw_is_tm(scsw))
834 return scsw_tm_is_valid_cstat(scsw);
836 return scsw_cmd_is_valid_cstat(scsw);
840 * scsw_is_valid_dstat - check dstat field validity
841 * @scsw: pointer to scsw
843 * Return non-zero if the dstat field of the specified scsw is valid,
844 * regardless of whether it is a transport mode or command mode scsw.
845 * Return zero if the field does not contain a valid value.
847 static inline int scsw_is_valid_dstat(union scsw *scsw)
849 if (scsw_is_tm(scsw))
850 return scsw_tm_is_valid_dstat(scsw);
852 return scsw_cmd_is_valid_dstat(scsw);
856 * scsw_is_valid_ectl - check ectl field validity
857 * @scsw: pointer to scsw
859 * Return non-zero if the ectl field of the specified scsw is valid,
860 * regardless of whether it is a transport mode or command mode scsw.
861 * Return zero if the field does not contain a valid value.
863 static inline int scsw_is_valid_ectl(union scsw *scsw)
865 if (scsw_is_tm(scsw))
866 return scsw_tm_is_valid_ectl(scsw);
868 return scsw_cmd_is_valid_ectl(scsw);
872 * scsw_is_valid_eswf - check eswf field validity
873 * @scsw: pointer to scsw
875 * Return non-zero if the eswf field of the specified scsw is valid,
876 * regardless of whether it is a transport mode or command mode scsw.
877 * Return zero if the field does not contain a valid value.
879 static inline int scsw_is_valid_eswf(union scsw *scsw)
881 if (scsw_is_tm(scsw))
882 return scsw_tm_is_valid_eswf(scsw);
884 return scsw_cmd_is_valid_eswf(scsw);
888 * scsw_is_valid_fctl - check fctl field validity
889 * @scsw: pointer to scsw
891 * Return non-zero if the fctl field of the specified scsw is valid,
892 * regardless of whether it is a transport mode or command mode scsw.
893 * Return zero if the field does not contain a valid value.
895 static inline int scsw_is_valid_fctl(union scsw *scsw)
897 if (scsw_is_tm(scsw))
898 return scsw_tm_is_valid_fctl(scsw);
900 return scsw_cmd_is_valid_fctl(scsw);
904 * scsw_is_valid_key - check key field validity
905 * @scsw: pointer to scsw
907 * Return non-zero if the key field of the specified scsw is valid,
908 * regardless of whether it is a transport mode or command mode scsw.
909 * Return zero if the field does not contain a valid value.
911 static inline int scsw_is_valid_key(union scsw *scsw)
913 if (scsw_is_tm(scsw))
914 return scsw_tm_is_valid_key(scsw);
916 return scsw_cmd_is_valid_key(scsw);
920 * scsw_is_valid_pno - check pno field validity
921 * @scsw: pointer to scsw
923 * Return non-zero if the pno field of the specified scsw is valid,
924 * regardless of whether it is a transport mode or command mode scsw.
925 * Return zero if the field does not contain a valid value.
927 static inline int scsw_is_valid_pno(union scsw *scsw)
929 if (scsw_is_tm(scsw))
930 return scsw_tm_is_valid_pno(scsw);
932 return scsw_cmd_is_valid_pno(scsw);
936 * scsw_is_valid_stctl - check stctl field validity
937 * @scsw: pointer to scsw
939 * Return non-zero if the stctl field of the specified scsw is valid,
940 * regardless of whether it is a transport mode or command mode scsw.
941 * Return zero if the field does not contain a valid value.
943 static inline int scsw_is_valid_stctl(union scsw *scsw)
945 if (scsw_is_tm(scsw))
946 return scsw_tm_is_valid_stctl(scsw);
948 return scsw_cmd_is_valid_stctl(scsw);
952 * scsw_cmd_is_solicited - check for solicited scsw
953 * @scsw: pointer to scsw
955 * Return non-zero if the command mode scsw indicates that the associated
956 * status condition is solicited, zero if it is unsolicited.
958 static inline int scsw_cmd_is_solicited(union scsw *scsw)
960 return (scsw->cmd.cc != 0) || (scsw->cmd.stctl !=
961 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS));
965 * scsw_tm_is_solicited - check for solicited scsw
966 * @scsw: pointer to scsw
968 * Return non-zero if the transport mode scsw indicates that the associated
969 * status condition is solicited, zero if it is unsolicited.
971 static inline int scsw_tm_is_solicited(union scsw *scsw)
973 return (scsw->tm.cc != 0) || (scsw->tm.stctl !=
974 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS));
978 * scsw_is_solicited - check for solicited scsw
979 * @scsw: pointer to scsw
981 * Return non-zero if the transport or command mode scsw indicates that the
982 * associated status condition is solicited, zero if it is unsolicited.
984 static inline int scsw_is_solicited(union scsw *scsw)
986 if (scsw_is_tm(scsw))
987 return scsw_tm_is_solicited(scsw);
989 return scsw_cmd_is_solicited(scsw);
992 #endif /* _ASM_S390_SCSW_H_ */