xref: /onnv-gate/usr/src/uts/common/io/aac/aac_regs.h (revision 12408:1b10f5564b76)
15678Spl196000 /*
2*12408SZhongyan.Gu@Sun.COM  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
35678Spl196000  */
45678Spl196000 
55678Spl196000 /*
65678Spl196000  * Copyright 2005-06 Adaptec, Inc.
75678Spl196000  * Copyright (c) 2005-06 Adaptec Inc., Achim Leubner
85678Spl196000  * Copyright (c) 2000 Michael Smith
95678Spl196000  * Copyright (c) 2000-2001 Scott Long
105678Spl196000  * Copyright (c) 2000 BSDi
115678Spl196000  * All rights reserved.
125678Spl196000  *
135678Spl196000  * Redistribution and use in source and binary forms, with or without
145678Spl196000  * modification, are permitted provided that the following conditions
155678Spl196000  * are met:
165678Spl196000  * 1. Redistributions of source code must retain the above copyright
175678Spl196000  *    notice, this list of conditions and the following disclaimer.
185678Spl196000  * 2. Redistributions in binary form must reproduce the above copyright
195678Spl196000  *    notice, this list of conditions and the following disclaimer in the
205678Spl196000  *    documentation and/or other materials provided with the distribution.
215678Spl196000  *
225678Spl196000  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
235678Spl196000  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
245678Spl196000  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
255678Spl196000  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
265678Spl196000  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
275678Spl196000  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
285678Spl196000  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
295678Spl196000  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
305678Spl196000  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
315678Spl196000  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
325678Spl196000  * SUCH DAMAGE.
335678Spl196000  *
345678Spl196000  *    $FreeBSD: src/sys/dev/aac/aacreg.h,v 1.23 2005/10/14 16:22:45 scottl Exp $
355678Spl196000  */
365678Spl196000 
375678Spl196000 #ifndef	__AAC_REGS_H__
385678Spl196000 #define	__AAC_REGS_H__
395678Spl196000 
405678Spl196000 #ifdef	__cplusplus
415678Spl196000 extern "C" {
425678Spl196000 #endif
435678Spl196000 
445678Spl196000 /* Status bits in the doorbell registers */
455678Spl196000 #define	AAC_DB_SYNC_COMMAND		(1<<0)	/* send/completed synchronous */
465678Spl196000 						/* FIB */
475678Spl196000 #define	AAC_DB_COMMAND_READY		(1<<1)	/* posted one or more */
485678Spl196000 						/* commands */
495678Spl196000 #define	AAC_DB_RESPONSE_READY		(1<<2)	/* one or more commands	*/
505678Spl196000 						/* complete */
515678Spl196000 #define	AAC_DB_COMMAND_NOT_FULL		(1<<3)	/* command queue not full */
525678Spl196000 #define	AAC_DB_RESPONSE_NOT_FULL	(1<<4)	/* response queue not full */
535678Spl196000 #define	AAC_DB_PRINTF_READY		(1<<5)	/* adapter requests host */
545678Spl196000 						/* printf */
555678Spl196000 #define	AAC_DB_INTR_BITS (AAC_DB_COMMAND_READY | \
565678Spl196000 	AAC_DB_RESPONSE_READY | AAC_DB_PRINTF_READY)
575678Spl196000 #define	AAC_DB_INTR_NEW			0x08
585678Spl196000 
595678Spl196000 /* Status bits in firmware status reg */
605678Spl196000 #define	AAC_SELF_TEST_FAILED		0x00000004
615678Spl196000 #define	AAC_MONITOR_PANIC		0x00000020
625678Spl196000 #define	AAC_KERNEL_UP_AND_RUNNING	0x00000080
635678Spl196000 #define	AAC_KERNEL_PANIC		0x00000100
645678Spl196000 
655678Spl196000 /* aac registers definitions */
665678Spl196000 #define	AAC_OMR0		0x18	/* outbound message register 0 */
675678Spl196000 #define	AAC_OMR1		0x1c	/* outbound message register 1 */
685678Spl196000 #define	AAC_IDBR		0x20	/* inbound doorbell reg */
695678Spl196000 #define	AAC_ODBR		0x2c	/* outbound doorbell reg */
705678Spl196000 #define	AAC_OIMR		0x34	/* outbound interrupt mask reg */
715678Spl196000 #define	AAC_IRCSR		0x38	/* inbound dual cores reset (SRL) */
725678Spl196000 #define	AAC_IQUE		0x40	/* inbound queue */
735678Spl196000 #define	AAC_OQUE		0x44	/* outbound queue */
745678Spl196000 #define	AAC_RX_MAILBOX		0x50	/* mailbox, size=20bytes, rx */
755678Spl196000 #define	AAC_RX_FWSTATUS		0x6c	/* firmware status, rx */
765678Spl196000 #define	AAC_RKT_MAILBOX		0x1000	/* mailbox, size=20bytes, rkt */
775678Spl196000 #define	AAC_RKT_FWSTATUS	0x101c	/* firmware status, rkt */
785678Spl196000 
795678Spl196000 /* Synchronous commands to the monitor/kernel. */
805678Spl196000 #define	AAC_BREAKPOINT_REQ	0x04
815678Spl196000 #define	AAC_MONKER_INITSTRUCT	0x05
825678Spl196000 #define	AAC_MONKER_SYNCFIB	0x0c
835678Spl196000 #define	AAC_MONKER_GETKERNVER	0x11
845678Spl196000 #define	AAC_MONKER_GETINFO	0x19
855678Spl196000 #define	AAC_MONKER_GETDRVPROP	0x23
865678Spl196000 #define	AAC_MONKER_GETCOMMPREF	0x26
875678Spl196000 #define	AAC_IOP_RESET		0x1000
885678Spl196000 
895678Spl196000 /* Sunrise Lake dual core reset */
905678Spl196000 #define	AAC_IRCSR_CORES_RST	3
915678Spl196000 
925678Spl196000 #define	AAC_SECTOR_SIZE		512
935678Spl196000 #define	AAC_NUMBER_OF_HEADS	255
945678Spl196000 #define	AAC_SECTORS_PER_TRACK	63
955678Spl196000 #define	AAC_ROTATION_SPEED	10000
965678Spl196000 #define	AAC_MAX_PFN		0xfffff
975678Spl196000 
985678Spl196000 #define	AAC_ADDITIONAL_LEN	31
995678Spl196000 #define	AAC_ANSI_VER		2
1005678Spl196000 #define	AAC_RESP_DATA_FORMAT	2
1015678Spl196000 
1025678Spl196000 #define	AAC_MAX_LD		64	/* max number of logical disks */
1037567SXin.Chen@Sun.COM #define	AAC_MAX_PD(s)		((s)->bus_max * (s)->tgt_max)
1047567SXin.Chen@Sun.COM #define	AAC_MAX_DEV(s)		(AAC_MAX_LD + AAC_MAX_PD((s)))
1055678Spl196000 #define	AAC_BLK_SIZE		AAC_SECTOR_SIZE
1065678Spl196000 #define	AAC_DMA_ALIGN		4
1075678Spl196000 #define	AAC_DMA_ALIGN_MASK	(AAC_DMA_ALIGN - 1)
1085678Spl196000 
1095678Spl196000 #define	AAC_MAX_CONTAINERS	AAC_MAX_LD
1105678Spl196000 
1115678Spl196000 /*
1125678Spl196000  * Minimum memory sizes we need to map to address the adapter. Before
1135678Spl196000  * we know the actual size to map, minimum memory is used instead.
1145678Spl196000  */
1155678Spl196000 #define	AAC_MAP_SIZE_MIN_RX	4096
1165678Spl196000 #define	AAC_MAP_SIZE_MIN_RKT	8192
1175678Spl196000 
1185678Spl196000 /*
1195678Spl196000  * Options supported by the adapter
1205678Spl196000  */
1215678Spl196000 #define	AAC_SUPPORTED_SNAPSHOT			0x01
1225678Spl196000 #define	AAC_SUPPORTED_CLUSTERS			0x02
1235678Spl196000 #define	AAC_SUPPORTED_WRITE_CACHE		0x04
1245678Spl196000 #define	AAC_SUPPORTED_64BIT_DATA		0x08
1255678Spl196000 #define	AAC_SUPPORTED_HOST_TIME_FIB		0x10
1265678Spl196000 #define	AAC_SUPPORTED_RAID50			0x20
1275678Spl196000 #define	AAC_SUPPORTED_4GB_WINDOW		0x40
1285678Spl196000 #define	AAC_SUPPORTED_SCSI_UPGRADEABLE		0x80
1295678Spl196000 #define	AAC_SUPPORTED_SOFT_ERR_REPORT		0x100
1305678Spl196000 #define	AAC_SUPPORTED_NOT_RECONDITION		0x200
1315678Spl196000 #define	AAC_SUPPORTED_SGMAP_HOST64		0x400
1325678Spl196000 #define	AAC_SUPPORTED_ALARM			0x800
1335678Spl196000 #define	AAC_SUPPORTED_NONDASD			0x1000
1345678Spl196000 #define	AAC_SUPPORTED_SCSI_MANAGED		0x2000
1355678Spl196000 #define	AAC_SUPPORTED_RAID_SCSI_MODE		0x4000
1365678Spl196000 #define	AAC_SUPPORTED_SUPPLEMENT_ADAPTER_INFO	0x10000
1375678Spl196000 #define	AAC_SUPPORTED_NEW_COMM			0x20000
1385678Spl196000 #define	AAC_SUPPORTED_64BIT_ARRAYSIZE		0x40000
1395678Spl196000 #define	AAC_SUPPORTED_HEAT_SENSOR		0x80000
1405678Spl196000 
14110976SZhongyan.Gu@Sun.COM /*
14210976SZhongyan.Gu@Sun.COM  * More options from supplement info - SupportedOptions2
14310976SZhongyan.Gu@Sun.COM  */
14410976SZhongyan.Gu@Sun.COM #define	AAC_SUPPORTED_MU_RESET			0x01
14510976SZhongyan.Gu@Sun.COM #define	AAC_SUPPORTED_IGNORE_RESET		0x02
14610976SZhongyan.Gu@Sun.COM #define	AAC_SUPPORTED_POWER_MANAGEMENT		0x04
14710976SZhongyan.Gu@Sun.COM #define	AAC_SUPPORTED_ARCIO_PHYDEV		0x08
148*12408SZhongyan.Gu@Sun.COM /*
149*12408SZhongyan.Gu@Sun.COM  * FeatureBits of RequestSupplementAdapterInfo used in the driver
150*12408SZhongyan.Gu@Sun.COM  */
151*12408SZhongyan.Gu@Sun.COM #define	AAC_FEATURE_SUPPORTED_JBOD		0x08000000
15210976SZhongyan.Gu@Sun.COM 
1535678Spl196000 #pragma	pack(1)
1545678Spl196000 
1555678Spl196000 /*
1565678Spl196000  * FIB (FSA Interface Block) this is the data structure passed between
1575678Spl196000  * the host and adapter.
1585678Spl196000  */
1595678Spl196000 struct aac_fib_header {
1605678Spl196000 	uint32_t	XferState;
1615678Spl196000 	uint16_t	Command;
1625678Spl196000 	uint8_t		StructType;
1635678Spl196000 	uint8_t		Flags;
1645678Spl196000 	uint16_t	Size;
1655678Spl196000 	uint16_t	SenderSize;
1665678Spl196000 	uint32_t	SenderFibAddress;
1675678Spl196000 	uint32_t	ReceiverFibAddress;
1685678Spl196000 	uint32_t	SenderData;
1695678Spl196000 	int prev;
1705678Spl196000 	int next;
1715678Spl196000 };
1725678Spl196000 
1735678Spl196000 /* FIB completed without error or no data was transferred in the FIB */
1745678Spl196000 #define	AAC_SENDERADDR_MASK_FAST_RESPONSE	0x01
1755678Spl196000 /* The received FIB is an AIF */
1765678Spl196000 #define	AAC_SENDERADDR_MASK_AIF			0x02
1775678Spl196000 
1785678Spl196000 #define	AAC_FIB_SIZE		512 /* size of a fib block in byte */
1795678Spl196000 #define	AAC_FIB_DATASIZE	(AAC_FIB_SIZE - sizeof (struct aac_fib_header))
1805678Spl196000 
1815678Spl196000 struct aac_fib {
1825678Spl196000 	struct aac_fib_header	Header;
1835678Spl196000 	uint8_t data[AAC_FIB_DATASIZE];
1845678Spl196000 };
1855678Spl196000 
1865678Spl196000 /* FIB transfer state */
1875678Spl196000 #define	AAC_FIBSTATE_HOSTOWNED		(1<<0)	/* owned by the host */
1885678Spl196000 #define	AAC_FIBSTATE_ADAPTEROWNED	(1<<1)	/* owned by the adapter */
1895678Spl196000 #define	AAC_FIBSTATE_INITIALISED	(1<<2)	/* has been initialised */
1905678Spl196000 #define	AAC_FIBSTATE_EMPTY		(1<<3)	/* is empty now */
1915678Spl196000 #define	AAC_FIBSTATE_FROMHOST		(1<<5)	/* sent from the host */
1925678Spl196000 #define	AAC_FIBSTATE_FROMADAP		(1<<6)	/* sent from the adapter */
1935678Spl196000 #define	AAC_FIBSTATE_REXPECTED		(1<<7)	/* response is expected */
1945678Spl196000 #define	AAC_FIBSTATE_NOREXPECTED	(1<<8)	/* no response is expected */
1955678Spl196000 #define	AAC_FIBSTATE_DONEADAP		(1<<9)	/* processed by the adapter */
1965678Spl196000 #define	AAC_FIBSTATE_DONEHOST		(1<<10)	/* processed by the host */
1975678Spl196000 #define	AAC_FIBSTATE_NORM		(1<<12)	/* normal priority */
1985678Spl196000 #define	AAC_FIBSTATE_ASYNC		(1<<13)
1995678Spl196000 #define	AAC_FIBSTATE_FAST_RESPONSE	(1<<19)	/* fast response capable */
2005678Spl196000 
2015678Spl196000 /* FIB types */
2025678Spl196000 #define	AAC_FIBTYPE_TFIB		1
2035678Spl196000 
2045678Spl196000 /*
2055678Spl196000  * FIB commands
2065678Spl196000  */
2075678Spl196000 
2085678Spl196000 #define	TestCommandResponse		1
2095678Spl196000 #define	TestAdapterCommand		2
2105678Spl196000 /* Lowlevel and comm commands */
2115678Spl196000 #define	LastTestCommand			100
2125678Spl196000 #define	ReinitHostNormCommandQueue	101
2135678Spl196000 #define	ReinitHostHighCommandQueue	102
2145678Spl196000 #define	ReinitHostHighRespQueue		103
2155678Spl196000 #define	ReinitHostNormRespQueue		104
2165678Spl196000 #define	ReinitAdapNormCommandQueue	105
2175678Spl196000 #define	ReinitAdapHighCommandQueue	107
2185678Spl196000 #define	ReinitAdapHighRespQueue		108
2195678Spl196000 #define	ReinitAdapNormRespQueue		109
2205678Spl196000 #define	InterfaceShutdown		110
2215678Spl196000 #define	DmaCommandFib			120
2225678Spl196000 #define	StartProfile			121
2235678Spl196000 #define	TermProfile			122
2245678Spl196000 #define	SpeedTest			123
2255678Spl196000 #define	TakeABreakPt			124
2265678Spl196000 #define	RequestPerfData			125
2275678Spl196000 #define	SetInterruptDefTimer		126
2285678Spl196000 #define	SetInterruptDefCount		127
2295678Spl196000 #define	GetInterruptDefStatus		128
2305678Spl196000 #define	LastCommCommand			129
2315678Spl196000 /* Filesystem commands */
2325678Spl196000 #define	NuFileSystem			300
2335678Spl196000 #define	UFS				301
2345678Spl196000 #define	HostFileSystem			302
2355678Spl196000 #define	LastFileSystemCommand		303
2365678Spl196000 /* Container commands */
2375678Spl196000 #define	ContainerCommand		500
2385678Spl196000 #define	ContainerCommand64		501
2395678Spl196000 #define	RawIo				502
2405678Spl196000 /* Cluster commands */
2415678Spl196000 #define	ClusterCommand			550
2425678Spl196000 /* Scsi Port commands (scsi passthrough) */
2435678Spl196000 #define	ScsiPortCommand			600
2445678Spl196000 #define	ScsiPortCommandU64		601
2455678Spl196000 /* Misc house keeping and generic adapter initiated commands */
2465678Spl196000 #define	AifRequest			700
2475678Spl196000 #define	CheckRevision			701
2485678Spl196000 #define	FsaHostShutdown			702
2495678Spl196000 #define	RequestAdapterInfo		703
2505678Spl196000 #define	IsAdapterPaused			704
2515678Spl196000 #define	SendHostTime			705
2525678Spl196000 #define	RequestSupplementAdapterInfo	706
2535678Spl196000 #define	LastMiscCommand			707
2545678Spl196000 #define	OnLineDiagnostic		800
2555678Spl196000 #define	FduAdapterTest			801
2565678Spl196000 
2575678Spl196000 /*
2585678Spl196000  * Revision number handling
2595678Spl196000  */
2605678Spl196000 struct FsaRev {
2615678Spl196000 	union {
2625678Spl196000 		struct {
2635678Spl196000 			uint8_t	dash;
2645678Spl196000 			uint8_t	type;
2655678Spl196000 			uint8_t	minor;
2665678Spl196000 			uint8_t	major;
2675678Spl196000 		} comp;
2685678Spl196000 		uint32_t ul;
2695678Spl196000 	} external;
2705678Spl196000 	uint32_t buildNumber;
2715678Spl196000 };
2725678Spl196000 
2735678Spl196000 /*
2745678Spl196000  * Structures used to respond to a RequestAdapterInfo FIB
2755678Spl196000  */
2765678Spl196000 struct aac_adapter_info {
2775678Spl196000 	uint32_t	PlatformBase;	/* adapter type */
2785678Spl196000 	uint32_t	CpuArchitecture; /* adapter CPU type */
2795678Spl196000 	uint32_t	CpuVariant;	/* adapter CPU subtype */
2805678Spl196000 	uint32_t	ClockSpeed;	/* adapter CPU clockspeed */
2815678Spl196000 	uint32_t	ExecutionMem;	/* adapter Execution Memory size */
2825678Spl196000 	uint32_t	BufferMem;	/* adapter Data Memory */
2835678Spl196000 	uint32_t	TotalMem;	/* adapter Total Memory */
2845678Spl196000 	struct FsaRev	KernelRevision;	/* adapter Kernel Software Revision */
2855678Spl196000 	struct FsaRev	MonitorRevision; /* adapter Monitor Software Revision */
2865678Spl196000 	struct FsaRev	HardwareRevision;
2875678Spl196000 	struct FsaRev	BIOSRevision;	/* adapter BIOS Revision */
2885678Spl196000 	uint32_t	ClusteringEnabled;
2895678Spl196000 	uint32_t	ClusterChannelMask;
2905678Spl196000 	uint64_t	SerialNumber;
2915678Spl196000 	uint32_t	batteryPlatform;
2925678Spl196000 	uint32_t	SupportedOptions; /* supported features */
2935678Spl196000 	uint32_t	OemVariant;
2945678Spl196000 };
2955678Spl196000 
2965678Spl196000 /*
2975678Spl196000  * The following definitions on Supplement Adapter Information
2985678Spl196000  * come from Adaptec:
2995678Spl196000  */
3005678Spl196000 struct vpd_info {
3015678Spl196000 	uint8_t		AssemblyPn[8];
3025678Spl196000 	uint8_t		FruPn[8];
3035678Spl196000 	uint8_t		BatteryFruPn[8];
3045678Spl196000 	uint8_t		EcVersionString[8];
3055678Spl196000 	uint8_t		Tsid[12];
3065678Spl196000 };
3075678Spl196000 
3085678Spl196000 #define	MFG_PCBA_SERIAL_NUMBER_WIDTH	12
3095678Spl196000 #define	MFG_WWN_WIDTH			8
3105678Spl196000 
3115678Spl196000 struct aac_supplement_adapter_info {
3125678Spl196000 	/* The assigned Adapter Type Text, extra byte for null termination */
3135678Spl196000 	int8_t		AdapterTypeText[17+1];
3145678Spl196000 	/* Pad for the text above */
3155678Spl196000 	int8_t		Pad[2];
3165678Spl196000 	/* Size in bytes of the memory that is flashed */
3175678Spl196000 	uint32_t	FlashMemoryByteSize;
3185678Spl196000 	/* The assigned IMAGEID_xxx for this adapter */
3195678Spl196000 	uint32_t	FlashImageId;
3205678Spl196000 	/*
3215678Spl196000 	 * The maximum number of Phys available on a SATA/SAS
3225678Spl196000 	 * Controller, 0 otherwise
3235678Spl196000 	 */
3245678Spl196000 	uint32_t	MaxNumberPorts;
3255678Spl196000 	/* Version of expansion area */
3265678Spl196000 	uint32_t	Version;
3275678Spl196000 	uint32_t	FeatureBits;
3285678Spl196000 	uint8_t		SlotNumber;
3295678Spl196000 	uint8_t		ReservedPad0[3];
3305678Spl196000 	uint8_t		BuildDate[12];
3315678Spl196000 	/* The current number of Ports on a SAS controller, 0 otherwise */
3325678Spl196000 	uint32_t	CurrentNumberPorts;
3335678Spl196000 
3345678Spl196000 	struct vpd_info VpdInfo;
3355678Spl196000 
3365678Spl196000 	/* Firmware Revision (Vmaj.min-dash.) */
3375678Spl196000 	struct FsaRev	FlashFirmwareRevision;
3385678Spl196000 	uint32_t	RaidTypeMorphOptions;
3395678Spl196000 	/* Firmware's boot code Revision (Vmaj.min-dash.) */
3405678Spl196000 	struct FsaRev	FlashFirmwareBootRevision;
3415678Spl196000 	/* PCBA serial no. from th MFG sector */
3425678Spl196000 	uint8_t		MfgPcbaSerialNo[MFG_PCBA_SERIAL_NUMBER_WIDTH];
3435678Spl196000 	/* WWN from the MFG sector */
3445678Spl196000 	uint8_t		MfgWWNName[MFG_WWN_WIDTH];
34510976SZhongyan.Gu@Sun.COM 	uint32_t	SupportedOptions2;	/* more supported features */
34610976SZhongyan.Gu@Sun.COM 	uint32_t	ExpansionFlag;	/* 1 - following fields are valid */
34710976SZhongyan.Gu@Sun.COM 	uint32_t	FeatureBits3;
34810976SZhongyan.Gu@Sun.COM 	uint32_t	SupportedPerformanceMode;
34910976SZhongyan.Gu@Sun.COM 	/* Growth Area for future expansion */
35010976SZhongyan.Gu@Sun.COM 	uint32_t	ReservedGrowth[80];
3515678Spl196000 };
3525678Spl196000 
3535678Spl196000 /* Container creation data */
3545678Spl196000 struct aac_container_creation {
3555678Spl196000 	uint8_t		ViaBuildNumber;
3565678Spl196000 	uint8_t		MicroSecond;
3575678Spl196000 	uint8_t		Via;		/* 1 = FSU, 2 = API, etc */
3585678Spl196000 	uint8_t		Years;		/* Since1900 */
3595678Spl196000 	uint32_t	Month:4;	/* 1-12 */
3605678Spl196000 	uint32_t	Day:6;		/* 1-32 */
3615678Spl196000 	uint32_t	Hour:6;		/* 0-23 */
3625678Spl196000 	uint32_t	Minute:6;	/* 0-59 */
3635678Spl196000 	uint32_t	Second:6;	/* 0-59 */
3645678Spl196000 	uint64_t	ViaAdapterSerialNumber;
3655678Spl196000 };
3665678Spl196000 
3675678Spl196000 struct aac_mntobj {
3685678Spl196000 	uint32_t		ObjectId;
3695678Spl196000 	char			FileSystemName[16];
3705678Spl196000 	struct aac_container_creation	CreateInfo;
3715678Spl196000 	uint32_t		Capacity;
3725678Spl196000 	uint32_t		VolType;
3735678Spl196000 	uint32_t		ObjType;
3745678Spl196000 	uint32_t		ContentState;
3755678Spl196000 	union {
3765678Spl196000 		uint32_t	pad[8];
3775678Spl196000 	} ObjExtension;
3785678Spl196000 	uint32_t		AlterEgoId;
3795678Spl196000 
3805678Spl196000 	uint32_t		CapacityHigh; /* 64-bit LBA */
3815678Spl196000 };
3825678Spl196000 
3835678Spl196000 struct aac_mntinfo {
3845678Spl196000 	uint32_t	Command;
3855678Spl196000 	uint32_t	MntType;
3865678Spl196000 	uint32_t	MntCount;
3875678Spl196000 };
3885678Spl196000 
3895678Spl196000 struct aac_mntinforesp {
3905678Spl196000 	uint32_t		Status;
3915678Spl196000 	uint32_t		MntType;
3925678Spl196000 	uint32_t		MntRespCount;
3935678Spl196000 	struct aac_mntobj	MntObj;
3945678Spl196000 };
3955678Spl196000 
3967567SXin.Chen@Sun.COM /*
3977567SXin.Chen@Sun.COM  * Structures used to access physical drives
3987567SXin.Chen@Sun.COM  */
3997567SXin.Chen@Sun.COM struct aac_bus_info {
4007567SXin.Chen@Sun.COM 	uint32_t	Command;	/* VM_Ioctl */
4017567SXin.Chen@Sun.COM 	uint32_t	ObjType;	/* FT_DRIVE */
4027567SXin.Chen@Sun.COM 	uint32_t	MethodId;	/* 1 = SCSI Layer */
4037567SXin.Chen@Sun.COM 	uint32_t	ObjectId;	/* Handle */
4047567SXin.Chen@Sun.COM 	uint32_t	CtlCmd;		/* GetBusInfo */
4057567SXin.Chen@Sun.COM };
4067567SXin.Chen@Sun.COM 
4077567SXin.Chen@Sun.COM struct aac_bus_info_response {
4087567SXin.Chen@Sun.COM 	uint32_t	Status;		/* ST_OK */
4097567SXin.Chen@Sun.COM 	uint32_t	ObjType;
4107567SXin.Chen@Sun.COM 	uint32_t	MethodId;	/* unused */
4117567SXin.Chen@Sun.COM 	uint32_t	ObjectId;	/* unused */
4127567SXin.Chen@Sun.COM 	uint32_t	CtlCmd;		/* unused */
4137567SXin.Chen@Sun.COM 	uint32_t	ProbeComplete;
4147567SXin.Chen@Sun.COM 	uint32_t	BusCount;
4157567SXin.Chen@Sun.COM 	uint32_t	TargetsPerBus;
4167567SXin.Chen@Sun.COM 	uint8_t		InitiatorBusId[10];
4177567SXin.Chen@Sun.COM 	uint8_t		BusValid[10];
4187567SXin.Chen@Sun.COM };
4197567SXin.Chen@Sun.COM 
4205678Spl196000 #define	CT_FIB_PARAMS			6
4215678Spl196000 #define	MAX_FIB_PARAMS			10
4225678Spl196000 #define	CT_PACKET_SIZE \
4235678Spl196000 	(AAC_FIB_DATASIZE - sizeof (uint32_t) - \
4245678Spl196000 	((sizeof (uint32_t)) * (MAX_FIB_PARAMS + 1)))
4255678Spl196000 
4265678Spl196000 #define	CNT_SIZE			5
4275678Spl196000 
4285678Spl196000 /* Container types */
4295678Spl196000 typedef enum {
4305678Spl196000 	CT_NONE = 0,
4315678Spl196000 	CT_VOLUME,
4325678Spl196000 	CT_MIRROR,
4335678Spl196000 	CT_STRIPE,
4345678Spl196000 	CT_RAID5,
4355678Spl196000 	CT_SSRW,
4365678Spl196000 	CT_SSRO,
4375678Spl196000 	CT_MORPH,
4385678Spl196000 	CT_PASSTHRU,
4395678Spl196000 	CT_RAID4,
4405678Spl196000 	CT_RAID10,		/* stripe of mirror */
4415678Spl196000 	CT_RAID00,		/* stripe of stripe */
4425678Spl196000 	CT_VOLUME_OF_MIRRORS,	/* volume of mirror */
4435678Spl196000 	CT_PSEUDO_RAID3,	/* really raid4 */
4445678Spl196000 	CT_RAID50,		/* stripe of raid5 */
4455678Spl196000 	CT_RAID5D,		/* raid5 distributed hot-sparing */
4465678Spl196000 	CT_RAID5D0,
4475678Spl196000 	CT_RAID1E,		/* extended raid1 mirroring */
4485678Spl196000 	CT_RAID6,
4495678Spl196000 	CT_RAID60
4505678Spl196000 } AAC_FSAVolType;
4515678Spl196000 
4525678Spl196000 /*
4535678Spl196000  * Container Configuration Sub-Commands
4545678Spl196000  */
4555678Spl196000 typedef enum {
4565678Spl196000 	CT_Null = 0,
4575678Spl196000 	CT_GET_SLICE_COUNT,		/* 1 */
4585678Spl196000 	CT_GET_PARTITION_COUNT,		/* 2 */
4595678Spl196000 	CT_GET_PARTITION_INFO,		/* 3 */
4605678Spl196000 	CT_GET_CONTAINER_COUNT,		/* 4 */
4615678Spl196000 	CT_GET_CONTAINER_INFO_OLD,	/* 5 */
4625678Spl196000 	CT_WRITE_MBR,			/* 6 */
4635678Spl196000 	CT_WRITE_PARTITION,		/* 7 */
4645678Spl196000 	CT_UPDATE_PARTITION,		/* 8 */
4655678Spl196000 	CT_UNLOAD_CONTAINER,		/* 9 */
4665678Spl196000 	CT_CONFIG_SINGLE_PRIMARY,	/* 10 */
4675678Spl196000 	CT_READ_CONFIG_AGE,		/* 11 */
4685678Spl196000 	CT_WRITE_CONFIG_AGE,		/* 12 */
4695678Spl196000 	CT_READ_SERIAL_NUMBER,		/* 13 */
4705678Spl196000 	CT_ZERO_PAR_ENTRY,		/* 14 */
4715678Spl196000 	CT_READ_MBR,			/* 15 */
4725678Spl196000 	CT_READ_PARTITION,		/* 16 */
4735678Spl196000 	CT_DESTROY_CONTAINER,		/* 17 */
4745678Spl196000 	CT_DESTROY2_CONTAINER,		/* 18 */
4755678Spl196000 	CT_SLICE_SIZE,			/* 19 */
4765678Spl196000 	CT_CHECK_CONFLICTS,		/* 20 */
4775678Spl196000 	CT_MOVE_CONTAINER,		/* 21 */
4785678Spl196000 	CT_READ_LAST_DRIVE,		/* 22 */
4795678Spl196000 	CT_WRITE_LAST_DRIVE,		/* 23 */
4805678Spl196000 	CT_UNMIRROR,			/* 24 */
4815678Spl196000 	CT_MIRROR_DELAY,		/* 25 */
4825678Spl196000 	CT_GEN_MIRROR,			/* 26 */
4835678Spl196000 	CT_GEN_MIRROR2,			/* 27 */
4845678Spl196000 	CT_TEST_CONTAINER,		/* 28 */
4855678Spl196000 	CT_MOVE2,			/* 29 */
4865678Spl196000 	CT_SPLIT,			/* 30 */
4875678Spl196000 	CT_SPLIT2,			/* 31 */
4885678Spl196000 	CT_SPLIT_BROKEN,		/* 32 */
4895678Spl196000 	CT_SPLIT_BROKEN2,		/* 33 */
4905678Spl196000 	CT_RECONFIG,			/* 34 */
4915678Spl196000 	CT_BREAK2,			/* 35 */
4925678Spl196000 	CT_BREAK,			/* 36 */
4935678Spl196000 	CT_MERGE2,			/* 37 */
4945678Spl196000 	CT_MERGE,			/* 38 */
4955678Spl196000 	CT_FORCE_ERROR,			/* 39 */
4965678Spl196000 	CT_CLEAR_ERROR,			/* 40 */
4975678Spl196000 	CT_ASSIGN_FAILOVER,		/* 41 */
4985678Spl196000 	CT_CLEAR_FAILOVER,		/* 42 */
4995678Spl196000 	CT_GET_FAILOVER_DATA,		/* 43 */
5005678Spl196000 	CT_VOLUME_ADD,			/* 44 */
5015678Spl196000 	CT_VOLUME_ADD2,			/* 45 */
5025678Spl196000 	CT_MIRROR_STATUS,		/* 46 */
5035678Spl196000 	CT_COPY_STATUS,			/* 47 */
5045678Spl196000 	CT_COPY,			/* 48 */
5055678Spl196000 	CT_UNLOCK_CONTAINER,		/* 49 */
5065678Spl196000 	CT_LOCK_CONTAINER,		/* 50 */
5075678Spl196000 	CT_MAKE_READ_ONLY,		/* 51 */
5085678Spl196000 	CT_MAKE_READ_WRITE,		/* 52 */
5095678Spl196000 	CT_CLEAN_DEAD,			/* 53 */
5105678Spl196000 	CT_ABORT_MIRROR_COMMAND,	/* 54 */
5115678Spl196000 	CT_SET,				/* 55 */
5125678Spl196000 	CT_GET,				/* 56 */
5135678Spl196000 	CT_GET_NVLOG_ENTRY,		/* 57 */
5145678Spl196000 	CT_GET_DELAY,			/* 58 */
5155678Spl196000 	CT_ZERO_CONTAINER_SPACE,	/* 59 */
5165678Spl196000 	CT_GET_ZERO_STATUS,		/* 60 */
5175678Spl196000 	CT_SCRUB,			/* 61 */
5185678Spl196000 	CT_GET_SCRUB_STATUS,		/* 62 */
5195678Spl196000 	CT_GET_SLICE_INFO,		/* 63 */
5205678Spl196000 	CT_GET_SCSI_METHOD,		/* 64 */
5215678Spl196000 	CT_PAUSE_IO,			/* 65 */
5225678Spl196000 	CT_RELEASE_IO,			/* 66 */
5235678Spl196000 	CT_SCRUB2,			/* 67 */
5245678Spl196000 	CT_MCHECK,			/* 68 */
5255678Spl196000 	CT_CORRUPT,			/* 69 */
5265678Spl196000 	CT_GET_TASK_COUNT,		/* 70 */
5275678Spl196000 	CT_PROMOTE,			/* 71 */
5285678Spl196000 	CT_SET_DEAD,			/* 72 */
5295678Spl196000 	CT_CONTAINER_OPTIONS,		/* 73 */
5305678Spl196000 	CT_GET_NV_PARAM,		/* 74 */
5315678Spl196000 	CT_GET_PARAM,			/* 75 */
5325678Spl196000 	CT_NV_PARAM_SIZE,		/* 76 */
5335678Spl196000 	CT_COMMON_PARAM_SIZE,		/* 77 */
5345678Spl196000 	CT_PLATFORM_PARAM_SIZE,		/* 78 */
5355678Spl196000 	CT_SET_NV_PARAM,		/* 79 */
5365678Spl196000 	CT_ABORT_SCRUB,			/* 80 */
5375678Spl196000 	CT_GET_SCRUB_ERROR,		/* 81 */
5385678Spl196000 	CT_LABEL_CONTAINER,		/* 82 */
5395678Spl196000 	CT_CONTINUE_DATA,		/* 83 */
5405678Spl196000 	CT_STOP_DATA,			/* 84 */
5415678Spl196000 	CT_GET_PARTITION_TABLE,		/* 85 */
5425678Spl196000 	CT_GET_DISK_PARTITIONS,		/* 86 */
5435678Spl196000 	CT_GET_MISC_STATUS,		/* 87 */
5445678Spl196000 	CT_GET_CONTAINER_PERF_INFO,	/* 88 */
5455678Spl196000 	CT_GET_TIME,			/* 89 */
5465678Spl196000 	CT_READ_DATA,			/* 90 */
5475678Spl196000 	CT_CTR,				/* 91 */
5485678Spl196000 	CT_CTL,				/* 92 */
5495678Spl196000 	CT_DRAINIO,			/* 93 */
5505678Spl196000 	CT_RELEASEIO,			/* 94 */
5515678Spl196000 	CT_GET_NVRAM,			/* 95 */
5525678Spl196000 	CT_GET_MEMORY,			/* 96 */
5535678Spl196000 	CT_PRINT_CT_LOG,		/* 97 */
5545678Spl196000 	CT_ADD_LEVEL,			/* 98 */
5555678Spl196000 	CT_NV_ZERO,			/* 99 */
5565678Spl196000 	CT_READ_SIGNATURE,		/* 100 */
5575678Spl196000 	CT_THROTTLE_ON,			/* 101 */
5585678Spl196000 	CT_THROTTLE_OFF,		/* 102 */
5595678Spl196000 	CT_GET_THROTTLE_STATS,		/* 103 */
5605678Spl196000 	CT_MAKE_SNAPSHOT,		/* 104 */
5615678Spl196000 	CT_REMOVE_SNAPSHOT,		/* 105 */
5625678Spl196000 	CT_WRITE_USER_FLAGS,		/* 106 */
5635678Spl196000 	CT_READ_USER_FLAGS,		/* 107 */
5645678Spl196000 	CT_MONITOR,			/* 108 */
5655678Spl196000 	CT_GEN_MORPH,			/* 109 */
5665678Spl196000 	CT_GET_SNAPSHOT_INFO,		/* 110 */
5675678Spl196000 	CT_CACHE_SET,			/* 111 */
5685678Spl196000 	CT_CACHE_STAT,			/* 112 */
5695678Spl196000 	CT_TRACE_START,			/* 113 */
5705678Spl196000 	CT_TRACE_STOP,			/* 114 */
5715678Spl196000 	CT_TRACE_ENABLE,		/* 115 */
5725678Spl196000 	CT_TRACE_DISABLE,		/* 116 */
5735678Spl196000 	CT_FORCE_CORE_DUMP,		/* 117 */
5745678Spl196000 	CT_SET_SERIAL_NUMBER,		/* 118 */
5755678Spl196000 	CT_RESET_SERIAL_NUMBER,		/* 119 */
5765678Spl196000 	CT_ENABLE_RAID5,		/* 120 */
5775678Spl196000 	CT_CLEAR_VALID_DUMP_FLAG,	/* 121 */
5785678Spl196000 	CT_GET_MEM_STATS,		/* 122 */
5795678Spl196000 	CT_GET_CORE_SIZE,		/* 123 */
5805678Spl196000 	CT_CREATE_CONTAINER_OLD,	/* 124 */
5815678Spl196000 	CT_STOP_DUMPS,			/* 125 */
5825678Spl196000 	CT_PANIC_ON_TAKE_A_BREAK,	/* 126 */
5835678Spl196000 	CT_GET_CACHE_STATS,		/* 127 */
5845678Spl196000 	CT_MOVE_PARTITION,		/* 128 */
5855678Spl196000 	CT_FLUSH_CACHE,			/* 129 */
5865678Spl196000 	CT_READ_NAME,			/* 130 */
5875678Spl196000 	CT_WRITE_NAME,			/* 131 */
5885678Spl196000 	CT_TOSS_CACHE,			/* 132 */
5895678Spl196000 	CT_LOCK_DRAINIO,		/* 133 */
5905678Spl196000 	CT_CONTAINER_OFFLINE,		/* 134 */
5915678Spl196000 	CT_SET_CACHE_SIZE,		/* 135 */
5925678Spl196000 	CT_CLEAN_SHUTDOWN_STATUS,	/* 136 */
5935678Spl196000 	CT_CLEAR_DISKLOG_ON_DISK,	/* 137 */
5945678Spl196000 	CT_CLEAR_ALL_DISKLOG,		/* 138 */
5955678Spl196000 	CT_CACHE_FAVOR,			/* 139 */
5965678Spl196000 	CT_READ_PASSTHRU_MBR,		/* 140 */
5975678Spl196000 	CT_SCRUB_NOFIX,			/* 141 */
5985678Spl196000 	CT_SCRUB2_NOFIX,		/* 142 */
5995678Spl196000 	CT_FLUSH,			/* 143 */
6005678Spl196000 	CT_REBUILD,	/* 144 rma, not really a command, partner to CT_SCRUB */
6015678Spl196000 	CT_FLUSH_CONTAINER,		/* 145 */
6025678Spl196000 	CT_RESTART,			/* 146 */
6035678Spl196000 	CT_GET_CONFIG_STATUS,		/* 147 */
6045678Spl196000 	CT_TRACE_FLAG,			/* 148 */
6055678Spl196000 	CT_RESTART_MORPH,		/* 149 */
6065678Spl196000 	CT_GET_TRACE_INFO,		/* 150 */
6075678Spl196000 	CT_GET_TRACE_ITEM,		/* 151 */
6085678Spl196000 	CT_COMMIT_CONFIG,		/* 152 */
6095678Spl196000 	CT_CONTAINER_EXISTS,		/* 153 */
6105678Spl196000 	CT_GET_SLICE_FROM_DEVT,		/* 154 */
6115678Spl196000 	CT_OPEN_READ_WRITE,		/* 155 */
6125678Spl196000 	CT_WRITE_MEMORY_BLOCK,		/* 156 */
6135678Spl196000 	CT_GET_CACHE_PARAMS,		/* 157 */
6145678Spl196000 	CT_CRAZY_CACHE,			/* 158 */
6155678Spl196000 	CT_GET_PROFILE_STRUCT,		/* 159 */
6165678Spl196000 	CT_SET_IO_TRACE_FLAG,		/* 160 */
6175678Spl196000 	CT_GET_IO_TRACE_STRUCT,		/* 161 */
6185678Spl196000 	CT_CID_TO_64BITS_UID,		/* 162 */
6195678Spl196000 	CT_64BITS_UID_TO_CID,		/* 163 */
6205678Spl196000 	CT_PAR_TO_64BITS_UID,		/* 164 */
6215678Spl196000 	CT_CID_TO_32BITS_UID,		/* 165 */
6225678Spl196000 	CT_32BITS_UID_TO_CID,		/* 166 */
6235678Spl196000 	CT_PAR_TO_32BITS_UID,		/* 167 */
6245678Spl196000 	CT_SET_FAILOVER_OPTION,		/* 168 */
6255678Spl196000 	CT_GET_FAILOVER_OPTION,		/* 169 */
6265678Spl196000 	CT_STRIPE_ADD2,			/* 170 */
6275678Spl196000 	CT_CREATE_VOLUME_SET,		/* 171 */
6285678Spl196000 	CT_CREATE_STRIPE_SET,		/* 172 */
6295678Spl196000 	/* 173	command and partner to scrub and rebuild task types */
6305678Spl196000 	CT_VERIFY_CONTAINER,
6315678Spl196000 	CT_IS_CONTAINER_DEAD,		/* 174 */
6325678Spl196000 	CT_GET_CONTAINER_OPTION,	/* 175 */
6335678Spl196000 	CT_GET_SNAPSHOT_UNUSED_STRUCT,	/* 176 */
6345678Spl196000 	CT_CLEAR_SNAPSHOT_UNUSED_STRUCT,	/* 177 */
6355678Spl196000 	CT_GET_CONTAINER_INFO,		/* 178 */
6365678Spl196000 	CT_CREATE_CONTAINER,		/* 179 */
6375678Spl196000 	CT_CHANGE_CREATIONINFO,		/* 180 */
6385678Spl196000 	CT_CHECK_CONFLICT_UID,		/* 181 */
6395678Spl196000 	CT_CONTAINER_UID_CHECK,		/* 182 */
6405678Spl196000 
6415678Spl196000 	/* 183 :RECmm: 20011220 added to support the Babylon */
6425678Spl196000 	CT_IS_CONTAINER_MEATADATA_STANDARD,
6435678Spl196000 	/* 184 :RECmm: 20011220 array imports */
6445678Spl196000 	CT_IS_SLICE_METADATA_STANDARD,
6455678Spl196000 
6465678Spl196000 	/* :BIOS_TEST: */
6475678Spl196000 	/* 185 :RECmm: 20020116	added to support BIOS interface for */
6485678Spl196000 	CT_GET_IMPORT_COUNT,
6495678Spl196000 	/* 186 :RECmm: 20020116	metadata conversion */
6505678Spl196000 	CT_CANCEL_ALL_IMPORTS,
6515678Spl196000 	CT_GET_IMPORT_INFO,		/* 187 :RECmm: 20020116	" */
6525678Spl196000 	CT_IMPORT_ARRAY,		/* 188 :RECmm: 20020116	" */
6535678Spl196000 	CT_GET_LOG_SIZE,		/* 189  */
6545678Spl196000 
6555678Spl196000 	/* Not BIOS TEST */
6565678Spl196000 	CT_ALARM_GET_STATE,		/* 190 */
6575678Spl196000 	CT_ALARM_SET_STATE,		/* 191 */
6585678Spl196000 	CT_ALARM_ON_OFF,		/* 192 */
6595678Spl196000 
6605678Spl196000 	CT_GET_EE_OEM_ID,		/* 193 */
6615678Spl196000 
6625678Spl196000 	CT_GET_PPI_HEADERS,		/* 194  get header fields only */
6635678Spl196000 	CT_GET_PPI_DATA,		/* 195  get all ppitable.data */
6645678Spl196000 	/* 196  get only range of entries specified in c_params */
6655678Spl196000 	CT_GET_PPI_ENTRIES,
6665678Spl196000 	/* 197  remove ppitable bundle specified by uid in c_param0 */
6675678Spl196000 	CT_DELETE_PPI_BUNDLE,
6685678Spl196000 
6695678Spl196000 	/* 198  current partition structure (not legacy) */
6705678Spl196000 	CT_GET_PARTITION_TABLE_2,
6715678Spl196000 	CT_GET_PARTITION_INFO_2,
6725678Spl196000 	CT_GET_DISK_PARTITIONS_2,
6735678Spl196000 
6745678Spl196000 	CT_QUIESCE_ADAPTER,		/* 201  chill dude */
6755678Spl196000 	CT_CLEAR_PPI_TABLE,		/* 202  clear ppi table */
6765678Spl196000 
6775678Spl196000 	CT_SET_DEVICE_CACHE_POLICY,	/* 203 */
6785678Spl196000 	CT_GET_DEVICE_CACHE_POLICY,	/* 204 */
6795678Spl196000 
6805678Spl196000 	CT_SET_VERIFY_DELAY,		/* 205 */
6815678Spl196000 	CT_GET_VERIFY_DELAY,		/* 206 */
6825678Spl196000 
6835678Spl196000 	/* 207 delete all PPI bundles that have an entry for device at devt */
6845678Spl196000 	CT_DELETE_PPI_BUNDLES_FOR_DEVT,
6855678Spl196000 
6865678Spl196000 	CT_READ_SW_SECTOR,		/* 208 */
6875678Spl196000 	CT_WRITE_SW_SECTOR,		/* 209 */
6885678Spl196000 
6895678Spl196000 	/* 210 added to support firmware cache sync operations */
6905678Spl196000 	CT_GET_CACHE_SYNC_INFO,
6915678Spl196000 	CT_SET_CACHE_SYNC_MODE,		/* 211 */
69210976SZhongyan.Gu@Sun.COM 	CT_PM_DRIVER_SUPPORT,		/* 212 */
69310976SZhongyan.Gu@Sun.COM 	CT_PM_CONFIGURATION,		/* 213 */
6945678Spl196000 
6955678Spl196000 	CT_LAST_COMMAND			/* last command */
6965678Spl196000 } AAC_CTCommand;
6975678Spl196000 
6985678Spl196000 /* General return status */
6995678Spl196000 #define	CT_OK				218
7005678Spl196000 
70110976SZhongyan.Gu@Sun.COM /* CT_PM_DRIVER_SUPPORT parameter */
70210976SZhongyan.Gu@Sun.COM typedef enum {
70310976SZhongyan.Gu@Sun.COM 	AAC_PM_DRIVERSUP_GET_STATUS = 1,
70410976SZhongyan.Gu@Sun.COM 	AAC_PM_DRIVERSUP_START_UNIT,
70510976SZhongyan.Gu@Sun.COM 	AAC_PM_DRIVERSUP_STOP_UNIT
70610976SZhongyan.Gu@Sun.COM } AAC_CT_PM_DRIVER_SUPPORT_SUB_COM;
70710976SZhongyan.Gu@Sun.COM 
7085678Spl196000 struct aac_fsa_ctm {
7095678Spl196000 	uint32_t	command;
7105678Spl196000 	uint32_t	param[CT_FIB_PARAMS];
7115678Spl196000 	int8_t		data[CT_PACKET_SIZE];
7125678Spl196000 };
7135678Spl196000 
7145678Spl196000 struct aac_Container {
7155678Spl196000 	uint32_t		Command;
7165678Spl196000 	struct aac_fsa_ctm	CTCommand;
7175678Spl196000 };
7185678Spl196000 
7195678Spl196000 struct aac_fsa_ctr {
7205678Spl196000 	uint32_t	response;
7215678Spl196000 	uint32_t	param[CT_FIB_PARAMS];
7225678Spl196000 	int8_t		data[CT_PACKET_SIZE];
7235678Spl196000 };
7245678Spl196000 
7255678Spl196000 struct aac_Container_resp {
7265678Spl196000 	uint32_t		Status;
7275678Spl196000 	struct aac_fsa_ctr	CTResponse;
7285678Spl196000 };
7295678Spl196000 
7305678Spl196000 struct aac_cf_status_header {
7315678Spl196000 	uint32_t	action;
7325678Spl196000 	uint16_t	flags;
7335678Spl196000 	int16_t		recordcount;
7345678Spl196000 };
7355678Spl196000 
7365678Spl196000 enum aac_cf_action_type {
7375678Spl196000 	CFACT_CONTINUE = 0,		/* Continue without pause */
7385678Spl196000 	CFACT_PAUSE,			/* Pause, then continue */
7395678Spl196000 	CFACT_ABORT			/* Abort */
7405678Spl196000 };
7415678Spl196000 
7425678Spl196000 enum aac_mpe {
7435678Spl196000 	AACMPE_OK = 0x0,
7445678Spl196000 	AACMPE_GET_CONFIG_STATUS = 0x1,
7455678Spl196000 	AACMPE_CONFIG_STATUS = 0x2,
7465678Spl196000 	AACMPE_COMMIT_CONFIG = 0x3
7475678Spl196000 };
7485678Spl196000 
7495678Spl196000 /*
7505678Spl196000  * CT_PAUSE_IO is immediate minimal runtime command that is used
7515678Spl196000  * to restart the applications and cache.
7525678Spl196000  */
7535678Spl196000 struct aac_pause_command {
7545678Spl196000 	uint32_t	Command;
7555678Spl196000 	uint32_t	Type;
7565678Spl196000 	uint32_t	Timeout;
7575678Spl196000 	uint32_t	Min;
7585678Spl196000 	uint32_t	NoRescan;
7595678Spl196000 	uint32_t	Parm3;
7605678Spl196000 	uint32_t	Parm4;
7615678Spl196000 	uint32_t	Count;
7625678Spl196000 };
7635678Spl196000 
7645678Spl196000 /*
7655678Spl196000  * The following two definitions come from Adaptec:
7665678Spl196000  *
7675678Spl196000  * Used to flush drive cache for container "cid"
7685678Spl196000  */
7695678Spl196000 struct aac_synchronize_command {
7705678Spl196000 	uint32_t	Command;	/* VM_ContainerConfig */
7715678Spl196000 	uint32_t	Type;		/* CT_FLUSH_CACHE */
7725678Spl196000 	uint32_t	Cid;
7735678Spl196000 	uint32_t	Parm1;
7745678Spl196000 	uint32_t	Parm2;
7755678Spl196000 	uint32_t	Parm3;
7765678Spl196000 	uint32_t	Parm4;
7775678Spl196000 	uint32_t	Count;
7785678Spl196000 };
7795678Spl196000 
7805678Spl196000 struct aac_synchronize_reply {
7815678Spl196000 	uint32_t	Dummy0;
7825678Spl196000 	uint32_t	Dummy1;
7835678Spl196000 	uint32_t	Status;
7845678Spl196000 	uint32_t	Parm1;
7855678Spl196000 	uint32_t	Parm2;
7865678Spl196000 	uint32_t	Parm3;
7875678Spl196000 	uint32_t	Parm4;
7885678Spl196000 	uint32_t	Parm5;
7895678Spl196000 	uint8_t		Data[16];
7905678Spl196000 };
7915678Spl196000 
7925678Spl196000 /*
7935678Spl196000  * Command status values
7945678Spl196000  */
7955678Spl196000 typedef enum {
7965678Spl196000 	ST_OK = 0,
7975678Spl196000 	ST_PERM = 1,
7985678Spl196000 	ST_NOENT = 2,
7995678Spl196000 	ST_IO = 5,
8005678Spl196000 	ST_NXIO = 6,
8015678Spl196000 	ST_E2BIG = 7,
8025678Spl196000 	ST_ACCES = 13,
8035678Spl196000 	ST_EXIST = 17,
8045678Spl196000 	ST_XDEV = 18,
8055678Spl196000 	ST_NODEV = 19,
8065678Spl196000 	ST_NOTDIR = 20,
8075678Spl196000 	ST_ISDIR = 21,
8085678Spl196000 	ST_INVAL = 22,
8095678Spl196000 	ST_FBIG = 27,
8105678Spl196000 	ST_NOSPC = 28,
8115678Spl196000 	ST_ROFS = 30,
8125678Spl196000 	ST_MLINK = 31,
8135678Spl196000 	ST_WOULDBLOCK = 35,
8145678Spl196000 	ST_NAMETOOLONG = 63,
8155678Spl196000 	ST_NOTEMPTY = 66,
8165678Spl196000 	ST_DQUOT = 69,
8175678Spl196000 	ST_STALE = 70,
8185678Spl196000 	ST_REMOTE = 71,
8195678Spl196000 	ST_BADHANDLE = 10001,
8205678Spl196000 	ST_NOT_SYNC = 10002,
8215678Spl196000 	ST_BAD_COOKIE = 10003,
8225678Spl196000 	ST_NOTSUPP = 10004,
8235678Spl196000 	ST_TOOSMALL = 10005,
8245678Spl196000 	ST_SERVERFAULT = 10006,
8255678Spl196000 	ST_BADTYPE = 10007,
8265678Spl196000 	ST_JUKEBOX = 10008,
8275678Spl196000 	ST_NOTMOUNTED = 10009,
8285678Spl196000 	ST_MAINTMODE = 10010,
8295678Spl196000 	ST_STALEACL = 10011
8305678Spl196000 } AAC_FSAStatus;
8315678Spl196000 
8325678Spl196000 /*
8335678Spl196000  * Object-Server / Volume-Manager Dispatch Classes
8345678Spl196000  */
8355678Spl196000 typedef enum {
8365678Spl196000 	VM_Null = 0,
8375678Spl196000 	VM_NameServe,
8385678Spl196000 	VM_ContainerConfig,
8395678Spl196000 	VM_Ioctl,
8405678Spl196000 	VM_FilesystemIoctl,
8415678Spl196000 	VM_CloseAll,
8425678Spl196000 	VM_CtBlockRead,
8435678Spl196000 	VM_CtBlockWrite,
8445678Spl196000 	VM_SliceBlockRead,	/* raw access to configured "storage objects" */
8455678Spl196000 	VM_SliceBlockWrite,
8465678Spl196000 	VM_DriveBlockRead,	/* raw access to physical devices */
8475678Spl196000 	VM_DriveBlockWrite,
8485678Spl196000 	VM_EnclosureMgt,	/* enclosure management */
8495678Spl196000 	VM_Unused,		/* used to be diskset management */
8505678Spl196000 	VM_CtBlockVerify,
8515678Spl196000 	VM_CtPerf,		/* performance test */
8525678Spl196000 	VM_CtBlockRead64,
8535678Spl196000 	VM_CtBlockWrite64,
8545678Spl196000 	VM_CtBlockVerify64,
8555678Spl196000 	VM_CtHostRead64,
8565678Spl196000 	VM_CtHostWrite64,
8575678Spl196000 	VM_NameServe64 = 22,
8585678Spl196000 	MAX_VMCOMMAND_NUM	/* used for sizing stats array - leave last */
8595678Spl196000 } AAC_VMCommand;
8605678Spl196000 
8615678Spl196000 /*
8625678Spl196000  * Host-addressable object types
8635678Spl196000  */
8645678Spl196000 typedef enum {
8655678Spl196000 	FT_REG = 1,	/* regular file */
8665678Spl196000 	FT_DIR,		/* directory */
8675678Spl196000 	FT_BLK,		/* "block" device - reserved */
8685678Spl196000 	FT_CHR,		/* "character special" device - reserved */
8695678Spl196000 	FT_LNK,		/* symbolic link */
8705678Spl196000 	FT_SOCK,	/* socket */
8715678Spl196000 	FT_FIFO,	/* fifo */
8725678Spl196000 	FT_FILESYS,	/* ADAPTEC's "FSA"(tm) filesystem */
8735678Spl196000 	FT_DRIVE,	/* physical disk - addressable in scsi by b/t/l */
8745678Spl196000 	FT_SLICE,	/* virtual disk - raw volume - slice */
8755678Spl196000 	FT_PARTITION,	/* FSA partition - carved out of a slice - building */
8765678Spl196000 			/* block for containers */
8775678Spl196000 	FT_VOLUME,	/* Container - Volume Set */
8785678Spl196000 	FT_STRIPE,	/* Container - Stripe Set */
8795678Spl196000 	FT_MIRROR,	/* Container - Mirror Set */
8805678Spl196000 	FT_RAID5,	/* Container - Raid 5 Set */
8815678Spl196000 	FT_DATABASE	/* Storage object with "foreign" content manager */
8825678Spl196000 } AAC_FType;
8835678Spl196000 
8845678Spl196000 /* Host-side scatter/gather list for 32-bit, 64-bit, raw commands */
8855678Spl196000 struct aac_sg_entry {
8865678Spl196000 	uint32_t	SgAddress;
8875678Spl196000 	uint32_t	SgByteCount;
8885678Spl196000 };
8895678Spl196000 
8905678Spl196000 struct aac_sg_entry64 {
8915678Spl196000 	uint64_t	SgAddress;
8925678Spl196000 	uint32_t	SgByteCount;
8935678Spl196000 };
8945678Spl196000 
8955678Spl196000 struct aac_sg_entryraw {
8965678Spl196000 	uint32_t	Next;		/* reserved */
8975678Spl196000 	uint32_t	Prev;		/* reserved */
8985678Spl196000 	uint64_t	SgAddress;
8995678Spl196000 	uint32_t	SgByteCount;
9005678Spl196000 	uint32_t	Flags;		/* reserved */
9015678Spl196000 };
9025678Spl196000 
9035678Spl196000 struct aac_sg_table {
9045678Spl196000 	uint32_t		SgCount;
9055678Spl196000 	struct aac_sg_entry	SgEntry[1]; /* at least there is one */
9065678Spl196000 					    /* SUN's CC cannot accept [0] */
9075678Spl196000 };
9085678Spl196000 
9095678Spl196000 struct aac_sg_table64 {
9105678Spl196000 	uint32_t		SgCount;
9115678Spl196000 	struct aac_sg_entry64	SgEntry64[1];
9125678Spl196000 };
9135678Spl196000 
9145678Spl196000 struct aac_sg_tableraw {
9155678Spl196000 	uint32_t		SgCount;
9165678Spl196000 	struct aac_sg_entryraw	SgEntryRaw[1];
9175678Spl196000 };
9185678Spl196000 
9195678Spl196000 /*
9205678Spl196000  * Block read/write operations.
9215678Spl196000  * These structures are packed into the 'data' area in the FIB.
9225678Spl196000  */
9235678Spl196000 struct aac_blockread {
9245678Spl196000 	uint32_t		Command;
9255678Spl196000 	uint32_t		ContainerId;
9265678Spl196000 	uint32_t		BlockNumber;
9275678Spl196000 	uint32_t		ByteCount;
9285678Spl196000 	struct aac_sg_table	SgMap;
9295678Spl196000 };
9305678Spl196000 
9315678Spl196000 struct aac_blockread64 {
9325678Spl196000 	uint32_t		Command;
9335678Spl196000 	uint16_t		ContainerId;
9345678Spl196000 	uint16_t		SectorCount;
9355678Spl196000 	uint32_t		BlockNumber;
9365678Spl196000 	uint16_t		Pad;
9375678Spl196000 	uint16_t		Flags;
9385678Spl196000 	struct aac_sg_table64	SgMap64;
9395678Spl196000 };
9405678Spl196000 
9415678Spl196000 struct aac_blockread_response {
9425678Spl196000 	uint32_t		Status;
9435678Spl196000 	uint32_t		ByteCount;
9445678Spl196000 };
9455678Spl196000 
9465678Spl196000 struct aac_blockwrite {
9475678Spl196000 	uint32_t		Command;
9485678Spl196000 	uint32_t		ContainerId;
9495678Spl196000 	uint32_t		BlockNumber;
9505678Spl196000 	uint32_t		ByteCount;
9515678Spl196000 	uint32_t		Stable;
9525678Spl196000 	struct aac_sg_table	SgMap;
9535678Spl196000 };
9545678Spl196000 
9555678Spl196000 struct aac_blockwrite64 {
9565678Spl196000 	uint32_t		Command;
9575678Spl196000 	uint16_t		ContainerId;
9585678Spl196000 	uint16_t		SectorCount;
9595678Spl196000 	uint32_t		BlockNumber;
9605678Spl196000 	uint16_t		Pad;
9615678Spl196000 	uint16_t		Flags;
9625678Spl196000 	struct aac_sg_table64	SgMap64;
9635678Spl196000 };
9645678Spl196000 
9655678Spl196000 struct aac_blockwrite_response {
9665678Spl196000 	uint32_t		Status;
9675678Spl196000 	uint32_t		ByteCount;
9685678Spl196000 	uint32_t		Committed;
9695678Spl196000 };
9705678Spl196000 
9715678Spl196000 struct aac_raw_io {
9725678Spl196000 	uint64_t		BlockNumber;
9735678Spl196000 	uint32_t		ByteCount;
9745678Spl196000 	uint16_t		ContainerId;
9755678Spl196000 	uint16_t		Flags;		/* 0: W, 1: R */
9765678Spl196000 	uint16_t		BpTotal;	/* reserved */
9775678Spl196000 	uint16_t		BpComplete;	/* reserved */
9785678Spl196000 	struct aac_sg_tableraw	SgMapRaw;
9795678Spl196000 };
9805678Spl196000 
9815678Spl196000 /*
9825678Spl196000  * Container shutdown command.
9835678Spl196000  */
9845678Spl196000 struct aac_close_command {
9855678Spl196000 	uint32_t		Command;
9865678Spl196000 	uint32_t		ContainerId;
9875678Spl196000 };
9885678Spl196000 
9897567SXin.Chen@Sun.COM /*
9907567SXin.Chen@Sun.COM  * Container Config Command
9917567SXin.Chen@Sun.COM  */
9927567SXin.Chen@Sun.COM struct aac_ctcfg {
9937567SXin.Chen@Sun.COM 	uint32_t		Command;
9947567SXin.Chen@Sun.COM 	uint32_t		cmd;
9957567SXin.Chen@Sun.COM 	uint32_t		param;
9967567SXin.Chen@Sun.COM };
9977567SXin.Chen@Sun.COM 
9987567SXin.Chen@Sun.COM struct aac_ctcfg_resp {
9997567SXin.Chen@Sun.COM 	uint32_t		Status;
10007567SXin.Chen@Sun.COM 	uint32_t		resp;
10017567SXin.Chen@Sun.COM 	uint32_t		param;
10027567SXin.Chen@Sun.COM };
10037567SXin.Chen@Sun.COM 
10045678Spl196000 /* Write 'stability' options */
10055678Spl196000 #define	CSTABLE			1
10065678Spl196000 #define	CUNSTABLE		2
10075678Spl196000 
10085678Spl196000 /* Number of FIBs for the controller to send us messages */
10095678Spl196000 #define	AAC_ADAPTER_FIBS	8
10105678Spl196000 
10115678Spl196000 /* Number of FIBs for the host I/O request */
10125678Spl196000 #define	AAC_HOST_FIBS		256
10135678Spl196000 
10145678Spl196000 /* Size of buffer for text messages from the controller */
10155678Spl196000 #define	AAC_ADAPTER_PRINT_BUFSIZE		256
10165678Spl196000 
10175678Spl196000 #define	AAC_INIT_STRUCT_REVISION		3
10185678Spl196000 #define	AAC_INIT_STRUCT_REVISION_4		4
10195678Spl196000 #define	AAC_INIT_STRUCT_MINIPORT_REVISION	1
102010976SZhongyan.Gu@Sun.COM 
10215678Spl196000 #define	AAC_INIT_FLAGS_NEW_COMM_SUPPORTED	1
102210976SZhongyan.Gu@Sun.COM #define	AAC_INIT_FLAGS_DRIVER_USES_UTC_TIME	0x10
102310976SZhongyan.Gu@Sun.COM #define	AAC_INIT_FLAGS_DRIVER_SUPPORTS_PM	0x20
102410976SZhongyan.Gu@Sun.COM 
10255678Spl196000 #define	AAC_PAGE_SIZE				4096
10265678Spl196000 struct aac_adapter_init {
10275678Spl196000 	uint32_t	InitStructRevision;
10285678Spl196000 	uint32_t	MiniPortRevision;
10295678Spl196000 	uint32_t	FilesystemRevision;
10305678Spl196000 	uint32_t	CommHeaderAddress;
10315678Spl196000 	uint32_t	FastIoCommAreaAddress;
10325678Spl196000 	uint32_t	AdapterFibsPhysicalAddress;
10335678Spl196000 	uint32_t	AdapterFibsVirtualAddress;
10345678Spl196000 	uint32_t	AdapterFibsSize;
10355678Spl196000 	uint32_t	AdapterFibAlign;
10365678Spl196000 	uint32_t	PrintfBufferAddress;
10375678Spl196000 	uint32_t	PrintfBufferSize;
10385678Spl196000 	uint32_t	HostPhysMemPages;
10395678Spl196000 	uint32_t	HostElapsedSeconds;
10405678Spl196000 	/* ADAPTER_INIT_STRUCT_REVISION_4 begins here */
10415678Spl196000 	uint32_t	InitFlags;
10425678Spl196000 	uint32_t	MaxIoCommands;
10435678Spl196000 	uint32_t	MaxIoSize;
10445678Spl196000 	uint32_t	MaxFibSize;
10455678Spl196000 };
10465678Spl196000 
10475678Spl196000 /* ************AAC QUEUE DEFINES (BELOW)*********** */
10485678Spl196000 
10495678Spl196000 #define	AAC_QUEUE_ALIGN		16
10505678Spl196000 #define	AAC_QUEUE_COUNT		8
10515678Spl196000 #define	AAC_PRODUCER_INDEX	0
10525678Spl196000 #define	AAC_CONSUMER_INDEX	1
10535678Spl196000 
10545678Spl196000 struct aac_queue_entry {
10555678Spl196000 	uint32_t aq_fib_size;	/* FIB size in bytes */
10565678Spl196000 	uint32_t aq_fib_addr;	/* receiver-space address of the FIB */
10575678Spl196000 };
10585678Spl196000 
10595678Spl196000 /*
10605678Spl196000  * Queue names
10615678Spl196000  *
10625678Spl196000  * Note that we base these at 0 in order to use them as array indices.
10635678Spl196000  * Adaptec used base 1 for some unknown reason, and sorted them in a
10645678Spl196000  * different order.
10655678Spl196000  */
10665678Spl196000 #define	AAC_HOST_NORM_CMD_Q	0
10675678Spl196000 #define	AAC_HOST_HIGH_CMD_Q	1
10685678Spl196000 #define	AAC_ADAP_NORM_CMD_Q	2
10695678Spl196000 #define	AAC_ADAP_HIGH_CMD_Q	3
10705678Spl196000 #define	AAC_HOST_NORM_RESP_Q	4
10715678Spl196000 #define	AAC_HOST_HIGH_RESP_Q	5
10725678Spl196000 #define	AAC_ADAP_NORM_RESP_Q	6
10735678Spl196000 #define	AAC_ADAP_HIGH_RESP_Q	7
10745678Spl196000 
10755678Spl196000 /*
10765678Spl196000  * We establish 4 command queues and matching response queues. Queues must
10775678Spl196000  * be 16-byte aligned, and are sized as follows:
10785678Spl196000  */
10795678Spl196000 /* command adapter->host, normal priority */
10805678Spl196000 #define	AAC_HOST_NORM_CMD_ENTRIES	8
10815678Spl196000 /* command adapter->host, high priority */
10825678Spl196000 #define	AAC_HOST_HIGH_CMD_ENTRIES	4
10835678Spl196000 /* command host->adapter, normal priority */
10845678Spl196000 #define	AAC_ADAP_NORM_CMD_ENTRIES	512
10855678Spl196000 /* command host->adapter, high priority */
10865678Spl196000 #define	AAC_ADAP_HIGH_CMD_ENTRIES	4
10875678Spl196000 /* response, adapter->host, normal priority */
10885678Spl196000 #define	AAC_HOST_NORM_RESP_ENTRIES	512
10895678Spl196000 /* response, adapter->host, high priority */
10905678Spl196000 #define	AAC_HOST_HIGH_RESP_ENTRIES	4
10915678Spl196000 /* response, host->adapter, normal priority */
10925678Spl196000 #define	AAC_ADAP_NORM_RESP_ENTRIES	8
10935678Spl196000 /* response, host->adapter, high priority */
10945678Spl196000 #define	AAC_ADAP_HIGH_RESP_ENTRIES	4
10955678Spl196000 
10965678Spl196000 #define	AAC_TOTALQ_LENGTH	(AAC_HOST_HIGH_CMD_ENTRIES + \
10975678Spl196000 				AAC_HOST_NORM_CMD_ENTRIES + \
10985678Spl196000 				AAC_ADAP_HIGH_CMD_ENTRIES + \
10995678Spl196000 				AAC_ADAP_NORM_CMD_ENTRIES + \
11005678Spl196000 				AAC_HOST_HIGH_RESP_ENTRIES + \
11015678Spl196000 				AAC_HOST_NORM_RESP_ENTRIES + \
11025678Spl196000 				AAC_ADAP_HIGH_RESP_ENTRIES + \
11035678Spl196000 				AAC_ADAP_NORM_RESP_ENTRIES)
11045678Spl196000 
11055678Spl196000 /*
11065678Spl196000  * Table of queue indices and queues used to communicate with the
11075678Spl196000  * controller. This structure must be aligned to AAC_QUEUE_ALIGN.
11085678Spl196000  */
11095678Spl196000 struct aac_queue_table {
11105678Spl196000 	/* queue consumer/producer indexes (layout mandated by adapter) */
11115678Spl196000 	uint32_t qt_qindex[AAC_QUEUE_COUNT][2];
11125678Spl196000 
11135678Spl196000 	/* queue entry structures (layout mandated by adapter) */
11145678Spl196000 	struct aac_queue_entry qt_HostNormCmdQueue \
11155678Spl196000 	    [AAC_HOST_NORM_CMD_ENTRIES];
11165678Spl196000 	struct aac_queue_entry qt_HostHighCmdQueue \
11175678Spl196000 	    [AAC_HOST_HIGH_CMD_ENTRIES];
11185678Spl196000 	struct aac_queue_entry qt_AdapNormCmdQueue \
11195678Spl196000 	    [AAC_ADAP_NORM_CMD_ENTRIES];
11205678Spl196000 	struct aac_queue_entry qt_AdapHighCmdQueue \
11215678Spl196000 	    [AAC_ADAP_HIGH_CMD_ENTRIES];
11225678Spl196000 	struct aac_queue_entry qt_HostNormRespQueue \
11235678Spl196000 	    [AAC_HOST_NORM_RESP_ENTRIES];
11245678Spl196000 	struct aac_queue_entry qt_HostHighRespQueue \
11255678Spl196000 	    [AAC_HOST_HIGH_RESP_ENTRIES];
11265678Spl196000 	struct aac_queue_entry qt_AdapNormRespQueue \
11275678Spl196000 	    [AAC_ADAP_NORM_RESP_ENTRIES];
11285678Spl196000 	struct aac_queue_entry qt_AdapHighRespQueue \
11295678Spl196000 	    [AAC_ADAP_HIGH_RESP_ENTRIES];
11305678Spl196000 };
11315678Spl196000 /* ************AAC QUEUE DEFINES (ABOVE)*********** */
11325678Spl196000 
11335678Spl196000 /*
11345678Spl196000  * NVRAM/Write Cache subsystem battery component states
11355678Spl196000  */
11365678Spl196000 typedef enum {
11375678Spl196000 	NVBATTSTATUS_NONE = 0,	/* battery has no power or is not present */
11385678Spl196000 	NVBATTSTATUS_LOW,	/* battery is low on power */
11395678Spl196000 	NVBATTSTATUS_OK,	/* battery is okay - normal operation */
11405678Spl196000 				/* possible only in this state */
11415678Spl196000 	NVBATTSTATUS_RECONDITIONING	/* no battery present */
11425678Spl196000 					/* - reconditioning in process */
11435678Spl196000 } AAC_NVBATTSTATUS;
11445678Spl196000 
11455678Spl196000 /*
11465678Spl196000  * Battery transition type
11475678Spl196000  */
11485678Spl196000 typedef enum {
11495678Spl196000 	NVBATT_TRANSITION_NONE = 0,	/* battery now has no power or is not */
11505678Spl196000 					/* present */
11515678Spl196000 	NVBATT_TRANSITION_LOW,	/* battery is now low on power */
11525678Spl196000 	NVBATT_TRANSITION_OK	/* battery is now okay - normal */
11535678Spl196000 				/* operation possible only in this state */
11545678Spl196000 } AAC_NVBATT_TRANSITION;
11555678Spl196000 
11565678Spl196000 /*
11575678Spl196000  * Data types relating to AIFs
11585678Spl196000  */
11595678Spl196000 
11605678Spl196000 /*
11615678Spl196000  * Progress Reports
11625678Spl196000  */
11635678Spl196000 typedef enum {
11645678Spl196000 	AifJobStsSuccess = 1,
11655678Spl196000 	AifJobStsFinished,
11665678Spl196000 	AifJobStsAborted,
11675678Spl196000 	AifJobStsFailed,
11685678Spl196000 	AifJobStsLastReportMarker = 100,	/* All prior mean last report */
11695678Spl196000 	AifJobStsSuspended,
11705678Spl196000 	AifJobStsRunning
11715678Spl196000 } AAC_AifJobStatus;
11725678Spl196000 
11735678Spl196000 typedef enum {
11745678Spl196000 	AifJobScsiMin = 1,	/* Minimum value for Scsi operation */
11755678Spl196000 	AifJobScsiZero,		/* SCSI device clear operation */
11765678Spl196000 	AifJobScsiVerify,	/* SCSI device Verify operation NO REPAIR */
11775678Spl196000 	AifJobScsiExercise,	/* SCSI device Exercise operation */
11785678Spl196000 	AifJobScsiVerifyRepair,	/* SCSI device Verify operation WITH repair */
11795678Spl196000 	AifJobScsiWritePattern,	/* write pattern */
11805678Spl196000 	AifJobScsiMax = 99,	/* Max Scsi value */
11815678Spl196000 	AifJobCtrMin,		/* Min Ctr op value */
11825678Spl196000 	AifJobCtrZero,		/* Container clear operation */
11835678Spl196000 	AifJobCtrCopy,		/* Container copy operation */
11845678Spl196000 	AifJobCtrCreateMirror,	/* Container Create Mirror operation */
11855678Spl196000 	AifJobCtrMergeMirror,	/* Container Merge Mirror operation */
11865678Spl196000 	AifJobCtrScrubMirror,	/* Container Scrub Mirror operation */
11875678Spl196000 	AifJobCtrRebuildRaid5,	/* Container Rebuild Raid5 operation */
11885678Spl196000 	AifJobCtrScrubRaid5,	/* Container Scrub Raid5 operation */
11895678Spl196000 	AifJobCtrMorph,		/* Container morph operation */
11905678Spl196000 	AifJobCtrPartCopy,	/* Container Partition copy operation */
11915678Spl196000 	AifJobCtrRebuildMirror,	/* Container Rebuild Mirror operation */
11925678Spl196000 	AifJobCtrCrazyCache,	/* crazy cache */
11935678Spl196000 	AifJobCtrCopyback,	/* Container Copyback operation */
11945678Spl196000 	AifJobCtrCompactRaid5D,	/* Container Compaction operation */
11955678Spl196000 	AifJobCtrExpandRaid5D,	/* Container Expansion operation */
11965678Spl196000 	AifJobCtrRebuildRaid6,	/* Container Rebuild Raid6 operation */
11975678Spl196000 	AifJobCtrScrubRaid6,	/* Container Scrub Raid6 operation */
11985678Spl196000 	AifJobCtrSSBackup,	/* Container snapshot backup task */
11995678Spl196000 	AifJobCtrMax = 199,	/* Max Ctr type operation */
12005678Spl196000 	AifJobFsMin,		/* Min Fs type operation */
12015678Spl196000 	AifJobFsCreate,		/* File System Create operation */
12025678Spl196000 	AifJobFsVerify,		/* File System Verify operation */
12035678Spl196000 	AifJobFsExtend,		/* File System Extend operation */
12045678Spl196000 	AifJobFsMax = 299,	/* Max Fs type operation */
12055678Spl196000 	AifJobApiFormatNTFS,	/* Format a drive to NTFS */
12065678Spl196000 	AifJobApiFormatFAT,	/* Format a drive to FAT */
12075678Spl196000 	AifJobApiUpdateSnapshot, /* update the read/write half of a snapshot */
12085678Spl196000 	AifJobApiFormatFAT32,	/* Format a drive to FAT32 */
12095678Spl196000 	AifJobApiMax = 399,		/* Max API type operation */
12105678Spl196000 	AifJobCtlContinuousCtrVerify,	/* Adapter operation */
12115678Spl196000 	AifJobCtlMax = 499		/* Max Adapter type operation */
12125678Spl196000 } AAC_AifJobType;
12135678Spl196000 
12145678Spl196000 struct aac_AifContainers {
12155678Spl196000 	uint32_t	src;		/* from/master */
12165678Spl196000 	uint32_t	dst;		/* to/slave */
12175678Spl196000 };
12185678Spl196000 
12195678Spl196000 union aac_AifJobClient {
12205678Spl196000 	struct aac_AifContainers container;	/* For Container and */
12215678Spl196000 						/* filesystem progress ops */
12225678Spl196000 	int32_t scsi_dh;			/* For SCSI progress ops */
12235678Spl196000 };
12245678Spl196000 
12255678Spl196000 struct aac_AifJobDesc {
12265678Spl196000 	uint32_t	jobID;	/* DO NOT FILL IN! Will be filled in by AIF */
12275678Spl196000 	AAC_AifJobType	type;	/* Operation that is being performed */
12285678Spl196000 	union aac_AifJobClient	client;	/* Details */
12295678Spl196000 };
12305678Spl196000 
12315678Spl196000 struct aac_AifJobProgressReport {
12325678Spl196000 	struct aac_AifJobDesc	jd;
12335678Spl196000 	AAC_AifJobStatus	status;
12345678Spl196000 	uint32_t		finalTick;
12355678Spl196000 	uint32_t		currentTick;
12365678Spl196000 	uint32_t		jobSpecificData1;
12375678Spl196000 	uint32_t		jobSpecificData2;
12385678Spl196000 };
12395678Spl196000 
12405678Spl196000 /*
12415678Spl196000  * Event Notification
12425678Spl196000  */
12435678Spl196000 typedef enum {
12445678Spl196000 	/* General application notifies start here */
12455678Spl196000 	AifEnGeneric = 1,	/* Generic notification */
12465678Spl196000 	AifEnTaskComplete,	/* Task has completed */
12475678Spl196000 	AifEnConfigChange,	/* Adapter config change occurred */
12485678Spl196000 	AifEnContainerChange,	/* Adapter specific container cfg. change */
12495678Spl196000 	AifEnDeviceFailure,	/* SCSI device failed */
12505678Spl196000 	AifEnMirrorFailover,	/* Mirror failover started */
12515678Spl196000 	AifEnContainerEvent,	/* Significant container event */
12525678Spl196000 	AifEnFileSystemChange,	/* File system changed */
12535678Spl196000 	AifEnConfigPause,	/* Container pause event */
12545678Spl196000 	AifEnConfigResume,	/* Container resume event */
12555678Spl196000 	AifEnFailoverChange,	/* Failover space assignment changed */
12565678Spl196000 	AifEnRAID5RebuildDone,	/* RAID5 rebuild finished */
12575678Spl196000 	AifEnEnclosureManagement,	/* Enclosure management event */
12585678Spl196000 	AifEnBatteryEvent,	/* Significant NV battery event */
12595678Spl196000 	AifEnAddContainer,	/* A new container was created. */
12605678Spl196000 	AifEnDeleteContainer,	/* A container was deleted. */
12615678Spl196000 	AifEnSMARTEvent,	/* SMART Event */
12625678Spl196000 	AifEnBatteryNeedsRecond,	/* The battery needs reconditioning */
12635678Spl196000 	AifEnClusterEvent,		/* Some cluster event */
12645678Spl196000 	AifEnDiskSetEvent,		/* A disk set event occured. */
1265*12408SZhongyan.Gu@Sun.COM 	AifEnAddJBOD = 30,	/* A new JBOD type drive was created (30) */
1266*12408SZhongyan.Gu@Sun.COM 	AifEnDeleteJBOD = 31,	/* A JBOD type drive was deleted (31) */
12675678Spl196000 	AifDriverNotifyStart = 199,	/* Notifies for host driver go here */
12685678Spl196000 	/* Host driver notifications start here */
12695678Spl196000 	AifDenMorphComplete,		/* A morph operation completed */
12705678Spl196000 	AifDenVolumeExtendComplete	/* Volume expand operation completed */
12715678Spl196000 } AAC_AifEventNotifyType;
12725678Spl196000 
12735678Spl196000 struct aac_AifEnsGeneric {
12745678Spl196000 	char	text[132];		/* Generic text */
12755678Spl196000 };
12765678Spl196000 
12775678Spl196000 struct aac_AifEnsDeviceFailure {
12785678Spl196000 	uint32_t	deviceHandle;	/* SCSI device handle */
12795678Spl196000 };
12805678Spl196000 
12815678Spl196000 struct aac_AifEnsMirrorFailover {
12825678Spl196000 	uint32_t	container;	/* Container with failed element */
12835678Spl196000 	uint32_t	failedSlice;	/* Old slice which failed */
12845678Spl196000 	uint32_t	creatingSlice;	/* New slice used for auto-create */
12855678Spl196000 };
12865678Spl196000 
12875678Spl196000 struct aac_AifEnsContainerChange {
12885678Spl196000 	uint32_t	container[2];	/* container that changed, -1 if */
12895678Spl196000 					/* no container */
12905678Spl196000 };
12915678Spl196000 
12925678Spl196000 struct aac_AifEnsContainerEvent {
12935678Spl196000 	uint32_t	container;	/* container number  */
12945678Spl196000 	uint32_t	eventType;	/* event type */
12955678Spl196000 };
12965678Spl196000 
12975678Spl196000 struct aac_AifEnsEnclosureEvent {
12985678Spl196000 	uint32_t	empID;		/* enclosure management proc number  */
12995678Spl196000 	uint32_t	unitID;		/* unitId, fan id, power supply id, */
13005678Spl196000 					/* slot id, tempsensor id. */
13015678Spl196000 	uint32_t	eventType;	/* event type */
13025678Spl196000 };
13035678Spl196000 
13045678Spl196000 struct aac_AifEnsBatteryEvent {
13055678Spl196000 	AAC_NVBATT_TRANSITION	transition_type;	/* eg from low to ok */
13065678Spl196000 	AAC_NVBATTSTATUS	current_state;	/* current batt state */
13075678Spl196000 	AAC_NVBATTSTATUS	prior_state;	/* prev batt state */
13085678Spl196000 };
13095678Spl196000 
13105678Spl196000 struct aac_AifEnsDiskSetEvent {
13115678Spl196000 	uint32_t	eventType;
13125678Spl196000 	uint64_t	DsNum;
13135678Spl196000 	uint64_t	CreatorId;
13145678Spl196000 };
13155678Spl196000 
13165678Spl196000 typedef enum {
13175678Spl196000 	CLUSTER_NULL_EVENT = 0,
13185678Spl196000 	CLUSTER_PARTNER_NAME_EVENT,	/* change in partner hostname or */
13195678Spl196000 					/* adaptername from NULL to non-NULL */
13205678Spl196000 					/* (partner's agent may be up) */
13215678Spl196000 	CLUSTER_PARTNER_NULL_NAME_EVENT	/* change in partner hostname or */
13225678Spl196000 					/* adaptername from non-null to NULL */
13235678Spl196000 					/* (partner has rebooted) */
13245678Spl196000 } AAC_ClusterAifEvent;
13255678Spl196000 
13265678Spl196000 struct aac_AifEnsClusterEvent {
13275678Spl196000 	AAC_ClusterAifEvent	eventType;
13285678Spl196000 };
13295678Spl196000 
13305678Spl196000 struct aac_AifEventNotify {
13315678Spl196000 	AAC_AifEventNotifyType	type;
13325678Spl196000 	union {
13335678Spl196000 		struct aac_AifEnsGeneric		EG;
13345678Spl196000 		struct aac_AifEnsDeviceFailure		EDF;
13355678Spl196000 		struct aac_AifEnsMirrorFailover		EMF;
13365678Spl196000 		struct aac_AifEnsContainerChange	ECC;
13375678Spl196000 		struct aac_AifEnsContainerEvent		ECE;
13385678Spl196000 		struct aac_AifEnsEnclosureEvent		EEE;
13395678Spl196000 		struct aac_AifEnsBatteryEvent		EBE;
13405678Spl196000 		struct aac_AifEnsDiskSetEvent		EDS;
13415678Spl196000 /*		struct aac_AifEnsSMARTEvent		ES; */
13425678Spl196000 		struct aac_AifEnsClusterEvent		ECLE;
13435678Spl196000 	} data;
13445678Spl196000 };
13455678Spl196000 
13465678Spl196000 /*
13475678Spl196000  * Adapter Initiated FIB command structures. Start with the adapter
13485678Spl196000  * initiated FIBs that really come from the adapter, and get responded
13495678Spl196000  * to by the host.
13505678Spl196000  */
13515678Spl196000 #define	AAC_AIF_REPORT_MAX_SIZE 64
13525678Spl196000 
13535678Spl196000 typedef enum {
13545678Spl196000 	AifCmdEventNotify = 1,	/* Notify of event */
13555678Spl196000 	AifCmdJobProgress,	/* Progress report */
13565678Spl196000 	AifCmdAPIReport,	/* Report from other user of API */
13575678Spl196000 	AifCmdDriverNotify,	/* Notify host driver of event */
13585678Spl196000 	AifReqJobList = 100,	/* Gets back complete job list */
13595678Spl196000 	AifReqJobsForCtr,	/* Gets back jobs for specific container */
13605678Spl196000 	AifReqJobsForScsi,	/* Gets back jobs for specific SCSI device */
13615678Spl196000 	AifReqJobReport,	/* Gets back a specific job report or list */
13625678Spl196000 	AifReqTerminateJob,	/* Terminates job */
13635678Spl196000 	AifReqSuspendJob,	/* Suspends a job */
13645678Spl196000 	AifReqResumeJob,	/* Resumes a job */
13655678Spl196000 	AifReqSendAPIReport,	/* API generic report requests */
13665678Spl196000 	AifReqAPIJobStart,	/* Start a job from the API */
13675678Spl196000 	AifReqAPIJobUpdate,	/* Update a job report from the API */
13685678Spl196000 	AifReqAPIJobFinish	/* Finish a job from the API */
13695678Spl196000 } AAC_AifCommand;
13705678Spl196000 
13715678Spl196000 struct aac_aif_command {
13725678Spl196000 	AAC_AifCommand	command; /* Tell host what type of notify this is */
13735678Spl196000 	uint32_t	seqNumber;	/* To allow ordering of reports */
13745678Spl196000 					/* (if necessary) */
13755678Spl196000 	union {
13765678Spl196000 		struct aac_AifEventNotify	EN;	/* Event notify */
13775678Spl196000 		struct aac_AifJobProgressReport	PR[1];	/* Progress report */
13785678Spl196000 		uint8_t	AR[AAC_AIF_REPORT_MAX_SIZE];
13795678Spl196000 		uint8_t	data[AAC_FIB_DATASIZE - 8];
13805678Spl196000 	} data;
13815678Spl196000 };
13825678Spl196000 
13835678Spl196000 #define	CT_PUP_MISSING_DRIVE	27
13845678Spl196000 
13855678Spl196000 /*
13865678Spl196000  * Cluster Management Commands
13875678Spl196000  */
13885678Spl196000 typedef enum {
13895678Spl196000 	CL_NULL = 0,		/* 0x00 null */
13905678Spl196000 	/* disk set commands */
13915678Spl196000 	DS_INIT = 1,		/* 0x01 init disk set control block */
13925678Spl196000 	DS_RESCAN,		/* 0x02 refresh drive, disk set, and slice */
13935678Spl196000 				/* structs */
13945678Spl196000 	DS_CREATE,		/* 0x03 create a disk set */
13955678Spl196000 	DS_DELETE,		/* 0x04 delete a disk set */
13965678Spl196000 	DS_ADD_DISK,		/* 0x05 add a disk to an existing disk set */
13975678Spl196000 	DS_REMOVE_DISK,		/* 0x06 remove a disk from an existing disk */
13985678Spl196000 				/* set */
13995678Spl196000 	DS_MOVE_DISK,		/* 0x07 move a disk from one existing disk */
14005678Spl196000 				/* set to another */
14015678Spl196000 	DS_TAKE_OWNERSHIP,	/* 0x08 take ownership of an unowned disk set */
14025678Spl196000 	DS_RELEASE_OWNERSHIP,	/* 0x09 release ownership of a disk set */
14035678Spl196000 	DS_FORCE_OWNERSHIP,	/* 0x0A force ownership of an disk set */
14045678Spl196000 	DS_GET_DISK_SET_PARAM,	/* 0x0B get info on a disk set */
14055678Spl196000 	DS_GET_DRIVE_PARAM,	/* 0x0C get info on a drive */
14065678Spl196000 	DS_GET_SLICE_PARAM,	/* 0x0D get info on a slice */
14075678Spl196000 	DS_GET_DISK_SETS,	/* 0x0E get a list of disk sets */
14085678Spl196000 	DS_GET_DRIVES,		/* 0x0F get a list of drives */
14095678Spl196000 	DS_SET_DISK_SET_PARAM,	/* 0x10 set info of a disk set */
14105678Spl196000 	DS_ONLINE,		/* 0x11 take disk set online */
14115678Spl196000 	DS_OFFLINE,		/* 0x12 take disk set offline */
14125678Spl196000 	DS_ONLINE_CONTAINERS,	/* 0x13 bring containers in diskset online */
14135678Spl196000 	DS_FSAPRINT,		/* 0x14 do an FsaPrint */
14145678Spl196000 
14155678Spl196000 	/* config commands */
14165678Spl196000 	CL_CFG_SET_HOST_IDS = 0x100,	/* 0x100 set host ids (host name and */
14175678Spl196000 					/* adapter name) */
14185678Spl196000 	CL_CFG_SET_PARTNER_HOST_IDS,	/* 0x101 set partner host ids (host */
14195678Spl196000 					/* name and adapter name) */
14205678Spl196000 	CL_CFG_GET_CLUSTER_CONFIG,	/* 0x102 get cluster configuration */
14215678Spl196000 
14225678Spl196000 	/* cluster comm commands */
14235678Spl196000 	CC_CLI_CLEAR_MESSAGE_BUFFER = 0x200,	/* 0x200 CC - client - clear */
14245678Spl196000 						/* contents of message buffer */
14255678Spl196000 	CC_SRV_CLEAR_MESSAGE_BUFFER,	/* 0x201 CC - server - clear contents */
14265678Spl196000 					/* of message buffer */
14275678Spl196000 	CC_CLI_SHOW_MESSAGE_BUFFER,	/* 0x202 CC - client - show contents */
14285678Spl196000 					/* of message buffer */
14295678Spl196000 	CC_SRV_SHOW_MESSAGE_BUFFER,	/* 0x203 CC - server - show contents */
14305678Spl196000 					/* of message buffer */
14315678Spl196000 	CC_CLI_SEND_MESSAGE,	/* 0x204 CC - client - send (req) message to */
14325678Spl196000 				/* server side */
14335678Spl196000 	CC_SRV_SEND_MESSAGE,	/* 0x205 CC - server - send (reply) message */
14345678Spl196000 				/* to client side */
14355678Spl196000 	CC_CLI_GET_MESSAGE,	/* 0x206 CC - client - read thru read message */
14365678Spl196000 				/* buffer */
14375678Spl196000 	CC_SRV_GET_MESSAGE,	/* 0x207 CC - server - read thru read message */
14385678Spl196000 				/* buffer */
14395678Spl196000 	CC_SEND_TEST_MESSAGE,	/* 0x208 CC - send a special subclass message */
14405678Spl196000 	CC_GET_BUSINFO,		/* 0x209 CC - get bus info */
14415678Spl196000 	CC_GET_PORTINFO,	/* 0x20A CC - get bus,port info */
14425678Spl196000 	CC_GET_NAMEINFO,	/* 0x20B CC - get misc info */
14435678Spl196000 	CC_GET_CONFIGINFO,	/* 0x20C CC - get misc info */
14445678Spl196000 	CQ_QUORUM_OP = 0x300,	/* 0x300 CQ - quorum messages */
14455678Spl196000 
14465678Spl196000 	/* last command */
14475678Spl196000 	CL_LAST_COMMAND		/* used for bounds checking */
14485678Spl196000 } AAC_CLCommand;
14495678Spl196000 
14505678Spl196000 /*
14515678Spl196000  * Disk IOCTL Functions
14525678Spl196000  */
14535678Spl196000 #define	Reserved_IOCTL			0x0000
14545678Spl196000 #define	GetDeviceHandle			0x0001
14555678Spl196000 #define	BusTargetLun_to_DeviceHandle	0x0002
14565678Spl196000 #define	DeviceHandle_to_BusTargetLun	0x0003
14575678Spl196000 #define	RescanBus			0x0004
14585678Spl196000 #define	GetDeviceProbeInfo		0x0005
14595678Spl196000 #define	GetDeviceCapacity		0x0006
14605678Spl196000 #define	GetContainerProbeInfo		0x0007	/* Container, not diskclass */
14615678Spl196000 						/* ioctl */
14625678Spl196000 #define	GetRequestedMemorySize		0x0008
14635678Spl196000 #define	GetBusInfo			0x0009
14645678Spl196000 #define	GetVendorSpecific		0x000a
14655678Spl196000 
14665678Spl196000 #define	EnhancedGetDeviceProbeInfo	0x000b
14675678Spl196000 #define	EnhancedGetBusInfo		0x000c
14685678Spl196000 
14695678Spl196000 #define	SetupExtendedCounters		0x000d
14705678Spl196000 #define	GetPerformanceCounters		0x000f
14715678Spl196000 #define	ResetPerformanceCounters	0x0010
14725678Spl196000 #define	ReadModePage			0x0011
14735678Spl196000 #define	WriteModePage			0x0012
14745678Spl196000 #define	ReadDriveParameter		0x0013
14755678Spl196000 #define	WriteDriveParameter		0x0014
14765678Spl196000 #define	ResetAdapter			0x0015
14775678Spl196000 #define	ResetBus			0x0016
14785678Spl196000 #define	ResetBusDevice			0x0017
14795678Spl196000 #define	ExecuteSrb			0x0018
14805678Spl196000 
14815678Spl196000 #define	Create_IO_Task			0x0030
14825678Spl196000 #define	Delete_IO_Task			0x0031
14835678Spl196000 #define	Get_IO_Task_Info		0x0032
14845678Spl196000 #define	Check_Task_Progress		0x0033
14855678Spl196000 
14865678Spl196000 #define	InjectError			0x0040
14875678Spl196000 #define	GetDeviceDefectCounts		0x0041
14885678Spl196000 #define	GetDeviceDefectInfo		0x0042
14895678Spl196000 #define	GetDeviceStatus			0x0043
14905678Spl196000 #define	ClearDeviceStatus		0x0044
14915678Spl196000 #define	DiskSpinControl			0x0045
14925678Spl196000 #define	DiskSmartControl		0x0046
14935678Spl196000 #define	WriteSame			0x0047
14945678Spl196000 #define	ReadWriteLong			0x0048
14955678Spl196000 #define	FormatUnit			0x0049
14965678Spl196000 
14975678Spl196000 #define	TargetDeviceControl		0x0050
14985678Spl196000 #define	TargetChannelControl		0x0051
14995678Spl196000 
15005678Spl196000 #define	FlashNewCode			0x0052
15015678Spl196000 #define	DiskCheck			0x0053
15025678Spl196000 #define	RequestSense			0x0054
15035678Spl196000 #define	DiskPERControl			0x0055
15045678Spl196000 #define	Read10				0x0056
15055678Spl196000 #define	Write10				0x0057
15065678Spl196000 
15075678Spl196000 /*
15085678Spl196000  * The following definitions come from Adaptec:
15095678Spl196000  *
15105678Spl196000  * SRB is required for the new management tools
15115678Spl196000  * and non-DASD support.
15125678Spl196000  */
15135678Spl196000 struct aac_srb
15145678Spl196000 {
15155678Spl196000 	uint32_t function;
15165678Spl196000 	uint32_t channel;
15175678Spl196000 	uint32_t id;
15185678Spl196000 	uint32_t lun;
15195678Spl196000 	uint32_t timeout;	/* timeout in sec. */
15205678Spl196000 	uint32_t flags;
15215678Spl196000 	uint32_t count;		/* data xfer size */
15225678Spl196000 	uint32_t retry_limit;	/* obsolete */
15235678Spl196000 	uint32_t cdb_size;
15245678Spl196000 	uint8_t cdb[16];
15255678Spl196000 	struct aac_sg_table sg;
15265678Spl196000 };
15275678Spl196000 
15285678Spl196000 #define	AAC_SENSE_BUFFERSIZE	 30
15295678Spl196000 
15305678Spl196000 struct aac_srb_reply
15315678Spl196000 {
15325678Spl196000 	uint32_t status;
15335678Spl196000 	uint32_t srb_status;
15345678Spl196000 	uint32_t scsi_status;
15355678Spl196000 	uint32_t data_xfer_length;
15365678Spl196000 	uint32_t sense_data_size;
15377567SXin.Chen@Sun.COM 	uint8_t sense_data[AAC_SENSE_BUFFERSIZE];
15385678Spl196000 };
15395678Spl196000 
15405678Spl196000 /*
15415678Spl196000  * SRB Flags
15425678Spl196000  */
15435678Spl196000 #define	SRB_NoDataXfer			0x0000
15445678Spl196000 #define	SRB_DisableDisconnect		0x0004
15455678Spl196000 #define	SRB_DisableSynchTransfer	0x0008
15465678Spl196000 #define	SRB_BypassFrozenQueue		0x0010
15475678Spl196000 #define	SRB_DisableAutosense		0x0020
15485678Spl196000 #define	SRB_DataIn			0x0040
15495678Spl196000 #define	SRB_DataOut			0x0080
15505678Spl196000 
15515678Spl196000 /*
15525678Spl196000  * SRB Functions - set in aac_srb->function
15535678Spl196000  */
15545678Spl196000 #define	SRBF_ExecuteScsi		0x0000
15555678Spl196000 #define	SRBF_ClaimDevice		0x0001
15565678Spl196000 #define	SRBF_IO_Control			0x0002
15575678Spl196000 #define	SRBF_ReceiveEvent		0x0003
15585678Spl196000 #define	SRBF_ReleaseQueue		0x0004
15595678Spl196000 #define	SRBF_AttachDevice		0x0005
15605678Spl196000 #define	SRBF_ReleaseDevice		0x0006
15615678Spl196000 #define	SRBF_Shutdown			0x0007
15625678Spl196000 #define	SRBF_Flush			0x0008
15635678Spl196000 #define	SRBF_AbortCommand		0x0010
15645678Spl196000 #define	SRBF_ReleaseRecovery		0x0011
15655678Spl196000 #define	SRBF_ResetBus			0x0012
15665678Spl196000 #define	SRBF_ResetDevice		0x0013
15675678Spl196000 #define	SRBF_TerminateIO		0x0014
15685678Spl196000 #define	SRBF_FlushQueue			0x0015
15695678Spl196000 #define	SRBF_RemoveDevice		0x0016
15705678Spl196000 #define	SRBF_DomainValidation		0x0017
15715678Spl196000 
15725678Spl196000 /*
15735678Spl196000  * SRB SCSI Status
15745678Spl196000  * Status codes for SCSI passthrough commands,
15755678Spl196000  * set in aac_srb->scsi_status
15765678Spl196000  */
15775678Spl196000 #define	SRB_STATUS_PENDING			0x00
15785678Spl196000 #define	SRB_STATUS_SUCCESS			0x01
15795678Spl196000 #define	SRB_STATUS_ABORTED			0x02
15805678Spl196000 #define	SRB_STATUS_ABORT_FAILED			0x03
15815678Spl196000 #define	SRB_STATUS_ERROR			0x04
15825678Spl196000 #define	SRB_STATUS_BUSY				0x05
15835678Spl196000 #define	SRB_STATUS_INVALID_REQUEST		0x06
15845678Spl196000 #define	SRB_STATUS_INVALID_PATH_ID		0x07
15855678Spl196000 #define	SRB_STATUS_NO_DEVICE			0x08
15865678Spl196000 #define	SRB_STATUS_TIMEOUT			0x09
15875678Spl196000 #define	SRB_STATUS_SELECTION_TIMEOUT		0x0A
15885678Spl196000 #define	SRB_STATUS_COMMAND_TIMEOUT		0x0B
15895678Spl196000 #define	SRB_STATUS_MESSAGE_REJECTED		0x0D
15905678Spl196000 #define	SRB_STATUS_BUS_RESET			0x0E
15915678Spl196000 #define	SRB_STATUS_PARITY_ERROR			0x0F
15925678Spl196000 #define	SRB_STATUS_REQUEST_SENSE_FAILED		0x10
15935678Spl196000 #define	SRB_STATUS_NO_HBA			0x11
15945678Spl196000 #define	SRB_STATUS_DATA_OVERRUN			0x12
15955678Spl196000 #define	SRB_STATUS_UNEXPECTED_BUS_FREE		0x13
15965678Spl196000 #define	SRB_STATUS_PHASE_SEQUENCE_FAILURE	0x14
15975678Spl196000 #define	SRB_STATUS_BAD_SRB_BLOCK_LENGTH		0x15
15985678Spl196000 #define	SRB_STATUS_REQUEST_FLUSHED		0x16
15995678Spl196000 #define	SRB_STATUS_DELAYED_RETRY		0x17
16005678Spl196000 #define	SRB_STATUS_INVALID_LUN			0x20
16015678Spl196000 #define	SRB_STATUS_INVALID_TARGET_ID		0x21
16025678Spl196000 #define	SRB_STATUS_BAD_FUNCTION			0x22
16035678Spl196000 #define	SRB_STATUS_ERROR_RECOVERY		0x23
16045678Spl196000 #define	SRB_STATUS_NOT_STARTED			0x24
16055678Spl196000 #define	SRB_STATUS_NOT_IN_USE			0x30
16065678Spl196000 #define	SRB_STATUS_FORCE_ABORT			0x31
16075678Spl196000 #define	SRB_STATUS_DOMAIN_VALIDATION_FAIL	0x32
16085678Spl196000 
16095678Spl196000 #pragma	pack()
16105678Spl196000 
16115678Spl196000 /*
16125678Spl196000  * Aligned structure definition for variable declarations that require
16135678Spl196000  * alignment.
16145678Spl196000  */
16155678Spl196000 union aac_fib_align {
16165678Spl196000 	struct aac_fib d;
16175678Spl196000 	uint32_t dumb;
16185678Spl196000 };
16195678Spl196000 
16205678Spl196000 /* AAC Communication Space */
16215678Spl196000 struct aac_comm_space {
16225678Spl196000 	struct aac_fib adapter_fibs[AAC_ADAPTER_FIBS];
16235678Spl196000 	struct aac_adapter_init init_data;
16245678Spl196000 	struct aac_queue_table qtable;
16255678Spl196000 	char qt_align_pad[AAC_QUEUE_ALIGN];
16265678Spl196000 	char adapter_print_buf[AAC_ADAPTER_PRINT_BUFSIZE];
16275678Spl196000 };
16285678Spl196000 
16295678Spl196000 #ifdef	__cplusplus
16305678Spl196000 }
16315678Spl196000 #endif
16325678Spl196000 
16335678Spl196000 #endif /* __AAC_REGS_H__ */
1634