dasd_eckd.h 11 KB

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