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)));
100 struct subchannel_id schid
;
101 __u32 intparm
; /* interruption parameter */
102 __u32 adapter_IO
: 1;
105 __u32 reserved3
: 12;
107 __u32 reserved4
: 12;
108 } __attribute__ ((packed
));
110 /* channel command word (type 1) */
116 } __attribute__ ((packed
));
118 #define CCW_FLAG_DC 0x80
119 #define CCW_FLAG_CC 0x40
120 #define CCW_FLAG_SLI 0x20
121 #define CCW_FLAG_SKIP 0x10
122 #define CCW_FLAG_PCI 0x08
123 #define CCW_FLAG_IDA 0x04
124 #define CCW_FLAG_SUSPEND 0x02
126 #define CCW_CMD_NOOP 0x03
127 #define CCW_CMD_BASIC_SENSE 0x04
128 #define CCW_CMD_TIC 0x08
129 #define CCW_CMD_SENSE_ID 0xe4
131 #define CCW_CMD_SET_VQ 0x13
132 #define CCW_CMD_VDEV_RESET 0x33
133 #define CCW_CMD_READ_FEAT 0x12
134 #define CCW_CMD_WRITE_FEAT 0x11
135 #define CCW_CMD_READ_CONF 0x22
136 #define CCW_CMD_WRITE_CONF 0x21
137 #define CCW_CMD_WRITE_STATUS 0x31
138 #define CCW_CMD_SET_IND 0x43
139 #define CCW_CMD_SET_CONF_IND 0x53
140 #define CCW_CMD_READ_VQ_CONF 0x32
143 * Command-mode operation request block
146 __u32 intparm
; /* interruption parameter */
147 __u32 key
:4; /* flags, like key, suspend control, etc. */
148 __u32 spnd
:1; /* suspend control */
149 __u32 res1
:1; /* reserved */
150 __u32 mod
:1; /* modification control */
151 __u32 sync
:1; /* synchronize control */
152 __u32 fmt
:1; /* format control */
153 __u32 pfch
:1; /* prefetch control */
154 __u32 isic
:1; /* initial-status-interruption control */
155 __u32 alcc
:1; /* address-limit-checking control */
156 __u32 ssic
:1; /* suppress-suspended-interr. control */
157 __u32 res2
:1; /* reserved */
158 __u32 c64
:1; /* IDAW/QDIO 64 bit control */
159 __u32 i2k
:1; /* IDAW 2/4kB block size control */
160 __u32 lpm
:8; /* logical path mask */
161 __u32 ils
:1; /* incorrect length */
162 __u32 zero
:6; /* reserved zeros */
163 __u32 orbx
:1; /* ORB extension control */
164 __u32 cpa
; /* channel program address */
165 } __attribute__ ((packed
, aligned(4)));
174 * sense-id response buffer layout
178 __u8 reserved
; /* always 0x'FF' */
179 __u16 cu_type
; /* control unit type */
180 __u8 cu_model
; /* control unit model */
181 __u16 dev_type
; /* device type */
182 __u8 dev_model
; /* device model */
183 __u8 unused
; /* padding byte */
186 } __attribute__ ((packed
, aligned(4)));
188 /* interruption response block */
194 } __attribute__ ((packed
, aligned(4)));
197 * Some S390 specific IO instructions as inline
200 static inline int stsch_err(struct subchannel_id schid
, struct schib
*addr
)
202 register struct subchannel_id reg1
asm ("1") = schid
;
210 : "+d" (ccode
), "=m" (*addr
)
211 : "d" (reg1
), "a" (addr
)
216 static inline int msch(struct subchannel_id schid
, struct schib
*addr
)
218 register struct subchannel_id reg1
asm ("1") = schid
;
226 : "d" (reg1
), "a" (addr
), "m" (*addr
)
231 static inline int msch_err(struct subchannel_id schid
, struct schib
*addr
)
233 register struct subchannel_id reg1
asm ("1") = schid
;
242 : "d" (reg1
), "a" (addr
), "m" (*addr
)
247 static inline int tsch(struct subchannel_id schid
, struct irb
*addr
)
249 register struct subchannel_id reg1
asm ("1") = schid
;
256 : "=d" (ccode
), "=m" (*addr
)
257 : "d" (reg1
), "a" (addr
)
262 static inline int ssch(struct subchannel_id schid
, struct cmd_orb
*addr
)
264 register struct subchannel_id reg1
asm("1") = schid
;
273 : "d" (reg1
), "a" (addr
), "m" (*addr
)
278 static inline int csch(struct subchannel_id schid
)
280 register struct subchannel_id reg1
asm("1") = schid
;
293 static inline int tpi(struct tpi_info
*addr
)
301 : "=d" (ccode
), "=m" (*addr
)
307 static inline int chsc(void *chsc_area
)
309 typedef struct { char _
[4096]; } addr_type
;
313 " .insn rre,0xb25f0000,%2,0\n"
316 : "=d" (cc
), "=m" (*(addr_type
*) chsc_area
)
317 : "d" (chsc_area
), "m" (*(addr_type
*) chsc_area
)