cio.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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. #include <linux/spinlock.h>
  10. #include <asm/types.h>
  11. #ifdef __KERNEL__
  12. #define LPM_ANYPATH 0xff
  13. /*
  14. * subchannel status word
  15. */
  16. struct scsw {
  17. __u32 key : 4; /* subchannel key */
  18. __u32 sctl : 1; /* suspend control */
  19. __u32 eswf : 1; /* ESW format */
  20. __u32 cc : 2; /* deferred condition code */
  21. __u32 fmt : 1; /* format */
  22. __u32 pfch : 1; /* prefetch */
  23. __u32 isic : 1; /* initial-status interruption control */
  24. __u32 alcc : 1; /* address-limit checking control */
  25. __u32 ssi : 1; /* supress-suspended interruption */
  26. __u32 zcc : 1; /* zero condition code */
  27. __u32 ectl : 1; /* extended control */
  28. __u32 pno : 1; /* path not operational */
  29. __u32 res : 1; /* reserved */
  30. __u32 fctl : 3; /* function control */
  31. __u32 actl : 7; /* activity control */
  32. __u32 stctl : 5; /* status control */
  33. __u32 cpa; /* channel program address */
  34. __u32 dstat : 8; /* device status */
  35. __u32 cstat : 8; /* subchannel status */
  36. __u32 count : 16; /* residual count */
  37. } __attribute__ ((packed));
  38. #define SCSW_FCTL_CLEAR_FUNC 0x1
  39. #define SCSW_FCTL_HALT_FUNC 0x2
  40. #define SCSW_FCTL_START_FUNC 0x4
  41. #define SCSW_ACTL_SUSPENDED 0x1
  42. #define SCSW_ACTL_DEVACT 0x2
  43. #define SCSW_ACTL_SCHACT 0x4
  44. #define SCSW_ACTL_CLEAR_PEND 0x8
  45. #define SCSW_ACTL_HALT_PEND 0x10
  46. #define SCSW_ACTL_START_PEND 0x20
  47. #define SCSW_ACTL_RESUME_PEND 0x40
  48. #define SCSW_STCTL_STATUS_PEND 0x1
  49. #define SCSW_STCTL_SEC_STATUS 0x2
  50. #define SCSW_STCTL_PRIM_STATUS 0x4
  51. #define SCSW_STCTL_INTER_STATUS 0x8
  52. #define SCSW_STCTL_ALERT_STATUS 0x10
  53. #define DEV_STAT_ATTENTION 0x80
  54. #define DEV_STAT_STAT_MOD 0x40
  55. #define DEV_STAT_CU_END 0x20
  56. #define DEV_STAT_BUSY 0x10
  57. #define DEV_STAT_CHN_END 0x08
  58. #define DEV_STAT_DEV_END 0x04
  59. #define DEV_STAT_UNIT_CHECK 0x02
  60. #define DEV_STAT_UNIT_EXCEP 0x01
  61. #define SCHN_STAT_PCI 0x80
  62. #define SCHN_STAT_INCORR_LEN 0x40
  63. #define SCHN_STAT_PROG_CHECK 0x20
  64. #define SCHN_STAT_PROT_CHECK 0x10
  65. #define SCHN_STAT_CHN_DATA_CHK 0x08
  66. #define SCHN_STAT_CHN_CTRL_CHK 0x04
  67. #define SCHN_STAT_INTF_CTRL_CHK 0x02
  68. #define SCHN_STAT_CHAIN_CHECK 0x01
  69. /*
  70. * architectured values for first sense byte
  71. */
  72. #define SNS0_CMD_REJECT 0x80
  73. #define SNS_CMD_REJECT SNS0_CMD_REJEC
  74. #define SNS0_INTERVENTION_REQ 0x40
  75. #define SNS0_BUS_OUT_CHECK 0x20
  76. #define SNS0_EQUIPMENT_CHECK 0x10
  77. #define SNS0_DATA_CHECK 0x08
  78. #define SNS0_OVERRUN 0x04
  79. #define SNS0_INCOMPL_DOMAIN 0x01
  80. /*
  81. * architectured values for second sense byte
  82. */
  83. #define SNS1_PERM_ERR 0x80
  84. #define SNS1_INV_TRACK_FORMAT 0x40
  85. #define SNS1_EOC 0x20
  86. #define SNS1_MESSAGE_TO_OPER 0x10
  87. #define SNS1_NO_REC_FOUND 0x08
  88. #define SNS1_FILE_PROTECTED 0x04
  89. #define SNS1_WRITE_INHIBITED 0x02
  90. #define SNS1_INPRECISE_END 0x01
  91. /*
  92. * architectured values for third sense byte
  93. */
  94. #define SNS2_REQ_INH_WRITE 0x80
  95. #define SNS2_CORRECTABLE 0x40
  96. #define SNS2_FIRST_LOG_ERR 0x20
  97. #define SNS2_ENV_DATA_PRESENT 0x10
  98. #define SNS2_INPRECISE_END 0x04
  99. struct ccw1 {
  100. __u8 cmd_code; /* command code */
  101. __u8 flags; /* flags, like IDA addressing, etc. */
  102. __u16 count; /* byte count */
  103. __u32 cda; /* data address */
  104. } __attribute__ ((packed,aligned(8)));
  105. #define CCW_FLAG_DC 0x80
  106. #define CCW_FLAG_CC 0x40
  107. #define CCW_FLAG_SLI 0x20
  108. #define CCW_FLAG_SKIP 0x10
  109. #define CCW_FLAG_PCI 0x08
  110. #define CCW_FLAG_IDA 0x04
  111. #define CCW_FLAG_SUSPEND 0x02
  112. #define CCW_CMD_READ_IPL 0x02
  113. #define CCW_CMD_NOOP 0x03
  114. #define CCW_CMD_BASIC_SENSE 0x04
  115. #define CCW_CMD_TIC 0x08
  116. #define CCW_CMD_STLCK 0x14
  117. #define CCW_CMD_SENSE_PGID 0x34
  118. #define CCW_CMD_SUSPEND_RECONN 0x5B
  119. #define CCW_CMD_RDC 0x64
  120. #define CCW_CMD_RELEASE 0x94
  121. #define CCW_CMD_SET_PGID 0xAF
  122. #define CCW_CMD_SENSE_ID 0xE4
  123. #define CCW_CMD_DCTL 0xF3
  124. #define SENSE_MAX_COUNT 0x20
  125. struct erw {
  126. __u32 res0 : 3; /* reserved */
  127. __u32 auth : 1; /* Authorization check */
  128. __u32 pvrf : 1; /* path-verification-required flag */
  129. __u32 cpt : 1; /* channel-path timeout */
  130. __u32 fsavf : 1; /* Failing storage address validity flag */
  131. __u32 cons : 1; /* concurrent-sense */
  132. __u32 scavf : 1; /* Secondary ccw address validity flag */
  133. __u32 fsaf : 1; /* Failing storage address format */
  134. __u32 scnt : 6; /* sense count if cons == 1 */
  135. __u32 res16 : 16; /* reserved */
  136. } __attribute__ ((packed));
  137. /*
  138. * subchannel logout area
  139. */
  140. struct sublog {
  141. __u32 res0 : 1; /* reserved */
  142. __u32 esf : 7; /* extended status flags */
  143. __u32 lpum : 8; /* last path used mask */
  144. __u32 arep : 1; /* ancillary report */
  145. __u32 fvf : 5; /* field-validity flags */
  146. __u32 sacc : 2; /* storage access code */
  147. __u32 termc : 2; /* termination code */
  148. __u32 devsc : 1; /* device-status check */
  149. __u32 serr : 1; /* secondary error */
  150. __u32 ioerr : 1; /* i/o-error alert */
  151. __u32 seqc : 3; /* sequence code */
  152. } __attribute__ ((packed));
  153. /*
  154. * Format 0 Extended Status Word (ESW)
  155. */
  156. struct esw0 {
  157. struct sublog sublog; /* subchannel logout */
  158. struct erw erw; /* extended report word */
  159. __u32 faddr[2]; /* failing storage address */
  160. __u32 saddr; /* secondary ccw address */
  161. } __attribute__ ((packed));
  162. /*
  163. * Format 1 Extended Status Word (ESW)
  164. */
  165. struct esw1 {
  166. __u8 zero0; /* reserved zeros */
  167. __u8 lpum; /* last path used mask */
  168. __u16 zero16; /* reserved zeros */
  169. struct erw erw; /* extended report word */
  170. __u32 zeros[3]; /* 2 fullwords of zeros */
  171. } __attribute__ ((packed));
  172. /*
  173. * Format 2 Extended Status Word (ESW)
  174. */
  175. struct esw2 {
  176. __u8 zero0; /* reserved zeros */
  177. __u8 lpum; /* last path used mask */
  178. __u16 dcti; /* device-connect-time interval */
  179. struct erw erw; /* extended report word */
  180. __u32 zeros[3]; /* 2 fullwords of zeros */
  181. } __attribute__ ((packed));
  182. /*
  183. * Format 3 Extended Status Word (ESW)
  184. */
  185. struct esw3 {
  186. __u8 zero0; /* reserved zeros */
  187. __u8 lpum; /* last path used mask */
  188. __u16 res; /* reserved */
  189. struct erw erw; /* extended report word */
  190. __u32 zeros[3]; /* 2 fullwords of zeros */
  191. } __attribute__ ((packed));
  192. /*
  193. * interruption response block
  194. */
  195. struct irb {
  196. struct scsw scsw; /* subchannel status word */
  197. union { /* extended status word, 4 formats */
  198. struct esw0 esw0;
  199. struct esw1 esw1;
  200. struct esw2 esw2;
  201. struct esw3 esw3;
  202. } esw;
  203. __u8 ecw[32]; /* extended control word */
  204. } __attribute__ ((packed,aligned(4)));
  205. /*
  206. * command information word (CIW) layout
  207. */
  208. struct ciw {
  209. __u32 et : 2; /* entry type */
  210. __u32 reserved : 2; /* reserved */
  211. __u32 ct : 4; /* command type */
  212. __u32 cmd : 8; /* command */
  213. __u32 count : 16; /* coun */
  214. } __attribute__ ((packed));
  215. #define CIW_TYPE_RCD 0x0 /* read configuration data */
  216. #define CIW_TYPE_SII 0x1 /* set interface identifier */
  217. #define CIW_TYPE_RNI 0x2 /* read node identifier */
  218. /*
  219. * Flags used as input parameters for do_IO()
  220. */
  221. #define DOIO_ALLOW_SUSPEND 0x0001 /* allow for channel prog. suspend */
  222. #define DOIO_DENY_PREFETCH 0x0002 /* don't allow for CCW prefetch */
  223. #define DOIO_SUPPRESS_INTER 0x0004 /* suppress intermediate inter. */
  224. /* ... for suspended CCWs */
  225. /* Device or subchannel gone. */
  226. #define CIO_GONE 0x0001
  227. /* No path to device. */
  228. #define CIO_NO_PATH 0x0002
  229. /* Device has appeared. */
  230. #define CIO_OPER 0x0004
  231. /* Sick revalidation of device. */
  232. #define CIO_REVALIDATE 0x0008
  233. struct diag210 {
  234. __u16 vrdcdvno : 16; /* device number (input) */
  235. __u16 vrdclen : 16; /* data block length (input) */
  236. __u32 vrdcvcla : 8; /* virtual device class (output) */
  237. __u32 vrdcvtyp : 8; /* virtual device type (output) */
  238. __u32 vrdcvsta : 8; /* virtual device status (output) */
  239. __u32 vrdcvfla : 8; /* virtual device flags (output) */
  240. __u32 vrdcrccl : 8; /* real device class (output) */
  241. __u32 vrdccrty : 8; /* real device type (output) */
  242. __u32 vrdccrmd : 8; /* real device model (output) */
  243. __u32 vrdccrft : 8; /* real device feature (output) */
  244. } __attribute__ ((packed,aligned(4)));
  245. struct ccw_dev_id {
  246. u8 ssid;
  247. u16 devno;
  248. };
  249. extern int diag210(struct diag210 *addr);
  250. extern void wait_cons_dev(void);
  251. extern void clear_all_subchannels(void);
  252. extern void cio_reset_channel_paths(void);
  253. extern void css_schedule_reprobe(void);
  254. extern void reipl_ccw_dev(struct ccw_dev_id *id);
  255. #endif
  256. #endif