added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / drivers / s390 / cio / scsw.c
blobf8da25ab576db2aa85ce27853d0ac6d79290ae5d
1 /*
2 * Helper functions for scsw access.
4 * Copyright IBM Corp. 2008
5 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
6 */
8 #include <linux/types.h>
9 #include <linux/module.h>
10 #include <asm/cio.h>
11 #include "css.h"
12 #include "chsc.h"
14 /**
15 * scsw_is_tm - check for transport mode scsw
16 * @scsw: pointer to scsw
18 * Return non-zero if the specified scsw is a transport mode scsw, zero
19 * otherwise.
21 int scsw_is_tm(union scsw *scsw)
23 return css_general_characteristics.fcx && (scsw->tm.x == 1);
25 EXPORT_SYMBOL(scsw_is_tm);
27 /**
28 * scsw_key - return scsw key field
29 * @scsw: pointer to scsw
31 * Return the value of the key field of the specified scsw, regardless of
32 * whether it is a transport mode or command mode scsw.
34 u32 scsw_key(union scsw *scsw)
36 if (scsw_is_tm(scsw))
37 return scsw->tm.key;
38 else
39 return scsw->cmd.key;
41 EXPORT_SYMBOL(scsw_key);
43 /**
44 * scsw_eswf - return scsw eswf field
45 * @scsw: pointer to scsw
47 * Return the value of the eswf field of the specified scsw, regardless of
48 * whether it is a transport mode or command mode scsw.
50 u32 scsw_eswf(union scsw *scsw)
52 if (scsw_is_tm(scsw))
53 return scsw->tm.eswf;
54 else
55 return scsw->cmd.eswf;
57 EXPORT_SYMBOL(scsw_eswf);
59 /**
60 * scsw_cc - return scsw cc field
61 * @scsw: pointer to scsw
63 * Return the value of the cc field of the specified scsw, regardless of
64 * whether it is a transport mode or command mode scsw.
66 u32 scsw_cc(union scsw *scsw)
68 if (scsw_is_tm(scsw))
69 return scsw->tm.cc;
70 else
71 return scsw->cmd.cc;
73 EXPORT_SYMBOL(scsw_cc);
75 /**
76 * scsw_ectl - return scsw ectl field
77 * @scsw: pointer to scsw
79 * Return the value of the ectl field of the specified scsw, regardless of
80 * whether it is a transport mode or command mode scsw.
82 u32 scsw_ectl(union scsw *scsw)
84 if (scsw_is_tm(scsw))
85 return scsw->tm.ectl;
86 else
87 return scsw->cmd.ectl;
89 EXPORT_SYMBOL(scsw_ectl);
91 /**
92 * scsw_pno - return scsw pno field
93 * @scsw: pointer to scsw
95 * Return the value of the pno field of the specified scsw, regardless of
96 * whether it is a transport mode or command mode scsw.
98 u32 scsw_pno(union scsw *scsw)
100 if (scsw_is_tm(scsw))
101 return scsw->tm.pno;
102 else
103 return scsw->cmd.pno;
105 EXPORT_SYMBOL(scsw_pno);
108 * scsw_fctl - return scsw fctl field
109 * @scsw: pointer to scsw
111 * Return the value of the fctl field of the specified scsw, regardless of
112 * whether it is a transport mode or command mode scsw.
114 u32 scsw_fctl(union scsw *scsw)
116 if (scsw_is_tm(scsw))
117 return scsw->tm.fctl;
118 else
119 return scsw->cmd.fctl;
121 EXPORT_SYMBOL(scsw_fctl);
124 * scsw_actl - return scsw actl field
125 * @scsw: pointer to scsw
127 * Return the value of the actl field of the specified scsw, regardless of
128 * whether it is a transport mode or command mode scsw.
130 u32 scsw_actl(union scsw *scsw)
132 if (scsw_is_tm(scsw))
133 return scsw->tm.actl;
134 else
135 return scsw->cmd.actl;
137 EXPORT_SYMBOL(scsw_actl);
140 * scsw_stctl - return scsw stctl field
141 * @scsw: pointer to scsw
143 * Return the value of the stctl field of the specified scsw, regardless of
144 * whether it is a transport mode or command mode scsw.
146 u32 scsw_stctl(union scsw *scsw)
148 if (scsw_is_tm(scsw))
149 return scsw->tm.stctl;
150 else
151 return scsw->cmd.stctl;
153 EXPORT_SYMBOL(scsw_stctl);
156 * scsw_dstat - return scsw dstat field
157 * @scsw: pointer to scsw
159 * Return the value of the dstat field of the specified scsw, regardless of
160 * whether it is a transport mode or command mode scsw.
162 u32 scsw_dstat(union scsw *scsw)
164 if (scsw_is_tm(scsw))
165 return scsw->tm.dstat;
166 else
167 return scsw->cmd.dstat;
169 EXPORT_SYMBOL(scsw_dstat);
172 * scsw_cstat - return scsw cstat field
173 * @scsw: pointer to scsw
175 * Return the value of the cstat field of the specified scsw, regardless of
176 * whether it is a transport mode or command mode scsw.
178 u32 scsw_cstat(union scsw *scsw)
180 if (scsw_is_tm(scsw))
181 return scsw->tm.cstat;
182 else
183 return scsw->cmd.cstat;
185 EXPORT_SYMBOL(scsw_cstat);
188 * scsw_cmd_is_valid_key - check key field validity
189 * @scsw: pointer to scsw
191 * Return non-zero if the key field of the specified command mode scsw is
192 * valid, zero otherwise.
194 int scsw_cmd_is_valid_key(union scsw *scsw)
196 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
198 EXPORT_SYMBOL(scsw_cmd_is_valid_key);
201 * scsw_cmd_is_valid_sctl - check fctl field validity
202 * @scsw: pointer to scsw
204 * Return non-zero if the fctl field of the specified command mode scsw is
205 * valid, zero otherwise.
207 int scsw_cmd_is_valid_sctl(union scsw *scsw)
209 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
211 EXPORT_SYMBOL(scsw_cmd_is_valid_sctl);
214 * scsw_cmd_is_valid_eswf - check eswf field validity
215 * @scsw: pointer to scsw
217 * Return non-zero if the eswf field of the specified command mode scsw is
218 * valid, zero otherwise.
220 int scsw_cmd_is_valid_eswf(union scsw *scsw)
222 return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND);
224 EXPORT_SYMBOL(scsw_cmd_is_valid_eswf);
227 * scsw_cmd_is_valid_cc - check cc field validity
228 * @scsw: pointer to scsw
230 * Return non-zero if the cc field of the specified command mode scsw is
231 * valid, zero otherwise.
233 int scsw_cmd_is_valid_cc(union scsw *scsw)
235 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC) &&
236 (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND);
238 EXPORT_SYMBOL(scsw_cmd_is_valid_cc);
241 * scsw_cmd_is_valid_fmt - check fmt field validity
242 * @scsw: pointer to scsw
244 * Return non-zero if the fmt field of the specified command mode scsw is
245 * valid, zero otherwise.
247 int scsw_cmd_is_valid_fmt(union scsw *scsw)
249 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
251 EXPORT_SYMBOL(scsw_cmd_is_valid_fmt);
254 * scsw_cmd_is_valid_pfch - check pfch field validity
255 * @scsw: pointer to scsw
257 * Return non-zero if the pfch field of the specified command mode scsw is
258 * valid, zero otherwise.
260 int scsw_cmd_is_valid_pfch(union scsw *scsw)
262 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
264 EXPORT_SYMBOL(scsw_cmd_is_valid_pfch);
267 * scsw_cmd_is_valid_isic - check isic field validity
268 * @scsw: pointer to scsw
270 * Return non-zero if the isic field of the specified command mode scsw is
271 * valid, zero otherwise.
273 int scsw_cmd_is_valid_isic(union scsw *scsw)
275 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
277 EXPORT_SYMBOL(scsw_cmd_is_valid_isic);
280 * scsw_cmd_is_valid_alcc - check alcc field validity
281 * @scsw: pointer to scsw
283 * Return non-zero if the alcc field of the specified command mode scsw is
284 * valid, zero otherwise.
286 int scsw_cmd_is_valid_alcc(union scsw *scsw)
288 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
290 EXPORT_SYMBOL(scsw_cmd_is_valid_alcc);
293 * scsw_cmd_is_valid_ssi - check ssi field validity
294 * @scsw: pointer to scsw
296 * Return non-zero if the ssi field of the specified command mode scsw is
297 * valid, zero otherwise.
299 int scsw_cmd_is_valid_ssi(union scsw *scsw)
301 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
303 EXPORT_SYMBOL(scsw_cmd_is_valid_ssi);
306 * scsw_cmd_is_valid_zcc - check zcc field validity
307 * @scsw: pointer to scsw
309 * Return non-zero if the zcc field of the specified command mode scsw is
310 * valid, zero otherwise.
312 int scsw_cmd_is_valid_zcc(union scsw *scsw)
314 return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC) &&
315 (scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS);
317 EXPORT_SYMBOL(scsw_cmd_is_valid_zcc);
320 * scsw_cmd_is_valid_ectl - check ectl field validity
321 * @scsw: pointer to scsw
323 * Return non-zero if the ectl field of the specified command mode scsw is
324 * valid, zero otherwise.
326 int scsw_cmd_is_valid_ectl(union scsw *scsw)
328 return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
329 !(scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) &&
330 (scsw->cmd.stctl & SCSW_STCTL_ALERT_STATUS);
332 EXPORT_SYMBOL(scsw_cmd_is_valid_ectl);
335 * scsw_cmd_is_valid_pno - check pno field validity
336 * @scsw: pointer to scsw
338 * Return non-zero if the pno field of the specified command mode scsw is
339 * valid, zero otherwise.
341 int scsw_cmd_is_valid_pno(union scsw *scsw)
343 return (scsw->cmd.fctl != 0) &&
344 (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
345 (!(scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) ||
346 ((scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) &&
347 (scsw->cmd.actl & SCSW_ACTL_SUSPENDED)));
349 EXPORT_SYMBOL(scsw_cmd_is_valid_pno);
352 * scsw_cmd_is_valid_fctl - check fctl field validity
353 * @scsw: pointer to scsw
355 * Return non-zero if the fctl field of the specified command mode scsw is
356 * valid, zero otherwise.
358 int scsw_cmd_is_valid_fctl(union scsw *scsw)
360 /* Only valid if pmcw.dnv == 1*/
361 return 1;
363 EXPORT_SYMBOL(scsw_cmd_is_valid_fctl);
366 * scsw_cmd_is_valid_actl - check actl field validity
367 * @scsw: pointer to scsw
369 * Return non-zero if the actl field of the specified command mode scsw is
370 * valid, zero otherwise.
372 int scsw_cmd_is_valid_actl(union scsw *scsw)
374 /* Only valid if pmcw.dnv == 1*/
375 return 1;
377 EXPORT_SYMBOL(scsw_cmd_is_valid_actl);
380 * scsw_cmd_is_valid_stctl - check stctl field validity
381 * @scsw: pointer to scsw
383 * Return non-zero if the stctl field of the specified command mode scsw is
384 * valid, zero otherwise.
386 int scsw_cmd_is_valid_stctl(union scsw *scsw)
388 /* Only valid if pmcw.dnv == 1*/
389 return 1;
391 EXPORT_SYMBOL(scsw_cmd_is_valid_stctl);
394 * scsw_cmd_is_valid_dstat - check dstat field validity
395 * @scsw: pointer to scsw
397 * Return non-zero if the dstat field of the specified command mode scsw is
398 * valid, zero otherwise.
400 int scsw_cmd_is_valid_dstat(union scsw *scsw)
402 return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
403 (scsw->cmd.cc != 3);
405 EXPORT_SYMBOL(scsw_cmd_is_valid_dstat);
408 * scsw_cmd_is_valid_cstat - check cstat field validity
409 * @scsw: pointer to scsw
411 * Return non-zero if the cstat field of the specified command mode scsw is
412 * valid, zero otherwise.
414 int scsw_cmd_is_valid_cstat(union scsw *scsw)
416 return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
417 (scsw->cmd.cc != 3);
419 EXPORT_SYMBOL(scsw_cmd_is_valid_cstat);
422 * scsw_tm_is_valid_key - check key field validity
423 * @scsw: pointer to scsw
425 * Return non-zero if the key field of the specified transport mode scsw is
426 * valid, zero otherwise.
428 int scsw_tm_is_valid_key(union scsw *scsw)
430 return (scsw->tm.fctl & SCSW_FCTL_START_FUNC);
432 EXPORT_SYMBOL(scsw_tm_is_valid_key);
435 * scsw_tm_is_valid_eswf - check eswf field validity
436 * @scsw: pointer to scsw
438 * Return non-zero if the eswf field of the specified transport mode scsw is
439 * valid, zero otherwise.
441 int scsw_tm_is_valid_eswf(union scsw *scsw)
443 return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND);
445 EXPORT_SYMBOL(scsw_tm_is_valid_eswf);
448 * scsw_tm_is_valid_cc - check cc field validity
449 * @scsw: pointer to scsw
451 * Return non-zero if the cc field of the specified transport mode scsw is
452 * valid, zero otherwise.
454 int scsw_tm_is_valid_cc(union scsw *scsw)
456 return (scsw->tm.fctl & SCSW_FCTL_START_FUNC) &&
457 (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND);
459 EXPORT_SYMBOL(scsw_tm_is_valid_cc);
462 * scsw_tm_is_valid_fmt - check fmt field validity
463 * @scsw: pointer to scsw
465 * Return non-zero if the fmt field of the specified transport mode scsw is
466 * valid, zero otherwise.
468 int scsw_tm_is_valid_fmt(union scsw *scsw)
470 return 1;
472 EXPORT_SYMBOL(scsw_tm_is_valid_fmt);
475 * scsw_tm_is_valid_x - check x field validity
476 * @scsw: pointer to scsw
478 * Return non-zero if the x field of the specified transport mode scsw is
479 * valid, zero otherwise.
481 int scsw_tm_is_valid_x(union scsw *scsw)
483 return 1;
485 EXPORT_SYMBOL(scsw_tm_is_valid_x);
488 * scsw_tm_is_valid_q - check q field validity
489 * @scsw: pointer to scsw
491 * Return non-zero if the q field of the specified transport mode scsw is
492 * valid, zero otherwise.
494 int scsw_tm_is_valid_q(union scsw *scsw)
496 return 1;
498 EXPORT_SYMBOL(scsw_tm_is_valid_q);
501 * scsw_tm_is_valid_ectl - check ectl field validity
502 * @scsw: pointer to scsw
504 * Return non-zero if the ectl field of the specified transport mode scsw is
505 * valid, zero otherwise.
507 int scsw_tm_is_valid_ectl(union scsw *scsw)
509 return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
510 !(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) &&
511 (scsw->tm.stctl & SCSW_STCTL_ALERT_STATUS);
513 EXPORT_SYMBOL(scsw_tm_is_valid_ectl);
516 * scsw_tm_is_valid_pno - check pno field validity
517 * @scsw: pointer to scsw
519 * Return non-zero if the pno field of the specified transport mode scsw is
520 * valid, zero otherwise.
522 int scsw_tm_is_valid_pno(union scsw *scsw)
524 return (scsw->tm.fctl != 0) &&
525 (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
526 (!(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) ||
527 ((scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) &&
528 (scsw->tm.actl & SCSW_ACTL_SUSPENDED)));
530 EXPORT_SYMBOL(scsw_tm_is_valid_pno);
533 * scsw_tm_is_valid_fctl - check fctl field validity
534 * @scsw: pointer to scsw
536 * Return non-zero if the fctl field of the specified transport mode scsw is
537 * valid, zero otherwise.
539 int scsw_tm_is_valid_fctl(union scsw *scsw)
541 /* Only valid if pmcw.dnv == 1*/
542 return 1;
544 EXPORT_SYMBOL(scsw_tm_is_valid_fctl);
547 * scsw_tm_is_valid_actl - check actl field validity
548 * @scsw: pointer to scsw
550 * Return non-zero if the actl field of the specified transport mode scsw is
551 * valid, zero otherwise.
553 int scsw_tm_is_valid_actl(union scsw *scsw)
555 /* Only valid if pmcw.dnv == 1*/
556 return 1;
558 EXPORT_SYMBOL(scsw_tm_is_valid_actl);
561 * scsw_tm_is_valid_stctl - check stctl field validity
562 * @scsw: pointer to scsw
564 * Return non-zero if the stctl field of the specified transport mode scsw is
565 * valid, zero otherwise.
567 int scsw_tm_is_valid_stctl(union scsw *scsw)
569 /* Only valid if pmcw.dnv == 1*/
570 return 1;
572 EXPORT_SYMBOL(scsw_tm_is_valid_stctl);
575 * scsw_tm_is_valid_dstat - check dstat field validity
576 * @scsw: pointer to scsw
578 * Return non-zero if the dstat field of the specified transport mode scsw is
579 * valid, zero otherwise.
581 int scsw_tm_is_valid_dstat(union scsw *scsw)
583 return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
584 (scsw->tm.cc != 3);
586 EXPORT_SYMBOL(scsw_tm_is_valid_dstat);
589 * scsw_tm_is_valid_cstat - check cstat field validity
590 * @scsw: pointer to scsw
592 * Return non-zero if the cstat field of the specified transport mode scsw is
593 * valid, zero otherwise.
595 int scsw_tm_is_valid_cstat(union scsw *scsw)
597 return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
598 (scsw->tm.cc != 3);
600 EXPORT_SYMBOL(scsw_tm_is_valid_cstat);
603 * scsw_tm_is_valid_fcxs - check fcxs field validity
604 * @scsw: pointer to scsw
606 * Return non-zero if the fcxs field of the specified transport mode scsw is
607 * valid, zero otherwise.
609 int scsw_tm_is_valid_fcxs(union scsw *scsw)
611 return 1;
613 EXPORT_SYMBOL(scsw_tm_is_valid_fcxs);
616 * scsw_tm_is_valid_schxs - check schxs field validity
617 * @scsw: pointer to scsw
619 * Return non-zero if the schxs field of the specified transport mode scsw is
620 * valid, zero otherwise.
622 int scsw_tm_is_valid_schxs(union scsw *scsw)
624 return (scsw->tm.cstat & (SCHN_STAT_PROG_CHECK |
625 SCHN_STAT_INTF_CTRL_CHK |
626 SCHN_STAT_PROT_CHECK |
627 SCHN_STAT_CHN_DATA_CHK));
629 EXPORT_SYMBOL(scsw_tm_is_valid_schxs);
632 * scsw_is_valid_actl - check actl field validity
633 * @scsw: pointer to scsw
635 * Return non-zero if the actl field of the specified scsw is valid,
636 * regardless of whether it is a transport mode or command mode scsw.
637 * Return zero if the field does not contain a valid value.
639 int scsw_is_valid_actl(union scsw *scsw)
641 if (scsw_is_tm(scsw))
642 return scsw_tm_is_valid_actl(scsw);
643 else
644 return scsw_cmd_is_valid_actl(scsw);
646 EXPORT_SYMBOL(scsw_is_valid_actl);
649 * scsw_is_valid_cc - check cc field validity
650 * @scsw: pointer to scsw
652 * Return non-zero if the cc field of the specified scsw is valid,
653 * regardless of whether it is a transport mode or command mode scsw.
654 * Return zero if the field does not contain a valid value.
656 int scsw_is_valid_cc(union scsw *scsw)
658 if (scsw_is_tm(scsw))
659 return scsw_tm_is_valid_cc(scsw);
660 else
661 return scsw_cmd_is_valid_cc(scsw);
663 EXPORT_SYMBOL(scsw_is_valid_cc);
666 * scsw_is_valid_cstat - check cstat field validity
667 * @scsw: pointer to scsw
669 * Return non-zero if the cstat field of the specified scsw is valid,
670 * regardless of whether it is a transport mode or command mode scsw.
671 * Return zero if the field does not contain a valid value.
673 int scsw_is_valid_cstat(union scsw *scsw)
675 if (scsw_is_tm(scsw))
676 return scsw_tm_is_valid_cstat(scsw);
677 else
678 return scsw_cmd_is_valid_cstat(scsw);
680 EXPORT_SYMBOL(scsw_is_valid_cstat);
683 * scsw_is_valid_dstat - check dstat field validity
684 * @scsw: pointer to scsw
686 * Return non-zero if the dstat field of the specified scsw is valid,
687 * regardless of whether it is a transport mode or command mode scsw.
688 * Return zero if the field does not contain a valid value.
690 int scsw_is_valid_dstat(union scsw *scsw)
692 if (scsw_is_tm(scsw))
693 return scsw_tm_is_valid_dstat(scsw);
694 else
695 return scsw_cmd_is_valid_dstat(scsw);
697 EXPORT_SYMBOL(scsw_is_valid_dstat);
700 * scsw_is_valid_ectl - check ectl field validity
701 * @scsw: pointer to scsw
703 * Return non-zero if the ectl field of the specified scsw is valid,
704 * regardless of whether it is a transport mode or command mode scsw.
705 * Return zero if the field does not contain a valid value.
707 int scsw_is_valid_ectl(union scsw *scsw)
709 if (scsw_is_tm(scsw))
710 return scsw_tm_is_valid_ectl(scsw);
711 else
712 return scsw_cmd_is_valid_ectl(scsw);
714 EXPORT_SYMBOL(scsw_is_valid_ectl);
717 * scsw_is_valid_eswf - check eswf field validity
718 * @scsw: pointer to scsw
720 * Return non-zero if the eswf field of the specified scsw is valid,
721 * regardless of whether it is a transport mode or command mode scsw.
722 * Return zero if the field does not contain a valid value.
724 int scsw_is_valid_eswf(union scsw *scsw)
726 if (scsw_is_tm(scsw))
727 return scsw_tm_is_valid_eswf(scsw);
728 else
729 return scsw_cmd_is_valid_eswf(scsw);
731 EXPORT_SYMBOL(scsw_is_valid_eswf);
734 * scsw_is_valid_fctl - check fctl field validity
735 * @scsw: pointer to scsw
737 * Return non-zero if the fctl field of the specified scsw is valid,
738 * regardless of whether it is a transport mode or command mode scsw.
739 * Return zero if the field does not contain a valid value.
741 int scsw_is_valid_fctl(union scsw *scsw)
743 if (scsw_is_tm(scsw))
744 return scsw_tm_is_valid_fctl(scsw);
745 else
746 return scsw_cmd_is_valid_fctl(scsw);
748 EXPORT_SYMBOL(scsw_is_valid_fctl);
751 * scsw_is_valid_key - check key field validity
752 * @scsw: pointer to scsw
754 * Return non-zero if the key field of the specified scsw is valid,
755 * regardless of whether it is a transport mode or command mode scsw.
756 * Return zero if the field does not contain a valid value.
758 int scsw_is_valid_key(union scsw *scsw)
760 if (scsw_is_tm(scsw))
761 return scsw_tm_is_valid_key(scsw);
762 else
763 return scsw_cmd_is_valid_key(scsw);
765 EXPORT_SYMBOL(scsw_is_valid_key);
768 * scsw_is_valid_pno - check pno field validity
769 * @scsw: pointer to scsw
771 * Return non-zero if the pno field of the specified scsw is valid,
772 * regardless of whether it is a transport mode or command mode scsw.
773 * Return zero if the field does not contain a valid value.
775 int scsw_is_valid_pno(union scsw *scsw)
777 if (scsw_is_tm(scsw))
778 return scsw_tm_is_valid_pno(scsw);
779 else
780 return scsw_cmd_is_valid_pno(scsw);
782 EXPORT_SYMBOL(scsw_is_valid_pno);
785 * scsw_is_valid_stctl - check stctl field validity
786 * @scsw: pointer to scsw
788 * Return non-zero if the stctl field of the specified scsw is valid,
789 * regardless of whether it is a transport mode or command mode scsw.
790 * Return zero if the field does not contain a valid value.
792 int scsw_is_valid_stctl(union scsw *scsw)
794 if (scsw_is_tm(scsw))
795 return scsw_tm_is_valid_stctl(scsw);
796 else
797 return scsw_cmd_is_valid_stctl(scsw);
799 EXPORT_SYMBOL(scsw_is_valid_stctl);
802 * scsw_cmd_is_solicited - check for solicited scsw
803 * @scsw: pointer to scsw
805 * Return non-zero if the command mode scsw indicates that the associated
806 * status condition is solicited, zero if it is unsolicited.
808 int scsw_cmd_is_solicited(union scsw *scsw)
810 return (scsw->cmd.cc != 0) || (scsw->cmd.stctl !=
811 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS));
813 EXPORT_SYMBOL(scsw_cmd_is_solicited);
816 * scsw_tm_is_solicited - check for solicited scsw
817 * @scsw: pointer to scsw
819 * Return non-zero if the transport mode scsw indicates that the associated
820 * status condition is solicited, zero if it is unsolicited.
822 int scsw_tm_is_solicited(union scsw *scsw)
824 return (scsw->tm.cc != 0) || (scsw->tm.stctl !=
825 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS));
827 EXPORT_SYMBOL(scsw_tm_is_solicited);
830 * scsw_is_solicited - check for solicited scsw
831 * @scsw: pointer to scsw
833 * Return non-zero if the transport or command mode scsw indicates that the
834 * associated status condition is solicited, zero if it is unsolicited.
836 int scsw_is_solicited(union scsw *scsw)
838 if (scsw_is_tm(scsw))
839 return scsw_tm_is_solicited(scsw);
840 else
841 return scsw_cmd_is_solicited(scsw);
843 EXPORT_SYMBOL(scsw_is_solicited);