xref: /dragonfly/sys/dev/raid/aac/aac_ioctl.h (revision f746689a)
1 /*-
2  * Copyright (c) 2000 Michael Smith
3  * Copyright (c) 2000 Scott Long
4  * Copyright (c) 2000 BSDi
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: src/sys/dev/aac/aac_ioctl.h,v 1.2.2.2 2001/09/19 19:09:11 scottl Exp $
29  *	$DragonFly: src/sys/dev/raid/aac/aac_ioctl.h,v 1.2 2003/06/17 04:28:21 dillon Exp $
30  */
31 
32 #include <sys/ioccom.h>
33 
34 /*
35  * Command queue statistics
36  */
37 #define AACQ_FREE	0
38 #define AACQ_BIO	1
39 #define AACQ_READY	2
40 #define AACQ_BUSY	3
41 #define AACQ_COMPLETE	4
42 #define AACQ_COUNT	5	/* total number of queues */
43 
44 struct aac_qstat {
45 	u_int32_t	q_length;
46 	u_int32_t	q_max;
47 };
48 
49 /*
50  * Statistics request
51  */
52 union aac_statrequest {
53 	u_int32_t		as_item;
54 	struct aac_qstat	as_qstat;
55 };
56 
57 #define AACIO_STATS		_IOWR('T', 101, union aac_statrequest)
58 
59 /*
60  * Ioctl commands likely to be submitted from a Linux management application.
61  * These bit encodings are actually descended from Windows NT.  Ick.
62  */
63 
64 #define CTL_CODE(devType, func, meth, acc) (((devType) << 16) | ((acc) << 14) | ((func) << 2) | (meth))
65 #define METHOD_BUFFERED                 0
66 #define METHOD_IN_DIRECT                1
67 #define METHOD_OUT_DIRECT               2
68 #define METHOD_NEITHER                  3
69 #define FILE_ANY_ACCESS                 0
70 #define FILE_READ_ACCESS          	( 0x0001 )
71 #define FILE_WRITE_ACCESS         	( 0x0002 )
72 #define FILE_DEVICE_CONTROLLER          0x00000004
73 
74 #define FSACTL_LNX_SENDFIB		CTL_CODE(FILE_DEVICE_CONTROLLER, 2050, \
75 					METHOD_BUFFERED, FILE_ANY_ACCESS)
76 #define FSACTL_LNX_GET_COMM_PERF_DATA	CTL_CODE(FILE_DEVICE_CONTROLLER, 2084, \
77 					METHOD_BUFFERED, FILE_ANY_ACCESS)
78 #define FSACTL_LNX_OPENCLS_COMM_PERF_DATA CTL_CODE(FILE_DEVICE_CONTROLLER, \
79 					2085, METHOD_BUFFERED, FILE_ANY_ACCESS)
80 #define FSACTL_LNX_OPEN_GET_ADAPTER_FIB	CTL_CODE(FILE_DEVICE_CONTROLLER, 2100, \
81 					METHOD_BUFFERED, FILE_ANY_ACCESS)
82 #define FSACTL_LNX_GET_NEXT_ADAPTER_FIB	CTL_CODE(FILE_DEVICE_CONTROLLER, 2101, \
83 					METHOD_BUFFERED, FILE_ANY_ACCESS)
84 #define FSACTL_LNX_CLOSE_GET_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, \
85 					2102, METHOD_BUFFERED, FILE_ANY_ACCESS)
86 #define FSACTL_LNX_CLOSE_ADAPTER_CONFIG	CTL_CODE(FILE_DEVICE_CONTROLLER, 2104, \
87 					METHOD_BUFFERED, FILE_ANY_ACCESS)
88 #define FSACTL_LNX_OPEN_ADAPTER_CONFIG	CTL_CODE(FILE_DEVICE_CONTROLLER, 2105, \
89 					METHOD_BUFFERED, FILE_ANY_ACCESS)
90 #define FSACTL_LNX_MINIPORT_REV_CHECK	CTL_CODE(FILE_DEVICE_CONTROLLER, 2107, \
91 					METHOD_BUFFERED, FILE_ANY_ACCESS)
92 #define FSACTL_LNX_QUERY_ADAPTER_CONFIG	CTL_CODE(FILE_DEVICE_CONTROLLER, 2113, \
93 					METHOD_BUFFERED, FILE_ANY_ACCESS)
94 #define FSACTL_LNX_GET_PCI_INFO		CTL_CODE(FILE_DEVICE_CONTROLLER, 2119, \
95 					METHOD_BUFFERED, FILE_ANY_ACCESS)
96 #define FSACTL_LNX_FORCE_DELETE_DISK	CTL_CODE(FILE_DEVICE_CONTROLLER, 2120, \
97 					METHOD_NEITHER, FILE_ANY_ACCESS)
98 #define FSACTL_LNX_AIF_THREAD		CTL_CODE(FILE_DEVICE_CONTROLLER, 2127, \
99 					METHOD_NEITHER, FILE_ANY_ACCESS)
100 
101 /* Why these don't follow the previous convention, I don't know */
102 #define FSACTL_LNX_NULL_IO_TEST		0x43
103 #define FSACTL_LNX_SIM_IO_TEST		0x53
104 #define FSACTL_LNX_DOWNLOAD		0x83
105 #define FSACTL_LNX_GET_VAR		0x93
106 #define FSACTL_LNX_SET_VAR		0xa3
107 #define FSACTL_LNX_GET_FIBTIMES		0xb3
108 #define FSACTL_LNX_ZERO_FIBTIMES	0xc3
109 #define FSACTL_LNX_DELETE_DISK		0x163
110 #define FSACTL_LNX_QUERY_DISK		0x173
111 
112 /* Ok, here it gets really lame */
113 #define FSACTL_LNX_PROBE_CONTAINERS	2131	/* Just guessing */
114 
115 /* Do the native version of the ioctls.  Since the BSD encoding scheme
116  * conflicts with the 'standard' AAC encoding scheme, the resulting numbers
117  * will be different.  The '8' comes from the fact that the previous scheme
118  * used 12 bits for the number, with the the 12th bit being the only set
119  * bit above bit 8.  Thus the value of 8, with the lower 8 bits holding the
120  * command number.  9 is used for the odd overflow case.
121  */
122 #define FSACTL_SENDFIB			_IO('8', 2)
123 #define FSACTL_GET_COMM_PERF_DATA	_IO('8', 36)
124 #define FSACTL_OPENCLS_COMM_PERF_DATA	_IO('8', 37)
125 #define FSACTL_OPEN_GET_ADAPTER_FIB	_IO('8', 52)
126 #define FSACTL_GET_NEXT_ADAPTER_FIB	_IO('8', 53)
127 #define FSACTL_CLOSE_GET_ADAPTER_FIB	_IO('8', 54)
128 #define FSACTL_CLOSE_ADAPTER_CONFIG	_IO('8', 56)
129 #define FSACTL_OPEN_ADAPTER_CONFIG	_IO('8', 57)
130 #define FSACTL_MINIPORT_REV_CHECK	_IO('8', 59)
131 #define FSACTL_QUERY_ADAPTER_CONFIG	_IO('8', 65)
132 #define FSACTL_GET_PCI_INFO		_IO('8', 71)
133 #define FSACTL_FORCE_DELETE_DISK	_IO('8', 72)
134 #define FSACTL_AIF_THREAD		_IO('8', 79)
135 
136 #define FSACTL_NULL_IO_TEST		_IO('8', 67)
137 #define FSACTL_SIM_IO_TEST		_IO('8', 83)
138 #define FSACTL_DOWNLOAD			_IO('8', 131)
139 #define FSACTL_GET_VAR			_IO('8', 147)
140 #define FSACTL_SET_VAR			_IO('8', 163)
141 #define FSACTL_GET_FIBTIMES		_IO('8', 179)
142 #define FSACTL_ZERO_FIBTIMES		_IO('8', 195)
143 #define FSACTL_DELETE_DISK		_IO('8', 99)
144 #define FSACTL_QUERY_DISK		_IO('9', 115)
145 
146 #define FSACTL_PROBE_CONTAINERS		_IO('9', 83)	/* Just guessing */
147 
148 
149 /*
150  * Support for faking the "miniport" version.
151  */
152 struct aac_rev_check {
153 	RevComponent		callingComponent;
154 	struct FsaRevision	callingRevision;
155 };
156 
157 struct aac_rev_check_resp {
158 	int			possiblyCompatible;
159 	struct FsaRevision	adapterSWRevision;
160 };
161 
162 /*
163  * Context passed in by a consumer looking to collect an AIF.
164  */
165 struct get_adapter_fib_ioctl {
166 	u_int32_t	AdapterFibContext;
167 	int	  	Wait;
168 	caddr_t		AifFib;
169 };
170 
171 struct aac_query_disk {
172 	int32_t		ContainerNumber;
173 	int32_t		Bus;
174 	int32_t		Target;
175 	int32_t		Lun;
176 	u_int32_t	Valid;
177 	u_int32_t	Locked;
178 	u_int32_t	Deleted;
179 	int32_t		Instance;
180 	char		diskDeviceName[10];
181 	u_int32_t	UnMapped;
182 };
183