Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * include/asm-s390/cio.h |
| 3 | * include/asm-s390x/cio.h |
| 4 | * |
| 5 | * Common interface for I/O on S/390 |
| 6 | */ |
| 7 | #ifndef _ASM_S390_CIO_H_ |
| 8 | #define _ASM_S390_CIO_H_ |
| 9 | |
| 10 | #include <linux/spinlock.h> |
| 11 | #include <asm/types.h> |
| 12 | |
| 13 | #ifdef __KERNEL__ |
| 14 | |
| 15 | #define LPM_ANYPATH 0xff |
Peter Oberparleiter | e5854a5 | 2007-04-27 16:01:31 +0200 | [diff] [blame] | 16 | #define __MAX_CSSID 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 18 | /** |
Peter Oberparleiter | 23d805b | 2008-07-14 09:58:50 +0200 | [diff] [blame] | 19 | * struct cmd_scsw - command-mode subchannel status word |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 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 |
Joe Perches | 5800266 | 2008-01-26 14:11:19 +0100 | [diff] [blame] | 27 | * @alcc: address-limit checking control |
| 28 | * @ssi: suppress-suspended interruption |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | */ |
Peter Oberparleiter | 23d805b | 2008-07-14 09:58:50 +0200 | [diff] [blame] | 41 | struct cmd_scsw { |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 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; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | } __attribute__ ((packed)); |
| 63 | |
Peter Oberparleiter | 23d805b | 2008-07-14 09:58:50 +0200 | [diff] [blame] | 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 | */ |
| 83 | struct 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 | */ |
| 110 | union scsw { |
| 111 | struct cmd_scsw cmd; |
| 112 | struct tm_scsw tm; |
| 113 | } __attribute__ ((packed)); |
| 114 | |
| 115 | int scsw_is_tm(union scsw *scsw); |
| 116 | u32 scsw_key(union scsw *scsw); |
| 117 | u32 scsw_eswf(union scsw *scsw); |
| 118 | u32 scsw_cc(union scsw *scsw); |
| 119 | u32 scsw_ectl(union scsw *scsw); |
| 120 | u32 scsw_pno(union scsw *scsw); |
| 121 | u32 scsw_fctl(union scsw *scsw); |
| 122 | u32 scsw_actl(union scsw *scsw); |
| 123 | u32 scsw_stctl(union scsw *scsw); |
| 124 | u32 scsw_dstat(union scsw *scsw); |
| 125 | u32 scsw_cstat(union scsw *scsw); |
| 126 | int scsw_is_solicited(union scsw *scsw); |
| 127 | int scsw_is_valid_key(union scsw *scsw); |
| 128 | int scsw_is_valid_eswf(union scsw *scsw); |
| 129 | int scsw_is_valid_cc(union scsw *scsw); |
| 130 | int scsw_is_valid_ectl(union scsw *scsw); |
| 131 | int scsw_is_valid_pno(union scsw *scsw); |
| 132 | int scsw_is_valid_fctl(union scsw *scsw); |
| 133 | int scsw_is_valid_actl(union scsw *scsw); |
| 134 | int scsw_is_valid_stctl(union scsw *scsw); |
| 135 | int scsw_is_valid_dstat(union scsw *scsw); |
| 136 | int scsw_is_valid_cstat(union scsw *scsw); |
| 137 | int scsw_cmd_is_valid_key(union scsw *scsw); |
| 138 | int scsw_cmd_is_valid_sctl(union scsw *scsw); |
| 139 | int scsw_cmd_is_valid_eswf(union scsw *scsw); |
| 140 | int scsw_cmd_is_valid_cc(union scsw *scsw); |
| 141 | int scsw_cmd_is_valid_fmt(union scsw *scsw); |
| 142 | int scsw_cmd_is_valid_pfch(union scsw *scsw); |
| 143 | int scsw_cmd_is_valid_isic(union scsw *scsw); |
| 144 | int scsw_cmd_is_valid_alcc(union scsw *scsw); |
| 145 | int scsw_cmd_is_valid_ssi(union scsw *scsw); |
| 146 | int scsw_cmd_is_valid_zcc(union scsw *scsw); |
| 147 | int scsw_cmd_is_valid_ectl(union scsw *scsw); |
| 148 | int scsw_cmd_is_valid_pno(union scsw *scsw); |
| 149 | int scsw_cmd_is_valid_fctl(union scsw *scsw); |
| 150 | int scsw_cmd_is_valid_actl(union scsw *scsw); |
| 151 | int scsw_cmd_is_valid_stctl(union scsw *scsw); |
| 152 | int scsw_cmd_is_valid_dstat(union scsw *scsw); |
| 153 | int scsw_cmd_is_valid_cstat(union scsw *scsw); |
| 154 | int scsw_cmd_is_solicited(union scsw *scsw); |
| 155 | int scsw_tm_is_valid_key(union scsw *scsw); |
| 156 | int scsw_tm_is_valid_eswf(union scsw *scsw); |
| 157 | int scsw_tm_is_valid_cc(union scsw *scsw); |
| 158 | int scsw_tm_is_valid_fmt(union scsw *scsw); |
| 159 | int scsw_tm_is_valid_x(union scsw *scsw); |
| 160 | int scsw_tm_is_valid_q(union scsw *scsw); |
| 161 | int scsw_tm_is_valid_ectl(union scsw *scsw); |
| 162 | int scsw_tm_is_valid_pno(union scsw *scsw); |
| 163 | int scsw_tm_is_valid_fctl(union scsw *scsw); |
| 164 | int scsw_tm_is_valid_actl(union scsw *scsw); |
| 165 | int scsw_tm_is_valid_stctl(union scsw *scsw); |
| 166 | int scsw_tm_is_valid_dstat(union scsw *scsw); |
| 167 | int scsw_tm_is_valid_cstat(union scsw *scsw); |
| 168 | int scsw_tm_is_valid_fcxs(union scsw *scsw); |
| 169 | int scsw_tm_is_valid_schxs(union scsw *scsw); |
| 170 | int scsw_tm_is_solicited(union scsw *scsw); |
| 171 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 241 | /** |
| 242 | * struct ccw1 - channel command word |
| 243 | * @cmd_code: command code |
| 244 | * @flags: flags, like IDA adressing, etc. |
| 245 | * @count: byte count |
| 246 | * @cda: data address |
| 247 | * |
| 248 | * The ccw is the basic structure to build channel programs that perform |
| 249 | * operations with the device or the control unit. Only Format-1 channel |
| 250 | * command words are supported. |
| 251 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | struct ccw1 { |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 253 | __u8 cmd_code; |
| 254 | __u8 flags; |
| 255 | __u16 count; |
| 256 | __u32 cda; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | } __attribute__ ((packed,aligned(8))); |
| 258 | |
| 259 | #define CCW_FLAG_DC 0x80 |
| 260 | #define CCW_FLAG_CC 0x40 |
| 261 | #define CCW_FLAG_SLI 0x20 |
| 262 | #define CCW_FLAG_SKIP 0x10 |
| 263 | #define CCW_FLAG_PCI 0x08 |
| 264 | #define CCW_FLAG_IDA 0x04 |
| 265 | #define CCW_FLAG_SUSPEND 0x02 |
| 266 | |
| 267 | #define CCW_CMD_READ_IPL 0x02 |
| 268 | #define CCW_CMD_NOOP 0x03 |
| 269 | #define CCW_CMD_BASIC_SENSE 0x04 |
| 270 | #define CCW_CMD_TIC 0x08 |
| 271 | #define CCW_CMD_STLCK 0x14 |
| 272 | #define CCW_CMD_SENSE_PGID 0x34 |
| 273 | #define CCW_CMD_SUSPEND_RECONN 0x5B |
| 274 | #define CCW_CMD_RDC 0x64 |
| 275 | #define CCW_CMD_RELEASE 0x94 |
| 276 | #define CCW_CMD_SET_PGID 0xAF |
| 277 | #define CCW_CMD_SENSE_ID 0xE4 |
| 278 | #define CCW_CMD_DCTL 0xF3 |
| 279 | |
| 280 | #define SENSE_MAX_COUNT 0x20 |
| 281 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 282 | /** |
| 283 | * struct erw - extended report word |
| 284 | * @res0: reserved |
| 285 | * @auth: authorization check |
| 286 | * @pvrf: path-verification-required flag |
| 287 | * @cpt: channel-path timeout |
| 288 | * @fsavf: failing storage address validity flag |
| 289 | * @cons: concurrent sense |
| 290 | * @scavf: secondary ccw address validity flag |
| 291 | * @fsaf: failing storage address format |
| 292 | * @scnt: sense count, if @cons == %1 |
| 293 | * @res16: reserved |
| 294 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | struct erw { |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 296 | __u32 res0 : 3; |
| 297 | __u32 auth : 1; |
| 298 | __u32 pvrf : 1; |
| 299 | __u32 cpt : 1; |
| 300 | __u32 fsavf : 1; |
| 301 | __u32 cons : 1; |
| 302 | __u32 scavf : 1; |
| 303 | __u32 fsaf : 1; |
| 304 | __u32 scnt : 6; |
| 305 | __u32 res16 : 16; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | } __attribute__ ((packed)); |
| 307 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 308 | /** |
| 309 | * struct sublog - subchannel logout area |
| 310 | * @res0: reserved |
| 311 | * @esf: extended status flags |
| 312 | * @lpum: last path used mask |
| 313 | * @arep: ancillary report |
| 314 | * @fvf: field-validity flags |
| 315 | * @sacc: storage access code |
| 316 | * @termc: termination code |
| 317 | * @devsc: device-status check |
| 318 | * @serr: secondary error |
| 319 | * @ioerr: i/o-error alert |
| 320 | * @seqc: sequence code |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | */ |
| 322 | struct sublog { |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 323 | __u32 res0 : 1; |
| 324 | __u32 esf : 7; |
| 325 | __u32 lpum : 8; |
| 326 | __u32 arep : 1; |
| 327 | __u32 fvf : 5; |
| 328 | __u32 sacc : 2; |
| 329 | __u32 termc : 2; |
| 330 | __u32 devsc : 1; |
| 331 | __u32 serr : 1; |
| 332 | __u32 ioerr : 1; |
| 333 | __u32 seqc : 3; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | } __attribute__ ((packed)); |
| 335 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 336 | /** |
| 337 | * struct esw0 - Format 0 Extended Status Word (ESW) |
| 338 | * @sublog: subchannel logout |
| 339 | * @erw: extended report word |
| 340 | * @faddr: failing storage address |
| 341 | * @saddr: secondary ccw address |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | */ |
| 343 | struct esw0 { |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 344 | struct sublog sublog; |
| 345 | struct erw erw; |
| 346 | __u32 faddr[2]; |
| 347 | __u32 saddr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | } __attribute__ ((packed)); |
| 349 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 350 | /** |
| 351 | * struct esw1 - Format 1 Extended Status Word (ESW) |
| 352 | * @zero0: reserved zeros |
| 353 | * @lpum: last path used mask |
| 354 | * @zero16: reserved zeros |
| 355 | * @erw: extended report word |
| 356 | * @zeros: three fullwords of zeros |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | */ |
| 358 | struct esw1 { |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 359 | __u8 zero0; |
| 360 | __u8 lpum; |
| 361 | __u16 zero16; |
| 362 | struct erw erw; |
| 363 | __u32 zeros[3]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | } __attribute__ ((packed)); |
| 365 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 366 | /** |
| 367 | * struct esw2 - Format 2 Extended Status Word (ESW) |
| 368 | * @zero0: reserved zeros |
| 369 | * @lpum: last path used mask |
| 370 | * @dcti: device-connect-time interval |
| 371 | * @erw: extended report word |
| 372 | * @zeros: three fullwords of zeros |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | */ |
| 374 | struct esw2 { |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 375 | __u8 zero0; |
| 376 | __u8 lpum; |
| 377 | __u16 dcti; |
| 378 | struct erw erw; |
| 379 | __u32 zeros[3]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 380 | } __attribute__ ((packed)); |
| 381 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 382 | /** |
| 383 | * struct esw3 - Format 3 Extended Status Word (ESW) |
| 384 | * @zero0: reserved zeros |
| 385 | * @lpum: last path used mask |
| 386 | * @res: reserved |
| 387 | * @erw: extended report word |
| 388 | * @zeros: three fullwords of zeros |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | */ |
| 390 | struct esw3 { |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 391 | __u8 zero0; |
| 392 | __u8 lpum; |
| 393 | __u16 res; |
| 394 | struct erw erw; |
| 395 | __u32 zeros[3]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | } __attribute__ ((packed)); |
| 397 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 398 | /** |
| 399 | * struct irb - interruption response block |
| 400 | * @scsw: subchannel status word |
| 401 | * @esw: extened status word, 4 formats |
| 402 | * @ecw: extended control word |
| 403 | * |
| 404 | * The irb that is handed to the device driver when an interrupt occurs. For |
| 405 | * solicited interrupts, the common I/O layer already performs checks whether |
| 406 | * a field is valid; a field not being valid is always passed as %0. |
| 407 | * If a unit check occured, @ecw may contain sense data; this is retrieved |
| 408 | * by the common I/O layer itself if the device doesn't support concurrent |
| 409 | * sense (so that the device driver never needs to perform basic sene itself). |
| 410 | * For unsolicited interrupts, the irb is passed as-is (expect for sense data, |
| 411 | * if applicable). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | */ |
| 413 | struct irb { |
Peter Oberparleiter | 23d805b | 2008-07-14 09:58:50 +0200 | [diff] [blame] | 414 | union scsw scsw; |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 415 | union { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 416 | struct esw0 esw0; |
| 417 | struct esw1 esw1; |
| 418 | struct esw2 esw2; |
| 419 | struct esw3 esw3; |
| 420 | } esw; |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 421 | __u8 ecw[32]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 422 | } __attribute__ ((packed,aligned(4))); |
| 423 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 424 | /** |
| 425 | * struct ciw - command information word (CIW) layout |
| 426 | * @et: entry type |
| 427 | * @reserved: reserved bits |
| 428 | * @ct: command type |
| 429 | * @cmd: command code |
| 430 | * @count: command count |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | */ |
| 432 | struct ciw { |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 433 | __u32 et : 2; |
| 434 | __u32 reserved : 2; |
| 435 | __u32 ct : 4; |
| 436 | __u32 cmd : 8; |
| 437 | __u32 count : 16; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | } __attribute__ ((packed)); |
| 439 | |
| 440 | #define CIW_TYPE_RCD 0x0 /* read configuration data */ |
| 441 | #define CIW_TYPE_SII 0x1 /* set interface identifier */ |
| 442 | #define CIW_TYPE_RNI 0x2 /* read node identifier */ |
| 443 | |
| 444 | /* |
| 445 | * Flags used as input parameters for do_IO() |
| 446 | */ |
| 447 | #define DOIO_ALLOW_SUSPEND 0x0001 /* allow for channel prog. suspend */ |
| 448 | #define DOIO_DENY_PREFETCH 0x0002 /* don't allow for CCW prefetch */ |
| 449 | #define DOIO_SUPPRESS_INTER 0x0004 /* suppress intermediate inter. */ |
| 450 | /* ... for suspended CCWs */ |
| 451 | /* Device or subchannel gone. */ |
| 452 | #define CIO_GONE 0x0001 |
| 453 | /* No path to device. */ |
| 454 | #define CIO_NO_PATH 0x0002 |
| 455 | /* Device has appeared. */ |
| 456 | #define CIO_OPER 0x0004 |
| 457 | /* Sick revalidation of device. */ |
| 458 | #define CIO_REVALIDATE 0x0008 |
Sebastian Ott | 47593bf | 2009-03-31 19:16:05 +0200 | [diff] [blame] | 459 | /* Device did not respond in time. */ |
| 460 | #define CIO_BOXED 0x0010 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 462 | /** |
| 463 | * struct ccw_dev_id - unique identifier for ccw devices |
| 464 | * @ssid: subchannel set id |
| 465 | * @devno: device number |
| 466 | * |
| 467 | * This structure is not directly based on any hardware structure. The |
| 468 | * hardware identifies a device by its device number and its subchannel, |
| 469 | * which is in turn identified by its id. In order to get a unique identifier |
| 470 | * for ccw devices across subchannel sets, @struct ccw_dev_id has been |
| 471 | * introduced. |
| 472 | */ |
Michael Holzheu | ff6b8ea | 2006-09-20 15:58:49 +0200 | [diff] [blame] | 473 | struct ccw_dev_id { |
| 474 | u8 ssid; |
| 475 | u16 devno; |
| 476 | }; |
| 477 | |
Cornelia Huck | b2ffd8e | 2007-10-12 16:11:17 +0200 | [diff] [blame] | 478 | /** |
| 479 | * ccw_device_id_is_equal() - compare two ccw_dev_ids |
| 480 | * @dev_id1: a ccw_dev_id |
| 481 | * @dev_id2: another ccw_dev_id |
| 482 | * Returns: |
| 483 | * %1 if the two structures are equal field-by-field, |
| 484 | * %0 if not. |
| 485 | * Context: |
| 486 | * any |
| 487 | */ |
Cornelia Huck | 7896426 | 2006-10-11 15:31:38 +0200 | [diff] [blame] | 488 | static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1, |
| 489 | struct ccw_dev_id *dev_id2) |
| 490 | { |
Cornelia Huck | ce26a85 | 2006-12-04 15:40:54 +0100 | [diff] [blame] | 491 | if ((dev_id1->ssid == dev_id2->ssid) && |
| 492 | (dev_id1->devno == dev_id2->devno)) |
| 493 | return 1; |
| 494 | return 0; |
Cornelia Huck | 7896426 | 2006-10-11 15:31:38 +0200 | [diff] [blame] | 495 | } |
| 496 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 497 | extern void wait_cons_dev(void); |
| 498 | |
Peter Oberparleiter | 40154b8 | 2006-06-29 14:57:03 +0200 | [diff] [blame] | 499 | extern void css_schedule_reprobe(void); |
| 500 | |
Michael Holzheu | ff6b8ea | 2006-09-20 15:58:49 +0200 | [diff] [blame] | 501 | extern void reipl_ccw_dev(struct ccw_dev_id *id); |
| 502 | |
Heiko Carstens | 6fc321f | 2007-04-27 16:01:25 +0200 | [diff] [blame] | 503 | struct cio_iplinfo { |
| 504 | u16 devno; |
| 505 | int is_qdio; |
| 506 | }; |
| 507 | |
| 508 | extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo); |
| 509 | |
Heiko Carstens | a806170 | 2008-04-17 07:46:26 +0200 | [diff] [blame] | 510 | /* Function from drivers/s390/cio/chsc.c */ |
| 511 | int chsc_sstpc(void *page, unsigned int op, u16 ctrl); |
| 512 | int chsc_sstpi(void *page, void *result, size_t size); |
| 513 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 514 | #endif |
| 515 | |
| 516 | #endif |