[PATCH] cciss: fix pci ssid for the E500 controller
[deliverable/linux.git] / drivers / block / cciss_cmd.h
CommitLineData
1da177e4
LT
1#ifndef CCISS_CMD_H
2#define CCISS_CMD_H
3//###########################################################################
4//DEFINES
5//###########################################################################
6#define CISS_VERSION "1.00"
7
8//general boundary defintions
9#define SENSEINFOBYTES 32//note that this value may vary between host implementations
10#define MAXSGENTRIES 31
11#define MAXREPLYQS 256
12
13//Command Status value
14#define CMD_SUCCESS 0x0000
15#define CMD_TARGET_STATUS 0x0001
16#define CMD_DATA_UNDERRUN 0x0002
17#define CMD_DATA_OVERRUN 0x0003
18#define CMD_INVALID 0x0004
19#define CMD_PROTOCOL_ERR 0x0005
20#define CMD_HARDWARE_ERR 0x0006
21#define CMD_CONNECTION_LOST 0x0007
22#define CMD_ABORTED 0x0008
23#define CMD_ABORT_FAILED 0x0009
24#define CMD_UNSOLICITED_ABORT 0x000A
25#define CMD_TIMEOUT 0x000B
26#define CMD_UNABORTABLE 0x000C
27
28//transfer direction
29#define XFER_NONE 0x00
30#define XFER_WRITE 0x01
31#define XFER_READ 0x02
32#define XFER_RSVD 0x03
33
34//task attribute
35#define ATTR_UNTAGGED 0x00
36#define ATTR_SIMPLE 0x04
37#define ATTR_HEADOFQUEUE 0x05
38#define ATTR_ORDERED 0x06
39#define ATTR_ACA 0x07
40
41//cdb type
42#define TYPE_CMD 0x00
43#define TYPE_MSG 0x01
44
45//config space register offsets
46#define CFG_VENDORID 0x00
47#define CFG_DEVICEID 0x02
48#define CFG_I2OBAR 0x10
49#define CFG_MEM1BAR 0x14
50
51//i2o space register offsets
52#define I2O_IBDB_SET 0x20
53#define I2O_IBDB_CLEAR 0x70
54#define I2O_INT_STATUS 0x30
55#define I2O_INT_MASK 0x34
56#define I2O_IBPOST_Q 0x40
57#define I2O_OBPOST_Q 0x44
58
59//Configuration Table
60#define CFGTBL_ChangeReq 0x00000001l
61#define CFGTBL_AccCmds 0x00000001l
62
63#define CFGTBL_Trans_Simple 0x00000002l
64
65#define CFGTBL_BusType_Ultra2 0x00000001l
66#define CFGTBL_BusType_Ultra3 0x00000002l
67#define CFGTBL_BusType_Fibre1G 0x00000100l
68#define CFGTBL_BusType_Fibre2G 0x00000200l
69typedef struct _vals32
70{
71 __u32 lower;
72 __u32 upper;
73} vals32;
74
75typedef union _u64bit
76{
77 vals32 val32;
78 __u64 val;
79} u64bit;
80
81// Type defs used in the following structs
82#define BYTE __u8
83#define WORD __u16
84#define HWORD __u16
85#define DWORD __u32
86#define QWORD vals32
87
88//###########################################################################
89//STRUCTURES
90//###########################################################################
91#define CISS_MAX_LUN 16
92#define CISS_MAX_PHYS_LUN 1024
93// SCSI-3 Cmmands
94
95#pragma pack(1)
96
97#define CISS_INQUIRY 0x12
98//Date returned
99typedef struct _InquiryData_struct
100{
101 BYTE data_byte[36];
102} InquiryData_struct;
103
104#define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */
105#define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */
106// Data returned
107typedef struct _ReportLUNdata_struct
108{
109 BYTE LUNListLength[4];
110 DWORD reserved;
111 BYTE LUN[CISS_MAX_LUN][8];
112} ReportLunData_struct;
113
114#define CCISS_READ_CAPACITY 0x25 /* Read Capacity */
115typedef struct _ReadCapdata_struct
116{
117 BYTE total_size[4]; // Total size in blocks
118 BYTE block_size[4]; // Size of blocks in bytes
119} ReadCapdata_struct;
120
00988a35
MMOD
121#define CCISS_READ_CAPACITY_16 0x9e /* Read Capacity 16 */
122
123/* service action to differentiate a 16 byte read capacity from
124 other commands that use the 0x9e SCSI op code */
125
126#define CCISS_READ_CAPACITY_16_SERVICE_ACT 0x10
127
128typedef struct _ReadCapdata_struct_16
129{
130 BYTE total_size[8]; /* Total size in blocks */
131 BYTE block_size[4]; /* Size of blocks in bytes */
132 BYTE prot_en:1; /* protection enable bit */
133 BYTE rto_en:1; /* reference tag own enable bit */
134 BYTE reserved:6; /* reserved bits */
135 BYTE reserved2[18]; /* reserved bytes per spec */
136} ReadCapdata_struct_16;
137
138/* Define the supported read/write commands for cciss based controllers */
139
140#define CCISS_READ_10 0x28 /* Read(10) */
141#define CCISS_WRITE_10 0x2a /* Write(10) */
142#define CCISS_READ_16 0x88 /* Read(16) */
143#define CCISS_WRITE_16 0x8a /* Write(16) */
144
145/* Define the CDB lengths supported by cciss based controllers */
146
147#define CDB_LEN10 10
148#define CDB_LEN16 16
1da177e4
LT
149
150// BMIC commands
151#define BMIC_READ 0x26
152#define BMIC_WRITE 0x27
153#define BMIC_CACHE_FLUSH 0xc2
154#define CCISS_CACHE_FLUSH 0x01 //C2 was already being used by CCISS
155
156//Command List Structure
157typedef union _SCSI3Addr_struct {
158 struct {
159 BYTE Dev;
160 BYTE Bus:6;
161 BYTE Mode:2; // b00
162 } PeripDev;
163 struct {
164 BYTE DevLSB;
165 BYTE DevMSB:6;
166 BYTE Mode:2; // b01
167 } LogDev;
168 struct {
169 BYTE Dev:5;
170 BYTE Bus:3;
171 BYTE Targ:6;
172 BYTE Mode:2; // b10
173 } LogUnit;
174} SCSI3Addr_struct;
175
176typedef struct _PhysDevAddr_struct {
177 DWORD TargetId:24;
178 DWORD Bus:6;
179 DWORD Mode:2;
180 SCSI3Addr_struct Target[2]; //2 level target device addr
181} PhysDevAddr_struct;
182
183typedef struct _LogDevAddr_struct {
184 DWORD VolId:30;
185 DWORD Mode:2;
186 BYTE reserved[4];
187} LogDevAddr_struct;
188
189typedef union _LUNAddr_struct {
190 BYTE LunAddrBytes[8];
191 SCSI3Addr_struct SCSI3Lun[4];
192 PhysDevAddr_struct PhysDev;
193 LogDevAddr_struct LogDev;
194} LUNAddr_struct;
195
196typedef struct _CommandListHeader_struct {
197 BYTE ReplyQueue;
198 BYTE SGList;
199 HWORD SGTotal;
200 QWORD Tag;
201 LUNAddr_struct LUN;
202} CommandListHeader_struct;
203typedef struct _RequestBlock_struct {
204 BYTE CDBLen;
205 struct {
206 BYTE Type:3;
207 BYTE Attribute:3;
208 BYTE Direction:2;
209 } Type;
210 HWORD Timeout;
211 BYTE CDB[16];
212} RequestBlock_struct;
213typedef struct _ErrDescriptor_struct {
214 QWORD Addr;
215 DWORD Len;
216} ErrDescriptor_struct;
217typedef struct _SGDescriptor_struct {
218 QWORD Addr;
219 DWORD Len;
220 DWORD Ext;
221} SGDescriptor_struct;
222
223typedef union _MoreErrInfo_struct{
224 struct {
225 BYTE Reserved[3];
226 BYTE Type;
227 DWORD ErrorInfo;
228 }Common_Info;
229 struct{
230 BYTE Reserved[2];
231 BYTE offense_size;//size of offending entry
232 BYTE offense_num; //byte # of offense 0-base
233 DWORD offense_value;
234 }Invalid_Cmd;
235}MoreErrInfo_struct;
236typedef struct _ErrorInfo_struct {
237 BYTE ScsiStatus;
238 BYTE SenseLen;
239 HWORD CommandStatus;
240 DWORD ResidualCnt;
241 MoreErrInfo_struct MoreErrInfo;
242 BYTE SenseInfo[SENSEINFOBYTES];
243} ErrorInfo_struct;
244
245/* Command types */
246#define CMD_RWREQ 0x00
247#define CMD_IOCTL_PEND 0x01
248#define CMD_SCSI 0x03
249#define CMD_MSG_DONE 0x04
250#define CMD_MSG_TIMEOUT 0x05
251
33079b21
MM
252/* This structure needs to be divisible by 8 for new
253 * indexing method.
254 */
255#define PADSIZE (sizeof(long) - 4)
1da177e4
LT
256typedef struct _CommandList_struct {
257 CommandListHeader_struct Header;
258 RequestBlock_struct Request;
259 ErrDescriptor_struct ErrDesc;
260 SGDescriptor_struct SG[MAXSGENTRIES];
261 /* information associated with the command */
262 __u32 busaddr; /* physical address of this record */
263 ErrorInfo_struct * err_info; /* pointer to the allocated mem */
264 int ctlr;
265 int cmd_type;
33079b21 266 long cmdindex;
1da177e4
LT
267 struct _CommandList_struct *prev;
268 struct _CommandList_struct *next;
269 struct request * rq;
270 struct completion *waiting;
271 int retry_count;
1da177e4 272 void * scsi_cmd;
33079b21 273 char pad[PADSIZE];
1da177e4
LT
274} CommandList_struct;
275
276//Configuration Table Structure
277typedef struct _HostWrite_struct {
278 DWORD TransportRequest;
279 DWORD Reserved;
280 DWORD CoalIntDelay;
281 DWORD CoalIntCount;
282} HostWrite_struct;
283
284typedef struct _CfgTable_struct {
285 BYTE Signature[4];
286 DWORD SpecValence;
287 DWORD TransportSupport;
288 DWORD TransportActive;
289 HostWrite_struct HostWrite;
290 DWORD CmdsOutMax;
291 DWORD BusTypes;
292 DWORD Reserved;
293 BYTE ServerName[16];
294 DWORD HeartBeat;
295 DWORD SCSI_Prefetch;
296} CfgTable_struct;
297#pragma pack()
298#endif // CCISS_CMD_H
This page took 0.181687 seconds and 5 git commands to generate.