gdth_ioctl.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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. #define MAX_HDRIVES MAX_LDRIVES /* max. host drive count */
  27. /* scatter/gather element */
  28. typedef struct {
  29. u32 sg_ptr; /* address */
  30. u32 sg_len; /* length */
  31. } __attribute__((packed)) gdth_sg_str;
  32. /* scatter/gather element - 64bit addresses */
  33. typedef struct {
  34. u64 sg_ptr; /* address */
  35. u32 sg_len; /* length */
  36. } __attribute__((packed)) gdth_sg64_str;
  37. /* command structure */
  38. typedef struct {
  39. u32 BoardNode; /* board node (always 0) */
  40. u32 CommandIndex; /* command number */
  41. u16 OpCode; /* the command (READ,..) */
  42. union {
  43. struct {
  44. u16 DeviceNo; /* number of cache drive */
  45. u32 BlockNo; /* block number */
  46. u32 BlockCnt; /* block count */
  47. u32 DestAddr; /* dest. addr. (if s/g: -1) */
  48. u32 sg_canz; /* s/g element count */
  49. gdth_sg_str sg_lst[GDTH_MAXSG]; /* s/g list */
  50. } __attribute__((packed)) cache; /* cache service cmd. str. */
  51. struct {
  52. u16 DeviceNo; /* number of cache drive */
  53. u64 BlockNo; /* block number */
  54. u32 BlockCnt; /* block count */
  55. u64 DestAddr; /* dest. addr. (if s/g: -1) */
  56. u32 sg_canz; /* s/g element count */
  57. gdth_sg64_str sg_lst[GDTH_MAXSG]; /* s/g list */
  58. } __attribute__((packed)) cache64; /* cache service cmd. str. */
  59. struct {
  60. u16 param_size; /* size of p_param buffer */
  61. u32 subfunc; /* IOCTL function */
  62. u32 channel; /* device */
  63. u64 p_param; /* buffer */
  64. } __attribute__((packed)) ioctl; /* IOCTL command structure */
  65. struct {
  66. u16 reserved;
  67. union {
  68. struct {
  69. u32 msg_handle; /* message handle */
  70. u64 msg_addr; /* message buffer address */
  71. } __attribute__((packed)) msg;
  72. u8 data[12]; /* buffer for rtc data, ... */
  73. } su;
  74. } __attribute__((packed)) screen; /* screen service cmd. str. */
  75. struct {
  76. u16 reserved;
  77. u32 direction; /* data direction */
  78. u32 mdisc_time; /* disc. time (0: no timeout)*/
  79. u32 mcon_time; /* connect time(0: no to.) */
  80. u32 sdata; /* dest. addr. (if s/g: -1) */
  81. u32 sdlen; /* data length (bytes) */
  82. u32 clen; /* SCSI cmd. length(6,10,12) */
  83. u8 cmd[12]; /* SCSI command */
  84. u8 target; /* target ID */
  85. u8 lun; /* LUN */
  86. u8 bus; /* SCSI bus number */
  87. u8 priority; /* only 0 used */
  88. u32 sense_len; /* sense data length */
  89. u32 sense_data; /* sense data addr. */
  90. u32 link_p; /* linked cmds (not supp.) */
  91. u32 sg_ranz; /* s/g element count */
  92. gdth_sg_str sg_lst[GDTH_MAXSG]; /* s/g list */
  93. } __attribute__((packed)) raw; /* raw service cmd. struct. */
  94. struct {
  95. u16 reserved;
  96. u32 direction; /* data direction */
  97. u32 mdisc_time; /* disc. time (0: no timeout)*/
  98. u32 mcon_time; /* connect time(0: no to.) */
  99. u64 sdata; /* dest. addr. (if s/g: -1) */
  100. u32 sdlen; /* data length (bytes) */
  101. u32 clen; /* SCSI cmd. length(6,..,16) */
  102. u8 cmd[16]; /* SCSI command */
  103. u8 target; /* target ID */
  104. u8 lun; /* LUN */
  105. u8 bus; /* SCSI bus number */
  106. u8 priority; /* only 0 used */
  107. u32 sense_len; /* sense data length */
  108. u64 sense_data; /* sense data addr. */
  109. u32 sg_ranz; /* s/g element count */
  110. gdth_sg64_str sg_lst[GDTH_MAXSG]; /* s/g list */
  111. } __attribute__((packed)) raw64; /* raw service cmd. struct. */
  112. } u;
  113. /* additional variables */
  114. u8 Service; /* controller service */
  115. u8 reserved;
  116. u16 Status; /* command result */
  117. u32 Info; /* additional information */
  118. void *RequestBuffer; /* request buffer */
  119. } __attribute__((packed)) gdth_cmd_str;
  120. /* controller event structure */
  121. #define ES_ASYNC 1
  122. #define ES_DRIVER 2
  123. #define ES_TEST 3
  124. #define ES_SYNC 4
  125. typedef struct {
  126. u16 size; /* size of structure */
  127. union {
  128. char stream[16];
  129. struct {
  130. u16 ionode;
  131. u16 service;
  132. u32 index;
  133. } __attribute__((packed)) driver;
  134. struct {
  135. u16 ionode;
  136. u16 service;
  137. u16 status;
  138. u32 info;
  139. u8 scsi_coord[3];
  140. } __attribute__((packed)) async;
  141. struct {
  142. u16 ionode;
  143. u16 service;
  144. u16 status;
  145. u32 info;
  146. u16 hostdrive;
  147. u8 scsi_coord[3];
  148. u8 sense_key;
  149. } __attribute__((packed)) sync;
  150. struct {
  151. u32 l1, l2, l3, l4;
  152. } __attribute__((packed)) test;
  153. } eu;
  154. u32 severity;
  155. u8 event_string[256];
  156. } __attribute__((packed)) gdth_evt_data;
  157. typedef struct {
  158. u32 first_stamp;
  159. u32 last_stamp;
  160. u16 same_count;
  161. u16 event_source;
  162. u16 event_idx;
  163. u8 application;
  164. u8 reserved;
  165. gdth_evt_data event_data;
  166. } __attribute__((packed)) gdth_evt_str;
  167. /* GDTIOCTL_GENERAL */
  168. typedef struct {
  169. u16 ionode; /* controller number */
  170. u16 timeout; /* timeout */
  171. u32 info; /* error info */
  172. u16 status; /* status */
  173. unsigned long data_len; /* data buffer size */
  174. unsigned long sense_len; /* sense buffer size */
  175. gdth_cmd_str command; /* command */
  176. } gdth_ioctl_general;
  177. /* GDTIOCTL_LOCKDRV */
  178. typedef struct {
  179. u16 ionode; /* controller number */
  180. u8 lock; /* lock/unlock */
  181. u8 drive_cnt; /* drive count */
  182. u16 drives[MAX_HDRIVES]; /* drives */
  183. } gdth_ioctl_lockdrv;
  184. /* GDTIOCTL_LOCKCHN */
  185. typedef struct {
  186. u16 ionode; /* controller number */
  187. u8 lock; /* lock/unlock */
  188. u8 channel; /* channel */
  189. } gdth_ioctl_lockchn;
  190. /* GDTIOCTL_OSVERS */
  191. typedef struct {
  192. u8 version; /* OS version */
  193. u8 subversion; /* OS subversion */
  194. u16 revision; /* revision */
  195. } gdth_ioctl_osvers;
  196. /* GDTIOCTL_CTRTYPE */
  197. typedef struct {
  198. u16 ionode; /* controller number */
  199. u8 type; /* controller type */
  200. u16 info; /* slot etc. */
  201. u16 oem_id; /* OEM ID */
  202. u16 bios_ver; /* not used */
  203. u16 access; /* not used */
  204. u16 ext_type; /* extended type */
  205. u16 device_id; /* device ID */
  206. u16 sub_device_id; /* sub device ID */
  207. } gdth_ioctl_ctrtype;
  208. /* GDTIOCTL_EVENT */
  209. typedef struct {
  210. u16 ionode;
  211. int erase; /* erase event? */
  212. int handle; /* event handle */
  213. gdth_evt_str event;
  214. } gdth_ioctl_event;
  215. /* GDTIOCTL_RESCAN/GDTIOCTL_HDRLIST */
  216. typedef struct {
  217. u16 ionode; /* controller number */
  218. u8 flag; /* add/remove */
  219. u16 hdr_no; /* drive no. */
  220. struct {
  221. u8 bus; /* SCSI bus */
  222. u8 target; /* target ID */
  223. u8 lun; /* LUN */
  224. u8 cluster_type; /* cluster properties */
  225. } hdr_list[MAX_HDRIVES]; /* index is host drive number */
  226. } gdth_ioctl_rescan;
  227. /* GDTIOCTL_RESET_BUS/GDTIOCTL_RESET_DRV */
  228. typedef struct {
  229. u16 ionode; /* controller number */
  230. u16 number; /* bus/host drive number */
  231. u16 status; /* status */
  232. } gdth_ioctl_reset;
  233. #endif