cciss_ioctl.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. #ifndef CCISS_IOCTLH
  2. #define CCISS_IOCTLH
  3. #include <linux/types.h>
  4. #include <linux/ioctl.h>
  5. #define CCISS_IOC_MAGIC 'B'
  6. typedef struct _cciss_pci_info_struct
  7. {
  8. unsigned char bus;
  9. unsigned char dev_fn;
  10. unsigned short domain;
  11. __u32 board_id;
  12. } cciss_pci_info_struct;
  13. typedef struct _cciss_coalint_struct
  14. {
  15. __u32 delay;
  16. __u32 count;
  17. } cciss_coalint_struct;
  18. typedef char NodeName_type[16];
  19. typedef __u32 Heartbeat_type;
  20. #define CISS_PARSCSIU2 0x0001
  21. #define CISS_PARCSCIU3 0x0002
  22. #define CISS_FIBRE1G 0x0100
  23. #define CISS_FIBRE2G 0x0200
  24. typedef __u32 BusTypes_type;
  25. typedef char FirmwareVer_type[4];
  26. typedef __u32 DriverVer_type;
  27. #define MAX_KMALLOC_SIZE 128000
  28. #ifndef CCISS_CMD_H
  29. /* This defines are duplicated in cciss_cmd.h in the driver directory */
  30. /* general boundary definitions */
  31. #define SENSEINFOBYTES 32 /* note that this value may vary
  32. between host implementations */
  33. /* Command Status value */
  34. #define CMD_SUCCESS 0x0000
  35. #define CMD_TARGET_STATUS 0x0001
  36. #define CMD_DATA_UNDERRUN 0x0002
  37. #define CMD_DATA_OVERRUN 0x0003
  38. #define CMD_INVALID 0x0004
  39. #define CMD_PROTOCOL_ERR 0x0005
  40. #define CMD_HARDWARE_ERR 0x0006
  41. #define CMD_CONNECTION_LOST 0x0007
  42. #define CMD_ABORTED 0x0008
  43. #define CMD_ABORT_FAILED 0x0009
  44. #define CMD_UNSOLICITED_ABORT 0x000A
  45. #define CMD_TIMEOUT 0x000B
  46. #define CMD_UNABORTABLE 0x000C
  47. /* transfer direction */
  48. #define XFER_NONE 0x00
  49. #define XFER_WRITE 0x01
  50. #define XFER_READ 0x02
  51. #define XFER_RSVD 0x03
  52. /* task attribute */
  53. #define ATTR_UNTAGGED 0x00
  54. #define ATTR_SIMPLE 0x04
  55. #define ATTR_HEADOFQUEUE 0x05
  56. #define ATTR_ORDERED 0x06
  57. #define ATTR_ACA 0x07
  58. /* cdb type */
  59. #define TYPE_CMD 0x00
  60. #define TYPE_MSG 0x01
  61. /* Type defs used in the following structs */
  62. #define BYTE __u8
  63. #define WORD __u16
  64. #define HWORD __u16
  65. #define DWORD __u32
  66. #define CISS_MAX_LUN 1024
  67. #define LEVEL2LUN 1 /* index into Target(x) structure, due to byte swapping */
  68. #define LEVEL3LUN 0
  69. #pragma pack(1)
  70. /* Command List Structure */
  71. typedef union _SCSI3Addr_struct {
  72. struct {
  73. BYTE Dev;
  74. BYTE Bus:6;
  75. BYTE Mode:2; /* b00 */
  76. } PeripDev;
  77. struct {
  78. BYTE DevLSB;
  79. BYTE DevMSB:6;
  80. BYTE Mode:2; /* b01 */
  81. } LogDev;
  82. struct {
  83. BYTE Dev:5;
  84. BYTE Bus:3;
  85. BYTE Targ:6;
  86. BYTE Mode:2; /* b10 */
  87. } LogUnit;
  88. } SCSI3Addr_struct;
  89. typedef struct _PhysDevAddr_struct {
  90. DWORD TargetId:24;
  91. DWORD Bus:6;
  92. DWORD Mode:2;
  93. SCSI3Addr_struct Target[2]; /* 2 level target device addr */
  94. } PhysDevAddr_struct;
  95. typedef struct _LogDevAddr_struct {
  96. DWORD VolId:30;
  97. DWORD Mode:2;
  98. BYTE reserved[4];
  99. } LogDevAddr_struct;
  100. typedef union _LUNAddr_struct {
  101. BYTE LunAddrBytes[8];
  102. SCSI3Addr_struct SCSI3Lun[4];
  103. PhysDevAddr_struct PhysDev;
  104. LogDevAddr_struct LogDev;
  105. } LUNAddr_struct;
  106. typedef struct _RequestBlock_struct {
  107. BYTE CDBLen;
  108. struct {
  109. BYTE Type:3;
  110. BYTE Attribute:3;
  111. BYTE Direction:2;
  112. } Type;
  113. HWORD Timeout;
  114. BYTE CDB[16];
  115. } RequestBlock_struct;
  116. typedef union _MoreErrInfo_struct{
  117. struct {
  118. BYTE Reserved[3];
  119. BYTE Type;
  120. DWORD ErrorInfo;
  121. }Common_Info;
  122. struct{
  123. BYTE Reserved[2];
  124. BYTE offense_size; /* size of offending entry */
  125. BYTE offense_num; /* byte # of offense 0-base */
  126. DWORD offense_value;
  127. }Invalid_Cmd;
  128. }MoreErrInfo_struct;
  129. typedef struct _ErrorInfo_struct {
  130. BYTE ScsiStatus;
  131. BYTE SenseLen;
  132. HWORD CommandStatus;
  133. DWORD ResidualCnt;
  134. MoreErrInfo_struct MoreErrInfo;
  135. BYTE SenseInfo[SENSEINFOBYTES];
  136. } ErrorInfo_struct;
  137. #pragma pack()
  138. #endif /* CCISS_CMD_H */
  139. typedef struct _IOCTL_Command_struct {
  140. LUNAddr_struct LUN_info;
  141. RequestBlock_struct Request;
  142. ErrorInfo_struct error_info;
  143. WORD buf_size; /* size in bytes of the buf */
  144. BYTE __user *buf;
  145. } IOCTL_Command_struct;
  146. typedef struct _BIG_IOCTL_Command_struct {
  147. LUNAddr_struct LUN_info;
  148. RequestBlock_struct Request;
  149. ErrorInfo_struct error_info;
  150. DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */
  151. DWORD buf_size; /* size in bytes of the buf */
  152. /* < malloc_size * MAXSGENTRIES */
  153. BYTE __user *buf;
  154. } BIG_IOCTL_Command_struct;
  155. typedef struct _LogvolInfo_struct{
  156. __u32 LunID;
  157. int num_opens; /* number of opens on the logical volume */
  158. int num_parts; /* number of partitions configured on logvol */
  159. } LogvolInfo_struct;
  160. #define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct)
  161. #define CCISS_GETINTINFO _IOR(CCISS_IOC_MAGIC, 2, cciss_coalint_struct)
  162. #define CCISS_SETINTINFO _IOW(CCISS_IOC_MAGIC, 3, cciss_coalint_struct)
  163. #define CCISS_GETNODENAME _IOR(CCISS_IOC_MAGIC, 4, NodeName_type)
  164. #define CCISS_SETNODENAME _IOW(CCISS_IOC_MAGIC, 5, NodeName_type)
  165. #define CCISS_GETHEARTBEAT _IOR(CCISS_IOC_MAGIC, 6, Heartbeat_type)
  166. #define CCISS_GETBUSTYPES _IOR(CCISS_IOC_MAGIC, 7, BusTypes_type)
  167. #define CCISS_GETFIRMVER _IOR(CCISS_IOC_MAGIC, 8, FirmwareVer_type)
  168. #define CCISS_GETDRIVVER _IOR(CCISS_IOC_MAGIC, 9, DriverVer_type)
  169. #define CCISS_REVALIDVOLS _IO(CCISS_IOC_MAGIC, 10)
  170. #define CCISS_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct)
  171. #define CCISS_DEREGDISK _IO(CCISS_IOC_MAGIC, 12)
  172. /* no longer used... use REGNEWD instead */
  173. #define CCISS_REGNEWDISK _IOW(CCISS_IOC_MAGIC, 13, int)
  174. #define CCISS_REGNEWD _IO(CCISS_IOC_MAGIC, 14)
  175. #define CCISS_RESCANDISK _IO(CCISS_IOC_MAGIC, 16)
  176. #define CCISS_GETLUNINFO _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct)
  177. #define CCISS_BIG_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL_Command_struct)
  178. #ifdef __KERNEL__
  179. #ifdef CONFIG_COMPAT
  180. /* 32 bit compatible ioctl structs */
  181. typedef struct _IOCTL32_Command_struct {
  182. LUNAddr_struct LUN_info;
  183. RequestBlock_struct Request;
  184. ErrorInfo_struct error_info;
  185. WORD buf_size; /* size in bytes of the buf */
  186. __u32 buf; /* 32 bit pointer to data buffer */
  187. } IOCTL32_Command_struct;
  188. typedef struct _BIG_IOCTL32_Command_struct {
  189. LUNAddr_struct LUN_info;
  190. RequestBlock_struct Request;
  191. ErrorInfo_struct error_info;
  192. DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */
  193. DWORD buf_size; /* size in bytes of the buf */
  194. /* < malloc_size * MAXSGENTRIES */
  195. __u32 buf; /* 32 bit pointer to data buffer */
  196. } BIG_IOCTL32_Command_struct;
  197. #define CCISS_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 11, IOCTL32_Command_struct)
  198. #define CCISS_BIG_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL32_Command_struct)
  199. #endif /* CONFIG_COMPAT */
  200. #endif /* __KERNEL__ */
  201. #endif