summaryrefslogtreecommitdiffstats
path: root/sys/dev/ciss/cissio.h
blob: abc14ab602a040b7fcbde7256d94d9e59db16b7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/*-
 * Copyright (c) 2001 Michael Smith
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	$FreeBSD$
 */

/*
 * Driver ioctl interface.
 *
 * Note that this interface is API-compatible with the Linux implementation
 * except as noted, and thus this header bears a striking resemblance to 
 * the Linux driver's cciss_ioctl.h.
 *
 */

#include <sys/ioccom.h>

#pragma pack(1)

typedef struct
{
    u_int8_t	bus;
    u_int8_t	dev_fn;
    u_int32_t	board_id;
} cciss_pci_info_struct; 

typedef struct
{
    u_int32_t	delay;
    u_int32_t	count;
} cciss_coalint_struct;

typedef char		NodeName_type[16];
typedef u_int32_t	Heartbeat_type;

#define CISS_PARSCSIU2	0x0001
#define CISS_PARCSCIU3	0x0002
#define CISS_FIBRE1G	0x0100
#define CISS_FIBRE2G	0x0200
typedef u_int32_t	BusTypes_type;

typedef char		FirmwareVer_type[4];
typedef u_int32_t	DriverVer_type;

/* passthrough command definitions */
#define SENSEINFOBYTES          32
#define CISS_MAX_LUN		16	
#define LEVEL2LUN		1
#define LEVEL3LUN		0

/* command status value */
#define CMD_SUCCESS		0x0000
#define CMD_TARGET_STATUS	0x0001
#define CMD_DATA_UNDERRUN	0x0002
#define CMD_DATA_OVERRUN	0x0003
#define CMD_INVALID		0x0004
#define CMD_PROTOCOL_ERR	0x0005
#define CMD_HARDWARE_ERR	0x0006
#define CMD_CONNECTION_LOST	0x0007
#define CMD_ABORTED		0x0008
#define CMD_ABORT_FAILED	0x0009
#define CMD_UNSOLICITED_ABORT	0x000A
#define CMD_TIMEOUT		0x000B
#define CMD_UNABORTABLE		0x000C

/* transfer direction */
#define XFER_NONE		0x00
#define XFER_WRITE		0x01
#define XFER_READ		0x02
#define XFER_RSVD		0x03

/* task attribute */
#define ATTR_UNTAGGED		0x00
#define ATTR_SIMPLE		0x04
#define ATTR_HEADOFQUEUE	0x05
#define ATTR_ORDERED		0x06
#define ATTR_ACA		0x07

/* CDB type */
#define TYPE_CMD		0x00
#define TYPE_MSG		0x01

/* command list structure */
typedef union {
    struct {
	u_int8_t	Dev;
	u_int8_t	Bus:6;
	u_int8_t	Mode:2;
    } PeripDev __packed;
    struct {
	u_int8_t	DevLSB;
	u_int8_t	DevMSB:6;
	u_int8_t	Mode:2;
    } LogDev __packed;
    struct {
	u_int8_t	Dev:5;
	u_int8_t	Bus:3;
	u_int8_t	Targ:6;
	u_int8_t	Mode:2;
    } LogUnit __packed;
} SCSI3Addr_struct;

typedef struct {
    u_int32_t		TargetId:24;
    u_int32_t		Bus:6;
    u_int32_t		Mode:2;
    SCSI3Addr_struct	Target[2];
} PhysDevAddr_struct __packed;
  
typedef struct {
    u_int32_t		VolId:30;
    u_int32_t		Mode:2;
    u_int8_t		reserved[4];
} LogDevAddr_struct __packed;

typedef union {
    u_int8_t		LunAddrBytes[8];
    SCSI3Addr_struct	SCSI3Lun[4];
    PhysDevAddr_struct	PhysDev;
    LogDevAddr_struct	LogDev;
} LUNAddr_struct __packed;

typedef struct {
    u_int8_t	CDBLen;
    struct {
	u_int8_t	Type:3;
	u_int8_t	Attribute:3;
	u_int8_t	Direction:2;
    } Type __packed;
    u_int16_t	Timeout;
    u_int8_t	CDB[16];
} RequestBlock_struct __packed;

typedef union {
    struct {
	u_int8_t	Reserved[3];
	u_int8_t	Type;
	u_int32_t	ErrorInfo;
    } Common_Info __packed;
    struct {
	u_int8_t	Reserved[2];
	u_int8_t	offense_size;
	u_int8_t	offense_num;
	u_int32_t	offense_value;
    } Invalid_Cmd __packed;
} MoreErrInfo_struct __packed;

typedef struct {
    u_int8_t		ScsiStatus;
    u_int8_t		SenseLen;
    u_int16_t		CommandStatus;
    u_int32_t		ResidualCnt;
    MoreErrInfo_struct	MoreErrInfo;
    u_int8_t		SenseInfo[SENSEINFOBYTES];
} ErrorInfo_struct __packed;

typedef struct {
    LUNAddr_struct	LUN_info;	/* 8 */
    RequestBlock_struct	Request;	/* 20 */
    ErrorInfo_struct	error_info;	/* 48 */
    u_int16_t		buf_size;	/* 2 */
    u_int8_t		*buf;		/* 4 */
} IOCTL_Command_struct __packed;

/*
 * Note that we'd normally pass the struct in directly, but
 * this code is trying to be compatible with other drivers.
 */
#define CCISS_GETPCIINFO	_IOR ('C', 200, cciss_pci_info_struct)
#define CCISS_GETINTINFO	_IOR ('C', 201, cciss_coalint_struct)
#define CCISS_SETINTINFO	_IOW ('C', 202, cciss_coalint_struct)
#define CCISS_GETNODENAME	_IOR ('C', 203, NodeName_type)
#define CCISS_SETNODENAME	_IOW ('C', 204, NodeName_type)
#define CCISS_GETHEARTBEAT	_IOR ('C', 205, Heartbeat_type)
#define CCISS_GETBUSTYPES	_IOR ('C', 206, BusTypes_type)
#define CCISS_GETFIRMVER	_IOR ('C', 207, FirmwareVer_type)
#define CCISS_GETDRIVERVER	_IOR ('C', 208, DriverVer_type)
#define CCISS_REVALIDVOLS	_IO  ('C', 209)
#define CCISS_PASSTHRU		_IOWR ('C', 210, IOCTL_Command_struct)

#pragma pack()
OpenPOWER on IntegriCloud