Automatic merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/driver...
[linux-2.6/verdex.git] / include / linux / cciss_ioctl.h
blobee0c6e8995dafd198f257cdea54fd48b65edb09b
1 #ifndef CCISS_IOCTLH
2 #define CCISS_IOCTLH
4 #include <linux/types.h>
5 #include <linux/ioctl.h>
7 #define CCISS_IOC_MAGIC 'B'
10 typedef struct _cciss_pci_info_struct
12 unsigned char bus;
13 unsigned char dev_fn;
14 __u32 board_id;
15 } cciss_pci_info_struct;
17 typedef struct _cciss_coalint_struct
19 __u32 delay;
20 __u32 count;
21 } cciss_coalint_struct;
23 typedef char NodeName_type[16];
25 typedef __u32 Heartbeat_type;
27 #define CISS_PARSCSIU2 0x0001
28 #define CISS_PARCSCIU3 0x0002
29 #define CISS_FIBRE1G 0x0100
30 #define CISS_FIBRE2G 0x0200
31 typedef __u32 BusTypes_type;
33 typedef char FirmwareVer_type[4];
34 typedef __u32 DriverVer_type;
36 #define MAX_KMALLOC_SIZE 128000
38 #ifndef CCISS_CMD_H
39 // This defines are duplicated in cciss_cmd.h in the driver directory
41 //general boundary defintions
42 #define SENSEINFOBYTES 32//note that this value may vary between host implementations
44 //Command Status value
45 #define CMD_SUCCESS 0x0000
46 #define CMD_TARGET_STATUS 0x0001
47 #define CMD_DATA_UNDERRUN 0x0002
48 #define CMD_DATA_OVERRUN 0x0003
49 #define CMD_INVALID 0x0004
50 #define CMD_PROTOCOL_ERR 0x0005
51 #define CMD_HARDWARE_ERR 0x0006
52 #define CMD_CONNECTION_LOST 0x0007
53 #define CMD_ABORTED 0x0008
54 #define CMD_ABORT_FAILED 0x0009
55 #define CMD_UNSOLICITED_ABORT 0x000A
56 #define CMD_TIMEOUT 0x000B
57 #define CMD_UNABORTABLE 0x000C
59 //transfer direction
60 #define XFER_NONE 0x00
61 #define XFER_WRITE 0x01
62 #define XFER_READ 0x02
63 #define XFER_RSVD 0x03
65 //task attribute
66 #define ATTR_UNTAGGED 0x00
67 #define ATTR_SIMPLE 0x04
68 #define ATTR_HEADOFQUEUE 0x05
69 #define ATTR_ORDERED 0x06
70 #define ATTR_ACA 0x07
72 //cdb type
73 #define TYPE_CMD 0x00
74 #define TYPE_MSG 0x01
76 // Type defs used in the following structs
77 #define BYTE __u8
78 #define WORD __u16
79 #define HWORD __u16
80 #define DWORD __u32
82 #define CISS_MAX_LUN 16
84 #define LEVEL2LUN 1 // index into Target(x) structure, due to byte swapping
85 #define LEVEL3LUN 0
87 #pragma pack(1)
89 //Command List Structure
90 typedef union _SCSI3Addr_struct {
91 struct {
92 BYTE Dev;
93 BYTE Bus:6;
94 BYTE Mode:2; // b00
95 } PeripDev;
96 struct {
97 BYTE DevLSB;
98 BYTE DevMSB:6;
99 BYTE Mode:2; // b01
100 } LogDev;
101 struct {
102 BYTE Dev:5;
103 BYTE Bus:3;
104 BYTE Targ:6;
105 BYTE Mode:2; // b10
106 } LogUnit;
107 } SCSI3Addr_struct;
109 typedef struct _PhysDevAddr_struct {
110 DWORD TargetId:24;
111 DWORD Bus:6;
112 DWORD Mode:2;
113 SCSI3Addr_struct Target[2]; //2 level target device addr
114 } PhysDevAddr_struct;
116 typedef struct _LogDevAddr_struct {
117 DWORD VolId:30;
118 DWORD Mode:2;
119 BYTE reserved[4];
120 } LogDevAddr_struct;
122 typedef union _LUNAddr_struct {
123 BYTE LunAddrBytes[8];
124 SCSI3Addr_struct SCSI3Lun[4];
125 PhysDevAddr_struct PhysDev;
126 LogDevAddr_struct LogDev;
127 } LUNAddr_struct;
129 typedef struct _RequestBlock_struct {
130 BYTE CDBLen;
131 struct {
132 BYTE Type:3;
133 BYTE Attribute:3;
134 BYTE Direction:2;
135 } Type;
136 HWORD Timeout;
137 BYTE CDB[16];
138 } RequestBlock_struct;
140 typedef union _MoreErrInfo_struct{
141 struct {
142 BYTE Reserved[3];
143 BYTE Type;
144 DWORD ErrorInfo;
145 }Common_Info;
146 struct{
147 BYTE Reserved[2];
148 BYTE offense_size;//size of offending entry
149 BYTE offense_num; //byte # of offense 0-base
150 DWORD offense_value;
151 }Invalid_Cmd;
152 }MoreErrInfo_struct;
153 typedef struct _ErrorInfo_struct {
154 BYTE ScsiStatus;
155 BYTE SenseLen;
156 HWORD CommandStatus;
157 DWORD ResidualCnt;
158 MoreErrInfo_struct MoreErrInfo;
159 BYTE SenseInfo[SENSEINFOBYTES];
160 } ErrorInfo_struct;
162 #pragma pack()
163 #endif /* CCISS_CMD_H */
165 typedef struct _IOCTL_Command_struct {
166 LUNAddr_struct LUN_info;
167 RequestBlock_struct Request;
168 ErrorInfo_struct error_info;
169 WORD buf_size; /* size in bytes of the buf */
170 BYTE __user *buf;
171 } IOCTL_Command_struct;
173 typedef struct _BIG_IOCTL_Command_struct {
174 LUNAddr_struct LUN_info;
175 RequestBlock_struct Request;
176 ErrorInfo_struct error_info;
177 DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */
178 DWORD buf_size; /* size in bytes of the buf */
179 /* < malloc_size * MAXSGENTRIES */
180 BYTE __user *buf;
181 } BIG_IOCTL_Command_struct;
183 typedef struct _LogvolInfo_struct{
184 __u32 LunID;
185 int num_opens; /* number of opens on the logical volume */
186 int num_parts; /* number of partitions configured on logvol */
187 } LogvolInfo_struct;
189 #define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct)
191 #define CCISS_GETINTINFO _IOR(CCISS_IOC_MAGIC, 2, cciss_coalint_struct)
192 #define CCISS_SETINTINFO _IOW(CCISS_IOC_MAGIC, 3, cciss_coalint_struct)
194 #define CCISS_GETNODENAME _IOR(CCISS_IOC_MAGIC, 4, NodeName_type)
195 #define CCISS_SETNODENAME _IOW(CCISS_IOC_MAGIC, 5, NodeName_type)
197 #define CCISS_GETHEARTBEAT _IOR(CCISS_IOC_MAGIC, 6, Heartbeat_type)
198 #define CCISS_GETBUSTYPES _IOR(CCISS_IOC_MAGIC, 7, BusTypes_type)
199 #define CCISS_GETFIRMVER _IOR(CCISS_IOC_MAGIC, 8, FirmwareVer_type)
200 #define CCISS_GETDRIVVER _IOR(CCISS_IOC_MAGIC, 9, DriverVer_type)
201 #define CCISS_REVALIDVOLS _IO(CCISS_IOC_MAGIC, 10)
202 #define CCISS_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct)
203 #define CCISS_DEREGDISK _IO(CCISS_IOC_MAGIC, 12)
205 /* no longer used... use REGNEWD instead */
206 #define CCISS_REGNEWDISK _IOW(CCISS_IOC_MAGIC, 13, int)
208 #define CCISS_REGNEWD _IO(CCISS_IOC_MAGIC, 14)
209 #define CCISS_RESCANDISK _IO(CCISS_IOC_MAGIC, 16)
210 #define CCISS_GETLUNINFO _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct)
211 #define CCISS_BIG_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL_Command_struct)
213 #ifdef __KERNEL__
214 #ifdef CONFIG_COMPAT
216 /* 32 bit compatible ioctl structs */
217 typedef struct _IOCTL32_Command_struct {
218 LUNAddr_struct LUN_info;
219 RequestBlock_struct Request;
220 ErrorInfo_struct error_info;
221 WORD buf_size; /* size in bytes of the buf */
222 __u32 buf; /* 32 bit pointer to data buffer */
223 } IOCTL32_Command_struct;
225 typedef struct _BIG_IOCTL32_Command_struct {
226 LUNAddr_struct LUN_info;
227 RequestBlock_struct Request;
228 ErrorInfo_struct error_info;
229 DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */
230 DWORD buf_size; /* size in bytes of the buf */
231 /* < malloc_size * MAXSGENTRIES */
232 __u32 buf; /* 32 bit pointer to data buffer */
233 } BIG_IOCTL32_Command_struct;
235 #define CCISS_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 11, IOCTL32_Command_struct)
236 #define CCISS_BIG_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL32_Command_struct)
238 #endif /* CONFIG_COMPAT */
239 #endif /* __KERNEL__ */
240 #endif