dasd_eckd.h 11 KB

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