cciss_cmd.h 6.2 KB

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