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