xref: /illumos-gate/usr/src/uts/common/io/aac/aac_ioctl.h (revision 3fced4392c3510db4e569c4f8188c45bb5b5f5d3)
1942c5e3cSpl196000 /*
2*3fced439Szhongyan gu - Sun Microsystems - Beijing China  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3942c5e3cSpl196000  */
4942c5e3cSpl196000 
5942c5e3cSpl196000 /*
6942c5e3cSpl196000  * Copyright 2005-06 Adaptec, Inc.
7942c5e3cSpl196000  * Copyright (c) 2005-06 Adaptec Inc., Achim Leubner
8942c5e3cSpl196000  * Copyright (c) 2000 Michael Smith
9942c5e3cSpl196000  * Copyright (c) 2000 Scott Long
10942c5e3cSpl196000  * Copyright (c) 2000 BSDi
11942c5e3cSpl196000  * All rights reserved.
12942c5e3cSpl196000  *
13942c5e3cSpl196000  * Redistribution and use in source and binary forms, with or without
14942c5e3cSpl196000  * modification, are permitted provided that the following conditions
15942c5e3cSpl196000  * are met:
16942c5e3cSpl196000  * 1. Redistributions of source code must retain the above copyright
17942c5e3cSpl196000  *    notice, this list of conditions and the following disclaimer.
18942c5e3cSpl196000  * 2. Redistributions in binary form must reproduce the above copyright
19942c5e3cSpl196000  *    notice, this list of conditions and the following disclaimer in the
20942c5e3cSpl196000  *    documentation and/or other materials provided with the distribution.
21942c5e3cSpl196000  *
22942c5e3cSpl196000  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23942c5e3cSpl196000  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24942c5e3cSpl196000  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25942c5e3cSpl196000  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26942c5e3cSpl196000  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27942c5e3cSpl196000  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28942c5e3cSpl196000  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29942c5e3cSpl196000  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30942c5e3cSpl196000  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31942c5e3cSpl196000  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32942c5e3cSpl196000  * SUCH DAMAGE.
33942c5e3cSpl196000  *
34*3fced439Szhongyan gu - Sun Microsystems - Beijing China  *    $FreeBSD: /repoman/r/ncvs/src/sys/sys/aac_ioctl.h,
35*3fced439Szhongyan gu - Sun Microsystems - Beijing China  *    v 1.11 2004/12/09 22:20:25 scottl Exp $
36942c5e3cSpl196000  */
37942c5e3cSpl196000 
38942c5e3cSpl196000 #ifndef	_AAC_IOCTL_H_
39942c5e3cSpl196000 #define	_AAC_IOCTL_H_
40942c5e3cSpl196000 
41942c5e3cSpl196000 #ifdef	__cplusplus
42942c5e3cSpl196000 extern "C" {
43942c5e3cSpl196000 #endif
44942c5e3cSpl196000 
45942c5e3cSpl196000 /*
46942c5e3cSpl196000  * IOCTL Interface
47942c5e3cSpl196000  */
48942c5e3cSpl196000 
49942c5e3cSpl196000 /* Macro definitions for IOCTL function control codes */
50942c5e3cSpl196000 #define	CTL_CODE(function, method) \
51942c5e3cSpl196000 	((4<< 16) | ((function) << 2) | (method))
52942c5e3cSpl196000 
53942c5e3cSpl196000 /* Method codes for how buffers are passed for I/O and FS controls */
54942c5e3cSpl196000 #define	METHOD_BUFFERED		0
55942c5e3cSpl196000 #define	METHOD_NEITHER		3
56942c5e3cSpl196000 
57942c5e3cSpl196000 /* IOCTL commands */
58942c5e3cSpl196000 #define	FSACTL_SENDFIB			CTL_CODE(2050, METHOD_BUFFERED)
59942c5e3cSpl196000 #define	FSACTL_SEND_RAW_SRB		CTL_CODE(2067, METHOD_BUFFERED)
60942c5e3cSpl196000 #define	FSACTL_DELETE_DISK		0x163
61942c5e3cSpl196000 #define	FSACTL_QUERY_DISK		0x173
62942c5e3cSpl196000 #define	FSACTL_OPEN_GET_ADAPTER_FIB	CTL_CODE(2100, METHOD_BUFFERED)
63942c5e3cSpl196000 #define	FSACTL_GET_NEXT_ADAPTER_FIB	CTL_CODE(2101, METHOD_BUFFERED)
64942c5e3cSpl196000 #define	FSACTL_CLOSE_GET_ADAPTER_FIB	CTL_CODE(2102, METHOD_BUFFERED)
65942c5e3cSpl196000 #define	FSACTL_MINIPORT_REV_CHECK	CTL_CODE(2107, METHOD_BUFFERED)
66942c5e3cSpl196000 #define	FSACTL_GET_PCI_INFO		CTL_CODE(2119, METHOD_BUFFERED)
67942c5e3cSpl196000 #define	FSACTL_FORCE_DELETE_DISK	CTL_CODE(2120, METHOD_NEITHER)
68942c5e3cSpl196000 #define	FSACTL_REGISTER_FIB_SEND	CTL_CODE(2136, METHOD_BUFFERED)
69942c5e3cSpl196000 #define	FSACTL_GET_CONTAINERS		2131
70942c5e3cSpl196000 #define	FSACTL_GET_VERSION_MATCHING	CTL_CODE(2137, METHOD_BUFFERED)
71942c5e3cSpl196000 #define	FSACTL_SEND_LARGE_FIB		CTL_CODE(2138, METHOD_BUFFERED)
72942c5e3cSpl196000 #define	FSACTL_GET_FEATURES		CTL_CODE(2139, METHOD_BUFFERED)
73942c5e3cSpl196000 
74942c5e3cSpl196000 #pragma pack(1)
75942c5e3cSpl196000 
76942c5e3cSpl196000 struct aac_revision
77942c5e3cSpl196000 {
78942c5e3cSpl196000 	uint32_t compat;
79942c5e3cSpl196000 	uint32_t version;
80942c5e3cSpl196000 	uint32_t build;
81942c5e3cSpl196000 };
82942c5e3cSpl196000 
83942c5e3cSpl196000 struct aac_get_adapter_fib
84942c5e3cSpl196000 {
85942c5e3cSpl196000 	uint32_t context;
86942c5e3cSpl196000 	int32_t wait;
87942c5e3cSpl196000 	uint32_t aif_fib;	/* RAID config app is 32bit */
88942c5e3cSpl196000 };
89942c5e3cSpl196000 
90942c5e3cSpl196000 struct aac_pci_info {
91942c5e3cSpl196000 	uint32_t bus;
92942c5e3cSpl196000 	uint32_t slot;
93942c5e3cSpl196000 };
94942c5e3cSpl196000 
95942c5e3cSpl196000 struct aac_query_disk {
96942c5e3cSpl196000 	int32_t container_no;
97942c5e3cSpl196000 	int32_t bus;
98942c5e3cSpl196000 	int32_t target;
99942c5e3cSpl196000 	int32_t lun;
100942c5e3cSpl196000 	uint32_t valid;
101942c5e3cSpl196000 	uint32_t locked;
102942c5e3cSpl196000 	uint32_t deleted;
103942c5e3cSpl196000 	int32_t instance;
104942c5e3cSpl196000 	char disk_device_name[10];
105942c5e3cSpl196000 	uint32_t unmapped;
106942c5e3cSpl196000 };
107942c5e3cSpl196000 
108942c5e3cSpl196000 struct aac_delete_disk {
109942c5e3cSpl196000 	int32_t nt_disk_no;
110942c5e3cSpl196000 	int32_t container_no;
111942c5e3cSpl196000 };
112942c5e3cSpl196000 
113942c5e3cSpl196000 /*
114942c5e3cSpl196000  * The following definitions come from Adaptec:
115942c5e3cSpl196000  */
116942c5e3cSpl196000 typedef union {
117942c5e3cSpl196000 	struct {
118942c5e3cSpl196000 		uint32_t largeLBA  : 1;	/* disk support greater 2TB */
119*3fced439Szhongyan gu - Sun Microsystems - Beijing China 		uint32_t IoctlBuf  : 1; /* ARCIOCTL call support */
120*3fced439Szhongyan gu - Sun Microsystems - Beijing China 		uint32_t AIFSupport: 1; /* AIF support */
121*3fced439Szhongyan gu - Sun Microsystems - Beijing China 		uint32_t JBODSupport:1; /* firmware+driver both support JBOD */
122*3fced439Szhongyan gu - Sun Microsystems - Beijing China 		uint32_t fReserved : 28;
123942c5e3cSpl196000 	} fBits;
124942c5e3cSpl196000 	uint32_t fValue;
125942c5e3cSpl196000 } featuresState;
126942c5e3cSpl196000 
127942c5e3cSpl196000 struct aac_features {
128942c5e3cSpl196000 	featuresState feat;
129942c5e3cSpl196000 	uint32_t data[31];
130942c5e3cSpl196000 	uint32_t reserved[32];
131942c5e3cSpl196000 };
132942c5e3cSpl196000 
133942c5e3cSpl196000 #pragma pack()
134942c5e3cSpl196000 
135942c5e3cSpl196000 /*
136942c5e3cSpl196000  * Aligned structure definitions for variable declarations that require
137942c5e3cSpl196000  * alignment.
138942c5e3cSpl196000  *
139942c5e3cSpl196000  * Normally the packed structures are defined in a way that if the initial
140942c5e3cSpl196000  * member is aligned, then the following members will also be aligned. So
14158bc78c7SXin Chen  * we need only to make sure the packed structure, ie. the first member, is
142942c5e3cSpl196000  * aligned to satisfy alignment requirement.
143942c5e3cSpl196000  */
144942c5e3cSpl196000 union aac_revision_align {
145942c5e3cSpl196000 	struct aac_revision d;
146942c5e3cSpl196000 	uint32_t dummy;
147942c5e3cSpl196000 };
148942c5e3cSpl196000 
149942c5e3cSpl196000 union aac_get_adapter_fib_align {
150942c5e3cSpl196000 	struct aac_get_adapter_fib d;
151942c5e3cSpl196000 	uint32_t dummy;
152942c5e3cSpl196000 };
153942c5e3cSpl196000 
154942c5e3cSpl196000 union aac_pci_info_align {
155942c5e3cSpl196000 	struct aac_pci_info d;
156942c5e3cSpl196000 	uint32_t dummy;
157942c5e3cSpl196000 };
158942c5e3cSpl196000 
159942c5e3cSpl196000 union aac_query_disk_align {
160942c5e3cSpl196000 	struct aac_query_disk d;
161942c5e3cSpl196000 	int32_t dummy;
162942c5e3cSpl196000 };
163942c5e3cSpl196000 
164942c5e3cSpl196000 union aac_delete_disk_align {
165942c5e3cSpl196000 	struct aac_delete_disk d;
166942c5e3cSpl196000 	int32_t dummy;
167942c5e3cSpl196000 };
168942c5e3cSpl196000 
169942c5e3cSpl196000 union aac_features_align {
170942c5e3cSpl196000 	struct aac_features d;
171942c5e3cSpl196000 	uint32_t dummy;
172942c5e3cSpl196000 };
173942c5e3cSpl196000 
174942c5e3cSpl196000 #ifdef	__cplusplus
175942c5e3cSpl196000 }
176942c5e3cSpl196000 #endif
177942c5e3cSpl196000 
178942c5e3cSpl196000 #endif /* _AAC_IOCTL_H_ */
179