xref: /titanic_50/usr/src/uts/common/io/aac/aac_ioctl.h (revision d2ec54f7875f7e05edd56195adbeb593c947763f)
1 /*
2  * Copyright 2007 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
42 
43 #ifdef	__cplusplus
44 extern "C" {
45 #endif
46 
47 /*
48  * IOCTL Interface
49  */
50 
51 /* Macro definitions for IOCTL function control codes */
52 #define	CTL_CODE(function, method) \
53 	((4<< 16) | ((function) << 2) | (method))
54 
55 /* Method codes for how buffers are passed for I/O and FS controls */
56 #define	METHOD_BUFFERED		0
57 #define	METHOD_NEITHER		3
58 
59 /* IOCTL commands */
60 #define	FSACTL_SENDFIB			CTL_CODE(2050, METHOD_BUFFERED)
61 #define	FSACTL_SEND_RAW_SRB		CTL_CODE(2067, METHOD_BUFFERED)
62 #define	FSACTL_DELETE_DISK		0x163
63 #define	FSACTL_QUERY_DISK		0x173
64 #define	FSACTL_OPEN_GET_ADAPTER_FIB	CTL_CODE(2100, METHOD_BUFFERED)
65 #define	FSACTL_GET_NEXT_ADAPTER_FIB	CTL_CODE(2101, METHOD_BUFFERED)
66 #define	FSACTL_CLOSE_GET_ADAPTER_FIB	CTL_CODE(2102, METHOD_BUFFERED)
67 #define	FSACTL_MINIPORT_REV_CHECK	CTL_CODE(2107, METHOD_BUFFERED)
68 #define	FSACTL_GET_PCI_INFO		CTL_CODE(2119, METHOD_BUFFERED)
69 #define	FSACTL_FORCE_DELETE_DISK	CTL_CODE(2120, METHOD_NEITHER)
70 #define	FSACTL_REGISTER_FIB_SEND	CTL_CODE(2136, METHOD_BUFFERED)
71 #define	FSACTL_GET_CONTAINERS		2131
72 #define	FSACTL_GET_VERSION_MATCHING	CTL_CODE(2137, METHOD_BUFFERED)
73 #define	FSACTL_SEND_LARGE_FIB		CTL_CODE(2138, METHOD_BUFFERED)
74 #define	FSACTL_GET_FEATURES		CTL_CODE(2139, METHOD_BUFFERED)
75 
76 #pragma pack(1)
77 
78 struct aac_revision
79 {
80 	uint32_t compat;
81 	uint32_t version;
82 	uint32_t build;
83 };
84 
85 struct aac_get_adapter_fib
86 {
87 	uint32_t context;
88 	int32_t wait;
89 	uint32_t aif_fib;	/* RAID config app is 32bit */
90 };
91 
92 struct aac_pci_info {
93 	uint32_t bus;
94 	uint32_t slot;
95 };
96 
97 struct aac_query_disk {
98 	int32_t container_no;
99 	int32_t bus;
100 	int32_t target;
101 	int32_t lun;
102 	uint32_t valid;
103 	uint32_t locked;
104 	uint32_t deleted;
105 	int32_t instance;
106 	char disk_device_name[10];
107 	uint32_t unmapped;
108 };
109 
110 struct aac_delete_disk {
111 	int32_t nt_disk_no;
112 	int32_t container_no;
113 };
114 
115 /*
116  * The following definitions come from Adaptec:
117  */
118 typedef union {
119 	struct {
120 		uint32_t largeLBA  : 1;	/* disk support greater 2TB */
121 		uint32_t fReserved : 31;
122 	} fBits;
123 	uint32_t fValue;
124 } featuresState;
125 
126 struct aac_features {
127 	featuresState feat;
128 	uint32_t data[31];
129 	uint32_t reserved[32];
130 };
131 
132 #pragma pack()
133 
134 /*
135  * Aligned structure definitions for variable declarations that require
136  * alignment.
137  *
138  * Normally the packed structures are defined in a way that if the initial
139  * member is aligned, then the following members will also be aligned. So
140  * we need only to make the packed structure, ie. the first member, is
141  * aligned to satisfy alignment requirement.
142  */
143 union aac_revision_align {
144 	struct aac_revision d;
145 	uint32_t dummy;
146 };
147 
148 union aac_get_adapter_fib_align {
149 	struct aac_get_adapter_fib d;
150 	uint32_t dummy;
151 };
152 
153 union aac_pci_info_align {
154 	struct aac_pci_info d;
155 	uint32_t dummy;
156 };
157 
158 union aac_query_disk_align {
159 	struct aac_query_disk d;
160 	int32_t dummy;
161 };
162 
163 union aac_delete_disk_align {
164 	struct aac_delete_disk d;
165 	int32_t dummy;
166 };
167 
168 union aac_features_align {
169 	struct aac_features d;
170 	uint32_t dummy;
171 };
172 
173 #ifdef	__cplusplus
174 }
175 #endif
176 
177 #endif /* _AAC_IOCTL_H_ */
178