dasd_eckd.h 13 KB

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