gdth_ioctl.h 15 KB

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