- Stephen Rothwell: APM updates
[davej-history.git] / include / linux / cciss_ioctl.h
blob989549b2413f90b3756db38cae3ef570f9a55f8f
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;
37 #ifndef CCISS_CMD_H
38 // This defines are duplicated in cciss_cmd.h in the driver directory
40 //general boundary defintions
41 #define SENSEINFOBYTES 32//note that this value may vary between host implementations
43 //Command Status value
44 #define CMD_SUCCESS 0x0000
45 #define CMD_TARGET_STATUS 0x0001
46 #define CMD_DATA_UNDERRUN 0x0002
47 #define CMD_DATA_OVERRUN 0x0003
48 #define CMD_INVALID 0x0004
49 #define CMD_PROTOCOL_ERR 0x0005
50 #define CMD_HARDWARE_ERR 0x0006
51 #define CMD_CONNECTION_LOST 0x0007
52 #define CMD_ABORTED 0x0008
53 #define CMD_ABORT_FAILED 0x0009
54 #define CMD_UNSOLICITED_ABORT 0x000A
55 #define CMD_TIMEOUT 0x000B
56 #define CMD_UNABORTABLE 0x000C
58 //transfer direction
59 #define XFER_NONE 0x00
60 #define XFER_WRITE 0x01
61 #define XFER_READ 0x02
62 #define XFER_RSVD 0x03
64 //task attribute
65 #define ATTR_UNTAGGED 0x00
66 #define ATTR_SIMPLE 0x04
67 #define ATTR_HEADOFQUEUE 0x05
68 #define ATTR_ORDERED 0x06
69 #define ATTR_ACA 0x07
71 //cdb type
72 #define TYPE_CMD 0x00
73 #define TYPE_MSG 0x01
75 // Type defs used in the following structs
76 #define BYTE __u8
77 #define WORD __u16
78 #define HWORD __u16
79 #define DWORD __u32
81 #define CISS_MAX_LUN 16
83 #pragma pack(1)
85 //Command List Structure
86 typedef union _SCSI3Addr_struct {
87 struct {
88 BYTE Bus:6;
89 BYTE Mode:2; // b00
90 BYTE Dev;
91 } PeripDev;
92 struct {
93 BYTE DevMSB:6;
94 BYTE Mode:2; // b01
95 BYTE DevLSB;
96 } LogDev;
97 struct {
98 BYTE Targ:6;
99 BYTE Mode:2; // b10
100 BYTE Dev:5;
101 BYTE Bus:3;
102 } LogUnit;
103 } SCSI3Addr_struct;
105 typedef struct _PhysDevAddr_struct {
106 DWORD TargetId:24;
107 DWORD Bus:6;
108 DWORD Mode:2;
109 SCSI3Addr_struct Target[2]; //2 level target device addr
110 } PhysDevAddr_struct;
112 typedef struct _LogDevAddr_struct {
113 DWORD VolId:30;
114 DWORD Mode:2;
115 BYTE reserved[4];
116 } LogDevAddr_struct;
118 typedef union _LUNAddr_struct {
119 BYTE LunAddrBytes[8];
120 SCSI3Addr_struct SCSI3Lun[4];
121 PhysDevAddr_struct PhysDev;
122 LogDevAddr_struct LogDev;
123 } LUNAddr_struct;
125 typedef struct _RequestBlock_struct {
126 BYTE CDBLen;
127 struct {
128 BYTE Type:3;
129 BYTE Attribute:3;
130 BYTE Direction:2;
131 } Type;
132 HWORD Timeout;
133 BYTE CDB[16];
134 } RequestBlock_struct;
136 typedef union _MoreErrInfo_struct{
137 struct {
138 BYTE Reserved[3];
139 BYTE Type;
140 DWORD ErrorInfo;
141 }Common_Info;
142 struct{
143 BYTE Reserved[2];
144 BYTE offense_size;//size of offending entry
145 BYTE offense_num; //byte # of offense 0-base
146 DWORD offense_value;
147 }Invalid_Cmd;
148 }MoreErrInfo_struct;
149 typedef struct _ErrorInfo_struct {
150 BYTE ScsiStatus;
151 BYTE SenseLen;
152 HWORD CommandStatus;
153 DWORD ResidualCnt;
154 MoreErrInfo_struct MoreErrInfo;
155 BYTE SenseInfo[SENSEINFOBYTES];
156 } ErrorInfo_struct;
158 #pragma pack()
159 #endif /* CCISS_CMD_H */
161 typedef struct _IOCTL_Command_struct {
162 LUNAddr_struct LUN_info;
163 RequestBlock_struct Request;
164 ErrorInfo_struct error_info;
165 WORD buf_size; /* size in bytes of the buf */
166 BYTE *buf;
167 } IOCTL_Command_struct;
170 #define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct)
172 #define CCISS_GETINTINFO _IOR(CCISS_IOC_MAGIC, 2, cciss_coalint_struct)
173 #define CCISS_SETINTINFO _IOW(CCISS_IOC_MAGIC, 3, cciss_coalint_struct)
175 #define CCISS_GETNODENAME _IOR(CCISS_IOC_MAGIC, 4, NodeName_type)
176 #define CCISS_SETNODENAME _IOW(CCISS_IOC_MAGIC, 5, NodeName_type)
178 #define CCISS_GETHEARTBEAT _IOR(CCISS_IOC_MAGIC, 6, Heartbeat_type)
179 #define CCISS_GETBUSTYPES _IOR(CCISS_IOC_MAGIC, 7, BusTypes_type)
180 #define CCISS_GETFIRMVER _IOR(CCISS_IOC_MAGIC, 8, FirmwareVer_type)
181 #define CCISS_GETDRIVVER _IOR(CCISS_IOC_MAGIC, 9, DriverVer_type)
182 #define CCISS_REVALIDVOLS _IO(CCISS_IOC_MAGIC, 10)
183 #define CCISS_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct)
186 #endif