~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/s390/include/asm/scsw.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php