dasd_eckd.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. /*
  2. * File...........: linux/drivers/s390/block/dasd_eckd.h
  3. * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
  4. * Horst Hummel <Horst.Hummel@de.ibm.com>
  5. * Bugreports.to..: <Linux390@de.ibm.com>
  6. * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
  7. *
  8. */
  9. #ifndef DASD_ECKD_H
  10. #define DASD_ECKD_H
  11. /*****************************************************************************
  12. * SECTION: CCW Definitions
  13. ****************************************************************************/
  14. #define DASD_ECKD_CCW_WRITE 0x05
  15. #define DASD_ECKD_CCW_READ 0x06
  16. #define DASD_ECKD_CCW_WRITE_HOME_ADDRESS 0x09
  17. #define DASD_ECKD_CCW_READ_HOME_ADDRESS 0x0a
  18. #define DASD_ECKD_CCW_WRITE_KD 0x0d
  19. #define DASD_ECKD_CCW_READ_KD 0x0e
  20. #define DASD_ECKD_CCW_ERASE 0x11
  21. #define DASD_ECKD_CCW_READ_COUNT 0x12
  22. #define DASD_ECKD_CCW_SLCK 0x14
  23. #define DASD_ECKD_CCW_WRITE_RECORD_ZERO 0x15
  24. #define DASD_ECKD_CCW_READ_RECORD_ZERO 0x16
  25. #define DASD_ECKD_CCW_WRITE_CKD 0x1d
  26. #define DASD_ECKD_CCW_READ_CKD 0x1e
  27. #define DASD_ECKD_CCW_PSF 0x27
  28. #define DASD_ECKD_CCW_RSSD 0x3e
  29. #define DASD_ECKD_CCW_LOCATE_RECORD 0x47
  30. #define DASD_ECKD_CCW_SNSS 0x54
  31. #define DASD_ECKD_CCW_DEFINE_EXTENT 0x63
  32. #define DASD_ECKD_CCW_WRITE_MT 0x85
  33. #define DASD_ECKD_CCW_READ_MT 0x86
  34. #define DASD_ECKD_CCW_WRITE_KD_MT 0x8d
  35. #define DASD_ECKD_CCW_READ_KD_MT 0x8e
  36. #define DASD_ECKD_CCW_RELEASE 0x94
  37. #define DASD_ECKD_CCW_READ_CKD_MT 0x9e
  38. #define DASD_ECKD_CCW_WRITE_CKD_MT 0x9d
  39. #define DASD_ECKD_CCW_RESERVE 0xB4
  40. #define DASD_ECKD_CCW_PFX 0xE7
  41. #define DASD_ECKD_CCW_RSCK 0xF9
  42. /*
  43. * Perform Subsystem Function / Sub-Orders
  44. */
  45. #define PSF_ORDER_PRSSD 0x18
  46. #define PSF_ORDER_SSC 0x1D
  47. /*
  48. * Size that is reportet for large volumes in the old 16-bit no_cyl field
  49. */
  50. #define LV_COMPAT_CYL 0xFFFE
  51. /*****************************************************************************
  52. * SECTION: Type Definitions
  53. ****************************************************************************/
  54. struct eckd_count {
  55. __u16 cyl;
  56. __u16 head;
  57. __u8 record;
  58. __u8 kl;
  59. __u16 dl;
  60. } __attribute__ ((packed));
  61. struct ch_t {
  62. __u16 cyl;
  63. __u16 head;
  64. } __attribute__ ((packed));
  65. struct chs_t {
  66. __u16 cyl;
  67. __u16 head;
  68. __u32 sector;
  69. } __attribute__ ((packed));
  70. struct chr_t {
  71. __u16 cyl;
  72. __u16 head;
  73. __u8 record;
  74. } __attribute__ ((packed));
  75. struct geom_t {
  76. __u16 cyl;
  77. __u16 head;
  78. __u32 sector;
  79. } __attribute__ ((packed));
  80. struct eckd_home {
  81. __u8 skip_control[14];
  82. __u16 cell_number;
  83. __u8 physical_addr[3];
  84. __u8 flag;
  85. struct ch_t track_addr;
  86. __u8 reserved;
  87. __u8 key_length;
  88. __u8 reserved2[2];
  89. } __attribute__ ((packed));
  90. struct DE_eckd_data {
  91. struct {
  92. unsigned char perm:2; /* Permissions on this extent */
  93. unsigned char reserved:1;
  94. unsigned char seek:2; /* Seek control */
  95. unsigned char auth:2; /* Access authorization */
  96. unsigned char pci:1; /* PCI Fetch mode */
  97. } __attribute__ ((packed)) mask;
  98. struct {
  99. unsigned char mode:2; /* Architecture mode */
  100. unsigned char ckd:1; /* CKD Conversion */
  101. unsigned char operation:3; /* Operation mode */
  102. unsigned char cfw:1; /* Cache fast write */
  103. unsigned char dfw:1; /* DASD fast write */
  104. } __attribute__ ((packed)) attributes;
  105. __u16 blk_size; /* Blocksize */
  106. __u16 fast_write_id;
  107. __u8 ga_additional; /* Global Attributes Additional */
  108. __u8 ga_extended; /* Global Attributes Extended */
  109. struct ch_t beg_ext;
  110. struct ch_t end_ext;
  111. unsigned long long ep_sys_time; /* Ext Parameter - System Time Stamp */
  112. __u8 ep_format; /* Extended Parameter format byte */
  113. __u8 ep_prio; /* Extended Parameter priority I/O byte */
  114. __u8 ep_reserved[6]; /* Extended Parameter Reserved */
  115. } __attribute__ ((packed));
  116. struct LO_eckd_data {
  117. struct {
  118. unsigned char orientation:2;
  119. unsigned char operation:6;
  120. } __attribute__ ((packed)) operation;
  121. struct {
  122. unsigned char last_bytes_used:1;
  123. unsigned char reserved:6;
  124. unsigned char read_count_suffix:1;
  125. } __attribute__ ((packed)) auxiliary;
  126. __u8 unused;
  127. __u8 count;
  128. struct ch_t seek_addr;
  129. struct chr_t search_arg;
  130. __u8 sector;
  131. __u16 length;
  132. } __attribute__ ((packed));
  133. /* Prefix data for format 0x00 and 0x01 */
  134. struct PFX_eckd_data {
  135. unsigned char format;
  136. struct {
  137. unsigned char define_extend:1;
  138. unsigned char time_stamp:1;
  139. unsigned char verify_base:1;
  140. unsigned char hyper_pav:1;
  141. unsigned char reserved:4;
  142. } __attribute__ ((packed)) validity;
  143. __u8 base_address;
  144. __u8 aux;
  145. __u8 base_lss;
  146. __u8 reserved[7];
  147. struct DE_eckd_data define_extend;
  148. struct LO_eckd_data locate_record;
  149. __u8 LO_extended_data[4];
  150. } __attribute__ ((packed));
  151. struct dasd_eckd_characteristics {
  152. __u16 cu_type;
  153. struct {
  154. unsigned char support:2;
  155. unsigned char async:1;
  156. unsigned char reserved:1;
  157. unsigned char cache_info:1;
  158. unsigned char model:3;
  159. } __attribute__ ((packed)) cu_model;
  160. __u16 dev_type;
  161. __u8 dev_model;
  162. struct {
  163. unsigned char mult_burst:1;
  164. unsigned char RT_in_LR:1;
  165. unsigned char reserved1:1;
  166. unsigned char RD_IN_LR:1;
  167. unsigned char reserved2:4;
  168. unsigned char reserved3:8;
  169. unsigned char defect_wr:1;
  170. unsigned char XRC_supported:1;
  171. unsigned char reserved4:1;
  172. unsigned char striping:1;
  173. unsigned char reserved5:4;
  174. unsigned char cfw:1;
  175. unsigned char reserved6:2;
  176. unsigned char cache:1;
  177. unsigned char dual_copy:1;
  178. unsigned char dfw:1;
  179. unsigned char reset_alleg:1;
  180. unsigned char sense_down:1;
  181. } __attribute__ ((packed)) facilities;
  182. __u8 dev_class;
  183. __u8 unit_type;
  184. __u16 no_cyl;
  185. __u16 trk_per_cyl;
  186. __u8 sec_per_trk;
  187. __u8 byte_per_track[3];
  188. __u16 home_bytes;
  189. __u8 formula;
  190. union {
  191. struct {
  192. __u8 f1;
  193. __u16 f2;
  194. __u16 f3;
  195. } __attribute__ ((packed)) f_0x01;
  196. struct {
  197. __u8 f1;
  198. __u8 f2;
  199. __u8 f3;
  200. __u8 f4;
  201. __u8 f5;
  202. } __attribute__ ((packed)) f_0x02;
  203. } __attribute__ ((packed)) factors;
  204. __u16 first_alt_trk;
  205. __u16 no_alt_trk;
  206. __u16 first_dia_trk;
  207. __u16 no_dia_trk;
  208. __u16 first_sup_trk;
  209. __u16 no_sup_trk;
  210. __u8 MDR_ID;
  211. __u8 OBR_ID;
  212. __u8 director;
  213. __u8 rd_trk_set;
  214. __u16 max_rec_zero;
  215. __u8 reserved1;
  216. __u8 RWANY_in_LR;
  217. __u8 factor6;
  218. __u8 factor7;
  219. __u8 factor8;
  220. __u8 reserved2[3];
  221. __u8 reserved3[6];
  222. __u32 long_no_cyl;
  223. } __attribute__ ((packed));
  224. /* elements of the configuration data */
  225. struct dasd_ned {
  226. struct {
  227. __u8 identifier:2;
  228. __u8 token_id:1;
  229. __u8 sno_valid:1;
  230. __u8 subst_sno:1;
  231. __u8 recNED:1;
  232. __u8 emuNED:1;
  233. __u8 reserved:1;
  234. } __attribute__ ((packed)) flags;
  235. __u8 descriptor;
  236. __u8 dev_class;
  237. __u8 reserved;
  238. __u8 dev_type[6];
  239. __u8 dev_model[3];
  240. __u8 HDA_manufacturer[3];
  241. __u8 HDA_location[2];
  242. __u8 HDA_seqno[12];
  243. __u8 ID;
  244. __u8 unit_addr;
  245. } __attribute__ ((packed));
  246. struct dasd_sneq {
  247. struct {
  248. __u8 identifier:2;
  249. __u8 reserved:6;
  250. } __attribute__ ((packed)) flags;
  251. __u8 res1;
  252. __u16 format;
  253. __u8 res2[4]; /* byte 4- 7 */
  254. __u8 sua_flags; /* byte 8 */
  255. __u8 base_unit_addr; /* byte 9 */
  256. __u8 res3[22]; /* byte 10-31 */
  257. } __attribute__ ((packed));
  258. struct vd_sneq {
  259. struct {
  260. __u8 identifier:2;
  261. __u8 reserved:6;
  262. } __attribute__ ((packed)) flags;
  263. __u8 res1;
  264. __u16 format;
  265. __u8 res2[4]; /* byte 4- 7 */
  266. __u8 uit[16]; /* byte 8-23 */
  267. __u8 res3[8]; /* byte 24-31 */
  268. } __attribute__ ((packed));
  269. struct dasd_gneq {
  270. struct {
  271. __u8 identifier:2;
  272. __u8 reserved:6;
  273. } __attribute__ ((packed)) flags;
  274. __u8 reserved[7];
  275. __u16 subsystemID;
  276. __u8 reserved2[22];
  277. } __attribute__ ((packed));
  278. struct dasd_eckd_path {
  279. __u8 opm;
  280. __u8 ppm;
  281. __u8 npm;
  282. };
  283. struct dasd_rssd_features {
  284. char feature[256];
  285. } __attribute__((packed));
  286. /*
  287. * Perform Subsystem Function - Prepare for Read Subsystem Data
  288. */
  289. struct dasd_psf_prssd_data {
  290. unsigned char order;
  291. unsigned char flags;
  292. unsigned char reserved[4];
  293. unsigned char suborder;
  294. unsigned char varies[5];
  295. } __attribute__ ((packed));
  296. /*
  297. * Perform Subsystem Function - Set Subsystem Characteristics
  298. */
  299. struct dasd_psf_ssc_data {
  300. unsigned char order;
  301. unsigned char flags;
  302. unsigned char cu_type[4];
  303. unsigned char suborder;
  304. unsigned char reserved[59];
  305. } __attribute__((packed));
  306. /*
  307. * some structures and definitions for alias handling
  308. */
  309. struct dasd_unit_address_configuration {
  310. struct {
  311. char ua_type;
  312. char base_ua;
  313. } unit[256];
  314. } __attribute__((packed));
  315. #define MAX_DEVICES_PER_LCU 256
  316. /* flags on the LCU */
  317. #define NEED_UAC_UPDATE 0x01
  318. #define UPDATE_PENDING 0x02
  319. enum pavtype {NO_PAV, BASE_PAV, HYPER_PAV};
  320. struct alias_root {
  321. struct list_head serverlist;
  322. spinlock_t lock;
  323. };
  324. struct alias_server {
  325. struct list_head server;
  326. struct dasd_uid uid;
  327. struct list_head lculist;
  328. };
  329. struct summary_unit_check_work_data {
  330. char reason;
  331. struct dasd_device *device;
  332. struct work_struct worker;
  333. };
  334. struct read_uac_work_data {
  335. struct dasd_device *device;
  336. struct delayed_work dwork;
  337. };
  338. struct alias_lcu {
  339. struct list_head lcu;
  340. struct dasd_uid uid;
  341. enum pavtype pav;
  342. char flags;
  343. spinlock_t lock;
  344. struct list_head grouplist;
  345. struct list_head active_devices;
  346. struct list_head inactive_devices;
  347. struct dasd_unit_address_configuration *uac;
  348. struct summary_unit_check_work_data suc_data;
  349. struct read_uac_work_data ruac_data;
  350. struct dasd_ccw_req *rsu_cqr;
  351. };
  352. struct alias_pav_group {
  353. struct list_head group;
  354. struct dasd_uid uid;
  355. struct alias_lcu *lcu;
  356. struct list_head baselist;
  357. struct list_head aliaslist;
  358. struct dasd_device *next;
  359. };
  360. struct dasd_eckd_private {
  361. struct dasd_eckd_characteristics rdc_data;
  362. u8 *conf_data;
  363. int conf_len;
  364. /* pointers to specific parts in the conf_data */
  365. struct dasd_ned *ned;
  366. struct dasd_sneq *sneq;
  367. struct vd_sneq *vdsneq;
  368. struct dasd_gneq *gneq;
  369. struct dasd_eckd_path path_data;
  370. struct eckd_count count_area[5];
  371. int init_cqr_status;
  372. int uses_cdl;
  373. struct attrib_data_t attrib; /* e.g. cache operations */
  374. struct dasd_rssd_features features;
  375. u32 real_cyl;
  376. /* alias managemnet */
  377. struct dasd_uid uid;
  378. struct alias_pav_group *pavgroup;
  379. struct alias_lcu *lcu;
  380. int count;
  381. };
  382. int dasd_alias_make_device_known_to_lcu(struct dasd_device *);
  383. void dasd_alias_disconnect_device_from_lcu(struct dasd_device *);
  384. int dasd_alias_add_device(struct dasd_device *);
  385. int dasd_alias_remove_device(struct dasd_device *);
  386. struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *);
  387. void dasd_alias_handle_summary_unit_check(struct dasd_device *, struct irb *);
  388. void dasd_eckd_reset_ccw_to_base_io(struct dasd_ccw_req *);
  389. #endif /* DASD_ECKD_H */