cciss_cmd.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. #ifndef CCISS_CMD_H
  2. #define CCISS_CMD_H
  3. #include <linux/cciss_defs.h>
  4. /* DEFINES */
  5. #define CISS_VERSION "1.00"
  6. /* general boundary definitions */
  7. #define MAXSGENTRIES 32
  8. #define CCISS_SG_CHAIN 0x80000000
  9. #define MAXREPLYQS 256
  10. /* Unit Attentions ASC's as defined for the MSA2012sa */
  11. #define POWER_OR_RESET 0x29
  12. #define STATE_CHANGED 0x2a
  13. #define UNIT_ATTENTION_CLEARED 0x2f
  14. #define LUN_FAILED 0x3e
  15. #define REPORT_LUNS_CHANGED 0x3f
  16. /* Unit Attentions ASCQ's as defined for the MSA2012sa */
  17. /* These ASCQ's defined for ASC = POWER_OR_RESET */
  18. #define POWER_ON_RESET 0x00
  19. #define POWER_ON_REBOOT 0x01
  20. #define SCSI_BUS_RESET 0x02
  21. #define MSA_TARGET_RESET 0x03
  22. #define CONTROLLER_FAILOVER 0x04
  23. #define TRANSCEIVER_SE 0x05
  24. #define TRANSCEIVER_LVD 0x06
  25. /* These ASCQ's defined for ASC = STATE_CHANGED */
  26. #define RESERVATION_PREEMPTED 0x03
  27. #define ASYM_ACCESS_CHANGED 0x06
  28. #define LUN_CAPACITY_CHANGED 0x09
  29. /* config space register offsets */
  30. #define CFG_VENDORID 0x00
  31. #define CFG_DEVICEID 0x02
  32. #define CFG_I2OBAR 0x10
  33. #define CFG_MEM1BAR 0x14
  34. /* i2o space register offsets */
  35. #define I2O_IBDB_SET 0x20
  36. #define I2O_IBDB_CLEAR 0x70
  37. #define I2O_INT_STATUS 0x30
  38. #define I2O_INT_MASK 0x34
  39. #define I2O_IBPOST_Q 0x40
  40. #define I2O_OBPOST_Q 0x44
  41. #define I2O_DMA1_CFG 0x214
  42. /* Configuration Table */
  43. #define CFGTBL_ChangeReq 0x00000001l
  44. #define CFGTBL_AccCmds 0x00000001l
  45. #define DOORBELL_CTLR_RESET 0x00000004l
  46. #define CFGTBL_Trans_Simple 0x00000002l
  47. #define CFGTBL_Trans_Performant 0x00000004l
  48. #define CFGTBL_BusType_Ultra2 0x00000001l
  49. #define CFGTBL_BusType_Ultra3 0x00000002l
  50. #define CFGTBL_BusType_Fibre1G 0x00000100l
  51. #define CFGTBL_BusType_Fibre2G 0x00000200l
  52. typedef struct _vals32
  53. {
  54. __u32 lower;
  55. __u32 upper;
  56. } vals32;
  57. typedef union _u64bit
  58. {
  59. vals32 val32;
  60. __u64 val;
  61. } u64bit;
  62. /* Type defs used in the following structs */
  63. #define QWORD vals32
  64. /* STRUCTURES */
  65. #define CISS_MAX_PHYS_LUN 1024
  66. /* SCSI-3 Cmmands */
  67. #pragma pack(1)
  68. #define CISS_INQUIRY 0x12
  69. /* Date returned */
  70. typedef struct _InquiryData_struct
  71. {
  72. BYTE data_byte[36];
  73. } InquiryData_struct;
  74. #define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */
  75. #define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */
  76. /* Data returned */
  77. typedef struct _ReportLUNdata_struct
  78. {
  79. BYTE LUNListLength[4];
  80. DWORD reserved;
  81. BYTE LUN[CISS_MAX_LUN][8];
  82. } ReportLunData_struct;
  83. #define CCISS_READ_CAPACITY 0x25 /* Read Capacity */
  84. typedef struct _ReadCapdata_struct
  85. {
  86. BYTE total_size[4]; /* Total size in blocks */
  87. BYTE block_size[4]; /* Size of blocks in bytes */
  88. } ReadCapdata_struct;
  89. #define CCISS_READ_CAPACITY_16 0x9e /* Read Capacity 16 */
  90. /* service action to differentiate a 16 byte read capacity from
  91. other commands that use the 0x9e SCSI op code */
  92. #define CCISS_READ_CAPACITY_16_SERVICE_ACT 0x10
  93. typedef struct _ReadCapdata_struct_16
  94. {
  95. BYTE total_size[8]; /* Total size in blocks */
  96. BYTE block_size[4]; /* Size of blocks in bytes */
  97. BYTE prot_en:1; /* protection enable bit */
  98. BYTE rto_en:1; /* reference tag own enable bit */
  99. BYTE reserved:6; /* reserved bits */
  100. BYTE reserved2[18]; /* reserved bytes per spec */
  101. } ReadCapdata_struct_16;
  102. /* Define the supported read/write commands for cciss based controllers */
  103. #define CCISS_READ_10 0x28 /* Read(10) */
  104. #define CCISS_WRITE_10 0x2a /* Write(10) */
  105. #define CCISS_READ_16 0x88 /* Read(16) */
  106. #define CCISS_WRITE_16 0x8a /* Write(16) */
  107. /* Define the CDB lengths supported by cciss based controllers */
  108. #define CDB_LEN10 10
  109. #define CDB_LEN16 16
  110. /* BMIC commands */
  111. #define BMIC_READ 0x26
  112. #define BMIC_WRITE 0x27
  113. #define BMIC_CACHE_FLUSH 0xc2
  114. #define CCISS_CACHE_FLUSH 0x01 /* C2 was already being used by CCISS */
  115. /* Command List Structure */
  116. #define CTLR_LUNID "\0\0\0\0\0\0\0\0"
  117. typedef struct _CommandListHeader_struct {
  118. BYTE ReplyQueue;
  119. BYTE SGList;
  120. HWORD SGTotal;
  121. QWORD Tag;
  122. LUNAddr_struct LUN;
  123. } CommandListHeader_struct;
  124. typedef struct _ErrDescriptor_struct {
  125. QWORD Addr;
  126. DWORD Len;
  127. } ErrDescriptor_struct;
  128. typedef struct _SGDescriptor_struct {
  129. QWORD Addr;
  130. DWORD Len;
  131. DWORD Ext;
  132. } SGDescriptor_struct;
  133. /* Command types */
  134. #define CMD_RWREQ 0x00
  135. #define CMD_IOCTL_PEND 0x01
  136. #define CMD_SCSI 0x03
  137. #define CMD_MSG_DONE 0x04
  138. #define CMD_MSG_TIMEOUT 0x05
  139. #define CMD_MSG_STALE 0xff
  140. /* This structure needs to be divisible by COMMANDLIST_ALIGNMENT
  141. * because low bits of the address are used to to indicate that
  142. * whether the tag contains an index or an address. PAD_32 and
  143. * PAD_64 can be adjusted independently as needed for 32-bit
  144. * and 64-bits systems.
  145. */
  146. #define COMMANDLIST_ALIGNMENT (32)
  147. #define IS_64_BIT ((sizeof(long) - 4)/4)
  148. #define IS_32_BIT (!IS_64_BIT)
  149. #define PAD_32 (0)
  150. #define PAD_64 (4)
  151. #define PADSIZE (IS_32_BIT * PAD_32 + IS_64_BIT * PAD_64)
  152. #define DIRECT_LOOKUP_BIT 0x10
  153. #define DIRECT_LOOKUP_SHIFT 5
  154. typedef struct _CommandList_struct {
  155. CommandListHeader_struct Header;
  156. RequestBlock_struct Request;
  157. ErrDescriptor_struct ErrDesc;
  158. SGDescriptor_struct SG[MAXSGENTRIES];
  159. /* information associated with the command */
  160. __u32 busaddr; /* physical address of this record */
  161. ErrorInfo_struct * err_info; /* pointer to the allocated mem */
  162. int ctlr;
  163. int cmd_type;
  164. long cmdindex;
  165. struct list_head list;
  166. struct request * rq;
  167. struct completion *waiting;
  168. int retry_count;
  169. void * scsi_cmd;
  170. char pad[PADSIZE];
  171. } CommandList_struct;
  172. /* Configuration Table Structure */
  173. typedef struct _HostWrite_struct {
  174. DWORD TransportRequest;
  175. DWORD Reserved;
  176. DWORD CoalIntDelay;
  177. DWORD CoalIntCount;
  178. } HostWrite_struct;
  179. typedef struct _CfgTable_struct {
  180. BYTE Signature[4];
  181. DWORD SpecValence;
  182. #define SIMPLE_MODE 0x02
  183. #define PERFORMANT_MODE 0x04
  184. #define MEMQ_MODE 0x08
  185. DWORD TransportSupport;
  186. DWORD TransportActive;
  187. HostWrite_struct HostWrite;
  188. DWORD CmdsOutMax;
  189. DWORD BusTypes;
  190. DWORD TransMethodOffset;
  191. BYTE ServerName[16];
  192. DWORD HeartBeat;
  193. DWORD SCSI_Prefetch;
  194. DWORD MaxSGElements;
  195. DWORD MaxLogicalUnits;
  196. DWORD MaxPhysicalDrives;
  197. DWORD MaxPhysicalDrivesPerLogicalUnit;
  198. DWORD MaxPerformantModeCommands;
  199. u8 reserved[0x78 - 0x58];
  200. u32 misc_fw_support; /* offset 0x78 */
  201. #define MISC_FW_DOORBELL_RESET (0x02)
  202. } CfgTable_struct;
  203. struct TransTable_struct {
  204. u32 BlockFetch0;
  205. u32 BlockFetch1;
  206. u32 BlockFetch2;
  207. u32 BlockFetch3;
  208. u32 BlockFetch4;
  209. u32 BlockFetch5;
  210. u32 BlockFetch6;
  211. u32 BlockFetch7;
  212. u32 RepQSize;
  213. u32 RepQCount;
  214. u32 RepQCtrAddrLow32;
  215. u32 RepQCtrAddrHigh32;
  216. u32 RepQAddr0Low32;
  217. u32 RepQAddr0High32;
  218. };
  219. #pragma pack()
  220. #endif /* CCISS_CMD_H */