gdth_ioctl.h 14 KB

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