xref: /freebsd/sys/dev/aacraid/aacraid_reg.h (revision 95ee2897)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2000 Michael Smith
5  * Copyright (c) 2000-2001 Scott Long
6  * Copyright (c) 2000 BSDi
7  * Copyright (c) 2001-2010 Adaptec, Inc.
8  * Copyright (c) 2010-2012 PMC-Sierra, Inc.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  */
32 
33 /*
34  * Data structures defining the interface between the driver and the Adaptec
35  * 'FSA' adapters.  Note that many field names and comments here are taken
36  * verbatim from the Adaptec driver source in order to make comparing the
37  * two slightly easier.
38  */
39 
40 /*
41  * Misc. magic numbers.
42  */
43 #define AAC_MAX_CONTAINERS	240
44 #define AAC_BLOCK_SIZE		512
45 
46 /*
47  * Communications interface.
48  *
49  * Where datastructure layouts are closely parallel to the Adaptec sample code,
50  * retain their naming conventions (for now) to aid in cross-referencing.
51  */
52 
53 /* transport FIB header (PMC) */
54 struct aac_fib_xporthdr {
55 	u_int64_t	HostAddress;	/* FIB host address w/o xport header */
56 	u_int32_t	Size;			/* FIB size excluding xport header */
57 	u_int32_t	Handle;			/* driver handle to reference the FIB */
58 	u_int64_t	Reserved[2];
59 } __packed;
60 
61 /*
62  * List structure used to chain FIBs (used by the adapter - we hang FIBs off
63  * our private command structure and don't touch these)
64  */
65 struct aac_fib_list_entry {
66 	u_int32_t	Flink;
67 	u_int32_t	Blink;
68 } __packed;
69 
70 /*
71  * FIB (FSA Interface Block?); this is the datastructure passed between the host
72  * and adapter.
73  */
74 struct aac_fib_header {
75 	u_int32_t		XferState;
76 	u_int16_t		Command;
77 	u_int8_t		StructType;
78 	u_int8_t		Unused;
79 	u_int16_t		Size;
80 	u_int16_t		SenderSize;
81 	u_int32_t		SenderFibAddress;
82 	union {
83 		u_int32_t	ReceiverFibAddress;
84 		u_int32_t	SenderFibAddressHigh;
85 		u_int32_t	TimeStamp;
86 	} u;
87 	u_int32_t		Handle;
88 	u_int32_t		Previous;
89 	u_int32_t		Next;
90 } __packed;
91 
92 #define AAC_FIB_DATASIZE	(512 - sizeof(struct aac_fib_header))
93 
94 struct aac_fib {
95 	struct aac_fib_header	Header;
96 	u_int8_t	data[AAC_FIB_DATASIZE];
97 } __packed;
98 
99 /*
100  * FIB commands
101  */
102 typedef enum {
103 	TestCommandResponse =		1,
104 	TestAdapterCommand =		2,
105 
106 	/* lowlevel and comm commands */
107 	LastTestCommand =		100,
108 	ReinitHostNormCommandQueue =	101,
109 	ReinitHostHighCommandQueue =	102,
110 	ReinitHostHighRespQueue =	103,
111 	ReinitHostNormRespQueue =	104,
112 	ReinitAdapNormCommandQueue =	105,
113 	ReinitAdapHighCommandQueue =	107,
114 	ReinitAdapHighRespQueue =	108,
115 	ReinitAdapNormRespQueue =	109,
116 	InterfaceShutdown =		110,
117 	DmaCommandFib =			120,
118 	StartProfile =			121,
119 	TermProfile =			122,
120 	SpeedTest =			123,
121 	TakeABreakPt =			124,
122 	RequestPerfData =		125,
123 	SetInterruptDefTimer=		126,
124 	SetInterruptDefCount=		127,
125 	GetInterruptDefStatus=		128,
126 	LastCommCommand =		129,
127 
128 	/* filesystem commands */
129 	NuFileSystem =			300,
130 	UFS =				301,
131 	HostFileSystem =		302,
132 	LastFileSystemCommand =		303,
133 
134 	/* Container Commands */
135 	ContainerCommand =		500,
136 	ContainerCommand64 =		501,
137 	RawIo = 			502,
138 	RawIo2 = 			503,
139 
140 	/* Cluster Commands */
141 	ClusterCommand =		550,
142 
143 	/* Scsi Port commands (scsi passthrough) */
144 	ScsiPortCommand =		600,
145 	ScsiPortCommandU64 =		601,
146 	SataPortCommandU64 =		602,
147 	SasSmpPassThrough =		603,
148 	SasRequestPhyInfo =		612,
149 
150 	/* misc house keeping and generic adapter initiated commands */
151 	AifRequest =			700,
152 	CheckRevision =			701,
153 	FsaHostShutdown =		702,
154 	RequestAdapterInfo =		703,
155 	IsAdapterPaused =		704,
156 	SendHostTime =			705,
157 	RequestSupplementAdapterInfo =	706,	/* Supp. Info for set in UCC
158 						 * use only if supported
159 						 * (RequestAdapterInfo first) */
160 	LastMiscCommand =		707,
161 
162 	OnLineDiagnostic =		800,
163 	FduAdapterTest =		801,
164 	RequestCompatibilityId =	802,
165 	AdapterEnvironmentInfo =	803,	/* temp. sensors */
166 	NvsramEventLog =		900,
167 	ResetNvsramEventLogPointers =	901,
168 	EnableEventLog =		902,
169 	DisableEventLog =		903,
170 	EncryptedKeyTransportFIB=	904,
171 	KeyableFeaturesFIB=		905
172 } AAC_FibCommands;
173 
174 /*
175  * FIB types
176  */
177 #define AAC_FIBTYPE_TFIB		1
178 #define AAC_FIBTYPE_TQE			2
179 #define AAC_FIBTYPE_TCTPERF		3
180 #define AAC_FIBTYPE_TFIB2		4
181 #define AAC_FIBTYPE_TFIB2_64	5
182 
183 /*
184  * FIB transfer state
185  */
186 #define AAC_FIBSTATE_HOSTOWNED		(1<<0)	/* owned by the host */
187 #define AAC_FIBSTATE_ADAPTEROWNED	(1<<1)	/* owned by the adapter */
188 #define AAC_FIBSTATE_INITIALISED	(1<<2)	/* initialised */
189 #define AAC_FIBSTATE_EMPTY		(1<<3)	/* empty */
190 #define AAC_FIBSTATE_FROMPOOL		(1<<4)	/* allocated from pool */
191 #define AAC_FIBSTATE_FROMHOST		(1<<5)	/* sent from the host */
192 #define AAC_FIBSTATE_FROMADAP		(1<<6)	/* sent from the adapter */
193 #define AAC_FIBSTATE_REXPECTED		(1<<7)	/* response is expected */
194 #define AAC_FIBSTATE_RNOTEXPECTED	(1<<8)	/* response is not expected */
195 #define AAC_FIBSTATE_DONEADAP		(1<<9)	/* processed by the adapter */
196 #define AAC_FIBSTATE_DONEHOST		(1<<10)	/* processed by the host */
197 #define AAC_FIBSTATE_HIGH		(1<<11)	/* high priority */
198 #define AAC_FIBSTATE_NORM		(1<<12)	/* normal priority */
199 #define AAC_FIBSTATE_ASYNC		(1<<13)
200 #define AAC_FIBSTATE_ASYNCIO		(1<<13)	/* to be removed */
201 #define AAC_FIBSTATE_PAGEFILEIO		(1<<14)	/* to be removed */
202 #define AAC_FIBSTATE_SHUTDOWN		(1<<15)
203 #define AAC_FIBSTATE_LAZYWRITE		(1<<16)	/* to be removed */
204 #define AAC_FIBSTATE_ADAPMICROFIB	(1<<17)
205 #define	AAC_FIBSTATE_BIOSFIB		(1<<18)
206 #define AAC_FIBSTATE_FAST_RESPONSE	(1<<19)	/* fast response capable */
207 #define AAC_FIBSTATE_APIFIB		(1<<20)
208 #define AAC_FIBSTATE_NOMOREAIF		(1<<21)
209 
210 /*
211  * FIB error values
212  */
213 #define AAC_ERROR_NORMAL			0x00
214 #define AAC_ERROR_PENDING			0x01
215 #define AAC_ERROR_FATAL				0x02
216 #define AAC_ERROR_INVALID_QUEUE			0x03
217 #define AAC_ERROR_NOENTRIES			0x04
218 #define AAC_ERROR_SENDFAILED			0x05
219 #define AAC_ERROR_INVALID_QUEUE_PRIORITY	0x06
220 #define AAC_ERROR_FIB_ALLOCATION_FAILED		0x07
221 #define AAC_ERROR_FIB_DEALLOCATION_FAILED	0x08
222 
223 /*
224  * Adapter Init Structure: this is passed to the adapter with the
225  * AAC_MONKER_INITSTRUCT command to point it at our control structures.
226  */
227 struct aac_adapter_init {
228 	u_int32_t	InitStructRevision;
229 #define AAC_INIT_STRUCT_REVISION		3
230 #define AAC_INIT_STRUCT_REVISION_4		4
231 #define AAC_INIT_STRUCT_REVISION_6		6
232 #define AAC_INIT_STRUCT_REVISION_7		7
233 	u_int32_t	NoOfMSIXVectors;
234 	u_int32_t	FilesystemRevision;
235 	u_int32_t	CommHeaderAddress;
236 	u_int32_t	FastIoCommAreaAddress;
237 	u_int32_t	AdapterFibsPhysicalAddress;
238 	u_int32_t 	AdapterFibsVirtualAddress;
239 	u_int32_t	AdapterFibsSize;
240 	u_int32_t	AdapterFibAlign;
241 	u_int32_t	PrintfBufferAddress;
242 	u_int32_t	PrintfBufferSize;
243 #define	AAC_PAGE_SIZE				4096
244 	u_int32_t	HostPhysMemPages;
245 	u_int32_t	HostElapsedSeconds;
246 	/* ADAPTER_INIT_STRUCT_REVISION_4 begins here */
247 	u_int32_t	InitFlags;			/* flags for supported features */
248 #define AAC_INITFLAGS_NEW_COMM_SUPPORTED	1
249 #define AAC_INITFLAGS_DRIVER_USES_UTC_TIME	0x10
250 #define AAC_INITFLAGS_DRIVER_SUPPORTS_PM	0x20
251 #define AAC_INITFLAGS_NEW_COMM_TYPE1_SUPPORTED	0x40
252 #define AAC_INITFLAGS_FAST_JBOD_SUPPORTED	0x80
253 #define AAC_INITFLAGS_NEW_COMM_TYPE2_SUPPORTED	0x100
254 	u_int32_t	MaxIoCommands;		/* max outstanding commands */
255 	u_int32_t	MaxIoSize;			/* largest I/O command */
256 	u_int32_t	MaxFibSize;			/* largest FIB to adapter */
257 	/* ADAPTER_INIT_STRUCT_REVISION_5 begins here */
258 	u_int32_t	MaxNumAif;	        /* max number of aif */
259 	/* ADAPTER_INIT_STRUCT_REVISION_6 begins here */
260 	u_int32_t	HostRRQ_AddrLow;
261 	u_int32_t	HostRRQ_AddrHigh;	/* Host RRQ (response queue) for SRC */
262 } __packed;
263 
264 /*
265  * Shared data types
266  */
267 /*
268  * Container types
269  */
270 typedef enum {
271 	CT_NONE = 0,
272 	CT_VOLUME,
273 	CT_MIRROR,
274 	CT_STRIPE,
275 	CT_RAID5,
276 	CT_SSRW,
277 	CT_SSRO,
278 	CT_MORPH,
279 	CT_PASSTHRU,
280 	CT_RAID4,
281 	CT_RAID10,                  /* stripe of mirror */
282 	CT_RAID00,                  /* stripe of stripe */
283 	CT_VOLUME_OF_MIRRORS,       /* volume of mirror */
284 	CT_PSEUDO_RAID3,            /* really raid4 */
285 	CT_RAID50,		    /* stripe of raid5 */
286 	CT_RAID5D,		    /* raid5 distributed hot-sparing */
287 	CT_RAID5D0,
288 	CT_RAID1E,		    /* extended raid1 mirroring */
289 	CT_RAID6,
290 	CT_RAID60,
291 } AAC_FSAVolType;
292 
293 /*
294  * Host-addressable object types
295  */
296 typedef enum {
297 	FT_REG = 1,     /* regular file */
298 	FT_DIR,         /* directory */
299 	FT_BLK,         /* "block" device - reserved */
300 	FT_CHR,         /* "character special" device - reserved */
301 	FT_LNK,         /* symbolic link */
302 	FT_SOCK,        /* socket */
303 	FT_FIFO,        /* fifo */
304 	FT_FILESYS,     /* ADAPTEC's "FSA"(tm) filesystem */
305 	FT_DRIVE,       /* physical disk - addressable in scsi by b/t/l */
306 	FT_SLICE,       /* virtual disk - raw volume - slice */
307 	FT_PARTITION,   /* FSA partition - carved out of a slice - building
308 			 * block for containers */
309 	FT_VOLUME,      /* Container - Volume Set */
310 	FT_STRIPE,      /* Container - Stripe Set */
311 	FT_MIRROR,      /* Container - Mirror Set */
312 	FT_RAID5,       /* Container - Raid 5 Set */
313 	FT_DATABASE     /* Storage object with "foreign" content manager */
314 } AAC_FType;
315 
316 /*
317  * Host-side scatter/gather list for 32-bit commands.
318  */
319 struct aac_sg_entry {
320 	u_int32_t	SgAddress;
321 	u_int32_t	SgByteCount;
322 } __packed;
323 
324 struct aac_sg_entry64 {
325 	u_int64_t	SgAddress;
326 	u_int32_t	SgByteCount;
327 } __packed;
328 
329 struct aac_sg_entryraw {
330 	u_int32_t	Next;		/* reserved for FW use */
331 	u_int32_t	Prev;		/* reserved for FW use */
332 	u_int64_t	SgAddress;
333 	u_int32_t	SgByteCount;
334 	u_int32_t	Flags;		/* reserved for FW use */
335 } __packed;
336 
337 struct aac_sg_table {
338 	u_int32_t		SgCount;
339 	struct aac_sg_entry	SgEntry[0];
340 } __packed;
341 
342 /*
343  * Host-side scatter/gather list for 64-bit commands.
344  */
345 struct aac_sg_table64 {
346 	u_int32_t	SgCount;
347 	struct aac_sg_entry64	SgEntry64[0];
348 } __packed;
349 
350 /*
351  * s/g list for raw commands
352  */
353 struct aac_sg_tableraw {
354 	u_int32_t	SgCount;
355 	struct aac_sg_entryraw	SgEntryRaw[0];
356 } __packed;
357 
358 /*
359  * new ieee1212 s/g element
360  */
361 struct aac_sge_ieee1212 {
362 	u_int32_t	addrLow;
363 	u_int32_t	addrHigh;
364 	u_int32_t	length;
365 	u_int32_t	flags;	/* always 0 from host side */
366 } __packed;
367 
368 /*
369  * Container creation data
370  */
371 struct aac_container_creation {
372 	u_int8_t	ViaBuildNumber;
373 	u_int8_t	MicroSecond;
374 	u_int8_t	Via;		/* 1 = FSU, 2 = API, etc. */
375 	u_int8_t	YearsSince1900;
376 	u_int32_t	Month:4;	/* 1-12 */
377 	u_int32_t	Day:6;		/* 1-32 */
378 	u_int32_t	Hour:6;		/* 0-23 */
379 	u_int32_t	Minute:6;	/* 0-59 */
380 	u_int32_t	Second:6;	/* 0-59 */
381 	u_int64_t	ViaAdapterSerialNumber;
382 } __packed;
383 
384 /*
385  * Revision number handling
386  */
387 
388 typedef enum {
389 	RevApplication = 1,
390 	RevDkiCli,
391 	RevNetService,
392 	RevApi,
393 	RevFileSysDriver,
394 	RevMiniportDriver,
395 	RevAdapterSW,
396 	RevMonitor,
397 	RevRemoteApi
398 } RevComponent;
399 
400 struct FsaRevision {
401 	union {
402 		struct {
403 			u_int8_t	dash;
404 			u_int8_t	type;
405 			u_int8_t	minor;
406 			u_int8_t	major;
407 		} comp;
408 		u_int32_t	ul;
409 	} external;
410 	u_int32_t	buildNumber;
411 }  __packed;
412 
413 /*
414  * Adapter Information
415  */
416 
417 typedef enum {
418 	CPU_NTSIM = 1,
419 	CPU_I960,
420 	CPU_ARM,
421 	CPU_SPARC,
422 	CPU_POWERPC,
423 	CPU_ALPHA,
424 	CPU_P7,
425 	CPU_I960_RX,
426 	CPU_MIPS,
427 	CPU_XSCALE,
428 	CPU__last
429 } AAC_CpuType;
430 
431 typedef enum {
432 	CPUI960_JX = 1,
433 	CPUI960_CX,
434 	CPUI960_HX,
435 	CPUI960_RX,
436 	CPUARM_SA110,
437 	CPUARM_xxx,
438 	CPUPPC_603e,
439 	CPUPPC_xxx,
440 	CPUI960_80303,
441 	CPU_XSCALE_80321,
442 	CPU_MIPS_4KC,
443 	CPU_MIPS_5KC,
444 	CPUSUBTYPE__last
445 } AAC_CpuSubType;
446 
447 typedef enum {
448 	PLAT_NTSIM = 1,
449 	PLAT_V3ADU,
450 	PLAT_CYCLONE,
451 	PLAT_CYCLONE_HD,
452 	PLAT_BATBOARD,
453 	PLAT_BATBOARD_HD,
454 	PLAT_YOLO,
455 	PLAT_COBRA,
456 	PLAT_ANAHEIM,
457 	PLAT_JALAPENO,
458 	PLAT_QUEENS,
459 	PLAT_JALAPENO_DELL,
460 	PLAT_POBLANO,
461 	PLAT_POBLANO_OPAL,
462 	PLAT_POBLANO_SL0,
463 	PLAT_POBLANO_SL1,
464 	PLAT_POBLANO_SL2,
465 	PLAT_POBLANO_XXX,
466 	PLAT_JALAPENO_P2,
467 	PLAT_HABANERO,
468 	PLAT_VULCAN,
469 	PLAT_CRUSADER,
470 	PLAT_LANCER,
471 	PLAT_HARRIER,
472 	PLAT_TERMINATOR,
473 	PLAT_SKYHAWK,
474 	PLAT_CORSAIR,
475 	PLAT_JAGUAR,
476 	PLAT_SATAHAWK,
477 	PLAT_SATANATOR,
478 	PLAT_PROWLER,
479 	PLAT_BLACKBIRD,
480 	PLAT_SABREEXPRESS,
481 	PLAT_INTRUDER,
482 	PLAT__last
483 } AAC_Platform;
484 
485 typedef enum {
486 	OEM_FLAVOR_ADAPTEC = 1,
487 	OEM_FLAVOR_DELL,
488 	OEM_FLAVOR_HP,
489 	OEM_FLAVOR_IBM,
490 	OEM_FLAVOR_CPQ,
491 	OEM_FLAVOR_FSC,
492 	OEM_FLAVOR_DWS,
493 	OEM_FLAVOR_BRAND_Z,
494 	OEM_FLAVOR_LEGEND,
495 	OEM_FLAVOR_HITACHI,
496 	OEM_FLAVOR_ESG,
497 	OEM_FLAVOR_ICP,
498 	OEM_FLAVOR_SCM,
499 	OEM_FLAVOR__last
500 } AAC_OemFlavor;
501 
502 /*
503  * XXX the aac-2622 with no battery present reports PLATFORM_BAT_OPT_PRESENT
504  */
505 typedef enum
506 {
507 	PLATFORM_BAT_REQ_PRESENT = 1,	/* BATTERY REQUIRED AND PRESENT */
508 	PLATFORM_BAT_REQ_NOTPRESENT,	/* BATTERY REQUIRED AND NOT PRESENT */
509 	PLATFORM_BAT_OPT_PRESENT,	/* BATTERY OPTIONAL AND PRESENT */
510 	PLATFORM_BAT_OPT_NOTPRESENT,	/* BATTERY OPTIONAL AND NOT PRESENT */
511 	PLATFORM_BAT_NOT_SUPPORTED	/* BATTERY NOT SUPPORTED */
512 } AAC_BatteryPlatform;
513 
514 /*
515  * options supported by this board
516  * there has to be a one to one mapping of these defines and the ones in
517  * fsaapi.h, search for FSA_SUPPORT_SNAPSHOT
518  */
519 #define AAC_SUPPORTED_SNAPSHOT		0x01
520 #define AAC_SUPPORTED_CLUSTERS		0x02
521 #define AAC_SUPPORTED_WRITE_CACHE	0x04
522 #define AAC_SUPPORTED_64BIT_DATA	0x08
523 #define AAC_SUPPORTED_HOST_TIME_FIB	0x10
524 #define AAC_SUPPORTED_RAID50		0x20
525 #define AAC_SUPPORTED_4GB_WINDOW	0x40
526 #define AAC_SUPPORTED_SCSI_UPGRADEABLE	0x80
527 #define AAC_SUPPORTED_SOFT_ERR_REPORT	0x100
528 #define AAC_SUPPORTED_NOT_RECONDITION	0x200
529 #define AAC_SUPPORTED_SGMAP_HOST64	0x400
530 #define AAC_SUPPORTED_ALARM		0x800
531 #define AAC_SUPPORTED_NONDASD		0x1000
532 #define AAC_SUPPORTED_SCSI_MANAGED	0x2000
533 #define AAC_SUPPORTED_RAID_SCSI_MODE	0x4000
534 #define AAC_SUPPORTED_SUPPLEMENT_ADAPTER_INFO	0x10000
535 #define AAC_SUPPORTED_NEW_COMM		0x20000
536 #define AAC_SUPPORTED_64BIT_ARRAYSIZE	0x40000
537 #define AAC_SUPPORTED_HEAT_SENSOR	0x80000
538 #define AAC_SUPPORTED_NEW_COMM_TYPE1	0x10000000  /* Tupelo new comm */
539 #define AAC_SUPPORTED_NEW_COMM_TYPE2	0x20000000  /* Denali new comm */
540 #define AAC_SUPPORTED_NEW_COMM_TYPE3	0x40000000  /* Series 8 new comm */
541 #define AAC_SUPPORTED_NEW_COMM_TYPE4	0x80000000  /* Series 9 new comm */
542 
543 /*
544  * Structure used to respond to a RequestAdapterInfo fib.
545  */
546 struct aac_adapter_info {
547 	AAC_Platform		PlatformBase;    /* adapter type */
548 	AAC_CpuType		CpuArchitecture; /* adapter CPU type */
549 	AAC_CpuSubType		CpuVariant;      /* adapter CPU subtype */
550 	u_int32_t		ClockSpeed;      /* adapter CPU clockspeed */
551 	u_int32_t		ExecutionMem;    /* adapter Execution Memory
552 						  * size */
553 	u_int32_t		BufferMem;       /* adapter Data Memory */
554 	u_int32_t		TotalMem;        /* adapter Total Memory */
555 	struct FsaRevision	KernelRevision;  /* adapter Kernel Software
556 						  * Revision */
557 	struct FsaRevision	MonitorRevision; /* adapter Monitor/Diagnostic
558 						  * Software Revision */
559 	struct FsaRevision	HardwareRevision;/* TBD */
560 	struct FsaRevision	BIOSRevision;    /* adapter BIOS Revision */
561 	u_int32_t		ClusteringEnabled;
562 	u_int32_t		ClusterChannelMask;
563 	u_int64_t		SerialNumber;
564 	AAC_BatteryPlatform	batteryPlatform;
565 	u_int32_t		SupportedOptions; /* supported features of this
566 						   * controller */
567 	AAC_OemFlavor	OemVariant;
568 } __packed;
569 
570 /*
571  * More options from supplement info - SupportedOptions2
572  */
573 #define AAC_SUPPORTED_MU_RESET			0x01
574 #define AAC_SUPPORTED_IGNORE_RESET		0x02
575 #define AAC_SUPPORTED_POWER_MANAGEMENT		0x04
576 #define AAC_SUPPORTED_ARCIO_PHYDEV		0x08
577 #define AAC_SUPPORTED_DOORBELL_RESET		0x4000
578 #define AAC_SUPPORTED_VARIABLE_BLOCK_SIZE	0x40000	/* 4KB sector size */
579 
580 /*
581  * FeatureBits of RequestSupplementAdapterInfo used in the driver
582  */
583 #define AAC_SUPPL_SUPPORTED_JBOD	0x08000000
584 
585 /*
586  * Structure used to respond to a RequestSupplementAdapterInfo fib.
587  */
588 struct vpd_info {
589 	u_int8_t		AssemblyPn[8];
590 	u_int8_t		FruPn[8];
591 	u_int8_t		BatteryFruPn[8];
592 	u_int8_t		EcVersionString[8];
593 	u_int8_t		Tsid[12];
594 } __packed;
595 
596 #define	MFG_PCBA_SERIAL_NUMBER_WIDTH	12
597 #define	MFG_WWN_WIDTH			8
598 
599 struct aac_supplement_adapter_info {
600 	/* The assigned Adapter Type Text, extra byte for null termination */
601 	int8_t		AdapterTypeText[17+1];
602 	/* Pad for the text above */
603 	int8_t		Pad[2];
604 	/* Size in bytes of the memory that is flashed */
605 	u_int32_t	FlashMemoryByteSize;
606 	/* The assigned IMAGEID_xxx for this adapter */
607 	u_int32_t	FlashImageId;
608 	/*
609 	 * The maximum number of Phys available on a SATA/SAS
610 	 * Controller, 0 otherwise
611 	 */
612 	u_int32_t	MaxNumberPorts;
613 	/* Version of expansion area */
614 	u_int32_t	Version;
615 	u_int32_t	FeatureBits;
616 	u_int8_t		SlotNumber;
617 	u_int8_t		ReservedPad0[3];
618 	u_int8_t		BuildDate[12];
619 	/* The current number of Ports on a SAS controller, 0 otherwise */
620 	u_int32_t	CurrentNumberPorts;
621 
622 	struct vpd_info VpdInfo;
623 
624 	/* Firmware Revision (Vmaj.min-dash.) */
625 	struct FsaRevision	FlashFirmwareRevision;
626 	u_int32_t	RaidTypeMorphOptions;
627 	/* Firmware's boot code Revision (Vmaj.min-dash.) */
628 	struct FsaRevision	FlashFirmwareBootRevision;
629 	/* PCBA serial no. from th MFG sector */
630 	u_int8_t		MfgPcbaSerialNo[MFG_PCBA_SERIAL_NUMBER_WIDTH];
631 	/* WWN from the MFG sector */
632 	u_int8_t		MfgWWNName[MFG_WWN_WIDTH];
633 	u_int32_t	SupportedOptions2;		/* more supported features */
634 	u_int32_t	ExpansionFlag;			/* 1 - following fields are valid */
635 	u_int32_t	FeatureBits3;
636 	u_int32_t	SupportedPerformanceMode;
637 	/* Growth Area for future expansion */
638 	u_int32_t	ReservedGrowth[80];
639 } __packed;
640 
641 /*
642  * Monitor/Kernel interface.
643  */
644 
645 /*
646  * Synchronous commands to the monitor/kernel.
647  */
648 #define AAC_MONKER_BREAKPOINT	0x04
649 #define AAC_MONKER_INITSTRUCT	0x05
650 #define AAC_MONKER_SYNCFIB	0x0c
651 #define AAC_MONKER_GETKERNVER	0x11
652 #define AAC_MONKER_POSTRESULTS	0x14
653 #define AAC_MONKER_GETINFO	0x19
654 #define AAC_MONKER_GETDRVPROP	0x23
655 #define AAC_MONKER_RCVTEMP	0x25
656 #define AAC_MONKER_GETCOMMPREF	0x26
657 #define AAC_MONKER_REINIT	0xee
658 #define	AAC_IOP_RESET		0x1000
659 #define	AAC_IOP_RESET_ALWAYS	0x1001
660 
661 /*
662  *  Adapter Status Register
663  *
664  *  Phase Staus mailbox is 32bits:
665  *  <31:16> = Phase Status
666  *  <15:0>  = Phase
667  *
668  *  The adapter reports its present state through the phase.  Only
669  *  a single phase should be ever be set.  Each phase can have multiple
670  *  phase status bits to provide more detailed information about the
671  *  state of the adapter.
672  */
673 #define AAC_SELF_TEST_FAILED	0x00000004
674 #define AAC_MONITOR_PANIC	0x00000020
675 #define AAC_UP_AND_RUNNING	0x00000080
676 #define AAC_KERNEL_PANIC	0x00000100
677 
678 /*
679  * for dual FW image support
680  */
681 #define AAC_FLASH_UPD_PENDING	0x00002000
682 #define AAC_FLASH_UPD_SUCCESS	0x00004000
683 #define AAC_FLASH_UPD_FAILED	0x00008000
684 
685 /*
686  * Data types relating to control and monitoring of the NVRAM/WriteCache
687  * subsystem.
688  */
689 
690 #define AAC_NFILESYS	24	/* maximum number of filesystems */
691 
692 /*
693  * NVRAM/Write Cache subsystem states
694  */
695 typedef enum {
696 	NVSTATUS_DISABLED = 0,	/* present, clean, not being used */
697 	NVSTATUS_ENABLED,	/* present, possibly dirty, ready for use */
698 	NVSTATUS_ERROR,		/* present, dirty, contains dirty data */
699 	NVSTATUS_BATTERY,	/* present, bad or low battery, may contain
700 				 * dirty data */
701 	NVSTATUS_UNKNOWN	/* for bad/missing device */
702 } AAC_NVSTATUS;
703 
704 /*
705  * NVRAM/Write Cache subsystem battery component states
706  *
707  */
708 typedef enum {
709 	NVBATTSTATUS_NONE = 0,	/* battery has no power or is not present */
710 	NVBATTSTATUS_LOW,	/* battery is low on power */
711 	NVBATTSTATUS_OK,	/* battery is okay - normal operation possible
712 				 * only in this state */
713 	NVBATTSTATUS_RECONDITIONING	/* no battery present - reconditioning
714 					 * in process */
715 } AAC_NVBATTSTATUS;
716 
717 /*
718  * Battery transition type
719  */
720 typedef enum {
721 	NVBATT_TRANSITION_NONE = 0,	/* battery now has no power or is not
722 					 * present */
723 	NVBATT_TRANSITION_LOW,		/* battery is now low on power */
724 	NVBATT_TRANSITION_OK		/* battery is now okay - normal
725 					 * operation possible only in this
726 					 * state */
727 } AAC_NVBATT_TRANSITION;
728 
729 /*
730  * NVRAM Info structure returned for NVRAM_GetInfo call
731  */
732 struct aac_nvramdevinfo {
733 	u_int32_t	NV_Enabled;	/* write caching enabled */
734 	u_int32_t	NV_Error;	/* device in error state */
735 	u_int32_t	NV_NDirty;	/* count of dirty NVRAM buffers */
736 	u_int32_t	NV_NActive;	/* count of NVRAM buffers being
737 					 * written */
738 } __packed;
739 
740 struct aac_nvraminfo {
741 	AAC_NVSTATUS		NV_Status;	/* nvram subsystem status */
742 	AAC_NVBATTSTATUS	NV_BattStatus;	/* battery status */
743 	u_int32_t		NV_Size;	/* size of WriteCache NVRAM in
744 						 * bytes */
745 	u_int32_t		NV_BufSize;	/* size of NVRAM buffers in
746 						 * bytes */
747 	u_int32_t		NV_NBufs;	/* number of NVRAM buffers */
748 	u_int32_t		NV_NDirty;	/* Num dirty NVRAM buffers */
749 	u_int32_t		NV_NClean;	/* Num clean NVRAM buffers */
750 	u_int32_t		NV_NActive;	/* Num NVRAM buffers being
751 						 * written */
752 	u_int32_t		NV_NBrokered;	/* Num brokered NVRAM buffers */
753 	struct aac_nvramdevinfo	NV_DevInfo[AAC_NFILESYS];	/* per device
754 								 * info */
755 	u_int32_t		NV_BattNeedsReconditioning;	/* boolean */
756 	u_int32_t		NV_TotalSize;	/* size of all non-volatile
757 						 * memories in bytes */
758 } __packed;
759 
760 /*
761  * Data types relating to adapter-initiated FIBs
762  *
763  * Based on types and structures in <aifstruc.h>
764  */
765 
766 /*
767  * Progress Reports
768  */
769 typedef enum {
770 	AifJobStsSuccess = 1,
771 	AifJobStsFinished,
772 	AifJobStsAborted,
773 	AifJobStsFailed,
774 	AifJobStsLastReportMarker = 100,	/* All prior mean last report */
775 	AifJobStsSuspended,
776 	AifJobStsRunning
777 } AAC_AifJobStatus;
778 
779 typedef enum {
780 	AifJobScsiMin = 1,		/* Minimum value for Scsi operation */
781 	AifJobScsiZero,			/* SCSI device clear operation */
782 	AifJobScsiVerify,		/* SCSI device Verify operation NO
783 					 * REPAIR */
784 	AifJobScsiExercise,		/* SCSI device Exercise operation */
785 	AifJobScsiVerifyRepair,		/* SCSI device Verify operation WITH
786 					 * repair */
787 	AifJobScsiWritePattern,		/* write pattern */
788 	AifJobScsiMax = 99,		/* Max Scsi value */
789 	AifJobCtrMin,			/* Min Ctr op value */
790 	AifJobCtrZero,			/* Container clear operation */
791 	AifJobCtrCopy,			/* Container copy operation */
792 	AifJobCtrCreateMirror,		/* Container Create Mirror operation */
793 	AifJobCtrMergeMirror,		/* Container Merge Mirror operation */
794 	AifJobCtrScrubMirror,		/* Container Scrub Mirror operation */
795 	AifJobCtrRebuildRaid5,		/* Container Rebuild Raid5 operation */
796 	AifJobCtrScrubRaid5,		/* Container Scrub Raid5 operation */
797 	AifJobCtrMorph,			/* Container morph operation */
798 	AifJobCtrPartCopy,		/* Container Partition copy operation */
799 	AifJobCtrRebuildMirror,		/* Container Rebuild Mirror operation */
800 	AifJobCtrCrazyCache,		/* crazy cache */
801 	AifJobCtrCopyback,		/* Container Copyback operation */
802 	AifJobCtrCompactRaid5D,		/* Container Compaction operation */
803 	AifJobCtrExpandRaid5D,		/* Container Expansion operation */
804 	AifJobCtrRebuildRaid6,		/* Container Rebuild Raid6 operation */
805 	AifJobCtrScrubRaid6,		/* Container Scrub Raid6 operation */
806 	AifJobCtrSSBackup,		/* Container snapshot backup task */
807 	AifJobCtrMax = 199,		/* Max Ctr type operation */
808 	AifJobFsMin,			/* Min Fs type operation */
809 	AifJobFsCreate,			/* File System Create operation */
810 	AifJobFsVerify,			/* File System Verify operation */
811 	AifJobFsExtend,			/* File System Extend operation */
812 	AifJobFsMax = 299,		/* Max Fs type operation */
813 	AifJobApiFormatNTFS,		/* Format a drive to NTFS */
814 	AifJobApiFormatFAT,		/* Format a drive to FAT */
815 	AifJobApiUpdateSnapshot,	/* update the read/write half of a
816 					 * snapshot */
817 	AifJobApiFormatFAT32,		/* Format a drive to FAT32 */
818 	AifJobApiMax = 399,		/* Max API type operation */
819 	AifJobCtlContinuousCtrVerify,	/* Adapter operation */
820 	AifJobCtlMax = 499		/* Max Adapter type operation */
821 } AAC_AifJobType;
822 
823 struct aac_AifContainers {
824 	u_int32_t	src;		/* from/master */
825 	u_int32_t	dst;		/* to/slave */
826 } __packed;
827 
828 union aac_AifJobClient {
829 	struct aac_AifContainers	container;	/* For Container and
830 							 * filesystem progress
831 							 * ops; */
832 	int32_t				scsi_dh;	/* For SCSI progress
833 							 * ops */
834 };
835 
836 struct aac_AifJobDesc {
837 	u_int32_t		jobID;		/* DO NOT FILL IN! Will be
838 						 * filled in by AIF */
839 	AAC_AifJobType		type;		/* Operation that is being
840 						 * performed */
841 	union aac_AifJobClient	client;		/* Details */
842 } __packed;
843 
844 struct aac_AifJobProgressReport {
845 	struct aac_AifJobDesc	jd;
846 	AAC_AifJobStatus	status;
847 	u_int32_t		finalTick;
848 	u_int32_t		currentTick;
849 	u_int32_t		jobSpecificData1;
850 	u_int32_t		jobSpecificData2;
851 } __packed;
852 
853 /*
854  * Event Notification
855  */
856 typedef enum {
857 	/* General application notifies start here */
858 	AifEnGeneric = 1,		/* Generic notification */
859 	AifEnTaskComplete,		/* Task has completed */
860 	AifEnConfigChange,		/* Adapter config change occurred */
861 	AifEnContainerChange,		/* Adapter specific container
862 					 * configuration change */
863 	AifEnDeviceFailure,		/* SCSI device failed */
864 	AifEnMirrorFailover,		/* Mirror failover started */
865 	AifEnContainerEvent,		/* Significant container event */
866 	AifEnFileSystemChange,		/* File system changed */
867 	AifEnConfigPause,		/* Container pause event */
868 	AifEnConfigResume,		/* Container resume event */
869 	AifEnFailoverChange,		/* Failover space assignment changed */
870 	AifEnRAID5RebuildDone,		/* RAID5 rebuild finished */
871 	AifEnEnclosureManagement,	/* Enclosure management event */
872 	AifEnBatteryEvent,		/* Significant NV battery event */
873 	AifEnAddContainer,		/* A new container was created. */
874 	AifEnDeleteContainer,		/* A container was deleted. */
875 	AifEnSMARTEvent, 	       	/* SMART Event */
876 	AifEnBatteryNeedsRecond,	/* The battery needs reconditioning */
877 	AifEnClusterEvent,		/* Some cluster event */
878 	AifEnDiskSetEvent,		/* A disk set event occurred. */
879 	AifEnContainerScsiEvent,	/* a container event with no. and scsi id */
880 	AifEnPicBatteryEvent,	/* An event gen. by pic_battery.c for an ABM */
881 	AifEnExpEvent,		/* Exp. Event Type to replace CTPopUp messages */
882 	AifEnRAID6RebuildDone,	/* RAID6 rebuild finished */
883 	AifEnSensorOverHeat,	/* Heat Sensor indicate overheat */
884 	AifEnSensorCoolDown,	/* Heat Sensor ind. cooled down after overheat */
885 	AifFeatureKeysModified,	/* notif. of updated feature keys */
886 	AifApplicationExpirationEvent,	/* notif. on app. expiration status */
887 	AifEnBackgroundConsistencyCheck,/* BCC notif. for NEC - DDTS 94700 */
888 	AifEnAddJBOD,		/* A new JBOD type drive was created (30) */
889 	AifEnDeleteJBOD,	/* A JBOD type drive was deleted (31) */
890 	AifDriverNotifyStart=199,	/* Notifies for host driver go here */
891 	/* Host driver notifications start here */
892 	AifDenMorphComplete, 		/* A morph operation completed */
893 	AifDenVolumeExtendComplete, 	/* Volume expand operation completed */
894 	AifDriverNotifyDelay,
895 	AifRawDeviceRemove			/* Raw device Failure event */
896 } AAC_AifEventNotifyType;
897 
898 struct aac_AifEnsGeneric {
899 	char	text[132];		/* Generic text */
900 } __packed;
901 
902 struct aac_AifEnsDeviceFailure {
903 	u_int32_t	deviceHandle;	/* SCSI device handle */
904 } __packed;
905 
906 struct aac_AifEnsMirrorFailover {
907 	u_int32_t	container;	/* Container with failed element */
908 	u_int32_t	failedSlice;	/* Old slice which failed */
909 	u_int32_t	creatingSlice;	/* New slice used for auto-create */
910 } __packed;
911 
912 struct aac_AifEnsContainerChange {
913 	u_int32_t	container[2];	/* container that changed, -1 if no
914 					 * container */
915 } __packed;
916 
917 struct aac_AifEnsContainerEvent {
918 	u_int32_t	container;	/* container number  */
919 	u_int32_t	eventType;	/* event type */
920 } __packed;
921 
922 struct aac_AifEnsEnclosureEvent {
923 	u_int32_t	empID;		/* enclosure management proc number  */
924 	u_int32_t	unitID;		/* unitId, fan id, power supply id,
925 					 * slot id, tempsensor id.  */
926 	u_int32_t	eventType;	/* event type */
927 } __packed;
928 
929 typedef enum {
930 	AIF_EM_DRIVE_INSERTION=31,
931 	AIF_EM_DRIVE_REMOVAL
932 } aac_AifEMEventType;
933 
934 struct aac_AifEnsBatteryEvent {
935 	AAC_NVBATT_TRANSITION	transition_type;	/* eg from low to ok */
936 	AAC_NVBATTSTATUS	current_state;		/* current batt state */
937 	AAC_NVBATTSTATUS	prior_state;		/* prev batt state */
938 } __packed;
939 
940 struct aac_AifEnsDiskSetEvent {
941 	u_int32_t	eventType;
942 	u_int64_t	DsNum;
943 	u_int64_t	CreatorId;
944 } __packed;
945 
946 typedef enum {
947 	CLUSTER_NULL_EVENT = 0,
948 	CLUSTER_PARTNER_NAME_EVENT,	/* change in partner hostname or
949 					 * adaptername from NULL to non-NULL */
950 	/* (partner's agent may be up) */
951 	CLUSTER_PARTNER_NULL_NAME_EVENT	/* change in partner hostname or
952 					 * adaptername from non-null to NULL */
953 	/* (partner has rebooted) */
954 } AAC_ClusterAifEvent;
955 
956 struct aac_AifEnsClusterEvent {
957 	AAC_ClusterAifEvent	eventType;
958 } __packed;
959 
960 struct aac_AifEventNotify {
961 	AAC_AifEventNotifyType	type;
962 	union {
963 		struct aac_AifEnsGeneric		EG;
964 		struct aac_AifEnsDeviceFailure		EDF;
965 		struct aac_AifEnsMirrorFailover		EMF;
966 		struct aac_AifEnsContainerChange	ECC;
967 		struct aac_AifEnsContainerEvent		ECE;
968 		struct aac_AifEnsEnclosureEvent		EEE;
969 		struct aac_AifEnsBatteryEvent		EBE;
970 		struct aac_AifEnsDiskSetEvent		EDS;
971 /*		struct aac_AifEnsSMARTEvent		ES;*/
972 		struct aac_AifEnsClusterEvent		ECLE;
973 	} data;
974 } __packed;
975 
976 /*
977  * Adapter Initiated FIB command structures. Start with the adapter
978  * initiated FIBs that really come from the adapter, and get responded
979  * to by the host.
980  */
981 #define AAC_AIF_REPORT_MAX_SIZE 64
982 
983 typedef enum {
984 	AifCmdEventNotify = 1,	/* Notify of event */
985 	AifCmdJobProgress,	/* Progress report */
986 	AifCmdAPIReport,	/* Report from other user of API */
987 	AifCmdDriverNotify,	/* Notify host driver of event */
988 	AifReqJobList = 100,	/* Gets back complete job list */
989 	AifReqJobsForCtr,	/* Gets back jobs for specific container */
990 	AifReqJobsForScsi,	/* Gets back jobs for specific SCSI device */
991 	AifReqJobReport,	/* Gets back a specific job report or list */
992 	AifReqTerminateJob,	/* Terminates job */
993 	AifReqSuspendJob,	/* Suspends a job */
994 	AifReqResumeJob,	/* Resumes a job */
995 	AifReqSendAPIReport,	/* API generic report requests */
996 	AifReqAPIJobStart,	/* Start a job from the API */
997 	AifReqAPIJobUpdate,	/* Update a job report from the API */
998 	AifReqAPIJobFinish,	/* Finish a job from the API */
999 	AifReqEvent = 200	/* PMC NEW COMM: Request the event data */
1000 } AAC_AifCommand;
1001 
1002 struct aac_aif_command {
1003 	AAC_AifCommand	command;	/* Tell host what type of
1004 					 * notify this is */
1005 	u_int32_t	seqNumber;	/* To allow ordering of
1006 					 * reports (if necessary) */
1007 	union {
1008 		struct aac_AifEventNotify	EN;	/* Event notify */
1009 		struct aac_AifJobProgressReport	PR[1];	/* Progress report */
1010 		u_int8_t			AR[AAC_AIF_REPORT_MAX_SIZE];
1011 		u_int8_t			data[AAC_FIB_DATASIZE - 8];
1012 	} data;
1013 } __packed;
1014 
1015 /*
1016  * Filesystem commands/data
1017  *
1018  * The adapter has a very complex filesystem interface, most of which we ignore.
1019  * (And which seems not to be implemented, anyway.)
1020  */
1021 
1022 /*
1023  * FSA commands
1024  * (not used?)
1025  */
1026 typedef enum {
1027 	Null = 0,
1028 	GetAttributes,
1029 	SetAttributes,
1030 	Lookup,
1031 	ReadLink,
1032 	Read,
1033 	Write,
1034 	Create,
1035 	MakeDirectory,
1036 	SymbolicLink,
1037 	MakeNode,
1038 	Removex,
1039 	RemoveDirectory,
1040 	Rename,
1041 	Link,
1042 	ReadDirectory,
1043 	ReadDirectoryPlus,
1044 	FileSystemStatus,
1045 	FileSystemInfo,
1046 	PathConfigure,
1047 	Commit,
1048 	Mount,
1049 	UnMount,
1050 	Newfs,
1051 	FsCheck,
1052 	FsSync,
1053 	SimReadWrite,
1054 	SetFileSystemStatus,
1055 	BlockRead,
1056 	BlockWrite,
1057 	NvramIoctl,
1058 	FsSyncWait,
1059 	ClearArchiveBit,
1060 	SetAcl,
1061 	GetAcl,
1062 	AssignAcl,
1063 	FaultInsertion,
1064 	CrazyCache
1065 } AAC_FSACommand;
1066 
1067 /*
1068  * Command status values
1069  */
1070 typedef enum {
1071 	ST_OK = 0,
1072 	ST_PERM = 1,
1073 	ST_NOENT = 2,
1074 	ST_IO = 5,
1075 	ST_NXIO = 6,
1076 	ST_E2BIG = 7,
1077 	ST_ACCES = 13,
1078 	ST_EXIST = 17,
1079 	ST_XDEV = 18,
1080 	ST_NODEV = 19,
1081 	ST_NOTDIR = 20,
1082 	ST_ISDIR = 21,
1083 	ST_INVAL = 22,
1084 	ST_FBIG = 27,
1085 	ST_NOSPC = 28,
1086 	ST_ROFS = 30,
1087 	ST_MLINK = 31,
1088 	ST_WOULDBLOCK = 35,
1089 	ST_NAMETOOLONG = 63,
1090 	ST_NOTEMPTY = 66,
1091 	ST_DQUOT = 69,
1092 	ST_STALE = 70,
1093 	ST_REMOTE = 71,
1094 	ST_NOT_READY = 72,
1095 	ST_BADHANDLE = 10001,
1096 	ST_NOT_SYNC = 10002,
1097 	ST_BAD_COOKIE = 10003,
1098 	ST_NOTSUPP = 10004,
1099 	ST_TOOSMALL = 10005,
1100 	ST_SERVERFAULT = 10006,
1101 	ST_BADTYPE = 10007,
1102 	ST_JUKEBOX = 10008,
1103 	ST_NOTMOUNTED = 10009,
1104 	ST_MAINTMODE = 10010,
1105 	ST_STALEACL = 10011,
1106 	ST_BUS_RESET = 20001
1107 } AAC_FSAStatus;
1108 
1109 /*
1110  * Volume manager commands
1111  */
1112 typedef enum _VM_COMMANDS {
1113 	VM_Null = 0,
1114 	VM_NameServe,        /* query for mountable objects (containers) */
1115 	VM_ContainerConfig,
1116 	VM_Ioctl,
1117 	VM_FilesystemIoctl,
1118 	VM_CloseAll,
1119 	VM_CtBlockRead,
1120 	VM_CtBlockWrite,
1121 	VM_SliceBlockRead,   /* raw access to configured "storage objects" */
1122 	VM_SliceBlockWrite,
1123 	VM_DriveBlockRead,   /* raw access to physical devices */
1124 	VM_DriveBlockWrite,
1125 	VM_EnclosureMgt,     /* enclosure management */
1126 	VM_Unused,           /* used to be diskset management */
1127 	VM_CtBlockVerify,
1128 	VM_CtPerf,           /* performance test */
1129 	VM_CtBlockRead64,
1130 	VM_CtBlockWrite64,
1131 	VM_CtBlockVerify64,
1132 	VM_CtHostRead64,
1133 	VM_CtHostWrite64,
1134 	VM_DrvErrTblLog,     /* drive error table/log type of command */
1135 	VM_NameServe64,      /* query also for containers >2TB */
1136 	VM_SasNvsramAccess,  /* for sas nvsram layout function */
1137 	VM_HandleExpiration, /* handles application expiration, internal use! */
1138 	VM_GetDynAdapProps,  /* retrieves dynamic adapter properties */
1139 	VM_SetDynAdapProps,  /* sets a dynamic adapter property */
1140 	VM_UpdateSSDODM,     /* updates the on-disk metadata for SSD caching */
1141 	VM_GetSPMParameters, /* get SPM parameters for one of the perf. modes */
1142 	VM_SetSPMParameters, /* set SPM parameters for user defined perf. mode */
1143 	VM_NameServeAllBlk,  /* query also for containers with 4KB sector size */
1144 	MAX_VMCOMMAND_NUM    /* used for sizing stats array - leave last */
1145 } AAC_VMCommand;
1146 
1147 /* Container Configuration Sub-Commands */
1148 #define CT_GET_SCSI_METHOD	64
1149 #define	CT_PAUSE_IO			65
1150 #define	CT_RELEASE_IO			66
1151 #define	CT_GET_CONFIG_STATUS		147
1152 #define	CT_COMMIT_CONFIG		152
1153 #define	CT_CID_TO_32BITS_UID		165
1154 #define CT_PM_DRIVER_SUPPORT		245
1155 
1156 /* General CT_xxx return status */
1157 #define CT_OK		218
1158 
1159 /* CT_PM_DRIVER_SUPPORT parameter */
1160 typedef enum {
1161 	AAC_PM_DRIVERSUP_GET_STATUS = 1,
1162 	AAC_PM_DRIVERSUP_START_UNIT,
1163 	AAC_PM_DRIVERSUP_STOP_UNIT
1164 } AAC_CT_PM_DRIVER_SUPPORT_SUB_COM;
1165 
1166 /*
1167  * CT_PAUSE_IO is immediate minimal runtime command that is used
1168  * to restart the applications and cache.
1169  */
1170 struct aac_pause_command {
1171 	u_int32_t	Command;
1172 	u_int32_t	Type;
1173 	u_int32_t	Timeout;
1174 	u_int32_t	Min;
1175 	u_int32_t	NoRescan;
1176 	u_int32_t	Parm3;
1177 	u_int32_t	Parm4;
1178 	u_int32_t	Count;
1179 } __packed;
1180 
1181 /* Flag values for ContentState */
1182 #define AAC_FSCS_NOTCLEAN	0x1	/* fscheck is necessary before mounting */
1183 #define AAC_FSCS_READONLY	0x2	/* possible result of broken mirror */
1184 #define AAC_FSCS_HIDDEN		0x4	/* container should be ignored by driver */
1185 #define AAC_FSCS_NOT_READY	0x8	/* cnt is in spinn. state, not rdy for IO's */
1186 
1187 /*
1188  * "mountable object"
1189  */
1190 struct aac_mntobj {
1191 	u_int32_t			ObjectId;
1192 	char				FileSystemName[16];
1193 	struct aac_container_creation	CreateInfo;
1194 	u_int32_t			Capacity;
1195 	u_int32_t			VolType;
1196 	u_int32_t			ObjType;
1197 	u_int32_t			ContentState;
1198 	union {
1199 		u_int32_t	pad[8];
1200 		struct {
1201 			u_int32_t	BlockSize;
1202 			u_int32_t	bdLgclPhysMap;
1203 		} BlockDevice;
1204 	} ObjExtension;
1205 	u_int32_t			AlterEgoId;
1206 	u_int32_t			CapacityHigh;
1207 } __packed;
1208 
1209 struct aac_mntinfo {
1210 	u_int32_t		Command;
1211 	u_int32_t		MntType;
1212 	u_int32_t		MntCount;
1213 } __packed;
1214 
1215 struct aac_mntinforesp {
1216 	u_int32_t		Status;
1217 	u_int32_t		MntType;
1218 	u_int32_t		MntRespCount;
1219 	struct aac_mntobj	MntTable[1];
1220 } __packed;
1221 
1222 /*
1223  * Container shutdown command.
1224  */
1225 struct aac_closecommand {
1226 	u_int32_t	Command;
1227 	u_int32_t	ContainerId;
1228 } __packed;
1229 
1230 /*
1231  * Container Config Command
1232  */
1233 struct aac_ctcfg {
1234 	u_int32_t		Command;
1235 	u_int32_t		cmd;
1236 	u_int32_t		param;
1237 } __packed;
1238 
1239 struct aac_ctcfg_resp {
1240 	u_int32_t		Status;
1241 	u_int32_t		resp;
1242 	u_int32_t		param;
1243 } __packed;
1244 
1245 /*
1246  * 'Ioctl' commads
1247  */
1248 #define AAC_SCSI_MAX_PORTS	10
1249 #define AAC_BUS_NO_EXIST	0
1250 #define AAC_BUS_VALID		1
1251 #define AAC_BUS_FAULTED		2
1252 #define AAC_BUS_DISABLED	3
1253 #define GetBusInfo		0x9
1254 
1255 struct aac_getbusinf {
1256 	u_int32_t		ProbeComplete;
1257 	u_int32_t		BusCount;
1258 	u_int32_t		TargetsPerBus;
1259 	u_int8_t		InitiatorBusId[AAC_SCSI_MAX_PORTS];
1260 	u_int8_t		BusValid[AAC_SCSI_MAX_PORTS];
1261 } __packed;
1262 
1263 struct aac_vmioctl {
1264 	u_int32_t		Command;
1265 	u_int32_t		ObjType;
1266 	u_int32_t		MethId;
1267 	u_int32_t		ObjId;
1268 	u_int32_t		IoctlCmd;
1269 	u_int32_t		IoctlBuf[1];	/* Placeholder? */
1270 } __packed;
1271 
1272 struct aac_vmi_businf_resp {
1273 	u_int32_t		Status;
1274 	u_int32_t		ObjType;
1275 	u_int32_t		MethId;
1276 	u_int32_t		ObjId;
1277 	u_int32_t		IoctlCmd;
1278 	struct aac_getbusinf	BusInf;
1279 } __packed;
1280 
1281 struct aac_vmi_devinfo_resp {
1282 	u_int32_t		Status;
1283 	u_int32_t		ObjType;
1284 	u_int32_t		MethId;
1285 	u_int32_t		ObjId;
1286 	u_int32_t		IoctlCmd;
1287 	u_int8_t		VendorId[8];
1288 	u_int8_t		ProductId[16];
1289 	u_int8_t		ProductRev[4];
1290 	u_int32_t		Inquiry7;
1291 	u_int32_t		align1;
1292 	u_int32_t		Inquiry0;
1293 	u_int32_t		align2;
1294 	u_int32_t		Inquiry1;
1295 	u_int32_t		align3;
1296 	u_int32_t		reserved[2];
1297 	u_int8_t		VendorSpecific[20];
1298 	u_int32_t		Smart:1;
1299 	u_int32_t		AAC_Managed:1;
1300 	u_int32_t		align4;
1301 	u_int32_t		reserved2:6;
1302 	u_int32_t		Bus;
1303 	u_int32_t		Target;
1304 	u_int32_t		Lun;
1305 	u_int32_t		ultraEnable:1,
1306 				disconnectEnable:1,
1307 				fast20EnabledW:1,
1308 				scamDevice:1,
1309 				scamTolerant:1,
1310 				setForSync:1,
1311 				setForWide:1,
1312 				syncDevice:1,
1313 				wideDevice:1,
1314 				reserved1:7,
1315 				ScsiRate:8,
1316 				ScsiOffset:8;
1317 }; /* Do not pack */
1318 
1319 #define ResetBus 0x16
1320 struct aac_resetbus {
1321 	u_int32_t		BusNumber;
1322 };
1323 
1324 /*
1325  * Write 'stability' options.
1326  */
1327 typedef enum {
1328 	CSTABLE = 1,
1329 	CUNSTABLE
1330 } AAC_CacheLevel;
1331 
1332 /*
1333  * Commit level response for a write request.
1334  */
1335 typedef enum {
1336 	CMFILE_SYNC_NVRAM = 1,
1337 	CMDATA_SYNC_NVRAM,
1338 	CMFILE_SYNC,
1339 	CMDATA_SYNC,
1340 	CMUNSTABLE
1341 } AAC_CommitLevel;
1342 
1343 #define	CT_FIB_PARAMS			6
1344 #define	MAX_FIB_PARAMS			10
1345 #define	CT_PACKET_SIZE \
1346 	(AAC_FIB_DATASIZE - sizeof (u_int32_t) - \
1347 	((sizeof (u_int32_t)) * (MAX_FIB_PARAMS + 1)))
1348 #define CNT_SIZE			5
1349 
1350 struct aac_fsa_ctm {
1351 	u_int32_t	command;
1352 	u_int32_t	param[CT_FIB_PARAMS];
1353 	int8_t		data[CT_PACKET_SIZE];
1354 };
1355 
1356 struct aac_cnt_config {
1357 	u_int32_t		Command;
1358 	struct aac_fsa_ctm	CTCommand;
1359 };
1360 
1361 /* check config. */
1362 enum {
1363 	CFACT_CONTINUE = 0,	/* continue without pause */
1364 	CFACT_PAUSE,		/* pause, then continue */
1365 	CFACT_ABORT		/* abort */
1366 };
1367 
1368 struct aac_cf_status_hdr {
1369 	u_int32_t	action;
1370 	u_int32_t	flags;
1371 	u_int32_t	recordcount;
1372 };
1373 
1374 /*
1375  * Block read/write operations.
1376  * These structures are packed into the 'data' area in the FIB.
1377  */
1378 
1379 struct aac_blockread {
1380 	u_int32_t		Command;	/* not FSACommand! */
1381 	u_int32_t		ContainerId;
1382 	u_int32_t		BlockNumber;
1383 	u_int32_t		ByteCount;
1384 	struct aac_sg_table	SgMap;		/* variable size */
1385 } __packed;
1386 
1387 struct aac_blockread64 {
1388 	u_int32_t		Command;
1389 	u_int16_t		ContainerId;
1390 	u_int16_t		SectorCount;
1391 	u_int32_t		BlockNumber;
1392 	u_int16_t		Pad;
1393 	u_int16_t		Flags;
1394 	struct aac_sg_table64	SgMap64;
1395 } __packed;
1396 
1397 struct aac_blockread_response {
1398 	u_int32_t		Status;
1399 	u_int32_t		ByteCount;
1400 } __packed;
1401 
1402 struct aac_blockwrite {
1403 	u_int32_t		Command;	/* not FSACommand! */
1404 	u_int32_t		ContainerId;
1405 	u_int32_t		BlockNumber;
1406 	u_int32_t		ByteCount;
1407 	u_int32_t		Stable;
1408 	struct aac_sg_table	SgMap;		/* variable size */
1409 } __packed;
1410 
1411 struct aac_blockwrite64 {
1412 	u_int32_t		Command;	/* not FSACommand! */
1413 	u_int16_t		ContainerId;
1414 	u_int16_t		SectorCount;
1415 	u_int32_t		BlockNumber;
1416 	u_int16_t		Pad;
1417 	u_int16_t		Flags;
1418 	struct aac_sg_table64	SgMap64;	/* variable size */
1419 } __packed;
1420 
1421 struct aac_blockwrite_response {
1422 	u_int32_t		Status;
1423 	u_int32_t		ByteCount;
1424 	u_int32_t		Committed;
1425 } __packed;
1426 
1427 struct aac_raw_io {
1428 	u_int64_t		BlockNumber;
1429 	u_int32_t		ByteCount;
1430 	u_int16_t		ContainerId;
1431 	u_int16_t		Flags;				/* 0: W, 1: R */
1432 	u_int16_t		BpTotal;			/* reserved for FW use */
1433 	u_int16_t		BpComplete;			/* reserved for FW use */
1434 	struct aac_sg_tableraw	SgMapRaw;	/* variable size */
1435 } __packed;
1436 
1437 #define RIO2_IO_TYPE		0x0003
1438 #define RIO2_IO_TYPE_WRITE	0x0000
1439 #define RIO2_IO_TYPE_READ	0x0001
1440 #define RIO2_IO_TYPE_VERIFY	0x0002
1441 #define RIO2_IO_ERROR		0x0004
1442 #define RIO2_IO_SUREWRITE	0x0008
1443 #define RIO2_SGL_CONFORMANT	0x0010
1444 #define RIO2_SG_FORMAT		0xF000
1445 #define RIO2_SG_FORMAT_ARC	0x0000
1446 #define RIO2_SG_FORMAT_SRL	0x1000
1447 #define RIO2_SG_FORMAT_IEEE1212	0x2000
1448 struct aac_raw_io2 {
1449 	u_int32_t		strtBlkLow;
1450 	u_int32_t		strtBlkHigh;
1451 	u_int32_t		byteCnt;
1452 	u_int16_t		ldNum;
1453 	u_int16_t		flags;				/* RIO2_xxx */
1454 	u_int32_t		sgeFirstSize;		/* size of first SG element */
1455 	u_int32_t		sgeNominalSize;		/* size of 2nd SG element */
1456 	u_int8_t		sgeCnt;
1457 	u_int8_t		bpTotal;			/* reserved for FW use */
1458 	u_int8_t		bpComplete;			/* reserved for FW use */
1459 	u_int8_t		sgeFirstIndex;		/* reserved for FW use */
1460 	u_int8_t		unused[4];
1461 	struct aac_sge_ieee1212	sge[0];		/* variable size */
1462 } __packed;
1463 
1464 /*
1465  * Container shutdown command.
1466  */
1467 struct aac_close_command {
1468 	u_int32_t		Command;
1469 	u_int32_t		ContainerId;
1470 } __packed;
1471 
1472 /*
1473  * SCSI Passthrough structures
1474  */
1475 struct aac_srb {
1476 	u_int32_t		function;
1477 	u_int32_t		bus;
1478 	u_int32_t		target;
1479 	u_int32_t		lun;
1480 	u_int32_t		timeout;
1481 	u_int32_t		flags;
1482 	u_int32_t		data_len;
1483 	u_int32_t		retry_limit;
1484 	u_int32_t		cdb_len;
1485 	u_int8_t		cdb[16];
1486 	struct aac_sg_table	sg_map;
1487 } __packed;
1488 
1489 enum {
1490 	AAC_SRB_FUNC_EXECUTE_SCSI	= 0x00,
1491 	AAC_SRB_FUNC_CLAIM_DEVICE,
1492 	AAC_SRB_FUNC_IO_CONTROL,
1493 	AAC_SRB_FUNC_RECEIVE_EVENT,
1494 	AAC_SRB_FUNC_RELEASE_QUEUE,
1495 	AAC_SRB_FUNC_ATTACH_DEVICE,
1496 	AAC_SRB_FUNC_RELEASE_DEVICE,
1497 	AAC_SRB_FUNC_SHUTDOWN,
1498 	AAC_SRB_FUNC_FLUSH,
1499 	AAC_SRB_FUNC_ABORT_COMMAND	= 0x10,
1500 	AAC_SRB_FUNC_RELEASE_RECOVERY,
1501 	AAC_SRB_FUNC_RESET_BUS,
1502 	AAC_SRB_FUNC_RESET_DEVICE,
1503 	AAC_SRB_FUNC_TERMINATE_IO,
1504 	AAC_SRB_FUNC_FLUSH_QUEUE,
1505 	AAC_SRB_FUNC_REMOVE_DEVICE,
1506 	AAC_SRB_FUNC_DOMAIN_VALIDATION
1507 };
1508 
1509 #define AAC_SRB_FLAGS_NO_DATA_XFER		0x0000
1510 #define	AAC_SRB_FLAGS_DISABLE_DISCONNECT	0x0004
1511 #define	AAC_SRB_FLAGS_DISABLE_SYNC_TRANSFER	0x0008
1512 #define AAC_SRB_FLAGS_BYPASS_FROZEN_QUEUE	0x0010
1513 #define	AAC_SRB_FLAGS_DISABLE_AUTOSENSE		0x0020
1514 #define	AAC_SRB_FLAGS_DATA_IN			0x0040
1515 #define AAC_SRB_FLAGS_DATA_OUT			0x0080
1516 #define	AAC_SRB_FLAGS_UNSPECIFIED_DIRECTION \
1517 			(AAC_SRB_FLAGS_DATA_IN | AAC_SRB_FLAGS_DATA_OUT)
1518 
1519 #define AAC_HOST_SENSE_DATA_MAX			30
1520 
1521 struct aac_srb_response {
1522 	u_int32_t	fib_status;
1523 	u_int32_t	srb_status;
1524 	u_int32_t	scsi_status;
1525 	u_int32_t	data_len;
1526 	u_int32_t	sense_len;
1527 	u_int8_t	sense[AAC_HOST_SENSE_DATA_MAX];
1528 } __packed;
1529 
1530 /*
1531  * Status codes for SCSI passthrough commands.  Since they are based on ASPI,
1532  * they also exactly match CAM status codes in both enumeration and meaning.
1533  * They seem to also be used as status codes for synchronous FIBs.
1534  */
1535 enum {
1536 	AAC_SRB_STS_PENDING			= 0x00,
1537 	AAC_SRB_STS_SUCCESS,
1538 	AAC_SRB_STS_ABORTED,
1539 	AAC_SRB_STS_ABORT_FAILED,
1540 	AAC_SRB_STS_ERROR,
1541 	AAC_SRB_STS_BUSY,
1542 	AAC_SRB_STS_INVALID_REQUEST,
1543 	AAC_SRB_STS_INVALID_PATH_ID,
1544 	AAC_SRB_STS_NO_DEVICE,
1545 	AAC_SRB_STS_TIMEOUT,
1546 	AAC_SRB_STS_SELECTION_TIMEOUT,
1547 	AAC_SRB_STS_COMMAND_TIMEOUT,
1548 	AAC_SRB_STS_MESSAGE_REJECTED		= 0x0D,
1549 	AAC_SRB_STS_BUS_RESET,
1550 	AAC_SRB_STS_PARITY_ERROR,
1551 	AAC_SRB_STS_REQUEST_SENSE_FAILED,
1552 	AAC_SRB_STS_NO_HBA,
1553 	AAC_SRB_STS_DATA_OVERRUN,
1554 	AAC_SRB_STS_UNEXPECTED_BUS_FREE,
1555 	AAC_SRB_STS_PHASE_SEQUENCE_FAILURE,
1556 	AAC_SRB_STS_BAD_SRB_BLOCK_LENGTH,
1557 	AAC_SRB_STS_REQUEST_FLUSHED,
1558 	AAC_SRB_STS_INVALID_LUN			= 0x20,
1559 	AAC_SRB_STS_INVALID_TARGET_ID,
1560 	AAC_SRB_STS_BAD_FUNCTION,
1561 	AAC_SRB_STS_ERROR_RECOVERY
1562 };
1563 
1564 /*
1565  * Register definitions for the Adaptec PMC SRC/SRCv adapters.
1566  */
1567 /* accessible via BAR0 */
1568 #define AAC_SRC_OMR		0xbc	/* outbound message register */
1569 #define AAC_SRC_IOAR		0x18	/* IOA->host interrupt register */
1570 #define AAC_SRC_IDBR		0x20	/* inbound doorbell register */
1571 #define AAC_SRC_IISR		0x24	/* inbound interrupt status register */
1572 #define AAC_SRC_ODBR_R		0x9c	/* outbound doorbell register read */
1573 #define AAC_SRC_ODBR_C		0xa0	/* outbound doorbell register clear */
1574 #define AAC_SRC_OIMR		0x34	/* outbound interrupt mask register */
1575 #define AAC_SRC_IQUE32		0x40	/* inbound queue address 32-bit */
1576 #define AAC_SRC_IQUE64_L	0xc0	/* inbound queue address 64-bit (low) */
1577 #define AAC_SRC_IQUE64_H	0xc4	/* inbound queue address 64-bit (high)*/
1578 #define AAC_SRC_ODBR_MSI	0xc8	/* MSI register for sync./AIF */
1579 
1580 #define AAC_SRC_MAILBOX		0x7fc60	/* mailbox (20 bytes) */
1581 #define AAC_SRCV_MAILBOX	0x1000	/* mailbox (20 bytes) */
1582 
1583 #define AAC_SRC_ODR_SHIFT 	12		/* outbound doorbell shift */
1584 #define AAC_SRC_IDR_SHIFT 	9		/* inbound doorbell shift */
1585 
1586 /* Sunrise Lake dual core reset */
1587 #define AAC_IRCSR		0x38	/* inbound dual cores reset */
1588 #define AAC_IRCSR_CORES_RST	3
1589 
1590 /*
1591  * Common bit definitions for the doorbell registers.
1592  */
1593 
1594 /*
1595  * Status bits in the doorbell registers.
1596  */
1597 #define AAC_DB_SYNC_COMMAND	(1<<0)	/* send/completed synchronous FIB */
1598 #define AAC_DB_AIF_PENDING	(1<<6)	/* pending AIF (new comm. type1) */
1599 /* PMC specific outbound doorbell bits */
1600 #define AAC_DB_RESPONSE_SENT_NS		(1<<1)	/* response sent (not shifted)*/
1601 
1602 /*
1603  * The adapter can request the host print a message by setting the
1604  * DB_PRINTF flag in DOORBELL0.  The driver responds by collecting the
1605  * message from the printf buffer, clearing the DB_PRINTF flag in
1606  * DOORBELL0 and setting it in DOORBELL1.
1607  * (ODBR and IDBR respectively for the i960Rx adapters)
1608  */
1609 #define AAC_DB_PRINTF		(1<<5)	/* adapter requests host printf */
1610 #define AAC_PRINTF_DONE		(1<<5)	/* Host completed printf processing */
1611 
1612 /*
1613  * Interrupts
1614  */
1615 #define AAC_MAX_MSIX		32	/* vectors */
1616 #define AAC_PCI_MSI_ENABLE	0x8000
1617 #define AAC_MSI_SYNC_STATUS	0x1000
1618 
1619 enum {
1620 	AAC_ENABLE_INTERRUPT	= 0x0,
1621 	AAC_DISABLE_INTERRUPT,
1622 	AAC_ENABLE_MSIX,
1623 	AAC_DISABLE_MSIX,
1624 	AAC_CLEAR_AIF_BIT,
1625 	AAC_CLEAR_SYNC_BIT,
1626 	AAC_ENABLE_INTX
1627 };
1628 
1629 #define AAC_INT_MODE_INTX		(1<<0)
1630 #define AAC_INT_MODE_MSI		(1<<1)
1631 #define AAC_INT_MODE_AIF		(1<<2)
1632 #define AAC_INT_MODE_SYNC		(1<<3)
1633 
1634 #define AAC_INT_ENABLE_TYPE1_INTX	0xfffffffb
1635 #define AAC_INT_ENABLE_TYPE1_MSIX	0xfffffffa
1636 #define AAC_INT_DISABLE_ALL		0xffffffff
1637 
1638 /* Bit definitions in IOA->Host Interrupt Register */
1639 #define PMC_TRANSITION_TO_OPERATIONAL	(0x80000000 >> 0)
1640 #define PMC_IOARCB_TRANSFER_FAILED	(0x80000000 >> 3)
1641 #define PMC_IOA_UNIT_CHECK		(0x80000000 >> 4)
1642 #define PMC_NO_HOST_RRQ_FOR_CMD_RESPONSE (0x80000000 >> 5)
1643 #define PMC_CRITICAL_IOA_OP_IN_PROGRESS	(0x80000000 >> 6)
1644 #define PMC_IOARRIN_LOST		(0x80000000 >> 27)
1645 #define PMC_SYSTEM_BUS_MMIO_ERROR	(0x80000000 >> 28)
1646 #define PMC_IOA_PROCESSOR_IN_ERROR_STATE (0x80000000 >> 29)
1647 #define PMC_HOST_RRQ_VALID		(0x80000000 >> 30)
1648 #define PMC_OPERATIONAL_STATUS		(0x80000000 >> 0)
1649 #define PMC_ALLOW_MSIX_VECTOR0		(0x80000000 >> 31)
1650 
1651 #define PMC_IOA_ERROR_INTERRUPTS	(PMC_IOARCB_TRANSFER_FAILED | \
1652 					 PMC_IOA_UNIT_CHECK | \
1653 					 PMC_NO_HOST_RRQ_FOR_CMD_RESPONSE | \
1654 					 PMC_IOARRIN_LOST | \
1655 					 PMC_SYSTEM_BUS_MMIO_ERROR | \
1656 					 PMC_IOA_PROCESSOR_IN_ERROR_STATE)
1657 
1658 #define PMC_ALL_INTERRUPT_BITS		(PMC_IOA_ERROR_INTERRUPTS | \
1659 					 PMC_HOST_RRQ_VALID | \
1660 					 PMC_TRANSITION_TO_OPERATIONAL | \
1661 					 PMC_ALLOW_MSIX_VECTOR0)
1662 
1663 #define PMC_GLOBAL_INT_BIT2		0x00000004
1664 #define PMC_GLOBAL_INT_BIT0		0x00000001
1665