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