More Makefile cleanups, otherwise mainly noticeable are the netfilter fix
[davej-history.git] / drivers / block / cciss_cmd.h
blob456a3a021dc8c0cde33a5680531b9f60d3e73354
1 #ifndef CCISS_CMD_H
2 #define CCISS_CMD_H
3 //###########################################################################
4 //DEFINES
5 //###########################################################################
6 #define CISS_VERSION "1.00"
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
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
28 //transfer direction
29 #define XFER_NONE 0x00
30 #define XFER_WRITE 0x01
31 #define XFER_READ 0x02
32 #define XFER_RSVD 0x03
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
41 //cdb type
42 #define TYPE_CMD 0x00
43 #define TYPE_MSG 0x01
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
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
59 //Configuration Table
60 #define CFGTBL_ChangeReq 0x00000001l
61 #define CFGTBL_AccCmds 0x00000001l
63 #define CFGTBL_Trans_Simple 0x00000002l
65 #define CFGTBL_BusType_Ultra2 0x00000001l
66 #define CFGTBL_BusType_Ultra3 0x00000002l
67 #define CFGTBL_BusType_Fibre1G 0x00000100l
68 #define CFGTBL_BusType_Fibre2G 0x00000200l
69 typedef struct _vals32
71 __u32 lower;
72 __u32 upper;
73 } vals32;
75 typedef union _u64bit
77 vals32 val32;
78 __u64 val;
79 } u64bit;
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
88 //###########################################################################
89 //STRUCTURES
90 //###########################################################################
91 #define CISS_MAX_LUN 16
92 // SCSI-3 Cmmands
94 #pragma pack(1)
96 #define CISS_INQUIRY 0x12
97 //Date returned
98 typedef struct _InquiryData_struct
100 BYTE data_byte[36];
101 } InquiryData_struct;
103 #define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */
104 // Data returned
105 typedef struct _ReportLUNdata_struct
107 BYTE LUNListLength[4];
108 DWORD reserved;
109 BYTE LUN[CISS_MAX_LUN][8];
110 } ReportLunData_struct;
112 #define CCISS_READ_CAPACITY 0x25 /* Read Capacity */
113 typedef struct _ReadCapdata_struct
115 BYTE total_size[4]; // Total size in blocks
116 BYTE block_size[4]; // Size of blocks in bytes
117 } ReadCapdata_struct;
119 // 12 byte commands not implemented in firmware yet.
120 // #define CCISS_READ 0xa8 // Read(12)
121 // #define CCISS_WRITE 0xaa // Write(12)
122 #define CCISS_READ 0x28 // Read(10)
123 #define CCISS_WRITE 0x2a // Write(10)
125 //Command List Structure
126 typedef union _SCSI3Addr_struct {
127 struct {
128 BYTE Bus:6;
129 BYTE Mode:2; // b00
130 BYTE Dev;
131 } PeripDev;
132 struct {
133 BYTE DevMSB:6;
134 BYTE Mode:2; // b01
135 BYTE DevLSB;
136 } LogDev;
137 struct {
138 BYTE Targ:6;
139 BYTE Mode:2; // b10
140 BYTE Dev:5;
141 BYTE Bus:3;
142 } LogUnit;
143 } SCSI3Addr_struct;
145 typedef struct _PhysDevAddr_struct {
146 DWORD TargetId:24;
147 DWORD Bus:6;
148 DWORD Mode:2;
149 SCSI3Addr_struct Target[2]; //2 level target device addr
150 } PhysDevAddr_struct;
152 typedef struct _LogDevAddr_struct {
153 DWORD VolId:30;
154 DWORD Mode:2;
155 BYTE reserved[4];
156 } LogDevAddr_struct;
158 typedef union _LUNAddr_struct {
159 BYTE LunAddrBytes[8];
160 SCSI3Addr_struct SCSI3Lun[4];
161 PhysDevAddr_struct PhysDev;
162 LogDevAddr_struct LogDev;
163 } LUNAddr_struct;
165 typedef struct _CommandListHeader_struct {
166 BYTE ReplyQueue;
167 BYTE SGList;
168 HWORD SGTotal;
169 QWORD Tag;
170 LUNAddr_struct LUN;
171 } CommandListHeader_struct;
172 typedef struct _RequestBlock_struct {
173 BYTE CDBLen;
174 struct {
175 BYTE Type:3;
176 BYTE Attribute:3;
177 BYTE Direction:2;
178 } Type;
179 HWORD Timeout;
180 BYTE CDB[16];
181 } RequestBlock_struct;
182 typedef struct _ErrDescriptor_struct {
183 QWORD Addr;
184 DWORD Len;
185 } ErrDescriptor_struct;
186 typedef struct _SGDescriptor_struct {
187 QWORD Addr;
188 DWORD Len;
189 DWORD Ext;
190 } SGDescriptor_struct;
192 typedef union _MoreErrInfo_struct{
193 struct {
194 BYTE Reserved[3];
195 BYTE Type;
196 DWORD ErrorInfo;
197 }Common_Info;
198 struct{
199 BYTE Reserved[2];
200 BYTE offense_size;//size of offending entry
201 BYTE offense_num; //byte # of offense 0-base
202 DWORD offense_value;
203 }Invalid_Cmd;
204 }MoreErrInfo_struct;
205 typedef struct _ErrorInfo_struct {
206 BYTE ScsiStatus;
207 BYTE SenseLen;
208 HWORD CommandStatus;
209 DWORD ResidualCnt;
210 MoreErrInfo_struct MoreErrInfo;
211 BYTE SenseInfo[SENSEINFOBYTES];
212 } ErrorInfo_struct;
214 /* Command types */
215 #define CMD_RWREQ 0x00
216 #define CMD_IOCTL_PEND 0x01
217 #define CMD_IOCTL_DONE 0x02
219 typedef struct _CommandList_struct {
220 CommandListHeader_struct Header;
221 RequestBlock_struct Request;
222 ErrDescriptor_struct ErrDesc;
223 SGDescriptor_struct SG[MAXSGENTRIES];
224 /* information associated with the command */
225 __u32 busaddr; /* physical addres of this record */
226 ErrorInfo_struct * err_info; /* pointer to the allocated mem */
227 int cmd_type;
228 struct _CommandList_struct *prev;
229 struct _CommandList_struct *next;
230 struct buffer_head * bh;
231 } CommandList_struct;
233 //Configuration Table Structure
234 typedef struct _HostWrite_struct {
235 DWORD TransportRequest;
236 DWORD Reserved;
237 DWORD CoalIntDelay;
238 DWORD CoalIntCount;
239 } HostWrite_struct;
241 typedef struct _CfgTable_struct {
242 BYTE Signature[4];
243 DWORD SpecValence;
244 DWORD TransportSupport;
245 DWORD TransportActive;
246 HostWrite_struct HostWrite;
247 DWORD CmdsOutMax;
248 DWORD BusTypes;
249 DWORD Reserved;
250 BYTE ServerName[16];
251 DWORD HeartBeat;
252 } CfgTable_struct;
253 #pragma pack()
254 #endif // CCISS_CMD_H