xref: /titanic_44/usr/src/uts/common/io/aac/aac_ioctl.h (revision f169c0eae91b2ee787cf8d6dcf8edd9159d4c9e2)
1 /*
2  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3  */
4 
5 /*
6  * Copyright 2005-06 Adaptec, Inc.
7  * Copyright (c) 2005-06 Adaptec Inc., Achim Leubner
8  * Copyright (c) 2000 Michael Smith
9  * Copyright (c) 2000 Scott Long
10  * Copyright (c) 2000 BSDi
11  * All rights reserved.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  *    notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  *    notice, this list of conditions and the following disclaimer in the
20  *    documentation and/or other materials provided with the distribution.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  *    $FreeBSD: /repoman/r/ncvs/src/sys/sys/aac_ioctl.h,
35  *    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 IoctlBuf  : 1; /* ARCIOCTL call support */
120 		uint32_t AIFSupport: 1; /* AIF support */
121 		uint32_t JBODSupport:1; /* firmware+driver both support JBOD */
122 		uint32_t fReserved : 28;
123 	} fBits;
124 	uint32_t fValue;
125 } featuresState;
126 
127 struct aac_features {
128 	featuresState feat;
129 	uint32_t data[31];
130 	uint32_t reserved[32];
131 };
132 
133 #pragma pack()
134 
135 /*
136  * Aligned structure definitions for variable declarations that require
137  * alignment.
138  *
139  * Normally the packed structures are defined in a way that if the initial
140  * member is aligned, then the following members will also be aligned. So
141  * we need only to make sure the packed structure, ie. the first member, is
142  * aligned to satisfy alignment requirement.
143  */
144 union aac_revision_align {
145 	struct aac_revision d;
146 	uint32_t dummy;
147 };
148 
149 union aac_get_adapter_fib_align {
150 	struct aac_get_adapter_fib d;
151 	uint32_t dummy;
152 };
153 
154 union aac_pci_info_align {
155 	struct aac_pci_info d;
156 	uint32_t dummy;
157 };
158 
159 union aac_query_disk_align {
160 	struct aac_query_disk d;
161 	int32_t dummy;
162 };
163 
164 union aac_delete_disk_align {
165 	struct aac_delete_disk d;
166 	int32_t dummy;
167 };
168 
169 union aac_features_align {
170 	struct aac_features d;
171 	uint32_t dummy;
172 };
173 
174 #ifdef	__cplusplus
175 }
176 #endif
177 
178 #endif /* _AAC_IOCTL_H_ */
179