dasd.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. /*
  2. * File...........: linux/drivers/s390/block/dasd.c
  3. * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
  4. * Bugreports.to..: <Linux390@de.ibm.com>
  5. * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
  6. *
  7. * This file is the interface of the DASD device driver, which is exported to user space
  8. * any future changes wrt the API will result in a change of the APIVERSION reported
  9. * to userspace by the DASDAPIVER-ioctl
  10. *
  11. */
  12. #ifndef DASD_H
  13. #define DASD_H
  14. #include <linux/ioctl.h>
  15. #define DASD_IOCTL_LETTER 'D'
  16. #define DASD_API_VERSION 6
  17. /*
  18. * struct dasd_information2_t
  19. * represents any data about the device, which is visible to userspace.
  20. * including foramt and featueres.
  21. */
  22. typedef struct dasd_information2_t {
  23. unsigned int devno; /* S/390 devno */
  24. unsigned int real_devno; /* for aliases */
  25. unsigned int schid; /* S/390 subchannel identifier */
  26. unsigned int cu_type : 16; /* from SenseID */
  27. unsigned int cu_model : 8; /* from SenseID */
  28. unsigned int dev_type : 16; /* from SenseID */
  29. unsigned int dev_model : 8; /* from SenseID */
  30. unsigned int open_count;
  31. unsigned int req_queue_len;
  32. unsigned int chanq_len; /* length of chanq */
  33. char type[4]; /* from discipline.name, 'none' for unknown */
  34. unsigned int status; /* current device level */
  35. unsigned int label_block; /* where to find the VOLSER */
  36. unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
  37. unsigned int characteristics_size;
  38. unsigned int confdata_size;
  39. char characteristics[64]; /* from read_device_characteristics */
  40. char configuration_data[256]; /* from read_configuration_data */
  41. unsigned int format; /* format info like formatted/cdl/ldl/... */
  42. unsigned int features; /* dasd features like 'ro',... */
  43. unsigned int reserved0; /* reserved for further use ,... */
  44. unsigned int reserved1; /* reserved for further use ,... */
  45. unsigned int reserved2; /* reserved for further use ,... */
  46. unsigned int reserved3; /* reserved for further use ,... */
  47. unsigned int reserved4; /* reserved for further use ,... */
  48. unsigned int reserved5; /* reserved for further use ,... */
  49. unsigned int reserved6; /* reserved for further use ,... */
  50. unsigned int reserved7; /* reserved for further use ,... */
  51. } dasd_information2_t;
  52. /*
  53. * values to be used for dasd_information_t.format
  54. * 0x00: NOT formatted
  55. * 0x01: Linux disc layout
  56. * 0x02: Common disc layout
  57. */
  58. #define DASD_FORMAT_NONE 0
  59. #define DASD_FORMAT_LDL 1
  60. #define DASD_FORMAT_CDL 2
  61. /*
  62. * values to be used for dasd_information_t.features
  63. * 0x00: default features
  64. * 0x01: readonly (ro)
  65. * 0x02: use diag discipline (diag)
  66. */
  67. #define DASD_FEATURE_DEFAULT 0
  68. #define DASD_FEATURE_READONLY 1
  69. #define DASD_FEATURE_USEDIAG 2
  70. #define DASD_PARTN_BITS 2
  71. /*
  72. * struct dasd_information_t
  73. * represents any data about the data, which is visible to userspace
  74. */
  75. typedef struct dasd_information_t {
  76. unsigned int devno; /* S/390 devno */
  77. unsigned int real_devno; /* for aliases */
  78. unsigned int schid; /* S/390 subchannel identifier */
  79. unsigned int cu_type : 16; /* from SenseID */
  80. unsigned int cu_model : 8; /* from SenseID */
  81. unsigned int dev_type : 16; /* from SenseID */
  82. unsigned int dev_model : 8; /* from SenseID */
  83. unsigned int open_count;
  84. unsigned int req_queue_len;
  85. unsigned int chanq_len; /* length of chanq */
  86. char type[4]; /* from discipline.name, 'none' for unknown */
  87. unsigned int status; /* current device level */
  88. unsigned int label_block; /* where to find the VOLSER */
  89. unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
  90. unsigned int characteristics_size;
  91. unsigned int confdata_size;
  92. char characteristics[64]; /* from read_device_characteristics */
  93. char configuration_data[256]; /* from read_configuration_data */
  94. } dasd_information_t;
  95. /*
  96. * Read Subsystem Data - Perfomance Statistics
  97. */
  98. typedef struct dasd_rssd_perf_stats_t {
  99. unsigned char invalid:1;
  100. unsigned char format:3;
  101. unsigned char data_format:4;
  102. unsigned char unit_address;
  103. unsigned short device_status;
  104. unsigned int nr_read_normal;
  105. unsigned int nr_read_normal_hits;
  106. unsigned int nr_write_normal;
  107. unsigned int nr_write_fast_normal_hits;
  108. unsigned int nr_read_seq;
  109. unsigned int nr_read_seq_hits;
  110. unsigned int nr_write_seq;
  111. unsigned int nr_write_fast_seq_hits;
  112. unsigned int nr_read_cache;
  113. unsigned int nr_read_cache_hits;
  114. unsigned int nr_write_cache;
  115. unsigned int nr_write_fast_cache_hits;
  116. unsigned int nr_inhibit_cache;
  117. unsigned int nr_bybass_cache;
  118. unsigned int nr_seq_dasd_to_cache;
  119. unsigned int nr_dasd_to_cache;
  120. unsigned int nr_cache_to_dasd;
  121. unsigned int nr_delayed_fast_write;
  122. unsigned int nr_normal_fast_write;
  123. unsigned int nr_seq_fast_write;
  124. unsigned int nr_cache_miss;
  125. unsigned char status2;
  126. unsigned int nr_quick_write_promotes;
  127. unsigned char reserved;
  128. unsigned short ssid;
  129. unsigned char reseved2[96];
  130. } __attribute__((packed)) dasd_rssd_perf_stats_t;
  131. /*
  132. * struct profile_info_t
  133. * holds the profinling information
  134. */
  135. typedef struct dasd_profile_info_t {
  136. unsigned int dasd_io_reqs; /* number of requests processed at all */
  137. unsigned int dasd_io_sects; /* number of sectors processed at all */
  138. unsigned int dasd_io_secs[32]; /* histogram of request's sizes */
  139. unsigned int dasd_io_times[32]; /* histogram of requests's times */
  140. unsigned int dasd_io_timps[32]; /* histogram of requests's times per sector */
  141. unsigned int dasd_io_time1[32]; /* histogram of time from build to start */
  142. unsigned int dasd_io_time2[32]; /* histogram of time from start to irq */
  143. unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */
  144. unsigned int dasd_io_time3[32]; /* histogram of time from irq to end */
  145. unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */
  146. } dasd_profile_info_t;
  147. /*
  148. * struct format_data_t
  149. * represents all data necessary to format a dasd
  150. */
  151. typedef struct format_data_t {
  152. int start_unit; /* from track */
  153. int stop_unit; /* to track */
  154. int blksize; /* sectorsize */
  155. int intensity;
  156. } format_data_t;
  157. /*
  158. * values to be used for format_data_t.intensity
  159. * 0/8: normal format
  160. * 1/9: also write record zero
  161. * 3/11: also write home address
  162. * 4/12: invalidate track
  163. */
  164. #define DASD_FMT_INT_FMT_R0 1 /* write record zero */
  165. #define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */
  166. #define DASD_FMT_INT_INVAL 4 /* invalidate tracks */
  167. #define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */
  168. /*
  169. * struct attrib_data_t
  170. * represents the operation (cache) bits for the device.
  171. * Used in DE to influence caching of the DASD.
  172. */
  173. typedef struct attrib_data_t {
  174. unsigned char operation:3; /* cache operation mode */
  175. unsigned char reserved:5; /* cache operation mode */
  176. __u16 nr_cyl; /* no of cyliners for read ahaed */
  177. __u8 reserved2[29]; /* for future use */
  178. } __attribute__ ((packed)) attrib_data_t;
  179. /* definition of operation (cache) bits within attributes of DE */
  180. #define DASD_NORMAL_CACHE 0x0
  181. #define DASD_BYPASS_CACHE 0x1
  182. #define DASD_INHIBIT_LOAD 0x2
  183. #define DASD_SEQ_ACCESS 0x3
  184. #define DASD_SEQ_PRESTAGE 0x4
  185. #define DASD_REC_ACCESS 0x5
  186. /********************************************************************************
  187. * SECTION: Definition of IOCTLs
  188. *
  189. * Here ist how the ioctl-nr should be used:
  190. * 0 - 31 DASD driver itself
  191. * 32 - 239 still open
  192. * 240 - 255 reserved for EMC
  193. *******************************************************************************/
  194. /* Disable the volume (for Linux) */
  195. #define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0)
  196. /* Enable the volume (for Linux) */
  197. #define BIODASDENABLE _IO(DASD_IOCTL_LETTER,1)
  198. /* Issue a reserve/release command, rsp. */
  199. #define BIODASDRSRV _IO(DASD_IOCTL_LETTER,2) /* reserve */
  200. #define BIODASDRLSE _IO(DASD_IOCTL_LETTER,3) /* release */
  201. #define BIODASDSLCK _IO(DASD_IOCTL_LETTER,4) /* steal lock */
  202. /* reset profiling information of a device */
  203. #define BIODASDPRRST _IO(DASD_IOCTL_LETTER,5)
  204. /* Quiesce IO on device */
  205. #define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6)
  206. /* Resume IO on device */
  207. #define BIODASDRESUME _IO(DASD_IOCTL_LETTER,7)
  208. /* retrieve API version number */
  209. #define DASDAPIVER _IOR(DASD_IOCTL_LETTER,0,int)
  210. /* Get information on a dasd device */
  211. #define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
  212. /* retrieve profiling information of a device */
  213. #define BIODASDPRRD _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t)
  214. /* Get information on a dasd device (enhanced) */
  215. #define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t)
  216. /* Performance Statistics Read */
  217. #define BIODASDPSRD _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t)
  218. /* Get Attributes (cache operations) */
  219. #define BIODASDGATTR _IOR(DASD_IOCTL_LETTER,5,attrib_data_t)
  220. /* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
  221. #define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t)
  222. /* Set Attributes (cache operations) */
  223. #define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t)
  224. #endif /* DASD_H */
  225. /*
  226. * Overrides for Emacs so that we follow Linus's tabbing style.
  227. * Emacs will notice this stuff at the end of the file and automatically
  228. * adjust the settings for this buffer only. This must remain at the end
  229. * of the file.
  230. * ---------------------------------------------------------------------------
  231. * Local variables:
  232. * c-indent-level: 4
  233. * c-brace-imaginary-offset: 0
  234. * c-brace-offset: -4
  235. * c-argdecl-indent: 4
  236. * c-label-offset: -4
  237. * c-continued-statement-offset: 4
  238. * c-continued-brace-offset: 0
  239. * indent-tabs-mode: nil
  240. * tab-width: 8
  241. * End:
  242. */