aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/cciss_cmd.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/cciss_cmd.h')
-rw-r--r--drivers/block/cciss_cmd.h164
1 files changed, 31 insertions, 133 deletions
diff --git a/drivers/block/cciss_cmd.h b/drivers/block/cciss_cmd.h
index 6afa700890ff..e624ff959cb6 100644
--- a/drivers/block/cciss_cmd.h
+++ b/drivers/block/cciss_cmd.h
@@ -1,31 +1,16 @@
1#ifndef CCISS_CMD_H 1#ifndef CCISS_CMD_H
2#define CCISS_CMD_H 2#define CCISS_CMD_H
3//########################################################################### 3
4//DEFINES 4#include <linux/cciss_defs.h>
5//########################################################################### 5
6/* DEFINES */
6#define CISS_VERSION "1.00" 7#define CISS_VERSION "1.00"
7 8
8//general boundary definitions 9/* general boundary definitions */
9#define SENSEINFOBYTES 32//note that this value may vary between host implementations
10#define MAXSGENTRIES 32 10#define MAXSGENTRIES 32
11#define CCISS_SG_CHAIN 0x80000000 11#define CCISS_SG_CHAIN 0x80000000
12#define MAXREPLYQS 256 12#define MAXREPLYQS 256
13 13
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
28
29/* Unit Attentions ASC's as defined for the MSA2012sa */ 14/* Unit Attentions ASC's as defined for the MSA2012sa */
30#define POWER_OR_RESET 0x29 15#define POWER_OR_RESET 0x29
31#define STATE_CHANGED 0x2a 16#define STATE_CHANGED 0x2a
@@ -49,30 +34,13 @@
49#define ASYM_ACCESS_CHANGED 0x06 34#define ASYM_ACCESS_CHANGED 0x06
50#define LUN_CAPACITY_CHANGED 0x09 35#define LUN_CAPACITY_CHANGED 0x09
51 36
52//transfer direction 37/* config space register offsets */
53#define XFER_NONE 0x00
54#define XFER_WRITE 0x01
55#define XFER_READ 0x02
56#define XFER_RSVD 0x03
57
58//task attribute
59#define ATTR_UNTAGGED 0x00
60#define ATTR_SIMPLE 0x04
61#define ATTR_HEADOFQUEUE 0x05
62#define ATTR_ORDERED 0x06
63#define ATTR_ACA 0x07
64
65//cdb type
66#define TYPE_CMD 0x00
67#define TYPE_MSG 0x01
68
69//config space register offsets
70#define CFG_VENDORID 0x00 38#define CFG_VENDORID 0x00
71#define CFG_DEVICEID 0x02 39#define CFG_DEVICEID 0x02
72#define CFG_I2OBAR 0x10 40#define CFG_I2OBAR 0x10
73#define CFG_MEM1BAR 0x14 41#define CFG_MEM1BAR 0x14
74 42
75//i2o space register offsets 43/* i2o space register offsets */
76#define I2O_IBDB_SET 0x20 44#define I2O_IBDB_SET 0x20
77#define I2O_IBDB_CLEAR 0x70 45#define I2O_IBDB_CLEAR 0x70
78#define I2O_INT_STATUS 0x30 46#define I2O_INT_STATUS 0x30
@@ -81,7 +49,7 @@
81#define I2O_OBPOST_Q 0x44 49#define I2O_OBPOST_Q 0x44
82#define I2O_DMA1_CFG 0x214 50#define I2O_DMA1_CFG 0x214
83 51
84//Configuration Table 52/* Configuration Table */
85#define CFGTBL_ChangeReq 0x00000001l 53#define CFGTBL_ChangeReq 0x00000001l
86#define CFGTBL_AccCmds 0x00000001l 54#define CFGTBL_AccCmds 0x00000001l
87 55
@@ -103,24 +71,17 @@ typedef union _u64bit
103 __u64 val; 71 __u64 val;
104} u64bit; 72} u64bit;
105 73
106// Type defs used in the following structs 74/* Type defs used in the following structs */
107#define BYTE __u8
108#define WORD __u16
109#define HWORD __u16
110#define DWORD __u32
111#define QWORD vals32 75#define QWORD vals32
112 76
113//########################################################################### 77/* STRUCTURES */
114//STRUCTURES
115//###########################################################################
116#define CISS_MAX_LUN 1024
117#define CISS_MAX_PHYS_LUN 1024 78#define CISS_MAX_PHYS_LUN 1024
118// SCSI-3 Cmmands 79/* SCSI-3 Cmmands */
119 80
120#pragma pack(1) 81#pragma pack(1)
121 82
122#define CISS_INQUIRY 0x12 83#define CISS_INQUIRY 0x12
123//Date returned 84/* Date returned */
124typedef struct _InquiryData_struct 85typedef struct _InquiryData_struct
125{ 86{
126 BYTE data_byte[36]; 87 BYTE data_byte[36];
@@ -128,7 +89,7 @@ typedef struct _InquiryData_struct
128 89
129#define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */ 90#define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */
130#define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */ 91#define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */
131// Data returned 92/* Data returned */
132typedef struct _ReportLUNdata_struct 93typedef struct _ReportLUNdata_struct
133{ 94{
134 BYTE LUNListLength[4]; 95 BYTE LUNListLength[4];
@@ -139,8 +100,8 @@ typedef struct _ReportLUNdata_struct
139#define CCISS_READ_CAPACITY 0x25 /* Read Capacity */ 100#define CCISS_READ_CAPACITY 0x25 /* Read Capacity */
140typedef struct _ReadCapdata_struct 101typedef struct _ReadCapdata_struct
141{ 102{
142 BYTE total_size[4]; // Total size in blocks 103 BYTE total_size[4]; /* Total size in blocks */
143 BYTE block_size[4]; // Size of blocks in bytes 104 BYTE block_size[4]; /* Size of blocks in bytes */
144} ReadCapdata_struct; 105} ReadCapdata_struct;
145 106
146#define CCISS_READ_CAPACITY_16 0x9e /* Read Capacity 16 */ 107#define CCISS_READ_CAPACITY_16 0x9e /* Read Capacity 16 */
@@ -172,52 +133,13 @@ typedef struct _ReadCapdata_struct_16
172#define CDB_LEN10 10 133#define CDB_LEN10 10
173#define CDB_LEN16 16 134#define CDB_LEN16 16
174 135
175// BMIC commands 136/* BMIC commands */
176#define BMIC_READ 0x26 137#define BMIC_READ 0x26
177#define BMIC_WRITE 0x27 138#define BMIC_WRITE 0x27
178#define BMIC_CACHE_FLUSH 0xc2 139#define BMIC_CACHE_FLUSH 0xc2
179#define CCISS_CACHE_FLUSH 0x01 //C2 was already being used by CCISS 140#define CCISS_CACHE_FLUSH 0x01 /* C2 was already being used by CCISS */
180
181//Command List Structure
182typedef union _SCSI3Addr_struct {
183 struct {
184 BYTE Dev;
185 BYTE Bus:6;
186 BYTE Mode:2; // b00
187 } PeripDev;
188 struct {
189 BYTE DevLSB;
190 BYTE DevMSB:6;
191 BYTE Mode:2; // b01
192 } LogDev;
193 struct {
194 BYTE Dev:5;
195 BYTE Bus:3;
196 BYTE Targ:6;
197 BYTE Mode:2; // b10
198 } LogUnit;
199} SCSI3Addr_struct;
200
201typedef struct _PhysDevAddr_struct {
202 DWORD TargetId:24;
203 DWORD Bus:6;
204 DWORD Mode:2;
205 SCSI3Addr_struct Target[2]; //2 level target device addr
206} PhysDevAddr_struct;
207
208typedef struct _LogDevAddr_struct {
209 DWORD VolId:30;
210 DWORD Mode:2;
211 BYTE reserved[4];
212} LogDevAddr_struct;
213
214typedef union _LUNAddr_struct {
215 BYTE LunAddrBytes[8];
216 SCSI3Addr_struct SCSI3Lun[4];
217 PhysDevAddr_struct PhysDev;
218 LogDevAddr_struct LogDev;
219} LUNAddr_struct;
220 141
142/* Command List Structure */
221#define CTLR_LUNID "\0\0\0\0\0\0\0\0" 143#define CTLR_LUNID "\0\0\0\0\0\0\0\0"
222 144
223typedef struct _CommandListHeader_struct { 145typedef struct _CommandListHeader_struct {
@@ -227,16 +149,6 @@ typedef struct _CommandListHeader_struct {
227 QWORD Tag; 149 QWORD Tag;
228 LUNAddr_struct LUN; 150 LUNAddr_struct LUN;
229} CommandListHeader_struct; 151} CommandListHeader_struct;
230typedef struct _RequestBlock_struct {
231 BYTE CDBLen;
232 struct {
233 BYTE Type:3;
234 BYTE Attribute:3;
235 BYTE Direction:2;
236 } Type;
237 HWORD Timeout;
238 BYTE CDB[16];
239} RequestBlock_struct;
240typedef struct _ErrDescriptor_struct { 152typedef struct _ErrDescriptor_struct {
241 QWORD Addr; 153 QWORD Addr;
242 DWORD Len; 154 DWORD Len;
@@ -247,28 +159,6 @@ typedef struct _SGDescriptor_struct {
247 DWORD Ext; 159 DWORD Ext;
248} SGDescriptor_struct; 160} SGDescriptor_struct;
249 161
250typedef union _MoreErrInfo_struct{
251 struct {
252 BYTE Reserved[3];
253 BYTE Type;
254 DWORD ErrorInfo;
255 }Common_Info;
256 struct{
257 BYTE Reserved[2];
258 BYTE offense_size;//size of offending entry
259 BYTE offense_num; //byte # of offense 0-base
260 DWORD offense_value;
261 }Invalid_Cmd;
262}MoreErrInfo_struct;
263typedef struct _ErrorInfo_struct {
264 BYTE ScsiStatus;
265 BYTE SenseLen;
266 HWORD CommandStatus;
267 DWORD ResidualCnt;
268 MoreErrInfo_struct MoreErrInfo;
269 BYTE SenseInfo[SENSEINFOBYTES];
270} ErrorInfo_struct;
271
272/* Command types */ 162/* Command types */
273#define CMD_RWREQ 0x00 163#define CMD_RWREQ 0x00
274#define CMD_IOCTL_PEND 0x01 164#define CMD_IOCTL_PEND 0x01
@@ -277,10 +167,18 @@ typedef struct _ErrorInfo_struct {
277#define CMD_MSG_TIMEOUT 0x05 167#define CMD_MSG_TIMEOUT 0x05
278#define CMD_MSG_STALE 0xff 168#define CMD_MSG_STALE 0xff
279 169
280/* This structure needs to be divisible by 8 for new 170/* This structure needs to be divisible by COMMANDLIST_ALIGNMENT
281 * indexing method. 171 * because low bits of the address are used to to indicate that
172 * whether the tag contains an index or an address. PAD_32 and
173 * PAD_64 can be adjusted independently as needed for 32-bit
174 * and 64-bits systems.
282 */ 175 */
283#define PADSIZE (sizeof(long) - 4) 176#define COMMANDLIST_ALIGNMENT (8)
177#define IS_64_BIT ((sizeof(long) - 4)/4)
178#define IS_32_BIT (!IS_64_BIT)
179#define PAD_32 (0)
180#define PAD_64 (4)
181#define PADSIZE (IS_32_BIT * PAD_32 + IS_64_BIT * PAD_64)
284typedef struct _CommandList_struct { 182typedef struct _CommandList_struct {
285 CommandListHeader_struct Header; 183 CommandListHeader_struct Header;
286 RequestBlock_struct Request; 184 RequestBlock_struct Request;
@@ -300,7 +198,7 @@ typedef struct _CommandList_struct {
300 char pad[PADSIZE]; 198 char pad[PADSIZE];
301} CommandList_struct; 199} CommandList_struct;
302 200
303//Configuration Table Structure 201/* Configuration Table Structure */
304typedef struct _HostWrite_struct { 202typedef struct _HostWrite_struct {
305 DWORD TransportRequest; 203 DWORD TransportRequest;
306 DWORD Reserved; 204 DWORD Reserved;
@@ -326,4 +224,4 @@ typedef struct _CfgTable_struct {
326 DWORD MaxPhysicalDrivesPerLogicalUnit; 224 DWORD MaxPhysicalDrivesPerLogicalUnit;
327} CfgTable_struct; 225} CfgTable_struct;
328#pragma pack() 226#pragma pack()
329#endif // CCISS_CMD_H 227#endif /* CCISS_CMD_H */