aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordann frazier <dannf@hp.com>2010-02-17 18:55:11 -0500
committerJens Axboe <jens.axboe@oracle.com>2010-02-22 07:44:45 -0500
commit429c42c9d246f5bda868495c09974312a0177328 (patch)
tree70ff1d78c6aee4eefcfb9ffd5d7c65614ba5c4c6
parentb028461d66a4dc2754d4e5dab1b3974c44798c5d (diff)
cciss: Consolidate duplicate bits in cciss_cmd.h & cciss_ioctl.h
There are several duplicate definitions in cciss_cmd.h and cciss_ioctl.h. Consolidate these into the new cciss_defs.h file. This patch doesn't change the definitions exposed under include/linux, so userspace apps shouldn't be affected. Acked-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: dann frazier <dannf@hp.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--drivers/block/cciss_cmd.h113
-rw-r--r--include/linux/cciss_defs.h130
-rw-r--r--include/linux/cciss_ioctl.h129
3 files changed, 134 insertions, 238 deletions
diff --git a/drivers/block/cciss_cmd.h b/drivers/block/cciss_cmd.h
index 277422b7e060..25f97623bacf 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
4#include <linux/cciss_defs.h>
5
3/* DEFINES */ 6/* DEFINES */
4#define CISS_VERSION "1.00" 7#define CISS_VERSION "1.00"
5 8
6/* general boundary definitions */ 9/* general boundary definitions */
7#define SENSEINFOBYTES 32 /* note that this value may vary
8 between host implementations */
9#define MAXSGENTRIES 32 10#define MAXSGENTRIES 32
10#define CCISS_SG_CHAIN 0x80000000 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,23 +34,6 @@
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 */
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 */ 37/* config space register offsets */
69#define CFG_VENDORID 0x00 38#define CFG_VENDORID 0x00
70#define CFG_DEVICEID 0x02 39#define CFG_DEVICEID 0x02
@@ -103,14 +72,9 @@ typedef union _u64bit
103} u64bit; 72} u64bit;
104 73
105/* Type defs used in the following structs */ 74/* 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 75#define QWORD vals32
111 76
112/* STRUCTURES */ 77/* STRUCTURES */
113#define CISS_MAX_LUN 1024
114#define CISS_MAX_PHYS_LUN 1024 78#define CISS_MAX_PHYS_LUN 1024
115/* SCSI-3 Cmmands */ 79/* SCSI-3 Cmmands */
116 80
@@ -176,45 +140,6 @@ typedef struct _ReadCapdata_struct_16
176#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 */
177 141
178/* Command List Structure */ 142/* Command List Structure */
179typedef union _SCSI3Addr_struct {
180 struct {
181 BYTE Dev;
182 BYTE Bus:6;
183 BYTE Mode:2; /* b00 */
184 } PeripDev;
185 struct {
186 BYTE DevLSB;
187 BYTE DevMSB:6;
188 BYTE Mode:2; /* b01 */
189 } LogDev;
190 struct {
191 BYTE Dev:5;
192 BYTE Bus:3;
193 BYTE Targ:6;
194 BYTE Mode:2; /* b10 */
195 } LogUnit;
196} SCSI3Addr_struct;
197
198typedef struct _PhysDevAddr_struct {
199 DWORD TargetId:24;
200 DWORD Bus:6;
201 DWORD Mode:2;
202 SCSI3Addr_struct Target[2]; /* 2 level target device addr */
203} PhysDevAddr_struct;
204
205typedef struct _LogDevAddr_struct {
206 DWORD VolId:30;
207 DWORD Mode:2;
208 BYTE reserved[4];
209} LogDevAddr_struct;
210
211typedef union _LUNAddr_struct {
212 BYTE LunAddrBytes[8];
213 SCSI3Addr_struct SCSI3Lun[4];
214 PhysDevAddr_struct PhysDev;
215 LogDevAddr_struct LogDev;
216} LUNAddr_struct;
217
218#define CTLR_LUNID "\0\0\0\0\0\0\0\0" 143#define CTLR_LUNID "\0\0\0\0\0\0\0\0"
219 144
220typedef struct _CommandListHeader_struct { 145typedef struct _CommandListHeader_struct {
@@ -224,16 +149,6 @@ typedef struct _CommandListHeader_struct {
224 QWORD Tag; 149 QWORD Tag;
225 LUNAddr_struct LUN; 150 LUNAddr_struct LUN;
226} CommandListHeader_struct; 151} CommandListHeader_struct;
227typedef struct _RequestBlock_struct {
228 BYTE CDBLen;
229 struct {
230 BYTE Type:3;
231 BYTE Attribute:3;
232 BYTE Direction:2;
233 } Type;
234 HWORD Timeout;
235 BYTE CDB[16];
236} RequestBlock_struct;
237typedef struct _ErrDescriptor_struct { 152typedef struct _ErrDescriptor_struct {
238 QWORD Addr; 153 QWORD Addr;
239 DWORD Len; 154 DWORD Len;
@@ -244,28 +159,6 @@ typedef struct _SGDescriptor_struct {
244 DWORD Ext; 159 DWORD Ext;
245} SGDescriptor_struct; 160} SGDescriptor_struct;
246 161
247typedef union _MoreErrInfo_struct{
248 struct {
249 BYTE Reserved[3];
250 BYTE Type;
251 DWORD ErrorInfo;
252 }Common_Info;
253 struct{
254 BYTE Reserved[2];
255 BYTE offense_size; /* size of offending entry */
256 BYTE offense_num; /* byte # of offense 0-base */
257 DWORD offense_value;
258 }Invalid_Cmd;
259}MoreErrInfo_struct;
260typedef struct _ErrorInfo_struct {
261 BYTE ScsiStatus;
262 BYTE SenseLen;
263 HWORD CommandStatus;
264 DWORD ResidualCnt;
265 MoreErrInfo_struct MoreErrInfo;
266 BYTE SenseInfo[SENSEINFOBYTES];
267} ErrorInfo_struct;
268
269/* Command types */ 162/* Command types */
270#define CMD_RWREQ 0x00 163#define CMD_RWREQ 0x00
271#define CMD_IOCTL_PEND 0x01 164#define CMD_IOCTL_PEND 0x01
diff --git a/include/linux/cciss_defs.h b/include/linux/cciss_defs.h
new file mode 100644
index 000000000000..316b670d4e33
--- /dev/null
+++ b/include/linux/cciss_defs.h
@@ -0,0 +1,130 @@
1#ifndef CCISS_DEFS_H
2#define CCISS_DEFS_H
3
4#include <linux/types.h>
5
6/* general boundary definitions */
7#define SENSEINFOBYTES 32 /* note that this value may vary
8 between host implementations */
9
10/* Command Status value */
11#define CMD_SUCCESS 0x0000
12#define CMD_TARGET_STATUS 0x0001
13#define CMD_DATA_UNDERRUN 0x0002
14#define CMD_DATA_OVERRUN 0x0003
15#define CMD_INVALID 0x0004
16#define CMD_PROTOCOL_ERR 0x0005
17#define CMD_HARDWARE_ERR 0x0006
18#define CMD_CONNECTION_LOST 0x0007
19#define CMD_ABORTED 0x0008
20#define CMD_ABORT_FAILED 0x0009
21#define CMD_UNSOLICITED_ABORT 0x000A
22#define CMD_TIMEOUT 0x000B
23#define CMD_UNABORTABLE 0x000C
24
25/* transfer direction */
26#define XFER_NONE 0x00
27#define XFER_WRITE 0x01
28#define XFER_READ 0x02
29#define XFER_RSVD 0x03
30
31/* task attribute */
32#define ATTR_UNTAGGED 0x00
33#define ATTR_SIMPLE 0x04
34#define ATTR_HEADOFQUEUE 0x05
35#define ATTR_ORDERED 0x06
36#define ATTR_ACA 0x07
37
38/* cdb type */
39#define TYPE_CMD 0x00
40#define TYPE_MSG 0x01
41
42/* Type defs used in the following structs */
43#define BYTE __u8
44#define WORD __u16
45#define HWORD __u16
46#define DWORD __u32
47
48#define CISS_MAX_LUN 1024
49
50#define LEVEL2LUN 1 /* index into Target(x) structure, due to byte swapping */
51#define LEVEL3LUN 0
52
53#pragma pack(1)
54
55/* Command List Structure */
56typedef union _SCSI3Addr_struct {
57 struct {
58 BYTE Dev;
59 BYTE Bus:6;
60 BYTE Mode:2; /* b00 */
61 } PeripDev;
62 struct {
63 BYTE DevLSB;
64 BYTE DevMSB:6;
65 BYTE Mode:2; /* b01 */
66 } LogDev;
67 struct {
68 BYTE Dev:5;
69 BYTE Bus:3;
70 BYTE Targ:6;
71 BYTE Mode:2; /* b10 */
72 } LogUnit;
73} SCSI3Addr_struct;
74
75typedef struct _PhysDevAddr_struct {
76 DWORD TargetId:24;
77 DWORD Bus:6;
78 DWORD Mode:2;
79 SCSI3Addr_struct Target[2]; /* 2 level target device addr */
80} PhysDevAddr_struct;
81
82typedef struct _LogDevAddr_struct {
83 DWORD VolId:30;
84 DWORD Mode:2;
85 BYTE reserved[4];
86} LogDevAddr_struct;
87
88typedef union _LUNAddr_struct {
89 BYTE LunAddrBytes[8];
90 SCSI3Addr_struct SCSI3Lun[4];
91 PhysDevAddr_struct PhysDev;
92 LogDevAddr_struct LogDev;
93} LUNAddr_struct;
94
95typedef struct _RequestBlock_struct {
96 BYTE CDBLen;
97 struct {
98 BYTE Type:3;
99 BYTE Attribute:3;
100 BYTE Direction:2;
101 } Type;
102 HWORD Timeout;
103 BYTE CDB[16];
104} RequestBlock_struct;
105
106typedef union _MoreErrInfo_struct{
107 struct {
108 BYTE Reserved[3];
109 BYTE Type;
110 DWORD ErrorInfo;
111 } Common_Info;
112 struct{
113 BYTE Reserved[2];
114 BYTE offense_size; /* size of offending entry */
115 BYTE offense_num; /* byte # of offense 0-base */
116 DWORD offense_value;
117 } Invalid_Cmd;
118} MoreErrInfo_struct;
119typedef struct _ErrorInfo_struct {
120 BYTE ScsiStatus;
121 BYTE SenseLen;
122 HWORD CommandStatus;
123 DWORD ResidualCnt;
124 MoreErrInfo_struct MoreErrInfo;
125 BYTE SenseInfo[SENSEINFOBYTES];
126} ErrorInfo_struct;
127
128#pragma pack()
129
130#endif /* CCISS_DEFS_H */
diff --git a/include/linux/cciss_ioctl.h b/include/linux/cciss_ioctl.h
index e7343a1a9ea8..986493f5b92b 100644
--- a/include/linux/cciss_ioctl.h
+++ b/include/linux/cciss_ioctl.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/ioctl.h> 5#include <linux/ioctl.h>
6#include <linux/cciss_defs.h>
6 7
7#define CCISS_IOC_MAGIC 'B' 8#define CCISS_IOC_MAGIC 'B'
8 9
@@ -36,134 +37,6 @@ typedef __u32 DriverVer_type;
36 37
37#define MAX_KMALLOC_SIZE 128000 38#define MAX_KMALLOC_SIZE 128000
38 39
39#ifndef CCISS_CMD_H
40/* This defines are duplicated in cciss_cmd.h in the driver directory */
41
42/* general boundary definitions */
43#define SENSEINFOBYTES 32 /* note that this value may vary
44 between host implementations */
45
46/* Command Status value */
47#define CMD_SUCCESS 0x0000
48#define CMD_TARGET_STATUS 0x0001
49#define CMD_DATA_UNDERRUN 0x0002
50#define CMD_DATA_OVERRUN 0x0003
51#define CMD_INVALID 0x0004
52#define CMD_PROTOCOL_ERR 0x0005
53#define CMD_HARDWARE_ERR 0x0006
54#define CMD_CONNECTION_LOST 0x0007
55#define CMD_ABORTED 0x0008
56#define CMD_ABORT_FAILED 0x0009
57#define CMD_UNSOLICITED_ABORT 0x000A
58#define CMD_TIMEOUT 0x000B
59#define CMD_UNABORTABLE 0x000C
60
61/* transfer direction */
62#define XFER_NONE 0x00
63#define XFER_WRITE 0x01
64#define XFER_READ 0x02
65#define XFER_RSVD 0x03
66
67/* task attribute */
68#define ATTR_UNTAGGED 0x00
69#define ATTR_SIMPLE 0x04
70#define ATTR_HEADOFQUEUE 0x05
71#define ATTR_ORDERED 0x06
72#define ATTR_ACA 0x07
73
74/* cdb type */
75#define TYPE_CMD 0x00
76#define TYPE_MSG 0x01
77
78/* Type defs used in the following structs */
79#define BYTE __u8
80#define WORD __u16
81#define HWORD __u16
82#define DWORD __u32
83
84#define CISS_MAX_LUN 1024
85
86#define LEVEL2LUN 1 /* index into Target(x) structure, due to byte swapping */
87#define LEVEL3LUN 0
88
89#pragma pack(1)
90
91/* Command List Structure */
92typedef union _SCSI3Addr_struct {
93 struct {
94 BYTE Dev;
95 BYTE Bus:6;
96 BYTE Mode:2; /* b00 */
97 } PeripDev;
98 struct {
99 BYTE DevLSB;
100 BYTE DevMSB:6;
101 BYTE Mode:2; /* b01 */
102 } LogDev;
103 struct {
104 BYTE Dev:5;
105 BYTE Bus:3;
106 BYTE Targ:6;
107 BYTE Mode:2; /* b10 */
108 } LogUnit;
109} SCSI3Addr_struct;
110
111typedef struct _PhysDevAddr_struct {
112 DWORD TargetId:24;
113 DWORD Bus:6;
114 DWORD Mode:2;
115 SCSI3Addr_struct Target[2]; /* 2 level target device addr */
116} PhysDevAddr_struct;
117
118typedef struct _LogDevAddr_struct {
119 DWORD VolId:30;
120 DWORD Mode:2;
121 BYTE reserved[4];
122} LogDevAddr_struct;
123
124typedef union _LUNAddr_struct {
125 BYTE LunAddrBytes[8];
126 SCSI3Addr_struct SCSI3Lun[4];
127 PhysDevAddr_struct PhysDev;
128 LogDevAddr_struct LogDev;
129} LUNAddr_struct;
130
131typedef struct _RequestBlock_struct {
132 BYTE CDBLen;
133 struct {
134 BYTE Type:3;
135 BYTE Attribute:3;
136 BYTE Direction:2;
137 } Type;
138 HWORD Timeout;
139 BYTE CDB[16];
140} RequestBlock_struct;
141
142typedef union _MoreErrInfo_struct{
143 struct {
144 BYTE Reserved[3];
145 BYTE Type;
146 DWORD ErrorInfo;
147 }Common_Info;
148 struct{
149 BYTE Reserved[2];
150 BYTE offense_size; /* size of offending entry */
151 BYTE offense_num; /* byte # of offense 0-base */
152 DWORD offense_value;
153 }Invalid_Cmd;
154}MoreErrInfo_struct;
155typedef struct _ErrorInfo_struct {
156 BYTE ScsiStatus;
157 BYTE SenseLen;
158 HWORD CommandStatus;
159 DWORD ResidualCnt;
160 MoreErrInfo_struct MoreErrInfo;
161 BYTE SenseInfo[SENSEINFOBYTES];
162} ErrorInfo_struct;
163
164#pragma pack()
165#endif /* CCISS_CMD_H */
166
167typedef struct _IOCTL_Command_struct { 40typedef struct _IOCTL_Command_struct {
168 LUNAddr_struct LUN_info; 41 LUNAddr_struct LUN_info;
169 RequestBlock_struct Request; 42 RequestBlock_struct Request;