dasd_eckd.h 13 KB

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