xref: /illumos-gate/usr/src/uts/common/io/aac/aac_regs.h (revision 3fced439)
17c478bd9Sstevel@tonic-gate /*
2*3fced439Szhongyan gu - Sun Microsystems - Beijing China  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
37c478bd9Sstevel@tonic-gate  */
4830d82f7Spl 
57c478bd9Sstevel@tonic-gate /*
6830d82f7Spl  * Copyright 2005-06 Adaptec, Inc.
7830d82f7Spl  * Copyright (c) 2005-06 Adaptec Inc., Achim Leubner
87c478bd9Sstevel@tonic-gate  * Copyright (c) 2000 Michael Smith
97c478bd9Sstevel@tonic-gate  * Copyright (c) 2000-2001 Scott Long
107c478bd9Sstevel@tonic-gate  * Copyright (c) 2000 BSDi
117c478bd9Sstevel@tonic-gate  * All rights reserved.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
147c478bd9Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
157c478bd9Sstevel@tonic-gate  * are met:
167c478bd9Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
177c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
187c478bd9Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
197c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
207c478bd9Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
217c478bd9Sstevel@tonic-gate  *
227c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
237c478bd9Sstevel@tonic-gate  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
247c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
257c478bd9Sstevel@tonic-gate  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
267c478bd9Sstevel@tonic-gate  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
277c478bd9Sstevel@tonic-gate  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
287c478bd9Sstevel@tonic-gate  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
297c478bd9Sstevel@tonic-gate  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
307c478bd9Sstevel@tonic-gate  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
317c478bd9Sstevel@tonic-gate  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
327c478bd9Sstevel@tonic-gate  * SUCH DAMAGE.
337c478bd9Sstevel@tonic-gate  *
34830d82f7Spl  *    $FreeBSD: src/sys/dev/aac/aacreg.h,v 1.23 2005/10/14 16:22:45 scottl Exp $
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #ifndef	__AAC_REGS_H__
387c478bd9Sstevel@tonic-gate #define	__AAC_REGS_H__
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
417c478bd9Sstevel@tonic-gate extern "C" {
427c478bd9Sstevel@tonic-gate #endif
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /* Status bits in the doorbell registers */
457c478bd9Sstevel@tonic-gate #define	AAC_DB_SYNC_COMMAND		(1<<0)	/* send/completed synchronous */
467c478bd9Sstevel@tonic-gate 						/* FIB */
477c478bd9Sstevel@tonic-gate #define	AAC_DB_COMMAND_READY		(1<<1)	/* posted one or more */
487c478bd9Sstevel@tonic-gate 						/* commands */
497c478bd9Sstevel@tonic-gate #define	AAC_DB_RESPONSE_READY		(1<<2)	/* one or more commands	*/
507c478bd9Sstevel@tonic-gate 						/* complete */
517c478bd9Sstevel@tonic-gate #define	AAC_DB_COMMAND_NOT_FULL		(1<<3)	/* command queue not full */
527c478bd9Sstevel@tonic-gate #define	AAC_DB_RESPONSE_NOT_FULL	(1<<4)	/* response queue not full */
537c478bd9Sstevel@tonic-gate #define	AAC_DB_PRINTF_READY		(1<<5)	/* adapter requests host */
547c478bd9Sstevel@tonic-gate 						/* printf */
557c478bd9Sstevel@tonic-gate #define	AAC_DB_INTR_BITS (AAC_DB_COMMAND_READY | \
56830d82f7Spl 	AAC_DB_RESPONSE_READY | AAC_DB_PRINTF_READY)
57830d82f7Spl #define	AAC_DB_INTR_NEW			0x08
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate /* Status bits in firmware status reg */
60830d82f7Spl #define	AAC_SELF_TEST_FAILED		0x00000004
61830d82f7Spl #define	AAC_MONITOR_PANIC		0x00000020
62830d82f7Spl #define	AAC_KERNEL_UP_AND_RUNNING	0x00000080
63830d82f7Spl #define	AAC_KERNEL_PANIC		0x00000100
647c478bd9Sstevel@tonic-gate 
65830d82f7Spl /* aac registers definitions */
66830d82f7Spl #define	AAC_OMR0		0x18	/* outbound message register 0 */
67830d82f7Spl #define	AAC_OMR1		0x1c	/* outbound message register 1 */
687c478bd9Sstevel@tonic-gate #define	AAC_IDBR		0x20	/* inbound doorbell reg */
697c478bd9Sstevel@tonic-gate #define	AAC_ODBR		0x2c	/* outbound doorbell reg */
707c478bd9Sstevel@tonic-gate #define	AAC_OIMR		0x34	/* outbound interrupt mask reg */
71382c8bcaSpl #define	AAC_IRCSR		0x38	/* inbound dual cores reset (SRL) */
72830d82f7Spl #define	AAC_IQUE		0x40	/* inbound queue */
73830d82f7Spl #define	AAC_OQUE		0x44	/* outbound queue */
74830d82f7Spl #define	AAC_RX_MAILBOX		0x50	/* mailbox, size=20bytes, rx */
75830d82f7Spl #define	AAC_RX_FWSTATUS		0x6c	/* firmware status, rx */
76830d82f7Spl #define	AAC_RKT_MAILBOX		0x1000	/* mailbox, size=20bytes, rkt */
77830d82f7Spl #define	AAC_RKT_FWSTATUS	0x101c	/* firmware status, rkt */
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /* Synchronous commands to the monitor/kernel. */
80830d82f7Spl #define	AAC_BREAKPOINT_REQ	0x04
817c478bd9Sstevel@tonic-gate #define	AAC_MONKER_INITSTRUCT	0x05
827c478bd9Sstevel@tonic-gate #define	AAC_MONKER_SYNCFIB	0x0c
837c478bd9Sstevel@tonic-gate #define	AAC_MONKER_GETKERNVER	0x11
847c478bd9Sstevel@tonic-gate #define	AAC_MONKER_GETINFO	0x19
851dd0a2dbSpl #define	AAC_MONKER_GETDRVPROP	0x23
86830d82f7Spl #define	AAC_MONKER_GETCOMMPREF	0x26
87830d82f7Spl #define	AAC_IOP_RESET		0x1000
887c478bd9Sstevel@tonic-gate 
89382c8bcaSpl /* Sunrise Lake dual core reset */
90382c8bcaSpl #define	AAC_IRCSR_CORES_RST	3
91382c8bcaSpl 
92c9487164Spl #define	AAC_SECTOR_SIZE		512
93c9487164Spl #define	AAC_NUMBER_OF_HEADS	255
94c9487164Spl #define	AAC_SECTORS_PER_TRACK	63
95c9487164Spl #define	AAC_ROTATION_SPEED	10000
96c9487164Spl #define	AAC_MAX_PFN		0xfffff
97c9487164Spl 
98c9487164Spl #define	AAC_ADDITIONAL_LEN	31
99c9487164Spl #define	AAC_ANSI_VER		2
100c9487164Spl #define	AAC_RESP_DATA_FORMAT	2
101c9487164Spl 
1027c478bd9Sstevel@tonic-gate #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)))
105c9487164Spl #define	AAC_BLK_SIZE		AAC_SECTOR_SIZE
106830d82f7Spl #define	AAC_DMA_ALIGN		4
107830d82f7Spl #define	AAC_DMA_ALIGN_MASK	(AAC_DMA_ALIGN - 1)
108830d82f7Spl 
109c9487164Spl #define	AAC_MAX_CONTAINERS	AAC_MAX_LD
110830d82f7Spl 
111830d82f7Spl /*
112830d82f7Spl  * Minimum memory sizes we need to map to address the adapter. Before
113830d82f7Spl  * we know the actual size to map, minimum memory is used instead.
114830d82f7Spl  */
115830d82f7Spl #define	AAC_MAP_SIZE_MIN_RX	4096
116830d82f7Spl #define	AAC_MAP_SIZE_MIN_RKT	8192
117830d82f7Spl 
118830d82f7Spl /*
119830d82f7Spl  * Options supported by the adapter
120830d82f7Spl  */
121830d82f7Spl #define	AAC_SUPPORTED_SNAPSHOT			0x01
122830d82f7Spl #define	AAC_SUPPORTED_CLUSTERS			0x02
123830d82f7Spl #define	AAC_SUPPORTED_WRITE_CACHE		0x04
124830d82f7Spl #define	AAC_SUPPORTED_64BIT_DATA		0x08
125830d82f7Spl #define	AAC_SUPPORTED_HOST_TIME_FIB		0x10
126830d82f7Spl #define	AAC_SUPPORTED_RAID50			0x20
127830d82f7Spl #define	AAC_SUPPORTED_4GB_WINDOW		0x40
128830d82f7Spl #define	AAC_SUPPORTED_SCSI_UPGRADEABLE		0x80
129830d82f7Spl #define	AAC_SUPPORTED_SOFT_ERR_REPORT		0x100
130830d82f7Spl #define	AAC_SUPPORTED_NOT_RECONDITION		0x200
131830d82f7Spl #define	AAC_SUPPORTED_SGMAP_HOST64		0x400
132830d82f7Spl #define	AAC_SUPPORTED_ALARM			0x800
133830d82f7Spl #define	AAC_SUPPORTED_NONDASD			0x1000
134830d82f7Spl #define	AAC_SUPPORTED_SCSI_MANAGED		0x2000
135830d82f7Spl #define	AAC_SUPPORTED_RAID_SCSI_MODE		0x4000
136830d82f7Spl #define	AAC_SUPPORTED_SUPPLEMENT_ADAPTER_INFO	0x10000
137830d82f7Spl #define	AAC_SUPPORTED_NEW_COMM			0x20000
138830d82f7Spl #define	AAC_SUPPORTED_64BIT_ARRAYSIZE		0x40000
139830d82f7Spl #define	AAC_SUPPORTED_HEAT_SENSOR		0x80000
1407c478bd9Sstevel@tonic-gate 
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 
1537c478bd9Sstevel@tonic-gate #pragma	pack(1)
1547c478bd9Sstevel@tonic-gate 
1557c478bd9Sstevel@tonic-gate /*
156830d82f7Spl  * FIB (FSA Interface Block) this is the data structure passed between
1577c478bd9Sstevel@tonic-gate  * the host and adapter.
1587c478bd9Sstevel@tonic-gate  */
1597c478bd9Sstevel@tonic-gate struct aac_fib_header {
1607c478bd9Sstevel@tonic-gate 	uint32_t	XferState;
1617c478bd9Sstevel@tonic-gate 	uint16_t	Command;
1627c478bd9Sstevel@tonic-gate 	uint8_t		StructType;
1637c478bd9Sstevel@tonic-gate 	uint8_t		Flags;
1647c478bd9Sstevel@tonic-gate 	uint16_t	Size;
1657c478bd9Sstevel@tonic-gate 	uint16_t	SenderSize;
1667c478bd9Sstevel@tonic-gate 	uint32_t	SenderFibAddress;
1677c478bd9Sstevel@tonic-gate 	uint32_t	ReceiverFibAddress;
1687c478bd9Sstevel@tonic-gate 	uint32_t	SenderData;
1697c478bd9Sstevel@tonic-gate 	int prev;
1707c478bd9Sstevel@tonic-gate 	int next;
1717c478bd9Sstevel@tonic-gate };
1727c478bd9Sstevel@tonic-gate 
173a9f097b0Spl /* FIB completed without error or no data was transferred in the FIB */
174a9f097b0Spl #define	AAC_SENDERADDR_MASK_FAST_RESPONSE	0x01
175a9f097b0Spl /* The received FIB is an AIF */
176a9f097b0Spl #define	AAC_SENDERADDR_MASK_AIF			0x02
177a9f097b0Spl 
1787c478bd9Sstevel@tonic-gate #define	AAC_FIB_SIZE		512 /* size of a fib block in byte */
1797c478bd9Sstevel@tonic-gate #define	AAC_FIB_DATASIZE	(AAC_FIB_SIZE - sizeof (struct aac_fib_header))
1807c478bd9Sstevel@tonic-gate 
1817c478bd9Sstevel@tonic-gate struct aac_fib {
1827c478bd9Sstevel@tonic-gate 	struct aac_fib_header	Header;
1837c478bd9Sstevel@tonic-gate 	uint8_t data[AAC_FIB_DATASIZE];
1847c478bd9Sstevel@tonic-gate };
1857c478bd9Sstevel@tonic-gate 
186830d82f7Spl /* FIB transfer state */
1877c478bd9Sstevel@tonic-gate #define	AAC_FIBSTATE_HOSTOWNED		(1<<0)	/* owned by the host */
1887c478bd9Sstevel@tonic-gate #define	AAC_FIBSTATE_ADAPTEROWNED	(1<<1)	/* owned by the adapter */
1897c478bd9Sstevel@tonic-gate #define	AAC_FIBSTATE_INITIALISED	(1<<2)	/* has been initialised */
1907c478bd9Sstevel@tonic-gate #define	AAC_FIBSTATE_EMPTY		(1<<3)	/* is empty now */
1917c478bd9Sstevel@tonic-gate #define	AAC_FIBSTATE_FROMHOST		(1<<5)	/* sent from the host */
192830d82f7Spl #define	AAC_FIBSTATE_FROMADAP		(1<<6)	/* sent from the adapter */
1937c478bd9Sstevel@tonic-gate #define	AAC_FIBSTATE_REXPECTED		(1<<7)	/* response is expected */
194830d82f7Spl #define	AAC_FIBSTATE_NOREXPECTED	(1<<8)	/* no response is expected */
195830d82f7Spl #define	AAC_FIBSTATE_DONEADAP		(1<<9)	/* processed by the adapter */
196830d82f7Spl #define	AAC_FIBSTATE_DONEHOST		(1<<10)	/* processed by the host */
1977c478bd9Sstevel@tonic-gate #define	AAC_FIBSTATE_NORM		(1<<12)	/* normal priority */
1987c478bd9Sstevel@tonic-gate #define	AAC_FIBSTATE_ASYNC		(1<<13)
199830d82f7Spl #define	AAC_FIBSTATE_FAST_RESPONSE	(1<<19)	/* fast response capable */
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate /* FIB types */
202830d82f7Spl #define	AAC_FIBTYPE_TFIB		1
203830d82f7Spl 
204830d82f7Spl /*
205830d82f7Spl  * FIB commands
206830d82f7Spl  */
207830d82f7Spl 
208830d82f7Spl #define	TestCommandResponse		1
209830d82f7Spl #define	TestAdapterCommand		2
210830d82f7Spl /* Lowlevel and comm commands */
211830d82f7Spl #define	LastTestCommand			100
212830d82f7Spl #define	ReinitHostNormCommandQueue	101
213830d82f7Spl #define	ReinitHostHighCommandQueue	102
214830d82f7Spl #define	ReinitHostHighRespQueue		103
215830d82f7Spl #define	ReinitHostNormRespQueue		104
216830d82f7Spl #define	ReinitAdapNormCommandQueue	105
217830d82f7Spl #define	ReinitAdapHighCommandQueue	107
218830d82f7Spl #define	ReinitAdapHighRespQueue		108
219830d82f7Spl #define	ReinitAdapNormRespQueue		109
220830d82f7Spl #define	InterfaceShutdown		110
221830d82f7Spl #define	DmaCommandFib			120
222830d82f7Spl #define	StartProfile			121
223830d82f7Spl #define	TermProfile			122
224830d82f7Spl #define	SpeedTest			123
225830d82f7Spl #define	TakeABreakPt			124
226830d82f7Spl #define	RequestPerfData			125
227830d82f7Spl #define	SetInterruptDefTimer		126
228830d82f7Spl #define	SetInterruptDefCount		127
229830d82f7Spl #define	GetInterruptDefStatus		128
230830d82f7Spl #define	LastCommCommand			129
231830d82f7Spl /* Filesystem commands */
232830d82f7Spl #define	NuFileSystem			300
233830d82f7Spl #define	UFS				301
234830d82f7Spl #define	HostFileSystem			302
235830d82f7Spl #define	LastFileSystemCommand		303
236830d82f7Spl /* Container commands */
237830d82f7Spl #define	ContainerCommand		500
238830d82f7Spl #define	ContainerCommand64		501
239830d82f7Spl #define	RawIo				502
240830d82f7Spl /* Cluster commands */
241830d82f7Spl #define	ClusterCommand			550
242830d82f7Spl /* Scsi Port commands (scsi passthrough) */
243830d82f7Spl #define	ScsiPortCommand			600
244830d82f7Spl #define	ScsiPortCommandU64		601
245830d82f7Spl /* Misc house keeping and generic adapter initiated commands */
246830d82f7Spl #define	AifRequest			700
247830d82f7Spl #define	CheckRevision			701
248830d82f7Spl #define	FsaHostShutdown			702
249830d82f7Spl #define	RequestAdapterInfo		703
250830d82f7Spl #define	IsAdapterPaused			704
251830d82f7Spl #define	SendHostTime			705
252830d82f7Spl #define	RequestSupplementAdapterInfo	706
253830d82f7Spl #define	LastMiscCommand			707
254830d82f7Spl #define	OnLineDiagnostic		800
255830d82f7Spl #define	FduAdapterTest			801
2567c478bd9Sstevel@tonic-gate 
257d937e6ebSpl /*
258d937e6ebSpl  * Revision number handling
259d937e6ebSpl  */
2607c478bd9Sstevel@tonic-gate struct FsaRev {
2617c478bd9Sstevel@tonic-gate 	union {
2627c478bd9Sstevel@tonic-gate 		struct {
2637c478bd9Sstevel@tonic-gate 			uint8_t	dash;
2647c478bd9Sstevel@tonic-gate 			uint8_t	type;
2657c478bd9Sstevel@tonic-gate 			uint8_t	minor;
2667c478bd9Sstevel@tonic-gate 			uint8_t	major;
2677c478bd9Sstevel@tonic-gate 		} comp;
2687c478bd9Sstevel@tonic-gate 		uint32_t ul;
2697c478bd9Sstevel@tonic-gate 	} external;
2707c478bd9Sstevel@tonic-gate 	uint32_t buildNumber;
2717c478bd9Sstevel@tonic-gate };
2727c478bd9Sstevel@tonic-gate 
273d937e6ebSpl /*
274d937e6ebSpl  * Structures used to respond to a RequestAdapterInfo FIB
275d937e6ebSpl  */
2767c478bd9Sstevel@tonic-gate struct aac_adapter_info {
2777c478bd9Sstevel@tonic-gate 	uint32_t	PlatformBase;	/* adapter type */
2787c478bd9Sstevel@tonic-gate 	uint32_t	CpuArchitecture; /* adapter CPU type */
2797c478bd9Sstevel@tonic-gate 	uint32_t	CpuVariant;	/* adapter CPU subtype */
2807c478bd9Sstevel@tonic-gate 	uint32_t	ClockSpeed;	/* adapter CPU clockspeed */
2817c478bd9Sstevel@tonic-gate 	uint32_t	ExecutionMem;	/* adapter Execution Memory size */
2827c478bd9Sstevel@tonic-gate 	uint32_t	BufferMem;	/* adapter Data Memory */
2837c478bd9Sstevel@tonic-gate 	uint32_t	TotalMem;	/* adapter Total Memory */
2847c478bd9Sstevel@tonic-gate 	struct FsaRev	KernelRevision;	/* adapter Kernel Software Revision */
2857c478bd9Sstevel@tonic-gate 	struct FsaRev	MonitorRevision; /* adapter Monitor Software Revision */
2867c478bd9Sstevel@tonic-gate 	struct FsaRev	HardwareRevision;
2877c478bd9Sstevel@tonic-gate 	struct FsaRev	BIOSRevision;	/* adapter BIOS Revision */
2887c478bd9Sstevel@tonic-gate 	uint32_t	ClusteringEnabled;
2897c478bd9Sstevel@tonic-gate 	uint32_t	ClusterChannelMask;
2907c478bd9Sstevel@tonic-gate 	uint64_t	SerialNumber;
2917c478bd9Sstevel@tonic-gate 	uint32_t	batteryPlatform;
2927c478bd9Sstevel@tonic-gate 	uint32_t	SupportedOptions; /* supported features */
2937c478bd9Sstevel@tonic-gate 	uint32_t	OemVariant;
2947c478bd9Sstevel@tonic-gate };
2957c478bd9Sstevel@tonic-gate 
296d937e6ebSpl /*
297d937e6ebSpl  * The following definitions on Supplement Adapter Information
298d937e6ebSpl  * come from Adaptec:
299d937e6ebSpl  */
300d937e6ebSpl struct vpd_info {
301d937e6ebSpl 	uint8_t		AssemblyPn[8];
302d937e6ebSpl 	uint8_t		FruPn[8];
303d937e6ebSpl 	uint8_t		BatteryFruPn[8];
304d937e6ebSpl 	uint8_t		EcVersionString[8];
305d937e6ebSpl 	uint8_t		Tsid[12];
306d937e6ebSpl };
307d937e6ebSpl 
308d937e6ebSpl #define	MFG_PCBA_SERIAL_NUMBER_WIDTH	12
309d937e6ebSpl #define	MFG_WWN_WIDTH			8
310d937e6ebSpl 
311d937e6ebSpl struct aac_supplement_adapter_info {
312d937e6ebSpl 	/* The assigned Adapter Type Text, extra byte for null termination */
313d937e6ebSpl 	int8_t		AdapterTypeText[17+1];
314d937e6ebSpl 	/* Pad for the text above */
315d937e6ebSpl 	int8_t		Pad[2];
316d937e6ebSpl 	/* Size in bytes of the memory that is flashed */
317d937e6ebSpl 	uint32_t	FlashMemoryByteSize;
318d937e6ebSpl 	/* The assigned IMAGEID_xxx for this adapter */
319d937e6ebSpl 	uint32_t	FlashImageId;
320d937e6ebSpl 	/*
321d937e6ebSpl 	 * The maximum number of Phys available on a SATA/SAS
322d937e6ebSpl 	 * Controller, 0 otherwise
323d937e6ebSpl 	 */
324d937e6ebSpl 	uint32_t	MaxNumberPorts;
325d937e6ebSpl 	/* Version of expansion area */
326d937e6ebSpl 	uint32_t	Version;
327d937e6ebSpl 	uint32_t	FeatureBits;
328d937e6ebSpl 	uint8_t		SlotNumber;
329d937e6ebSpl 	uint8_t		ReservedPad0[3];
330d937e6ebSpl 	uint8_t		BuildDate[12];
331d937e6ebSpl 	/* The current number of Ports on a SAS controller, 0 otherwise */
332d937e6ebSpl 	uint32_t	CurrentNumberPorts;
333d937e6ebSpl 
334d937e6ebSpl 	struct vpd_info VpdInfo;
335d937e6ebSpl 
336d937e6ebSpl 	/* Firmware Revision (Vmaj.min-dash.) */
337d937e6ebSpl 	struct FsaRev	FlashFirmwareRevision;
338d937e6ebSpl 	uint32_t	RaidTypeMorphOptions;
339d937e6ebSpl 	/* Firmware's boot code Revision (Vmaj.min-dash.) */
340d937e6ebSpl 	struct FsaRev	FlashFirmwareBootRevision;
341d937e6ebSpl 	/* PCBA serial no. from th MFG sector */
342d937e6ebSpl 	uint8_t		MfgPcbaSerialNo[MFG_PCBA_SERIAL_NUMBER_WIDTH];
343d937e6ebSpl 	/* WWN from the MFG sector */
344d937e6ebSpl 	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];
351d937e6ebSpl };
352d937e6ebSpl 
3537c478bd9Sstevel@tonic-gate /* Container creation data */
3547c478bd9Sstevel@tonic-gate struct aac_container_creation {
3557c478bd9Sstevel@tonic-gate 	uint8_t		ViaBuildNumber;
3567c478bd9Sstevel@tonic-gate 	uint8_t		MicroSecond;
3577c478bd9Sstevel@tonic-gate 	uint8_t		Via;		/* 1 = FSU, 2 = API, etc */
3587c478bd9Sstevel@tonic-gate 	uint8_t		Years;		/* Since1900 */
3597c478bd9Sstevel@tonic-gate 	uint32_t	Month:4;	/* 1-12 */
3607c478bd9Sstevel@tonic-gate 	uint32_t	Day:6;		/* 1-32 */
3617c478bd9Sstevel@tonic-gate 	uint32_t	Hour:6;		/* 0-23 */
3627c478bd9Sstevel@tonic-gate 	uint32_t	Minute:6;	/* 0-59 */
3637c478bd9Sstevel@tonic-gate 	uint32_t	Second:6;	/* 0-59 */
3647c478bd9Sstevel@tonic-gate 	uint64_t	ViaAdapterSerialNumber;
3657c478bd9Sstevel@tonic-gate };
3667c478bd9Sstevel@tonic-gate 
3677c478bd9Sstevel@tonic-gate struct aac_mntobj {
368830d82f7Spl 	uint32_t		ObjectId;
369830d82f7Spl 	char			FileSystemName[16];
3707c478bd9Sstevel@tonic-gate 	struct aac_container_creation	CreateInfo;
371830d82f7Spl 	uint32_t		Capacity;
372830d82f7Spl 	uint32_t		VolType;
373830d82f7Spl 	uint32_t		ObjType;
374830d82f7Spl 	uint32_t		ContentState;
3757c478bd9Sstevel@tonic-gate 	union {
376830d82f7Spl 		uint32_t	pad[8];
3777c478bd9Sstevel@tonic-gate 	} ObjExtension;
378830d82f7Spl 	uint32_t		AlterEgoId;
379830d82f7Spl 
380830d82f7Spl 	uint32_t		CapacityHigh; /* 64-bit LBA */
3817c478bd9Sstevel@tonic-gate };
3827c478bd9Sstevel@tonic-gate 
3837c478bd9Sstevel@tonic-gate struct aac_mntinfo {
3847c478bd9Sstevel@tonic-gate 	uint32_t	Command;
3857c478bd9Sstevel@tonic-gate 	uint32_t	MntType;
3867c478bd9Sstevel@tonic-gate 	uint32_t	MntCount;
3877c478bd9Sstevel@tonic-gate };
3887c478bd9Sstevel@tonic-gate 
3897c478bd9Sstevel@tonic-gate struct aac_mntinforesp {
3907c478bd9Sstevel@tonic-gate 	uint32_t		Status;
3917c478bd9Sstevel@tonic-gate 	uint32_t		MntType;
3927c478bd9Sstevel@tonic-gate 	uint32_t		MntRespCount;
3937c478bd9Sstevel@tonic-gate 	struct aac_mntobj	MntObj;
3947c478bd9Sstevel@tonic-gate };
3957c478bd9Sstevel@tonic-gate 
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 
420830d82f7Spl #define	CT_FIB_PARAMS			6
421830d82f7Spl #define	MAX_FIB_PARAMS			10
422830d82f7Spl #define	CT_PACKET_SIZE \
423830d82f7Spl 	(AAC_FIB_DATASIZE - sizeof (uint32_t) - \
424830d82f7Spl 	((sizeof (uint32_t)) * (MAX_FIB_PARAMS + 1)))
425830d82f7Spl 
426830d82f7Spl #define	CNT_SIZE			5
427830d82f7Spl 
428830d82f7Spl /* Container types */
429d937e6ebSpl typedef enum {
430d937e6ebSpl 	CT_NONE = 0,
431d937e6ebSpl 	CT_VOLUME,
432d937e6ebSpl 	CT_MIRROR,
433d937e6ebSpl 	CT_STRIPE,
434d937e6ebSpl 	CT_RAID5,
435d937e6ebSpl 	CT_SSRW,
436d937e6ebSpl 	CT_SSRO,
437d937e6ebSpl 	CT_MORPH,
438d937e6ebSpl 	CT_PASSTHRU,
439d937e6ebSpl 	CT_RAID4,
440d937e6ebSpl 	CT_RAID10,		/* stripe of mirror */
441d937e6ebSpl 	CT_RAID00,		/* stripe of stripe */
442d937e6ebSpl 	CT_VOLUME_OF_MIRRORS,	/* volume of mirror */
443d937e6ebSpl 	CT_PSEUDO_RAID3,	/* really raid4 */
444d937e6ebSpl 	CT_RAID50,		/* stripe of raid5 */
445d937e6ebSpl 	CT_RAID5D,		/* raid5 distributed hot-sparing */
446d937e6ebSpl 	CT_RAID5D0,
447d937e6ebSpl 	CT_RAID1E,		/* extended raid1 mirroring */
448d937e6ebSpl 	CT_RAID6,
449d937e6ebSpl 	CT_RAID60
450d937e6ebSpl } AAC_FSAVolType;
451830d82f7Spl 
452830d82f7Spl /*
453830d82f7Spl  * Container Configuration Sub-Commands
454830d82f7Spl  */
455830d82f7Spl typedef enum {
456830d82f7Spl 	CT_Null = 0,
457830d82f7Spl 	CT_GET_SLICE_COUNT,		/* 1 */
458830d82f7Spl 	CT_GET_PARTITION_COUNT,		/* 2 */
459830d82f7Spl 	CT_GET_PARTITION_INFO,		/* 3 */
460830d82f7Spl 	CT_GET_CONTAINER_COUNT,		/* 4 */
461830d82f7Spl 	CT_GET_CONTAINER_INFO_OLD,	/* 5 */
462830d82f7Spl 	CT_WRITE_MBR,			/* 6 */
463830d82f7Spl 	CT_WRITE_PARTITION,		/* 7 */
464830d82f7Spl 	CT_UPDATE_PARTITION,		/* 8 */
465830d82f7Spl 	CT_UNLOAD_CONTAINER,		/* 9 */
466830d82f7Spl 	CT_CONFIG_SINGLE_PRIMARY,	/* 10 */
467830d82f7Spl 	CT_READ_CONFIG_AGE,		/* 11 */
468830d82f7Spl 	CT_WRITE_CONFIG_AGE,		/* 12 */
469830d82f7Spl 	CT_READ_SERIAL_NUMBER,		/* 13 */
470830d82f7Spl 	CT_ZERO_PAR_ENTRY,		/* 14 */
471830d82f7Spl 	CT_READ_MBR,			/* 15 */
472830d82f7Spl 	CT_READ_PARTITION,		/* 16 */
473830d82f7Spl 	CT_DESTROY_CONTAINER,		/* 17 */
474830d82f7Spl 	CT_DESTROY2_CONTAINER,		/* 18 */
475830d82f7Spl 	CT_SLICE_SIZE,			/* 19 */
476830d82f7Spl 	CT_CHECK_CONFLICTS,		/* 20 */
477830d82f7Spl 	CT_MOVE_CONTAINER,		/* 21 */
478830d82f7Spl 	CT_READ_LAST_DRIVE,		/* 22 */
479830d82f7Spl 	CT_WRITE_LAST_DRIVE,		/* 23 */
480830d82f7Spl 	CT_UNMIRROR,			/* 24 */
481830d82f7Spl 	CT_MIRROR_DELAY,		/* 25 */
482830d82f7Spl 	CT_GEN_MIRROR,			/* 26 */
483830d82f7Spl 	CT_GEN_MIRROR2,			/* 27 */
484830d82f7Spl 	CT_TEST_CONTAINER,		/* 28 */
485830d82f7Spl 	CT_MOVE2,			/* 29 */
486830d82f7Spl 	CT_SPLIT,			/* 30 */
487830d82f7Spl 	CT_SPLIT2,			/* 31 */
488830d82f7Spl 	CT_SPLIT_BROKEN,		/* 32 */
489830d82f7Spl 	CT_SPLIT_BROKEN2,		/* 33 */
490830d82f7Spl 	CT_RECONFIG,			/* 34 */
491830d82f7Spl 	CT_BREAK2,			/* 35 */
492830d82f7Spl 	CT_BREAK,			/* 36 */
493830d82f7Spl 	CT_MERGE2,			/* 37 */
494830d82f7Spl 	CT_MERGE,			/* 38 */
495830d82f7Spl 	CT_FORCE_ERROR,			/* 39 */
496830d82f7Spl 	CT_CLEAR_ERROR,			/* 40 */
497830d82f7Spl 	CT_ASSIGN_FAILOVER,		/* 41 */
498830d82f7Spl 	CT_CLEAR_FAILOVER,		/* 42 */
499830d82f7Spl 	CT_GET_FAILOVER_DATA,		/* 43 */
500830d82f7Spl 	CT_VOLUME_ADD,			/* 44 */
501830d82f7Spl 	CT_VOLUME_ADD2,			/* 45 */
502830d82f7Spl 	CT_MIRROR_STATUS,		/* 46 */
503830d82f7Spl 	CT_COPY_STATUS,			/* 47 */
504830d82f7Spl 	CT_COPY,			/* 48 */
505830d82f7Spl 	CT_UNLOCK_CONTAINER,		/* 49 */
506830d82f7Spl 	CT_LOCK_CONTAINER,		/* 50 */
507830d82f7Spl 	CT_MAKE_READ_ONLY,		/* 51 */
508830d82f7Spl 	CT_MAKE_READ_WRITE,		/* 52 */
509830d82f7Spl 	CT_CLEAN_DEAD,			/* 53 */
510830d82f7Spl 	CT_ABORT_MIRROR_COMMAND,	/* 54 */
511830d82f7Spl 	CT_SET,				/* 55 */
512830d82f7Spl 	CT_GET,				/* 56 */
513830d82f7Spl 	CT_GET_NVLOG_ENTRY,		/* 57 */
514830d82f7Spl 	CT_GET_DELAY,			/* 58 */
515830d82f7Spl 	CT_ZERO_CONTAINER_SPACE,	/* 59 */
516830d82f7Spl 	CT_GET_ZERO_STATUS,		/* 60 */
517830d82f7Spl 	CT_SCRUB,			/* 61 */
518830d82f7Spl 	CT_GET_SCRUB_STATUS,		/* 62 */
519830d82f7Spl 	CT_GET_SLICE_INFO,		/* 63 */
520830d82f7Spl 	CT_GET_SCSI_METHOD,		/* 64 */
521830d82f7Spl 	CT_PAUSE_IO,			/* 65 */
522830d82f7Spl 	CT_RELEASE_IO,			/* 66 */
523830d82f7Spl 	CT_SCRUB2,			/* 67 */
524830d82f7Spl 	CT_MCHECK,			/* 68 */
525830d82f7Spl 	CT_CORRUPT,			/* 69 */
526830d82f7Spl 	CT_GET_TASK_COUNT,		/* 70 */
527830d82f7Spl 	CT_PROMOTE,			/* 71 */
528830d82f7Spl 	CT_SET_DEAD,			/* 72 */
529830d82f7Spl 	CT_CONTAINER_OPTIONS,		/* 73 */
530830d82f7Spl 	CT_GET_NV_PARAM,		/* 74 */
531830d82f7Spl 	CT_GET_PARAM,			/* 75 */
532830d82f7Spl 	CT_NV_PARAM_SIZE,		/* 76 */
533830d82f7Spl 	CT_COMMON_PARAM_SIZE,		/* 77 */
534830d82f7Spl 	CT_PLATFORM_PARAM_SIZE,		/* 78 */
535830d82f7Spl 	CT_SET_NV_PARAM,		/* 79 */
536830d82f7Spl 	CT_ABORT_SCRUB,			/* 80 */
537830d82f7Spl 	CT_GET_SCRUB_ERROR,		/* 81 */
538830d82f7Spl 	CT_LABEL_CONTAINER,		/* 82 */
539830d82f7Spl 	CT_CONTINUE_DATA,		/* 83 */
540830d82f7Spl 	CT_STOP_DATA,			/* 84 */
541830d82f7Spl 	CT_GET_PARTITION_TABLE,		/* 85 */
542830d82f7Spl 	CT_GET_DISK_PARTITIONS,		/* 86 */
543830d82f7Spl 	CT_GET_MISC_STATUS,		/* 87 */
544830d82f7Spl 	CT_GET_CONTAINER_PERF_INFO,	/* 88 */
545830d82f7Spl 	CT_GET_TIME,			/* 89 */
546830d82f7Spl 	CT_READ_DATA,			/* 90 */
547830d82f7Spl 	CT_CTR,				/* 91 */
548830d82f7Spl 	CT_CTL,				/* 92 */
549830d82f7Spl 	CT_DRAINIO,			/* 93 */
550830d82f7Spl 	CT_RELEASEIO,			/* 94 */
551830d82f7Spl 	CT_GET_NVRAM,			/* 95 */
552830d82f7Spl 	CT_GET_MEMORY,			/* 96 */
553830d82f7Spl 	CT_PRINT_CT_LOG,		/* 97 */
554830d82f7Spl 	CT_ADD_LEVEL,			/* 98 */
555830d82f7Spl 	CT_NV_ZERO,			/* 99 */
556830d82f7Spl 	CT_READ_SIGNATURE,		/* 100 */
557830d82f7Spl 	CT_THROTTLE_ON,			/* 101 */
558830d82f7Spl 	CT_THROTTLE_OFF,		/* 102 */
559830d82f7Spl 	CT_GET_THROTTLE_STATS,		/* 103 */
560830d82f7Spl 	CT_MAKE_SNAPSHOT,		/* 104 */
561830d82f7Spl 	CT_REMOVE_SNAPSHOT,		/* 105 */
562830d82f7Spl 	CT_WRITE_USER_FLAGS,		/* 106 */
563830d82f7Spl 	CT_READ_USER_FLAGS,		/* 107 */
564830d82f7Spl 	CT_MONITOR,			/* 108 */
565830d82f7Spl 	CT_GEN_MORPH,			/* 109 */
566830d82f7Spl 	CT_GET_SNAPSHOT_INFO,		/* 110 */
567830d82f7Spl 	CT_CACHE_SET,			/* 111 */
568830d82f7Spl 	CT_CACHE_STAT,			/* 112 */
569830d82f7Spl 	CT_TRACE_START,			/* 113 */
570830d82f7Spl 	CT_TRACE_STOP,			/* 114 */
571830d82f7Spl 	CT_TRACE_ENABLE,		/* 115 */
572830d82f7Spl 	CT_TRACE_DISABLE,		/* 116 */
573830d82f7Spl 	CT_FORCE_CORE_DUMP,		/* 117 */
574830d82f7Spl 	CT_SET_SERIAL_NUMBER,		/* 118 */
575830d82f7Spl 	CT_RESET_SERIAL_NUMBER,		/* 119 */
576830d82f7Spl 	CT_ENABLE_RAID5,		/* 120 */
577830d82f7Spl 	CT_CLEAR_VALID_DUMP_FLAG,	/* 121 */
578830d82f7Spl 	CT_GET_MEM_STATS,		/* 122 */
579830d82f7Spl 	CT_GET_CORE_SIZE,		/* 123 */
580830d82f7Spl 	CT_CREATE_CONTAINER_OLD,	/* 124 */
581830d82f7Spl 	CT_STOP_DUMPS,			/* 125 */
582830d82f7Spl 	CT_PANIC_ON_TAKE_A_BREAK,	/* 126 */
583830d82f7Spl 	CT_GET_CACHE_STATS,		/* 127 */
584830d82f7Spl 	CT_MOVE_PARTITION,		/* 128 */
585830d82f7Spl 	CT_FLUSH_CACHE,			/* 129 */
586830d82f7Spl 	CT_READ_NAME,			/* 130 */
587830d82f7Spl 	CT_WRITE_NAME,			/* 131 */
588830d82f7Spl 	CT_TOSS_CACHE,			/* 132 */
589830d82f7Spl 	CT_LOCK_DRAINIO,		/* 133 */
590830d82f7Spl 	CT_CONTAINER_OFFLINE,		/* 134 */
591830d82f7Spl 	CT_SET_CACHE_SIZE,		/* 135 */
592830d82f7Spl 	CT_CLEAN_SHUTDOWN_STATUS,	/* 136 */
593830d82f7Spl 	CT_CLEAR_DISKLOG_ON_DISK,	/* 137 */
594830d82f7Spl 	CT_CLEAR_ALL_DISKLOG,		/* 138 */
595830d82f7Spl 	CT_CACHE_FAVOR,			/* 139 */
596830d82f7Spl 	CT_READ_PASSTHRU_MBR,		/* 140 */
597830d82f7Spl 	CT_SCRUB_NOFIX,			/* 141 */
598830d82f7Spl 	CT_SCRUB2_NOFIX,		/* 142 */
599830d82f7Spl 	CT_FLUSH,			/* 143 */
600830d82f7Spl 	CT_REBUILD,	/* 144 rma, not really a command, partner to CT_SCRUB */
601830d82f7Spl 	CT_FLUSH_CONTAINER,		/* 145 */
602830d82f7Spl 	CT_RESTART,			/* 146 */
603830d82f7Spl 	CT_GET_CONFIG_STATUS,		/* 147 */
604830d82f7Spl 	CT_TRACE_FLAG,			/* 148 */
605830d82f7Spl 	CT_RESTART_MORPH,		/* 149 */
606830d82f7Spl 	CT_GET_TRACE_INFO,		/* 150 */
607830d82f7Spl 	CT_GET_TRACE_ITEM,		/* 151 */
608830d82f7Spl 	CT_COMMIT_CONFIG,		/* 152 */
609830d82f7Spl 	CT_CONTAINER_EXISTS,		/* 153 */
610830d82f7Spl 	CT_GET_SLICE_FROM_DEVT,		/* 154 */
611830d82f7Spl 	CT_OPEN_READ_WRITE,		/* 155 */
612830d82f7Spl 	CT_WRITE_MEMORY_BLOCK,		/* 156 */
613830d82f7Spl 	CT_GET_CACHE_PARAMS,		/* 157 */
614830d82f7Spl 	CT_CRAZY_CACHE,			/* 158 */
615830d82f7Spl 	CT_GET_PROFILE_STRUCT,		/* 159 */
616830d82f7Spl 	CT_SET_IO_TRACE_FLAG,		/* 160 */
617830d82f7Spl 	CT_GET_IO_TRACE_STRUCT,		/* 161 */
618830d82f7Spl 	CT_CID_TO_64BITS_UID,		/* 162 */
619830d82f7Spl 	CT_64BITS_UID_TO_CID,		/* 163 */
620830d82f7Spl 	CT_PAR_TO_64BITS_UID,		/* 164 */
621830d82f7Spl 	CT_CID_TO_32BITS_UID,		/* 165 */
622830d82f7Spl 	CT_32BITS_UID_TO_CID,		/* 166 */
623830d82f7Spl 	CT_PAR_TO_32BITS_UID,		/* 167 */
624830d82f7Spl 	CT_SET_FAILOVER_OPTION,		/* 168 */
625830d82f7Spl 	CT_GET_FAILOVER_OPTION,		/* 169 */
626830d82f7Spl 	CT_STRIPE_ADD2,			/* 170 */
627830d82f7Spl 	CT_CREATE_VOLUME_SET,		/* 171 */
628830d82f7Spl 	CT_CREATE_STRIPE_SET,		/* 172 */
629830d82f7Spl 	/* 173	command and partner to scrub and rebuild task types */
630830d82f7Spl 	CT_VERIFY_CONTAINER,
631830d82f7Spl 	CT_IS_CONTAINER_DEAD,		/* 174 */
632830d82f7Spl 	CT_GET_CONTAINER_OPTION,	/* 175 */
633830d82f7Spl 	CT_GET_SNAPSHOT_UNUSED_STRUCT,	/* 176 */
634830d82f7Spl 	CT_CLEAR_SNAPSHOT_UNUSED_STRUCT,	/* 177 */
635830d82f7Spl 	CT_GET_CONTAINER_INFO,		/* 178 */
636830d82f7Spl 	CT_CREATE_CONTAINER,		/* 179 */
637830d82f7Spl 	CT_CHANGE_CREATIONINFO,		/* 180 */
638830d82f7Spl 	CT_CHECK_CONFLICT_UID,		/* 181 */
639830d82f7Spl 	CT_CONTAINER_UID_CHECK,		/* 182 */
640830d82f7Spl 
641830d82f7Spl 	/* 183 :RECmm: 20011220 added to support the Babylon */
642830d82f7Spl 	CT_IS_CONTAINER_MEATADATA_STANDARD,
643830d82f7Spl 	/* 184 :RECmm: 20011220 array imports */
644830d82f7Spl 	CT_IS_SLICE_METADATA_STANDARD,
645830d82f7Spl 
646830d82f7Spl 	/* :BIOS_TEST: */
647830d82f7Spl 	/* 185 :RECmm: 20020116	added to support BIOS interface for */
648830d82f7Spl 	CT_GET_IMPORT_COUNT,
649830d82f7Spl 	/* 186 :RECmm: 20020116	metadata conversion */
650830d82f7Spl 	CT_CANCEL_ALL_IMPORTS,
651830d82f7Spl 	CT_GET_IMPORT_INFO,		/* 187 :RECmm: 20020116	" */
652830d82f7Spl 	CT_IMPORT_ARRAY,		/* 188 :RECmm: 20020116	" */
653830d82f7Spl 	CT_GET_LOG_SIZE,		/* 189  */
654830d82f7Spl 
655830d82f7Spl 	/* Not BIOS TEST */
656830d82f7Spl 	CT_ALARM_GET_STATE,		/* 190 */
657830d82f7Spl 	CT_ALARM_SET_STATE,		/* 191 */
658830d82f7Spl 	CT_ALARM_ON_OFF,		/* 192 */
659830d82f7Spl 
660830d82f7Spl 	CT_GET_EE_OEM_ID,		/* 193 */
661830d82f7Spl 
662830d82f7Spl 	CT_GET_PPI_HEADERS,		/* 194  get header fields only */
663830d82f7Spl 	CT_GET_PPI_DATA,		/* 195  get all ppitable.data */
664830d82f7Spl 	/* 196  get only range of entries specified in c_params */
665830d82f7Spl 	CT_GET_PPI_ENTRIES,
666830d82f7Spl 	/* 197  remove ppitable bundle specified by uid in c_param0 */
667830d82f7Spl 	CT_DELETE_PPI_BUNDLE,
668830d82f7Spl 
669830d82f7Spl 	/* 198  current partition structure (not legacy) */
670830d82f7Spl 	CT_GET_PARTITION_TABLE_2,
671830d82f7Spl 	CT_GET_PARTITION_INFO_2,
672830d82f7Spl 	CT_GET_DISK_PARTITIONS_2,
673830d82f7Spl 
674830d82f7Spl 	CT_QUIESCE_ADAPTER,		/* 201  chill dude */
675830d82f7Spl 	CT_CLEAR_PPI_TABLE,		/* 202  clear ppi table */
676830d82f7Spl 
677830d82f7Spl 	CT_SET_DEVICE_CACHE_POLICY,	/* 203 */
678830d82f7Spl 	CT_GET_DEVICE_CACHE_POLICY,	/* 204 */
679830d82f7Spl 
680830d82f7Spl 	CT_SET_VERIFY_DELAY,		/* 205 */
681830d82f7Spl 	CT_GET_VERIFY_DELAY,		/* 206 */
682830d82f7Spl 
683830d82f7Spl 	/* 207 delete all PPI bundles that have an entry for device at devt */
684830d82f7Spl 	CT_DELETE_PPI_BUNDLES_FOR_DEVT,
685830d82f7Spl 
686830d82f7Spl 	CT_READ_SW_SECTOR,		/* 208 */
687830d82f7Spl 	CT_WRITE_SW_SECTOR,		/* 209 */
688830d82f7Spl 
689830d82f7Spl 	/* 210 added to support firmware cache sync operations */
690830d82f7Spl 	CT_GET_CACHE_SYNC_INFO,
691830d82f7Spl 	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 */
694830d82f7Spl 
695830d82f7Spl 	CT_LAST_COMMAND			/* last command */
696d7c5bf88Spl } AAC_CTCommand;
697830d82f7Spl 
698830d82f7Spl /* General return status */
699830d82f7Spl #define	CT_OK				218
700830d82f7Spl 
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 
708830d82f7Spl struct aac_fsa_ctm {
709830d82f7Spl 	uint32_t	command;
710830d82f7Spl 	uint32_t	param[CT_FIB_PARAMS];
711830d82f7Spl 	int8_t		data[CT_PACKET_SIZE];
712830d82f7Spl };
713830d82f7Spl 
714830d82f7Spl struct aac_Container {
715830d82f7Spl 	uint32_t		Command;
716830d82f7Spl 	struct aac_fsa_ctm	CTCommand;
717830d82f7Spl };
718830d82f7Spl 
719830d82f7Spl struct aac_fsa_ctr {
720830d82f7Spl 	uint32_t	response;
721830d82f7Spl 	uint32_t	param[CT_FIB_PARAMS];
722830d82f7Spl 	int8_t		data[CT_PACKET_SIZE];
723830d82f7Spl };
724830d82f7Spl 
725830d82f7Spl struct aac_Container_resp {
726830d82f7Spl 	uint32_t		Status;
727830d82f7Spl 	struct aac_fsa_ctr	CTResponse;
728830d82f7Spl };
729830d82f7Spl 
730830d82f7Spl struct aac_cf_status_header {
731830d82f7Spl 	uint32_t	action;
732830d82f7Spl 	uint16_t	flags;
733830d82f7Spl 	int16_t		recordcount;
734830d82f7Spl };
735830d82f7Spl 
736830d82f7Spl enum aac_cf_action_type {
737830d82f7Spl 	CFACT_CONTINUE = 0,		/* Continue without pause */
738830d82f7Spl 	CFACT_PAUSE,			/* Pause, then continue */
739830d82f7Spl 	CFACT_ABORT			/* Abort */
740830d82f7Spl };
741830d82f7Spl 
742830d82f7Spl enum aac_mpe {
743830d82f7Spl 	AACMPE_OK = 0x0,
744830d82f7Spl 	AACMPE_GET_CONFIG_STATUS = 0x1,
745830d82f7Spl 	AACMPE_CONFIG_STATUS = 0x2,
746830d82f7Spl 	AACMPE_COMMIT_CONFIG = 0x3
747830d82f7Spl };
748830d82f7Spl 
749830d82f7Spl /*
750830d82f7Spl  * CT_PAUSE_IO is immediate minimal runtime command that is used
751830d82f7Spl  * to restart the applications and cache.
752830d82f7Spl  */
753830d82f7Spl struct aac_pause_command {
754830d82f7Spl 	uint32_t	Command;
755830d82f7Spl 	uint32_t	Type;
756830d82f7Spl 	uint32_t	Timeout;
757830d82f7Spl 	uint32_t	Min;
758830d82f7Spl 	uint32_t	NoRescan;
759830d82f7Spl 	uint32_t	Parm3;
760830d82f7Spl 	uint32_t	Parm4;
761830d82f7Spl 	uint32_t	Count;
762830d82f7Spl };
763830d82f7Spl 
764382c8bcaSpl /*
765382c8bcaSpl  * The following two definitions come from Adaptec:
766382c8bcaSpl  *
767382c8bcaSpl  * Used to flush drive cache for container "cid"
768382c8bcaSpl  */
769382c8bcaSpl struct aac_synchronize_command {
770382c8bcaSpl 	uint32_t	Command;	/* VM_ContainerConfig */
771382c8bcaSpl 	uint32_t	Type;		/* CT_FLUSH_CACHE */
772382c8bcaSpl 	uint32_t	Cid;
773382c8bcaSpl 	uint32_t	Parm1;
774382c8bcaSpl 	uint32_t	Parm2;
775382c8bcaSpl 	uint32_t	Parm3;
776382c8bcaSpl 	uint32_t	Parm4;
777382c8bcaSpl 	uint32_t	Count;
778382c8bcaSpl };
779382c8bcaSpl 
780382c8bcaSpl struct aac_synchronize_reply {
781382c8bcaSpl 	uint32_t	Dummy0;
782382c8bcaSpl 	uint32_t	Dummy1;
783382c8bcaSpl 	uint32_t	Status;
784382c8bcaSpl 	uint32_t	Parm1;
785382c8bcaSpl 	uint32_t	Parm2;
786382c8bcaSpl 	uint32_t	Parm3;
787382c8bcaSpl 	uint32_t	Parm4;
788382c8bcaSpl 	uint32_t	Parm5;
789382c8bcaSpl 	uint8_t		Data[16];
790382c8bcaSpl };
791382c8bcaSpl 
792d7c5bf88Spl /*
793d7c5bf88Spl  * Command status values
794d7c5bf88Spl  */
795d7c5bf88Spl typedef enum {
796d7c5bf88Spl 	ST_OK = 0,
797d7c5bf88Spl 	ST_PERM = 1,
798d7c5bf88Spl 	ST_NOENT = 2,
799d7c5bf88Spl 	ST_IO = 5,
800d7c5bf88Spl 	ST_NXIO = 6,
801d7c5bf88Spl 	ST_E2BIG = 7,
802d7c5bf88Spl 	ST_ACCES = 13,
803d7c5bf88Spl 	ST_EXIST = 17,
804d7c5bf88Spl 	ST_XDEV = 18,
805d7c5bf88Spl 	ST_NODEV = 19,
806d7c5bf88Spl 	ST_NOTDIR = 20,
807d7c5bf88Spl 	ST_ISDIR = 21,
808d7c5bf88Spl 	ST_INVAL = 22,
809d7c5bf88Spl 	ST_FBIG = 27,
810d7c5bf88Spl 	ST_NOSPC = 28,
811d7c5bf88Spl 	ST_ROFS = 30,
812d7c5bf88Spl 	ST_MLINK = 31,
813d7c5bf88Spl 	ST_WOULDBLOCK = 35,
814d7c5bf88Spl 	ST_NAMETOOLONG = 63,
815d7c5bf88Spl 	ST_NOTEMPTY = 66,
816d7c5bf88Spl 	ST_DQUOT = 69,
817d7c5bf88Spl 	ST_STALE = 70,
818d7c5bf88Spl 	ST_REMOTE = 71,
819d7c5bf88Spl 	ST_BADHANDLE = 10001,
820d7c5bf88Spl 	ST_NOT_SYNC = 10002,
821d7c5bf88Spl 	ST_BAD_COOKIE = 10003,
822d7c5bf88Spl 	ST_NOTSUPP = 10004,
823d7c5bf88Spl 	ST_TOOSMALL = 10005,
824d7c5bf88Spl 	ST_SERVERFAULT = 10006,
825d7c5bf88Spl 	ST_BADTYPE = 10007,
826d7c5bf88Spl 	ST_JUKEBOX = 10008,
827d7c5bf88Spl 	ST_NOTMOUNTED = 10009,
828d7c5bf88Spl 	ST_MAINTMODE = 10010,
829d7c5bf88Spl 	ST_STALEACL = 10011
830d7c5bf88Spl } AAC_FSAStatus;
831d7c5bf88Spl 
832830d82f7Spl /*
833830d82f7Spl  * Object-Server / Volume-Manager Dispatch Classes
834830d82f7Spl  */
835830d82f7Spl typedef enum {
836830d82f7Spl 	VM_Null = 0,
837830d82f7Spl 	VM_NameServe,
838830d82f7Spl 	VM_ContainerConfig,
839830d82f7Spl 	VM_Ioctl,
840830d82f7Spl 	VM_FilesystemIoctl,
841830d82f7Spl 	VM_CloseAll,
842830d82f7Spl 	VM_CtBlockRead,
843830d82f7Spl 	VM_CtBlockWrite,
844830d82f7Spl 	VM_SliceBlockRead,	/* raw access to configured "storage objects" */
845830d82f7Spl 	VM_SliceBlockWrite,
846830d82f7Spl 	VM_DriveBlockRead,	/* raw access to physical devices */
847830d82f7Spl 	VM_DriveBlockWrite,
848830d82f7Spl 	VM_EnclosureMgt,	/* enclosure management */
849830d82f7Spl 	VM_Unused,		/* used to be diskset management */
850830d82f7Spl 	VM_CtBlockVerify,
851830d82f7Spl 	VM_CtPerf,		/* performance test */
852830d82f7Spl 	VM_CtBlockRead64,
853830d82f7Spl 	VM_CtBlockWrite64,
854830d82f7Spl 	VM_CtBlockVerify64,
855830d82f7Spl 	VM_CtHostRead64,
856830d82f7Spl 	VM_CtHostWrite64,
857830d82f7Spl 	VM_NameServe64 = 22,
858830d82f7Spl 	MAX_VMCOMMAND_NUM	/* used for sizing stats array - leave last */
859d7c5bf88Spl } AAC_VMCommand;
8607c478bd9Sstevel@tonic-gate 
861d937e6ebSpl /*
862d937e6ebSpl  * Host-addressable object types
863d937e6ebSpl  */
864d937e6ebSpl typedef enum {
865d937e6ebSpl 	FT_REG = 1,	/* regular file */
866d937e6ebSpl 	FT_DIR,		/* directory */
867d937e6ebSpl 	FT_BLK,		/* "block" device - reserved */
868d937e6ebSpl 	FT_CHR,		/* "character special" device - reserved */
869d937e6ebSpl 	FT_LNK,		/* symbolic link */
870d937e6ebSpl 	FT_SOCK,	/* socket */
871d937e6ebSpl 	FT_FIFO,	/* fifo */
872d937e6ebSpl 	FT_FILESYS,	/* ADAPTEC's "FSA"(tm) filesystem */
873d937e6ebSpl 	FT_DRIVE,	/* physical disk - addressable in scsi by b/t/l */
874d937e6ebSpl 	FT_SLICE,	/* virtual disk - raw volume - slice */
875d937e6ebSpl 	FT_PARTITION,	/* FSA partition - carved out of a slice - building */
876d937e6ebSpl 			/* block for containers */
877d937e6ebSpl 	FT_VOLUME,	/* Container - Volume Set */
878d937e6ebSpl 	FT_STRIPE,	/* Container - Stripe Set */
879d937e6ebSpl 	FT_MIRROR,	/* Container - Mirror Set */
880d937e6ebSpl 	FT_RAID5,	/* Container - Raid 5 Set */
881d937e6ebSpl 	FT_DATABASE	/* Storage object with "foreign" content manager */
882d937e6ebSpl } AAC_FType;
8837c478bd9Sstevel@tonic-gate 
884830d82f7Spl /* Host-side scatter/gather list for 32-bit, 64-bit, raw commands */
8857c478bd9Sstevel@tonic-gate struct aac_sg_entry {
8867c478bd9Sstevel@tonic-gate 	uint32_t	SgAddress;
8877c478bd9Sstevel@tonic-gate 	uint32_t	SgByteCount;
8887c478bd9Sstevel@tonic-gate };
8897c478bd9Sstevel@tonic-gate 
890830d82f7Spl struct aac_sg_entry64 {
891830d82f7Spl 	uint64_t	SgAddress;
892830d82f7Spl 	uint32_t	SgByteCount;
893830d82f7Spl };
894830d82f7Spl 
895830d82f7Spl struct aac_sg_entryraw {
896830d82f7Spl 	uint32_t	Next;		/* reserved */
897830d82f7Spl 	uint32_t	Prev;		/* reserved */
898830d82f7Spl 	uint64_t	SgAddress;
899830d82f7Spl 	uint32_t	SgByteCount;
900830d82f7Spl 	uint32_t	Flags;		/* reserved */
901830d82f7Spl };
902830d82f7Spl 
9037c478bd9Sstevel@tonic-gate struct aac_sg_table {
9047c478bd9Sstevel@tonic-gate 	uint32_t		SgCount;
9057c478bd9Sstevel@tonic-gate 	struct aac_sg_entry	SgEntry[1]; /* at least there is one */
9067c478bd9Sstevel@tonic-gate 					    /* SUN's CC cannot accept [0] */
9077c478bd9Sstevel@tonic-gate };
9087c478bd9Sstevel@tonic-gate 
909830d82f7Spl struct aac_sg_table64 {
910830d82f7Spl 	uint32_t		SgCount;
911830d82f7Spl 	struct aac_sg_entry64	SgEntry64[1];
912830d82f7Spl };
913830d82f7Spl 
914830d82f7Spl struct aac_sg_tableraw {
915830d82f7Spl 	uint32_t		SgCount;
916830d82f7Spl 	struct aac_sg_entryraw	SgEntryRaw[1];
917830d82f7Spl };
918830d82f7Spl 
9197c478bd9Sstevel@tonic-gate /*
9207c478bd9Sstevel@tonic-gate  * Block read/write operations.
9217c478bd9Sstevel@tonic-gate  * These structures are packed into the 'data' area in the FIB.
9227c478bd9Sstevel@tonic-gate  */
9237c478bd9Sstevel@tonic-gate struct aac_blockread {
9247c478bd9Sstevel@tonic-gate 	uint32_t		Command;
9257c478bd9Sstevel@tonic-gate 	uint32_t		ContainerId;
9267c478bd9Sstevel@tonic-gate 	uint32_t		BlockNumber;
9277c478bd9Sstevel@tonic-gate 	uint32_t		ByteCount;
9287c478bd9Sstevel@tonic-gate 	struct aac_sg_table	SgMap;
9297c478bd9Sstevel@tonic-gate };
9307c478bd9Sstevel@tonic-gate 
931830d82f7Spl struct aac_blockread64 {
932830d82f7Spl 	uint32_t		Command;
933830d82f7Spl 	uint16_t		ContainerId;
934830d82f7Spl 	uint16_t		SectorCount;
935830d82f7Spl 	uint32_t		BlockNumber;
936830d82f7Spl 	uint16_t		Pad;
937830d82f7Spl 	uint16_t		Flags;
938830d82f7Spl 	struct aac_sg_table64	SgMap64;
939830d82f7Spl };
940830d82f7Spl 
941d7c5bf88Spl struct aac_blockread_response {
942d7c5bf88Spl 	uint32_t		Status;
943d7c5bf88Spl 	uint32_t		ByteCount;
944d7c5bf88Spl };
945d7c5bf88Spl 
9467c478bd9Sstevel@tonic-gate struct aac_blockwrite {
9477c478bd9Sstevel@tonic-gate 	uint32_t		Command;
9487c478bd9Sstevel@tonic-gate 	uint32_t		ContainerId;
9497c478bd9Sstevel@tonic-gate 	uint32_t		BlockNumber;
9507c478bd9Sstevel@tonic-gate 	uint32_t		ByteCount;
9517c478bd9Sstevel@tonic-gate 	uint32_t		Stable;
9527c478bd9Sstevel@tonic-gate 	struct aac_sg_table	SgMap;
9537c478bd9Sstevel@tonic-gate };
9547c478bd9Sstevel@tonic-gate 
955830d82f7Spl struct aac_blockwrite64 {
956830d82f7Spl 	uint32_t		Command;
957830d82f7Spl 	uint16_t		ContainerId;
958830d82f7Spl 	uint16_t		SectorCount;
959830d82f7Spl 	uint32_t		BlockNumber;
960830d82f7Spl 	uint16_t		Pad;
961830d82f7Spl 	uint16_t		Flags;
962830d82f7Spl 	struct aac_sg_table64	SgMap64;
963830d82f7Spl };
964830d82f7Spl 
965d7c5bf88Spl struct aac_blockwrite_response {
966d7c5bf88Spl 	uint32_t		Status;
967d7c5bf88Spl 	uint32_t		ByteCount;
968d7c5bf88Spl 	uint32_t		Committed;
969d7c5bf88Spl };
970d7c5bf88Spl 
971830d82f7Spl struct aac_raw_io {
972830d82f7Spl 	uint64_t		BlockNumber;
973830d82f7Spl 	uint32_t		ByteCount;
974830d82f7Spl 	uint16_t		ContainerId;
975830d82f7Spl 	uint16_t		Flags;		/* 0: W, 1: R */
976830d82f7Spl 	uint16_t		BpTotal;	/* reserved */
977830d82f7Spl 	uint16_t		BpComplete;	/* reserved */
978830d82f7Spl 	struct aac_sg_tableraw	SgMapRaw;
979830d82f7Spl };
980830d82f7Spl 
981c9487164Spl /*
982c9487164Spl  * Container shutdown command.
983c9487164Spl  */
984830d82f7Spl struct aac_close_command {
985830d82f7Spl 	uint32_t		Command;
986830d82f7Spl 	uint32_t		ContainerId;
987830d82f7Spl };
988830d82f7Spl 
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 
10047c478bd9Sstevel@tonic-gate /* Write 'stability' options */
1005830d82f7Spl #define	CSTABLE			1
1006830d82f7Spl #define	CUNSTABLE		2
10077c478bd9Sstevel@tonic-gate 
1008830d82f7Spl /* Number of FIBs for the controller to send us messages */
1009830d82f7Spl #define	AAC_ADAPTER_FIBS	8
10107c478bd9Sstevel@tonic-gate 
1011830d82f7Spl /* Number of FIBs for the host I/O request */
1012830d82f7Spl #define	AAC_HOST_FIBS		256
10137c478bd9Sstevel@tonic-gate 
1014830d82f7Spl /* Size of buffer for text messages from the controller */
1015830d82f7Spl #define	AAC_ADAPTER_PRINT_BUFSIZE		256
10167c478bd9Sstevel@tonic-gate 
10177c478bd9Sstevel@tonic-gate #define	AAC_INIT_STRUCT_REVISION		3
1018830d82f7Spl #define	AAC_INIT_STRUCT_REVISION_4		4
10197c478bd9Sstevel@tonic-gate #define	AAC_INIT_STRUCT_MINIPORT_REVISION	1
1020b40e8a89Szhongyan gu - Sun Microsystems - Beijing China 
1021830d82f7Spl #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 
10257c478bd9Sstevel@tonic-gate #define	AAC_PAGE_SIZE				4096
10267c478bd9Sstevel@tonic-gate struct aac_adapter_init {
10277c478bd9Sstevel@tonic-gate 	uint32_t	InitStructRevision;
10287c478bd9Sstevel@tonic-gate 	uint32_t	MiniPortRevision;
10297c478bd9Sstevel@tonic-gate 	uint32_t	FilesystemRevision;
10307c478bd9Sstevel@tonic-gate 	uint32_t	CommHeaderAddress;
10317c478bd9Sstevel@tonic-gate 	uint32_t	FastIoCommAreaAddress;
10327c478bd9Sstevel@tonic-gate 	uint32_t	AdapterFibsPhysicalAddress;
1033830d82f7Spl 	uint32_t	AdapterFibsVirtualAddress;
10347c478bd9Sstevel@tonic-gate 	uint32_t	AdapterFibsSize;
10357c478bd9Sstevel@tonic-gate 	uint32_t	AdapterFibAlign;
10367c478bd9Sstevel@tonic-gate 	uint32_t	PrintfBufferAddress;
10377c478bd9Sstevel@tonic-gate 	uint32_t	PrintfBufferSize;
10387c478bd9Sstevel@tonic-gate 	uint32_t	HostPhysMemPages;
10397c478bd9Sstevel@tonic-gate 	uint32_t	HostElapsedSeconds;
1040830d82f7Spl 	/* ADAPTER_INIT_STRUCT_REVISION_4 begins here */
1041830d82f7Spl 	uint32_t	InitFlags;
1042830d82f7Spl 	uint32_t	MaxIoCommands;
1043830d82f7Spl 	uint32_t	MaxIoSize;
1044830d82f7Spl 	uint32_t	MaxFibSize;
10457c478bd9Sstevel@tonic-gate };
10467c478bd9Sstevel@tonic-gate 
10477c478bd9Sstevel@tonic-gate /* ************AAC QUEUE DEFINES (BELOW)*********** */
10487c478bd9Sstevel@tonic-gate 
1049830d82f7Spl #define	AAC_QUEUE_ALIGN		16
10507c478bd9Sstevel@tonic-gate #define	AAC_QUEUE_COUNT		8
10517c478bd9Sstevel@tonic-gate #define	AAC_PRODUCER_INDEX	0
10527c478bd9Sstevel@tonic-gate #define	AAC_CONSUMER_INDEX	1
10537c478bd9Sstevel@tonic-gate 
10547c478bd9Sstevel@tonic-gate struct aac_queue_entry {
10557c478bd9Sstevel@tonic-gate 	uint32_t aq_fib_size;	/* FIB size in bytes */
10567c478bd9Sstevel@tonic-gate 	uint32_t aq_fib_addr;	/* receiver-space address of the FIB */
10577c478bd9Sstevel@tonic-gate };
10587c478bd9Sstevel@tonic-gate 
10597c478bd9Sstevel@tonic-gate /*
10607c478bd9Sstevel@tonic-gate  * Queue names
10617c478bd9Sstevel@tonic-gate  *
10627c478bd9Sstevel@tonic-gate  * Note that we base these at 0 in order to use them as array indices.
10637c478bd9Sstevel@tonic-gate  * Adaptec used base 1 for some unknown reason, and sorted them in a
10647c478bd9Sstevel@tonic-gate  * different order.
10657c478bd9Sstevel@tonic-gate  */
10667c478bd9Sstevel@tonic-gate #define	AAC_HOST_NORM_CMD_Q	0
10677c478bd9Sstevel@tonic-gate #define	AAC_HOST_HIGH_CMD_Q	1
10687c478bd9Sstevel@tonic-gate #define	AAC_ADAP_NORM_CMD_Q	2
10697c478bd9Sstevel@tonic-gate #define	AAC_ADAP_HIGH_CMD_Q	3
10707c478bd9Sstevel@tonic-gate #define	AAC_HOST_NORM_RESP_Q	4
10717c478bd9Sstevel@tonic-gate #define	AAC_HOST_HIGH_RESP_Q	5
10727c478bd9Sstevel@tonic-gate #define	AAC_ADAP_NORM_RESP_Q	6
10737c478bd9Sstevel@tonic-gate #define	AAC_ADAP_HIGH_RESP_Q	7
10747c478bd9Sstevel@tonic-gate 
10757c478bd9Sstevel@tonic-gate /*
1076830d82f7Spl  * We establish 4 command queues and matching response queues. Queues must
10777c478bd9Sstevel@tonic-gate  * be 16-byte aligned, and are sized as follows:
10787c478bd9Sstevel@tonic-gate  */
10797c478bd9Sstevel@tonic-gate /* command adapter->host, normal priority */
10807c478bd9Sstevel@tonic-gate #define	AAC_HOST_NORM_CMD_ENTRIES	8
10817c478bd9Sstevel@tonic-gate /* command adapter->host, high priority */
10827c478bd9Sstevel@tonic-gate #define	AAC_HOST_HIGH_CMD_ENTRIES	4
10837c478bd9Sstevel@tonic-gate /* command host->adapter, normal priority */
10847c478bd9Sstevel@tonic-gate #define	AAC_ADAP_NORM_CMD_ENTRIES	512
10857c478bd9Sstevel@tonic-gate /* command host->adapter, high priority */
10867c478bd9Sstevel@tonic-gate #define	AAC_ADAP_HIGH_CMD_ENTRIES	4
10877c478bd9Sstevel@tonic-gate /* response, adapter->host, normal priority */
10887c478bd9Sstevel@tonic-gate #define	AAC_HOST_NORM_RESP_ENTRIES	512
10897c478bd9Sstevel@tonic-gate /* response, adapter->host, high priority */
10907c478bd9Sstevel@tonic-gate #define	AAC_HOST_HIGH_RESP_ENTRIES	4
10917c478bd9Sstevel@tonic-gate /* response, host->adapter, normal priority */
10927c478bd9Sstevel@tonic-gate #define	AAC_ADAP_NORM_RESP_ENTRIES	8
10937c478bd9Sstevel@tonic-gate /* response, host->adapter, high priority */
10947c478bd9Sstevel@tonic-gate #define	AAC_ADAP_HIGH_RESP_ENTRIES	4
10957c478bd9Sstevel@tonic-gate 
1096830d82f7Spl #define	AAC_TOTALQ_LENGTH	(AAC_HOST_HIGH_CMD_ENTRIES + \
1097830d82f7Spl 				AAC_HOST_NORM_CMD_ENTRIES + \
1098830d82f7Spl 				AAC_ADAP_HIGH_CMD_ENTRIES + \
1099830d82f7Spl 				AAC_ADAP_NORM_CMD_ENTRIES + \
1100830d82f7Spl 				AAC_HOST_HIGH_RESP_ENTRIES + \
1101830d82f7Spl 				AAC_HOST_NORM_RESP_ENTRIES + \
1102830d82f7Spl 				AAC_ADAP_HIGH_RESP_ENTRIES + \
11037c478bd9Sstevel@tonic-gate 				AAC_ADAP_NORM_RESP_ENTRIES)
11047c478bd9Sstevel@tonic-gate 
11057c478bd9Sstevel@tonic-gate /*
11067c478bd9Sstevel@tonic-gate  * Table of queue indices and queues used to communicate with the
1107c9487164Spl  * controller. This structure must be aligned to AAC_QUEUE_ALIGN.
11087c478bd9Sstevel@tonic-gate  */
11097c478bd9Sstevel@tonic-gate struct aac_queue_table {
11107c478bd9Sstevel@tonic-gate 	/* queue consumer/producer indexes (layout mandated by adapter) */
11117c478bd9Sstevel@tonic-gate 	uint32_t qt_qindex[AAC_QUEUE_COUNT][2];
11127c478bd9Sstevel@tonic-gate 
11137c478bd9Sstevel@tonic-gate 	/* queue entry structures (layout mandated by adapter) */
11147c478bd9Sstevel@tonic-gate 	struct aac_queue_entry qt_HostNormCmdQueue \
1115c9487164Spl 	    [AAC_HOST_NORM_CMD_ENTRIES];
11167c478bd9Sstevel@tonic-gate 	struct aac_queue_entry qt_HostHighCmdQueue \
1117c9487164Spl 	    [AAC_HOST_HIGH_CMD_ENTRIES];
11187c478bd9Sstevel@tonic-gate 	struct aac_queue_entry qt_AdapNormCmdQueue \
1119c9487164Spl 	    [AAC_ADAP_NORM_CMD_ENTRIES];
11207c478bd9Sstevel@tonic-gate 	struct aac_queue_entry qt_AdapHighCmdQueue \
1121c9487164Spl 	    [AAC_ADAP_HIGH_CMD_ENTRIES];
1122830d82f7Spl 	struct aac_queue_entry qt_HostNormRespQueue \
1123c9487164Spl 	    [AAC_HOST_NORM_RESP_ENTRIES];
1124830d82f7Spl 	struct aac_queue_entry qt_HostHighRespQueue \
1125c9487164Spl 	    [AAC_HOST_HIGH_RESP_ENTRIES];
1126830d82f7Spl 	struct aac_queue_entry qt_AdapNormRespQueue \
1127c9487164Spl 	    [AAC_ADAP_NORM_RESP_ENTRIES];
1128830d82f7Spl 	struct aac_queue_entry qt_AdapHighRespQueue \
1129c9487164Spl 	    [AAC_ADAP_HIGH_RESP_ENTRIES];
11307c478bd9Sstevel@tonic-gate };
11317c478bd9Sstevel@tonic-gate /* ************AAC QUEUE DEFINES (ABOVE)*********** */
11327c478bd9Sstevel@tonic-gate 
1133830d82f7Spl /*
1134830d82f7Spl  * NVRAM/Write Cache subsystem battery component states
1135830d82f7Spl  */
1136830d82f7Spl typedef enum {
1137830d82f7Spl 	NVBATTSTATUS_NONE = 0,	/* battery has no power or is not present */
1138830d82f7Spl 	NVBATTSTATUS_LOW,	/* battery is low on power */
1139830d82f7Spl 	NVBATTSTATUS_OK,	/* battery is okay - normal operation */
1140830d82f7Spl 				/* possible only in this state */
1141830d82f7Spl 	NVBATTSTATUS_RECONDITIONING	/* no battery present */
1142830d82f7Spl 					/* - reconditioning in process */
1143830d82f7Spl } AAC_NVBATTSTATUS;
1144830d82f7Spl 
1145830d82f7Spl /*
1146830d82f7Spl  * Battery transition type
1147830d82f7Spl  */
1148830d82f7Spl typedef enum {
1149830d82f7Spl 	NVBATT_TRANSITION_NONE = 0,	/* battery now has no power or is not */
1150830d82f7Spl 					/* present */
1151830d82f7Spl 	NVBATT_TRANSITION_LOW,	/* battery is now low on power */
1152830d82f7Spl 	NVBATT_TRANSITION_OK	/* battery is now okay - normal */
1153830d82f7Spl 				/* operation possible only in this state */
1154830d82f7Spl } AAC_NVBATT_TRANSITION;
1155830d82f7Spl 
1156830d82f7Spl /*
1157830d82f7Spl  * Data types relating to AIFs
1158830d82f7Spl  */
1159830d82f7Spl 
1160830d82f7Spl /*
1161830d82f7Spl  * Progress Reports
1162830d82f7Spl  */
1163830d82f7Spl typedef enum {
1164830d82f7Spl 	AifJobStsSuccess = 1,
1165830d82f7Spl 	AifJobStsFinished,
1166830d82f7Spl 	AifJobStsAborted,
1167830d82f7Spl 	AifJobStsFailed,
1168830d82f7Spl 	AifJobStsLastReportMarker = 100,	/* All prior mean last report */
1169830d82f7Spl 	AifJobStsSuspended,
1170830d82f7Spl 	AifJobStsRunning
1171830d82f7Spl } AAC_AifJobStatus;
1172830d82f7Spl 
1173830d82f7Spl typedef enum {
1174830d82f7Spl 	AifJobScsiMin = 1,	/* Minimum value for Scsi operation */
1175830d82f7Spl 	AifJobScsiZero,		/* SCSI device clear operation */
1176830d82f7Spl 	AifJobScsiVerify,	/* SCSI device Verify operation NO REPAIR */
1177830d82f7Spl 	AifJobScsiExercise,	/* SCSI device Exercise operation */
1178830d82f7Spl 	AifJobScsiVerifyRepair,	/* SCSI device Verify operation WITH repair */
1179830d82f7Spl 	AifJobScsiWritePattern,	/* write pattern */
1180830d82f7Spl 	AifJobScsiMax = 99,	/* Max Scsi value */
1181830d82f7Spl 	AifJobCtrMin,		/* Min Ctr op value */
1182830d82f7Spl 	AifJobCtrZero,		/* Container clear operation */
1183830d82f7Spl 	AifJobCtrCopy,		/* Container copy operation */
1184830d82f7Spl 	AifJobCtrCreateMirror,	/* Container Create Mirror operation */
1185830d82f7Spl 	AifJobCtrMergeMirror,	/* Container Merge Mirror operation */
1186830d82f7Spl 	AifJobCtrScrubMirror,	/* Container Scrub Mirror operation */
1187830d82f7Spl 	AifJobCtrRebuildRaid5,	/* Container Rebuild Raid5 operation */
1188830d82f7Spl 	AifJobCtrScrubRaid5,	/* Container Scrub Raid5 operation */
1189830d82f7Spl 	AifJobCtrMorph,		/* Container morph operation */
1190830d82f7Spl 	AifJobCtrPartCopy,	/* Container Partition copy operation */
1191830d82f7Spl 	AifJobCtrRebuildMirror,	/* Container Rebuild Mirror operation */
1192830d82f7Spl 	AifJobCtrCrazyCache,	/* crazy cache */
1193830d82f7Spl 	AifJobCtrCopyback,	/* Container Copyback operation */
1194830d82f7Spl 	AifJobCtrCompactRaid5D,	/* Container Compaction operation */
1195830d82f7Spl 	AifJobCtrExpandRaid5D,	/* Container Expansion operation */
1196830d82f7Spl 	AifJobCtrRebuildRaid6,	/* Container Rebuild Raid6 operation */
1197830d82f7Spl 	AifJobCtrScrubRaid6,	/* Container Scrub Raid6 operation */
1198830d82f7Spl 	AifJobCtrSSBackup,	/* Container snapshot backup task */
1199830d82f7Spl 	AifJobCtrMax = 199,	/* Max Ctr type operation */
1200830d82f7Spl 	AifJobFsMin,		/* Min Fs type operation */
1201830d82f7Spl 	AifJobFsCreate,		/* File System Create operation */
1202830d82f7Spl 	AifJobFsVerify,		/* File System Verify operation */
1203830d82f7Spl 	AifJobFsExtend,		/* File System Extend operation */
1204830d82f7Spl 	AifJobFsMax = 299,	/* Max Fs type operation */
1205830d82f7Spl 	AifJobApiFormatNTFS,	/* Format a drive to NTFS */
1206830d82f7Spl 	AifJobApiFormatFAT,	/* Format a drive to FAT */
1207830d82f7Spl 	AifJobApiUpdateSnapshot, /* update the read/write half of a snapshot */
1208830d82f7Spl 	AifJobApiFormatFAT32,	/* Format a drive to FAT32 */
1209830d82f7Spl 	AifJobApiMax = 399,		/* Max API type operation */
1210830d82f7Spl 	AifJobCtlContinuousCtrVerify,	/* Adapter operation */
1211830d82f7Spl 	AifJobCtlMax = 499		/* Max Adapter type operation */
1212830d82f7Spl } AAC_AifJobType;
1213830d82f7Spl 
1214830d82f7Spl struct aac_AifContainers {
1215830d82f7Spl 	uint32_t	src;		/* from/master */
1216830d82f7Spl 	uint32_t	dst;		/* to/slave */
1217830d82f7Spl };
1218830d82f7Spl 
1219830d82f7Spl union aac_AifJobClient {
1220830d82f7Spl 	struct aac_AifContainers container;	/* For Container and */
1221830d82f7Spl 						/* filesystem progress ops */
1222830d82f7Spl 	int32_t scsi_dh;			/* For SCSI progress ops */
1223830d82f7Spl };
1224830d82f7Spl 
1225830d82f7Spl struct aac_AifJobDesc {
1226830d82f7Spl 	uint32_t	jobID;	/* DO NOT FILL IN! Will be filled in by AIF */
1227830d82f7Spl 	AAC_AifJobType	type;	/* Operation that is being performed */
1228830d82f7Spl 	union aac_AifJobClient	client;	/* Details */
1229830d82f7Spl };
1230830d82f7Spl 
1231830d82f7Spl struct aac_AifJobProgressReport {
1232830d82f7Spl 	struct aac_AifJobDesc	jd;
1233830d82f7Spl 	AAC_AifJobStatus	status;
1234830d82f7Spl 	uint32_t		finalTick;
1235830d82f7Spl 	uint32_t		currentTick;
1236830d82f7Spl 	uint32_t		jobSpecificData1;
1237830d82f7Spl 	uint32_t		jobSpecificData2;
1238830d82f7Spl };
1239830d82f7Spl 
1240830d82f7Spl /*
1241830d82f7Spl  * Event Notification
1242830d82f7Spl  */
1243830d82f7Spl typedef enum {
1244830d82f7Spl 	/* General application notifies start here */
1245830d82f7Spl 	AifEnGeneric = 1,	/* Generic notification */
1246830d82f7Spl 	AifEnTaskComplete,	/* Task has completed */
1247830d82f7Spl 	AifEnConfigChange,	/* Adapter config change occurred */
1248830d82f7Spl 	AifEnContainerChange,	/* Adapter specific container cfg. change */
1249830d82f7Spl 	AifEnDeviceFailure,	/* SCSI device failed */
1250830d82f7Spl 	AifEnMirrorFailover,	/* Mirror failover started */
1251830d82f7Spl 	AifEnContainerEvent,	/* Significant container event */
1252830d82f7Spl 	AifEnFileSystemChange,	/* File system changed */
1253830d82f7Spl 	AifEnConfigPause,	/* Container pause event */
1254830d82f7Spl 	AifEnConfigResume,	/* Container resume event */
1255830d82f7Spl 	AifEnFailoverChange,	/* Failover space assignment changed */
1256830d82f7Spl 	AifEnRAID5RebuildDone,	/* RAID5 rebuild finished */
1257830d82f7Spl 	AifEnEnclosureManagement,	/* Enclosure management event */
1258830d82f7Spl 	AifEnBatteryEvent,	/* Significant NV battery event */
1259830d82f7Spl 	AifEnAddContainer,	/* A new container was created. */
1260830d82f7Spl 	AifEnDeleteContainer,	/* A container was deleted. */
1261830d82f7Spl 	AifEnSMARTEvent,	/* SMART Event */
1262830d82f7Spl 	AifEnBatteryNeedsRecond,	/* The battery needs reconditioning */
1263830d82f7Spl 	AifEnClusterEvent,		/* Some cluster event */
1264830d82f7Spl 	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) */
1267830d82f7Spl 	AifDriverNotifyStart = 199,	/* Notifies for host driver go here */
1268830d82f7Spl 	/* Host driver notifications start here */
1269830d82f7Spl 	AifDenMorphComplete,		/* A morph operation completed */
1270830d82f7Spl 	AifDenVolumeExtendComplete	/* Volume expand operation completed */
1271830d82f7Spl } AAC_AifEventNotifyType;
1272830d82f7Spl 
1273830d82f7Spl struct aac_AifEnsGeneric {
1274830d82f7Spl 	char	text[132];		/* Generic text */
1275830d82f7Spl };
1276830d82f7Spl 
1277830d82f7Spl struct aac_AifEnsDeviceFailure {
1278830d82f7Spl 	uint32_t	deviceHandle;	/* SCSI device handle */
1279830d82f7Spl };
1280830d82f7Spl 
1281830d82f7Spl struct aac_AifEnsMirrorFailover {
1282830d82f7Spl 	uint32_t	container;	/* Container with failed element */
1283830d82f7Spl 	uint32_t	failedSlice;	/* Old slice which failed */
1284830d82f7Spl 	uint32_t	creatingSlice;	/* New slice used for auto-create */
1285830d82f7Spl };
1286830d82f7Spl 
1287830d82f7Spl struct aac_AifEnsContainerChange {
1288830d82f7Spl 	uint32_t	container[2];	/* container that changed, -1 if */
1289830d82f7Spl 					/* no container */
1290830d82f7Spl };
1291830d82f7Spl 
1292830d82f7Spl struct aac_AifEnsContainerEvent {
1293830d82f7Spl 	uint32_t	container;	/* container number  */
1294830d82f7Spl 	uint32_t	eventType;	/* event type */
1295830d82f7Spl };
1296830d82f7Spl 
1297830d82f7Spl struct aac_AifEnsEnclosureEvent {
1298830d82f7Spl 	uint32_t	empID;		/* enclosure management proc number  */
1299830d82f7Spl 	uint32_t	unitID;		/* unitId, fan id, power supply id, */
1300830d82f7Spl 					/* slot id, tempsensor id. */
1301830d82f7Spl 	uint32_t	eventType;	/* event type */
1302830d82f7Spl };
1303830d82f7Spl 
1304830d82f7Spl struct aac_AifEnsBatteryEvent {
1305830d82f7Spl 	AAC_NVBATT_TRANSITION	transition_type;	/* eg from low to ok */
1306830d82f7Spl 	AAC_NVBATTSTATUS	current_state;	/* current batt state */
1307830d82f7Spl 	AAC_NVBATTSTATUS	prior_state;	/* prev batt state */
1308830d82f7Spl };
1309830d82f7Spl 
1310830d82f7Spl struct aac_AifEnsDiskSetEvent {
1311830d82f7Spl 	uint32_t	eventType;
1312830d82f7Spl 	uint64_t	DsNum;
1313830d82f7Spl 	uint64_t	CreatorId;
1314830d82f7Spl };
1315830d82f7Spl 
1316830d82f7Spl typedef enum {
1317830d82f7Spl 	CLUSTER_NULL_EVENT = 0,
1318830d82f7Spl 	CLUSTER_PARTNER_NAME_EVENT,	/* change in partner hostname or */
1319830d82f7Spl 					/* adaptername from NULL to non-NULL */
1320830d82f7Spl 					/* (partner's agent may be up) */
1321830d82f7Spl 	CLUSTER_PARTNER_NULL_NAME_EVENT	/* change in partner hostname or */
1322830d82f7Spl 					/* adaptername from non-null to NULL */
1323830d82f7Spl 					/* (partner has rebooted) */
1324830d82f7Spl } AAC_ClusterAifEvent;
1325830d82f7Spl 
1326830d82f7Spl struct aac_AifEnsClusterEvent {
1327830d82f7Spl 	AAC_ClusterAifEvent	eventType;
1328830d82f7Spl };
1329830d82f7Spl 
1330830d82f7Spl struct aac_AifEventNotify {
1331830d82f7Spl 	AAC_AifEventNotifyType	type;
1332830d82f7Spl 	union {
1333830d82f7Spl 		struct aac_AifEnsGeneric		EG;
1334830d82f7Spl 		struct aac_AifEnsDeviceFailure		EDF;
1335830d82f7Spl 		struct aac_AifEnsMirrorFailover		EMF;
1336830d82f7Spl 		struct aac_AifEnsContainerChange	ECC;
1337830d82f7Spl 		struct aac_AifEnsContainerEvent		ECE;
1338830d82f7Spl 		struct aac_AifEnsEnclosureEvent		EEE;
1339830d82f7Spl 		struct aac_AifEnsBatteryEvent		EBE;
1340830d82f7Spl 		struct aac_AifEnsDiskSetEvent		EDS;
1341830d82f7Spl /*		struct aac_AifEnsSMARTEvent		ES; */
1342830d82f7Spl 		struct aac_AifEnsClusterEvent		ECLE;
1343830d82f7Spl 	} data;
1344830d82f7Spl };
1345830d82f7Spl 
1346830d82f7Spl /*
1347830d82f7Spl  * Adapter Initiated FIB command structures. Start with the adapter
1348830d82f7Spl  * initiated FIBs that really come from the adapter, and get responded
1349830d82f7Spl  * to by the host.
1350830d82f7Spl  */
1351830d82f7Spl #define	AAC_AIF_REPORT_MAX_SIZE 64
1352830d82f7Spl 
1353830d82f7Spl typedef enum {
1354830d82f7Spl 	AifCmdEventNotify = 1,	/* Notify of event */
1355830d82f7Spl 	AifCmdJobProgress,	/* Progress report */
1356830d82f7Spl 	AifCmdAPIReport,	/* Report from other user of API */
1357830d82f7Spl 	AifCmdDriverNotify,	/* Notify host driver of event */
1358830d82f7Spl 	AifReqJobList = 100,	/* Gets back complete job list */
1359830d82f7Spl 	AifReqJobsForCtr,	/* Gets back jobs for specific container */
1360830d82f7Spl 	AifReqJobsForScsi,	/* Gets back jobs for specific SCSI device */
1361830d82f7Spl 	AifReqJobReport,	/* Gets back a specific job report or list */
1362830d82f7Spl 	AifReqTerminateJob,	/* Terminates job */
1363830d82f7Spl 	AifReqSuspendJob,	/* Suspends a job */
1364830d82f7Spl 	AifReqResumeJob,	/* Resumes a job */
1365830d82f7Spl 	AifReqSendAPIReport,	/* API generic report requests */
1366830d82f7Spl 	AifReqAPIJobStart,	/* Start a job from the API */
1367830d82f7Spl 	AifReqAPIJobUpdate,	/* Update a job report from the API */
1368830d82f7Spl 	AifReqAPIJobFinish	/* Finish a job from the API */
1369830d82f7Spl } AAC_AifCommand;
1370830d82f7Spl 
1371830d82f7Spl struct aac_aif_command {
1372830d82f7Spl 	AAC_AifCommand	command; /* Tell host what type of notify this is */
1373830d82f7Spl 	uint32_t	seqNumber;	/* To allow ordering of reports */
1374830d82f7Spl 					/* (if necessary) */
1375830d82f7Spl 	union {
1376830d82f7Spl 		struct aac_AifEventNotify	EN;	/* Event notify */
1377830d82f7Spl 		struct aac_AifJobProgressReport	PR[1];	/* Progress report */
1378830d82f7Spl 		uint8_t	AR[AAC_AIF_REPORT_MAX_SIZE];
1379830d82f7Spl 		uint8_t	data[AAC_FIB_DATASIZE - 8];
1380830d82f7Spl 	} data;
1381830d82f7Spl };
1382830d82f7Spl 
1383830d82f7Spl #define	CT_PUP_MISSING_DRIVE	27
1384830d82f7Spl 
1385830d82f7Spl /*
1386830d82f7Spl  * Cluster Management Commands
1387830d82f7Spl  */
1388830d82f7Spl typedef enum {
1389830d82f7Spl 	CL_NULL = 0,		/* 0x00 null */
1390830d82f7Spl 	/* disk set commands */
1391830d82f7Spl 	DS_INIT = 1,		/* 0x01 init disk set control block */
1392830d82f7Spl 	DS_RESCAN,		/* 0x02 refresh drive, disk set, and slice */
1393830d82f7Spl 				/* structs */
1394830d82f7Spl 	DS_CREATE,		/* 0x03 create a disk set */
1395830d82f7Spl 	DS_DELETE,		/* 0x04 delete a disk set */
1396830d82f7Spl 	DS_ADD_DISK,		/* 0x05 add a disk to an existing disk set */
1397830d82f7Spl 	DS_REMOVE_DISK,		/* 0x06 remove a disk from an existing disk */
1398830d82f7Spl 				/* set */
1399830d82f7Spl 	DS_MOVE_DISK,		/* 0x07 move a disk from one existing disk */
1400830d82f7Spl 				/* set to another */
1401830d82f7Spl 	DS_TAKE_OWNERSHIP,	/* 0x08 take ownership of an unowned disk set */
1402830d82f7Spl 	DS_RELEASE_OWNERSHIP,	/* 0x09 release ownership of a disk set */
1403830d82f7Spl 	DS_FORCE_OWNERSHIP,	/* 0x0A force ownership of an disk set */
1404830d82f7Spl 	DS_GET_DISK_SET_PARAM,	/* 0x0B get info on a disk set */
1405830d82f7Spl 	DS_GET_DRIVE_PARAM,	/* 0x0C get info on a drive */
1406830d82f7Spl 	DS_GET_SLICE_PARAM,	/* 0x0D get info on a slice */
1407830d82f7Spl 	DS_GET_DISK_SETS,	/* 0x0E get a list of disk sets */
1408830d82f7Spl 	DS_GET_DRIVES,		/* 0x0F get a list of drives */
1409830d82f7Spl 	DS_SET_DISK_SET_PARAM,	/* 0x10 set info of a disk set */
1410830d82f7Spl 	DS_ONLINE,		/* 0x11 take disk set online */
1411830d82f7Spl 	DS_OFFLINE,		/* 0x12 take disk set offline */
1412830d82f7Spl 	DS_ONLINE_CONTAINERS,	/* 0x13 bring containers in diskset online */
1413830d82f7Spl 	DS_FSAPRINT,		/* 0x14 do an FsaPrint */
1414830d82f7Spl 
1415830d82f7Spl 	/* config commands */
1416830d82f7Spl 	CL_CFG_SET_HOST_IDS = 0x100,	/* 0x100 set host ids (host name and */
1417830d82f7Spl 					/* adapter name) */
1418830d82f7Spl 	CL_CFG_SET_PARTNER_HOST_IDS,	/* 0x101 set partner host ids (host */
1419830d82f7Spl 					/* name and adapter name) */
1420830d82f7Spl 	CL_CFG_GET_CLUSTER_CONFIG,	/* 0x102 get cluster configuration */
1421830d82f7Spl 
1422830d82f7Spl 	/* cluster comm commands */
1423830d82f7Spl 	CC_CLI_CLEAR_MESSAGE_BUFFER = 0x200,	/* 0x200 CC - client - clear */
1424830d82f7Spl 						/* contents of message buffer */
1425830d82f7Spl 	CC_SRV_CLEAR_MESSAGE_BUFFER,	/* 0x201 CC - server - clear contents */
1426830d82f7Spl 					/* of message buffer */
1427830d82f7Spl 	CC_CLI_SHOW_MESSAGE_BUFFER,	/* 0x202 CC - client - show contents */
1428830d82f7Spl 					/* of message buffer */
1429830d82f7Spl 	CC_SRV_SHOW_MESSAGE_BUFFER,	/* 0x203 CC - server - show contents */
1430830d82f7Spl 					/* of message buffer */
1431830d82f7Spl 	CC_CLI_SEND_MESSAGE,	/* 0x204 CC - client - send (req) message to */
1432830d82f7Spl 				/* server side */
1433830d82f7Spl 	CC_SRV_SEND_MESSAGE,	/* 0x205 CC - server - send (reply) message */
1434830d82f7Spl 				/* to client side */
1435830d82f7Spl 	CC_CLI_GET_MESSAGE,	/* 0x206 CC - client - read thru read message */
1436830d82f7Spl 				/* buffer */
1437830d82f7Spl 	CC_SRV_GET_MESSAGE,	/* 0x207 CC - server - read thru read message */
1438830d82f7Spl 				/* buffer */
1439830d82f7Spl 	CC_SEND_TEST_MESSAGE,	/* 0x208 CC - send a special subclass message */
1440830d82f7Spl 	CC_GET_BUSINFO,		/* 0x209 CC - get bus info */
1441830d82f7Spl 	CC_GET_PORTINFO,	/* 0x20A CC - get bus,port info */
1442830d82f7Spl 	CC_GET_NAMEINFO,	/* 0x20B CC - get misc info */
1443830d82f7Spl 	CC_GET_CONFIGINFO,	/* 0x20C CC - get misc info */
1444830d82f7Spl 	CQ_QUORUM_OP = 0x300,	/* 0x300 CQ - quorum messages */
1445830d82f7Spl 
1446830d82f7Spl 	/* last command */
1447830d82f7Spl 	CL_LAST_COMMAND		/* used for bounds checking */
1448d7c5bf88Spl } AAC_CLCommand;
1449830d82f7Spl 
1450830d82f7Spl /*
1451830d82f7Spl  * Disk IOCTL Functions
1452830d82f7Spl  */
1453830d82f7Spl #define	Reserved_IOCTL			0x0000
1454830d82f7Spl #define	GetDeviceHandle			0x0001
1455830d82f7Spl #define	BusTargetLun_to_DeviceHandle	0x0002
1456830d82f7Spl #define	DeviceHandle_to_BusTargetLun	0x0003
1457830d82f7Spl #define	RescanBus			0x0004
1458830d82f7Spl #define	GetDeviceProbeInfo		0x0005
1459830d82f7Spl #define	GetDeviceCapacity		0x0006
1460830d82f7Spl #define	GetContainerProbeInfo		0x0007	/* Container, not diskclass */
1461830d82f7Spl 						/* ioctl */
1462830d82f7Spl #define	GetRequestedMemorySize		0x0008
1463830d82f7Spl #define	GetBusInfo			0x0009
1464830d82f7Spl #define	GetVendorSpecific		0x000a
1465830d82f7Spl 
1466830d82f7Spl #define	EnhancedGetDeviceProbeInfo	0x000b
1467830d82f7Spl #define	EnhancedGetBusInfo		0x000c
1468830d82f7Spl 
1469830d82f7Spl #define	SetupExtendedCounters		0x000d
1470830d82f7Spl #define	GetPerformanceCounters		0x000f
1471830d82f7Spl #define	ResetPerformanceCounters	0x0010
1472830d82f7Spl #define	ReadModePage			0x0011
1473830d82f7Spl #define	WriteModePage			0x0012
1474830d82f7Spl #define	ReadDriveParameter		0x0013
1475830d82f7Spl #define	WriteDriveParameter		0x0014
1476830d82f7Spl #define	ResetAdapter			0x0015
1477830d82f7Spl #define	ResetBus			0x0016
1478830d82f7Spl #define	ResetBusDevice			0x0017
1479830d82f7Spl #define	ExecuteSrb			0x0018
1480830d82f7Spl 
1481830d82f7Spl #define	Create_IO_Task			0x0030
1482830d82f7Spl #define	Delete_IO_Task			0x0031
1483830d82f7Spl #define	Get_IO_Task_Info		0x0032
1484830d82f7Spl #define	Check_Task_Progress		0x0033
1485830d82f7Spl 
1486830d82f7Spl #define	InjectError			0x0040
1487830d82f7Spl #define	GetDeviceDefectCounts		0x0041
1488830d82f7Spl #define	GetDeviceDefectInfo		0x0042
1489830d82f7Spl #define	GetDeviceStatus			0x0043
1490830d82f7Spl #define	ClearDeviceStatus		0x0044
1491830d82f7Spl #define	DiskSpinControl			0x0045
1492830d82f7Spl #define	DiskSmartControl		0x0046
1493830d82f7Spl #define	WriteSame			0x0047
1494830d82f7Spl #define	ReadWriteLong			0x0048
1495830d82f7Spl #define	FormatUnit			0x0049
1496830d82f7Spl 
1497830d82f7Spl #define	TargetDeviceControl		0x0050
1498830d82f7Spl #define	TargetChannelControl		0x0051
1499830d82f7Spl 
1500830d82f7Spl #define	FlashNewCode			0x0052
1501830d82f7Spl #define	DiskCheck			0x0053
1502830d82f7Spl #define	RequestSense			0x0054
1503830d82f7Spl #define	DiskPERControl			0x0055
1504830d82f7Spl #define	Read10				0x0056
1505830d82f7Spl #define	Write10				0x0057
1506830d82f7Spl 
1507942c5e3cSpl /*
1508942c5e3cSpl  * The following definitions come from Adaptec:
1509942c5e3cSpl  *
1510942c5e3cSpl  * SRB is required for the new management tools
1511942c5e3cSpl  * and non-DASD support.
1512942c5e3cSpl  */
1513942c5e3cSpl struct aac_srb
1514942c5e3cSpl {
1515942c5e3cSpl 	uint32_t function;
1516942c5e3cSpl 	uint32_t channel;
1517942c5e3cSpl 	uint32_t id;
1518942c5e3cSpl 	uint32_t lun;
1519942c5e3cSpl 	uint32_t timeout;	/* timeout in sec. */
1520942c5e3cSpl 	uint32_t flags;
1521942c5e3cSpl 	uint32_t count;		/* data xfer size */
1522942c5e3cSpl 	uint32_t retry_limit;	/* obsolete */
1523942c5e3cSpl 	uint32_t cdb_size;
1524942c5e3cSpl 	uint8_t cdb[16];
1525942c5e3cSpl 	struct aac_sg_table sg;
1526942c5e3cSpl };
1527942c5e3cSpl 
1528942c5e3cSpl #define	AAC_SENSE_BUFFERSIZE	 30
1529942c5e3cSpl 
1530942c5e3cSpl struct aac_srb_reply
1531942c5e3cSpl {
1532942c5e3cSpl 	uint32_t status;
1533942c5e3cSpl 	uint32_t srb_status;
1534942c5e3cSpl 	uint32_t scsi_status;
1535942c5e3cSpl 	uint32_t data_xfer_length;
1536942c5e3cSpl 	uint32_t sense_data_size;
153758bc78c7SXin Chen 	uint8_t sense_data[AAC_SENSE_BUFFERSIZE];
1538942c5e3cSpl };
1539942c5e3cSpl 
1540942c5e3cSpl /*
1541942c5e3cSpl  * SRB Flags
1542942c5e3cSpl  */
1543942c5e3cSpl #define	SRB_NoDataXfer			0x0000
1544942c5e3cSpl #define	SRB_DisableDisconnect		0x0004
1545942c5e3cSpl #define	SRB_DisableSynchTransfer	0x0008
1546942c5e3cSpl #define	SRB_BypassFrozenQueue		0x0010
1547942c5e3cSpl #define	SRB_DisableAutosense		0x0020
1548942c5e3cSpl #define	SRB_DataIn			0x0040
1549942c5e3cSpl #define	SRB_DataOut			0x0080
1550942c5e3cSpl 
1551942c5e3cSpl /*
1552942c5e3cSpl  * SRB Functions - set in aac_srb->function
1553942c5e3cSpl  */
1554942c5e3cSpl #define	SRBF_ExecuteScsi		0x0000
1555942c5e3cSpl #define	SRBF_ClaimDevice		0x0001
1556942c5e3cSpl #define	SRBF_IO_Control			0x0002
1557942c5e3cSpl #define	SRBF_ReceiveEvent		0x0003
1558942c5e3cSpl #define	SRBF_ReleaseQueue		0x0004
1559942c5e3cSpl #define	SRBF_AttachDevice		0x0005
1560942c5e3cSpl #define	SRBF_ReleaseDevice		0x0006
1561942c5e3cSpl #define	SRBF_Shutdown			0x0007
1562942c5e3cSpl #define	SRBF_Flush			0x0008
1563942c5e3cSpl #define	SRBF_AbortCommand		0x0010
1564942c5e3cSpl #define	SRBF_ReleaseRecovery		0x0011
1565942c5e3cSpl #define	SRBF_ResetBus			0x0012
1566942c5e3cSpl #define	SRBF_ResetDevice		0x0013
1567942c5e3cSpl #define	SRBF_TerminateIO		0x0014
1568942c5e3cSpl #define	SRBF_FlushQueue			0x0015
1569942c5e3cSpl #define	SRBF_RemoveDevice		0x0016
1570942c5e3cSpl #define	SRBF_DomainValidation		0x0017
1571942c5e3cSpl 
1572c9487164Spl /*
1573c9487164Spl  * SRB SCSI Status
1574c9487164Spl  * Status codes for SCSI passthrough commands,
1575c9487164Spl  * set in aac_srb->scsi_status
1576c9487164Spl  */
1577c9487164Spl #define	SRB_STATUS_PENDING			0x00
1578c9487164Spl #define	SRB_STATUS_SUCCESS			0x01
1579c9487164Spl #define	SRB_STATUS_ABORTED			0x02
1580c9487164Spl #define	SRB_STATUS_ABORT_FAILED			0x03
1581c9487164Spl #define	SRB_STATUS_ERROR			0x04
1582c9487164Spl #define	SRB_STATUS_BUSY				0x05
1583c9487164Spl #define	SRB_STATUS_INVALID_REQUEST		0x06
1584c9487164Spl #define	SRB_STATUS_INVALID_PATH_ID		0x07
1585c9487164Spl #define	SRB_STATUS_NO_DEVICE			0x08
1586c9487164Spl #define	SRB_STATUS_TIMEOUT			0x09
1587c9487164Spl #define	SRB_STATUS_SELECTION_TIMEOUT		0x0A
1588c9487164Spl #define	SRB_STATUS_COMMAND_TIMEOUT		0x0B
1589c9487164Spl #define	SRB_STATUS_MESSAGE_REJECTED		0x0D
1590c9487164Spl #define	SRB_STATUS_BUS_RESET			0x0E
1591c9487164Spl #define	SRB_STATUS_PARITY_ERROR			0x0F
1592c9487164Spl #define	SRB_STATUS_REQUEST_SENSE_FAILED		0x10
1593c9487164Spl #define	SRB_STATUS_NO_HBA			0x11
1594c9487164Spl #define	SRB_STATUS_DATA_OVERRUN			0x12
1595c9487164Spl #define	SRB_STATUS_UNEXPECTED_BUS_FREE		0x13
1596c9487164Spl #define	SRB_STATUS_PHASE_SEQUENCE_FAILURE	0x14
1597c9487164Spl #define	SRB_STATUS_BAD_SRB_BLOCK_LENGTH		0x15
1598c9487164Spl #define	SRB_STATUS_REQUEST_FLUSHED		0x16
1599c9487164Spl #define	SRB_STATUS_DELAYED_RETRY		0x17
1600c9487164Spl #define	SRB_STATUS_INVALID_LUN			0x20
1601c9487164Spl #define	SRB_STATUS_INVALID_TARGET_ID		0x21
1602c9487164Spl #define	SRB_STATUS_BAD_FUNCTION			0x22
1603c9487164Spl #define	SRB_STATUS_ERROR_RECOVERY		0x23
1604c9487164Spl #define	SRB_STATUS_NOT_STARTED			0x24
1605c9487164Spl #define	SRB_STATUS_NOT_IN_USE			0x30
1606c9487164Spl #define	SRB_STATUS_FORCE_ABORT			0x31
1607c9487164Spl #define	SRB_STATUS_DOMAIN_VALIDATION_FAIL	0x32
1608c9487164Spl 
1609942c5e3cSpl #pragma	pack()
1610942c5e3cSpl 
1611c9487164Spl /*
1612942c5e3cSpl  * Aligned structure definition for variable declarations that require
1613942c5e3cSpl  * alignment.
1614c9487164Spl  */
1615942c5e3cSpl union aac_fib_align {
1616942c5e3cSpl 	struct aac_fib d;
1617942c5e3cSpl 	uint32_t dumb;
1618c9487164Spl };
1619c9487164Spl 
16207c478bd9Sstevel@tonic-gate /* AAC Communication Space */
16217c478bd9Sstevel@tonic-gate struct aac_comm_space {
16227c478bd9Sstevel@tonic-gate 	struct aac_fib adapter_fibs[AAC_ADAPTER_FIBS];
16237c478bd9Sstevel@tonic-gate 	struct aac_adapter_init init_data;
1624830d82f7Spl 	struct aac_queue_table qtable;
1625830d82f7Spl 	char qt_align_pad[AAC_QUEUE_ALIGN];
1626830d82f7Spl 	char adapter_print_buf[AAC_ADAPTER_PRINT_BUFSIZE];
16277c478bd9Sstevel@tonic-gate };
16287c478bd9Sstevel@tonic-gate 
16297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
16307c478bd9Sstevel@tonic-gate }
16317c478bd9Sstevel@tonic-gate #endif
16327c478bd9Sstevel@tonic-gate 
16337c478bd9Sstevel@tonic-gate #endif /* __AAC_REGS_H__ */
1634