0001
0002
0003
0004
0005 #ifndef _ASM_S390_CIO_H_
0006 #define _ASM_S390_CIO_H_
0007
0008 #include <linux/bitops.h>
0009 #include <linux/genalloc.h>
0010 #include <asm/types.h>
0011 #include <asm/tpi.h>
0012
0013 #define LPM_ANYPATH 0xff
0014 #define __MAX_CSSID 0
0015 #define __MAX_SUBCHANNEL 65535
0016 #define __MAX_SSID 3
0017
0018 #include <asm/scsw.h>
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 struct ccw1 {
0032 __u8 cmd_code;
0033 __u8 flags;
0034 __u16 count;
0035 __u32 cda;
0036 } __attribute__ ((packed,aligned(8)));
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 struct ccw0 {
0049 __u8 cmd_code;
0050 __u32 cda : 24;
0051 __u8 flags;
0052 __u8 reserved;
0053 __u16 count;
0054 } __packed __aligned(8);
0055
0056 #define CCW_FLAG_DC 0x80
0057 #define CCW_FLAG_CC 0x40
0058 #define CCW_FLAG_SLI 0x20
0059 #define CCW_FLAG_SKIP 0x10
0060 #define CCW_FLAG_PCI 0x08
0061 #define CCW_FLAG_IDA 0x04
0062 #define CCW_FLAG_SUSPEND 0x02
0063
0064 #define CCW_CMD_READ_IPL 0x02
0065 #define CCW_CMD_NOOP 0x03
0066 #define CCW_CMD_BASIC_SENSE 0x04
0067 #define CCW_CMD_TIC 0x08
0068 #define CCW_CMD_STLCK 0x14
0069 #define CCW_CMD_SENSE_PGID 0x34
0070 #define CCW_CMD_SUSPEND_RECONN 0x5B
0071 #define CCW_CMD_RDC 0x64
0072 #define CCW_CMD_RELEASE 0x94
0073 #define CCW_CMD_SET_PGID 0xAF
0074 #define CCW_CMD_SENSE_ID 0xE4
0075 #define CCW_CMD_DCTL 0xF3
0076
0077 #define SENSE_MAX_COUNT 0x20
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092 struct erw {
0093 __u32 res0 : 3;
0094 __u32 auth : 1;
0095 __u32 pvrf : 1;
0096 __u32 cpt : 1;
0097 __u32 fsavf : 1;
0098 __u32 cons : 1;
0099 __u32 scavf : 1;
0100 __u32 fsaf : 1;
0101 __u32 scnt : 6;
0102 __u32 res16 : 16;
0103 } __attribute__ ((packed));
0104
0105
0106
0107
0108
0109
0110 struct erw_eadm {
0111 __u32 : 16;
0112 __u32 b : 1;
0113 __u32 r : 1;
0114 __u32 : 14;
0115 } __packed;
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131 struct sublog {
0132 __u32 res0 : 1;
0133 __u32 esf : 7;
0134 __u32 lpum : 8;
0135 __u32 arep : 1;
0136 __u32 fvf : 5;
0137 __u32 sacc : 2;
0138 __u32 termc : 2;
0139 __u32 devsc : 1;
0140 __u32 serr : 1;
0141 __u32 ioerr : 1;
0142 __u32 seqc : 3;
0143 } __attribute__ ((packed));
0144
0145
0146
0147
0148
0149
0150
0151
0152 struct esw0 {
0153 struct sublog sublog;
0154 struct erw erw;
0155 __u32 faddr[2];
0156 __u32 saddr;
0157 } __attribute__ ((packed));
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167 struct esw1 {
0168 __u8 zero0;
0169 __u8 lpum;
0170 __u16 zero16;
0171 struct erw erw;
0172 __u32 zeros[3];
0173 } __attribute__ ((packed));
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183 struct esw2 {
0184 __u8 zero0;
0185 __u8 lpum;
0186 __u16 dcti;
0187 struct erw erw;
0188 __u32 zeros[3];
0189 } __attribute__ ((packed));
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199 struct esw3 {
0200 __u8 zero0;
0201 __u8 lpum;
0202 __u16 res;
0203 struct erw erw;
0204 __u32 zeros[3];
0205 } __attribute__ ((packed));
0206
0207
0208
0209
0210
0211
0212 struct esw_eadm {
0213 __u32 sublog;
0214 struct erw_eadm erw;
0215 __u32 : 32;
0216 __u32 : 32;
0217 __u32 : 32;
0218 } __packed;
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235 struct irb {
0236 union scsw scsw;
0237 union {
0238 struct esw0 esw0;
0239 struct esw1 esw1;
0240 struct esw2 esw2;
0241 struct esw3 esw3;
0242 struct esw_eadm eadm;
0243 } esw;
0244 __u8 ecw[32];
0245 } __attribute__ ((packed,aligned(4)));
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255 struct ciw {
0256 __u32 et : 2;
0257 __u32 reserved : 2;
0258 __u32 ct : 4;
0259 __u32 cmd : 8;
0260 __u32 count : 16;
0261 } __attribute__ ((packed));
0262
0263 #define CIW_TYPE_RCD 0x0
0264 #define CIW_TYPE_SII 0x1
0265 #define CIW_TYPE_RNI 0x2
0266
0267
0268
0269
0270
0271 #define ND_VALIDITY_VALID 0
0272 #define ND_VALIDITY_OUTDATED 1
0273 #define ND_VALIDITY_INVALID 2
0274
0275 struct node_descriptor {
0276
0277 union {
0278 struct {
0279 u32 validity:3;
0280 u32 reserved:5;
0281 } __packed;
0282 u8 byte0;
0283 } __packed;
0284
0285
0286 u32 params:24;
0287
0288
0289 char type[6];
0290 char model[3];
0291 char manufacturer[3];
0292 char plant[2];
0293 char seq[12];
0294 u16 tag;
0295 } __packed;
0296
0297
0298
0299
0300 #define DOIO_ALLOW_SUSPEND 0x0001
0301 #define DOIO_DENY_PREFETCH 0x0002
0302 #define DOIO_SUPPRESS_INTER 0x0004
0303
0304
0305 #define CIO_GONE 0x0001
0306
0307 #define CIO_NO_PATH 0x0002
0308
0309 #define CIO_OPER 0x0004
0310
0311 #define CIO_REVALIDATE 0x0008
0312
0313 #define CIO_BOXED 0x0010
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326 struct ccw_dev_id {
0327 u8 ssid;
0328 u16 devno;
0329 };
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341 static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
0342 struct ccw_dev_id *dev_id2)
0343 {
0344 if ((dev_id1->ssid == dev_id2->ssid) &&
0345 (dev_id1->devno == dev_id2->devno))
0346 return 1;
0347 return 0;
0348 }
0349
0350
0351
0352
0353
0354 static inline u8 pathmask_to_pos(u8 mask)
0355 {
0356 return 8 - ffs(mask);
0357 }
0358
0359 extern void css_schedule_reprobe(void);
0360
0361 extern void *cio_dma_zalloc(size_t size);
0362 extern void cio_dma_free(void *cpu_addr, size_t size);
0363 extern struct device *cio_get_dma_css_dev(void);
0364
0365 void *cio_gp_dma_zalloc(struct gen_pool *gp_dma, struct device *dma_dev,
0366 size_t size);
0367 void cio_gp_dma_free(struct gen_pool *gp_dma, void *cpu_addr, size_t size);
0368 void cio_gp_dma_destroy(struct gen_pool *gp_dma, struct device *dma_dev);
0369 struct gen_pool *cio_gp_dma_create(struct device *dma_dev, int nr_pages);
0370
0371
0372 int chsc_sstpc(void *page, unsigned int op, u16 ctrl, long *clock_delta);
0373 int chsc_sstpi(void *page, void *result, size_t size);
0374 int chsc_stzi(void *page, void *result, size_t size);
0375 int chsc_sgib(u32 origin);
0376 int chsc_scud(u16 cu, u64 *esm, u8 *esm_valid);
0377
0378 #endif