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