dasd_eckd.h 12 KB

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