2 * Channel IO definitions
4 * Copyright (c) 2013 Alexander Graf <agraf@suse.de>
6 * Inspired by various s390 headers in Linux 3.9.
8 * This work is licensed under the terms of the GNU GPL, version 2 or (at
9 * your option) any later version. See the COPYING file in the top-level
17 * path management control word
20 __u32 intparm
; /* interruption parameter */
21 __u32 qf
: 1; /* qdio facility */
23 __u32 isc
: 3; /* interruption sublass */
24 __u32 res5
: 3; /* reserved zeros */
25 __u32 ena
: 1; /* enabled */
26 __u32 lm
: 2; /* limit mode */
27 __u32 mme
: 2; /* measurement-mode enable */
28 __u32 mp
: 1; /* multipath mode */
29 __u32 tf
: 1; /* timing facility */
30 __u32 dnv
: 1; /* device number valid */
31 __u32 dev
: 16; /* device number */
32 __u8 lpm
; /* logical path mask */
33 __u8 pnom
; /* path not operational mask */
34 __u8 lpum
; /* last path used mask */
35 __u8 pim
; /* path installed mask */
36 __u16 mbi
; /* measurement-block index */
37 __u8 pom
; /* path operational mask */
38 __u8 pam
; /* path available mask */
39 __u8 chpid
[8]; /* CHPID 0-7 (if available) */
40 __u32 unused1
: 8; /* reserved zeros */
41 __u32 st
: 3; /* subchannel type */
42 __u32 unused2
: 18; /* reserved zeros */
43 __u32 mbfc
: 1; /* measurement block format control */
44 __u32 xmwme
: 1; /* extended measurement word mode enable */
45 __u32 csense
: 1; /* concurrent sense; can be enabled ...*/
46 /* ... per MSCH, however, if facility */
47 /* ... is not installed, this results */
48 /* ... in an operand exception. */
49 } __attribute__ ((packed
));
51 /* Target SCHIB configuration. */
62 } __attribute__ ((packed
));
71 } __attribute__ ((packed
));
73 #define SCSW_FCTL_CLEAR_FUNC 0x1000
74 #define SCSW_FCTL_HALT_FUNC 0x2000
75 #define SCSW_FCTL_START_FUNC 0x4000
78 * subchannel information block
81 struct pmcw pmcw
; /* path management control word */
82 struct scsw scsw
; /* subchannel status word */
83 __u64 mba
; /* measurement block address */
84 __u8 mda
[4]; /* model dependent area */
85 } __attribute__ ((packed
,aligned(4)));
87 struct subchannel_id
{
94 } __attribute__ ((packed
, aligned(4)));
99 } __attribute__((packed
));
101 struct chsc_area_sda
{
102 struct chsc_header request
;
106 __u16 operation_code
;
109 __u32 operation_data_area
[252];
110 struct chsc_header response
;
114 } __attribute__((packed
));
120 struct subchannel_id schid
;
121 __u32 intparm
; /* interruption parameter */
122 __u32 adapter_IO
: 1;
125 __u32 reserved3
: 12;
127 __u32 reserved4
: 12;
128 } __attribute__ ((packed
));
130 /* channel command word (type 1) */
136 } __attribute__ ((packed
));
138 #define CCW_FLAG_DC 0x80
139 #define CCW_FLAG_CC 0x40
140 #define CCW_FLAG_SLI 0x20
141 #define CCW_FLAG_SKIP 0x10
142 #define CCW_FLAG_PCI 0x08
143 #define CCW_FLAG_IDA 0x04
144 #define CCW_FLAG_SUSPEND 0x02
146 #define CCW_CMD_NOOP 0x03
147 #define CCW_CMD_BASIC_SENSE 0x04
148 #define CCW_CMD_TIC 0x08
149 #define CCW_CMD_SENSE_ID 0xe4
151 #define CCW_CMD_SET_VQ 0x13
152 #define CCW_CMD_VDEV_RESET 0x33
153 #define CCW_CMD_READ_FEAT 0x12
154 #define CCW_CMD_WRITE_FEAT 0x11
155 #define CCW_CMD_READ_CONF 0x22
156 #define CCW_CMD_WRITE_CONF 0x21
157 #define CCW_CMD_WRITE_STATUS 0x31
158 #define CCW_CMD_SET_IND 0x43
159 #define CCW_CMD_SET_CONF_IND 0x53
160 #define CCW_CMD_READ_VQ_CONF 0x32
163 * Command-mode operation request block
166 __u32 intparm
; /* interruption parameter */
167 __u32 key
:4; /* flags, like key, suspend control, etc. */
168 __u32 spnd
:1; /* suspend control */
169 __u32 res1
:1; /* reserved */
170 __u32 mod
:1; /* modification control */
171 __u32 sync
:1; /* synchronize control */
172 __u32 fmt
:1; /* format control */
173 __u32 pfch
:1; /* prefetch control */
174 __u32 isic
:1; /* initial-status-interruption control */
175 __u32 alcc
:1; /* address-limit-checking control */
176 __u32 ssic
:1; /* suppress-suspended-interr. control */
177 __u32 res2
:1; /* reserved */
178 __u32 c64
:1; /* IDAW/QDIO 64 bit control */
179 __u32 i2k
:1; /* IDAW 2/4kB block size control */
180 __u32 lpm
:8; /* logical path mask */
181 __u32 ils
:1; /* incorrect length */
182 __u32 zero
:6; /* reserved zeros */
183 __u32 orbx
:1; /* ORB extension control */
184 __u32 cpa
; /* channel program address */
185 } __attribute__ ((packed
, aligned(4)));
194 * sense-id response buffer layout
198 __u8 reserved
; /* always 0x'FF' */
199 __u16 cu_type
; /* control unit type */
200 __u8 cu_model
; /* control unit model */
201 __u16 dev_type
; /* device type */
202 __u8 dev_model
; /* device model */
203 __u8 unused
; /* padding byte */
206 } __attribute__ ((packed
, aligned(4)));
208 /* interruption response block */
214 } __attribute__ ((packed
, aligned(4)));
217 * Some S390 specific IO instructions as inline
220 static inline int stsch_err(struct subchannel_id schid
, struct schib
*addr
)
222 register struct subchannel_id reg1
asm ("1") = schid
;
230 : "+d" (ccode
), "=m" (*addr
)
231 : "d" (reg1
), "a" (addr
)
236 static inline int msch(struct subchannel_id schid
, struct schib
*addr
)
238 register struct subchannel_id reg1
asm ("1") = schid
;
246 : "d" (reg1
), "a" (addr
), "m" (*addr
)
251 static inline int msch_err(struct subchannel_id schid
, struct schib
*addr
)
253 register struct subchannel_id reg1
asm ("1") = schid
;
262 : "d" (reg1
), "a" (addr
), "m" (*addr
)
267 static inline int tsch(struct subchannel_id schid
, struct irb
*addr
)
269 register struct subchannel_id reg1
asm ("1") = schid
;
276 : "=d" (ccode
), "=m" (*addr
)
277 : "d" (reg1
), "a" (addr
)
282 static inline int ssch(struct subchannel_id schid
, struct cmd_orb
*addr
)
284 register struct subchannel_id reg1
asm("1") = schid
;
293 : "d" (reg1
), "a" (addr
), "m" (*addr
)
298 static inline int csch(struct subchannel_id schid
)
300 register struct subchannel_id reg1
asm("1") = schid
;
313 static inline int tpi(struct tpi_info
*addr
)
321 : "=d" (ccode
), "=m" (*addr
)
327 static inline int chsc(void *chsc_area
)
329 typedef struct { char _
[4096]; } addr_type
;
333 " .insn rre,0xb25f0000,%2,0\n"
336 : "=d" (cc
), "=m" (*(addr_type
*) chsc_area
)
337 : "d" (chsc_area
), "m" (*(addr_type
*) chsc_area
)