dasd.h 12 KB

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