dasd_eckd.h 12 KB

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