aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/cciss_cmd.h
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-01-13 01:06:28 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-01-13 01:06:28 -0500
commitf43dc23d5ea91fca257be02138a255f02d98e806 (patch)
treeb29722f6e965316e90ac97abf79923ced250dc21 /drivers/block/cciss_cmd.h
parentf8e53553f452dcbf67cb89c8cba63a1cd6eb4cc0 (diff)
parent4162cf64973df51fc885825bc9ca4d055891c49f (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 into common/serial-rework
Conflicts: arch/sh/kernel/cpu/sh2/setup-sh7619.c arch/sh/kernel/cpu/sh2a/setup-mxg.c arch/sh/kernel/cpu/sh2a/setup-sh7201.c arch/sh/kernel/cpu/sh2a/setup-sh7203.c arch/sh/kernel/cpu/sh2a/setup-sh7206.c arch/sh/kernel/cpu/sh3/setup-sh7705.c arch/sh/kernel/cpu/sh3/setup-sh770x.c arch/sh/kernel/cpu/sh3/setup-sh7710.c arch/sh/kernel/cpu/sh3/setup-sh7720.c arch/sh/kernel/cpu/sh4/setup-sh4-202.c arch/sh/kernel/cpu/sh4/setup-sh7750.c arch/sh/kernel/cpu/sh4/setup-sh7760.c arch/sh/kernel/cpu/sh4a/setup-sh7343.c arch/sh/kernel/cpu/sh4a/setup-sh7366.c arch/sh/kernel/cpu/sh4a/setup-sh7722.c arch/sh/kernel/cpu/sh4a/setup-sh7723.c arch/sh/kernel/cpu/sh4a/setup-sh7724.c arch/sh/kernel/cpu/sh4a/setup-sh7763.c arch/sh/kernel/cpu/sh4a/setup-sh7770.c arch/sh/kernel/cpu/sh4a/setup-sh7780.c arch/sh/kernel/cpu/sh4a/setup-sh7785.c arch/sh/kernel/cpu/sh4a/setup-sh7786.c arch/sh/kernel/cpu/sh4a/setup-shx3.c arch/sh/kernel/cpu/sh5/setup-sh5.c drivers/serial/sh-sci.c drivers/serial/sh-sci.h include/linux/serial_sci.h
Diffstat (limited to 'drivers/block/cciss_cmd.h')
-rw-r--r--drivers/block/cciss_cmd.h206
1 files changed, 70 insertions, 136 deletions
diff --git a/drivers/block/cciss_cmd.h b/drivers/block/cciss_cmd.h
index cd665b00c7c5..eb060f1b00b6 100644
--- a/drivers/block/cciss_cmd.h
+++ b/drivers/block/cciss_cmd.h
@@ -1,30 +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 defintions 9/* general boundary definitions */
9#define SENSEINFOBYTES 32//note that this value may vary between host implementations 10#define MAXSGENTRIES 32
10#define MAXSGENTRIES 31 11#define CCISS_SG_CHAIN 0x80000000
11#define MAXREPLYQS 256 12#define MAXREPLYQS 256
12 13
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/* Unit Attentions ASC's as defined for the MSA2012sa */ 14/* Unit Attentions ASC's as defined for the MSA2012sa */
29#define POWER_OR_RESET 0x29 15#define POWER_OR_RESET 0x29
30#define STATE_CHANGED 0x2a 16#define STATE_CHANGED 0x2a
@@ -48,30 +34,13 @@
48#define ASYM_ACCESS_CHANGED 0x06 34#define ASYM_ACCESS_CHANGED 0x06
49#define LUN_CAPACITY_CHANGED 0x09 35#define LUN_CAPACITY_CHANGED 0x09
50 36
51//transfer direction 37/* config space register offsets */
52#define XFER_NONE 0x00
53#define XFER_WRITE 0x01
54#define XFER_READ 0x02
55#define XFER_RSVD 0x03
56
57//task attribute
58#define ATTR_UNTAGGED 0x00
59#define ATTR_SIMPLE 0x04
60#define ATTR_HEADOFQUEUE 0x05
61#define ATTR_ORDERED 0x06
62#define ATTR_ACA 0x07
63
64//cdb type
65#define TYPE_CMD 0x00
66#define TYPE_MSG 0x01
67
68//config space register offsets
69#define CFG_VENDORID 0x00 38#define CFG_VENDORID 0x00
70#define CFG_DEVICEID 0x02 39#define CFG_DEVICEID 0x02
71#define CFG_I2OBAR 0x10 40#define CFG_I2OBAR 0x10
72#define CFG_MEM1BAR 0x14 41#define CFG_MEM1BAR 0x14
73 42
74//i2o space register offsets 43/* i2o space register offsets */
75#define I2O_IBDB_SET 0x20 44#define I2O_IBDB_SET 0x20
76#define I2O_IBDB_CLEAR 0x70 45#define I2O_IBDB_CLEAR 0x70
77#define I2O_INT_STATUS 0x30 46#define I2O_INT_STATUS 0x30
@@ -80,11 +49,13 @@
80#define I2O_OBPOST_Q 0x44 49#define I2O_OBPOST_Q 0x44
81#define I2O_DMA1_CFG 0x214 50#define I2O_DMA1_CFG 0x214
82 51
83//Configuration Table 52/* Configuration Table */
84#define CFGTBL_ChangeReq 0x00000001l 53#define CFGTBL_ChangeReq 0x00000001l
85#define CFGTBL_AccCmds 0x00000001l 54#define CFGTBL_AccCmds 0x00000001l
55#define DOORBELL_CTLR_RESET 0x00000004l
86 56
87#define CFGTBL_Trans_Simple 0x00000002l 57#define CFGTBL_Trans_Simple 0x00000002l
58#define CFGTBL_Trans_Performant 0x00000004l
88 59
89#define CFGTBL_BusType_Ultra2 0x00000001l 60#define CFGTBL_BusType_Ultra2 0x00000001l
90#define CFGTBL_BusType_Ultra3 0x00000002l 61#define CFGTBL_BusType_Ultra3 0x00000002l
@@ -102,24 +73,17 @@ typedef union _u64bit
102 __u64 val; 73 __u64 val;
103} u64bit; 74} u64bit;
104 75
105// Type defs used in the following structs 76/* Type defs used in the following structs */
106#define BYTE __u8
107#define WORD __u16
108#define HWORD __u16
109#define DWORD __u32
110#define QWORD vals32 77#define QWORD vals32
111 78
112//########################################################################### 79/* STRUCTURES */
113//STRUCTURES
114//###########################################################################
115#define CISS_MAX_LUN 1024
116#define CISS_MAX_PHYS_LUN 1024 80#define CISS_MAX_PHYS_LUN 1024
117// SCSI-3 Cmmands 81/* SCSI-3 Cmmands */
118 82
119#pragma pack(1) 83#pragma pack(1)
120 84
121#define CISS_INQUIRY 0x12 85#define CISS_INQUIRY 0x12
122//Date returned 86/* Date returned */
123typedef struct _InquiryData_struct 87typedef struct _InquiryData_struct
124{ 88{
125 BYTE data_byte[36]; 89 BYTE data_byte[36];
@@ -127,7 +91,7 @@ typedef struct _InquiryData_struct
127 91
128#define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */ 92#define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */
129#define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */ 93#define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */
130// Data returned 94/* Data returned */
131typedef struct _ReportLUNdata_struct 95typedef struct _ReportLUNdata_struct
132{ 96{
133 BYTE LUNListLength[4]; 97 BYTE LUNListLength[4];
@@ -138,8 +102,8 @@ typedef struct _ReportLUNdata_struct
138#define CCISS_READ_CAPACITY 0x25 /* Read Capacity */ 102#define CCISS_READ_CAPACITY 0x25 /* Read Capacity */
139typedef struct _ReadCapdata_struct 103typedef struct _ReadCapdata_struct
140{ 104{
141 BYTE total_size[4]; // Total size in blocks 105 BYTE total_size[4]; /* Total size in blocks */
142 BYTE block_size[4]; // Size of blocks in bytes 106 BYTE block_size[4]; /* Size of blocks in bytes */
143} ReadCapdata_struct; 107} ReadCapdata_struct;
144 108
145#define CCISS_READ_CAPACITY_16 0x9e /* Read Capacity 16 */ 109#define CCISS_READ_CAPACITY_16 0x9e /* Read Capacity 16 */
@@ -171,52 +135,13 @@ typedef struct _ReadCapdata_struct_16
171#define CDB_LEN10 10 135#define CDB_LEN10 10
172#define CDB_LEN16 16 136#define CDB_LEN16 16
173 137
174// BMIC commands 138/* BMIC commands */
175#define BMIC_READ 0x26 139#define BMIC_READ 0x26
176#define BMIC_WRITE 0x27 140#define BMIC_WRITE 0x27
177#define BMIC_CACHE_FLUSH 0xc2 141#define BMIC_CACHE_FLUSH 0xc2
178#define CCISS_CACHE_FLUSH 0x01 //C2 was already being used by CCISS 142#define CCISS_CACHE_FLUSH 0x01 /* C2 was already being used by CCISS */
179
180//Command List Structure
181typedef union _SCSI3Addr_struct {
182 struct {
183 BYTE Dev;
184 BYTE Bus:6;
185 BYTE Mode:2; // b00
186 } PeripDev;
187 struct {
188 BYTE DevLSB;
189 BYTE DevMSB:6;
190 BYTE Mode:2; // b01
191 } LogDev;
192 struct {
193 BYTE Dev:5;
194 BYTE Bus:3;
195 BYTE Targ:6;
196 BYTE Mode:2; // b10
197 } LogUnit;
198} SCSI3Addr_struct;
199
200typedef struct _PhysDevAddr_struct {
201 DWORD TargetId:24;
202 DWORD Bus:6;
203 DWORD Mode:2;
204 SCSI3Addr_struct Target[2]; //2 level target device addr
205} PhysDevAddr_struct;
206
207typedef struct _LogDevAddr_struct {
208 DWORD VolId:30;
209 DWORD Mode:2;
210 BYTE reserved[4];
211} LogDevAddr_struct;
212
213typedef union _LUNAddr_struct {
214 BYTE LunAddrBytes[8];
215 SCSI3Addr_struct SCSI3Lun[4];
216 PhysDevAddr_struct PhysDev;
217 LogDevAddr_struct LogDev;
218} LUNAddr_struct;
219 143
144/* Command List Structure */
220#define CTLR_LUNID "\0\0\0\0\0\0\0\0" 145#define CTLR_LUNID "\0\0\0\0\0\0\0\0"
221 146
222typedef struct _CommandListHeader_struct { 147typedef struct _CommandListHeader_struct {
@@ -226,16 +151,6 @@ typedef struct _CommandListHeader_struct {
226 QWORD Tag; 151 QWORD Tag;
227 LUNAddr_struct LUN; 152 LUNAddr_struct LUN;
228} CommandListHeader_struct; 153} CommandListHeader_struct;
229typedef struct _RequestBlock_struct {
230 BYTE CDBLen;
231 struct {
232 BYTE Type:3;
233 BYTE Attribute:3;
234 BYTE Direction:2;
235 } Type;
236 HWORD Timeout;
237 BYTE CDB[16];
238} RequestBlock_struct;
239typedef struct _ErrDescriptor_struct { 154typedef struct _ErrDescriptor_struct {
240 QWORD Addr; 155 QWORD Addr;
241 DWORD Len; 156 DWORD Len;
@@ -246,39 +161,29 @@ typedef struct _SGDescriptor_struct {
246 DWORD Ext; 161 DWORD Ext;
247} SGDescriptor_struct; 162} SGDescriptor_struct;
248 163
249typedef union _MoreErrInfo_struct{
250 struct {
251 BYTE Reserved[3];
252 BYTE Type;
253 DWORD ErrorInfo;
254 }Common_Info;
255 struct{
256 BYTE Reserved[2];
257 BYTE offense_size;//size of offending entry
258 BYTE offense_num; //byte # of offense 0-base
259 DWORD offense_value;
260 }Invalid_Cmd;
261}MoreErrInfo_struct;
262typedef struct _ErrorInfo_struct {
263 BYTE ScsiStatus;
264 BYTE SenseLen;
265 HWORD CommandStatus;
266 DWORD ResidualCnt;
267 MoreErrInfo_struct MoreErrInfo;
268 BYTE SenseInfo[SENSEINFOBYTES];
269} ErrorInfo_struct;
270
271/* Command types */ 164/* Command types */
272#define CMD_RWREQ 0x00 165#define CMD_RWREQ 0x00
273#define CMD_IOCTL_PEND 0x01 166#define CMD_IOCTL_PEND 0x01
274#define CMD_SCSI 0x03 167#define CMD_SCSI 0x03
275#define CMD_MSG_DONE 0x04 168#define CMD_MSG_DONE 0x04
276#define CMD_MSG_TIMEOUT 0x05 169#define CMD_MSG_TIMEOUT 0x05
170#define CMD_MSG_STALE 0xff
277 171
278/* This structure needs to be divisible by 8 for new 172/* This structure needs to be divisible by COMMANDLIST_ALIGNMENT
279 * indexing method. 173 * because low bits of the address are used to to indicate that
174 * whether the tag contains an index or an address. PAD_32 and
175 * PAD_64 can be adjusted independently as needed for 32-bit
176 * and 64-bits systems.
280 */ 177 */
281#define PADSIZE (sizeof(long) - 4) 178#define COMMANDLIST_ALIGNMENT (32)
179#define IS_64_BIT ((sizeof(long) - 4)/4)
180#define IS_32_BIT (!IS_64_BIT)
181#define PAD_32 (0)
182#define PAD_64 (4)
183#define PADSIZE (IS_32_BIT * PAD_32 + IS_64_BIT * PAD_64)
184#define DIRECT_LOOKUP_BIT 0x10
185#define DIRECT_LOOKUP_SHIFT 5
186
282typedef struct _CommandList_struct { 187typedef struct _CommandList_struct {
283 CommandListHeader_struct Header; 188 CommandListHeader_struct Header;
284 RequestBlock_struct Request; 189 RequestBlock_struct Request;
@@ -295,10 +200,10 @@ typedef struct _CommandList_struct {
295 struct completion *waiting; 200 struct completion *waiting;
296 int retry_count; 201 int retry_count;
297 void * scsi_cmd; 202 void * scsi_cmd;
298 char pad[PADSIZE]; 203 char pad[PADSIZE];
299} CommandList_struct; 204} CommandList_struct;
300 205
301//Configuration Table Structure 206/* Configuration Table Structure */
302typedef struct _HostWrite_struct { 207typedef struct _HostWrite_struct {
303 DWORD TransportRequest; 208 DWORD TransportRequest;
304 DWORD Reserved; 209 DWORD Reserved;
@@ -309,15 +214,44 @@ typedef struct _HostWrite_struct {
309typedef struct _CfgTable_struct { 214typedef struct _CfgTable_struct {
310 BYTE Signature[4]; 215 BYTE Signature[4];
311 DWORD SpecValence; 216 DWORD SpecValence;
217#define SIMPLE_MODE 0x02
218#define PERFORMANT_MODE 0x04
219#define MEMQ_MODE 0x08
312 DWORD TransportSupport; 220 DWORD TransportSupport;
313 DWORD TransportActive; 221 DWORD TransportActive;
314 HostWrite_struct HostWrite; 222 HostWrite_struct HostWrite;
315 DWORD CmdsOutMax; 223 DWORD CmdsOutMax;
316 DWORD BusTypes; 224 DWORD BusTypes;
317 DWORD Reserved; 225 DWORD TransMethodOffset;
318 BYTE ServerName[16]; 226 BYTE ServerName[16];
319 DWORD HeartBeat; 227 DWORD HeartBeat;
320 DWORD SCSI_Prefetch; 228 DWORD SCSI_Prefetch;
229 DWORD MaxSGElements;
230 DWORD MaxLogicalUnits;
231 DWORD MaxPhysicalDrives;
232 DWORD MaxPhysicalDrivesPerLogicalUnit;
233 DWORD MaxPerformantModeCommands;
234 u8 reserved[0x78 - 0x58];
235 u32 misc_fw_support; /* offset 0x78 */
236#define MISC_FW_DOORBELL_RESET (0x02)
321} CfgTable_struct; 237} CfgTable_struct;
238
239struct TransTable_struct {
240 u32 BlockFetch0;
241 u32 BlockFetch1;
242 u32 BlockFetch2;
243 u32 BlockFetch3;
244 u32 BlockFetch4;
245 u32 BlockFetch5;
246 u32 BlockFetch6;
247 u32 BlockFetch7;
248 u32 RepQSize;
249 u32 RepQCount;
250 u32 RepQCtrAddrLow32;
251 u32 RepQCtrAddrHigh32;
252 u32 RepQAddr0Low32;
253 u32 RepQAddr0High32;
254};
255
322#pragma pack() 256#pragma pack()
323#endif // CCISS_CMD_H 257#endif /* CCISS_CMD_H */