cciss_cmd.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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 DOORBELL_CTLR_RESET2 0x00000020l
  47. #define CFGTBL_Trans_Simple 0x00000002l
  48. #define CFGTBL_Trans_Performant 0x00000004l
  49. #define CFGTBL_Trans_use_short_tags 0x20000000l
  50. #define CFGTBL_BusType_Ultra2 0x00000001l
  51. #define CFGTBL_BusType_Ultra3 0x00000002l
  52. #define CFGTBL_BusType_Fibre1G 0x00000100l
  53. #define CFGTBL_BusType_Fibre2G 0x00000200l
  54. typedef struct _vals32
  55. {
  56. __u32 lower;
  57. __u32 upper;
  58. } vals32;
  59. typedef union _u64bit
  60. {
  61. vals32 val32;
  62. __u64 val;
  63. } u64bit;
  64. /* Type defs used in the following structs */
  65. #define QWORD vals32
  66. /* STRUCTURES */
  67. #define CISS_MAX_PHYS_LUN 1024
  68. /* SCSI-3 Cmmands */
  69. #pragma pack(1)
  70. #define CISS_INQUIRY 0x12
  71. /* Date returned */
  72. typedef struct _InquiryData_struct
  73. {
  74. BYTE data_byte[36];
  75. } InquiryData_struct;
  76. #define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */
  77. #define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */
  78. /* Data returned */
  79. typedef struct _ReportLUNdata_struct
  80. {
  81. BYTE LUNListLength[4];
  82. DWORD reserved;
  83. BYTE LUN[CISS_MAX_LUN][8];
  84. } ReportLunData_struct;
  85. #define CCISS_READ_CAPACITY 0x25 /* Read Capacity */
  86. typedef struct _ReadCapdata_struct
  87. {
  88. BYTE total_size[4]; /* Total size in blocks */
  89. BYTE block_size[4]; /* Size of blocks in bytes */
  90. } ReadCapdata_struct;
  91. #define CCISS_READ_CAPACITY_16 0x9e /* Read Capacity 16 */
  92. /* service action to differentiate a 16 byte read capacity from
  93. other commands that use the 0x9e SCSI op code */
  94. #define CCISS_READ_CAPACITY_16_SERVICE_ACT 0x10
  95. typedef struct _ReadCapdata_struct_16
  96. {
  97. BYTE total_size[8]; /* Total size in blocks */
  98. BYTE block_size[4]; /* Size of blocks in bytes */
  99. BYTE prot_en:1; /* protection enable bit */
  100. BYTE rto_en:1; /* reference tag own enable bit */
  101. BYTE reserved:6; /* reserved bits */
  102. BYTE reserved2[18]; /* reserved bytes per spec */
  103. } ReadCapdata_struct_16;
  104. /* Define the supported read/write commands for cciss based controllers */
  105. #define CCISS_READ_10 0x28 /* Read(10) */
  106. #define CCISS_WRITE_10 0x2a /* Write(10) */
  107. #define CCISS_READ_16 0x88 /* Read(16) */
  108. #define CCISS_WRITE_16 0x8a /* Write(16) */
  109. /* Define the CDB lengths supported by cciss based controllers */
  110. #define CDB_LEN10 10
  111. #define CDB_LEN16 16
  112. /* BMIC commands */
  113. #define BMIC_READ 0x26
  114. #define BMIC_WRITE 0x27
  115. #define BMIC_CACHE_FLUSH 0xc2
  116. #define CCISS_CACHE_FLUSH 0x01 /* C2 was already being used by CCISS */
  117. #define CCISS_ABORT_MSG 0x00
  118. #define CCISS_RESET_MSG 0x01
  119. #define CCISS_RESET_TYPE_CONTROLLER 0x00
  120. #define CCISS_RESET_TYPE_BUS 0x01
  121. #define CCISS_RESET_TYPE_TARGET 0x03
  122. #define CCISS_RESET_TYPE_LUN 0x04
  123. #define CCISS_NOOP_MSG 0x03
  124. /* Command List Structure */
  125. #define CTLR_LUNID "\0\0\0\0\0\0\0\0"
  126. typedef struct _CommandListHeader_struct {
  127. BYTE ReplyQueue;
  128. BYTE SGList;
  129. HWORD SGTotal;
  130. QWORD Tag;
  131. LUNAddr_struct LUN;
  132. } CommandListHeader_struct;
  133. typedef struct _ErrDescriptor_struct {
  134. QWORD Addr;
  135. DWORD Len;
  136. } ErrDescriptor_struct;
  137. typedef struct _SGDescriptor_struct {
  138. QWORD Addr;
  139. DWORD Len;
  140. DWORD Ext;
  141. } SGDescriptor_struct;
  142. /* Command types */
  143. #define CMD_RWREQ 0x00
  144. #define CMD_IOCTL_PEND 0x01
  145. #define CMD_SCSI 0x03
  146. #define CMD_MSG_DONE 0x04
  147. #define CMD_MSG_TIMEOUT 0x05
  148. #define CMD_MSG_STALE 0xff
  149. /* This structure needs to be divisible by COMMANDLIST_ALIGNMENT
  150. * because low bits of the address are used to to indicate that
  151. * whether the tag contains an index or an address. PAD_32 and
  152. * PAD_64 can be adjusted independently as needed for 32-bit
  153. * and 64-bits systems.
  154. */
  155. #define COMMANDLIST_ALIGNMENT (32)
  156. #define IS_64_BIT ((sizeof(long) - 4)/4)
  157. #define IS_32_BIT (!IS_64_BIT)
  158. #define PAD_32 (0)
  159. #define PAD_64 (4)
  160. #define PADSIZE (IS_32_BIT * PAD_32 + IS_64_BIT * PAD_64)
  161. #define DIRECT_LOOKUP_BIT 0x10
  162. #define DIRECT_LOOKUP_SHIFT 5
  163. typedef struct _CommandList_struct {
  164. CommandListHeader_struct Header;
  165. RequestBlock_struct Request;
  166. ErrDescriptor_struct ErrDesc;
  167. SGDescriptor_struct SG[MAXSGENTRIES];
  168. /* information associated with the command */
  169. __u32 busaddr; /* physical address of this record */
  170. ErrorInfo_struct * err_info; /* pointer to the allocated mem */
  171. int ctlr;
  172. int cmd_type;
  173. long cmdindex;
  174. struct list_head list;
  175. struct request * rq;
  176. struct completion *waiting;
  177. int retry_count;
  178. void * scsi_cmd;
  179. char pad[PADSIZE];
  180. } CommandList_struct;
  181. /* Configuration Table Structure */
  182. typedef struct _HostWrite_struct {
  183. DWORD TransportRequest;
  184. DWORD Reserved;
  185. DWORD CoalIntDelay;
  186. DWORD CoalIntCount;
  187. } HostWrite_struct;
  188. typedef struct _CfgTable_struct {
  189. BYTE Signature[4];
  190. DWORD SpecValence;
  191. #define SIMPLE_MODE 0x02
  192. #define PERFORMANT_MODE 0x04
  193. #define MEMQ_MODE 0x08
  194. DWORD TransportSupport;
  195. DWORD TransportActive;
  196. HostWrite_struct HostWrite;
  197. DWORD CmdsOutMax;
  198. DWORD BusTypes;
  199. DWORD TransMethodOffset;
  200. BYTE ServerName[16];
  201. DWORD HeartBeat;
  202. DWORD SCSI_Prefetch;
  203. DWORD MaxSGElements;
  204. DWORD MaxLogicalUnits;
  205. DWORD MaxPhysicalDrives;
  206. DWORD MaxPhysicalDrivesPerLogicalUnit;
  207. DWORD MaxPerformantModeCommands;
  208. u8 reserved[0x78 - 0x58];
  209. u32 misc_fw_support; /* offset 0x78 */
  210. #define MISC_FW_DOORBELL_RESET (0x02)
  211. #define MISC_FW_DOORBELL_RESET2 (0x10)
  212. u8 driver_version[32];
  213. } CfgTable_struct;
  214. struct TransTable_struct {
  215. u32 BlockFetch0;
  216. u32 BlockFetch1;
  217. u32 BlockFetch2;
  218. u32 BlockFetch3;
  219. u32 BlockFetch4;
  220. u32 BlockFetch5;
  221. u32 BlockFetch6;
  222. u32 BlockFetch7;
  223. u32 RepQSize;
  224. u32 RepQCount;
  225. u32 RepQCtrAddrLow32;
  226. u32 RepQCtrAddrHigh32;
  227. u32 RepQAddr0Low32;
  228. u32 RepQAddr0High32;
  229. };
  230. #pragma pack()
  231. #endif /* CCISS_CMD_H */