]> git.karo-electronics.de Git - karo-tx-linux.git/blob - include/linux/cciss_ioctl.h
e7343a1a9ea84bbb893f5d8406400c8a771e7651
[karo-tx-linux.git] / include / linux / cciss_ioctl.h
1 #ifndef CCISS_IOCTLH
2 #define CCISS_IOCTLH
3
4 #include <linux/types.h>
5 #include <linux/ioctl.h>
6
7 #define CCISS_IOC_MAGIC 'B'
8
9
10 typedef struct _cciss_pci_info_struct
11 {
12         unsigned char   bus;
13         unsigned char   dev_fn;
14         unsigned short  domain;
15         __u32           board_id;
16 } cciss_pci_info_struct; 
17
18 typedef struct _cciss_coalint_struct
19 {
20         __u32  delay;
21         __u32  count;
22 } cciss_coalint_struct;
23
24 typedef char NodeName_type[16];
25
26 typedef __u32 Heartbeat_type;
27
28 #define CISS_PARSCSIU2  0x0001
29 #define CISS_PARCSCIU3  0x0002
30 #define CISS_FIBRE1G    0x0100
31 #define CISS_FIBRE2G    0x0200
32 typedef __u32 BusTypes_type;
33
34 typedef char FirmwareVer_type[4];
35 typedef __u32 DriverVer_type;
36
37 #define MAX_KMALLOC_SIZE 128000
38
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 */
92 typedef 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
111 typedef 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   
118 typedef struct _LogDevAddr_struct {
119   DWORD            VolId:30;
120   DWORD            Mode:2;
121   BYTE             reserved[4];
122 } LogDevAddr_struct;
123
124 typedef union _LUNAddr_struct {
125   BYTE               LunAddrBytes[8];
126   SCSI3Addr_struct   SCSI3Lun[4];
127   PhysDevAddr_struct PhysDev;
128   LogDevAddr_struct  LogDev;
129 } LUNAddr_struct;
130
131 typedef 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
142 typedef 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;
155 typedef 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
167 typedef struct _IOCTL_Command_struct {
168   LUNAddr_struct           LUN_info;
169   RequestBlock_struct      Request;
170   ErrorInfo_struct         error_info; 
171   WORD                     buf_size;  /* size in bytes of the buf */
172   BYTE                     __user *buf;
173 } IOCTL_Command_struct;
174
175 typedef struct _BIG_IOCTL_Command_struct {
176   LUNAddr_struct           LUN_info;
177   RequestBlock_struct      Request;
178   ErrorInfo_struct         error_info;
179   DWORD                    malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */
180   DWORD                    buf_size;    /* size in bytes of the buf */
181                                         /* < malloc_size * MAXSGENTRIES */
182   BYTE                     __user *buf;
183 } BIG_IOCTL_Command_struct;
184
185 typedef struct _LogvolInfo_struct{
186         __u32   LunID;
187         int     num_opens;  /* number of opens on the logical volume */
188         int     num_parts;  /* number of partitions configured on logvol */
189 } LogvolInfo_struct;
190
191 #define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct)
192
193 #define CCISS_GETINTINFO _IOR(CCISS_IOC_MAGIC, 2, cciss_coalint_struct)
194 #define CCISS_SETINTINFO _IOW(CCISS_IOC_MAGIC, 3, cciss_coalint_struct)
195
196 #define CCISS_GETNODENAME _IOR(CCISS_IOC_MAGIC, 4, NodeName_type)
197 #define CCISS_SETNODENAME _IOW(CCISS_IOC_MAGIC, 5, NodeName_type)
198
199 #define CCISS_GETHEARTBEAT _IOR(CCISS_IOC_MAGIC, 6, Heartbeat_type)
200 #define CCISS_GETBUSTYPES  _IOR(CCISS_IOC_MAGIC, 7, BusTypes_type)
201 #define CCISS_GETFIRMVER   _IOR(CCISS_IOC_MAGIC, 8, FirmwareVer_type)
202 #define CCISS_GETDRIVVER   _IOR(CCISS_IOC_MAGIC, 9, DriverVer_type)
203 #define CCISS_REVALIDVOLS  _IO(CCISS_IOC_MAGIC, 10)
204 #define CCISS_PASSTHRU     _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct)
205 #define CCISS_DEREGDISK    _IO(CCISS_IOC_MAGIC, 12)
206
207 /* no longer used... use REGNEWD instead */ 
208 #define CCISS_REGNEWDISK  _IOW(CCISS_IOC_MAGIC, 13, int)
209
210 #define CCISS_REGNEWD      _IO(CCISS_IOC_MAGIC, 14)
211 #define CCISS_RESCANDISK   _IO(CCISS_IOC_MAGIC, 16)
212 #define CCISS_GETLUNINFO   _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct)
213 #define CCISS_BIG_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL_Command_struct)
214
215 #ifdef __KERNEL__
216 #ifdef CONFIG_COMPAT
217
218 /* 32 bit compatible ioctl structs */
219 typedef struct _IOCTL32_Command_struct {
220   LUNAddr_struct           LUN_info;
221   RequestBlock_struct      Request;
222   ErrorInfo_struct         error_info;
223   WORD                     buf_size;  /* size in bytes of the buf */
224   __u32                    buf; /* 32 bit pointer to data buffer */
225 } IOCTL32_Command_struct;
226
227 typedef struct _BIG_IOCTL32_Command_struct {
228   LUNAddr_struct           LUN_info;
229   RequestBlock_struct      Request;
230   ErrorInfo_struct         error_info;
231   DWORD                    malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */
232   DWORD                    buf_size;    /* size in bytes of the buf */
233                                         /* < malloc_size * MAXSGENTRIES */
234   __u32                 buf;    /* 32 bit pointer to data buffer */
235 } BIG_IOCTL32_Command_struct;
236
237 #define CCISS_PASSTHRU32   _IOWR(CCISS_IOC_MAGIC, 11, IOCTL32_Command_struct)
238 #define CCISS_BIG_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL32_Command_struct)
239
240 #endif /* CONFIG_COMPAT */
241 #endif /* __KERNEL__ */
242 #endif