xref: /titanic_44/usr/src/uts/common/io/aac/aac_regs.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-2001 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  *
34942c5e3cSpl196000  *    $FreeBSD: src/sys/dev/aac/aacreg.h,v 1.23 2005/10/14 16:22:45 scottl Exp $
35942c5e3cSpl196000  */
36942c5e3cSpl196000 
37942c5e3cSpl196000 #ifndef	__AAC_REGS_H__
38942c5e3cSpl196000 #define	__AAC_REGS_H__
39942c5e3cSpl196000 
40942c5e3cSpl196000 #ifdef	__cplusplus
41942c5e3cSpl196000 extern "C" {
42942c5e3cSpl196000 #endif
43942c5e3cSpl196000 
44942c5e3cSpl196000 /* Status bits in the doorbell registers */
45942c5e3cSpl196000 #define	AAC_DB_SYNC_COMMAND		(1<<0)	/* send/completed synchronous */
46942c5e3cSpl196000 						/* FIB */
47942c5e3cSpl196000 #define	AAC_DB_COMMAND_READY		(1<<1)	/* posted one or more */
48942c5e3cSpl196000 						/* commands */
49942c5e3cSpl196000 #define	AAC_DB_RESPONSE_READY		(1<<2)	/* one or more commands	*/
50942c5e3cSpl196000 						/* complete */
51942c5e3cSpl196000 #define	AAC_DB_COMMAND_NOT_FULL		(1<<3)	/* command queue not full */
52942c5e3cSpl196000 #define	AAC_DB_RESPONSE_NOT_FULL	(1<<4)	/* response queue not full */
53942c5e3cSpl196000 #define	AAC_DB_PRINTF_READY		(1<<5)	/* adapter requests host */
54942c5e3cSpl196000 						/* printf */
55942c5e3cSpl196000 #define	AAC_DB_INTR_BITS (AAC_DB_COMMAND_READY | \
56942c5e3cSpl196000 	AAC_DB_RESPONSE_READY | AAC_DB_PRINTF_READY)
57942c5e3cSpl196000 #define	AAC_DB_INTR_NEW			0x08
58942c5e3cSpl196000 
59942c5e3cSpl196000 /* Status bits in firmware status reg */
60942c5e3cSpl196000 #define	AAC_SELF_TEST_FAILED		0x00000004
61942c5e3cSpl196000 #define	AAC_MONITOR_PANIC		0x00000020
62942c5e3cSpl196000 #define	AAC_KERNEL_UP_AND_RUNNING	0x00000080
63942c5e3cSpl196000 #define	AAC_KERNEL_PANIC		0x00000100
64942c5e3cSpl196000 
65942c5e3cSpl196000 /* aac registers definitions */
66942c5e3cSpl196000 #define	AAC_OMR0		0x18	/* outbound message register 0 */
67942c5e3cSpl196000 #define	AAC_OMR1		0x1c	/* outbound message register 1 */
68942c5e3cSpl196000 #define	AAC_IDBR		0x20	/* inbound doorbell reg */
69942c5e3cSpl196000 #define	AAC_ODBR		0x2c	/* outbound doorbell reg */
70942c5e3cSpl196000 #define	AAC_OIMR		0x34	/* outbound interrupt mask reg */
71942c5e3cSpl196000 #define	AAC_IRCSR		0x38	/* inbound dual cores reset (SRL) */
72942c5e3cSpl196000 #define	AAC_IQUE		0x40	/* inbound queue */
73942c5e3cSpl196000 #define	AAC_OQUE		0x44	/* outbound queue */
74942c5e3cSpl196000 #define	AAC_RX_MAILBOX		0x50	/* mailbox, size=20bytes, rx */
75942c5e3cSpl196000 #define	AAC_RX_FWSTATUS		0x6c	/* firmware status, rx */
76942c5e3cSpl196000 #define	AAC_RKT_MAILBOX		0x1000	/* mailbox, size=20bytes, rkt */
77942c5e3cSpl196000 #define	AAC_RKT_FWSTATUS	0x101c	/* firmware status, rkt */
78942c5e3cSpl196000 
79942c5e3cSpl196000 /* Synchronous commands to the monitor/kernel. */
80942c5e3cSpl196000 #define	AAC_BREAKPOINT_REQ	0x04
81942c5e3cSpl196000 #define	AAC_MONKER_INITSTRUCT	0x05
82942c5e3cSpl196000 #define	AAC_MONKER_SYNCFIB	0x0c
83942c5e3cSpl196000 #define	AAC_MONKER_GETKERNVER	0x11
84942c5e3cSpl196000 #define	AAC_MONKER_GETINFO	0x19
85942c5e3cSpl196000 #define	AAC_MONKER_GETDRVPROP	0x23
86942c5e3cSpl196000 #define	AAC_MONKER_GETCOMMPREF	0x26
87942c5e3cSpl196000 #define	AAC_IOP_RESET		0x1000
88942c5e3cSpl196000 
89942c5e3cSpl196000 /* Sunrise Lake dual core reset */
90942c5e3cSpl196000 #define	AAC_IRCSR_CORES_RST	3
91942c5e3cSpl196000 
92942c5e3cSpl196000 #define	AAC_SECTOR_SIZE		512
93942c5e3cSpl196000 #define	AAC_NUMBER_OF_HEADS	255
94942c5e3cSpl196000 #define	AAC_SECTORS_PER_TRACK	63
95942c5e3cSpl196000 #define	AAC_ROTATION_SPEED	10000
96942c5e3cSpl196000 #define	AAC_MAX_PFN		0xfffff
97942c5e3cSpl196000 
98942c5e3cSpl196000 #define	AAC_ADDITIONAL_LEN	31
99942c5e3cSpl196000 #define	AAC_ANSI_VER		2
100942c5e3cSpl196000 #define	AAC_RESP_DATA_FORMAT	2
101942c5e3cSpl196000 
102942c5e3cSpl196000 #define	AAC_MAX_LD		64	/* max number of logical disks */
10358bc78c7SXin Chen #define	AAC_MAX_PD(s)		((s)->bus_max * (s)->tgt_max)
10458bc78c7SXin Chen #define	AAC_MAX_DEV(s)		(AAC_MAX_LD + AAC_MAX_PD((s)))
105942c5e3cSpl196000 #define	AAC_BLK_SIZE		AAC_SECTOR_SIZE
106942c5e3cSpl196000 #define	AAC_DMA_ALIGN		4
107942c5e3cSpl196000 #define	AAC_DMA_ALIGN_MASK	(AAC_DMA_ALIGN - 1)
108942c5e3cSpl196000 
109942c5e3cSpl196000 #define	AAC_MAX_CONTAINERS	AAC_MAX_LD
110942c5e3cSpl196000 
111942c5e3cSpl196000 /*
112942c5e3cSpl196000  * Minimum memory sizes we need to map to address the adapter. Before
113942c5e3cSpl196000  * we know the actual size to map, minimum memory is used instead.
114942c5e3cSpl196000  */
115942c5e3cSpl196000 #define	AAC_MAP_SIZE_MIN_RX	4096
116942c5e3cSpl196000 #define	AAC_MAP_SIZE_MIN_RKT	8192
117942c5e3cSpl196000 
118942c5e3cSpl196000 /*
119942c5e3cSpl196000  * Options supported by the adapter
120942c5e3cSpl196000  */
121942c5e3cSpl196000 #define	AAC_SUPPORTED_SNAPSHOT			0x01
122942c5e3cSpl196000 #define	AAC_SUPPORTED_CLUSTERS			0x02
123942c5e3cSpl196000 #define	AAC_SUPPORTED_WRITE_CACHE		0x04
124942c5e3cSpl196000 #define	AAC_SUPPORTED_64BIT_DATA		0x08
125942c5e3cSpl196000 #define	AAC_SUPPORTED_HOST_TIME_FIB		0x10
126942c5e3cSpl196000 #define	AAC_SUPPORTED_RAID50			0x20
127942c5e3cSpl196000 #define	AAC_SUPPORTED_4GB_WINDOW		0x40
128942c5e3cSpl196000 #define	AAC_SUPPORTED_SCSI_UPGRADEABLE		0x80
129942c5e3cSpl196000 #define	AAC_SUPPORTED_SOFT_ERR_REPORT		0x100
130942c5e3cSpl196000 #define	AAC_SUPPORTED_NOT_RECONDITION		0x200
131942c5e3cSpl196000 #define	AAC_SUPPORTED_SGMAP_HOST64		0x400
132942c5e3cSpl196000 #define	AAC_SUPPORTED_ALARM			0x800
133942c5e3cSpl196000 #define	AAC_SUPPORTED_NONDASD			0x1000
134942c5e3cSpl196000 #define	AAC_SUPPORTED_SCSI_MANAGED		0x2000
135942c5e3cSpl196000 #define	AAC_SUPPORTED_RAID_SCSI_MODE		0x4000
136942c5e3cSpl196000 #define	AAC_SUPPORTED_SUPPLEMENT_ADAPTER_INFO	0x10000
137942c5e3cSpl196000 #define	AAC_SUPPORTED_NEW_COMM			0x20000
138942c5e3cSpl196000 #define	AAC_SUPPORTED_64BIT_ARRAYSIZE		0x40000
139942c5e3cSpl196000 #define	AAC_SUPPORTED_HEAT_SENSOR		0x80000
140942c5e3cSpl196000 
141b40e8a89Szhongyan gu - Sun Microsystems - Beijing China /*
142b40e8a89Szhongyan gu - Sun Microsystems - Beijing China  * More options from supplement info - SupportedOptions2
143b40e8a89Szhongyan gu - Sun Microsystems - Beijing China  */
144b40e8a89Szhongyan gu - Sun Microsystems - Beijing China #define	AAC_SUPPORTED_MU_RESET			0x01
145b40e8a89Szhongyan gu - Sun Microsystems - Beijing China #define	AAC_SUPPORTED_IGNORE_RESET		0x02
146b40e8a89Szhongyan gu - Sun Microsystems - Beijing China #define	AAC_SUPPORTED_POWER_MANAGEMENT		0x04
147b40e8a89Szhongyan gu - Sun Microsystems - Beijing China #define	AAC_SUPPORTED_ARCIO_PHYDEV		0x08
148*3fced439Szhongyan gu - Sun Microsystems - Beijing China /*
149*3fced439Szhongyan gu - Sun Microsystems - Beijing China  * FeatureBits of RequestSupplementAdapterInfo used in the driver
150*3fced439Szhongyan gu - Sun Microsystems - Beijing China  */
151*3fced439Szhongyan gu - Sun Microsystems - Beijing China #define	AAC_FEATURE_SUPPORTED_JBOD		0x08000000
152b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 
153942c5e3cSpl196000 #pragma	pack(1)
154942c5e3cSpl196000 
155942c5e3cSpl196000 /*
156942c5e3cSpl196000  * FIB (FSA Interface Block) this is the data structure passed between
157942c5e3cSpl196000  * the host and adapter.
158942c5e3cSpl196000  */
159942c5e3cSpl196000 struct aac_fib_header {
160942c5e3cSpl196000 	uint32_t	XferState;
161942c5e3cSpl196000 	uint16_t	Command;
162942c5e3cSpl196000 	uint8_t		StructType;
163942c5e3cSpl196000 	uint8_t		Flags;
164942c5e3cSpl196000 	uint16_t	Size;
165942c5e3cSpl196000 	uint16_t	SenderSize;
166942c5e3cSpl196000 	uint32_t	SenderFibAddress;
167942c5e3cSpl196000 	uint32_t	ReceiverFibAddress;
168942c5e3cSpl196000 	uint32_t	SenderData;
169942c5e3cSpl196000 	int prev;
170942c5e3cSpl196000 	int next;
171942c5e3cSpl196000 };
172942c5e3cSpl196000 
173942c5e3cSpl196000 /* FIB completed without error or no data was transferred in the FIB */
174942c5e3cSpl196000 #define	AAC_SENDERADDR_MASK_FAST_RESPONSE	0x01
175942c5e3cSpl196000 /* The received FIB is an AIF */
176942c5e3cSpl196000 #define	AAC_SENDERADDR_MASK_AIF			0x02
177942c5e3cSpl196000 
178942c5e3cSpl196000 #define	AAC_FIB_SIZE		512 /* size of a fib block in byte */
179942c5e3cSpl196000 #define	AAC_FIB_DATASIZE	(AAC_FIB_SIZE - sizeof (struct aac_fib_header))
180942c5e3cSpl196000 
181942c5e3cSpl196000 struct aac_fib {
182942c5e3cSpl196000 	struct aac_fib_header	Header;
183942c5e3cSpl196000 	uint8_t data[AAC_FIB_DATASIZE];
184942c5e3cSpl196000 };
185942c5e3cSpl196000 
186942c5e3cSpl196000 /* FIB transfer state */
187942c5e3cSpl196000 #define	AAC_FIBSTATE_HOSTOWNED		(1<<0)	/* owned by the host */
188942c5e3cSpl196000 #define	AAC_FIBSTATE_ADAPTEROWNED	(1<<1)	/* owned by the adapter */
189942c5e3cSpl196000 #define	AAC_FIBSTATE_INITIALISED	(1<<2)	/* has been initialised */
190942c5e3cSpl196000 #define	AAC_FIBSTATE_EMPTY		(1<<3)	/* is empty now */
191942c5e3cSpl196000 #define	AAC_FIBSTATE_FROMHOST		(1<<5)	/* sent from the host */
192942c5e3cSpl196000 #define	AAC_FIBSTATE_FROMADAP		(1<<6)	/* sent from the adapter */
193942c5e3cSpl196000 #define	AAC_FIBSTATE_REXPECTED		(1<<7)	/* response is expected */
194942c5e3cSpl196000 #define	AAC_FIBSTATE_NOREXPECTED	(1<<8)	/* no response is expected */
195942c5e3cSpl196000 #define	AAC_FIBSTATE_DONEADAP		(1<<9)	/* processed by the adapter */
196942c5e3cSpl196000 #define	AAC_FIBSTATE_DONEHOST		(1<<10)	/* processed by the host */
197942c5e3cSpl196000 #define	AAC_FIBSTATE_NORM		(1<<12)	/* normal priority */
198942c5e3cSpl196000 #define	AAC_FIBSTATE_ASYNC		(1<<13)
199942c5e3cSpl196000 #define	AAC_FIBSTATE_FAST_RESPONSE	(1<<19)	/* fast response capable */
200942c5e3cSpl196000 
201942c5e3cSpl196000 /* FIB types */
202942c5e3cSpl196000 #define	AAC_FIBTYPE_TFIB		1
203942c5e3cSpl196000 
204942c5e3cSpl196000 /*
205942c5e3cSpl196000  * FIB commands
206942c5e3cSpl196000  */
207942c5e3cSpl196000 
208942c5e3cSpl196000 #define	TestCommandResponse		1
209942c5e3cSpl196000 #define	TestAdapterCommand		2
210942c5e3cSpl196000 /* Lowlevel and comm commands */
211942c5e3cSpl196000 #define	LastTestCommand			100
212942c5e3cSpl196000 #define	ReinitHostNormCommandQueue	101
213942c5e3cSpl196000 #define	ReinitHostHighCommandQueue	102
214942c5e3cSpl196000 #define	ReinitHostHighRespQueue		103
215942c5e3cSpl196000 #define	ReinitHostNormRespQueue		104
216942c5e3cSpl196000 #define	ReinitAdapNormCommandQueue	105
217942c5e3cSpl196000 #define	ReinitAdapHighCommandQueue	107
218942c5e3cSpl196000 #define	ReinitAdapHighRespQueue		108
219942c5e3cSpl196000 #define	ReinitAdapNormRespQueue		109
220942c5e3cSpl196000 #define	InterfaceShutdown		110
221942c5e3cSpl196000 #define	DmaCommandFib			120
222942c5e3cSpl196000 #define	StartProfile			121
223942c5e3cSpl196000 #define	TermProfile			122
224942c5e3cSpl196000 #define	SpeedTest			123
225942c5e3cSpl196000 #define	TakeABreakPt			124
226942c5e3cSpl196000 #define	RequestPerfData			125
227942c5e3cSpl196000 #define	SetInterruptDefTimer		126
228942c5e3cSpl196000 #define	SetInterruptDefCount		127
229942c5e3cSpl196000 #define	GetInterruptDefStatus		128
230942c5e3cSpl196000 #define	LastCommCommand			129
231942c5e3cSpl196000 /* Filesystem commands */
232942c5e3cSpl196000 #define	NuFileSystem			300
233942c5e3cSpl196000 #define	UFS				301
234942c5e3cSpl196000 #define	HostFileSystem			302
235942c5e3cSpl196000 #define	LastFileSystemCommand		303
236942c5e3cSpl196000 /* Container commands */
237942c5e3cSpl196000 #define	ContainerCommand		500
238942c5e3cSpl196000 #define	ContainerCommand64		501
239942c5e3cSpl196000 #define	RawIo				502
240942c5e3cSpl196000 /* Cluster commands */
241942c5e3cSpl196000 #define	ClusterCommand			550
242942c5e3cSpl196000 /* Scsi Port commands (scsi passthrough) */
243942c5e3cSpl196000 #define	ScsiPortCommand			600
244942c5e3cSpl196000 #define	ScsiPortCommandU64		601
245942c5e3cSpl196000 /* Misc house keeping and generic adapter initiated commands */
246942c5e3cSpl196000 #define	AifRequest			700
247942c5e3cSpl196000 #define	CheckRevision			701
248942c5e3cSpl196000 #define	FsaHostShutdown			702
249942c5e3cSpl196000 #define	RequestAdapterInfo		703
250942c5e3cSpl196000 #define	IsAdapterPaused			704
251942c5e3cSpl196000 #define	SendHostTime			705
252942c5e3cSpl196000 #define	RequestSupplementAdapterInfo	706
253942c5e3cSpl196000 #define	LastMiscCommand			707
254942c5e3cSpl196000 #define	OnLineDiagnostic		800
255942c5e3cSpl196000 #define	FduAdapterTest			801
256942c5e3cSpl196000 
257942c5e3cSpl196000 /*
258942c5e3cSpl196000  * Revision number handling
259942c5e3cSpl196000  */
260942c5e3cSpl196000 struct FsaRev {
261942c5e3cSpl196000 	union {
262942c5e3cSpl196000 		struct {
263942c5e3cSpl196000 			uint8_t	dash;
264942c5e3cSpl196000 			uint8_t	type;
265942c5e3cSpl196000 			uint8_t	minor;
266942c5e3cSpl196000 			uint8_t	major;
267942c5e3cSpl196000 		} comp;
268942c5e3cSpl196000 		uint32_t ul;
269942c5e3cSpl196000 	} external;
270942c5e3cSpl196000 	uint32_t buildNumber;
271942c5e3cSpl196000 };
272942c5e3cSpl196000 
273942c5e3cSpl196000 /*
274942c5e3cSpl196000  * Structures used to respond to a RequestAdapterInfo FIB
275942c5e3cSpl196000  */
276942c5e3cSpl196000 struct aac_adapter_info {
277942c5e3cSpl196000 	uint32_t	PlatformBase;	/* adapter type */
278942c5e3cSpl196000 	uint32_t	CpuArchitecture; /* adapter CPU type */
279942c5e3cSpl196000 	uint32_t	CpuVariant;	/* adapter CPU subtype */
280942c5e3cSpl196000 	uint32_t	ClockSpeed;	/* adapter CPU clockspeed */
281942c5e3cSpl196000 	uint32_t	ExecutionMem;	/* adapter Execution Memory size */
282942c5e3cSpl196000 	uint32_t	BufferMem;	/* adapter Data Memory */
283942c5e3cSpl196000 	uint32_t	TotalMem;	/* adapter Total Memory */
284942c5e3cSpl196000 	struct FsaRev	KernelRevision;	/* adapter Kernel Software Revision */
285942c5e3cSpl196000 	struct FsaRev	MonitorRevision; /* adapter Monitor Software Revision */
286942c5e3cSpl196000 	struct FsaRev	HardwareRevision;
287942c5e3cSpl196000 	struct FsaRev	BIOSRevision;	/* adapter BIOS Revision */
288942c5e3cSpl196000 	uint32_t	ClusteringEnabled;
289942c5e3cSpl196000 	uint32_t	ClusterChannelMask;
290942c5e3cSpl196000 	uint64_t	SerialNumber;
291942c5e3cSpl196000 	uint32_t	batteryPlatform;
292942c5e3cSpl196000 	uint32_t	SupportedOptions; /* supported features */
293942c5e3cSpl196000 	uint32_t	OemVariant;
294942c5e3cSpl196000 };
295942c5e3cSpl196000 
296942c5e3cSpl196000 /*
297942c5e3cSpl196000  * The following definitions on Supplement Adapter Information
298942c5e3cSpl196000  * come from Adaptec:
299942c5e3cSpl196000  */
300942c5e3cSpl196000 struct vpd_info {
301942c5e3cSpl196000 	uint8_t		AssemblyPn[8];
302942c5e3cSpl196000 	uint8_t		FruPn[8];
303942c5e3cSpl196000 	uint8_t		BatteryFruPn[8];
304942c5e3cSpl196000 	uint8_t		EcVersionString[8];
305942c5e3cSpl196000 	uint8_t		Tsid[12];
306942c5e3cSpl196000 };
307942c5e3cSpl196000 
308942c5e3cSpl196000 #define	MFG_PCBA_SERIAL_NUMBER_WIDTH	12
309942c5e3cSpl196000 #define	MFG_WWN_WIDTH			8
310942c5e3cSpl196000 
311942c5e3cSpl196000 struct aac_supplement_adapter_info {
312942c5e3cSpl196000 	/* The assigned Adapter Type Text, extra byte for null termination */
313942c5e3cSpl196000 	int8_t		AdapterTypeText[17+1];
314942c5e3cSpl196000 	/* Pad for the text above */
315942c5e3cSpl196000 	int8_t		Pad[2];
316942c5e3cSpl196000 	/* Size in bytes of the memory that is flashed */
317942c5e3cSpl196000 	uint32_t	FlashMemoryByteSize;
318942c5e3cSpl196000 	/* The assigned IMAGEID_xxx for this adapter */
319942c5e3cSpl196000 	uint32_t	FlashImageId;
320942c5e3cSpl196000 	/*
321942c5e3cSpl196000 	 * The maximum number of Phys available on a SATA/SAS
322942c5e3cSpl196000 	 * Controller, 0 otherwise
323942c5e3cSpl196000 	 */
324942c5e3cSpl196000 	uint32_t	MaxNumberPorts;
325942c5e3cSpl196000 	/* Version of expansion area */
326942c5e3cSpl196000 	uint32_t	Version;
327942c5e3cSpl196000 	uint32_t	FeatureBits;
328942c5e3cSpl196000 	uint8_t		SlotNumber;
329942c5e3cSpl196000 	uint8_t		ReservedPad0[3];
330942c5e3cSpl196000 	uint8_t		BuildDate[12];
331942c5e3cSpl196000 	/* The current number of Ports on a SAS controller, 0 otherwise */
332942c5e3cSpl196000 	uint32_t	CurrentNumberPorts;
333942c5e3cSpl196000 
334942c5e3cSpl196000 	struct vpd_info VpdInfo;
335942c5e3cSpl196000 
336942c5e3cSpl196000 	/* Firmware Revision (Vmaj.min-dash.) */
337942c5e3cSpl196000 	struct FsaRev	FlashFirmwareRevision;
338942c5e3cSpl196000 	uint32_t	RaidTypeMorphOptions;
339942c5e3cSpl196000 	/* Firmware's boot code Revision (Vmaj.min-dash.) */
340942c5e3cSpl196000 	struct FsaRev	FlashFirmwareBootRevision;
341942c5e3cSpl196000 	/* PCBA serial no. from th MFG sector */
342942c5e3cSpl196000 	uint8_t		MfgPcbaSerialNo[MFG_PCBA_SERIAL_NUMBER_WIDTH];
343942c5e3cSpl196000 	/* WWN from the MFG sector */
344942c5e3cSpl196000 	uint8_t		MfgWWNName[MFG_WWN_WIDTH];
345b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 	uint32_t	SupportedOptions2;	/* more supported features */
346b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 	uint32_t	ExpansionFlag;	/* 1 - following fields are valid */
347b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 	uint32_t	FeatureBits3;
348b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 	uint32_t	SupportedPerformanceMode;
349b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 	/* Growth Area for future expansion */
350b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 	uint32_t	ReservedGrowth[80];
351942c5e3cSpl196000 };
352942c5e3cSpl196000 
353942c5e3cSpl196000 /* Container creation data */
354942c5e3cSpl196000 struct aac_container_creation {
355942c5e3cSpl196000 	uint8_t		ViaBuildNumber;
356942c5e3cSpl196000 	uint8_t		MicroSecond;
357942c5e3cSpl196000 	uint8_t		Via;		/* 1 = FSU, 2 = API, etc */
358942c5e3cSpl196000 	uint8_t		Years;		/* Since1900 */
359942c5e3cSpl196000 	uint32_t	Month:4;	/* 1-12 */
360942c5e3cSpl196000 	uint32_t	Day:6;		/* 1-32 */
361942c5e3cSpl196000 	uint32_t	Hour:6;		/* 0-23 */
362942c5e3cSpl196000 	uint32_t	Minute:6;	/* 0-59 */
363942c5e3cSpl196000 	uint32_t	Second:6;	/* 0-59 */
364942c5e3cSpl196000 	uint64_t	ViaAdapterSerialNumber;
365942c5e3cSpl196000 };
366942c5e3cSpl196000 
367942c5e3cSpl196000 struct aac_mntobj {
368942c5e3cSpl196000 	uint32_t		ObjectId;
369942c5e3cSpl196000 	char			FileSystemName[16];
370942c5e3cSpl196000 	struct aac_container_creation	CreateInfo;
371942c5e3cSpl196000 	uint32_t		Capacity;
372942c5e3cSpl196000 	uint32_t		VolType;
373942c5e3cSpl196000 	uint32_t		ObjType;
374942c5e3cSpl196000 	uint32_t		ContentState;
375942c5e3cSpl196000 	union {
376942c5e3cSpl196000 		uint32_t	pad[8];
377942c5e3cSpl196000 	} ObjExtension;
378942c5e3cSpl196000 	uint32_t		AlterEgoId;
379942c5e3cSpl196000 
380942c5e3cSpl196000 	uint32_t		CapacityHigh; /* 64-bit LBA */
381942c5e3cSpl196000 };
382942c5e3cSpl196000 
383942c5e3cSpl196000 struct aac_mntinfo {
384942c5e3cSpl196000 	uint32_t	Command;
385942c5e3cSpl196000 	uint32_t	MntType;
386942c5e3cSpl196000 	uint32_t	MntCount;
387942c5e3cSpl196000 };
388942c5e3cSpl196000 
389942c5e3cSpl196000 struct aac_mntinforesp {
390942c5e3cSpl196000 	uint32_t		Status;
391942c5e3cSpl196000 	uint32_t		MntType;
392942c5e3cSpl196000 	uint32_t		MntRespCount;
393942c5e3cSpl196000 	struct aac_mntobj	MntObj;
394942c5e3cSpl196000 };
395942c5e3cSpl196000 
39658bc78c7SXin Chen /*
39758bc78c7SXin Chen  * Structures used to access physical drives
39858bc78c7SXin Chen  */
39958bc78c7SXin Chen struct aac_bus_info {
40058bc78c7SXin Chen 	uint32_t	Command;	/* VM_Ioctl */
40158bc78c7SXin Chen 	uint32_t	ObjType;	/* FT_DRIVE */
40258bc78c7SXin Chen 	uint32_t	MethodId;	/* 1 = SCSI Layer */
40358bc78c7SXin Chen 	uint32_t	ObjectId;	/* Handle */
40458bc78c7SXin Chen 	uint32_t	CtlCmd;		/* GetBusInfo */
40558bc78c7SXin Chen };
40658bc78c7SXin Chen 
40758bc78c7SXin Chen struct aac_bus_info_response {
40858bc78c7SXin Chen 	uint32_t	Status;		/* ST_OK */
40958bc78c7SXin Chen 	uint32_t	ObjType;
41058bc78c7SXin Chen 	uint32_t	MethodId;	/* unused */
41158bc78c7SXin Chen 	uint32_t	ObjectId;	/* unused */
41258bc78c7SXin Chen 	uint32_t	CtlCmd;		/* unused */
41358bc78c7SXin Chen 	uint32_t	ProbeComplete;
41458bc78c7SXin Chen 	uint32_t	BusCount;
41558bc78c7SXin Chen 	uint32_t	TargetsPerBus;
41658bc78c7SXin Chen 	uint8_t		InitiatorBusId[10];
41758bc78c7SXin Chen 	uint8_t		BusValid[10];
41858bc78c7SXin Chen };
41958bc78c7SXin Chen 
420942c5e3cSpl196000 #define	CT_FIB_PARAMS			6
421942c5e3cSpl196000 #define	MAX_FIB_PARAMS			10
422942c5e3cSpl196000 #define	CT_PACKET_SIZE \
423942c5e3cSpl196000 	(AAC_FIB_DATASIZE - sizeof (uint32_t) - \
424942c5e3cSpl196000 	((sizeof (uint32_t)) * (MAX_FIB_PARAMS + 1)))
425942c5e3cSpl196000 
426942c5e3cSpl196000 #define	CNT_SIZE			5
427942c5e3cSpl196000 
428942c5e3cSpl196000 /* Container types */
429942c5e3cSpl196000 typedef enum {
430942c5e3cSpl196000 	CT_NONE = 0,
431942c5e3cSpl196000 	CT_VOLUME,
432942c5e3cSpl196000 	CT_MIRROR,
433942c5e3cSpl196000 	CT_STRIPE,
434942c5e3cSpl196000 	CT_RAID5,
435942c5e3cSpl196000 	CT_SSRW,
436942c5e3cSpl196000 	CT_SSRO,
437942c5e3cSpl196000 	CT_MORPH,
438942c5e3cSpl196000 	CT_PASSTHRU,
439942c5e3cSpl196000 	CT_RAID4,
440942c5e3cSpl196000 	CT_RAID10,		/* stripe of mirror */
441942c5e3cSpl196000 	CT_RAID00,		/* stripe of stripe */
442942c5e3cSpl196000 	CT_VOLUME_OF_MIRRORS,	/* volume of mirror */
443942c5e3cSpl196000 	CT_PSEUDO_RAID3,	/* really raid4 */
444942c5e3cSpl196000 	CT_RAID50,		/* stripe of raid5 */
445942c5e3cSpl196000 	CT_RAID5D,		/* raid5 distributed hot-sparing */
446942c5e3cSpl196000 	CT_RAID5D0,
447942c5e3cSpl196000 	CT_RAID1E,		/* extended raid1 mirroring */
448942c5e3cSpl196000 	CT_RAID6,
449942c5e3cSpl196000 	CT_RAID60
450942c5e3cSpl196000 } AAC_FSAVolType;
451942c5e3cSpl196000 
452942c5e3cSpl196000 /*
453942c5e3cSpl196000  * Container Configuration Sub-Commands
454942c5e3cSpl196000  */
455942c5e3cSpl196000 typedef enum {
456942c5e3cSpl196000 	CT_Null = 0,
457942c5e3cSpl196000 	CT_GET_SLICE_COUNT,		/* 1 */
458942c5e3cSpl196000 	CT_GET_PARTITION_COUNT,		/* 2 */
459942c5e3cSpl196000 	CT_GET_PARTITION_INFO,		/* 3 */
460942c5e3cSpl196000 	CT_GET_CONTAINER_COUNT,		/* 4 */
461942c5e3cSpl196000 	CT_GET_CONTAINER_INFO_OLD,	/* 5 */
462942c5e3cSpl196000 	CT_WRITE_MBR,			/* 6 */
463942c5e3cSpl196000 	CT_WRITE_PARTITION,		/* 7 */
464942c5e3cSpl196000 	CT_UPDATE_PARTITION,		/* 8 */
465942c5e3cSpl196000 	CT_UNLOAD_CONTAINER,		/* 9 */
466942c5e3cSpl196000 	CT_CONFIG_SINGLE_PRIMARY,	/* 10 */
467942c5e3cSpl196000 	CT_READ_CONFIG_AGE,		/* 11 */
468942c5e3cSpl196000 	CT_WRITE_CONFIG_AGE,		/* 12 */
469942c5e3cSpl196000 	CT_READ_SERIAL_NUMBER,		/* 13 */
470942c5e3cSpl196000 	CT_ZERO_PAR_ENTRY,		/* 14 */
471942c5e3cSpl196000 	CT_READ_MBR,			/* 15 */
472942c5e3cSpl196000 	CT_READ_PARTITION,		/* 16 */
473942c5e3cSpl196000 	CT_DESTROY_CONTAINER,		/* 17 */
474942c5e3cSpl196000 	CT_DESTROY2_CONTAINER,		/* 18 */
475942c5e3cSpl196000 	CT_SLICE_SIZE,			/* 19 */
476942c5e3cSpl196000 	CT_CHECK_CONFLICTS,		/* 20 */
477942c5e3cSpl196000 	CT_MOVE_CONTAINER,		/* 21 */
478942c5e3cSpl196000 	CT_READ_LAST_DRIVE,		/* 22 */
479942c5e3cSpl196000 	CT_WRITE_LAST_DRIVE,		/* 23 */
480942c5e3cSpl196000 	CT_UNMIRROR,			/* 24 */
481942c5e3cSpl196000 	CT_MIRROR_DELAY,		/* 25 */
482942c5e3cSpl196000 	CT_GEN_MIRROR,			/* 26 */
483942c5e3cSpl196000 	CT_GEN_MIRROR2,			/* 27 */
484942c5e3cSpl196000 	CT_TEST_CONTAINER,		/* 28 */
485942c5e3cSpl196000 	CT_MOVE2,			/* 29 */
486942c5e3cSpl196000 	CT_SPLIT,			/* 30 */
487942c5e3cSpl196000 	CT_SPLIT2,			/* 31 */
488942c5e3cSpl196000 	CT_SPLIT_BROKEN,		/* 32 */
489942c5e3cSpl196000 	CT_SPLIT_BROKEN2,		/* 33 */
490942c5e3cSpl196000 	CT_RECONFIG,			/* 34 */
491942c5e3cSpl196000 	CT_BREAK2,			/* 35 */
492942c5e3cSpl196000 	CT_BREAK,			/* 36 */
493942c5e3cSpl196000 	CT_MERGE2,			/* 37 */
494942c5e3cSpl196000 	CT_MERGE,			/* 38 */
495942c5e3cSpl196000 	CT_FORCE_ERROR,			/* 39 */
496942c5e3cSpl196000 	CT_CLEAR_ERROR,			/* 40 */
497942c5e3cSpl196000 	CT_ASSIGN_FAILOVER,		/* 41 */
498942c5e3cSpl196000 	CT_CLEAR_FAILOVER,		/* 42 */
499942c5e3cSpl196000 	CT_GET_FAILOVER_DATA,		/* 43 */
500942c5e3cSpl196000 	CT_VOLUME_ADD,			/* 44 */
501942c5e3cSpl196000 	CT_VOLUME_ADD2,			/* 45 */
502942c5e3cSpl196000 	CT_MIRROR_STATUS,		/* 46 */
503942c5e3cSpl196000 	CT_COPY_STATUS,			/* 47 */
504942c5e3cSpl196000 	CT_COPY,			/* 48 */
505942c5e3cSpl196000 	CT_UNLOCK_CONTAINER,		/* 49 */
506942c5e3cSpl196000 	CT_LOCK_CONTAINER,		/* 50 */
507942c5e3cSpl196000 	CT_MAKE_READ_ONLY,		/* 51 */
508942c5e3cSpl196000 	CT_MAKE_READ_WRITE,		/* 52 */
509942c5e3cSpl196000 	CT_CLEAN_DEAD,			/* 53 */
510942c5e3cSpl196000 	CT_ABORT_MIRROR_COMMAND,	/* 54 */
511942c5e3cSpl196000 	CT_SET,				/* 55 */
512942c5e3cSpl196000 	CT_GET,				/* 56 */
513942c5e3cSpl196000 	CT_GET_NVLOG_ENTRY,		/* 57 */
514942c5e3cSpl196000 	CT_GET_DELAY,			/* 58 */
515942c5e3cSpl196000 	CT_ZERO_CONTAINER_SPACE,	/* 59 */
516942c5e3cSpl196000 	CT_GET_ZERO_STATUS,		/* 60 */
517942c5e3cSpl196000 	CT_SCRUB,			/* 61 */
518942c5e3cSpl196000 	CT_GET_SCRUB_STATUS,		/* 62 */
519942c5e3cSpl196000 	CT_GET_SLICE_INFO,		/* 63 */
520942c5e3cSpl196000 	CT_GET_SCSI_METHOD,		/* 64 */
521942c5e3cSpl196000 	CT_PAUSE_IO,			/* 65 */
522942c5e3cSpl196000 	CT_RELEASE_IO,			/* 66 */
523942c5e3cSpl196000 	CT_SCRUB2,			/* 67 */
524942c5e3cSpl196000 	CT_MCHECK,			/* 68 */
525942c5e3cSpl196000 	CT_CORRUPT,			/* 69 */
526942c5e3cSpl196000 	CT_GET_TASK_COUNT,		/* 70 */
527942c5e3cSpl196000 	CT_PROMOTE,			/* 71 */
528942c5e3cSpl196000 	CT_SET_DEAD,			/* 72 */
529942c5e3cSpl196000 	CT_CONTAINER_OPTIONS,		/* 73 */
530942c5e3cSpl196000 	CT_GET_NV_PARAM,		/* 74 */
531942c5e3cSpl196000 	CT_GET_PARAM,			/* 75 */
532942c5e3cSpl196000 	CT_NV_PARAM_SIZE,		/* 76 */
533942c5e3cSpl196000 	CT_COMMON_PARAM_SIZE,		/* 77 */
534942c5e3cSpl196000 	CT_PLATFORM_PARAM_SIZE,		/* 78 */
535942c5e3cSpl196000 	CT_SET_NV_PARAM,		/* 79 */
536942c5e3cSpl196000 	CT_ABORT_SCRUB,			/* 80 */
537942c5e3cSpl196000 	CT_GET_SCRUB_ERROR,		/* 81 */
538942c5e3cSpl196000 	CT_LABEL_CONTAINER,		/* 82 */
539942c5e3cSpl196000 	CT_CONTINUE_DATA,		/* 83 */
540942c5e3cSpl196000 	CT_STOP_DATA,			/* 84 */
541942c5e3cSpl196000 	CT_GET_PARTITION_TABLE,		/* 85 */
542942c5e3cSpl196000 	CT_GET_DISK_PARTITIONS,		/* 86 */
543942c5e3cSpl196000 	CT_GET_MISC_STATUS,		/* 87 */
544942c5e3cSpl196000 	CT_GET_CONTAINER_PERF_INFO,	/* 88 */
545942c5e3cSpl196000 	CT_GET_TIME,			/* 89 */
546942c5e3cSpl196000 	CT_READ_DATA,			/* 90 */
547942c5e3cSpl196000 	CT_CTR,				/* 91 */
548942c5e3cSpl196000 	CT_CTL,				/* 92 */
549942c5e3cSpl196000 	CT_DRAINIO,			/* 93 */
550942c5e3cSpl196000 	CT_RELEASEIO,			/* 94 */
551942c5e3cSpl196000 	CT_GET_NVRAM,			/* 95 */
552942c5e3cSpl196000 	CT_GET_MEMORY,			/* 96 */
553942c5e3cSpl196000 	CT_PRINT_CT_LOG,		/* 97 */
554942c5e3cSpl196000 	CT_ADD_LEVEL,			/* 98 */
555942c5e3cSpl196000 	CT_NV_ZERO,			/* 99 */
556942c5e3cSpl196000 	CT_READ_SIGNATURE,		/* 100 */
557942c5e3cSpl196000 	CT_THROTTLE_ON,			/* 101 */
558942c5e3cSpl196000 	CT_THROTTLE_OFF,		/* 102 */
559942c5e3cSpl196000 	CT_GET_THROTTLE_STATS,		/* 103 */
560942c5e3cSpl196000 	CT_MAKE_SNAPSHOT,		/* 104 */
561942c5e3cSpl196000 	CT_REMOVE_SNAPSHOT,		/* 105 */
562942c5e3cSpl196000 	CT_WRITE_USER_FLAGS,		/* 106 */
563942c5e3cSpl196000 	CT_READ_USER_FLAGS,		/* 107 */
564942c5e3cSpl196000 	CT_MONITOR,			/* 108 */
565942c5e3cSpl196000 	CT_GEN_MORPH,			/* 109 */
566942c5e3cSpl196000 	CT_GET_SNAPSHOT_INFO,		/* 110 */
567942c5e3cSpl196000 	CT_CACHE_SET,			/* 111 */
568942c5e3cSpl196000 	CT_CACHE_STAT,			/* 112 */
569942c5e3cSpl196000 	CT_TRACE_START,			/* 113 */
570942c5e3cSpl196000 	CT_TRACE_STOP,			/* 114 */
571942c5e3cSpl196000 	CT_TRACE_ENABLE,		/* 115 */
572942c5e3cSpl196000 	CT_TRACE_DISABLE,		/* 116 */
573942c5e3cSpl196000 	CT_FORCE_CORE_DUMP,		/* 117 */
574942c5e3cSpl196000 	CT_SET_SERIAL_NUMBER,		/* 118 */
575942c5e3cSpl196000 	CT_RESET_SERIAL_NUMBER,		/* 119 */
576942c5e3cSpl196000 	CT_ENABLE_RAID5,		/* 120 */
577942c5e3cSpl196000 	CT_CLEAR_VALID_DUMP_FLAG,	/* 121 */
578942c5e3cSpl196000 	CT_GET_MEM_STATS,		/* 122 */
579942c5e3cSpl196000 	CT_GET_CORE_SIZE,		/* 123 */
580942c5e3cSpl196000 	CT_CREATE_CONTAINER_OLD,	/* 124 */
581942c5e3cSpl196000 	CT_STOP_DUMPS,			/* 125 */
582942c5e3cSpl196000 	CT_PANIC_ON_TAKE_A_BREAK,	/* 126 */
583942c5e3cSpl196000 	CT_GET_CACHE_STATS,		/* 127 */
584942c5e3cSpl196000 	CT_MOVE_PARTITION,		/* 128 */
585942c5e3cSpl196000 	CT_FLUSH_CACHE,			/* 129 */
586942c5e3cSpl196000 	CT_READ_NAME,			/* 130 */
587942c5e3cSpl196000 	CT_WRITE_NAME,			/* 131 */
588942c5e3cSpl196000 	CT_TOSS_CACHE,			/* 132 */
589942c5e3cSpl196000 	CT_LOCK_DRAINIO,		/* 133 */
590942c5e3cSpl196000 	CT_CONTAINER_OFFLINE,		/* 134 */
591942c5e3cSpl196000 	CT_SET_CACHE_SIZE,		/* 135 */
592942c5e3cSpl196000 	CT_CLEAN_SHUTDOWN_STATUS,	/* 136 */
593942c5e3cSpl196000 	CT_CLEAR_DISKLOG_ON_DISK,	/* 137 */
594942c5e3cSpl196000 	CT_CLEAR_ALL_DISKLOG,		/* 138 */
595942c5e3cSpl196000 	CT_CACHE_FAVOR,			/* 139 */
596942c5e3cSpl196000 	CT_READ_PASSTHRU_MBR,		/* 140 */
597942c5e3cSpl196000 	CT_SCRUB_NOFIX,			/* 141 */
598942c5e3cSpl196000 	CT_SCRUB2_NOFIX,		/* 142 */
599942c5e3cSpl196000 	CT_FLUSH,			/* 143 */
600942c5e3cSpl196000 	CT_REBUILD,	/* 144 rma, not really a command, partner to CT_SCRUB */
601942c5e3cSpl196000 	CT_FLUSH_CONTAINER,		/* 145 */
602942c5e3cSpl196000 	CT_RESTART,			/* 146 */
603942c5e3cSpl196000 	CT_GET_CONFIG_STATUS,		/* 147 */
604942c5e3cSpl196000 	CT_TRACE_FLAG,			/* 148 */
605942c5e3cSpl196000 	CT_RESTART_MORPH,		/* 149 */
606942c5e3cSpl196000 	CT_GET_TRACE_INFO,		/* 150 */
607942c5e3cSpl196000 	CT_GET_TRACE_ITEM,		/* 151 */
608942c5e3cSpl196000 	CT_COMMIT_CONFIG,		/* 152 */
609942c5e3cSpl196000 	CT_CONTAINER_EXISTS,		/* 153 */
610942c5e3cSpl196000 	CT_GET_SLICE_FROM_DEVT,		/* 154 */
611942c5e3cSpl196000 	CT_OPEN_READ_WRITE,		/* 155 */
612942c5e3cSpl196000 	CT_WRITE_MEMORY_BLOCK,		/* 156 */
613942c5e3cSpl196000 	CT_GET_CACHE_PARAMS,		/* 157 */
614942c5e3cSpl196000 	CT_CRAZY_CACHE,			/* 158 */
615942c5e3cSpl196000 	CT_GET_PROFILE_STRUCT,		/* 159 */
616942c5e3cSpl196000 	CT_SET_IO_TRACE_FLAG,		/* 160 */
617942c5e3cSpl196000 	CT_GET_IO_TRACE_STRUCT,		/* 161 */
618942c5e3cSpl196000 	CT_CID_TO_64BITS_UID,		/* 162 */
619942c5e3cSpl196000 	CT_64BITS_UID_TO_CID,		/* 163 */
620942c5e3cSpl196000 	CT_PAR_TO_64BITS_UID,		/* 164 */
621942c5e3cSpl196000 	CT_CID_TO_32BITS_UID,		/* 165 */
622942c5e3cSpl196000 	CT_32BITS_UID_TO_CID,		/* 166 */
623942c5e3cSpl196000 	CT_PAR_TO_32BITS_UID,		/* 167 */
624942c5e3cSpl196000 	CT_SET_FAILOVER_OPTION,		/* 168 */
625942c5e3cSpl196000 	CT_GET_FAILOVER_OPTION,		/* 169 */
626942c5e3cSpl196000 	CT_STRIPE_ADD2,			/* 170 */
627942c5e3cSpl196000 	CT_CREATE_VOLUME_SET,		/* 171 */
628942c5e3cSpl196000 	CT_CREATE_STRIPE_SET,		/* 172 */
629942c5e3cSpl196000 	/* 173	command and partner to scrub and rebuild task types */
630942c5e3cSpl196000 	CT_VERIFY_CONTAINER,
631942c5e3cSpl196000 	CT_IS_CONTAINER_DEAD,		/* 174 */
632942c5e3cSpl196000 	CT_GET_CONTAINER_OPTION,	/* 175 */
633942c5e3cSpl196000 	CT_GET_SNAPSHOT_UNUSED_STRUCT,	/* 176 */
634942c5e3cSpl196000 	CT_CLEAR_SNAPSHOT_UNUSED_STRUCT,	/* 177 */
635942c5e3cSpl196000 	CT_GET_CONTAINER_INFO,		/* 178 */
636942c5e3cSpl196000 	CT_CREATE_CONTAINER,		/* 179 */
637942c5e3cSpl196000 	CT_CHANGE_CREATIONINFO,		/* 180 */
638942c5e3cSpl196000 	CT_CHECK_CONFLICT_UID,		/* 181 */
639942c5e3cSpl196000 	CT_CONTAINER_UID_CHECK,		/* 182 */
640942c5e3cSpl196000 
641942c5e3cSpl196000 	/* 183 :RECmm: 20011220 added to support the Babylon */
642942c5e3cSpl196000 	CT_IS_CONTAINER_MEATADATA_STANDARD,
643942c5e3cSpl196000 	/* 184 :RECmm: 20011220 array imports */
644942c5e3cSpl196000 	CT_IS_SLICE_METADATA_STANDARD,
645942c5e3cSpl196000 
646942c5e3cSpl196000 	/* :BIOS_TEST: */
647942c5e3cSpl196000 	/* 185 :RECmm: 20020116	added to support BIOS interface for */
648942c5e3cSpl196000 	CT_GET_IMPORT_COUNT,
649942c5e3cSpl196000 	/* 186 :RECmm: 20020116	metadata conversion */
650942c5e3cSpl196000 	CT_CANCEL_ALL_IMPORTS,
651942c5e3cSpl196000 	CT_GET_IMPORT_INFO,		/* 187 :RECmm: 20020116	" */
652942c5e3cSpl196000 	CT_IMPORT_ARRAY,		/* 188 :RECmm: 20020116	" */
653942c5e3cSpl196000 	CT_GET_LOG_SIZE,		/* 189  */
654942c5e3cSpl196000 
655942c5e3cSpl196000 	/* Not BIOS TEST */
656942c5e3cSpl196000 	CT_ALARM_GET_STATE,		/* 190 */
657942c5e3cSpl196000 	CT_ALARM_SET_STATE,		/* 191 */
658942c5e3cSpl196000 	CT_ALARM_ON_OFF,		/* 192 */
659942c5e3cSpl196000 
660942c5e3cSpl196000 	CT_GET_EE_OEM_ID,		/* 193 */
661942c5e3cSpl196000 
662942c5e3cSpl196000 	CT_GET_PPI_HEADERS,		/* 194  get header fields only */
663942c5e3cSpl196000 	CT_GET_PPI_DATA,		/* 195  get all ppitable.data */
664942c5e3cSpl196000 	/* 196  get only range of entries specified in c_params */
665942c5e3cSpl196000 	CT_GET_PPI_ENTRIES,
666942c5e3cSpl196000 	/* 197  remove ppitable bundle specified by uid in c_param0 */
667942c5e3cSpl196000 	CT_DELETE_PPI_BUNDLE,
668942c5e3cSpl196000 
669942c5e3cSpl196000 	/* 198  current partition structure (not legacy) */
670942c5e3cSpl196000 	CT_GET_PARTITION_TABLE_2,
671942c5e3cSpl196000 	CT_GET_PARTITION_INFO_2,
672942c5e3cSpl196000 	CT_GET_DISK_PARTITIONS_2,
673942c5e3cSpl196000 
674942c5e3cSpl196000 	CT_QUIESCE_ADAPTER,		/* 201  chill dude */
675942c5e3cSpl196000 	CT_CLEAR_PPI_TABLE,		/* 202  clear ppi table */
676942c5e3cSpl196000 
677942c5e3cSpl196000 	CT_SET_DEVICE_CACHE_POLICY,	/* 203 */
678942c5e3cSpl196000 	CT_GET_DEVICE_CACHE_POLICY,	/* 204 */
679942c5e3cSpl196000 
680942c5e3cSpl196000 	CT_SET_VERIFY_DELAY,		/* 205 */
681942c5e3cSpl196000 	CT_GET_VERIFY_DELAY,		/* 206 */
682942c5e3cSpl196000 
683942c5e3cSpl196000 	/* 207 delete all PPI bundles that have an entry for device at devt */
684942c5e3cSpl196000 	CT_DELETE_PPI_BUNDLES_FOR_DEVT,
685942c5e3cSpl196000 
686942c5e3cSpl196000 	CT_READ_SW_SECTOR,		/* 208 */
687942c5e3cSpl196000 	CT_WRITE_SW_SECTOR,		/* 209 */
688942c5e3cSpl196000 
689942c5e3cSpl196000 	/* 210 added to support firmware cache sync operations */
690942c5e3cSpl196000 	CT_GET_CACHE_SYNC_INFO,
691942c5e3cSpl196000 	CT_SET_CACHE_SYNC_MODE,		/* 211 */
692b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 	CT_PM_DRIVER_SUPPORT,		/* 212 */
693b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 	CT_PM_CONFIGURATION,		/* 213 */
694942c5e3cSpl196000 
695942c5e3cSpl196000 	CT_LAST_COMMAND			/* last command */
696942c5e3cSpl196000 } AAC_CTCommand;
697942c5e3cSpl196000 
698942c5e3cSpl196000 /* General return status */
699942c5e3cSpl196000 #define	CT_OK				218
700942c5e3cSpl196000 
701b40e8a89Szhongyan gu - Sun Microsystems - Beijing China /* CT_PM_DRIVER_SUPPORT parameter */
702b40e8a89Szhongyan gu - Sun Microsystems - Beijing China typedef enum {
703b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 	AAC_PM_DRIVERSUP_GET_STATUS = 1,
704b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 	AAC_PM_DRIVERSUP_START_UNIT,
705b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 	AAC_PM_DRIVERSUP_STOP_UNIT
706b40e8a89Szhongyan gu - Sun Microsystems - Beijing China } AAC_CT_PM_DRIVER_SUPPORT_SUB_COM;
707b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 
708942c5e3cSpl196000 struct aac_fsa_ctm {
709942c5e3cSpl196000 	uint32_t	command;
710942c5e3cSpl196000 	uint32_t	param[CT_FIB_PARAMS];
711942c5e3cSpl196000 	int8_t		data[CT_PACKET_SIZE];
712942c5e3cSpl196000 };
713942c5e3cSpl196000 
714942c5e3cSpl196000 struct aac_Container {
715942c5e3cSpl196000 	uint32_t		Command;
716942c5e3cSpl196000 	struct aac_fsa_ctm	CTCommand;
717942c5e3cSpl196000 };
718942c5e3cSpl196000 
719942c5e3cSpl196000 struct aac_fsa_ctr {
720942c5e3cSpl196000 	uint32_t	response;
721942c5e3cSpl196000 	uint32_t	param[CT_FIB_PARAMS];
722942c5e3cSpl196000 	int8_t		data[CT_PACKET_SIZE];
723942c5e3cSpl196000 };
724942c5e3cSpl196000 
725942c5e3cSpl196000 struct aac_Container_resp {
726942c5e3cSpl196000 	uint32_t		Status;
727942c5e3cSpl196000 	struct aac_fsa_ctr	CTResponse;
728942c5e3cSpl196000 };
729942c5e3cSpl196000 
730942c5e3cSpl196000 struct aac_cf_status_header {
731942c5e3cSpl196000 	uint32_t	action;
732942c5e3cSpl196000 	uint16_t	flags;
733942c5e3cSpl196000 	int16_t		recordcount;
734942c5e3cSpl196000 };
735942c5e3cSpl196000 
736942c5e3cSpl196000 enum aac_cf_action_type {
737942c5e3cSpl196000 	CFACT_CONTINUE = 0,		/* Continue without pause */
738942c5e3cSpl196000 	CFACT_PAUSE,			/* Pause, then continue */
739942c5e3cSpl196000 	CFACT_ABORT			/* Abort */
740942c5e3cSpl196000 };
741942c5e3cSpl196000 
742942c5e3cSpl196000 enum aac_mpe {
743942c5e3cSpl196000 	AACMPE_OK = 0x0,
744942c5e3cSpl196000 	AACMPE_GET_CONFIG_STATUS = 0x1,
745942c5e3cSpl196000 	AACMPE_CONFIG_STATUS = 0x2,
746942c5e3cSpl196000 	AACMPE_COMMIT_CONFIG = 0x3
747942c5e3cSpl196000 };
748942c5e3cSpl196000 
749942c5e3cSpl196000 /*
750942c5e3cSpl196000  * CT_PAUSE_IO is immediate minimal runtime command that is used
751942c5e3cSpl196000  * to restart the applications and cache.
752942c5e3cSpl196000  */
753942c5e3cSpl196000 struct aac_pause_command {
754942c5e3cSpl196000 	uint32_t	Command;
755942c5e3cSpl196000 	uint32_t	Type;
756942c5e3cSpl196000 	uint32_t	Timeout;
757942c5e3cSpl196000 	uint32_t	Min;
758942c5e3cSpl196000 	uint32_t	NoRescan;
759942c5e3cSpl196000 	uint32_t	Parm3;
760942c5e3cSpl196000 	uint32_t	Parm4;
761942c5e3cSpl196000 	uint32_t	Count;
762942c5e3cSpl196000 };
763942c5e3cSpl196000 
764942c5e3cSpl196000 /*
765942c5e3cSpl196000  * The following two definitions come from Adaptec:
766942c5e3cSpl196000  *
767942c5e3cSpl196000  * Used to flush drive cache for container "cid"
768942c5e3cSpl196000  */
769942c5e3cSpl196000 struct aac_synchronize_command {
770942c5e3cSpl196000 	uint32_t	Command;	/* VM_ContainerConfig */
771942c5e3cSpl196000 	uint32_t	Type;		/* CT_FLUSH_CACHE */
772942c5e3cSpl196000 	uint32_t	Cid;
773942c5e3cSpl196000 	uint32_t	Parm1;
774942c5e3cSpl196000 	uint32_t	Parm2;
775942c5e3cSpl196000 	uint32_t	Parm3;
776942c5e3cSpl196000 	uint32_t	Parm4;
777942c5e3cSpl196000 	uint32_t	Count;
778942c5e3cSpl196000 };
779942c5e3cSpl196000 
780942c5e3cSpl196000 struct aac_synchronize_reply {
781942c5e3cSpl196000 	uint32_t	Dummy0;
782942c5e3cSpl196000 	uint32_t	Dummy1;
783942c5e3cSpl196000 	uint32_t	Status;
784942c5e3cSpl196000 	uint32_t	Parm1;
785942c5e3cSpl196000 	uint32_t	Parm2;
786942c5e3cSpl196000 	uint32_t	Parm3;
787942c5e3cSpl196000 	uint32_t	Parm4;
788942c5e3cSpl196000 	uint32_t	Parm5;
789942c5e3cSpl196000 	uint8_t		Data[16];
790942c5e3cSpl196000 };
791942c5e3cSpl196000 
792942c5e3cSpl196000 /*
793942c5e3cSpl196000  * Command status values
794942c5e3cSpl196000  */
795942c5e3cSpl196000 typedef enum {
796942c5e3cSpl196000 	ST_OK = 0,
797942c5e3cSpl196000 	ST_PERM = 1,
798942c5e3cSpl196000 	ST_NOENT = 2,
799942c5e3cSpl196000 	ST_IO = 5,
800942c5e3cSpl196000 	ST_NXIO = 6,
801942c5e3cSpl196000 	ST_E2BIG = 7,
802942c5e3cSpl196000 	ST_ACCES = 13,
803942c5e3cSpl196000 	ST_EXIST = 17,
804942c5e3cSpl196000 	ST_XDEV = 18,
805942c5e3cSpl196000 	ST_NODEV = 19,
806942c5e3cSpl196000 	ST_NOTDIR = 20,
807942c5e3cSpl196000 	ST_ISDIR = 21,
808942c5e3cSpl196000 	ST_INVAL = 22,
809942c5e3cSpl196000 	ST_FBIG = 27,
810942c5e3cSpl196000 	ST_NOSPC = 28,
811942c5e3cSpl196000 	ST_ROFS = 30,
812942c5e3cSpl196000 	ST_MLINK = 31,
813942c5e3cSpl196000 	ST_WOULDBLOCK = 35,
814942c5e3cSpl196000 	ST_NAMETOOLONG = 63,
815942c5e3cSpl196000 	ST_NOTEMPTY = 66,
816942c5e3cSpl196000 	ST_DQUOT = 69,
817942c5e3cSpl196000 	ST_STALE = 70,
818942c5e3cSpl196000 	ST_REMOTE = 71,
819942c5e3cSpl196000 	ST_BADHANDLE = 10001,
820942c5e3cSpl196000 	ST_NOT_SYNC = 10002,
821942c5e3cSpl196000 	ST_BAD_COOKIE = 10003,
822942c5e3cSpl196000 	ST_NOTSUPP = 10004,
823942c5e3cSpl196000 	ST_TOOSMALL = 10005,
824942c5e3cSpl196000 	ST_SERVERFAULT = 10006,
825942c5e3cSpl196000 	ST_BADTYPE = 10007,
826942c5e3cSpl196000 	ST_JUKEBOX = 10008,
827942c5e3cSpl196000 	ST_NOTMOUNTED = 10009,
828942c5e3cSpl196000 	ST_MAINTMODE = 10010,
829942c5e3cSpl196000 	ST_STALEACL = 10011
830942c5e3cSpl196000 } AAC_FSAStatus;
831942c5e3cSpl196000 
832942c5e3cSpl196000 /*
833942c5e3cSpl196000  * Object-Server / Volume-Manager Dispatch Classes
834942c5e3cSpl196000  */
835942c5e3cSpl196000 typedef enum {
836942c5e3cSpl196000 	VM_Null = 0,
837942c5e3cSpl196000 	VM_NameServe,
838942c5e3cSpl196000 	VM_ContainerConfig,
839942c5e3cSpl196000 	VM_Ioctl,
840942c5e3cSpl196000 	VM_FilesystemIoctl,
841942c5e3cSpl196000 	VM_CloseAll,
842942c5e3cSpl196000 	VM_CtBlockRead,
843942c5e3cSpl196000 	VM_CtBlockWrite,
844942c5e3cSpl196000 	VM_SliceBlockRead,	/* raw access to configured "storage objects" */
845942c5e3cSpl196000 	VM_SliceBlockWrite,
846942c5e3cSpl196000 	VM_DriveBlockRead,	/* raw access to physical devices */
847942c5e3cSpl196000 	VM_DriveBlockWrite,
848942c5e3cSpl196000 	VM_EnclosureMgt,	/* enclosure management */
849942c5e3cSpl196000 	VM_Unused,		/* used to be diskset management */
850942c5e3cSpl196000 	VM_CtBlockVerify,
851942c5e3cSpl196000 	VM_CtPerf,		/* performance test */
852942c5e3cSpl196000 	VM_CtBlockRead64,
853942c5e3cSpl196000 	VM_CtBlockWrite64,
854942c5e3cSpl196000 	VM_CtBlockVerify64,
855942c5e3cSpl196000 	VM_CtHostRead64,
856942c5e3cSpl196000 	VM_CtHostWrite64,
857942c5e3cSpl196000 	VM_NameServe64 = 22,
858942c5e3cSpl196000 	MAX_VMCOMMAND_NUM	/* used for sizing stats array - leave last */
859942c5e3cSpl196000 } AAC_VMCommand;
860942c5e3cSpl196000 
861942c5e3cSpl196000 /*
862942c5e3cSpl196000  * Host-addressable object types
863942c5e3cSpl196000  */
864942c5e3cSpl196000 typedef enum {
865942c5e3cSpl196000 	FT_REG = 1,	/* regular file */
866942c5e3cSpl196000 	FT_DIR,		/* directory */
867942c5e3cSpl196000 	FT_BLK,		/* "block" device - reserved */
868942c5e3cSpl196000 	FT_CHR,		/* "character special" device - reserved */
869942c5e3cSpl196000 	FT_LNK,		/* symbolic link */
870942c5e3cSpl196000 	FT_SOCK,	/* socket */
871942c5e3cSpl196000 	FT_FIFO,	/* fifo */
872942c5e3cSpl196000 	FT_FILESYS,	/* ADAPTEC's "FSA"(tm) filesystem */
873942c5e3cSpl196000 	FT_DRIVE,	/* physical disk - addressable in scsi by b/t/l */
874942c5e3cSpl196000 	FT_SLICE,	/* virtual disk - raw volume - slice */
875942c5e3cSpl196000 	FT_PARTITION,	/* FSA partition - carved out of a slice - building */
876942c5e3cSpl196000 			/* block for containers */
877942c5e3cSpl196000 	FT_VOLUME,	/* Container - Volume Set */
878942c5e3cSpl196000 	FT_STRIPE,	/* Container - Stripe Set */
879942c5e3cSpl196000 	FT_MIRROR,	/* Container - Mirror Set */
880942c5e3cSpl196000 	FT_RAID5,	/* Container - Raid 5 Set */
881942c5e3cSpl196000 	FT_DATABASE	/* Storage object with "foreign" content manager */
882942c5e3cSpl196000 } AAC_FType;
883942c5e3cSpl196000 
884942c5e3cSpl196000 /* Host-side scatter/gather list for 32-bit, 64-bit, raw commands */
885942c5e3cSpl196000 struct aac_sg_entry {
886942c5e3cSpl196000 	uint32_t	SgAddress;
887942c5e3cSpl196000 	uint32_t	SgByteCount;
888942c5e3cSpl196000 };
889942c5e3cSpl196000 
890942c5e3cSpl196000 struct aac_sg_entry64 {
891942c5e3cSpl196000 	uint64_t	SgAddress;
892942c5e3cSpl196000 	uint32_t	SgByteCount;
893942c5e3cSpl196000 };
894942c5e3cSpl196000 
895942c5e3cSpl196000 struct aac_sg_entryraw {
896942c5e3cSpl196000 	uint32_t	Next;		/* reserved */
897942c5e3cSpl196000 	uint32_t	Prev;		/* reserved */
898942c5e3cSpl196000 	uint64_t	SgAddress;
899942c5e3cSpl196000 	uint32_t	SgByteCount;
900942c5e3cSpl196000 	uint32_t	Flags;		/* reserved */
901942c5e3cSpl196000 };
902942c5e3cSpl196000 
903942c5e3cSpl196000 struct aac_sg_table {
904942c5e3cSpl196000 	uint32_t		SgCount;
905942c5e3cSpl196000 	struct aac_sg_entry	SgEntry[1]; /* at least there is one */
906942c5e3cSpl196000 					    /* SUN's CC cannot accept [0] */
907942c5e3cSpl196000 };
908942c5e3cSpl196000 
909942c5e3cSpl196000 struct aac_sg_table64 {
910942c5e3cSpl196000 	uint32_t		SgCount;
911942c5e3cSpl196000 	struct aac_sg_entry64	SgEntry64[1];
912942c5e3cSpl196000 };
913942c5e3cSpl196000 
914942c5e3cSpl196000 struct aac_sg_tableraw {
915942c5e3cSpl196000 	uint32_t		SgCount;
916942c5e3cSpl196000 	struct aac_sg_entryraw	SgEntryRaw[1];
917942c5e3cSpl196000 };
918942c5e3cSpl196000 
919942c5e3cSpl196000 /*
920942c5e3cSpl196000  * Block read/write operations.
921942c5e3cSpl196000  * These structures are packed into the 'data' area in the FIB.
922942c5e3cSpl196000  */
923942c5e3cSpl196000 struct aac_blockread {
924942c5e3cSpl196000 	uint32_t		Command;
925942c5e3cSpl196000 	uint32_t		ContainerId;
926942c5e3cSpl196000 	uint32_t		BlockNumber;
927942c5e3cSpl196000 	uint32_t		ByteCount;
928942c5e3cSpl196000 	struct aac_sg_table	SgMap;
929942c5e3cSpl196000 };
930942c5e3cSpl196000 
931942c5e3cSpl196000 struct aac_blockread64 {
932942c5e3cSpl196000 	uint32_t		Command;
933942c5e3cSpl196000 	uint16_t		ContainerId;
934942c5e3cSpl196000 	uint16_t		SectorCount;
935942c5e3cSpl196000 	uint32_t		BlockNumber;
936942c5e3cSpl196000 	uint16_t		Pad;
937942c5e3cSpl196000 	uint16_t		Flags;
938942c5e3cSpl196000 	struct aac_sg_table64	SgMap64;
939942c5e3cSpl196000 };
940942c5e3cSpl196000 
941942c5e3cSpl196000 struct aac_blockread_response {
942942c5e3cSpl196000 	uint32_t		Status;
943942c5e3cSpl196000 	uint32_t		ByteCount;
944942c5e3cSpl196000 };
945942c5e3cSpl196000 
946942c5e3cSpl196000 struct aac_blockwrite {
947942c5e3cSpl196000 	uint32_t		Command;
948942c5e3cSpl196000 	uint32_t		ContainerId;
949942c5e3cSpl196000 	uint32_t		BlockNumber;
950942c5e3cSpl196000 	uint32_t		ByteCount;
951942c5e3cSpl196000 	uint32_t		Stable;
952942c5e3cSpl196000 	struct aac_sg_table	SgMap;
953942c5e3cSpl196000 };
954942c5e3cSpl196000 
955942c5e3cSpl196000 struct aac_blockwrite64 {
956942c5e3cSpl196000 	uint32_t		Command;
957942c5e3cSpl196000 	uint16_t		ContainerId;
958942c5e3cSpl196000 	uint16_t		SectorCount;
959942c5e3cSpl196000 	uint32_t		BlockNumber;
960942c5e3cSpl196000 	uint16_t		Pad;
961942c5e3cSpl196000 	uint16_t		Flags;
962942c5e3cSpl196000 	struct aac_sg_table64	SgMap64;
963942c5e3cSpl196000 };
964942c5e3cSpl196000 
965942c5e3cSpl196000 struct aac_blockwrite_response {
966942c5e3cSpl196000 	uint32_t		Status;
967942c5e3cSpl196000 	uint32_t		ByteCount;
968942c5e3cSpl196000 	uint32_t		Committed;
969942c5e3cSpl196000 };
970942c5e3cSpl196000 
971942c5e3cSpl196000 struct aac_raw_io {
972942c5e3cSpl196000 	uint64_t		BlockNumber;
973942c5e3cSpl196000 	uint32_t		ByteCount;
974942c5e3cSpl196000 	uint16_t		ContainerId;
975942c5e3cSpl196000 	uint16_t		Flags;		/* 0: W, 1: R */
976942c5e3cSpl196000 	uint16_t		BpTotal;	/* reserved */
977942c5e3cSpl196000 	uint16_t		BpComplete;	/* reserved */
978942c5e3cSpl196000 	struct aac_sg_tableraw	SgMapRaw;
979942c5e3cSpl196000 };
980942c5e3cSpl196000 
981942c5e3cSpl196000 /*
982942c5e3cSpl196000  * Container shutdown command.
983942c5e3cSpl196000  */
984942c5e3cSpl196000 struct aac_close_command {
985942c5e3cSpl196000 	uint32_t		Command;
986942c5e3cSpl196000 	uint32_t		ContainerId;
987942c5e3cSpl196000 };
988942c5e3cSpl196000 
98958bc78c7SXin Chen /*
99058bc78c7SXin Chen  * Container Config Command
99158bc78c7SXin Chen  */
99258bc78c7SXin Chen struct aac_ctcfg {
99358bc78c7SXin Chen 	uint32_t		Command;
99458bc78c7SXin Chen 	uint32_t		cmd;
99558bc78c7SXin Chen 	uint32_t		param;
99658bc78c7SXin Chen };
99758bc78c7SXin Chen 
99858bc78c7SXin Chen struct aac_ctcfg_resp {
99958bc78c7SXin Chen 	uint32_t		Status;
100058bc78c7SXin Chen 	uint32_t		resp;
100158bc78c7SXin Chen 	uint32_t		param;
100258bc78c7SXin Chen };
100358bc78c7SXin Chen 
1004942c5e3cSpl196000 /* Write 'stability' options */
1005942c5e3cSpl196000 #define	CSTABLE			1
1006942c5e3cSpl196000 #define	CUNSTABLE		2
1007942c5e3cSpl196000 
1008942c5e3cSpl196000 /* Number of FIBs for the controller to send us messages */
1009942c5e3cSpl196000 #define	AAC_ADAPTER_FIBS	8
1010942c5e3cSpl196000 
1011942c5e3cSpl196000 /* Number of FIBs for the host I/O request */
1012942c5e3cSpl196000 #define	AAC_HOST_FIBS		256
1013942c5e3cSpl196000 
1014942c5e3cSpl196000 /* Size of buffer for text messages from the controller */
1015942c5e3cSpl196000 #define	AAC_ADAPTER_PRINT_BUFSIZE		256
1016942c5e3cSpl196000 
1017942c5e3cSpl196000 #define	AAC_INIT_STRUCT_REVISION		3
1018942c5e3cSpl196000 #define	AAC_INIT_STRUCT_REVISION_4		4
1019942c5e3cSpl196000 #define	AAC_INIT_STRUCT_MINIPORT_REVISION	1
1020b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 
1021942c5e3cSpl196000 #define	AAC_INIT_FLAGS_NEW_COMM_SUPPORTED	1
1022b40e8a89Szhongyan gu - Sun Microsystems - Beijing China #define	AAC_INIT_FLAGS_DRIVER_USES_UTC_TIME	0x10
1023b40e8a89Szhongyan gu - Sun Microsystems - Beijing China #define	AAC_INIT_FLAGS_DRIVER_SUPPORTS_PM	0x20
1024b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 
1025942c5e3cSpl196000 #define	AAC_PAGE_SIZE				4096
1026942c5e3cSpl196000 struct aac_adapter_init {
1027942c5e3cSpl196000 	uint32_t	InitStructRevision;
1028942c5e3cSpl196000 	uint32_t	MiniPortRevision;
1029942c5e3cSpl196000 	uint32_t	FilesystemRevision;
1030942c5e3cSpl196000 	uint32_t	CommHeaderAddress;
1031942c5e3cSpl196000 	uint32_t	FastIoCommAreaAddress;
1032942c5e3cSpl196000 	uint32_t	AdapterFibsPhysicalAddress;
1033942c5e3cSpl196000 	uint32_t	AdapterFibsVirtualAddress;
1034942c5e3cSpl196000 	uint32_t	AdapterFibsSize;
1035942c5e3cSpl196000 	uint32_t	AdapterFibAlign;
1036942c5e3cSpl196000 	uint32_t	PrintfBufferAddress;
1037942c5e3cSpl196000 	uint32_t	PrintfBufferSize;
1038942c5e3cSpl196000 	uint32_t	HostPhysMemPages;
1039942c5e3cSpl196000 	uint32_t	HostElapsedSeconds;
1040942c5e3cSpl196000 	/* ADAPTER_INIT_STRUCT_REVISION_4 begins here */
1041942c5e3cSpl196000 	uint32_t	InitFlags;
1042942c5e3cSpl196000 	uint32_t	MaxIoCommands;
1043942c5e3cSpl196000 	uint32_t	MaxIoSize;
1044942c5e3cSpl196000 	uint32_t	MaxFibSize;
1045942c5e3cSpl196000 };
1046942c5e3cSpl196000 
1047942c5e3cSpl196000 /* ************AAC QUEUE DEFINES (BELOW)*********** */
1048942c5e3cSpl196000 
1049942c5e3cSpl196000 #define	AAC_QUEUE_ALIGN		16
1050942c5e3cSpl196000 #define	AAC_QUEUE_COUNT		8
1051942c5e3cSpl196000 #define	AAC_PRODUCER_INDEX	0
1052942c5e3cSpl196000 #define	AAC_CONSUMER_INDEX	1
1053942c5e3cSpl196000 
1054942c5e3cSpl196000 struct aac_queue_entry {
1055942c5e3cSpl196000 	uint32_t aq_fib_size;	/* FIB size in bytes */
1056942c5e3cSpl196000 	uint32_t aq_fib_addr;	/* receiver-space address of the FIB */
1057942c5e3cSpl196000 };
1058942c5e3cSpl196000 
1059942c5e3cSpl196000 /*
1060942c5e3cSpl196000  * Queue names
1061942c5e3cSpl196000  *
1062942c5e3cSpl196000  * Note that we base these at 0 in order to use them as array indices.
1063942c5e3cSpl196000  * Adaptec used base 1 for some unknown reason, and sorted them in a
1064942c5e3cSpl196000  * different order.
1065942c5e3cSpl196000  */
1066942c5e3cSpl196000 #define	AAC_HOST_NORM_CMD_Q	0
1067942c5e3cSpl196000 #define	AAC_HOST_HIGH_CMD_Q	1
1068942c5e3cSpl196000 #define	AAC_ADAP_NORM_CMD_Q	2
1069942c5e3cSpl196000 #define	AAC_ADAP_HIGH_CMD_Q	3
1070942c5e3cSpl196000 #define	AAC_HOST_NORM_RESP_Q	4
1071942c5e3cSpl196000 #define	AAC_HOST_HIGH_RESP_Q	5
1072942c5e3cSpl196000 #define	AAC_ADAP_NORM_RESP_Q	6
1073942c5e3cSpl196000 #define	AAC_ADAP_HIGH_RESP_Q	7
1074942c5e3cSpl196000 
1075942c5e3cSpl196000 /*
1076942c5e3cSpl196000  * We establish 4 command queues and matching response queues. Queues must
1077942c5e3cSpl196000  * be 16-byte aligned, and are sized as follows:
1078942c5e3cSpl196000  */
1079942c5e3cSpl196000 /* command adapter->host, normal priority */
1080942c5e3cSpl196000 #define	AAC_HOST_NORM_CMD_ENTRIES	8
1081942c5e3cSpl196000 /* command adapter->host, high priority */
1082942c5e3cSpl196000 #define	AAC_HOST_HIGH_CMD_ENTRIES	4
1083942c5e3cSpl196000 /* command host->adapter, normal priority */
1084942c5e3cSpl196000 #define	AAC_ADAP_NORM_CMD_ENTRIES	512
1085942c5e3cSpl196000 /* command host->adapter, high priority */
1086942c5e3cSpl196000 #define	AAC_ADAP_HIGH_CMD_ENTRIES	4
1087942c5e3cSpl196000 /* response, adapter->host, normal priority */
1088942c5e3cSpl196000 #define	AAC_HOST_NORM_RESP_ENTRIES	512
1089942c5e3cSpl196000 /* response, adapter->host, high priority */
1090942c5e3cSpl196000 #define	AAC_HOST_HIGH_RESP_ENTRIES	4
1091942c5e3cSpl196000 /* response, host->adapter, normal priority */
1092942c5e3cSpl196000 #define	AAC_ADAP_NORM_RESP_ENTRIES	8
1093942c5e3cSpl196000 /* response, host->adapter, high priority */
1094942c5e3cSpl196000 #define	AAC_ADAP_HIGH_RESP_ENTRIES	4
1095942c5e3cSpl196000 
1096942c5e3cSpl196000 #define	AAC_TOTALQ_LENGTH	(AAC_HOST_HIGH_CMD_ENTRIES + \
1097942c5e3cSpl196000 				AAC_HOST_NORM_CMD_ENTRIES + \
1098942c5e3cSpl196000 				AAC_ADAP_HIGH_CMD_ENTRIES + \
1099942c5e3cSpl196000 				AAC_ADAP_NORM_CMD_ENTRIES + \
1100942c5e3cSpl196000 				AAC_HOST_HIGH_RESP_ENTRIES + \
1101942c5e3cSpl196000 				AAC_HOST_NORM_RESP_ENTRIES + \
1102942c5e3cSpl196000 				AAC_ADAP_HIGH_RESP_ENTRIES + \
1103942c5e3cSpl196000 				AAC_ADAP_NORM_RESP_ENTRIES)
1104942c5e3cSpl196000 
1105942c5e3cSpl196000 /*
1106942c5e3cSpl196000  * Table of queue indices and queues used to communicate with the
1107942c5e3cSpl196000  * controller. This structure must be aligned to AAC_QUEUE_ALIGN.
1108942c5e3cSpl196000  */
1109942c5e3cSpl196000 struct aac_queue_table {
1110942c5e3cSpl196000 	/* queue consumer/producer indexes (layout mandated by adapter) */
1111942c5e3cSpl196000 	uint32_t qt_qindex[AAC_QUEUE_COUNT][2];
1112942c5e3cSpl196000 
1113942c5e3cSpl196000 	/* queue entry structures (layout mandated by adapter) */
1114942c5e3cSpl196000 	struct aac_queue_entry qt_HostNormCmdQueue \
1115942c5e3cSpl196000 	    [AAC_HOST_NORM_CMD_ENTRIES];
1116942c5e3cSpl196000 	struct aac_queue_entry qt_HostHighCmdQueue \
1117942c5e3cSpl196000 	    [AAC_HOST_HIGH_CMD_ENTRIES];
1118942c5e3cSpl196000 	struct aac_queue_entry qt_AdapNormCmdQueue \
1119942c5e3cSpl196000 	    [AAC_ADAP_NORM_CMD_ENTRIES];
1120942c5e3cSpl196000 	struct aac_queue_entry qt_AdapHighCmdQueue \
1121942c5e3cSpl196000 	    [AAC_ADAP_HIGH_CMD_ENTRIES];
1122942c5e3cSpl196000 	struct aac_queue_entry qt_HostNormRespQueue \
1123942c5e3cSpl196000 	    [AAC_HOST_NORM_RESP_ENTRIES];
1124942c5e3cSpl196000 	struct aac_queue_entry qt_HostHighRespQueue \
1125942c5e3cSpl196000 	    [AAC_HOST_HIGH_RESP_ENTRIES];
1126942c5e3cSpl196000 	struct aac_queue_entry qt_AdapNormRespQueue \
1127942c5e3cSpl196000 	    [AAC_ADAP_NORM_RESP_ENTRIES];
1128942c5e3cSpl196000 	struct aac_queue_entry qt_AdapHighRespQueue \
1129942c5e3cSpl196000 	    [AAC_ADAP_HIGH_RESP_ENTRIES];
1130942c5e3cSpl196000 };
1131942c5e3cSpl196000 /* ************AAC QUEUE DEFINES (ABOVE)*********** */
1132942c5e3cSpl196000 
1133942c5e3cSpl196000 /*
1134942c5e3cSpl196000  * NVRAM/Write Cache subsystem battery component states
1135942c5e3cSpl196000  */
1136942c5e3cSpl196000 typedef enum {
1137942c5e3cSpl196000 	NVBATTSTATUS_NONE = 0,	/* battery has no power or is not present */
1138942c5e3cSpl196000 	NVBATTSTATUS_LOW,	/* battery is low on power */
1139942c5e3cSpl196000 	NVBATTSTATUS_OK,	/* battery is okay - normal operation */
1140942c5e3cSpl196000 				/* possible only in this state */
1141942c5e3cSpl196000 	NVBATTSTATUS_RECONDITIONING	/* no battery present */
1142942c5e3cSpl196000 					/* - reconditioning in process */
1143942c5e3cSpl196000 } AAC_NVBATTSTATUS;
1144942c5e3cSpl196000 
1145942c5e3cSpl196000 /*
1146942c5e3cSpl196000  * Battery transition type
1147942c5e3cSpl196000  */
1148942c5e3cSpl196000 typedef enum {
1149942c5e3cSpl196000 	NVBATT_TRANSITION_NONE = 0,	/* battery now has no power or is not */
1150942c5e3cSpl196000 					/* present */
1151942c5e3cSpl196000 	NVBATT_TRANSITION_LOW,	/* battery is now low on power */
1152942c5e3cSpl196000 	NVBATT_TRANSITION_OK	/* battery is now okay - normal */
1153942c5e3cSpl196000 				/* operation possible only in this state */
1154942c5e3cSpl196000 } AAC_NVBATT_TRANSITION;
1155942c5e3cSpl196000 
1156942c5e3cSpl196000 /*
1157942c5e3cSpl196000  * Data types relating to AIFs
1158942c5e3cSpl196000  */
1159942c5e3cSpl196000 
1160942c5e3cSpl196000 /*
1161942c5e3cSpl196000  * Progress Reports
1162942c5e3cSpl196000  */
1163942c5e3cSpl196000 typedef enum {
1164942c5e3cSpl196000 	AifJobStsSuccess = 1,
1165942c5e3cSpl196000 	AifJobStsFinished,
1166942c5e3cSpl196000 	AifJobStsAborted,
1167942c5e3cSpl196000 	AifJobStsFailed,
1168942c5e3cSpl196000 	AifJobStsLastReportMarker = 100,	/* All prior mean last report */
1169942c5e3cSpl196000 	AifJobStsSuspended,
1170942c5e3cSpl196000 	AifJobStsRunning
1171942c5e3cSpl196000 } AAC_AifJobStatus;
1172942c5e3cSpl196000 
1173942c5e3cSpl196000 typedef enum {
1174942c5e3cSpl196000 	AifJobScsiMin = 1,	/* Minimum value for Scsi operation */
1175942c5e3cSpl196000 	AifJobScsiZero,		/* SCSI device clear operation */
1176942c5e3cSpl196000 	AifJobScsiVerify,	/* SCSI device Verify operation NO REPAIR */
1177942c5e3cSpl196000 	AifJobScsiExercise,	/* SCSI device Exercise operation */
1178942c5e3cSpl196000 	AifJobScsiVerifyRepair,	/* SCSI device Verify operation WITH repair */
1179942c5e3cSpl196000 	AifJobScsiWritePattern,	/* write pattern */
1180942c5e3cSpl196000 	AifJobScsiMax = 99,	/* Max Scsi value */
1181942c5e3cSpl196000 	AifJobCtrMin,		/* Min Ctr op value */
1182942c5e3cSpl196000 	AifJobCtrZero,		/* Container clear operation */
1183942c5e3cSpl196000 	AifJobCtrCopy,		/* Container copy operation */
1184942c5e3cSpl196000 	AifJobCtrCreateMirror,	/* Container Create Mirror operation */
1185942c5e3cSpl196000 	AifJobCtrMergeMirror,	/* Container Merge Mirror operation */
1186942c5e3cSpl196000 	AifJobCtrScrubMirror,	/* Container Scrub Mirror operation */
1187942c5e3cSpl196000 	AifJobCtrRebuildRaid5,	/* Container Rebuild Raid5 operation */
1188942c5e3cSpl196000 	AifJobCtrScrubRaid5,	/* Container Scrub Raid5 operation */
1189942c5e3cSpl196000 	AifJobCtrMorph,		/* Container morph operation */
1190942c5e3cSpl196000 	AifJobCtrPartCopy,	/* Container Partition copy operation */
1191942c5e3cSpl196000 	AifJobCtrRebuildMirror,	/* Container Rebuild Mirror operation */
1192942c5e3cSpl196000 	AifJobCtrCrazyCache,	/* crazy cache */
1193942c5e3cSpl196000 	AifJobCtrCopyback,	/* Container Copyback operation */
1194942c5e3cSpl196000 	AifJobCtrCompactRaid5D,	/* Container Compaction operation */
1195942c5e3cSpl196000 	AifJobCtrExpandRaid5D,	/* Container Expansion operation */
1196942c5e3cSpl196000 	AifJobCtrRebuildRaid6,	/* Container Rebuild Raid6 operation */
1197942c5e3cSpl196000 	AifJobCtrScrubRaid6,	/* Container Scrub Raid6 operation */
1198942c5e3cSpl196000 	AifJobCtrSSBackup,	/* Container snapshot backup task */
1199942c5e3cSpl196000 	AifJobCtrMax = 199,	/* Max Ctr type operation */
1200942c5e3cSpl196000 	AifJobFsMin,		/* Min Fs type operation */
1201942c5e3cSpl196000 	AifJobFsCreate,		/* File System Create operation */
1202942c5e3cSpl196000 	AifJobFsVerify,		/* File System Verify operation */
1203942c5e3cSpl196000 	AifJobFsExtend,		/* File System Extend operation */
1204942c5e3cSpl196000 	AifJobFsMax = 299,	/* Max Fs type operation */
1205942c5e3cSpl196000 	AifJobApiFormatNTFS,	/* Format a drive to NTFS */
1206942c5e3cSpl196000 	AifJobApiFormatFAT,	/* Format a drive to FAT */
1207942c5e3cSpl196000 	AifJobApiUpdateSnapshot, /* update the read/write half of a snapshot */
1208942c5e3cSpl196000 	AifJobApiFormatFAT32,	/* Format a drive to FAT32 */
1209942c5e3cSpl196000 	AifJobApiMax = 399,		/* Max API type operation */
1210942c5e3cSpl196000 	AifJobCtlContinuousCtrVerify,	/* Adapter operation */
1211942c5e3cSpl196000 	AifJobCtlMax = 499		/* Max Adapter type operation */
1212942c5e3cSpl196000 } AAC_AifJobType;
1213942c5e3cSpl196000 
1214942c5e3cSpl196000 struct aac_AifContainers {
1215942c5e3cSpl196000 	uint32_t	src;		/* from/master */
1216942c5e3cSpl196000 	uint32_t	dst;		/* to/slave */
1217942c5e3cSpl196000 };
1218942c5e3cSpl196000 
1219942c5e3cSpl196000 union aac_AifJobClient {
1220942c5e3cSpl196000 	struct aac_AifContainers container;	/* For Container and */
1221942c5e3cSpl196000 						/* filesystem progress ops */
1222942c5e3cSpl196000 	int32_t scsi_dh;			/* For SCSI progress ops */
1223942c5e3cSpl196000 };
1224942c5e3cSpl196000 
1225942c5e3cSpl196000 struct aac_AifJobDesc {
1226942c5e3cSpl196000 	uint32_t	jobID;	/* DO NOT FILL IN! Will be filled in by AIF */
1227942c5e3cSpl196000 	AAC_AifJobType	type;	/* Operation that is being performed */
1228942c5e3cSpl196000 	union aac_AifJobClient	client;	/* Details */
1229942c5e3cSpl196000 };
1230942c5e3cSpl196000 
1231942c5e3cSpl196000 struct aac_AifJobProgressReport {
1232942c5e3cSpl196000 	struct aac_AifJobDesc	jd;
1233942c5e3cSpl196000 	AAC_AifJobStatus	status;
1234942c5e3cSpl196000 	uint32_t		finalTick;
1235942c5e3cSpl196000 	uint32_t		currentTick;
1236942c5e3cSpl196000 	uint32_t		jobSpecificData1;
1237942c5e3cSpl196000 	uint32_t		jobSpecificData2;
1238942c5e3cSpl196000 };
1239942c5e3cSpl196000 
1240942c5e3cSpl196000 /*
1241942c5e3cSpl196000  * Event Notification
1242942c5e3cSpl196000  */
1243942c5e3cSpl196000 typedef enum {
1244942c5e3cSpl196000 	/* General application notifies start here */
1245942c5e3cSpl196000 	AifEnGeneric = 1,	/* Generic notification */
1246942c5e3cSpl196000 	AifEnTaskComplete,	/* Task has completed */
1247942c5e3cSpl196000 	AifEnConfigChange,	/* Adapter config change occurred */
1248942c5e3cSpl196000 	AifEnContainerChange,	/* Adapter specific container cfg. change */
1249942c5e3cSpl196000 	AifEnDeviceFailure,	/* SCSI device failed */
1250942c5e3cSpl196000 	AifEnMirrorFailover,	/* Mirror failover started */
1251942c5e3cSpl196000 	AifEnContainerEvent,	/* Significant container event */
1252942c5e3cSpl196000 	AifEnFileSystemChange,	/* File system changed */
1253942c5e3cSpl196000 	AifEnConfigPause,	/* Container pause event */
1254942c5e3cSpl196000 	AifEnConfigResume,	/* Container resume event */
1255942c5e3cSpl196000 	AifEnFailoverChange,	/* Failover space assignment changed */
1256942c5e3cSpl196000 	AifEnRAID5RebuildDone,	/* RAID5 rebuild finished */
1257942c5e3cSpl196000 	AifEnEnclosureManagement,	/* Enclosure management event */
1258942c5e3cSpl196000 	AifEnBatteryEvent,	/* Significant NV battery event */
1259942c5e3cSpl196000 	AifEnAddContainer,	/* A new container was created. */
1260942c5e3cSpl196000 	AifEnDeleteContainer,	/* A container was deleted. */
1261942c5e3cSpl196000 	AifEnSMARTEvent,	/* SMART Event */
1262942c5e3cSpl196000 	AifEnBatteryNeedsRecond,	/* The battery needs reconditioning */
1263942c5e3cSpl196000 	AifEnClusterEvent,		/* Some cluster event */
1264942c5e3cSpl196000 	AifEnDiskSetEvent,		/* A disk set event occured. */
1265*3fced439Szhongyan gu - Sun Microsystems - Beijing China 	AifEnAddJBOD = 30,	/* A new JBOD type drive was created (30) */
1266*3fced439Szhongyan gu - Sun Microsystems - Beijing China 	AifEnDeleteJBOD = 31,	/* A JBOD type drive was deleted (31) */
1267942c5e3cSpl196000 	AifDriverNotifyStart = 199,	/* Notifies for host driver go here */
1268942c5e3cSpl196000 	/* Host driver notifications start here */
1269942c5e3cSpl196000 	AifDenMorphComplete,		/* A morph operation completed */
1270942c5e3cSpl196000 	AifDenVolumeExtendComplete	/* Volume expand operation completed */
1271942c5e3cSpl196000 } AAC_AifEventNotifyType;
1272942c5e3cSpl196000 
1273942c5e3cSpl196000 struct aac_AifEnsGeneric {
1274942c5e3cSpl196000 	char	text[132];		/* Generic text */
1275942c5e3cSpl196000 };
1276942c5e3cSpl196000 
1277942c5e3cSpl196000 struct aac_AifEnsDeviceFailure {
1278942c5e3cSpl196000 	uint32_t	deviceHandle;	/* SCSI device handle */
1279942c5e3cSpl196000 };
1280942c5e3cSpl196000 
1281942c5e3cSpl196000 struct aac_AifEnsMirrorFailover {
1282942c5e3cSpl196000 	uint32_t	container;	/* Container with failed element */
1283942c5e3cSpl196000 	uint32_t	failedSlice;	/* Old slice which failed */
1284942c5e3cSpl196000 	uint32_t	creatingSlice;	/* New slice used for auto-create */
1285942c5e3cSpl196000 };
1286942c5e3cSpl196000 
1287942c5e3cSpl196000 struct aac_AifEnsContainerChange {
1288942c5e3cSpl196000 	uint32_t	container[2];	/* container that changed, -1 if */
1289942c5e3cSpl196000 					/* no container */
1290942c5e3cSpl196000 };
1291942c5e3cSpl196000 
1292942c5e3cSpl196000 struct aac_AifEnsContainerEvent {
1293942c5e3cSpl196000 	uint32_t	container;	/* container number  */
1294942c5e3cSpl196000 	uint32_t	eventType;	/* event type */
1295942c5e3cSpl196000 };
1296942c5e3cSpl196000 
1297942c5e3cSpl196000 struct aac_AifEnsEnclosureEvent {
1298942c5e3cSpl196000 	uint32_t	empID;		/* enclosure management proc number  */
1299942c5e3cSpl196000 	uint32_t	unitID;		/* unitId, fan id, power supply id, */
1300942c5e3cSpl196000 					/* slot id, tempsensor id. */
1301942c5e3cSpl196000 	uint32_t	eventType;	/* event type */
1302942c5e3cSpl196000 };
1303942c5e3cSpl196000 
1304942c5e3cSpl196000 struct aac_AifEnsBatteryEvent {
1305942c5e3cSpl196000 	AAC_NVBATT_TRANSITION	transition_type;	/* eg from low to ok */
1306942c5e3cSpl196000 	AAC_NVBATTSTATUS	current_state;	/* current batt state */
1307942c5e3cSpl196000 	AAC_NVBATTSTATUS	prior_state;	/* prev batt state */
1308942c5e3cSpl196000 };
1309942c5e3cSpl196000 
1310942c5e3cSpl196000 struct aac_AifEnsDiskSetEvent {
1311942c5e3cSpl196000 	uint32_t	eventType;
1312942c5e3cSpl196000 	uint64_t	DsNum;
1313942c5e3cSpl196000 	uint64_t	CreatorId;
1314942c5e3cSpl196000 };
1315942c5e3cSpl196000 
1316942c5e3cSpl196000 typedef enum {
1317942c5e3cSpl196000 	CLUSTER_NULL_EVENT = 0,
1318942c5e3cSpl196000 	CLUSTER_PARTNER_NAME_EVENT,	/* change in partner hostname or */
1319942c5e3cSpl196000 					/* adaptername from NULL to non-NULL */
1320942c5e3cSpl196000 					/* (partner's agent may be up) */
1321942c5e3cSpl196000 	CLUSTER_PARTNER_NULL_NAME_EVENT	/* change in partner hostname or */
1322942c5e3cSpl196000 					/* adaptername from non-null to NULL */
1323942c5e3cSpl196000 					/* (partner has rebooted) */
1324942c5e3cSpl196000 } AAC_ClusterAifEvent;
1325942c5e3cSpl196000 
1326942c5e3cSpl196000 struct aac_AifEnsClusterEvent {
1327942c5e3cSpl196000 	AAC_ClusterAifEvent	eventType;
1328942c5e3cSpl196000 };
1329942c5e3cSpl196000 
1330942c5e3cSpl196000 struct aac_AifEventNotify {
1331942c5e3cSpl196000 	AAC_AifEventNotifyType	type;
1332942c5e3cSpl196000 	union {
1333942c5e3cSpl196000 		struct aac_AifEnsGeneric		EG;
1334942c5e3cSpl196000 		struct aac_AifEnsDeviceFailure		EDF;
1335942c5e3cSpl196000 		struct aac_AifEnsMirrorFailover		EMF;
1336942c5e3cSpl196000 		struct aac_AifEnsContainerChange	ECC;
1337942c5e3cSpl196000 		struct aac_AifEnsContainerEvent		ECE;
1338942c5e3cSpl196000 		struct aac_AifEnsEnclosureEvent		EEE;
1339942c5e3cSpl196000 		struct aac_AifEnsBatteryEvent		EBE;
1340942c5e3cSpl196000 		struct aac_AifEnsDiskSetEvent		EDS;
1341942c5e3cSpl196000 /*		struct aac_AifEnsSMARTEvent		ES; */
1342942c5e3cSpl196000 		struct aac_AifEnsClusterEvent		ECLE;
1343942c5e3cSpl196000 	} data;
1344942c5e3cSpl196000 };
1345942c5e3cSpl196000 
1346942c5e3cSpl196000 /*
1347942c5e3cSpl196000  * Adapter Initiated FIB command structures. Start with the adapter
1348942c5e3cSpl196000  * initiated FIBs that really come from the adapter, and get responded
1349942c5e3cSpl196000  * to by the host.
1350942c5e3cSpl196000  */
1351942c5e3cSpl196000 #define	AAC_AIF_REPORT_MAX_SIZE 64
1352942c5e3cSpl196000 
1353942c5e3cSpl196000 typedef enum {
1354942c5e3cSpl196000 	AifCmdEventNotify = 1,	/* Notify of event */
1355942c5e3cSpl196000 	AifCmdJobProgress,	/* Progress report */
1356942c5e3cSpl196000 	AifCmdAPIReport,	/* Report from other user of API */
1357942c5e3cSpl196000 	AifCmdDriverNotify,	/* Notify host driver of event */
1358942c5e3cSpl196000 	AifReqJobList = 100,	/* Gets back complete job list */
1359942c5e3cSpl196000 	AifReqJobsForCtr,	/* Gets back jobs for specific container */
1360942c5e3cSpl196000 	AifReqJobsForScsi,	/* Gets back jobs for specific SCSI device */
1361942c5e3cSpl196000 	AifReqJobReport,	/* Gets back a specific job report or list */
1362942c5e3cSpl196000 	AifReqTerminateJob,	/* Terminates job */
1363942c5e3cSpl196000 	AifReqSuspendJob,	/* Suspends a job */
1364942c5e3cSpl196000 	AifReqResumeJob,	/* Resumes a job */
1365942c5e3cSpl196000 	AifReqSendAPIReport,	/* API generic report requests */
1366942c5e3cSpl196000 	AifReqAPIJobStart,	/* Start a job from the API */
1367942c5e3cSpl196000 	AifReqAPIJobUpdate,	/* Update a job report from the API */
1368942c5e3cSpl196000 	AifReqAPIJobFinish	/* Finish a job from the API */
1369942c5e3cSpl196000 } AAC_AifCommand;
1370942c5e3cSpl196000 
1371942c5e3cSpl196000 struct aac_aif_command {
1372942c5e3cSpl196000 	AAC_AifCommand	command; /* Tell host what type of notify this is */
1373942c5e3cSpl196000 	uint32_t	seqNumber;	/* To allow ordering of reports */
1374942c5e3cSpl196000 					/* (if necessary) */
1375942c5e3cSpl196000 	union {
1376942c5e3cSpl196000 		struct aac_AifEventNotify	EN;	/* Event notify */
1377942c5e3cSpl196000 		struct aac_AifJobProgressReport	PR[1];	/* Progress report */
1378942c5e3cSpl196000 		uint8_t	AR[AAC_AIF_REPORT_MAX_SIZE];
1379942c5e3cSpl196000 		uint8_t	data[AAC_FIB_DATASIZE - 8];
1380942c5e3cSpl196000 	} data;
1381942c5e3cSpl196000 };
1382942c5e3cSpl196000 
1383942c5e3cSpl196000 #define	CT_PUP_MISSING_DRIVE	27
1384942c5e3cSpl196000 
1385942c5e3cSpl196000 /*
1386942c5e3cSpl196000  * Cluster Management Commands
1387942c5e3cSpl196000  */
1388942c5e3cSpl196000 typedef enum {
1389942c5e3cSpl196000 	CL_NULL = 0,		/* 0x00 null */
1390942c5e3cSpl196000 	/* disk set commands */
1391942c5e3cSpl196000 	DS_INIT = 1,		/* 0x01 init disk set control block */
1392942c5e3cSpl196000 	DS_RESCAN,		/* 0x02 refresh drive, disk set, and slice */
1393942c5e3cSpl196000 				/* structs */
1394942c5e3cSpl196000 	DS_CREATE,		/* 0x03 create a disk set */
1395942c5e3cSpl196000 	DS_DELETE,		/* 0x04 delete a disk set */
1396942c5e3cSpl196000 	DS_ADD_DISK,		/* 0x05 add a disk to an existing disk set */
1397942c5e3cSpl196000 	DS_REMOVE_DISK,		/* 0x06 remove a disk from an existing disk */
1398942c5e3cSpl196000 				/* set */
1399942c5e3cSpl196000 	DS_MOVE_DISK,		/* 0x07 move a disk from one existing disk */
1400942c5e3cSpl196000 				/* set to another */
1401942c5e3cSpl196000 	DS_TAKE_OWNERSHIP,	/* 0x08 take ownership of an unowned disk set */
1402942c5e3cSpl196000 	DS_RELEASE_OWNERSHIP,	/* 0x09 release ownership of a disk set */
1403942c5e3cSpl196000 	DS_FORCE_OWNERSHIP,	/* 0x0A force ownership of an disk set */
1404942c5e3cSpl196000 	DS_GET_DISK_SET_PARAM,	/* 0x0B get info on a disk set */
1405942c5e3cSpl196000 	DS_GET_DRIVE_PARAM,	/* 0x0C get info on a drive */
1406942c5e3cSpl196000 	DS_GET_SLICE_PARAM,	/* 0x0D get info on a slice */
1407942c5e3cSpl196000 	DS_GET_DISK_SETS,	/* 0x0E get a list of disk sets */
1408942c5e3cSpl196000 	DS_GET_DRIVES,		/* 0x0F get a list of drives */
1409942c5e3cSpl196000 	DS_SET_DISK_SET_PARAM,	/* 0x10 set info of a disk set */
1410942c5e3cSpl196000 	DS_ONLINE,		/* 0x11 take disk set online */
1411942c5e3cSpl196000 	DS_OFFLINE,		/* 0x12 take disk set offline */
1412942c5e3cSpl196000 	DS_ONLINE_CONTAINERS,	/* 0x13 bring containers in diskset online */
1413942c5e3cSpl196000 	DS_FSAPRINT,		/* 0x14 do an FsaPrint */
1414942c5e3cSpl196000 
1415942c5e3cSpl196000 	/* config commands */
1416942c5e3cSpl196000 	CL_CFG_SET_HOST_IDS = 0x100,	/* 0x100 set host ids (host name and */
1417942c5e3cSpl196000 					/* adapter name) */
1418942c5e3cSpl196000 	CL_CFG_SET_PARTNER_HOST_IDS,	/* 0x101 set partner host ids (host */
1419942c5e3cSpl196000 					/* name and adapter name) */
1420942c5e3cSpl196000 	CL_CFG_GET_CLUSTER_CONFIG,	/* 0x102 get cluster configuration */
1421942c5e3cSpl196000 
1422942c5e3cSpl196000 	/* cluster comm commands */
1423942c5e3cSpl196000 	CC_CLI_CLEAR_MESSAGE_BUFFER = 0x200,	/* 0x200 CC - client - clear */
1424942c5e3cSpl196000 						/* contents of message buffer */
1425942c5e3cSpl196000 	CC_SRV_CLEAR_MESSAGE_BUFFER,	/* 0x201 CC - server - clear contents */
1426942c5e3cSpl196000 					/* of message buffer */
1427942c5e3cSpl196000 	CC_CLI_SHOW_MESSAGE_BUFFER,	/* 0x202 CC - client - show contents */
1428942c5e3cSpl196000 					/* of message buffer */
1429942c5e3cSpl196000 	CC_SRV_SHOW_MESSAGE_BUFFER,	/* 0x203 CC - server - show contents */
1430942c5e3cSpl196000 					/* of message buffer */
1431942c5e3cSpl196000 	CC_CLI_SEND_MESSAGE,	/* 0x204 CC - client - send (req) message to */
1432942c5e3cSpl196000 				/* server side */
1433942c5e3cSpl196000 	CC_SRV_SEND_MESSAGE,	/* 0x205 CC - server - send (reply) message */
1434942c5e3cSpl196000 				/* to client side */
1435942c5e3cSpl196000 	CC_CLI_GET_MESSAGE,	/* 0x206 CC - client - read thru read message */
1436942c5e3cSpl196000 				/* buffer */
1437942c5e3cSpl196000 	CC_SRV_GET_MESSAGE,	/* 0x207 CC - server - read thru read message */
1438942c5e3cSpl196000 				/* buffer */
1439942c5e3cSpl196000 	CC_SEND_TEST_MESSAGE,	/* 0x208 CC - send a special subclass message */
1440942c5e3cSpl196000 	CC_GET_BUSINFO,		/* 0x209 CC - get bus info */
1441942c5e3cSpl196000 	CC_GET_PORTINFO,	/* 0x20A CC - get bus,port info */
1442942c5e3cSpl196000 	CC_GET_NAMEINFO,	/* 0x20B CC - get misc info */
1443942c5e3cSpl196000 	CC_GET_CONFIGINFO,	/* 0x20C CC - get misc info */
1444942c5e3cSpl196000 	CQ_QUORUM_OP = 0x300,	/* 0x300 CQ - quorum messages */
1445942c5e3cSpl196000 
1446942c5e3cSpl196000 	/* last command */
1447942c5e3cSpl196000 	CL_LAST_COMMAND		/* used for bounds checking */
1448942c5e3cSpl196000 } AAC_CLCommand;
1449942c5e3cSpl196000 
1450942c5e3cSpl196000 /*
1451942c5e3cSpl196000  * Disk IOCTL Functions
1452942c5e3cSpl196000  */
1453942c5e3cSpl196000 #define	Reserved_IOCTL			0x0000
1454942c5e3cSpl196000 #define	GetDeviceHandle			0x0001
1455942c5e3cSpl196000 #define	BusTargetLun_to_DeviceHandle	0x0002
1456942c5e3cSpl196000 #define	DeviceHandle_to_BusTargetLun	0x0003
1457942c5e3cSpl196000 #define	RescanBus			0x0004
1458942c5e3cSpl196000 #define	GetDeviceProbeInfo		0x0005
1459942c5e3cSpl196000 #define	GetDeviceCapacity		0x0006
1460942c5e3cSpl196000 #define	GetContainerProbeInfo		0x0007	/* Container, not diskclass */
1461942c5e3cSpl196000 						/* ioctl */
1462942c5e3cSpl196000 #define	GetRequestedMemorySize		0x0008
1463942c5e3cSpl196000 #define	GetBusInfo			0x0009
1464942c5e3cSpl196000 #define	GetVendorSpecific		0x000a
1465942c5e3cSpl196000 
1466942c5e3cSpl196000 #define	EnhancedGetDeviceProbeInfo	0x000b
1467942c5e3cSpl196000 #define	EnhancedGetBusInfo		0x000c
1468942c5e3cSpl196000 
1469942c5e3cSpl196000 #define	SetupExtendedCounters		0x000d
1470942c5e3cSpl196000 #define	GetPerformanceCounters		0x000f
1471942c5e3cSpl196000 #define	ResetPerformanceCounters	0x0010
1472942c5e3cSpl196000 #define	ReadModePage			0x0011
1473942c5e3cSpl196000 #define	WriteModePage			0x0012
1474942c5e3cSpl196000 #define	ReadDriveParameter		0x0013
1475942c5e3cSpl196000 #define	WriteDriveParameter		0x0014
1476942c5e3cSpl196000 #define	ResetAdapter			0x0015
1477942c5e3cSpl196000 #define	ResetBus			0x0016
1478942c5e3cSpl196000 #define	ResetBusDevice			0x0017
1479942c5e3cSpl196000 #define	ExecuteSrb			0x0018
1480942c5e3cSpl196000 
1481942c5e3cSpl196000 #define	Create_IO_Task			0x0030
1482942c5e3cSpl196000 #define	Delete_IO_Task			0x0031
1483942c5e3cSpl196000 #define	Get_IO_Task_Info		0x0032
1484942c5e3cSpl196000 #define	Check_Task_Progress		0x0033
1485942c5e3cSpl196000 
1486942c5e3cSpl196000 #define	InjectError			0x0040
1487942c5e3cSpl196000 #define	GetDeviceDefectCounts		0x0041
1488942c5e3cSpl196000 #define	GetDeviceDefectInfo		0x0042
1489942c5e3cSpl196000 #define	GetDeviceStatus			0x0043
1490942c5e3cSpl196000 #define	ClearDeviceStatus		0x0044
1491942c5e3cSpl196000 #define	DiskSpinControl			0x0045
1492942c5e3cSpl196000 #define	DiskSmartControl		0x0046
1493942c5e3cSpl196000 #define	WriteSame			0x0047
1494942c5e3cSpl196000 #define	ReadWriteLong			0x0048
1495942c5e3cSpl196000 #define	FormatUnit			0x0049
1496942c5e3cSpl196000 
1497942c5e3cSpl196000 #define	TargetDeviceControl		0x0050
1498942c5e3cSpl196000 #define	TargetChannelControl		0x0051
1499942c5e3cSpl196000 
1500942c5e3cSpl196000 #define	FlashNewCode			0x0052
1501942c5e3cSpl196000 #define	DiskCheck			0x0053
1502942c5e3cSpl196000 #define	RequestSense			0x0054
1503942c5e3cSpl196000 #define	DiskPERControl			0x0055
1504942c5e3cSpl196000 #define	Read10				0x0056
1505942c5e3cSpl196000 #define	Write10				0x0057
1506942c5e3cSpl196000 
1507942c5e3cSpl196000 /*
1508942c5e3cSpl196000  * The following definitions come from Adaptec:
1509942c5e3cSpl196000  *
1510942c5e3cSpl196000  * SRB is required for the new management tools
1511942c5e3cSpl196000  * and non-DASD support.
1512942c5e3cSpl196000  */
1513942c5e3cSpl196000 struct aac_srb
1514942c5e3cSpl196000 {
1515942c5e3cSpl196000 	uint32_t function;
1516942c5e3cSpl196000 	uint32_t channel;
1517942c5e3cSpl196000 	uint32_t id;
1518942c5e3cSpl196000 	uint32_t lun;
1519942c5e3cSpl196000 	uint32_t timeout;	/* timeout in sec. */
1520942c5e3cSpl196000 	uint32_t flags;
1521942c5e3cSpl196000 	uint32_t count;		/* data xfer size */
1522942c5e3cSpl196000 	uint32_t retry_limit;	/* obsolete */
1523942c5e3cSpl196000 	uint32_t cdb_size;
1524942c5e3cSpl196000 	uint8_t cdb[16];
1525942c5e3cSpl196000 	struct aac_sg_table sg;
1526942c5e3cSpl196000 };
1527942c5e3cSpl196000 
1528942c5e3cSpl196000 #define	AAC_SENSE_BUFFERSIZE	 30
1529942c5e3cSpl196000 
1530942c5e3cSpl196000 struct aac_srb_reply
1531942c5e3cSpl196000 {
1532942c5e3cSpl196000 	uint32_t status;
1533942c5e3cSpl196000 	uint32_t srb_status;
1534942c5e3cSpl196000 	uint32_t scsi_status;
1535942c5e3cSpl196000 	uint32_t data_xfer_length;
1536942c5e3cSpl196000 	uint32_t sense_data_size;
153758bc78c7SXin Chen 	uint8_t sense_data[AAC_SENSE_BUFFERSIZE];
1538942c5e3cSpl196000 };
1539942c5e3cSpl196000 
1540942c5e3cSpl196000 /*
1541942c5e3cSpl196000  * SRB Flags
1542942c5e3cSpl196000  */
1543942c5e3cSpl196000 #define	SRB_NoDataXfer			0x0000
1544942c5e3cSpl196000 #define	SRB_DisableDisconnect		0x0004
1545942c5e3cSpl196000 #define	SRB_DisableSynchTransfer	0x0008
1546942c5e3cSpl196000 #define	SRB_BypassFrozenQueue		0x0010
1547942c5e3cSpl196000 #define	SRB_DisableAutosense		0x0020
1548942c5e3cSpl196000 #define	SRB_DataIn			0x0040
1549942c5e3cSpl196000 #define	SRB_DataOut			0x0080
1550942c5e3cSpl196000 
1551942c5e3cSpl196000 /*
1552942c5e3cSpl196000  * SRB Functions - set in aac_srb->function
1553942c5e3cSpl196000  */
1554942c5e3cSpl196000 #define	SRBF_ExecuteScsi		0x0000
1555942c5e3cSpl196000 #define	SRBF_ClaimDevice		0x0001
1556942c5e3cSpl196000 #define	SRBF_IO_Control			0x0002
1557942c5e3cSpl196000 #define	SRBF_ReceiveEvent		0x0003
1558942c5e3cSpl196000 #define	SRBF_ReleaseQueue		0x0004
1559942c5e3cSpl196000 #define	SRBF_AttachDevice		0x0005
1560942c5e3cSpl196000 #define	SRBF_ReleaseDevice		0x0006
1561942c5e3cSpl196000 #define	SRBF_Shutdown			0x0007
1562942c5e3cSpl196000 #define	SRBF_Flush			0x0008
1563942c5e3cSpl196000 #define	SRBF_AbortCommand		0x0010
1564942c5e3cSpl196000 #define	SRBF_ReleaseRecovery		0x0011
1565942c5e3cSpl196000 #define	SRBF_ResetBus			0x0012
1566942c5e3cSpl196000 #define	SRBF_ResetDevice		0x0013
1567942c5e3cSpl196000 #define	SRBF_TerminateIO		0x0014
1568942c5e3cSpl196000 #define	SRBF_FlushQueue			0x0015
1569942c5e3cSpl196000 #define	SRBF_RemoveDevice		0x0016
1570942c5e3cSpl196000 #define	SRBF_DomainValidation		0x0017
1571942c5e3cSpl196000 
1572942c5e3cSpl196000 /*
1573942c5e3cSpl196000  * SRB SCSI Status
1574942c5e3cSpl196000  * Status codes for SCSI passthrough commands,
1575942c5e3cSpl196000  * set in aac_srb->scsi_status
1576942c5e3cSpl196000  */
1577942c5e3cSpl196000 #define	SRB_STATUS_PENDING			0x00
1578942c5e3cSpl196000 #define	SRB_STATUS_SUCCESS			0x01
1579942c5e3cSpl196000 #define	SRB_STATUS_ABORTED			0x02
1580942c5e3cSpl196000 #define	SRB_STATUS_ABORT_FAILED			0x03
1581942c5e3cSpl196000 #define	SRB_STATUS_ERROR			0x04
1582942c5e3cSpl196000 #define	SRB_STATUS_BUSY				0x05
1583942c5e3cSpl196000 #define	SRB_STATUS_INVALID_REQUEST		0x06
1584942c5e3cSpl196000 #define	SRB_STATUS_INVALID_PATH_ID		0x07
1585942c5e3cSpl196000 #define	SRB_STATUS_NO_DEVICE			0x08
1586942c5e3cSpl196000 #define	SRB_STATUS_TIMEOUT			0x09
1587942c5e3cSpl196000 #define	SRB_STATUS_SELECTION_TIMEOUT		0x0A
1588942c5e3cSpl196000 #define	SRB_STATUS_COMMAND_TIMEOUT		0x0B
1589942c5e3cSpl196000 #define	SRB_STATUS_MESSAGE_REJECTED		0x0D
1590942c5e3cSpl196000 #define	SRB_STATUS_BUS_RESET			0x0E
1591942c5e3cSpl196000 #define	SRB_STATUS_PARITY_ERROR			0x0F
1592942c5e3cSpl196000 #define	SRB_STATUS_REQUEST_SENSE_FAILED		0x10
1593942c5e3cSpl196000 #define	SRB_STATUS_NO_HBA			0x11
1594942c5e3cSpl196000 #define	SRB_STATUS_DATA_OVERRUN			0x12
1595942c5e3cSpl196000 #define	SRB_STATUS_UNEXPECTED_BUS_FREE		0x13
1596942c5e3cSpl196000 #define	SRB_STATUS_PHASE_SEQUENCE_FAILURE	0x14
1597942c5e3cSpl196000 #define	SRB_STATUS_BAD_SRB_BLOCK_LENGTH		0x15
1598942c5e3cSpl196000 #define	SRB_STATUS_REQUEST_FLUSHED		0x16
1599942c5e3cSpl196000 #define	SRB_STATUS_DELAYED_RETRY		0x17
1600942c5e3cSpl196000 #define	SRB_STATUS_INVALID_LUN			0x20
1601942c5e3cSpl196000 #define	SRB_STATUS_INVALID_TARGET_ID		0x21
1602942c5e3cSpl196000 #define	SRB_STATUS_BAD_FUNCTION			0x22
1603942c5e3cSpl196000 #define	SRB_STATUS_ERROR_RECOVERY		0x23
1604942c5e3cSpl196000 #define	SRB_STATUS_NOT_STARTED			0x24
1605942c5e3cSpl196000 #define	SRB_STATUS_NOT_IN_USE			0x30
1606942c5e3cSpl196000 #define	SRB_STATUS_FORCE_ABORT			0x31
1607942c5e3cSpl196000 #define	SRB_STATUS_DOMAIN_VALIDATION_FAIL	0x32
1608942c5e3cSpl196000 
1609942c5e3cSpl196000 #pragma	pack()
1610942c5e3cSpl196000 
1611942c5e3cSpl196000 /*
1612942c5e3cSpl196000  * Aligned structure definition for variable declarations that require
1613942c5e3cSpl196000  * alignment.
1614942c5e3cSpl196000  */
1615942c5e3cSpl196000 union aac_fib_align {
1616942c5e3cSpl196000 	struct aac_fib d;
1617942c5e3cSpl196000 	uint32_t dumb;
1618942c5e3cSpl196000 };
1619942c5e3cSpl196000 
1620942c5e3cSpl196000 /* AAC Communication Space */
1621942c5e3cSpl196000 struct aac_comm_space {
1622942c5e3cSpl196000 	struct aac_fib adapter_fibs[AAC_ADAPTER_FIBS];
1623942c5e3cSpl196000 	struct aac_adapter_init init_data;
1624942c5e3cSpl196000 	struct aac_queue_table qtable;
1625942c5e3cSpl196000 	char qt_align_pad[AAC_QUEUE_ALIGN];
1626942c5e3cSpl196000 	char adapter_print_buf[AAC_ADAPTER_PRINT_BUFSIZE];
1627942c5e3cSpl196000 };
1628942c5e3cSpl196000 
1629942c5e3cSpl196000 #ifdef	__cplusplus
1630942c5e3cSpl196000 }
1631942c5e3cSpl196000 #endif
1632942c5e3cSpl196000 
1633942c5e3cSpl196000 #endif /* __AAC_REGS_H__ */
1634