dasd.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * Author(s)......: Holger Smolinski <[email protected]>
  4. * Bugreports.to..: <[email protected]>
  5. * Copyright IBM Corp. 1999, 2000
  6. * EMC Symmetrix ioctl Copyright EMC Corporation, 2008
  7. * Author.........: Nigel Hislop <[email protected]>
  8. *
  9. * This file is the interface of the DASD device driver, which is exported to user space
  10. * any future changes wrt the API will result in a change of the APIVERSION reported
  11. * to userspace by the DASDAPIVER-ioctl
  12. *
  13. */
  14. #ifndef DASD_H
  15. #define DASD_H
  16. #include <linux/types.h>
  17. #include <linux/ioctl.h>
  18. #define DASD_IOCTL_LETTER 'D'
  19. #define DASD_API_VERSION 6
  20. /*
  21. * struct dasd_information2_t
  22. * represents any data about the device, which is visible to userspace.
  23. * including foramt and featueres.
  24. */
  25. typedef struct dasd_information2_t {
  26. unsigned int devno; /* S/390 devno */
  27. unsigned int real_devno; /* for aliases */
  28. unsigned int schid; /* S/390 subchannel identifier */
  29. unsigned int cu_type : 16; /* from SenseID */
  30. unsigned int cu_model : 8; /* from SenseID */
  31. unsigned int dev_type : 16; /* from SenseID */
  32. unsigned int dev_model : 8; /* from SenseID */
  33. unsigned int open_count;
  34. unsigned int req_queue_len;
  35. unsigned int chanq_len; /* length of chanq */
  36. char type[4]; /* from discipline.name, 'none' for unknown */
  37. unsigned int status; /* current device level */
  38. unsigned int label_block; /* where to find the VOLSER */
  39. unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
  40. unsigned int characteristics_size;
  41. unsigned int confdata_size;
  42. char characteristics[64]; /* from read_device_characteristics */
  43. char configuration_data[256]; /* from read_configuration_data */
  44. unsigned int format; /* format info like formatted/cdl/ldl/... */
  45. unsigned int features; /* dasd features like 'ro',... */
  46. unsigned int reserved0; /* reserved for further use ,... */
  47. unsigned int reserved1; /* reserved for further use ,... */
  48. unsigned int reserved2; /* reserved for further use ,... */
  49. unsigned int reserved3; /* reserved for further use ,... */
  50. unsigned int reserved4; /* reserved for further use ,... */
  51. unsigned int reserved5; /* reserved for further use ,... */
  52. unsigned int reserved6; /* reserved for further use ,... */
  53. unsigned int reserved7; /* reserved for further use ,... */
  54. } dasd_information2_t;
  55. /*
  56. * values to be used for dasd_information_t.format
  57. * 0x00: NOT formatted
  58. * 0x01: Linux disc layout
  59. * 0x02: Common disc layout
  60. */
  61. #define DASD_FORMAT_NONE 0
  62. #define DASD_FORMAT_LDL 1
  63. #define DASD_FORMAT_CDL 2
  64. /*
  65. * values to be used for dasd_information_t.features
  66. * 0x100: default features
  67. * 0x001: readonly (ro)
  68. * 0x002: use diag discipline (diag)
  69. * 0x004: set the device initially online (internal use only)
  70. * 0x008: enable ERP related logging
  71. * 0x010: allow I/O to fail on lost paths
  72. * 0x020: allow I/O to fail when a lock was stolen
  73. * 0x040: give access to raw eckd data
  74. * 0x080: enable discard support
  75. * 0x100: enable autodisable for IFCC errors (default)
  76. */
  77. #define DASD_FEATURE_READONLY 0x001
  78. #define DASD_FEATURE_USEDIAG 0x002
  79. #define DASD_FEATURE_INITIAL_ONLINE 0x004
  80. #define DASD_FEATURE_ERPLOG 0x008
  81. #define DASD_FEATURE_FAILFAST 0x010
  82. #define DASD_FEATURE_FAILONSLCK 0x020
  83. #define DASD_FEATURE_USERAW 0x040
  84. #define DASD_FEATURE_DISCARD 0x080
  85. #define DASD_FEATURE_PATH_AUTODISABLE 0x100
  86. #define DASD_FEATURE_DEFAULT DASD_FEATURE_PATH_AUTODISABLE
  87. #define DASD_PARTN_BITS 2
  88. /*
  89. * struct dasd_information_t
  90. * represents any data about the data, which is visible to userspace
  91. */
  92. typedef struct dasd_information_t {
  93. unsigned int devno; /* S/390 devno */
  94. unsigned int real_devno; /* for aliases */
  95. unsigned int schid; /* S/390 subchannel identifier */
  96. unsigned int cu_type : 16; /* from SenseID */
  97. unsigned int cu_model : 8; /* from SenseID */
  98. unsigned int dev_type : 16; /* from SenseID */
  99. unsigned int dev_model : 8; /* from SenseID */
  100. unsigned int open_count;
  101. unsigned int req_queue_len;
  102. unsigned int chanq_len; /* length of chanq */
  103. char type[4]; /* from discipline.name, 'none' for unknown */
  104. unsigned int status; /* current device level */
  105. unsigned int label_block; /* where to find the VOLSER */
  106. unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
  107. unsigned int characteristics_size;
  108. unsigned int confdata_size;
  109. char characteristics[64]; /* from read_device_characteristics */
  110. char configuration_data[256]; /* from read_configuration_data */
  111. } dasd_information_t;
  112. /*
  113. * Read Subsystem Data - Performance Statistics
  114. */
  115. typedef struct dasd_rssd_perf_stats_t {
  116. unsigned char invalid:1;
  117. unsigned char format:3;
  118. unsigned char data_format:4;
  119. unsigned char unit_address;
  120. unsigned short device_status;
  121. unsigned int nr_read_normal;
  122. unsigned int nr_read_normal_hits;
  123. unsigned int nr_write_normal;
  124. unsigned int nr_write_fast_normal_hits;
  125. unsigned int nr_read_seq;
  126. unsigned int nr_read_seq_hits;
  127. unsigned int nr_write_seq;
  128. unsigned int nr_write_fast_seq_hits;
  129. unsigned int nr_read_cache;
  130. unsigned int nr_read_cache_hits;
  131. unsigned int nr_write_cache;
  132. unsigned int nr_write_fast_cache_hits;
  133. unsigned int nr_inhibit_cache;
  134. unsigned int nr_bybass_cache;
  135. unsigned int nr_seq_dasd_to_cache;
  136. unsigned int nr_dasd_to_cache;
  137. unsigned int nr_cache_to_dasd;
  138. unsigned int nr_delayed_fast_write;
  139. unsigned int nr_normal_fast_write;
  140. unsigned int nr_seq_fast_write;
  141. unsigned int nr_cache_miss;
  142. unsigned char status2;
  143. unsigned int nr_quick_write_promotes;
  144. unsigned char reserved;
  145. unsigned short ssid;
  146. unsigned char reseved2[96];
  147. } __attribute__((packed)) dasd_rssd_perf_stats_t;
  148. /*
  149. * struct profile_info_t
  150. * holds the profinling information
  151. */
  152. typedef struct dasd_profile_info_t {
  153. unsigned int dasd_io_reqs; /* number of requests processed at all */
  154. unsigned int dasd_io_sects; /* number of sectors processed at all */
  155. unsigned int dasd_io_secs[32]; /* histogram of request's sizes */
  156. unsigned int dasd_io_times[32]; /* histogram of requests's times */
  157. unsigned int dasd_io_timps[32]; /* histogram of requests's times per sector */
  158. unsigned int dasd_io_time1[32]; /* histogram of time from build to start */
  159. unsigned int dasd_io_time2[32]; /* histogram of time from start to irq */
  160. unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */
  161. unsigned int dasd_io_time3[32]; /* histogram of time from irq to end */
  162. unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */
  163. } dasd_profile_info_t;
  164. /*
  165. * struct format_data_t
  166. * represents all data necessary to format a dasd
  167. */
  168. typedef struct format_data_t {
  169. unsigned int start_unit; /* from track */
  170. unsigned int stop_unit; /* to track */
  171. unsigned int blksize; /* sectorsize */
  172. unsigned int intensity;
  173. } format_data_t;
  174. /*
  175. * struct dasd_copypair_swap_data_t
  176. * represents all data necessary to issue a swap of the copy pair relation
  177. */
  178. struct dasd_copypair_swap_data_t {
  179. char primary[20]; /* BUSID of primary */
  180. char secondary[20]; /* BUSID of secondary */
  181. /* Reserved for future updates. */
  182. __u8 reserved[64];
  183. };
  184. /*
  185. * values to be used for format_data_t.intensity
  186. * 0/8: normal format
  187. * 1/9: also write record zero
  188. * 3/11: also write home address
  189. * 4/12: invalidate track
  190. */
  191. #define DASD_FMT_INT_FMT_R0 1 /* write record zero */
  192. #define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */
  193. #define DASD_FMT_INT_INVAL 4 /* invalidate tracks */
  194. #define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */
  195. #define DASD_FMT_INT_FMT_NOR0 16 /* remove permission to write record zero */
  196. #define DASD_FMT_INT_ESE_FULL 32 /* release space for entire volume */
  197. /*
  198. * struct format_check_t
  199. * represents all data necessary to evaluate the format of
  200. * different tracks of a dasd
  201. */
  202. typedef struct format_check_t {
  203. /* Input */
  204. struct format_data_t expect;
  205. /* Output */
  206. unsigned int result; /* Error indication (DASD_FMT_ERR_*) */
  207. unsigned int unit; /* Track that is in error */
  208. unsigned int rec; /* Record that is in error */
  209. unsigned int num_records; /* Records in the track in error */
  210. unsigned int blksize; /* Blocksize of first record in error */
  211. unsigned int key_length; /* Key length of first record in error */
  212. } format_check_t;
  213. /* Values returned in format_check_t when a format error is detected: */
  214. /* Too few records were found on a single track */
  215. #define DASD_FMT_ERR_TOO_FEW_RECORDS 1
  216. /* Too many records were found on a single track */
  217. #define DASD_FMT_ERR_TOO_MANY_RECORDS 2
  218. /* Blocksize/data-length of a record was wrong */
  219. #define DASD_FMT_ERR_BLKSIZE 3
  220. /* A record ID is defined by cylinder, head, and record number (CHR). */
  221. /* On mismatch, this error is set */
  222. #define DASD_FMT_ERR_RECORD_ID 4
  223. /* If key-length was != 0 */
  224. #define DASD_FMT_ERR_KEY_LENGTH 5
  225. /*
  226. * struct attrib_data_t
  227. * represents the operation (cache) bits for the device.
  228. * Used in DE to influence caching of the DASD.
  229. */
  230. typedef struct attrib_data_t {
  231. unsigned char operation:3; /* cache operation mode */
  232. unsigned char reserved:5; /* cache operation mode */
  233. __u16 nr_cyl; /* no of cyliners for read ahaed */
  234. __u8 reserved2[29]; /* for future use */
  235. } __attribute__ ((packed)) attrib_data_t;
  236. /* definition of operation (cache) bits within attributes of DE */
  237. #define DASD_NORMAL_CACHE 0x0
  238. #define DASD_BYPASS_CACHE 0x1
  239. #define DASD_INHIBIT_LOAD 0x2
  240. #define DASD_SEQ_ACCESS 0x3
  241. #define DASD_SEQ_PRESTAGE 0x4
  242. #define DASD_REC_ACCESS 0x5
  243. /*
  244. * Perform EMC Symmetrix I/O
  245. */
  246. typedef struct dasd_symmio_parms {
  247. unsigned char reserved[8]; /* compat with older releases */
  248. unsigned long long psf_data; /* char * cast to u64 */
  249. unsigned long long rssd_result; /* char * cast to u64 */
  250. int psf_data_len;
  251. int rssd_result_len;
  252. } __attribute__ ((packed)) dasd_symmio_parms_t;
  253. /*
  254. * Data returned by Sense Path Group ID (SNID)
  255. */
  256. struct dasd_snid_data {
  257. struct {
  258. __u8 group:2;
  259. __u8 reserve:2;
  260. __u8 mode:1;
  261. __u8 res:3;
  262. } __attribute__ ((packed)) path_state;
  263. __u8 pgid[11];
  264. } __attribute__ ((packed));
  265. struct dasd_snid_ioctl_data {
  266. struct dasd_snid_data data;
  267. __u8 path_mask;
  268. } __attribute__ ((packed));
  269. /********************************************************************************
  270. * SECTION: Definition of IOCTLs
  271. *
  272. * Here ist how the ioctl-nr should be used:
  273. * 0 - 31 DASD driver itself
  274. * 32 - 239 still open
  275. * 240 - 255 reserved for EMC
  276. *******************************************************************************/
  277. /* Disable the volume (for Linux) */
  278. #define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0)
  279. /* Enable the volume (for Linux) */
  280. #define BIODASDENABLE _IO(DASD_IOCTL_LETTER,1)
  281. /* Issue a reserve/release command, rsp. */
  282. #define BIODASDRSRV _IO(DASD_IOCTL_LETTER,2) /* reserve */
  283. #define BIODASDRLSE _IO(DASD_IOCTL_LETTER,3) /* release */
  284. #define BIODASDSLCK _IO(DASD_IOCTL_LETTER,4) /* steal lock */
  285. /* reset profiling information of a device */
  286. #define BIODASDPRRST _IO(DASD_IOCTL_LETTER,5)
  287. /* Quiesce IO on device */
  288. #define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6)
  289. /* Resume IO on device */
  290. #define BIODASDRESUME _IO(DASD_IOCTL_LETTER,7)
  291. /* Abort all I/O on a device */
  292. #define BIODASDABORTIO _IO(DASD_IOCTL_LETTER, 240)
  293. /* Allow I/O on a device */
  294. #define BIODASDALLOWIO _IO(DASD_IOCTL_LETTER, 241)
  295. /* retrieve API version number */
  296. #define DASDAPIVER _IOR(DASD_IOCTL_LETTER,0,int)
  297. /* Get information on a dasd device */
  298. #define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
  299. /* retrieve profiling information of a device */
  300. #define BIODASDPRRD _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t)
  301. /* Get information on a dasd device (enhanced) */
  302. #define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t)
  303. /* Performance Statistics Read */
  304. #define BIODASDPSRD _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t)
  305. /* Get Attributes (cache operations) */
  306. #define BIODASDGATTR _IOR(DASD_IOCTL_LETTER,5,attrib_data_t)
  307. /* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
  308. #define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t)
  309. /* Set Attributes (cache operations) */
  310. #define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t)
  311. /* Release Allocated Space */
  312. #define BIODASDRAS _IOW(DASD_IOCTL_LETTER, 3, format_data_t)
  313. /* Swap copy pair relation */
  314. #define BIODASDCOPYPAIRSWAP _IOW(DASD_IOCTL_LETTER, 4, struct dasd_copypair_swap_data_t)
  315. /* Get Sense Path Group ID (SNID) data */
  316. #define BIODASDSNID _IOWR(DASD_IOCTL_LETTER, 1, struct dasd_snid_ioctl_data)
  317. /* Check device format according to format_check_t */
  318. #define BIODASDCHECKFMT _IOWR(DASD_IOCTL_LETTER, 2, format_check_t)
  319. #define BIODASDSYMMIO _IOWR(DASD_IOCTL_LETTER, 240, dasd_symmio_parms_t)
  320. #endif /* DASD_H */