FreeBSD/Linux Kernel Cross Reference
sys/dev/ciss/cissio.h
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2001 Michael Smith
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD$
29 */
30
31 /*
32 * Driver ioctl interface.
33 *
34 * Note that this interface is API-compatible with the Linux implementation
35 * except as noted, and thus this header bears a striking resemblance to
36 * the Linux driver's cciss_ioctl.h.
37 *
38 */
39
40 #include <sys/ioccom.h>
41
42 #pragma pack(1)
43
44 typedef struct
45 {
46 u_int8_t bus;
47 u_int8_t dev_fn;
48 u_int32_t board_id;
49 } cciss_pci_info_struct;
50
51 typedef struct
52 {
53 u_int32_t delay;
54 u_int32_t count;
55 } cciss_coalint_struct;
56
57 typedef char NodeName_type[16];
58 typedef u_int32_t Heartbeat_type;
59
60 #define CISS_PARSCSIU2 0x0001
61 #define CISS_PARCSCIU3 0x0002
62 #define CISS_FIBRE1G 0x0100
63 #define CISS_FIBRE2G 0x0200
64 typedef u_int32_t BusTypes_type;
65
66 typedef char FirmwareVer_type[4];
67 typedef u_int32_t DriverVer_type;
68
69 /* passthrough command definitions */
70 #define SENSEINFOBYTES 32
71 #define CISS_MAX_LUN 16
72 #define LEVEL2LUN 1
73 #define LEVEL3LUN 0
74
75 /* command status value */
76 #define CMD_SUCCESS 0x0000
77 #define CMD_TARGET_STATUS 0x0001
78 #define CMD_DATA_UNDERRUN 0x0002
79 #define CMD_DATA_OVERRUN 0x0003
80 #define CMD_INVALID 0x0004
81 #define CMD_PROTOCOL_ERR 0x0005
82 #define CMD_HARDWARE_ERR 0x0006
83 #define CMD_CONNECTION_LOST 0x0007
84 #define CMD_ABORTED 0x0008
85 #define CMD_ABORT_FAILED 0x0009
86 #define CMD_UNSOLICITED_ABORT 0x000A
87 #define CMD_TIMEOUT 0x000B
88 #define CMD_UNABORTABLE 0x000C
89
90 /* transfer direction */
91 #define XFER_NONE 0x00
92 #define XFER_WRITE 0x01
93 #define XFER_READ 0x02
94 #define XFER_RSVD 0x03
95
96 /* task attribute */
97 #define ATTR_UNTAGGED 0x00
98 #define ATTR_SIMPLE 0x04
99 #define ATTR_HEADOFQUEUE 0x05
100 #define ATTR_ORDERED 0x06
101 #define ATTR_ACA 0x07
102
103 /* CDB type */
104 #define TYPE_CMD 0x00
105 #define TYPE_MSG 0x01
106
107 /* command list structure */
108 typedef union {
109 struct {
110 u_int8_t Dev;
111 u_int8_t Bus:6;
112 u_int8_t Mode:2;
113 } __packed PeripDev;
114 struct {
115 u_int8_t DevLSB;
116 u_int8_t DevMSB:6;
117 u_int8_t Mode:2;
118 } __packed LogDev;
119 struct {
120 u_int8_t Dev:5;
121 u_int8_t Bus:3;
122 u_int8_t Targ:6;
123 u_int8_t Mode:2;
124 } __packed LogUnit;
125 } SCSI3Addr_struct;
126
127 typedef struct {
128 u_int32_t TargetId:24;
129 u_int32_t Bus:6;
130 u_int32_t Mode:2;
131 SCSI3Addr_struct Target[2];
132 } __packed PhysDevAddr_struct;
133
134 typedef struct {
135 u_int32_t VolId:30;
136 u_int32_t Mode:2;
137 u_int8_t reserved[4];
138 } __packed LogDevAddr_struct;
139
140 typedef union {
141 u_int8_t LunAddrBytes[8];
142 SCSI3Addr_struct SCSI3Lun[4];
143 PhysDevAddr_struct PhysDev;
144 LogDevAddr_struct LogDev;
145 } __packed LUNAddr_struct;
146
147 typedef struct {
148 u_int8_t CDBLen;
149 struct {
150 u_int8_t Type:3;
151 u_int8_t Attribute:3;
152 u_int8_t Direction:2;
153 } __packed Type;
154 u_int16_t Timeout;
155 u_int8_t CDB[16];
156 } __packed RequestBlock_struct;
157
158 typedef union {
159 struct {
160 u_int8_t Reserved[3];
161 u_int8_t Type;
162 u_int32_t ErrorInfo;
163 } __packed Common_Info;
164 struct {
165 u_int8_t Reserved[2];
166 u_int8_t offense_size;
167 u_int8_t offense_num;
168 u_int32_t offense_value;
169 } __packed Invalid_Cmd;
170 } __packed MoreErrInfo_struct;
171
172 typedef struct {
173 u_int8_t ScsiStatus;
174 u_int8_t SenseLen;
175 u_int16_t CommandStatus;
176 u_int32_t ResidualCnt;
177 MoreErrInfo_struct MoreErrInfo;
178 u_int8_t SenseInfo[SENSEINFOBYTES];
179 } __packed ErrorInfo_struct;
180
181 typedef struct {
182 LUNAddr_struct LUN_info; /* 8 */
183 RequestBlock_struct Request; /* 20 */
184 ErrorInfo_struct error_info; /* 48 */
185 u_int16_t buf_size; /* 2 */
186 u_int8_t *buf; /* 4 */
187 } __packed IOCTL_Command_struct;
188
189 #ifdef __amd64__
190 typedef struct {
191 LUNAddr_struct LUN_info; /* 8 */
192 RequestBlock_struct Request; /* 20 */
193 ErrorInfo_struct error_info; /* 48 */
194 u_int16_t buf_size; /* 2 */
195 u_int32_t buf; /* 4 */
196 } __packed IOCTL_Command_struct32;
197 #endif
198
199 /************************************************************************
200 * Command queue statistics
201 */
202
203 #define CISSQ_FREE 0
204 #define CISSQ_NOTIFY 1
205 #define CISSQ_COUNT 2
206
207 struct ciss_qstat {
208 uint32_t q_length;
209 uint32_t q_max;
210 };
211
212 union ciss_statrequest {
213 uint32_t cs_item;
214 struct ciss_qstat cs_qstat;
215 };
216
217 /*
218 * Note that we'd normally pass the struct in directly, but
219 * this code is trying to be compatible with other drivers.
220 */
221 #define CCISS_GETPCIINFO _IOR ('C', 200, cciss_pci_info_struct)
222 #define CCISS_GETINTINFO _IOR ('C', 201, cciss_coalint_struct)
223 #define CCISS_SETINTINFO _IOW ('C', 202, cciss_coalint_struct)
224 #define CCISS_GETNODENAME _IOR ('C', 203, NodeName_type)
225 #define CCISS_SETNODENAME _IOW ('C', 204, NodeName_type)
226 #define CCISS_GETHEARTBEAT _IOR ('C', 205, Heartbeat_type)
227 #define CCISS_GETBUSTYPES _IOR ('C', 206, BusTypes_type)
228 #define CCISS_GETFIRMVER _IOR ('C', 207, FirmwareVer_type)
229 #define CCISS_GETDRIVERVER _IOR ('C', 208, DriverVer_type)
230 #define CCISS_REVALIDVOLS _IO ('C', 209)
231 #define CCISS_PASSTHRU _IOWR ('C', 210, IOCTL_Command_struct)
232 #ifdef __amd64
233 #define CCISS_PASSTHRU32 _IOWR ('C', 210, IOCTL_Command_struct32)
234 #endif
235 #define CCISS_GETQSTATS _IOWR ('C', 211, union ciss_statrequest)
236
237 #pragma pack()
Cache object: 07377a6804903de12cc75e4794a31cfa
|