cciss_ioctl.h 6.6 KB

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