xref: /freebsd/sys/dev/aac/aacreg.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
135863739SMike Smith /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
435863739SMike Smith  * Copyright (c) 2000 Michael Smith
5fadfef89SScott Long  * Copyright (c) 2000-2001 Scott Long
635863739SMike Smith  * Copyright (c) 2000 BSDi
7c6eafcf2SScott Long  * Copyright (c) 2001 Adaptec, Inc.
835863739SMike Smith  * All rights reserved.
935863739SMike Smith  *
1035863739SMike Smith  * Redistribution and use in source and binary forms, with or without
1135863739SMike Smith  * modification, are permitted provided that the following conditions
1235863739SMike Smith  * are met:
1335863739SMike Smith  * 1. Redistributions of source code must retain the above copyright
1435863739SMike Smith  *    notice, this list of conditions and the following disclaimer.
1535863739SMike Smith  * 2. Redistributions in binary form must reproduce the above copyright
1635863739SMike Smith  *    notice, this list of conditions and the following disclaimer in the
1735863739SMike Smith  *    documentation and/or other materials provided with the distribution.
1835863739SMike Smith  *
1935863739SMike Smith  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2035863739SMike Smith  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2135863739SMike Smith  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2235863739SMike Smith  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2335863739SMike Smith  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2435863739SMike Smith  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2535863739SMike Smith  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2635863739SMike Smith  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2735863739SMike Smith  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2835863739SMike Smith  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2935863739SMike Smith  * SUCH DAMAGE.
3035863739SMike Smith  */
3135863739SMike Smith 
3235863739SMike Smith /*
3335863739SMike Smith  * Data structures defining the interface between the driver and the Adaptec
3435863739SMike Smith  * 'FSA' adapters.  Note that many field names and comments here are taken
3535863739SMike Smith  * verbatim from the Adaptec driver source in order to make comparing the
3635863739SMike Smith  * two slightly easier.
3735863739SMike Smith  */
3835863739SMike Smith 
39914da7d0SScott Long /*
4035863739SMike Smith  * Misc. magic numbers.
4135863739SMike Smith  */
4235863739SMike Smith #define AAC_MAX_CONTAINERS	64
4335863739SMike Smith #define AAC_BLOCK_SIZE		512
4435863739SMike Smith 
45914da7d0SScott Long /*
4635863739SMike Smith  * Communications interface.
4735863739SMike Smith  *
4835863739SMike Smith  * Where datastructure layouts are closely parallel to the Adaptec sample code,
4935863739SMike Smith  * retain their naming conventions (for now) to aid in cross-referencing.
5035863739SMike Smith  */
5135863739SMike Smith 
5235863739SMike Smith /*
5335863739SMike Smith  * We establish 4 command queues and matching response queues.  Queues must
5435863739SMike Smith  * be 16-byte aligned, and are sized as follows:
5535863739SMike Smith  */
56c6eafcf2SScott Long #define AAC_HOST_NORM_CMD_ENTRIES	8	/* command adapter->host,
57c6eafcf2SScott Long 						 * normal priority */
58c6eafcf2SScott Long #define AAC_HOST_HIGH_CMD_ENTRIES	4	/* command adapter->host,
59c6eafcf2SScott Long 						 * high priority */
60c6eafcf2SScott Long #define AAC_ADAP_NORM_CMD_ENTRIES	512	/* command host->adapter,
61c6eafcf2SScott Long 						 * normal priority */
62c6eafcf2SScott Long #define AAC_ADAP_HIGH_CMD_ENTRIES	4	/* command host->adapter,
63c6eafcf2SScott Long 						 * high priority */
64c6eafcf2SScott Long #define AAC_HOST_NORM_RESP_ENTRIES	512	/* response, adapter->host,
65c6eafcf2SScott Long 						 * normal priority */
66c6eafcf2SScott Long #define AAC_HOST_HIGH_RESP_ENTRIES	4	/* response, adapter->host,
67c6eafcf2SScott Long 						 * high priority */
68c6eafcf2SScott Long #define AAC_ADAP_NORM_RESP_ENTRIES	8	/* response, host->adapter,
69c6eafcf2SScott Long 						 * normal priority */
70c6eafcf2SScott Long #define AAC_ADAP_HIGH_RESP_ENTRIES	4	/* response, host->adapter,
71c6eafcf2SScott Long 						 * high priority */
7235863739SMike Smith 
7335863739SMike Smith #define AAC_TOTALQ_LENGTH	(AAC_HOST_HIGH_CMD_ENTRIES +	\
7435863739SMike Smith 				 AAC_HOST_NORM_CMD_ENTRIES +	\
7535863739SMike Smith 				 AAC_ADAP_HIGH_CMD_ENTRIES +	\
7635863739SMike Smith 				 AAC_ADAP_NORM_CMD_ENTRIES +	\
7735863739SMike Smith 				 AAC_HOST_HIGH_RESP_ENTRIES +	\
7835863739SMike Smith 				 AAC_HOST_NORM_RESP_ENTRIES +	\
7935863739SMike Smith 				 AAC_ADAP_HIGH_RESP_ENTRIES +	\
8035863739SMike Smith 				 AAC_ADAP_NORM_RESP_ENTRIES)
8135863739SMike Smith #define AAC_QUEUE_COUNT		8
8235863739SMike Smith #define AAC_QUEUE_ALIGN		16
8335863739SMike Smith 
8435863739SMike Smith struct aac_queue_entry {
8535863739SMike Smith 	u_int32_t	aq_fib_size;	/* FIB size in bytes */
8635863739SMike Smith 	u_int32_t	aq_fib_addr;	/* receiver-space address of the FIB */
874f492bfaSAlfred Perlstein } __packed;
8835863739SMike Smith 
8935863739SMike Smith #define AAC_PRODUCER_INDEX	0
9035863739SMike Smith #define AAC_CONSUMER_INDEX	1
9135863739SMike Smith 
9235863739SMike Smith /*
9335863739SMike Smith  * Table of queue indices and queues used to communicate with the
9435863739SMike Smith  * controller.  This structure must be aligned to AAC_QUEUE_ALIGN
9535863739SMike Smith  */
9635863739SMike Smith struct aac_queue_table {
9735863739SMike Smith 	/* queue consumer/producer indexes (layout mandated by adapter) */
9835863739SMike Smith 	u_int32_t			qt_qindex[AAC_QUEUE_COUNT][2];
9935863739SMike Smith 
10035863739SMike Smith 	/* queue entry structures (layout mandated by adapter) */
10135863739SMike Smith 	struct aac_queue_entry qt_HostNormCmdQueue [AAC_HOST_NORM_CMD_ENTRIES];
10235863739SMike Smith 	struct aac_queue_entry qt_HostHighCmdQueue [AAC_HOST_HIGH_CMD_ENTRIES];
10335863739SMike Smith 	struct aac_queue_entry qt_AdapNormCmdQueue [AAC_ADAP_NORM_CMD_ENTRIES];
10435863739SMike Smith 	struct aac_queue_entry qt_AdapHighCmdQueue [AAC_ADAP_HIGH_CMD_ENTRIES];
10535863739SMike Smith 	struct aac_queue_entry qt_HostNormRespQueue[AAC_HOST_NORM_RESP_ENTRIES];
10635863739SMike Smith 	struct aac_queue_entry qt_HostHighRespQueue[AAC_HOST_HIGH_RESP_ENTRIES];
10735863739SMike Smith 	struct aac_queue_entry qt_AdapNormRespQueue[AAC_ADAP_NORM_RESP_ENTRIES];
10835863739SMike Smith 	struct aac_queue_entry qt_AdapHighRespQueue[AAC_ADAP_HIGH_RESP_ENTRIES];
1094f492bfaSAlfred Perlstein } __packed;
11035863739SMike Smith 
11135863739SMike Smith /*
11235863739SMike Smith  * Queue names
11335863739SMike Smith  *
11435863739SMike Smith  * Note that we base these at 0 in order to use them as array indices.  Adaptec
11535863739SMike Smith  * used base 1 for some unknown reason, and sorted them in a different order.
11635863739SMike Smith  */
11735863739SMike Smith #define AAC_HOST_NORM_CMD_QUEUE		0
11835863739SMike Smith #define AAC_HOST_HIGH_CMD_QUEUE		1
11935863739SMike Smith #define AAC_ADAP_NORM_CMD_QUEUE		2
12035863739SMike Smith #define AAC_ADAP_HIGH_CMD_QUEUE		3
12135863739SMike Smith #define AAC_HOST_NORM_RESP_QUEUE	4
12235863739SMike Smith #define AAC_HOST_HIGH_RESP_QUEUE	5
12335863739SMike Smith #define AAC_ADAP_NORM_RESP_QUEUE	6
12435863739SMike Smith #define AAC_ADAP_HIGH_RESP_QUEUE	7
12535863739SMike Smith 
12635863739SMike Smith /*
12735863739SMike Smith  * List structure used to chain FIBs (used by the adapter - we hang FIBs off
12835863739SMike Smith  * our private command structure and don't touch these)
12935863739SMike Smith  */
13035863739SMike Smith struct aac_fib_list_entry {
131f30ac74cSScott Long 	u_int32_t	Flink;
132f30ac74cSScott Long 	u_int32_t	Blink;
1334f492bfaSAlfred Perlstein } __packed;
13435863739SMike Smith 
13535863739SMike Smith /*
13635863739SMike Smith  * FIB (FSA Interface Block?); this is the datastructure passed between the host
13735863739SMike Smith  * and adapter.
13835863739SMike Smith  */
13935863739SMike Smith struct aac_fib_header {
14035863739SMike Smith 	u_int32_t		XferState;
14135863739SMike Smith 	u_int16_t		Command;
14235863739SMike Smith 	u_int8_t		StructType;
14335863739SMike Smith 	u_int8_t		Flags;
14435863739SMike Smith 	u_int16_t		Size;
14535863739SMike Smith 	u_int16_t		SenderSize;
14635863739SMike Smith 	u_int32_t		SenderFibAddress;
14735863739SMike Smith 	u_int32_t		ReceiverFibAddress;
14835863739SMike Smith 	u_int32_t		SenderData;
14935863739SMike Smith 	union {
15035863739SMike Smith 		struct {
15135863739SMike Smith 			u_int32_t	ReceiverTimeStart;
15235863739SMike Smith 			u_int32_t	ReceiverTimeDone;
15335863739SMike Smith 		} _s;
15435863739SMike Smith 		struct aac_fib_list_entry FibLinks;
15535863739SMike Smith 	} _u;
1564f492bfaSAlfred Perlstein } __packed;
15735863739SMike Smith 
15835863739SMike Smith #define AAC_FIB_DATASIZE	(512 - sizeof(struct aac_fib_header))
15935863739SMike Smith 
16035863739SMike Smith struct aac_fib {
16135863739SMike Smith 	struct aac_fib_header	Header;
16235863739SMike Smith 	u_int8_t			data[AAC_FIB_DATASIZE];
1634f492bfaSAlfred Perlstein } __packed;
16435863739SMike Smith 
16535863739SMike Smith /*
16635863739SMike Smith  * FIB commands
16735863739SMike Smith  */
16835863739SMike Smith typedef enum {
16935863739SMike Smith 	TestCommandResponse =		1,
17035863739SMike Smith 	TestAdapterCommand =		2,
17135863739SMike Smith 
17235863739SMike Smith 	/* lowlevel and comm commands */
17335863739SMike Smith 	LastTestCommand =		100,
17435863739SMike Smith 	ReinitHostNormCommandQueue =	101,
17535863739SMike Smith 	ReinitHostHighCommandQueue =	102,
17635863739SMike Smith 	ReinitHostHighRespQueue =	103,
17735863739SMike Smith 	ReinitHostNormRespQueue =	104,
17835863739SMike Smith 	ReinitAdapNormCommandQueue =	105,
17935863739SMike Smith 	ReinitAdapHighCommandQueue =	107,
18035863739SMike Smith 	ReinitAdapHighRespQueue =	108,
18135863739SMike Smith 	ReinitAdapNormRespQueue =	109,
18235863739SMike Smith 	InterfaceShutdown =		110,
18335863739SMike Smith 	DmaCommandFib =			120,
18435863739SMike Smith 	StartProfile =			121,
18535863739SMike Smith 	TermProfile =			122,
18635863739SMike Smith 	SpeedTest =			123,
18735863739SMike Smith 	TakeABreakPt =			124,
18835863739SMike Smith 	RequestPerfData =		125,
18935863739SMike Smith 	SetInterruptDefTimer=		126,
19035863739SMike Smith 	SetInterruptDefCount=		127,
19135863739SMike Smith 	GetInterruptDefStatus=		128,
19235863739SMike Smith 	LastCommCommand =		129,
19335863739SMike Smith 
19435863739SMike Smith 	/* filesystem commands */
19535863739SMike Smith 	NuFileSystem =			300,
19635863739SMike Smith 	UFS =				301,
19735863739SMike Smith 	HostFileSystem =		302,
19835863739SMike Smith 	LastFileSystemCommand =		303,
19935863739SMike Smith 
20035863739SMike Smith 	/* Container Commands */
20135863739SMike Smith 	ContainerCommand =		500,
20235863739SMike Smith 	ContainerCommand64 =		501,
2037cb209f5SScott Long 	RawIo = 			502,
20435863739SMike Smith 
20535863739SMike Smith 	/* Cluster Commands */
20635863739SMike Smith 	ClusterCommand =		550,
20735863739SMike Smith 
20835863739SMike Smith 	/* Scsi Port commands (scsi passthrough) */
20935863739SMike Smith 	ScsiPortCommand =		600,
2107cb209f5SScott Long 	ScsiPortCommandU64 =		601,
2117cb209f5SScott Long 	SataPortCommandU64 =		602,
2127cb209f5SScott Long 	SasSmpPassThrough =		603,
2137cb209f5SScott Long 	SasRequestPhyInfo =		612,
21435863739SMike Smith 
21535863739SMike Smith 	/* misc house keeping and generic adapter initiated commands */
21635863739SMike Smith 	AifRequest =			700,
21735863739SMike Smith 	CheckRevision =			701,
21835863739SMike Smith 	FsaHostShutdown =		702,
21935863739SMike Smith 	RequestAdapterInfo =		703,
22035863739SMike Smith 	IsAdapterPaused =		704,
22135863739SMike Smith 	SendHostTime =			705,
2227cb209f5SScott Long 	RequestSupplementAdapterInfo =	706,	/* Supp. Info for set in UCC
2237cb209f5SScott Long 						 * use only if supported
2247cb209f5SScott Long 						 * (RequestAdapterInfo first) */
2257cb209f5SScott Long 	LastMiscCommand =		707,
2267cb209f5SScott Long 
2277cb209f5SScott Long 	OnLineDiagnostic =		800,
2287cb209f5SScott Long 	FduAdapterTest =		801,
2297cb209f5SScott Long 	RequestCompatibilityId =	802,
2307cb209f5SScott Long 	AdapterEnvironmentInfo =	803,	/* temp. sensors */
2317cb209f5SScott Long 	NvsramEventLog =		900,
2327cb209f5SScott Long 	ResetNvsramEventLogPointers =	901,
2337cb209f5SScott Long 	EnableEventLog =		902,
2347cb209f5SScott Long 	DisableEventLog =		903,
2357cb209f5SScott Long 	EncryptedKeyTransportFIB=	904,
2367cb209f5SScott Long 	KeyableFeaturesFIB=		905
23735863739SMike Smith } AAC_FibCommands;
23835863739SMike Smith 
23935863739SMike Smith /*
24035863739SMike Smith  * FIB types
24135863739SMike Smith  */
24235863739SMike Smith #define AAC_FIBTYPE_TFIB	1
24335863739SMike Smith #define AAC_FIBTYPE_TQE		2
24435863739SMike Smith #define AAC_FIBTYPE_TCTPERF	3
24535863739SMike Smith 
24635863739SMike Smith /*
24735863739SMike Smith  * FIB transfer state
24835863739SMike Smith  */
24935863739SMike Smith #define AAC_FIBSTATE_HOSTOWNED		(1<<0)	/* owned by the host */
25035863739SMike Smith #define AAC_FIBSTATE_ADAPTEROWNED	(1<<1)	/* owned by the adapter */
25135863739SMike Smith #define AAC_FIBSTATE_INITIALISED	(1<<2)	/* initialised */
25235863739SMike Smith #define AAC_FIBSTATE_EMPTY		(1<<3)	/* empty */
25335863739SMike Smith #define AAC_FIBSTATE_FROMPOOL		(1<<4)	/* allocated from pool */
25435863739SMike Smith #define AAC_FIBSTATE_FROMHOST		(1<<5)	/* sent from the host */
25535863739SMike Smith #define AAC_FIBSTATE_FROMADAP		(1<<6)	/* sent from the adapter */
25635863739SMike Smith #define AAC_FIBSTATE_REXPECTED		(1<<7)	/* response is expected */
25735863739SMike Smith #define AAC_FIBSTATE_RNOTEXPECTED	(1<<8)	/* response is not expected */
25835863739SMike Smith #define AAC_FIBSTATE_DONEADAP		(1<<9)	/* processed by the adapter */
25935863739SMike Smith #define AAC_FIBSTATE_DONEHOST		(1<<10)	/* processed by the host */
26035863739SMike Smith #define AAC_FIBSTATE_HIGH		(1<<11)	/* high priority */
26135863739SMike Smith #define AAC_FIBSTATE_NORM		(1<<12)	/* normal priority */
26235863739SMike Smith #define AAC_FIBSTATE_ASYNC		(1<<13)
26335863739SMike Smith #define AAC_FIBSTATE_ASYNCIO		(1<<13)	/* to be removed */
26435863739SMike Smith #define AAC_FIBSTATE_PAGEFILEIO		(1<<14)	/* to be removed */
26535863739SMike Smith #define AAC_FIBSTATE_SHUTDOWN		(1<<15)
26635863739SMike Smith #define AAC_FIBSTATE_LAZYWRITE		(1<<16)	/* to be removed */
26735863739SMike Smith #define AAC_FIBSTATE_ADAPMICROFIB	(1<<17)
26835863739SMike Smith #define AAC_FIBSTATE_BIOSFIB		(1<<18)
26935863739SMike Smith #define AAC_FIBSTATE_FAST_RESPONSE	(1<<19)	/* fast response capable */
27035863739SMike Smith #define AAC_FIBSTATE_APIFIB		(1<<20)
27135863739SMike Smith 
27235863739SMike Smith /*
27335863739SMike Smith  * FIB error values
27435863739SMike Smith  */
27535863739SMike Smith #define AAC_ERROR_NORMAL			0x00
27635863739SMike Smith #define AAC_ERROR_PENDING			0x01
27735863739SMike Smith #define AAC_ERROR_FATAL				0x02
27835863739SMike Smith #define AAC_ERROR_INVALID_QUEUE			0x03
27935863739SMike Smith #define AAC_ERROR_NOENTRIES			0x04
28035863739SMike Smith #define AAC_ERROR_SENDFAILED			0x05
28135863739SMike Smith #define AAC_ERROR_INVALID_QUEUE_PRIORITY	0x06
28235863739SMike Smith #define AAC_ERROR_FIB_ALLOCATION_FAILED		0x07
28335863739SMike Smith #define AAC_ERROR_FIB_DEALLOCATION_FAILED	0x08
28435863739SMike Smith 
28535863739SMike Smith /*
28635863739SMike Smith  * Adapter Init Structure: this is passed to the adapter with the
28735863739SMike Smith  * AAC_MONKER_INITSTRUCT command to point it at our control structures.
28835863739SMike Smith  */
28935863739SMike Smith struct aac_adapter_init {
29035863739SMike Smith 	u_int32_t	InitStructRevision;
29135863739SMike Smith #define AAC_INIT_STRUCT_REVISION		3
2927cb209f5SScott Long #define AAC_INIT_STRUCT_REVISION_4		4
29335863739SMike Smith 	u_int32_t	MiniPortRevision;
294f30ac74cSScott Long #define AAC_INIT_STRUCT_MINIPORT_REVISION	1
29535863739SMike Smith 	u_int32_t	FilesystemRevision;
29635863739SMike Smith 	u_int32_t	CommHeaderAddress;
29735863739SMike Smith 	u_int32_t	FastIoCommAreaAddress;
29835863739SMike Smith 	u_int32_t	AdapterFibsPhysicalAddress;
299f30ac74cSScott Long 	u_int32_t 	AdapterFibsVirtualAddress;
30035863739SMike Smith 	u_int32_t	AdapterFibsSize;
30135863739SMike Smith 	u_int32_t	AdapterFibAlign;
30235863739SMike Smith 	u_int32_t	PrintfBufferAddress;
30335863739SMike Smith 	u_int32_t	PrintfBufferSize;
304f30ac74cSScott Long #define	AAC_PAGE_SIZE				4096
30535863739SMike Smith 	u_int32_t	HostPhysMemPages;
30635863739SMike Smith 	u_int32_t	HostElapsedSeconds;
3077cb209f5SScott Long 	/* ADAPTER_INIT_STRUCT_REVISION_4 begins here */
3087cb209f5SScott Long 	u_int32_t	InitFlags;			/* flags for supported features */
309e71d3b9cSEd Maste #define	AAC_INITFLAGS_NEW_COMM_SUPPORTED	1
310435c8a15SEd Maste #define	AAC_INITFLAGS_DRIVER_USES_UTC_TIME	0x10
311435c8a15SEd Maste #define	AAC_INITFLAGS_DRIVER_SUPPORTS_PM	0x20
3127cb209f5SScott Long 	u_int32_t	MaxIoCommands;		/* max outstanding commands */
3137cb209f5SScott Long 	u_int32_t	MaxIoSize;			/* largest I/O command */
3147cb209f5SScott Long 	u_int32_t	MaxFibSize;			/* largest FIB to adapter */
3154f492bfaSAlfred Perlstein } __packed;
31635863739SMike Smith 
317914da7d0SScott Long /*
31835863739SMike Smith  * Shared data types
31935863739SMike Smith  */
32035863739SMike Smith /*
32135863739SMike Smith  * Container types
32235863739SMike Smith  */
32335863739SMike Smith typedef enum {
32435863739SMike Smith 	CT_NONE = 0,
32535863739SMike Smith 	CT_VOLUME,
32635863739SMike Smith 	CT_MIRROR,
32735863739SMike Smith 	CT_STRIPE,
32835863739SMike Smith 	CT_RAID5,
32935863739SMike Smith 	CT_SSRW,
33035863739SMike Smith 	CT_SSRO,
33135863739SMike Smith 	CT_MORPH,
33235863739SMike Smith 	CT_PASSTHRU,
33335863739SMike Smith 	CT_RAID4,
33435863739SMike Smith 	CT_RAID10,		/* stripe of mirror */
33535863739SMike Smith 	CT_RAID00,		/* stripe of stripe */
33635863739SMike Smith 	CT_VOLUME_OF_MIRRORS,	/* volume of mirror */
33735863739SMike Smith 	CT_PSEUDO_RAID3,	/* really raid4 */
338b3457b51SScott Long 	CT_RAID50,		/* stripe of raid5 */
3397cb209f5SScott Long 	CT_RAID5D,		/* raid5 distributed hot-sparing */
3407cb209f5SScott Long 	CT_RAID5D0,
3417cb209f5SScott Long 	CT_RAID1E,		/* extended raid1 mirroring */
3427cb209f5SScott Long 	CT_RAID6,
3437cb209f5SScott Long 	CT_RAID60,
34435863739SMike Smith } AAC_FSAVolType;
34535863739SMike Smith 
34635863739SMike Smith /*
34735863739SMike Smith  * Host-addressable object types
34835863739SMike Smith  */
34935863739SMike Smith typedef enum {
35035863739SMike Smith 	FT_REG = 1,	/* regular file */
35135863739SMike Smith 	FT_DIR,		/* directory */
35235863739SMike Smith 	FT_BLK,		/* "block" device - reserved */
35335863739SMike Smith 	FT_CHR,		/* "character special" device - reserved */
35435863739SMike Smith 	FT_LNK,		/* symbolic link */
35535863739SMike Smith 	FT_SOCK,	/* socket */
35635863739SMike Smith 	FT_FIFO,	/* fifo */
35735863739SMike Smith 	FT_FILESYS,	/* ADAPTEC's "FSA"(tm) filesystem */
358914da7d0SScott Long 	FT_DRIVE,	/* physical disk - addressable in scsi by b/t/l */
35935863739SMike Smith 	FT_SLICE,	/* virtual disk - raw volume - slice */
360914da7d0SScott Long 	FT_PARTITION,	/* FSA partition - carved out of a slice - building
361914da7d0SScott Long 			 * block for containers */
36235863739SMike Smith 	FT_VOLUME,	/* Container - Volume Set */
36335863739SMike Smith 	FT_STRIPE,	/* Container - Stripe Set */
36435863739SMike Smith 	FT_MIRROR,	/* Container - Mirror Set */
36535863739SMike Smith 	FT_RAID5,	/* Container - Raid 5 Set */
36635863739SMike Smith 	FT_DATABASE	/* Storage object with "foreign" content manager */
36735863739SMike Smith } AAC_FType;
36835863739SMike Smith 
36935863739SMike Smith /*
37035863739SMike Smith  * Host-side scatter/gather list for 32-bit commands.
37135863739SMike Smith  */
37235863739SMike Smith struct aac_sg_entry {
37335863739SMike Smith 	u_int32_t	SgAddress;
37435863739SMike Smith 	u_int32_t	SgByteCount;
3754f492bfaSAlfred Perlstein } __packed;
37635863739SMike Smith 
377a6d35632SScott Long struct aac_sg_entry64 {
378a6d35632SScott Long 	u_int64_t	SgAddress;
379a6d35632SScott Long 	u_int32_t	SgByteCount;
380a6d35632SScott Long } __packed;
381a6d35632SScott Long 
3827cb209f5SScott Long struct aac_sg_entryraw {
3837cb209f5SScott Long 	u_int32_t	Next;		/* reserved for FW use */
3847cb209f5SScott Long 	u_int32_t	Prev;		/* reserved for FW use */
3857cb209f5SScott Long 	u_int64_t	SgAddress;
3867cb209f5SScott Long 	u_int32_t	SgByteCount;
3877cb209f5SScott Long 	u_int32_t	Flags;		/* reserved for FW use */
3887cb209f5SScott Long } __packed;
3897cb209f5SScott Long 
39035863739SMike Smith struct aac_sg_table {
39135863739SMike Smith 	u_int32_t		SgCount;
39235863739SMike Smith 	struct aac_sg_entry	SgEntry[0];
3934f492bfaSAlfred Perlstein } __packed;
39435863739SMike Smith 
39535863739SMike Smith /*
39635863739SMike Smith  * Host-side scatter/gather list for 64-bit commands.
39735863739SMike Smith  */
39835863739SMike Smith struct aac_sg_table64 {
399a6d35632SScott Long 	u_int32_t	SgCount;
400a6d35632SScott Long 	struct aac_sg_entry64	SgEntry64[0];
4014f492bfaSAlfred Perlstein } __packed;
40235863739SMike Smith 
40335863739SMike Smith /*
4047cb209f5SScott Long  * s/g list for raw commands
4057cb209f5SScott Long  */
4067cb209f5SScott Long struct aac_sg_tableraw {
4077cb209f5SScott Long 	u_int32_t	SgCount;
4087cb209f5SScott Long 	struct aac_sg_entryraw	SgEntryRaw[0];
4097cb209f5SScott Long } __packed;
4107cb209f5SScott Long 
4117cb209f5SScott Long /*
41235863739SMike Smith  * Container creation data
41335863739SMike Smith  */
41435863739SMike Smith struct aac_container_creation {
41535863739SMike Smith 	u_int8_t	ViaBuildNumber;
41635863739SMike Smith 	u_int8_t	MicroSecond;
41735863739SMike Smith 	u_int8_t	Via;		/* 1 = FSU, 2 = API, etc. */
41835863739SMike Smith 	u_int8_t	YearsSince1900;
41935863739SMike Smith 	u_int32_t	Month:4;	/* 1-12 */
42035863739SMike Smith 	u_int32_t	Day:6;		/* 1-32 */
42135863739SMike Smith 	u_int32_t	Hour:6;		/* 0-23 */
42235863739SMike Smith 	u_int32_t	Minute:6;	/* 0-59 */
42335863739SMike Smith 	u_int32_t	Second:6;	/* 0-59 */
42435863739SMike Smith 	u_int64_t	ViaAdapterSerialNumber;
4254f492bfaSAlfred Perlstein } __packed;
42635863739SMike Smith 
427914da7d0SScott Long /*
42835863739SMike Smith  * Revision number handling
42935863739SMike Smith  */
43035863739SMike Smith 
43135863739SMike Smith typedef enum {
43235863739SMike Smith 	RevApplication = 1,
43335863739SMike Smith 	RevDkiCli,
43435863739SMike Smith 	RevNetService,
43535863739SMike Smith 	RevApi,
43635863739SMike Smith 	RevFileSysDriver,
43735863739SMike Smith 	RevMiniportDriver,
43835863739SMike Smith 	RevAdapterSW,
43935863739SMike Smith 	RevMonitor,
44035863739SMike Smith 	RevRemoteApi
44135863739SMike Smith } RevComponent;
44235863739SMike Smith 
44335863739SMike Smith struct FsaRevision {
44435863739SMike Smith 	union {
44535863739SMike Smith 		struct {
44635863739SMike Smith 			u_int8_t	dash;
44735863739SMike Smith 			u_int8_t	type;
44835863739SMike Smith 			u_int8_t	minor;
44935863739SMike Smith 			u_int8_t	major;
45035863739SMike Smith 		} comp;
45135863739SMike Smith 		u_int32_t	ul;
45235863739SMike Smith 	} external;
45335863739SMike Smith 	u_int32_t	buildNumber;
4544f492bfaSAlfred Perlstein }  __packed;
45535863739SMike Smith 
456914da7d0SScott Long /*
45735863739SMike Smith  * Adapter Information
45835863739SMike Smith  */
45935863739SMike Smith 
46035863739SMike Smith typedef enum {
46135863739SMike Smith 	CPU_NTSIM = 1,
46235863739SMike Smith 	CPU_I960,
46335863739SMike Smith 	CPU_ARM,
46435863739SMike Smith 	CPU_SPARC,
46535863739SMike Smith 	CPU_POWERPC,
46635863739SMike Smith 	CPU_ALPHA,
46735863739SMike Smith 	CPU_P7,
46835863739SMike Smith 	CPU_I960_RX,
4697cb209f5SScott Long 	CPU_MIPS,
4707cb209f5SScott Long 	CPU_XSCALE,
47135863739SMike Smith 	CPU__last
47235863739SMike Smith } AAC_CpuType;
47335863739SMike Smith 
47435863739SMike Smith typedef enum {
47535863739SMike Smith 	CPUI960_JX = 1,
47635863739SMike Smith 	CPUI960_CX,
47735863739SMike Smith 	CPUI960_HX,
47835863739SMike Smith 	CPUI960_RX,
47935863739SMike Smith 	CPUARM_SA110,
48035863739SMike Smith 	CPUARM_xxx,
4817cb209f5SScott Long 	CPUPPC_603e,
48235863739SMike Smith 	CPUPPC_xxx,
4837cb209f5SScott Long 	CPUI960_80303,
4847cb209f5SScott Long 	CPU_XSCALE_80321,
4857cb209f5SScott Long 	CPU_MIPS_4KC,
4867cb209f5SScott Long 	CPU_MIPS_5KC,
48735863739SMike Smith 	CPUSUBTYPE__last
48835863739SMike Smith } AAC_CpuSubType;
48935863739SMike Smith 
49035863739SMike Smith typedef enum {
49135863739SMike Smith 	PLAT_NTSIM = 1,
49235863739SMike Smith 	PLAT_V3ADU,
49335863739SMike Smith 	PLAT_CYCLONE,
49435863739SMike Smith 	PLAT_CYCLONE_HD,
49535863739SMike Smith 	PLAT_BATBOARD,
49635863739SMike Smith 	PLAT_BATBOARD_HD,
49735863739SMike Smith 	PLAT_YOLO,
49835863739SMike Smith 	PLAT_COBRA,
49935863739SMike Smith 	PLAT_ANAHEIM,
50035863739SMike Smith 	PLAT_JALAPENO,
50135863739SMike Smith 	PLAT_QUEENS,
50235863739SMike Smith 	PLAT_JALAPENO_DELL,
50335863739SMike Smith 	PLAT_POBLANO,
50435863739SMike Smith 	PLAT_POBLANO_OPAL,
50535863739SMike Smith 	PLAT_POBLANO_SL0,
50635863739SMike Smith 	PLAT_POBLANO_SL1,
50735863739SMike Smith 	PLAT_POBLANO_SL2,
50835863739SMike Smith 	PLAT_POBLANO_XXX,
50935863739SMike Smith 	PLAT_JALAPENO_P2,
51035863739SMike Smith 	PLAT_HABANERO,
5117cb209f5SScott Long 	PLAT_VULCAN,
5127cb209f5SScott Long 	PLAT_CRUSADER,
5137cb209f5SScott Long 	PLAT_LANCER,
5147cb209f5SScott Long 	PLAT_HARRIER,
5157cb209f5SScott Long 	PLAT_TERMINATOR,
5167cb209f5SScott Long 	PLAT_SKYHAWK,
5177cb209f5SScott Long 	PLAT_CORSAIR,
5187cb209f5SScott Long 	PLAT_JAGUAR,
5197cb209f5SScott Long 	PLAT_SATAHAWK,
5207cb209f5SScott Long 	PLAT_SATANATOR,
5217cb209f5SScott Long 	PLAT_PROWLER,
5227cb209f5SScott Long 	PLAT_BLACKBIRD,
5237cb209f5SScott Long 	PLAT_SABREEXPRESS,
5247cb209f5SScott Long 	PLAT_INTRUDER,
52535863739SMike Smith 	PLAT__last
52635863739SMike Smith } AAC_Platform;
52735863739SMike Smith 
52835863739SMike Smith typedef enum {
52935863739SMike Smith 	OEM_FLAVOR_ADAPTEC = 1,
53035863739SMike Smith 	OEM_FLAVOR_DELL,
53135863739SMike Smith 	OEM_FLAVOR_HP,
53235863739SMike Smith 	OEM_FLAVOR_IBM,
53335863739SMike Smith 	OEM_FLAVOR_CPQ,
5347cb209f5SScott Long 	OEM_FLAVOR_FSC,
5357cb209f5SScott Long 	OEM_FLAVOR_DWS,
53635863739SMike Smith 	OEM_FLAVOR_BRAND_Z,
5377cb209f5SScott Long 	OEM_FLAVOR_LEGEND,
5387cb209f5SScott Long 	OEM_FLAVOR_HITACHI,
5397cb209f5SScott Long 	OEM_FLAVOR_ESG,
5407cb209f5SScott Long 	OEM_FLAVOR_ICP,
5417cb209f5SScott Long 	OEM_FLAVOR_SCM,
54235863739SMike Smith 	OEM_FLAVOR__last
54335863739SMike Smith } AAC_OemFlavor;
54435863739SMike Smith 
54535863739SMike Smith /*
54635863739SMike Smith  * XXX the aac-2622 with no battery present reports PLATFORM_BAT_OPT_PRESENT
54735863739SMike Smith  */
54835863739SMike Smith typedef enum
54935863739SMike Smith {
55035863739SMike Smith 	PLATFORM_BAT_REQ_PRESENT = 1,	/* BATTERY REQUIRED AND PRESENT */
55135863739SMike Smith 	PLATFORM_BAT_REQ_NOTPRESENT,	/* BATTERY REQUIRED AND NOT PRESENT */
55235863739SMike Smith 	PLATFORM_BAT_OPT_PRESENT,	/* BATTERY OPTIONAL AND PRESENT */
55335863739SMike Smith 	PLATFORM_BAT_OPT_NOTPRESENT,	/* BATTERY OPTIONAL AND NOT PRESENT */
55435863739SMike Smith 	PLATFORM_BAT_NOT_SUPPORTED	/* BATTERY NOT SUPPORTED */
55535863739SMike Smith } AAC_BatteryPlatform;
55635863739SMike Smith 
55735863739SMike Smith /*
55835863739SMike Smith  * options supported by this board
55935863739SMike Smith  * there has to be a one to one mapping of these defines and the ones in
56035863739SMike Smith  * fsaapi.h, search for FSA_SUPPORT_SNAPSHOT
56135863739SMike Smith  */
56235863739SMike Smith #define AAC_SUPPORTED_SNAPSHOT		0x01
56335863739SMike Smith #define AAC_SUPPORTED_CLUSTERS		0x02
56435863739SMike Smith #define AAC_SUPPORTED_WRITE_CACHE	0x04
56535863739SMike Smith #define AAC_SUPPORTED_64BIT_DATA	0x08
56635863739SMike Smith #define AAC_SUPPORTED_HOST_TIME_FIB	0x10
56735863739SMike Smith #define AAC_SUPPORTED_RAID50		0x20
568a6d35632SScott Long #define AAC_SUPPORTED_4GB_WINDOW	0x40
569a6d35632SScott Long #define AAC_SUPPORTED_SCSI_UPGRADEABLE	0x80
570a6d35632SScott Long #define AAC_SUPPORTED_SOFT_ERR_REPORT	0x100
571a6d35632SScott Long #define AAC_SUPPORTED_NOT_RECONDITION	0x200
572a6d35632SScott Long #define AAC_SUPPORTED_SGMAP_HOST64	0x400
573a6d35632SScott Long #define AAC_SUPPORTED_ALARM		0x800
574a6d35632SScott Long #define AAC_SUPPORTED_NONDASD		0x1000
5757cb209f5SScott Long #define AAC_SUPPORTED_SCSI_MANAGED	0x2000
5767cb209f5SScott Long #define AAC_SUPPORTED_RAID_SCSI_MODE	0x4000
5777cb209f5SScott Long #define AAC_SUPPORTED_SUPPLEMENT_ADAPTER_INFO	0x10000
5787cb209f5SScott Long #define AAC_SUPPORTED_NEW_COMM		0x20000
5797cb209f5SScott Long #define AAC_SUPPORTED_64BIT_ARRAYSIZE	0x40000
5807cb209f5SScott Long #define AAC_SUPPORTED_HEAT_SENSOR	0x80000
58135863739SMike Smith 
58235863739SMike Smith /*
58335863739SMike Smith  * Structure used to respond to a RequestAdapterInfo fib.
58435863739SMike Smith  */
58535863739SMike Smith struct aac_adapter_info {
58635863739SMike Smith 	AAC_Platform		PlatformBase;	 /* adapter type */
58735863739SMike Smith 	AAC_CpuType		CpuArchitecture; /* adapter CPU type */
58835863739SMike Smith 	AAC_CpuSubType		CpuVariant;	 /* adapter CPU subtype */
58935863739SMike Smith 	u_int32_t		ClockSpeed;	 /* adapter CPU clockspeed */
590914da7d0SScott Long 	u_int32_t		ExecutionMem;	 /* adapter Execution Memory
591914da7d0SScott Long 						  * size */
59235863739SMike Smith 	u_int32_t		BufferMem;	 /* adapter Data Memory */
59335863739SMike Smith 	u_int32_t		TotalMem;	 /* adapter Total Memory */
594914da7d0SScott Long 	struct FsaRevision	KernelRevision;  /* adapter Kernel Software
595914da7d0SScott Long 						  * Revision */
596c6eafcf2SScott Long 	struct FsaRevision	MonitorRevision; /* adapter Monitor/Diagnostic
597c6eafcf2SScott Long 						  * Software Revision */
5980b94a66eSMike Smith 	struct FsaRevision	HardwareRevision;/* TBD */
59935863739SMike Smith 	struct FsaRevision	BIOSRevision;	 /* adapter BIOS Revision */
60035863739SMike Smith 	u_int32_t		ClusteringEnabled;
60135863739SMike Smith 	u_int32_t		ClusterChannelMask;
60235863739SMike Smith 	u_int64_t		SerialNumber;
60335863739SMike Smith 	AAC_BatteryPlatform	batteryPlatform;
604c6eafcf2SScott Long 	u_int32_t		SupportedOptions; /* supported features of this
605c6eafcf2SScott Long 						   * controller */
60635863739SMike Smith 	AAC_OemFlavor	OemVariant;
6074f492bfaSAlfred Perlstein } __packed;
60835863739SMike Smith 
609914da7d0SScott Long /*
6107ea2d558SEd Maste  * Structure used to respond to a RequestSupplementAdapterInfo fib.
6117ea2d558SEd Maste  */
6127ea2d558SEd Maste struct vpd_info {
6137ea2d558SEd Maste 	u_int8_t		AssemblyPn[8];
6147ea2d558SEd Maste 	u_int8_t		FruPn[8];
6157ea2d558SEd Maste 	u_int8_t		BatteryFruPn[8];
6167ea2d558SEd Maste 	u_int8_t		EcVersionString[8];
6177ea2d558SEd Maste 	u_int8_t		Tsid[12];
6187ea2d558SEd Maste } __packed;
6197ea2d558SEd Maste 
6207ea2d558SEd Maste #define	MFG_PCBA_SERIAL_NUMBER_WIDTH	12
6217ea2d558SEd Maste #define	MFG_WWN_WIDTH			8
6227ea2d558SEd Maste 
6237ea2d558SEd Maste struct aac_supplement_adapter_info {
6247ea2d558SEd Maste 	/* The assigned Adapter Type Text, extra byte for null termination */
6257ea2d558SEd Maste 	int8_t		AdapterTypeText[17+1];
6267ea2d558SEd Maste 	/* Pad for the text above */
6277ea2d558SEd Maste 	int8_t		Pad[2];
6287ea2d558SEd Maste 	/* Size in bytes of the memory that is flashed */
6297ea2d558SEd Maste 	u_int32_t	FlashMemoryByteSize;
6307ea2d558SEd Maste 	/* The assigned IMAGEID_xxx for this adapter */
6317ea2d558SEd Maste 	u_int32_t	FlashImageId;
6327ea2d558SEd Maste 	/*
6337ea2d558SEd Maste 	 * The maximum number of Phys available on a SATA/SAS
6347ea2d558SEd Maste 	 * Controller, 0 otherwise
6357ea2d558SEd Maste 	 */
6367ea2d558SEd Maste 	u_int32_t	MaxNumberPorts;
6377ea2d558SEd Maste 	/* Version of expansion area */
6387ea2d558SEd Maste 	u_int32_t	Version;
6397ea2d558SEd Maste 	u_int32_t	FeatureBits;
6407ea2d558SEd Maste 	u_int8_t		SlotNumber;
6417ea2d558SEd Maste 	u_int8_t		ReservedPad0[3];
6427ea2d558SEd Maste 	u_int8_t		BuildDate[12];
6437ea2d558SEd Maste 	/* The current number of Ports on a SAS controller, 0 otherwise */
6447ea2d558SEd Maste 	u_int32_t	CurrentNumberPorts;
6457ea2d558SEd Maste 
6467ea2d558SEd Maste 	struct vpd_info VpdInfo;
6477ea2d558SEd Maste 
6487ea2d558SEd Maste 	/* Firmware Revision (Vmaj.min-dash.) */
6497ea2d558SEd Maste 	struct FsaRevision	FlashFirmwareRevision;
6507ea2d558SEd Maste 	u_int32_t	RaidTypeMorphOptions;
6517ea2d558SEd Maste 	/* Firmware's boot code Revision (Vmaj.min-dash.) */
6527ea2d558SEd Maste 	struct FsaRevision	FlashFirmwareBootRevision;
6537ea2d558SEd Maste 	/* PCBA serial no. from th MFG sector */
6547ea2d558SEd Maste 	u_int8_t		MfgPcbaSerialNo[MFG_PCBA_SERIAL_NUMBER_WIDTH];
6557ea2d558SEd Maste 	/* WWN from the MFG sector */
6567ea2d558SEd Maste 	u_int8_t		MfgWWNName[MFG_WWN_WIDTH];
6577ea2d558SEd Maste 	/* Growth Area for future expansion ((7*4) - 12 - 8)/4 = 2 words */
6587ea2d558SEd Maste 	u_int32_t	ReservedGrowth[2];
6597ea2d558SEd Maste } __packed;
6607ea2d558SEd Maste 
6617ea2d558SEd Maste /*
66235863739SMike Smith  * Monitor/Kernel interface.
66335863739SMike Smith  */
66435863739SMike Smith 
66535863739SMike Smith /*
66635863739SMike Smith  * Synchronous commands to the monitor/kernel.
66735863739SMike Smith  */
6687cb209f5SScott Long #define AAC_MONKER_BREAKPOINT	0x04
66935863739SMike Smith #define AAC_MONKER_INITSTRUCT	0x05
67035863739SMike Smith #define AAC_MONKER_SYNCFIB	0x0c
671fe94b852SScott Long #define AAC_MONKER_GETKERNVER	0x11
6727cb209f5SScott Long #define AAC_MONKER_POSTRESULTS	0x14
673a6d35632SScott Long #define AAC_MONKER_GETINFO	0x19
6747cb209f5SScott Long #define AAC_MONKER_GETDRVPROP	0x23
6757cb209f5SScott Long #define AAC_MONKER_RCVTEMP	0x25
6767cb209f5SScott Long #define AAC_MONKER_GETCOMMPREF	0x26
6777cb209f5SScott Long #define AAC_MONKER_REINIT	0xee
67835863739SMike Smith 
67935863739SMike Smith /*
68035863739SMike Smith  *  Adapter Status Register
68135863739SMike Smith  *
68235863739SMike Smith  *  Phase Staus mailbox is 32bits:
68335863739SMike Smith  *  <31:16> = Phase Status
68435863739SMike Smith  *  <15:0>  = Phase
68535863739SMike Smith  *
68635863739SMike Smith  *  The adapter reports its present state through the phase.  Only
68735863739SMike Smith  *  a single phase should be ever be set.  Each phase can have multiple
68835863739SMike Smith  *  phase status bits to provide more detailed information about the
68935863739SMike Smith  *  state of the adapter.
69035863739SMike Smith  */
69135863739SMike Smith #define AAC_SELF_TEST_FAILED	0x00000004
69215c37be0SScott Long #define AAC_MONITOR_PANIC	0x00000020
69335863739SMike Smith #define AAC_UP_AND_RUNNING	0x00000080
69435863739SMike Smith #define AAC_KERNEL_PANIC	0x00000100
69535863739SMike Smith 
696914da7d0SScott Long /*
69735863739SMike Smith  * Data types relating to control and monitoring of the NVRAM/WriteCache
69835863739SMike Smith  * subsystem.
69935863739SMike Smith  */
70035863739SMike Smith 
70135863739SMike Smith #define AAC_NFILESYS	24	/* maximum number of filesystems */
70235863739SMike Smith 
70335863739SMike Smith /*
70435863739SMike Smith  * NVRAM/Write Cache subsystem states
70535863739SMike Smith  */
70635863739SMike Smith typedef enum {
70735863739SMike Smith 	NVSTATUS_DISABLED = 0,	/* present, clean, not being used */
70835863739SMike Smith 	NVSTATUS_ENABLED,	/* present, possibly dirty, ready for use */
70935863739SMike Smith 	NVSTATUS_ERROR,		/* present, dirty, contains dirty data */
710914da7d0SScott Long 	NVSTATUS_BATTERY,	/* present, bad or low battery, may contain
711914da7d0SScott Long 				 * dirty data */
712914da7d0SScott Long 	NVSTATUS_UNKNOWN	/* for bad/missing device */
71335863739SMike Smith } AAC_NVSTATUS;
71435863739SMike Smith 
71535863739SMike Smith /*
71635863739SMike Smith  * NVRAM/Write Cache subsystem battery component states
71735863739SMike Smith  *
71835863739SMike Smith  */
71935863739SMike Smith typedef enum {
72035863739SMike Smith 	NVBATTSTATUS_NONE = 0,	/* battery has no power or is not present */
72135863739SMike Smith 	NVBATTSTATUS_LOW,	/* battery is low on power */
722914da7d0SScott Long 	NVBATTSTATUS_OK,	/* battery is okay - normal operation possible
723914da7d0SScott Long 				 * only in this state */
724914da7d0SScott Long 	NVBATTSTATUS_RECONDITIONING	/* no battery present - reconditioning
725914da7d0SScott Long 					 * in process */
72635863739SMike Smith } AAC_NVBATTSTATUS;
72735863739SMike Smith 
72835863739SMike Smith /*
72935863739SMike Smith  * Battery transition type
73035863739SMike Smith  */
73135863739SMike Smith typedef enum {
732914da7d0SScott Long 	NVBATT_TRANSITION_NONE = 0,	/* battery now has no power or is not
733914da7d0SScott Long 					 * present */
73435863739SMike Smith 	NVBATT_TRANSITION_LOW,		/* battery is now low on power */
735914da7d0SScott Long 	NVBATT_TRANSITION_OK		/* battery is now okay - normal
736914da7d0SScott Long 					 * operation possible only in this
737914da7d0SScott Long 					 * state */
73835863739SMike Smith } AAC_NVBATT_TRANSITION;
73935863739SMike Smith 
74035863739SMike Smith /*
74135863739SMike Smith  * NVRAM Info structure returned for NVRAM_GetInfo call
74235863739SMike Smith  */
74335863739SMike Smith struct aac_nvramdevinfo {
74435863739SMike Smith 	u_int32_t	NV_Enabled;	/* write caching enabled */
74535863739SMike Smith 	u_int32_t	NV_Error;	/* device in error state */
74635863739SMike Smith 	u_int32_t	NV_NDirty;	/* count of dirty NVRAM buffers */
747914da7d0SScott Long 	u_int32_t	NV_NActive;	/* count of NVRAM buffers being
748914da7d0SScott Long 					 * written */
7494f492bfaSAlfred Perlstein } __packed;
75035863739SMike Smith 
75135863739SMike Smith struct aac_nvraminfo {
75235863739SMike Smith 	AAC_NVSTATUS		NV_Status;	/* nvram subsystem status */
75335863739SMike Smith 	AAC_NVBATTSTATUS	NV_BattStatus;	/* battery status */
754c6eafcf2SScott Long 	u_int32_t		NV_Size;	/* size of WriteCache NVRAM in
755c6eafcf2SScott Long 						 * bytes */
756c6eafcf2SScott Long 	u_int32_t		NV_BufSize;	/* size of NVRAM buffers in
757c6eafcf2SScott Long 						 * bytes */
75835863739SMike Smith 	u_int32_t		NV_NBufs;	/* number of NVRAM buffers */
759c6eafcf2SScott Long 	u_int32_t		NV_NDirty;	/* Num dirty NVRAM buffers */
760c6eafcf2SScott Long 	u_int32_t		NV_NClean;	/* Num clean NVRAM buffers */
761c6eafcf2SScott Long 	u_int32_t		NV_NActive;	/* Num NVRAM buffers being
762c6eafcf2SScott Long 						 * written */
763c6eafcf2SScott Long 	u_int32_t		NV_NBrokered;	/* Num brokered NVRAM buffers */
764c6eafcf2SScott Long 	struct aac_nvramdevinfo	NV_DevInfo[AAC_NFILESYS];	/* per device
765c6eafcf2SScott Long 								 * info */
76635863739SMike Smith 	u_int32_t		NV_BattNeedsReconditioning;	/* boolean */
767c6eafcf2SScott Long 	u_int32_t		NV_TotalSize;	/* size of all non-volatile
768c6eafcf2SScott Long 						 * memories in bytes */
7694f492bfaSAlfred Perlstein } __packed;
77035863739SMike Smith 
771914da7d0SScott Long /*
77235863739SMike Smith  * Data types relating to adapter-initiated FIBs
77335863739SMike Smith  *
77435863739SMike Smith  * Based on types and structures in <aifstruc.h>
77535863739SMike Smith  */
77635863739SMike Smith 
77735863739SMike Smith /*
77835863739SMike Smith  * Progress Reports
77935863739SMike Smith  */
78035863739SMike Smith typedef enum {
78135863739SMike Smith 	AifJobStsSuccess = 1,
78235863739SMike Smith 	AifJobStsFinished,
78335863739SMike Smith 	AifJobStsAborted,
78435863739SMike Smith 	AifJobStsFailed,
785914da7d0SScott Long 	AifJobStsLastReportMarker = 100,	/* All prior mean last report */
78635863739SMike Smith 	AifJobStsSuspended,
78735863739SMike Smith 	AifJobStsRunning
78835863739SMike Smith } AAC_AifJobStatus;
78935863739SMike Smith 
79035863739SMike Smith typedef enum {
79135863739SMike Smith 	AifJobScsiMin = 1,		/* Minimum value for Scsi operation */
79235863739SMike Smith 	AifJobScsiZero,			/* SCSI device clear operation */
793c6eafcf2SScott Long 	AifJobScsiVerify,		/* SCSI device Verify operation NO
794c6eafcf2SScott Long 					 * REPAIR */
79535863739SMike Smith 	AifJobScsiExercise,		/* SCSI device Exercise operation */
796c6eafcf2SScott Long 	AifJobScsiVerifyRepair,		/* SCSI device Verify operation WITH
797c6eafcf2SScott Long 					 * repair */
7987cb209f5SScott Long 	AifJobScsiWritePattern,		/* write pattern */
79935863739SMike Smith 	AifJobScsiMax = 99,		/* Max Scsi value */
80035863739SMike Smith 	AifJobCtrMin,			/* Min Ctr op value */
80135863739SMike Smith 	AifJobCtrZero,			/* Container clear operation */
80235863739SMike Smith 	AifJobCtrCopy,			/* Container copy operation */
80335863739SMike Smith 	AifJobCtrCreateMirror,		/* Container Create Mirror operation */
80435863739SMike Smith 	AifJobCtrMergeMirror,		/* Container Merge Mirror operation */
80535863739SMike Smith 	AifJobCtrScrubMirror,		/* Container Scrub Mirror operation */
80635863739SMike Smith 	AifJobCtrRebuildRaid5,		/* Container Rebuild Raid5 operation */
80735863739SMike Smith 	AifJobCtrScrubRaid5,		/* Container Scrub Raid5 operation */
80835863739SMike Smith 	AifJobCtrMorph,			/* Container morph operation */
80935863739SMike Smith 	AifJobCtrPartCopy,		/* Container Partition copy operation */
81035863739SMike Smith 	AifJobCtrRebuildMirror,		/* Container Rebuild Mirror operation */
81135863739SMike Smith 	AifJobCtrCrazyCache,		/* crazy cache */
8127cb209f5SScott Long 	AifJobCtrCopyback,		/* Container Copyback operation */
8137cb209f5SScott Long 	AifJobCtrCompactRaid5D,		/* Container Compaction operation */
8147cb209f5SScott Long 	AifJobCtrExpandRaid5D,		/* Container Expansion operation */
8157cb209f5SScott Long 	AifJobCtrRebuildRaid6,		/* Container Rebuild Raid6 operation */
8167cb209f5SScott Long 	AifJobCtrScrubRaid6,		/* Container Scrub Raid6 operation */
8177cb209f5SScott Long 	AifJobCtrSSBackup,		/* Container snapshot backup task */
81835863739SMike Smith 	AifJobCtrMax = 199,		/* Max Ctr type operation */
81935863739SMike Smith 	AifJobFsMin,			/* Min Fs type operation */
82035863739SMike Smith 	AifJobFsCreate,			/* File System Create operation */
82135863739SMike Smith 	AifJobFsVerify,			/* File System Verify operation */
82235863739SMike Smith 	AifJobFsExtend,			/* File System Extend operation */
82335863739SMike Smith 	AifJobFsMax = 299,		/* Max Fs type operation */
82435863739SMike Smith 	AifJobApiFormatNTFS,		/* Format a drive to NTFS */
82535863739SMike Smith 	AifJobApiFormatFAT,		/* Format a drive to FAT */
826c6eafcf2SScott Long 	AifJobApiUpdateSnapshot,	/* update the read/write half of a
827c6eafcf2SScott Long 					 * snapshot */
82835863739SMike Smith 	AifJobApiFormatFAT32,		/* Format a drive to FAT32 */
82935863739SMike Smith 	AifJobApiMax = 399,		/* Max API type operation */
83035863739SMike Smith 	AifJobCtlContinuousCtrVerify,	/* Adapter operation */
83135863739SMike Smith 	AifJobCtlMax = 499		/* Max Adapter type operation */
83235863739SMike Smith } AAC_AifJobType;
83335863739SMike Smith 
83435863739SMike Smith struct aac_AifContainers {
83535863739SMike Smith 	u_int32_t	src;		/* from/master */
83635863739SMike Smith 	u_int32_t	dst;		/* to/slave */
8374f492bfaSAlfred Perlstein } __packed;
83835863739SMike Smith 
83935863739SMike Smith union aac_AifJobClient {
840914da7d0SScott Long 	struct aac_AifContainers	container;	/* For Container and
841914da7d0SScott Long 							 * filesystem progress
842914da7d0SScott Long 							 * ops; */
843914da7d0SScott Long 	int32_t				scsi_dh;	/* For SCSI progress
844914da7d0SScott Long 							 * ops */
84535863739SMike Smith };
84635863739SMike Smith 
84735863739SMike Smith struct aac_AifJobDesc {
848c6eafcf2SScott Long 	u_int32_t		jobID;		/* DO NOT FILL IN! Will be
849c6eafcf2SScott Long 						 * filled in by AIF */
850c6eafcf2SScott Long 	AAC_AifJobType		type;		/* Operation that is being
851c6eafcf2SScott Long 						 * performed */
85235863739SMike Smith 	union aac_AifJobClient	client;		/* Details */
8534f492bfaSAlfred Perlstein } __packed;
85435863739SMike Smith 
85535863739SMike Smith struct aac_AifJobProgressReport {
85635863739SMike Smith 	struct aac_AifJobDesc	jd;
85735863739SMike Smith 	AAC_AifJobStatus	status;
85835863739SMike Smith 	u_int32_t		finalTick;
85935863739SMike Smith 	u_int32_t		currentTick;
86035863739SMike Smith 	u_int32_t		jobSpecificData1;
86135863739SMike Smith 	u_int32_t		jobSpecificData2;
8624f492bfaSAlfred Perlstein } __packed;
86335863739SMike Smith 
86435863739SMike Smith /*
86535863739SMike Smith  * Event Notification
86635863739SMike Smith  */
86735863739SMike Smith typedef enum {
86835863739SMike Smith 	/* General application notifies start here */
86935863739SMike Smith 	AifEnGeneric = 1,		/* Generic notification */
87035863739SMike Smith 	AifEnTaskComplete,		/* Task has completed */
871c6eafcf2SScott Long 	AifEnConfigChange,		/* Adapter config change occurred */
872c6eafcf2SScott Long 	AifEnContainerChange,		/* Adapter specific container
873c6eafcf2SScott Long 					 * configuration change */
87435863739SMike Smith 	AifEnDeviceFailure,		/* SCSI device failed */
87535863739SMike Smith 	AifEnMirrorFailover,		/* Mirror failover started */
87635863739SMike Smith 	AifEnContainerEvent,		/* Significant container event */
87735863739SMike Smith 	AifEnFileSystemChange,		/* File system changed */
87835863739SMike Smith 	AifEnConfigPause,		/* Container pause event */
87935863739SMike Smith 	AifEnConfigResume,		/* Container resume event */
88035863739SMike Smith 	AifEnFailoverChange,		/* Failover space assignment changed */
88135863739SMike Smith 	AifEnRAID5RebuildDone,		/* RAID5 rebuild finished */
88235863739SMike Smith 	AifEnEnclosureManagement,	/* Enclosure management event */
88335863739SMike Smith 	AifEnBatteryEvent,		/* Significant NV battery event */
88435863739SMike Smith 	AifEnAddContainer,		/* A new container was created. */
88535863739SMike Smith 	AifEnDeleteContainer,		/* A container was deleted. */
88635863739SMike Smith 	AifEnSMARTEvent,		/* SMART Event */
88735863739SMike Smith 	AifEnBatteryNeedsRecond,	/* The battery needs reconditioning */
88835863739SMike Smith 	AifEnClusterEvent,		/* Some cluster event */
889453130d9SPedro F. Giffuni 	AifEnDiskSetEvent,		/* A disk set event occurred. */
890435c8a15SEd Maste 	AifEnContainerScsiEvent,	/* a container event with no. and scsi id */
891435c8a15SEd Maste 	AifEnPicBatteryEvent,	/* An event gen. by pic_battery.c for an ABM */
892435c8a15SEd Maste 	AifEnExpEvent,		/* Exp. Event Type to replace CTPopUp messages */
893435c8a15SEd Maste 	AifEnRAID6RebuildDone,	/* RAID6 rebuild finished */
894435c8a15SEd Maste 	AifEnSensorOverHeat,	/* Heat Sensor indicate overheat */
895435c8a15SEd Maste 	AifEnSensorCoolDown,	/* Heat Sensor ind. cooled down after overheat */
896435c8a15SEd Maste 	AifFeatureKeysModified,	/* notif. of updated feature keys */
897435c8a15SEd Maste 	AifApplicationExpirationEvent,	/* notif. on app. expiration status */
898435c8a15SEd Maste 	AifEnBackgroundConsistencyCheck,/* BCC notif. for NEC - DDTS 94700 */
899435c8a15SEd Maste 	AifEnAddJBOD,		/* A new JBOD type drive was created (30) */
900435c8a15SEd Maste 	AifEnDeleteJBOD,	/* A JBOD type drive was deleted (31) */
90135863739SMike Smith 	AifDriverNotifyStart=199,	/* Notifies for host driver go here */
90235863739SMike Smith 	/* Host driver notifications start here */
90335863739SMike Smith 	AifDenMorphComplete, 		/* A morph operation completed */
904914da7d0SScott Long 	AifDenVolumeExtendComplete 	/* Volume expand operation completed */
90535863739SMike Smith } AAC_AifEventNotifyType;
90635863739SMike Smith 
90735863739SMike Smith struct aac_AifEnsGeneric {
90835863739SMike Smith 	char	text[132];		/* Generic text */
9094f492bfaSAlfred Perlstein } __packed;
91035863739SMike Smith 
91135863739SMike Smith struct aac_AifEnsDeviceFailure {
91235863739SMike Smith 	u_int32_t	deviceHandle;	/* SCSI device handle */
9134f492bfaSAlfred Perlstein } __packed;
91435863739SMike Smith 
91535863739SMike Smith struct aac_AifEnsMirrorFailover {
91635863739SMike Smith 	u_int32_t	container;	/* Container with failed element */
91735863739SMike Smith 	u_int32_t	failedSlice;	/* Old slice which failed */
91835863739SMike Smith 	u_int32_t	creatingSlice;	/* New slice used for auto-create */
9194f492bfaSAlfred Perlstein } __packed;
92035863739SMike Smith 
92135863739SMike Smith struct aac_AifEnsContainerChange {
922c6eafcf2SScott Long 	u_int32_t	container[2];	/* container that changed, -1 if no
923c6eafcf2SScott Long 					 * container */
9244f492bfaSAlfred Perlstein } __packed;
92535863739SMike Smith 
92635863739SMike Smith struct aac_AifEnsContainerEvent {
92735863739SMike Smith 	u_int32_t	container;	/* container number  */
92835863739SMike Smith 	u_int32_t	eventType;	/* event type */
9294f492bfaSAlfred Perlstein } __packed;
93035863739SMike Smith 
93135863739SMike Smith struct aac_AifEnsEnclosureEvent {
932c6eafcf2SScott Long 	u_int32_t	empID;		/* enclosure management proc number  */
933c6eafcf2SScott Long 	u_int32_t	unitID;		/* unitId, fan id, power supply id,
934c6eafcf2SScott Long 					 * slot id, tempsensor id.  */
93535863739SMike Smith 	u_int32_t	eventType;	/* event type */
9364f492bfaSAlfred Perlstein } __packed;
93735863739SMike Smith 
938851f59d7SEd Maste typedef enum {
939851f59d7SEd Maste 	AIF_EM_DRIVE_INSERTION=31,
940851f59d7SEd Maste 	AIF_EM_DRIVE_REMOVAL
941851f59d7SEd Maste } aac_AifEMEventType;
942851f59d7SEd Maste 
94335863739SMike Smith struct aac_AifEnsBatteryEvent {
944c6eafcf2SScott Long 	AAC_NVBATT_TRANSITION	transition_type;	/* eg from low to ok */
945c6eafcf2SScott Long 	AAC_NVBATTSTATUS	current_state;		/* current batt state */
946c6eafcf2SScott Long 	AAC_NVBATTSTATUS	prior_state;		/* prev batt state */
9474f492bfaSAlfred Perlstein } __packed;
94835863739SMike Smith 
94935863739SMike Smith struct aac_AifEnsDiskSetEvent {
95035863739SMike Smith 	u_int32_t	eventType;
95135863739SMike Smith 	u_int64_t	DsNum;
95235863739SMike Smith 	u_int64_t	CreatorId;
9534f492bfaSAlfred Perlstein } __packed;
95435863739SMike Smith 
95535863739SMike Smith typedef enum {
95635863739SMike Smith 	CLUSTER_NULL_EVENT = 0,
957c6eafcf2SScott Long 	CLUSTER_PARTNER_NAME_EVENT,	/* change in partner hostname or
958c6eafcf2SScott Long 					 * adaptername from NULL to non-NULL */
95935863739SMike Smith 	/* (partner's agent may be up) */
960c6eafcf2SScott Long 	CLUSTER_PARTNER_NULL_NAME_EVENT	/* change in partner hostname or
961c6eafcf2SScott Long 					 * adaptername from non-null to NULL */
96235863739SMike Smith 	/* (partner has rebooted) */
96335863739SMike Smith } AAC_ClusterAifEvent;
96435863739SMike Smith 
96535863739SMike Smith struct aac_AifEnsClusterEvent {
96635863739SMike Smith 	AAC_ClusterAifEvent	eventType;
9674f492bfaSAlfred Perlstein } __packed;
96835863739SMike Smith 
96935863739SMike Smith struct aac_AifEventNotify {
97035863739SMike Smith 	AAC_AifEventNotifyType	type;
97135863739SMike Smith 	union {
97235863739SMike Smith 		struct aac_AifEnsGeneric		EG;
97335863739SMike Smith 		struct aac_AifEnsDeviceFailure		EDF;
97435863739SMike Smith 		struct aac_AifEnsMirrorFailover		EMF;
97535863739SMike Smith 		struct aac_AifEnsContainerChange	ECC;
97635863739SMike Smith 		struct aac_AifEnsContainerEvent		ECE;
97735863739SMike Smith 		struct aac_AifEnsEnclosureEvent		EEE;
97835863739SMike Smith 		struct aac_AifEnsBatteryEvent		EBE;
97935863739SMike Smith 		struct aac_AifEnsDiskSetEvent		EDS;
98035863739SMike Smith /*		struct aac_AifEnsSMARTEvent		ES;*/
98135863739SMike Smith 		struct aac_AifEnsClusterEvent		ECLE;
98235863739SMike Smith 	} data;
9834f492bfaSAlfred Perlstein } __packed;
98435863739SMike Smith 
98535863739SMike Smith /*
98635863739SMike Smith  * Adapter Initiated FIB command structures. Start with the adapter
98735863739SMike Smith  * initiated FIBs that really come from the adapter, and get responded
98835863739SMike Smith  * to by the host.
98935863739SMike Smith  */
99035863739SMike Smith #define AAC_AIF_REPORT_MAX_SIZE 64
99135863739SMike Smith 
99235863739SMike Smith typedef enum {
99335863739SMike Smith 	AifCmdEventNotify = 1,	/* Notify of event */
99435863739SMike Smith 	AifCmdJobProgress,	/* Progress report */
99535863739SMike Smith 	AifCmdAPIReport,	/* Report from other user of API */
99635863739SMike Smith 	AifCmdDriverNotify,	/* Notify host driver of event */
99735863739SMike Smith 	AifReqJobList = 100,	/* Gets back complete job list */
99835863739SMike Smith 	AifReqJobsForCtr,	/* Gets back jobs for specific container */
99935863739SMike Smith 	AifReqJobsForScsi,	/* Gets back jobs for specific SCSI device */
1000c6eafcf2SScott Long 	AifReqJobReport,	/* Gets back a specific job report or list */
100135863739SMike Smith 	AifReqTerminateJob,	/* Terminates job */
100235863739SMike Smith 	AifReqSuspendJob,	/* Suspends a job */
100335863739SMike Smith 	AifReqResumeJob,	/* Resumes a job */
100435863739SMike Smith 	AifReqSendAPIReport,	/* API generic report requests */
100535863739SMike Smith 	AifReqAPIJobStart,	/* Start a job from the API */
100635863739SMike Smith 	AifReqAPIJobUpdate,	/* Update a job report from the API */
100735863739SMike Smith 	AifReqAPIJobFinish	/* Finish a job from the API */
100835863739SMike Smith } AAC_AifCommand;
100935863739SMike Smith 
101035863739SMike Smith struct aac_aif_command {
1011c6eafcf2SScott Long 	AAC_AifCommand	command;	/* Tell host what type of
1012c6eafcf2SScott Long 					 * notify this is */
1013c6eafcf2SScott Long 	u_int32_t	seqNumber;	/* To allow ordering of
1014c6eafcf2SScott Long 					 * reports (if necessary) */
101535863739SMike Smith 	union {
10163df780cfSScott Long 		struct aac_AifEventNotify	EN;	/* Event notify */
101735863739SMike Smith 		struct aac_AifJobProgressReport	PR[1];	/* Progress report */
101835863739SMike Smith 		u_int8_t			AR[AAC_AIF_REPORT_MAX_SIZE];
10193df780cfSScott Long 		u_int8_t			data[AAC_FIB_DATASIZE - 8];
102035863739SMike Smith 	} data;
10214f492bfaSAlfred Perlstein } __packed;
102235863739SMike Smith 
1023914da7d0SScott Long /*
102435863739SMike Smith  * Filesystem commands/data
102535863739SMike Smith  *
102635863739SMike Smith  * The adapter has a very complex filesystem interface, most of which we ignore.
102735863739SMike Smith  * (And which seems not to be implemented, anyway.)
102835863739SMike Smith  */
102935863739SMike Smith 
103035863739SMike Smith /*
103135863739SMike Smith  * FSA commands
103235863739SMike Smith  * (not used?)
103335863739SMike Smith  */
103435863739SMike Smith typedef enum {
103535863739SMike Smith 	Null = 0,
103635863739SMike Smith 	GetAttributes,
103735863739SMike Smith 	SetAttributes,
103835863739SMike Smith 	Lookup,
103935863739SMike Smith 	ReadLink,
104035863739SMike Smith 	Read,
104135863739SMike Smith 	Write,
104235863739SMike Smith 	Create,
104335863739SMike Smith 	MakeDirectory,
104435863739SMike Smith 	SymbolicLink,
104535863739SMike Smith 	MakeNode,
104635863739SMike Smith 	Removex,
104735863739SMike Smith 	RemoveDirectory,
104835863739SMike Smith 	Rename,
104935863739SMike Smith 	Link,
105035863739SMike Smith 	ReadDirectory,
105135863739SMike Smith 	ReadDirectoryPlus,
105235863739SMike Smith 	FileSystemStatus,
105335863739SMike Smith 	FileSystemInfo,
105435863739SMike Smith 	PathConfigure,
105535863739SMike Smith 	Commit,
105635863739SMike Smith 	Mount,
105735863739SMike Smith 	UnMount,
105835863739SMike Smith 	Newfs,
105935863739SMike Smith 	FsCheck,
106035863739SMike Smith 	FsSync,
106135863739SMike Smith 	SimReadWrite,
106235863739SMike Smith 	SetFileSystemStatus,
106335863739SMike Smith 	BlockRead,
106435863739SMike Smith 	BlockWrite,
106535863739SMike Smith 	NvramIoctl,
106635863739SMike Smith 	FsSyncWait,
106735863739SMike Smith 	ClearArchiveBit,
106835863739SMike Smith 	SetAcl,
106935863739SMike Smith 	GetAcl,
107035863739SMike Smith 	AssignAcl,
107135863739SMike Smith 	FaultInsertion,
107235863739SMike Smith 	CrazyCache
107335863739SMike Smith } AAC_FSACommand;
107435863739SMike Smith 
107535863739SMike Smith /*
107635863739SMike Smith  * Command status values
107735863739SMike Smith  */
107835863739SMike Smith typedef enum {
107935863739SMike Smith 	ST_OK = 0,
108035863739SMike Smith 	ST_PERM = 1,
108135863739SMike Smith 	ST_NOENT = 2,
108235863739SMike Smith 	ST_IO = 5,
108335863739SMike Smith 	ST_NXIO = 6,
108435863739SMike Smith 	ST_E2BIG = 7,
108535863739SMike Smith 	ST_ACCES = 13,
108635863739SMike Smith 	ST_EXIST = 17,
108735863739SMike Smith 	ST_XDEV = 18,
108835863739SMike Smith 	ST_NODEV = 19,
108935863739SMike Smith 	ST_NOTDIR = 20,
109035863739SMike Smith 	ST_ISDIR = 21,
109135863739SMike Smith 	ST_INVAL = 22,
109235863739SMike Smith 	ST_FBIG = 27,
109335863739SMike Smith 	ST_NOSPC = 28,
109435863739SMike Smith 	ST_ROFS = 30,
109535863739SMike Smith 	ST_MLINK = 31,
109635863739SMike Smith 	ST_WOULDBLOCK = 35,
109735863739SMike Smith 	ST_NAMETOOLONG = 63,
109835863739SMike Smith 	ST_NOTEMPTY = 66,
109935863739SMike Smith 	ST_DQUOT = 69,
110035863739SMike Smith 	ST_STALE = 70,
110135863739SMike Smith 	ST_REMOTE = 71,
1102e71d3b9cSEd Maste 	ST_NOT_READY = 72,
110335863739SMike Smith 	ST_BADHANDLE = 10001,
110435863739SMike Smith 	ST_NOT_SYNC = 10002,
110535863739SMike Smith 	ST_BAD_COOKIE = 10003,
110635863739SMike Smith 	ST_NOTSUPP = 10004,
110735863739SMike Smith 	ST_TOOSMALL = 10005,
110835863739SMike Smith 	ST_SERVERFAULT = 10006,
110935863739SMike Smith 	ST_BADTYPE = 10007,
111035863739SMike Smith 	ST_JUKEBOX = 10008,
111135863739SMike Smith 	ST_NOTMOUNTED = 10009,
111235863739SMike Smith 	ST_MAINTMODE = 10010,
1113e71d3b9cSEd Maste 	ST_STALEACL = 10011,
1114e71d3b9cSEd Maste 	ST_BUS_RESET = 20001
111535863739SMike Smith } AAC_FSAStatus;
111635863739SMike Smith 
111735863739SMike Smith /*
111835863739SMike Smith  * Volume manager commands
111935863739SMike Smith  */
112035863739SMike Smith typedef enum _VM_COMMANDS {
112135863739SMike Smith 	VM_Null = 0,
112235863739SMike Smith 	VM_NameServe,
112335863739SMike Smith 	VM_ContainerConfig,
112435863739SMike Smith 	VM_Ioctl,
112535863739SMike Smith 	VM_FilesystemIoctl,
112635863739SMike Smith 	VM_CloseAll,
112735863739SMike Smith 	VM_CtBlockRead,
112835863739SMike Smith 	VM_CtBlockWrite,
1129914da7d0SScott Long 	VM_SliceBlockRead,	 /* raw access to configured storage objects */
113035863739SMike Smith 	VM_SliceBlockWrite,
113135863739SMike Smith 	VM_DriveBlockRead,	 /* raw access to physical devices */
113235863739SMike Smith 	VM_DriveBlockWrite,
113335863739SMike Smith 	VM_EnclosureMgt,	 /* enclosure management */
113435863739SMike Smith 	VM_Unused,		 /* used to be diskset management */
113535863739SMike Smith 	VM_CtBlockVerify,
113635863739SMike Smith 	VM_CtPerf,		 /* performance test */
113735863739SMike Smith 	VM_CtBlockRead64,
113835863739SMike Smith 	VM_CtBlockWrite64,
113935863739SMike Smith 	VM_CtBlockVerify64,
1140a6d35632SScott Long 	VM_CtHostRead64,
1141a6d35632SScott Long 	VM_CtHostWrite64,
11427cb209f5SScott Long 	VM_DrvErrTblLog,	/* drive error table/log type of command */
11437cb209f5SScott Long 	VM_NameServe64
114435863739SMike Smith } AAC_VMCommand;
114535863739SMike Smith 
114635863739SMike Smith /*
114735863739SMike Smith  * "mountable object"
114835863739SMike Smith  */
114935863739SMike Smith struct aac_mntobj {
115035863739SMike Smith 	u_int32_t			ObjectId;
115135863739SMike Smith 	char				FileSystemName[16];
115235863739SMike Smith 	struct aac_container_creation	CreateInfo;
115335863739SMike Smith 	u_int32_t			Capacity;
1154f30ac74cSScott Long 	u_int32_t			VolType;
1155f30ac74cSScott Long 	u_int32_t			ObjType;
115635863739SMike Smith 	u_int32_t			ContentState;
1157c6eafcf2SScott Long #define FSCS_READONLY		0x0002		/* XXX need more information
1158c6eafcf2SScott Long 						 * than this */
115935863739SMike Smith 	union {
116035863739SMike Smith 		u_int32_t	pad[8];
116135863739SMike Smith 	} ObjExtension;
116235863739SMike Smith 	u_int32_t			AlterEgoId;
1163523da39bSEd Maste 	u_int32_t			CapacityHigh;
11644f492bfaSAlfred Perlstein } __packed;
116535863739SMike Smith 
116635863739SMike Smith struct aac_mntinfo {
1167f30ac74cSScott Long 	u_int32_t		Command;
1168f30ac74cSScott Long 	u_int32_t		MntType;
116935863739SMike Smith 	u_int32_t		MntCount;
11704f492bfaSAlfred Perlstein } __packed;
117135863739SMike Smith 
1172cbfd045bSScott Long struct aac_mntinforesp {
1173f30ac74cSScott Long 	u_int32_t		Status;
1174f30ac74cSScott Long 	u_int32_t		MntType;
117535863739SMike Smith 	u_int32_t		MntRespCount;
117635863739SMike Smith 	struct aac_mntobj	MntTable[1];
11774f492bfaSAlfred Perlstein } __packed;
117835863739SMike Smith 
117935863739SMike Smith /*
118035863739SMike Smith  * Container shutdown command.
118135863739SMike Smith  */
118235863739SMike Smith struct aac_closecommand {
118335863739SMike Smith 	u_int32_t	Command;
118436e0bf6eSScott Long 	u_int32_t	ContainerId;
11854f492bfaSAlfred Perlstein } __packed;
118635863739SMike Smith 
118735863739SMike Smith /*
1188fe3cb0e1SScott Long  * Container Config Command
1189fe3cb0e1SScott Long  */
1190fe3cb0e1SScott Long #define CT_GET_SCSI_METHOD	64
1191fe3cb0e1SScott Long struct aac_ctcfg {
1192f30ac74cSScott Long 	u_int32_t		Command;
1193fe3cb0e1SScott Long 	u_int32_t		cmd;
1194fe3cb0e1SScott Long 	u_int32_t		param;
11954f492bfaSAlfred Perlstein } __packed;
1196fe3cb0e1SScott Long 
1197fe3cb0e1SScott Long struct aac_ctcfg_resp {
1198f30ac74cSScott Long 	u_int32_t		Status;
1199fe3cb0e1SScott Long 	u_int32_t		resp;
1200fe3cb0e1SScott Long 	u_int32_t		param;
12014f492bfaSAlfred Perlstein } __packed;
1202fe3cb0e1SScott Long 
1203fe3cb0e1SScott Long /*
1204fe3cb0e1SScott Long  * 'Ioctl' commads
1205fe3cb0e1SScott Long  */
1206fe3cb0e1SScott Long #define AAC_SCSI_MAX_PORTS	10
1207fe3cb0e1SScott Long #define AAC_BUS_NO_EXIST	0
1208fe3cb0e1SScott Long #define AAC_BUS_VALID		1
1209fe3cb0e1SScott Long #define AAC_BUS_FAULTED		2
1210fe3cb0e1SScott Long #define AAC_BUS_DISABLED	3
1211fe3cb0e1SScott Long #define GetBusInfo		0x9
1212fe3cb0e1SScott Long 
1213fe3cb0e1SScott Long struct aac_getbusinf {
1214fe3cb0e1SScott Long 	u_int32_t		ProbeComplete;
1215fe3cb0e1SScott Long 	u_int32_t		BusCount;
1216fe3cb0e1SScott Long 	u_int32_t		TargetsPerBus;
1217fe3cb0e1SScott Long 	u_int8_t		InitiatorBusId[AAC_SCSI_MAX_PORTS];
1218fe3cb0e1SScott Long 	u_int8_t		BusValid[AAC_SCSI_MAX_PORTS];
12194f492bfaSAlfred Perlstein } __packed;
1220fe3cb0e1SScott Long 
1221fe3cb0e1SScott Long struct aac_vmioctl {
1222f30ac74cSScott Long 	u_int32_t		Command;
1223f30ac74cSScott Long 	u_int32_t		ObjType;
1224fe3cb0e1SScott Long 	u_int32_t		MethId;
1225fe3cb0e1SScott Long 	u_int32_t		ObjId;
1226fe3cb0e1SScott Long 	u_int32_t		IoctlCmd;
1227fe3cb0e1SScott Long 	u_int32_t		IoctlBuf[1];	/* Placeholder? */
12284f492bfaSAlfred Perlstein } __packed;
1229fe3cb0e1SScott Long 
1230fe3cb0e1SScott Long struct aac_vmi_businf_resp {
1231f30ac74cSScott Long 	u_int32_t		Status;
1232f30ac74cSScott Long 	u_int32_t		ObjType;
1233fe3cb0e1SScott Long 	u_int32_t		MethId;
1234fe3cb0e1SScott Long 	u_int32_t		ObjId;
1235fe3cb0e1SScott Long 	u_int32_t		IoctlCmd;
1236fe3cb0e1SScott Long 	struct aac_getbusinf	BusInf;
12374f492bfaSAlfred Perlstein } __packed;
1238fe3cb0e1SScott Long 
12397cb209f5SScott Long #if 0
1240fe3cb0e1SScott Long #define AAC_BTL_TO_HANDLE(b, t, l) \
1241fe3cb0e1SScott Long     (((b & 0x3f) << 7) | ((l & 0x7) << 4) | (t & 0xf))
12427cb209f5SScott Long #else
12437cb209f5SScott Long #define AAC_BTL_TO_HANDLE(b, t, l) \
12447cb209f5SScott Long     ((((u_int32_t)b & 0x0f) << 24) | \
12457cb209f5SScott Long      (((u_int32_t)l & 0xff) << 16) | \
12467cb209f5SScott Long      ((u_int32_t)t & 0xffff))
12477cb209f5SScott Long #endif
1248fe3cb0e1SScott Long #define GetDeviceProbeInfo 0x5
1249fe3cb0e1SScott Long 
1250fe3cb0e1SScott Long struct aac_vmi_devinfo_resp {
1251f30ac74cSScott Long 	u_int32_t		Status;
1252f30ac74cSScott Long 	u_int32_t		ObjType;
1253fe3cb0e1SScott Long 	u_int32_t		MethId;
1254fe3cb0e1SScott Long 	u_int32_t		ObjId;
1255fe3cb0e1SScott Long 	u_int32_t		IoctlCmd;
1256fe3cb0e1SScott Long 	u_int8_t		VendorId[8];
1257fe3cb0e1SScott Long 	u_int8_t		ProductId[16];
1258fe3cb0e1SScott Long 	u_int8_t		ProductRev[4];
1259fe3cb0e1SScott Long 	u_int32_t		Inquiry7;
1260fe3cb0e1SScott Long 	u_int32_t		align1;
1261fe3cb0e1SScott Long 	u_int32_t		Inquiry0;
1262fe3cb0e1SScott Long 	u_int32_t		align2;
1263fe3cb0e1SScott Long 	u_int32_t		Inquiry1;
1264fe3cb0e1SScott Long 	u_int32_t		align3;
1265fe3cb0e1SScott Long 	u_int32_t		reserved[2];
1266fe3cb0e1SScott Long 	u_int8_t		VendorSpecific[20];
1267fe3cb0e1SScott Long 	u_int32_t		Smart:1;
1268fe3cb0e1SScott Long 	u_int32_t		AAC_Managed:1;
1269fe3cb0e1SScott Long 	u_int32_t		align4;
1270fe3cb0e1SScott Long 	u_int32_t		reserved2:6;
1271fe3cb0e1SScott Long 	u_int32_t		Bus;
1272fe3cb0e1SScott Long 	u_int32_t		Target;
1273fe3cb0e1SScott Long 	u_int32_t		Lun;
1274fe3cb0e1SScott Long 	u_int32_t		ultraEnable:1,
1275fe3cb0e1SScott Long 				disconnectEnable:1,
1276fe3cb0e1SScott Long 				fast20EnabledW:1,
1277fe3cb0e1SScott Long 				scamDevice:1,
1278fe3cb0e1SScott Long 				scamTolerant:1,
1279fe3cb0e1SScott Long 				setForSync:1,
1280fe3cb0e1SScott Long 				setForWide:1,
1281fe3cb0e1SScott Long 				syncDevice:1,
1282fe3cb0e1SScott Long 				wideDevice:1,
1283fe3cb0e1SScott Long 				reserved1:7,
1284fe3cb0e1SScott Long 				ScsiRate:8,
1285fe3cb0e1SScott Long 				ScsiOffset:8;
1286fe3cb0e1SScott Long }; /* Do not pack */
1287fe3cb0e1SScott Long 
1288fe3cb0e1SScott Long #define ResetBus 0x16
1289fe3cb0e1SScott Long struct aac_resetbus {
1290fe3cb0e1SScott Long 	u_int32_t		BusNumber;
1291fe3cb0e1SScott Long };
1292fe3cb0e1SScott Long 
1293fe3cb0e1SScott Long /*
129435863739SMike Smith  * Write 'stability' options.
129535863739SMike Smith  */
129635863739SMike Smith typedef enum {
129735863739SMike Smith 	CSTABLE = 1,
129835863739SMike Smith 	CUNSTABLE
129935863739SMike Smith } AAC_CacheLevel;
130035863739SMike Smith 
130135863739SMike Smith /*
130235863739SMike Smith  * Commit level response for a write request.
130335863739SMike Smith  */
130435863739SMike Smith typedef enum {
130535863739SMike Smith 	CMFILE_SYNC_NVRAM = 1,
130635863739SMike Smith 	CMDATA_SYNC_NVRAM,
130735863739SMike Smith 	CMFILE_SYNC,
130835863739SMike Smith 	CMDATA_SYNC,
130935863739SMike Smith 	CMUNSTABLE
131035863739SMike Smith } AAC_CommitLevel;
131135863739SMike Smith 
131235863739SMike Smith /*
131335863739SMike Smith  * Block read/write operations.
131435863739SMike Smith  * These structures are packed into the 'data' area in the FIB.
131535863739SMike Smith  */
131635863739SMike Smith 
131735863739SMike Smith struct aac_blockread {
1318f30ac74cSScott Long 	u_int32_t		Command;	/* not FSACommand! */
131935863739SMike Smith 	u_int32_t		ContainerId;
132035863739SMike Smith 	u_int32_t		BlockNumber;
132135863739SMike Smith 	u_int32_t		ByteCount;
132235863739SMike Smith 	struct aac_sg_table	SgMap;		/* variable size */
13234f492bfaSAlfred Perlstein } __packed;
132435863739SMike Smith 
1325a6d35632SScott Long struct aac_blockread64 {
1326a6d35632SScott Long 	u_int32_t		Command;
1327a6d35632SScott Long 	u_int16_t		ContainerId;
1328a6d35632SScott Long 	u_int16_t		SectorCount;
1329a6d35632SScott Long 	u_int32_t		BlockNumber;
1330a6d35632SScott Long 	u_int16_t		Pad;
1331a6d35632SScott Long 	u_int16_t		Flags;
1332a6d35632SScott Long 	struct aac_sg_table64	SgMap64;
1333a6d35632SScott Long } __packed;
1334a6d35632SScott Long 
133535863739SMike Smith struct aac_blockread_response {
1336f30ac74cSScott Long 	u_int32_t		Status;
133735863739SMike Smith 	u_int32_t		ByteCount;
13384f492bfaSAlfred Perlstein } __packed;
133935863739SMike Smith 
134035863739SMike Smith struct aac_blockwrite {
1341f30ac74cSScott Long 	u_int32_t		Command;	/* not FSACommand! */
134235863739SMike Smith 	u_int32_t		ContainerId;
134335863739SMike Smith 	u_int32_t		BlockNumber;
134435863739SMike Smith 	u_int32_t		ByteCount;
1345f30ac74cSScott Long 	u_int32_t		Stable;
134635863739SMike Smith 	struct aac_sg_table	SgMap;		/* variable size */
13474f492bfaSAlfred Perlstein } __packed;
134835863739SMike Smith 
1349a6d35632SScott Long struct aac_blockwrite64 {
1350a6d35632SScott Long 	u_int32_t		Command;	/* not FSACommand! */
1351a6d35632SScott Long 	u_int16_t		ContainerId;
1352a6d35632SScott Long 	u_int16_t		SectorCount;
1353a6d35632SScott Long 	u_int32_t		BlockNumber;
1354a6d35632SScott Long 	u_int16_t		Pad;
1355a6d35632SScott Long 	u_int16_t		Flags;
1356a6d35632SScott Long 	struct aac_sg_table64	SgMap64;	/* variable size */
1357a6d35632SScott Long } __packed;
1358a6d35632SScott Long 
135935863739SMike Smith struct aac_blockwrite_response {
1360f30ac74cSScott Long 	u_int32_t		Status;
136135863739SMike Smith 	u_int32_t		ByteCount;
1362f30ac74cSScott Long 	u_int32_t		Committed;
13634f492bfaSAlfred Perlstein } __packed;
136435863739SMike Smith 
13657cb209f5SScott Long struct aac_raw_io {
13667cb209f5SScott Long 	u_int64_t		BlockNumber;
13677cb209f5SScott Long 	u_int32_t		ByteCount;
13687cb209f5SScott Long 	u_int16_t		ContainerId;
13697cb209f5SScott Long 	u_int16_t		Flags;				/* 0: W, 1: R */
13707cb209f5SScott Long 	u_int16_t		BpTotal;			/* reserved for FW use */
13717cb209f5SScott Long 	u_int16_t		BpComplete;			/* reserved for FW use */
13727cb209f5SScott Long 	struct aac_sg_tableraw	SgMapRaw;	/* variable size */
13737cb209f5SScott Long } __packed;
13747cb209f5SScott Long 
137535863739SMike Smith /*
137635863739SMike Smith  * Container shutdown command.
137735863739SMike Smith  */
137835863739SMike Smith struct aac_close_command {
1379f30ac74cSScott Long 	u_int32_t		Command;
138035863739SMike Smith 	u_int32_t		ContainerId;
138135863739SMike Smith };
138235863739SMike Smith 
1383914da7d0SScott Long /*
1384fe3cb0e1SScott Long  * SCSI Passthrough structures
1385fe3cb0e1SScott Long  */
1386c89d07b9SEd Maste struct aac_srb {
1387fe3cb0e1SScott Long 	u_int32_t		function;
1388fe3cb0e1SScott Long 	u_int32_t		bus;
1389fe3cb0e1SScott Long 	u_int32_t		target;
1390fe3cb0e1SScott Long 	u_int32_t		lun;
1391fe3cb0e1SScott Long 	u_int32_t		timeout;
1392fe3cb0e1SScott Long 	u_int32_t		flags;
1393fe3cb0e1SScott Long 	u_int32_t		data_len;
1394fe3cb0e1SScott Long 	u_int32_t		retry_limit;
1395fe3cb0e1SScott Long 	u_int32_t		cdb_len;
1396fe3cb0e1SScott Long 	u_int8_t		cdb[16];
13978e7e6335SEd Maste 	struct aac_sg_table	sg_map;
1398fe3cb0e1SScott Long };
1399fe3cb0e1SScott Long 
1400fe3cb0e1SScott Long enum {
1401fe3cb0e1SScott Long 	AAC_SRB_FUNC_EXECUTE_SCSI	= 0x00,
1402fe3cb0e1SScott Long 	AAC_SRB_FUNC_CLAIM_DEVICE,
1403fe3cb0e1SScott Long 	AAC_SRB_FUNC_IO_CONTROL,
1404fe3cb0e1SScott Long 	AAC_SRB_FUNC_RECEIVE_EVENT,
1405fe3cb0e1SScott Long 	AAC_SRB_FUNC_RELEASE_QUEUE,
1406fe3cb0e1SScott Long 	AAC_SRB_FUNC_ATTACH_DEVICE,
1407fe3cb0e1SScott Long 	AAC_SRB_FUNC_RELEASE_DEVICE,
1408fe3cb0e1SScott Long 	AAC_SRB_FUNC_SHUTDOWN,
1409fe3cb0e1SScott Long 	AAC_SRB_FUNC_FLUSH,
1410fe3cb0e1SScott Long 	AAC_SRB_FUNC_ABORT_COMMAND	= 0x10,
1411fe3cb0e1SScott Long 	AAC_SRB_FUNC_RELEASE_RECOVERY,
1412fe3cb0e1SScott Long 	AAC_SRB_FUNC_RESET_BUS,
1413fe3cb0e1SScott Long 	AAC_SRB_FUNC_RESET_DEVICE,
1414fe3cb0e1SScott Long 	AAC_SRB_FUNC_TERMINATE_IO,
1415fe3cb0e1SScott Long 	AAC_SRB_FUNC_FLUSH_QUEUE,
1416fe3cb0e1SScott Long 	AAC_SRB_FUNC_REMOVE_DEVICE,
1417fe3cb0e1SScott Long 	AAC_SRB_FUNC_DOMAIN_VALIDATION
1418fe3cb0e1SScott Long };
1419fe3cb0e1SScott Long 
1420fe3cb0e1SScott Long #define AAC_SRB_FLAGS_NO_DATA_XFER		0x0000
1421fe3cb0e1SScott Long #define	AAC_SRB_FLAGS_DISABLE_DISCONNECT	0x0004
1422fe3cb0e1SScott Long #define	AAC_SRB_FLAGS_DISABLE_SYNC_TRANSFER	0x0008
1423fe3cb0e1SScott Long #define AAC_SRB_FLAGS_BYPASS_FROZEN_QUEUE	0x0010
1424fe3cb0e1SScott Long #define	AAC_SRB_FLAGS_DISABLE_AUTOSENSE		0x0020
1425fe3cb0e1SScott Long #define	AAC_SRB_FLAGS_DATA_IN			0x0040
1426fe3cb0e1SScott Long #define AAC_SRB_FLAGS_DATA_OUT			0x0080
1427fe3cb0e1SScott Long #define	AAC_SRB_FLAGS_UNSPECIFIED_DIRECTION \
1428fe3cb0e1SScott Long 			(AAC_SRB_FLAGS_DATA_IN | AAC_SRB_FLAGS_DATA_OUT)
1429fe3cb0e1SScott Long 
1430fe3cb0e1SScott Long #define AAC_HOST_SENSE_DATA_MAX			30
1431fe3cb0e1SScott Long 
1432fe3cb0e1SScott Long struct aac_srb_response {
1433fe3cb0e1SScott Long 	u_int32_t	fib_status;
1434fe3cb0e1SScott Long 	u_int32_t	srb_status;
1435fe3cb0e1SScott Long 	u_int32_t	scsi_status;
1436fe3cb0e1SScott Long 	u_int32_t	data_len;
1437fe3cb0e1SScott Long 	u_int32_t	sense_len;
1438fe3cb0e1SScott Long 	u_int8_t	sense[AAC_HOST_SENSE_DATA_MAX];
1439fe3cb0e1SScott Long };
1440fe3cb0e1SScott Long 
1441a441b3fcSScott Long /*
1442a441b3fcSScott Long  * Status codes for SCSI passthrough commands.  Since they are based on ASPI,
1443a441b3fcSScott Long  * they also exactly match CAM status codes in both enumeration and meaning.
1444a441b3fcSScott Long  * They seem to also be used as status codes for synchronous FIBs.
1445a441b3fcSScott Long  */
1446fe3cb0e1SScott Long enum {
1447fe3cb0e1SScott Long 	AAC_SRB_STS_PENDING			= 0x00,
1448fe3cb0e1SScott Long 	AAC_SRB_STS_SUCCESS,
1449fe3cb0e1SScott Long 	AAC_SRB_STS_ABORTED,
1450fe3cb0e1SScott Long 	AAC_SRB_STS_ABORT_FAILED,
1451fe3cb0e1SScott Long 	AAC_SRB_STS_ERROR,
1452fe3cb0e1SScott Long 	AAC_SRB_STS_BUSY,
1453fe3cb0e1SScott Long 	AAC_SRB_STS_INVALID_REQUEST,
1454fe3cb0e1SScott Long 	AAC_SRB_STS_INVALID_PATH_ID,
1455fe3cb0e1SScott Long 	AAC_SRB_STS_NO_DEVICE,
1456fe3cb0e1SScott Long 	AAC_SRB_STS_TIMEOUT,
1457fe3cb0e1SScott Long 	AAC_SRB_STS_SELECTION_TIMEOUT,
1458fe3cb0e1SScott Long 	AAC_SRB_STS_COMMAND_TIMEOUT,
1459fe3cb0e1SScott Long 	AAC_SRB_STS_MESSAGE_REJECTED		= 0x0D,
1460fe3cb0e1SScott Long 	AAC_SRB_STS_BUS_RESET,
1461fe3cb0e1SScott Long 	AAC_SRB_STS_PARITY_ERROR,
1462fe3cb0e1SScott Long 	AAC_SRB_STS_REQUEST_SENSE_FAILED,
1463fe3cb0e1SScott Long 	AAC_SRB_STS_NO_HBA,
1464fe3cb0e1SScott Long 	AAC_SRB_STS_DATA_OVERRUN,
1465fe3cb0e1SScott Long 	AAC_SRB_STS_UNEXPECTED_BUS_FREE,
1466fe3cb0e1SScott Long 	AAC_SRB_STS_PHASE_SEQUENCE_FAILURE,
1467fe3cb0e1SScott Long 	AAC_SRB_STS_BAD_SRB_BLOCK_LENGTH,
1468fe3cb0e1SScott Long 	AAC_SRB_STS_REQUEST_FLUSHED,
1469fe3cb0e1SScott Long 	AAC_SRB_STS_INVALID_LUN			= 0x20,
1470fe3cb0e1SScott Long 	AAC_SRB_STS_INVALID_TARGET_ID,
1471fe3cb0e1SScott Long 	AAC_SRB_STS_BAD_FUNCTION,
1472fe3cb0e1SScott Long 	AAC_SRB_STS_ERROR_RECOVERY
1473fe3cb0e1SScott Long };
1474fe3cb0e1SScott Long 
1475fe3cb0e1SScott Long /*
147635863739SMike Smith  * Register definitions for the Adaptec AAC-364 'Jalapeno I/II' adapters, based
147735863739SMike Smith  * on the SA110 'StrongArm'.
147835863739SMike Smith  */
147935863739SMike Smith 
148035863739SMike Smith #define AAC_SA_DOORBELL0_CLEAR		0x98	/* doorbell 0 (adapter->host) */
148135863739SMike Smith #define AAC_SA_DOORBELL0_SET		0x9c
148235863739SMike Smith #define AAC_SA_DOORBELL0		0x9c
148335863739SMike Smith #define AAC_SA_MASK0_CLEAR		0xa0
148435863739SMike Smith #define AAC_SA_MASK0_SET		0xa4
148535863739SMike Smith 
148635863739SMike Smith #define AAC_SA_DOORBELL1_CLEAR		0x9a	/* doorbell 1 (host->adapter) */
148735863739SMike Smith #define AAC_SA_DOORBELL1_SET		0x9e
1488b3457b51SScott Long #define AAC_SA_DOORBELL1		0x9e
148935863739SMike Smith #define AAC_SA_MASK1_CLEAR		0xa2
149035863739SMike Smith #define AAC_SA_MASK1_SET		0xa6
149135863739SMike Smith 
149235863739SMike Smith #define AAC_SA_MAILBOX			0xa8	/* mailbox (20 bytes) */
149335863739SMike Smith #define AAC_SA_FWSTATUS			0xc4
149435863739SMike Smith 
1495914da7d0SScott Long /*
149635863739SMike Smith  * Register definitions for the Adaptec 'Pablano' adapters, based on the i960Rx,
149735863739SMike Smith  * and other related adapters.
149835863739SMike Smith  */
149935863739SMike Smith 
15008d5b55c3SEd Maste #define AAC_RX_OMR0		0x18	/* outbound message register 0 */
15018d5b55c3SEd Maste #define AAC_RX_OMR1		0x1c	/* outbound message register 1 */
150235863739SMike Smith #define AAC_RX_IDBR		0x20	/* inbound doorbell register */
150384ad14e4SMike Smith #define AAC_RX_IISR		0x24	/* inbound interrupt status register */
150484ad14e4SMike Smith #define AAC_RX_IIMR		0x28	/* inbound interrupt mask register */
150535863739SMike Smith #define AAC_RX_ODBR		0x2c	/* outbound doorbell register */
15060791663fSMike Smith #define AAC_RX_OISR		0x30	/* outbound interrupt status register */
15070791663fSMike Smith #define AAC_RX_OIMR		0x34	/* outbound interrupt mask register */
15087cb209f5SScott Long #define AAC_RX_IQUE		0x40	/* inbound queue */
15097cb209f5SScott Long #define AAC_RX_OQUE		0x44	/* outbound queue */
151035863739SMike Smith 
151135863739SMike Smith #define AAC_RX_MAILBOX		0x50	/* mailbox (20 bytes) */
151235863739SMike Smith #define AAC_RX_FWSTATUS		0x6c
151335863739SMike Smith 
1514914da7d0SScott Long /*
15154afedc31SScott Long  * Register definitions for the Adaptec 'Rocket' RAID-On-Chip adapters.
15164afedc31SScott Long  * Unsurprisingly, it's quite similar to the i960!
15174afedc31SScott Long  */
15184afedc31SScott Long 
15198d5b55c3SEd Maste #define AAC_RKT_OMR0		0x18	/* outbound message register 0 */
15208d5b55c3SEd Maste #define AAC_RKT_OMR1		0x1c	/* outbound message register 1 */
15214afedc31SScott Long #define AAC_RKT_IDBR		0x20	/* inbound doorbell register */
15224afedc31SScott Long #define AAC_RKT_IISR		0x24	/* inbound interrupt status register */
15234afedc31SScott Long #define AAC_RKT_IIMR		0x28	/* inbound interrupt mask register */
15244afedc31SScott Long #define AAC_RKT_ODBR		0x2c	/* outbound doorbell register */
15254afedc31SScott Long #define AAC_RKT_OISR		0x30	/* outbound interrupt status register */
15264afedc31SScott Long #define AAC_RKT_OIMR		0x34	/* outbound interrupt mask register */
15277cb209f5SScott Long #define AAC_RKT_IQUE		0x40	/* inbound queue */
15287cb209f5SScott Long #define AAC_RKT_OQUE		0x44	/* outbound queue */
15294afedc31SScott Long 
15304afedc31SScott Long #define AAC_RKT_MAILBOX		0x1000	/* mailbox */
15314afedc31SScott Long #define AAC_RKT_FWSTATUS	0x101c	/* Firmware Status (mailbox 7) */
15324afedc31SScott Long 
15334afedc31SScott Long /*
153435863739SMike Smith  * Common bit definitions for the doorbell registers.
153535863739SMike Smith  */
153635863739SMike Smith 
153735863739SMike Smith /*
153835863739SMike Smith  * Status bits in the doorbell registers.
153935863739SMike Smith  */
154035863739SMike Smith #define AAC_DB_SYNC_COMMAND	(1<<0)	/* send/completed synchronous FIB */
154135863739SMike Smith #define AAC_DB_COMMAND_READY	(1<<1)	/* posted one or more commands */
154235863739SMike Smith #define AAC_DB_RESPONSE_READY	(1<<2)	/* one or more commands complete */
154335863739SMike Smith #define AAC_DB_COMMAND_NOT_FULL	(1<<3)	/* command queue not full */
154435863739SMike Smith #define AAC_DB_RESPONSE_NOT_FULL (1<<4)	/* response queue not full */
154535863739SMike Smith 
154635863739SMike Smith /*
154735863739SMike Smith  * The adapter can request the host print a message by setting the
154835863739SMike Smith  * DB_PRINTF flag in DOORBELL0.  The driver responds by collecting the
154935863739SMike Smith  * message from the printf buffer, clearing the DB_PRINTF flag in
155035863739SMike Smith  * DOORBELL0 and setting it in DOORBELL1.
155135863739SMike Smith  * (ODBR and IDBR respectively for the i960Rx adapters)
155235863739SMike Smith  */
155335863739SMike Smith #define AAC_DB_PRINTF		(1<<5)	/* adapter requests host printf */
1554b3457b51SScott Long #define AAC_PRINTF_DONE		(1<<5)	/* Host completed printf processing */
155535863739SMike Smith 
155635863739SMike Smith /*
1557c6eafcf2SScott Long  * Mask containing the interrupt bits we care about.  We don't anticipate (or
1558c6eafcf2SScott Long  * want) interrupts not in this mask.
155935863739SMike Smith  */
1560914da7d0SScott Long #define AAC_DB_INTERRUPTS	(AAC_DB_COMMAND_READY  |	\
1561914da7d0SScott Long 				 AAC_DB_RESPONSE_READY |	\
1562914da7d0SScott Long 				 AAC_DB_PRINTF)
15637cb209f5SScott Long #define AAC_DB_INT_NEW_COMM		0x08
1564