xref: /illumos-gate/usr/src/uts/common/io/aac/aac_ioctl.h (revision 46b592853d0f4f11781b6b0a7533f267c6aee132)
1 /*
2  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright 2005-06 Adaptec, Inc.
8  * Copyright (c) 2005-06 Adaptec Inc., Achim Leubner
9  * Copyright (c) 2000 Michael Smith
10  * Copyright (c) 2000 Scott Long
11  * Copyright (c) 2000 BSDi
12  * All rights reserved.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  * 1. Redistributions of source code must retain the above copyright
18  *    notice, this list of conditions and the following disclaimer.
19  * 2. Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in the
21  *    documentation and/or other materials provided with the distribution.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  *    $FreeBSD: /repoman/r/ncvs/src/sys/sys/aac_ioctl.h,v 1.11 2004/12/09 22:20:25 scottl Exp $
36  */
37 
38 #ifndef	_AAC_IOCTL_H_
39 #define	_AAC_IOCTL_H_
40 
41 #ifdef	__cplusplus
42 extern "C" {
43 #endif
44 
45 /*
46  * IOCTL Interface
47  */
48 
49 /* Macro definitions for IOCTL function control codes */
50 #define	CTL_CODE(function, method) \
51 	((4<< 16) | ((function) << 2) | (method))
52 
53 /* Method codes for how buffers are passed for I/O and FS controls */
54 #define	METHOD_BUFFERED		0
55 #define	METHOD_NEITHER		3
56 
57 /* IOCTL commands */
58 #define	FSACTL_SENDFIB			CTL_CODE(2050, METHOD_BUFFERED)
59 #define	FSACTL_SEND_RAW_SRB		CTL_CODE(2067, METHOD_BUFFERED)
60 #define	FSACTL_DELETE_DISK		0x163
61 #define	FSACTL_QUERY_DISK		0x173
62 #define	FSACTL_OPEN_GET_ADAPTER_FIB	CTL_CODE(2100, METHOD_BUFFERED)
63 #define	FSACTL_GET_NEXT_ADAPTER_FIB	CTL_CODE(2101, METHOD_BUFFERED)
64 #define	FSACTL_CLOSE_GET_ADAPTER_FIB	CTL_CODE(2102, METHOD_BUFFERED)
65 #define	FSACTL_MINIPORT_REV_CHECK	CTL_CODE(2107, METHOD_BUFFERED)
66 #define	FSACTL_GET_PCI_INFO		CTL_CODE(2119, METHOD_BUFFERED)
67 #define	FSACTL_FORCE_DELETE_DISK	CTL_CODE(2120, METHOD_NEITHER)
68 #define	FSACTL_REGISTER_FIB_SEND	CTL_CODE(2136, METHOD_BUFFERED)
69 #define	FSACTL_GET_CONTAINERS		2131
70 #define	FSACTL_GET_VERSION_MATCHING	CTL_CODE(2137, METHOD_BUFFERED)
71 #define	FSACTL_SEND_LARGE_FIB		CTL_CODE(2138, METHOD_BUFFERED)
72 #define	FSACTL_GET_FEATURES		CTL_CODE(2139, METHOD_BUFFERED)
73 
74 #pragma pack(1)
75 
76 struct aac_revision
77 {
78 	uint32_t compat;
79 	uint32_t version;
80 	uint32_t build;
81 };
82 
83 struct aac_get_adapter_fib
84 {
85 	uint32_t context;
86 	int32_t wait;
87 	uint32_t aif_fib;	/* RAID config app is 32bit */
88 };
89 
90 struct aac_pci_info {
91 	uint32_t bus;
92 	uint32_t slot;
93 };
94 
95 struct aac_query_disk {
96 	int32_t container_no;
97 	int32_t bus;
98 	int32_t target;
99 	int32_t lun;
100 	uint32_t valid;
101 	uint32_t locked;
102 	uint32_t deleted;
103 	int32_t instance;
104 	char disk_device_name[10];
105 	uint32_t unmapped;
106 };
107 
108 struct aac_delete_disk {
109 	int32_t nt_disk_no;
110 	int32_t container_no;
111 };
112 
113 /*
114  * The following definitions come from Adaptec:
115  */
116 typedef union {
117 	struct {
118 		uint32_t largeLBA  : 1;	/* disk support greater 2TB */
119 		uint32_t fReserved : 31;
120 	} fBits;
121 	uint32_t fValue;
122 } featuresState;
123 
124 struct aac_features {
125 	featuresState feat;
126 	uint32_t data[31];
127 	uint32_t reserved[32];
128 };
129 
130 #pragma pack()
131 
132 /*
133  * Aligned structure definitions for variable declarations that require
134  * alignment.
135  *
136  * Normally the packed structures are defined in a way that if the initial
137  * member is aligned, then the following members will also be aligned. So
138  * we need only to make sure the packed structure, ie. the first member, is
139  * aligned to satisfy alignment requirement.
140  */
141 union aac_revision_align {
142 	struct aac_revision d;
143 	uint32_t dummy;
144 };
145 
146 union aac_get_adapter_fib_align {
147 	struct aac_get_adapter_fib d;
148 	uint32_t dummy;
149 };
150 
151 union aac_pci_info_align {
152 	struct aac_pci_info d;
153 	uint32_t dummy;
154 };
155 
156 union aac_query_disk_align {
157 	struct aac_query_disk d;
158 	int32_t dummy;
159 };
160 
161 union aac_delete_disk_align {
162 	struct aac_delete_disk d;
163 	int32_t dummy;
164 };
165 
166 union aac_features_align {
167 	struct aac_features d;
168 	uint32_t dummy;
169 };
170 
171 #ifdef	__cplusplus
172 }
173 #endif
174 
175 #endif /* _AAC_IOCTL_H_ */
176