3 //###########################################################################
5 //###########################################################################
6 #define CISS_VERSION "1.00"
8 //general boundary definitions
9 #define SENSEINFOBYTES 32//note that this value may vary between host implementations
10 #define MAXSGENTRIES 32
11 #define CCISS_SG_CHAIN 0x80000000
12 #define MAXREPLYQS 256
14 //Command Status value
15 #define CMD_SUCCESS 0x0000
16 #define CMD_TARGET_STATUS 0x0001
17 #define CMD_DATA_UNDERRUN 0x0002
18 #define CMD_DATA_OVERRUN 0x0003
19 #define CMD_INVALID 0x0004
20 #define CMD_PROTOCOL_ERR 0x0005
21 #define CMD_HARDWARE_ERR 0x0006
22 #define CMD_CONNECTION_LOST 0x0007
23 #define CMD_ABORTED 0x0008
24 #define CMD_ABORT_FAILED 0x0009
25 #define CMD_UNSOLICITED_ABORT 0x000A
26 #define CMD_TIMEOUT 0x000B
27 #define CMD_UNABORTABLE 0x000C
29 /* Unit Attentions ASC's as defined for the MSA2012sa */
30 #define POWER_OR_RESET 0x29
31 #define STATE_CHANGED 0x2a
32 #define UNIT_ATTENTION_CLEARED 0x2f
33 #define LUN_FAILED 0x3e
34 #define REPORT_LUNS_CHANGED 0x3f
36 /* Unit Attentions ASCQ's as defined for the MSA2012sa */
38 /* These ASCQ's defined for ASC = POWER_OR_RESET */
39 #define POWER_ON_RESET 0x00
40 #define POWER_ON_REBOOT 0x01
41 #define SCSI_BUS_RESET 0x02
42 #define MSA_TARGET_RESET 0x03
43 #define CONTROLLER_FAILOVER 0x04
44 #define TRANSCEIVER_SE 0x05
45 #define TRANSCEIVER_LVD 0x06
47 /* These ASCQ's defined for ASC = STATE_CHANGED */
48 #define RESERVATION_PREEMPTED 0x03
49 #define ASYM_ACCESS_CHANGED 0x06
50 #define LUN_CAPACITY_CHANGED 0x09
53 #define XFER_NONE 0x00
54 #define XFER_WRITE 0x01
55 #define XFER_READ 0x02
56 #define XFER_RSVD 0x03
59 #define ATTR_UNTAGGED 0x00
60 #define ATTR_SIMPLE 0x04
61 #define ATTR_HEADOFQUEUE 0x05
62 #define ATTR_ORDERED 0x06
69 //config space register offsets
70 #define CFG_VENDORID 0x00
71 #define CFG_DEVICEID 0x02
72 #define CFG_I2OBAR 0x10
73 #define CFG_MEM1BAR 0x14
75 //i2o space register offsets
76 #define I2O_IBDB_SET 0x20
77 #define I2O_IBDB_CLEAR 0x70
78 #define I2O_INT_STATUS 0x30
79 #define I2O_INT_MASK 0x34
80 #define I2O_IBPOST_Q 0x40
81 #define I2O_OBPOST_Q 0x44
82 #define I2O_DMA1_CFG 0x214
85 #define CFGTBL_ChangeReq 0x00000001l
86 #define CFGTBL_AccCmds 0x00000001l
88 #define CFGTBL_Trans_Simple 0x00000002l
90 #define CFGTBL_BusType_Ultra2 0x00000001l
91 #define CFGTBL_BusType_Ultra3 0x00000002l
92 #define CFGTBL_BusType_Fibre1G 0x00000100l
93 #define CFGTBL_BusType_Fibre2G 0x00000200l
94 typedef struct _vals32
100 typedef union _u64bit
106 // Type defs used in the following structs
113 //###########################################################################
115 //###########################################################################
116 #define CISS_MAX_LUN 1024
117 #define CISS_MAX_PHYS_LUN 1024
122 #define CISS_INQUIRY 0x12
124 typedef struct _InquiryData_struct
127 } InquiryData_struct
;
129 #define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */
130 #define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */
132 typedef struct _ReportLUNdata_struct
134 BYTE LUNListLength
[4];
136 BYTE LUN
[CISS_MAX_LUN
][8];
137 } ReportLunData_struct
;
139 #define CCISS_READ_CAPACITY 0x25 /* Read Capacity */
140 typedef struct _ReadCapdata_struct
142 BYTE total_size
[4]; // Total size in blocks
143 BYTE block_size
[4]; // Size of blocks in bytes
144 } ReadCapdata_struct
;
146 #define CCISS_READ_CAPACITY_16 0x9e /* Read Capacity 16 */
148 /* service action to differentiate a 16 byte read capacity from
149 other commands that use the 0x9e SCSI op code */
151 #define CCISS_READ_CAPACITY_16_SERVICE_ACT 0x10
153 typedef struct _ReadCapdata_struct_16
155 BYTE total_size
[8]; /* Total size in blocks */
156 BYTE block_size
[4]; /* Size of blocks in bytes */
157 BYTE prot_en
:1; /* protection enable bit */
158 BYTE rto_en
:1; /* reference tag own enable bit */
159 BYTE reserved
:6; /* reserved bits */
160 BYTE reserved2
[18]; /* reserved bytes per spec */
161 } ReadCapdata_struct_16
;
163 /* Define the supported read/write commands for cciss based controllers */
165 #define CCISS_READ_10 0x28 /* Read(10) */
166 #define CCISS_WRITE_10 0x2a /* Write(10) */
167 #define CCISS_READ_16 0x88 /* Read(16) */
168 #define CCISS_WRITE_16 0x8a /* Write(16) */
170 /* Define the CDB lengths supported by cciss based controllers */
176 #define BMIC_READ 0x26
177 #define BMIC_WRITE 0x27
178 #define BMIC_CACHE_FLUSH 0xc2
179 #define CCISS_CACHE_FLUSH 0x01 //C2 was already being used by CCISS
181 //Command List Structure
182 typedef union _SCSI3Addr_struct
{
201 typedef struct _PhysDevAddr_struct
{
205 SCSI3Addr_struct Target
[2]; //2 level target device addr
206 } PhysDevAddr_struct
;
208 typedef struct _LogDevAddr_struct
{
214 typedef union _LUNAddr_struct
{
215 BYTE LunAddrBytes
[8];
216 SCSI3Addr_struct SCSI3Lun
[4];
217 PhysDevAddr_struct PhysDev
;
218 LogDevAddr_struct LogDev
;
221 #define CTLR_LUNID "\0\0\0\0\0\0\0\0"
223 typedef struct _CommandListHeader_struct
{
229 } CommandListHeader_struct
;
230 typedef struct _RequestBlock_struct
{
239 } RequestBlock_struct
;
240 typedef struct _ErrDescriptor_struct
{
243 } ErrDescriptor_struct
;
244 typedef struct _SGDescriptor_struct
{
248 } SGDescriptor_struct
;
250 typedef union _MoreErrInfo_struct
{
258 BYTE offense_size
;//size of offending entry
259 BYTE offense_num
; //byte # of offense 0-base
263 typedef struct _ErrorInfo_struct
{
268 MoreErrInfo_struct MoreErrInfo
;
269 BYTE SenseInfo
[SENSEINFOBYTES
];
273 #define CMD_RWREQ 0x00
274 #define CMD_IOCTL_PEND 0x01
275 #define CMD_SCSI 0x03
276 #define CMD_MSG_DONE 0x04
277 #define CMD_MSG_TIMEOUT 0x05
278 #define CMD_MSG_STALE 0xff
280 /* This structure needs to be divisible by 8 for new
283 #define PADSIZE (sizeof(long) - 4)
284 typedef struct _CommandList_struct
{
285 CommandListHeader_struct Header
;
286 RequestBlock_struct Request
;
287 ErrDescriptor_struct ErrDesc
;
288 SGDescriptor_struct SG
[MAXSGENTRIES
];
289 /* information associated with the command */
290 __u32 busaddr
; /* physical address of this record */
291 ErrorInfo_struct
* err_info
; /* pointer to the allocated mem */
295 struct hlist_node list
;
297 struct completion
*waiting
;
301 } CommandList_struct
;
303 //Configuration Table Structure
304 typedef struct _HostWrite_struct
{
305 DWORD TransportRequest
;
311 typedef struct _CfgTable_struct
{
314 DWORD TransportSupport
;
315 DWORD TransportActive
;
316 HostWrite_struct HostWrite
;
324 DWORD MaxLogicalUnits
;
325 DWORD MaxPhysicalDrives
;
326 DWORD MaxPhysicalDrivesPerLogicalUnit
;
329 #endif // CCISS_CMD_H