gdth_ioctl.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _GDTH_IOCTL_H
  3. #define _GDTH_IOCTL_H
  4. /* gdth_ioctl.h
  5. * $Id: gdth_ioctl.h,v 1.14 2004/02/19 15:43:15 achim Exp $
  6. */
  7. /* IOCTLs */
  8. #define GDTIOCTL_MASK ('J'<<8)
  9. #define GDTIOCTL_GENERAL (GDTIOCTL_MASK | 0) /* general IOCTL */
  10. #define GDTIOCTL_DRVERS (GDTIOCTL_MASK | 1) /* get driver version */
  11. #define GDTIOCTL_CTRTYPE (GDTIOCTL_MASK | 2) /* get controller type */
  12. #define GDTIOCTL_OSVERS (GDTIOCTL_MASK | 3) /* get OS version */
  13. #define GDTIOCTL_HDRLIST (GDTIOCTL_MASK | 4) /* get host drive list */
  14. #define GDTIOCTL_CTRCNT (GDTIOCTL_MASK | 5) /* get controller count */
  15. #define GDTIOCTL_LOCKDRV (GDTIOCTL_MASK | 6) /* lock host drive */
  16. #define GDTIOCTL_LOCKCHN (GDTIOCTL_MASK | 7) /* lock channel */
  17. #define GDTIOCTL_EVENT (GDTIOCTL_MASK | 8) /* read controller events */
  18. #define GDTIOCTL_SCSI (GDTIOCTL_MASK | 9) /* SCSI command */
  19. #define GDTIOCTL_RESET_BUS (GDTIOCTL_MASK |10) /* reset SCSI bus */
  20. #define GDTIOCTL_RESCAN (GDTIOCTL_MASK |11) /* rescan host drives */
  21. #define GDTIOCTL_RESET_DRV (GDTIOCTL_MASK |12) /* reset (remote) drv. res. */
  22. #define GDTIOCTL_MAGIC 0xaffe0004
  23. #define EVENT_SIZE 294
  24. #define GDTH_MAXSG 32 /* max. s/g elements */
  25. #define MAX_LDRIVES 255 /* max. log. drive count */
  26. #ifdef GDTH_IOCTL_PROC
  27. #define MAX_HDRIVES 100 /* max. host drive count */
  28. #else
  29. #define MAX_HDRIVES MAX_LDRIVES /* max. host drive count */
  30. #endif
  31. /* scatter/gather element */
  32. typedef struct {
  33. u32 sg_ptr; /* address */
  34. u32 sg_len; /* length */
  35. } __attribute__((packed)) gdth_sg_str;
  36. /* scatter/gather element - 64bit addresses */
  37. typedef struct {
  38. u64 sg_ptr; /* address */
  39. u32 sg_len; /* length */
  40. } __attribute__((packed)) gdth_sg64_str;
  41. /* command structure */
  42. typedef struct {
  43. u32 BoardNode; /* board node (always 0) */
  44. u32 CommandIndex; /* command number */
  45. u16 OpCode; /* the command (READ,..) */
  46. union {
  47. struct {
  48. u16 DeviceNo; /* number of cache drive */
  49. u32 BlockNo; /* block number */
  50. u32 BlockCnt; /* block count */
  51. u32 DestAddr; /* dest. addr. (if s/g: -1) */
  52. u32 sg_canz; /* s/g element count */
  53. gdth_sg_str sg_lst[GDTH_MAXSG]; /* s/g list */
  54. } __attribute__((packed)) cache; /* cache service cmd. str. */
  55. struct {
  56. u16 DeviceNo; /* number of cache drive */
  57. u64 BlockNo; /* block number */
  58. u32 BlockCnt; /* block count */
  59. u64 DestAddr; /* dest. addr. (if s/g: -1) */
  60. u32 sg_canz; /* s/g element count */
  61. gdth_sg64_str sg_lst[GDTH_MAXSG]; /* s/g list */
  62. } __attribute__((packed)) cache64; /* cache service cmd. str. */
  63. struct {
  64. u16 param_size; /* size of p_param buffer */
  65. u32 subfunc; /* IOCTL function */
  66. u32 channel; /* device */
  67. u64 p_param; /* buffer */
  68. } __attribute__((packed)) ioctl; /* IOCTL command structure */
  69. struct {
  70. u16 reserved;
  71. union {
  72. struct {
  73. u32 msg_handle; /* message handle */
  74. u64 msg_addr; /* message buffer address */
  75. } __attribute__((packed)) msg;
  76. u8 data[12]; /* buffer for rtc data, ... */
  77. } su;
  78. } __attribute__((packed)) screen; /* screen service cmd. str. */
  79. struct {
  80. u16 reserved;
  81. u32 direction; /* data direction */
  82. u32 mdisc_time; /* disc. time (0: no timeout)*/
  83. u32 mcon_time; /* connect time(0: no to.) */
  84. u32 sdata; /* dest. addr. (if s/g: -1) */
  85. u32 sdlen; /* data length (bytes) */
  86. u32 clen; /* SCSI cmd. length(6,10,12) */
  87. u8 cmd[12]; /* SCSI command */
  88. u8 target; /* target ID */
  89. u8 lun; /* LUN */
  90. u8 bus; /* SCSI bus number */
  91. u8 priority; /* only 0 used */
  92. u32 sense_len; /* sense data length */
  93. u32 sense_data; /* sense data addr. */
  94. u32 link_p; /* linked cmds (not supp.) */
  95. u32 sg_ranz; /* s/g element count */
  96. gdth_sg_str sg_lst[GDTH_MAXSG]; /* s/g list */
  97. } __attribute__((packed)) raw; /* raw service cmd. struct. */
  98. struct {
  99. u16 reserved;
  100. u32 direction; /* data direction */
  101. u32 mdisc_time; /* disc. time (0: no timeout)*/
  102. u32 mcon_time; /* connect time(0: no to.) */
  103. u64 sdata; /* dest. addr. (if s/g: -1) */
  104. u32 sdlen; /* data length (bytes) */
  105. u32 clen; /* SCSI cmd. length(6,..,16) */
  106. u8 cmd[16]; /* SCSI command */
  107. u8 target; /* target ID */
  108. u8 lun; /* LUN */
  109. u8 bus; /* SCSI bus number */
  110. u8 priority; /* only 0 used */
  111. u32 sense_len; /* sense data length */
  112. u64 sense_data; /* sense data addr. */
  113. u32 sg_ranz; /* s/g element count */
  114. gdth_sg64_str sg_lst[GDTH_MAXSG]; /* s/g list */
  115. } __attribute__((packed)) raw64; /* raw service cmd. struct. */
  116. } u;
  117. /* additional variables */
  118. u8 Service; /* controller service */
  119. u8 reserved;
  120. u16 Status; /* command result */
  121. u32 Info; /* additional information */
  122. void *RequestBuffer; /* request buffer */
  123. } __attribute__((packed)) gdth_cmd_str;
  124. /* controller event structure */
  125. #define ES_ASYNC 1
  126. #define ES_DRIVER 2
  127. #define ES_TEST 3
  128. #define ES_SYNC 4
  129. typedef struct {
  130. u16 size; /* size of structure */
  131. union {
  132. char stream[16];
  133. struct {
  134. u16 ionode;
  135. u16 service;
  136. u32 index;
  137. } __attribute__((packed)) driver;
  138. struct {
  139. u16 ionode;
  140. u16 service;
  141. u16 status;
  142. u32 info;
  143. u8 scsi_coord[3];
  144. } __attribute__((packed)) async;
  145. struct {
  146. u16 ionode;
  147. u16 service;
  148. u16 status;
  149. u32 info;
  150. u16 hostdrive;
  151. u8 scsi_coord[3];
  152. u8 sense_key;
  153. } __attribute__((packed)) sync;
  154. struct {
  155. u32 l1, l2, l3, l4;
  156. } __attribute__((packed)) test;
  157. } eu;
  158. u32 severity;
  159. u8 event_string[256];
  160. } __attribute__((packed)) gdth_evt_data;
  161. typedef struct {
  162. u32 first_stamp;
  163. u32 last_stamp;
  164. u16 same_count;
  165. u16 event_source;
  166. u16 event_idx;
  167. u8 application;
  168. u8 reserved;
  169. gdth_evt_data event_data;
  170. } __attribute__((packed)) gdth_evt_str;
  171. #ifdef GDTH_IOCTL_PROC
  172. /* IOCTL structure (write) */
  173. typedef struct {
  174. u32 magic; /* IOCTL magic */
  175. u16 ioctl; /* IOCTL */
  176. u16 ionode; /* controller number */
  177. u16 service; /* controller service */
  178. u16 timeout; /* timeout */
  179. union {
  180. struct {
  181. u8 command[512]; /* controller command */
  182. u8 data[1]; /* add. data */
  183. } general;
  184. struct {
  185. u8 lock; /* lock/unlock */
  186. u8 drive_cnt; /* drive count */
  187. u16 drives[MAX_HDRIVES];/* drives */
  188. } lockdrv;
  189. struct {
  190. u8 lock; /* lock/unlock */
  191. u8 channel; /* channel */
  192. } lockchn;
  193. struct {
  194. int erase; /* erase event ? */
  195. int handle;
  196. u8 evt[EVENT_SIZE]; /* event structure */
  197. } event;
  198. struct {
  199. u8 bus; /* SCSI bus */
  200. u8 target; /* target ID */
  201. u8 lun; /* LUN */
  202. u8 cmd_len; /* command length */
  203. u8 cmd[12]; /* SCSI command */
  204. } scsi;
  205. struct {
  206. u16 hdr_no; /* host drive number */
  207. u8 flag; /* old meth./add/remove */
  208. } rescan;
  209. } iu;
  210. } gdth_iowr_str;
  211. /* IOCTL structure (read) */
  212. typedef struct {
  213. u32 size; /* buffer size */
  214. u32 status; /* IOCTL error code */
  215. union {
  216. struct {
  217. u8 data[1]; /* data */
  218. } general;
  219. struct {
  220. u16 version; /* driver version */
  221. } drvers;
  222. struct {
  223. u8 type; /* controller type */
  224. u16 info; /* slot etc. */
  225. u16 oem_id; /* OEM ID */
  226. u16 bios_ver; /* not used */
  227. u16 access; /* not used */
  228. u16 ext_type; /* extended type */
  229. u16 device_id; /* device ID */
  230. u16 sub_device_id; /* sub device ID */
  231. } ctrtype;
  232. struct {
  233. u8 version; /* OS version */
  234. u8 subversion; /* OS subversion */
  235. u16 revision; /* revision */
  236. } osvers;
  237. struct {
  238. u16 count; /* controller count */
  239. } ctrcnt;
  240. struct {
  241. int handle;
  242. u8 evt[EVENT_SIZE]; /* event structure */
  243. } event;
  244. struct {
  245. u8 bus; /* SCSI bus, 0xff: invalid */
  246. u8 target; /* target ID */
  247. u8 lun; /* LUN */
  248. u8 cluster_type; /* cluster properties */
  249. } hdr_list[MAX_HDRIVES]; /* index is host drive number */
  250. } iu;
  251. } gdth_iord_str;
  252. #endif
  253. /* GDTIOCTL_GENERAL */
  254. typedef struct {
  255. u16 ionode; /* controller number */
  256. u16 timeout; /* timeout */
  257. u32 info; /* error info */
  258. u16 status; /* status */
  259. unsigned long data_len; /* data buffer size */
  260. unsigned long sense_len; /* sense buffer size */
  261. gdth_cmd_str command; /* command */
  262. } gdth_ioctl_general;
  263. /* GDTIOCTL_LOCKDRV */
  264. typedef struct {
  265. u16 ionode; /* controller number */
  266. u8 lock; /* lock/unlock */
  267. u8 drive_cnt; /* drive count */
  268. u16 drives[MAX_HDRIVES]; /* drives */
  269. } gdth_ioctl_lockdrv;
  270. /* GDTIOCTL_LOCKCHN */
  271. typedef struct {
  272. u16 ionode; /* controller number */
  273. u8 lock; /* lock/unlock */
  274. u8 channel; /* channel */
  275. } gdth_ioctl_lockchn;
  276. /* GDTIOCTL_OSVERS */
  277. typedef struct {
  278. u8 version; /* OS version */
  279. u8 subversion; /* OS subversion */
  280. u16 revision; /* revision */
  281. } gdth_ioctl_osvers;
  282. /* GDTIOCTL_CTRTYPE */
  283. typedef struct {
  284. u16 ionode; /* controller number */
  285. u8 type; /* controller type */
  286. u16 info; /* slot etc. */
  287. u16 oem_id; /* OEM ID */
  288. u16 bios_ver; /* not used */
  289. u16 access; /* not used */
  290. u16 ext_type; /* extended type */
  291. u16 device_id; /* device ID */
  292. u16 sub_device_id; /* sub device ID */
  293. } gdth_ioctl_ctrtype;
  294. /* GDTIOCTL_EVENT */
  295. typedef struct {
  296. u16 ionode;
  297. int erase; /* erase event? */
  298. int handle; /* event handle */
  299. gdth_evt_str event;
  300. } gdth_ioctl_event;
  301. /* GDTIOCTL_RESCAN/GDTIOCTL_HDRLIST */
  302. typedef struct {
  303. u16 ionode; /* controller number */
  304. u8 flag; /* add/remove */
  305. u16 hdr_no; /* drive no. */
  306. struct {
  307. u8 bus; /* SCSI bus */
  308. u8 target; /* target ID */
  309. u8 lun; /* LUN */
  310. u8 cluster_type; /* cluster properties */
  311. } hdr_list[MAX_HDRIVES]; /* index is host drive number */
  312. } gdth_ioctl_rescan;
  313. /* GDTIOCTL_RESET_BUS/GDTIOCTL_RESET_DRV */
  314. typedef struct {
  315. u16 ionode; /* controller number */
  316. u16 number; /* bus/host drive number */
  317. u16 status; /* status */
  318. } gdth_ioctl_reset;
  319. #endif