cciss_ioctl.h 6.6 KB

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