xref: /illumos-gate/usr/src/uts/common/io/aac/aac_regs.h (revision 3d393ee6c37fa10ac512ed6d36109ad616dc7c1a)
1 /*
2  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright 2005-06 Adaptec, Inc.
8  * Copyright (c) 2005-06 Adaptec Inc., Achim Leubner
9  * Copyright (c) 2000 Michael Smith
10  * Copyright (c) 2000-2001 Scott Long
11  * Copyright (c) 2000 BSDi
12  * All rights reserved.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  * 1. Redistributions of source code must retain the above copyright
18  *    notice, this list of conditions and the following disclaimer.
19  * 2. Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in the
21  *    documentation and/or other materials provided with the distribution.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  *    $FreeBSD: src/sys/dev/aac/aacreg.h,v 1.23 2005/10/14 16:22:45 scottl Exp $
36  */
37 
38 #ifndef	__AAC_REGS_H__
39 #define	__AAC_REGS_H__
40 
41 #ifdef	__cplusplus
42 extern "C" {
43 #endif
44 
45 /* Status bits in the doorbell registers */
46 #define	AAC_DB_SYNC_COMMAND		(1<<0)	/* send/completed synchronous */
47 						/* FIB */
48 #define	AAC_DB_COMMAND_READY		(1<<1)	/* posted one or more */
49 						/* commands */
50 #define	AAC_DB_RESPONSE_READY		(1<<2)	/* one or more commands	*/
51 						/* complete */
52 #define	AAC_DB_COMMAND_NOT_FULL		(1<<3)	/* command queue not full */
53 #define	AAC_DB_RESPONSE_NOT_FULL	(1<<4)	/* response queue not full */
54 #define	AAC_DB_PRINTF_READY		(1<<5)	/* adapter requests host */
55 						/* printf */
56 #define	AAC_DB_INTR_BITS (AAC_DB_COMMAND_READY | \
57 	AAC_DB_RESPONSE_READY | AAC_DB_PRINTF_READY)
58 #define	AAC_DB_INTR_NEW			0x08
59 
60 /* Status bits in firmware status reg */
61 #define	AAC_SELF_TEST_FAILED		0x00000004
62 #define	AAC_MONITOR_PANIC		0x00000020
63 #define	AAC_KERNEL_UP_AND_RUNNING	0x00000080
64 #define	AAC_KERNEL_PANIC		0x00000100
65 
66 /* aac registers definitions */
67 #define	AAC_OMR0		0x18	/* outbound message register 0 */
68 #define	AAC_OMR1		0x1c	/* outbound message register 1 */
69 #define	AAC_IDBR		0x20	/* inbound doorbell reg */
70 #define	AAC_ODBR		0x2c	/* outbound doorbell reg */
71 #define	AAC_OIMR		0x34	/* outbound interrupt mask reg */
72 #define	AAC_IRCSR		0x38	/* inbound dual cores reset (SRL) */
73 #define	AAC_IQUE		0x40	/* inbound queue */
74 #define	AAC_OQUE		0x44	/* outbound queue */
75 #define	AAC_RX_MAILBOX		0x50	/* mailbox, size=20bytes, rx */
76 #define	AAC_RX_FWSTATUS		0x6c	/* firmware status, rx */
77 #define	AAC_RKT_MAILBOX		0x1000	/* mailbox, size=20bytes, rkt */
78 #define	AAC_RKT_FWSTATUS	0x101c	/* firmware status, rkt */
79 
80 /* Synchronous commands to the monitor/kernel. */
81 #define	AAC_BREAKPOINT_REQ	0x04
82 #define	AAC_MONKER_INITSTRUCT	0x05
83 #define	AAC_MONKER_SYNCFIB	0x0c
84 #define	AAC_MONKER_GETKERNVER	0x11
85 #define	AAC_MONKER_GETINFO	0x19
86 #define	AAC_MONKER_GETDRVPROP	0x23
87 #define	AAC_MONKER_GETCOMMPREF	0x26
88 #define	AAC_IOP_RESET		0x1000
89 
90 /* Sunrise Lake dual core reset */
91 #define	AAC_IRCSR_CORES_RST	3
92 
93 #define	AAC_SECTOR_SIZE		512
94 #define	AAC_NUMBER_OF_HEADS	255
95 #define	AAC_SECTORS_PER_TRACK	63
96 #define	AAC_ROTATION_SPEED	10000
97 #define	AAC_MAX_PFN		0xfffff
98 
99 #define	AAC_ADDITIONAL_LEN	31
100 #define	AAC_ANSI_VER		2
101 #define	AAC_RESP_DATA_FORMAT	2
102 
103 #define	AAC_MAX_LD		64	/* max number of logical disks */
104 #define	AAC_MAX_PD(s)		((s)->bus_max * (s)->tgt_max)
105 #define	AAC_MAX_DEV(s)		(AAC_MAX_LD + AAC_MAX_PD((s)))
106 #define	AAC_BLK_SIZE		AAC_SECTOR_SIZE
107 #define	AAC_DMA_ALIGN		4
108 #define	AAC_DMA_ALIGN_MASK	(AAC_DMA_ALIGN - 1)
109 
110 #define	AAC_MAX_CONTAINERS	AAC_MAX_LD
111 
112 /*
113  * Minimum memory sizes we need to map to address the adapter. Before
114  * we know the actual size to map, minimum memory is used instead.
115  */
116 #define	AAC_MAP_SIZE_MIN_RX	4096
117 #define	AAC_MAP_SIZE_MIN_RKT	8192
118 
119 /*
120  * Options supported by the adapter
121  */
122 #define	AAC_SUPPORTED_SNAPSHOT			0x01
123 #define	AAC_SUPPORTED_CLUSTERS			0x02
124 #define	AAC_SUPPORTED_WRITE_CACHE		0x04
125 #define	AAC_SUPPORTED_64BIT_DATA		0x08
126 #define	AAC_SUPPORTED_HOST_TIME_FIB		0x10
127 #define	AAC_SUPPORTED_RAID50			0x20
128 #define	AAC_SUPPORTED_4GB_WINDOW		0x40
129 #define	AAC_SUPPORTED_SCSI_UPGRADEABLE		0x80
130 #define	AAC_SUPPORTED_SOFT_ERR_REPORT		0x100
131 #define	AAC_SUPPORTED_NOT_RECONDITION		0x200
132 #define	AAC_SUPPORTED_SGMAP_HOST64		0x400
133 #define	AAC_SUPPORTED_ALARM			0x800
134 #define	AAC_SUPPORTED_NONDASD			0x1000
135 #define	AAC_SUPPORTED_SCSI_MANAGED		0x2000
136 #define	AAC_SUPPORTED_RAID_SCSI_MODE		0x4000
137 #define	AAC_SUPPORTED_SUPPLEMENT_ADAPTER_INFO	0x10000
138 #define	AAC_SUPPORTED_NEW_COMM			0x20000
139 #define	AAC_SUPPORTED_64BIT_ARRAYSIZE		0x40000
140 #define	AAC_SUPPORTED_HEAT_SENSOR		0x80000
141 
142 #pragma	pack(1)
143 
144 /*
145  * FIB (FSA Interface Block) this is the data structure passed between
146  * the host and adapter.
147  */
148 struct aac_fib_header {
149 	uint32_t	XferState;
150 	uint16_t	Command;
151 	uint8_t		StructType;
152 	uint8_t		Flags;
153 	uint16_t	Size;
154 	uint16_t	SenderSize;
155 	uint32_t	SenderFibAddress;
156 	uint32_t	ReceiverFibAddress;
157 	uint32_t	SenderData;
158 	int prev;
159 	int next;
160 };
161 
162 /* FIB completed without error or no data was transferred in the FIB */
163 #define	AAC_SENDERADDR_MASK_FAST_RESPONSE	0x01
164 /* The received FIB is an AIF */
165 #define	AAC_SENDERADDR_MASK_AIF			0x02
166 
167 #define	AAC_FIB_SIZE		512 /* size of a fib block in byte */
168 #define	AAC_FIB_DATASIZE	(AAC_FIB_SIZE - sizeof (struct aac_fib_header))
169 
170 struct aac_fib {
171 	struct aac_fib_header	Header;
172 	uint8_t data[AAC_FIB_DATASIZE];
173 };
174 
175 /* FIB transfer state */
176 #define	AAC_FIBSTATE_HOSTOWNED		(1<<0)	/* owned by the host */
177 #define	AAC_FIBSTATE_ADAPTEROWNED	(1<<1)	/* owned by the adapter */
178 #define	AAC_FIBSTATE_INITIALISED	(1<<2)	/* has been initialised */
179 #define	AAC_FIBSTATE_EMPTY		(1<<3)	/* is empty now */
180 #define	AAC_FIBSTATE_FROMHOST		(1<<5)	/* sent from the host */
181 #define	AAC_FIBSTATE_FROMADAP		(1<<6)	/* sent from the adapter */
182 #define	AAC_FIBSTATE_REXPECTED		(1<<7)	/* response is expected */
183 #define	AAC_FIBSTATE_NOREXPECTED	(1<<8)	/* no response is expected */
184 #define	AAC_FIBSTATE_DONEADAP		(1<<9)	/* processed by the adapter */
185 #define	AAC_FIBSTATE_DONEHOST		(1<<10)	/* processed by the host */
186 #define	AAC_FIBSTATE_NORM		(1<<12)	/* normal priority */
187 #define	AAC_FIBSTATE_ASYNC		(1<<13)
188 #define	AAC_FIBSTATE_FAST_RESPONSE	(1<<19)	/* fast response capable */
189 
190 /* FIB types */
191 #define	AAC_FIBTYPE_TFIB		1
192 
193 /*
194  * FIB commands
195  */
196 
197 #define	TestCommandResponse		1
198 #define	TestAdapterCommand		2
199 /* Lowlevel and comm commands */
200 #define	LastTestCommand			100
201 #define	ReinitHostNormCommandQueue	101
202 #define	ReinitHostHighCommandQueue	102
203 #define	ReinitHostHighRespQueue		103
204 #define	ReinitHostNormRespQueue		104
205 #define	ReinitAdapNormCommandQueue	105
206 #define	ReinitAdapHighCommandQueue	107
207 #define	ReinitAdapHighRespQueue		108
208 #define	ReinitAdapNormRespQueue		109
209 #define	InterfaceShutdown		110
210 #define	DmaCommandFib			120
211 #define	StartProfile			121
212 #define	TermProfile			122
213 #define	SpeedTest			123
214 #define	TakeABreakPt			124
215 #define	RequestPerfData			125
216 #define	SetInterruptDefTimer		126
217 #define	SetInterruptDefCount		127
218 #define	GetInterruptDefStatus		128
219 #define	LastCommCommand			129
220 /* Filesystem commands */
221 #define	NuFileSystem			300
222 #define	UFS				301
223 #define	HostFileSystem			302
224 #define	LastFileSystemCommand		303
225 /* Container commands */
226 #define	ContainerCommand		500
227 #define	ContainerCommand64		501
228 #define	RawIo				502
229 /* Cluster commands */
230 #define	ClusterCommand			550
231 /* Scsi Port commands (scsi passthrough) */
232 #define	ScsiPortCommand			600
233 #define	ScsiPortCommandU64		601
234 /* Misc house keeping and generic adapter initiated commands */
235 #define	AifRequest			700
236 #define	CheckRevision			701
237 #define	FsaHostShutdown			702
238 #define	RequestAdapterInfo		703
239 #define	IsAdapterPaused			704
240 #define	SendHostTime			705
241 #define	RequestSupplementAdapterInfo	706
242 #define	LastMiscCommand			707
243 #define	OnLineDiagnostic		800
244 #define	FduAdapterTest			801
245 
246 /*
247  * Revision number handling
248  */
249 struct FsaRev {
250 	union {
251 		struct {
252 			uint8_t	dash;
253 			uint8_t	type;
254 			uint8_t	minor;
255 			uint8_t	major;
256 		} comp;
257 		uint32_t ul;
258 	} external;
259 	uint32_t buildNumber;
260 };
261 
262 /*
263  * Structures used to respond to a RequestAdapterInfo FIB
264  */
265 struct aac_adapter_info {
266 	uint32_t	PlatformBase;	/* adapter type */
267 	uint32_t	CpuArchitecture; /* adapter CPU type */
268 	uint32_t	CpuVariant;	/* adapter CPU subtype */
269 	uint32_t	ClockSpeed;	/* adapter CPU clockspeed */
270 	uint32_t	ExecutionMem;	/* adapter Execution Memory size */
271 	uint32_t	BufferMem;	/* adapter Data Memory */
272 	uint32_t	TotalMem;	/* adapter Total Memory */
273 	struct FsaRev	KernelRevision;	/* adapter Kernel Software Revision */
274 	struct FsaRev	MonitorRevision; /* adapter Monitor Software Revision */
275 	struct FsaRev	HardwareRevision;
276 	struct FsaRev	BIOSRevision;	/* adapter BIOS Revision */
277 	uint32_t	ClusteringEnabled;
278 	uint32_t	ClusterChannelMask;
279 	uint64_t	SerialNumber;
280 	uint32_t	batteryPlatform;
281 	uint32_t	SupportedOptions; /* supported features */
282 	uint32_t	OemVariant;
283 };
284 
285 /*
286  * The following definitions on Supplement Adapter Information
287  * come from Adaptec:
288  */
289 struct vpd_info {
290 	uint8_t		AssemblyPn[8];
291 	uint8_t		FruPn[8];
292 	uint8_t		BatteryFruPn[8];
293 	uint8_t		EcVersionString[8];
294 	uint8_t		Tsid[12];
295 };
296 
297 #define	MFG_PCBA_SERIAL_NUMBER_WIDTH	12
298 #define	MFG_WWN_WIDTH			8
299 
300 struct aac_supplement_adapter_info {
301 	/* The assigned Adapter Type Text, extra byte for null termination */
302 	int8_t		AdapterTypeText[17+1];
303 	/* Pad for the text above */
304 	int8_t		Pad[2];
305 	/* Size in bytes of the memory that is flashed */
306 	uint32_t	FlashMemoryByteSize;
307 	/* The assigned IMAGEID_xxx for this adapter */
308 	uint32_t	FlashImageId;
309 	/*
310 	 * The maximum number of Phys available on a SATA/SAS
311 	 * Controller, 0 otherwise
312 	 */
313 	uint32_t	MaxNumberPorts;
314 	/* Version of expansion area */
315 	uint32_t	Version;
316 	uint32_t	FeatureBits;
317 	uint8_t		SlotNumber;
318 	uint8_t		ReservedPad0[3];
319 	uint8_t		BuildDate[12];
320 	/* The current number of Ports on a SAS controller, 0 otherwise */
321 	uint32_t	CurrentNumberPorts;
322 
323 	struct vpd_info VpdInfo;
324 
325 	/* Firmware Revision (Vmaj.min-dash.) */
326 	struct FsaRev	FlashFirmwareRevision;
327 	uint32_t	RaidTypeMorphOptions;
328 	/* Firmware's boot code Revision (Vmaj.min-dash.) */
329 	struct FsaRev	FlashFirmwareBootRevision;
330 	/* PCBA serial no. from th MFG sector */
331 	uint8_t		MfgPcbaSerialNo[MFG_PCBA_SERIAL_NUMBER_WIDTH];
332 	/* WWN from the MFG sector */
333 	uint8_t		MfgWWNName[MFG_WWN_WIDTH];
334 	/* Growth Area for future expansion ((7*4) - 12 - 8)/4 = 2 words */
335 	uint32_t	ReservedGrowth[2];
336 };
337 
338 /* Container creation data */
339 struct aac_container_creation {
340 	uint8_t		ViaBuildNumber;
341 	uint8_t		MicroSecond;
342 	uint8_t		Via;		/* 1 = FSU, 2 = API, etc */
343 	uint8_t		Years;		/* Since1900 */
344 	uint32_t	Month:4;	/* 1-12 */
345 	uint32_t	Day:6;		/* 1-32 */
346 	uint32_t	Hour:6;		/* 0-23 */
347 	uint32_t	Minute:6;	/* 0-59 */
348 	uint32_t	Second:6;	/* 0-59 */
349 	uint64_t	ViaAdapterSerialNumber;
350 };
351 
352 struct aac_mntobj {
353 	uint32_t		ObjectId;
354 	char			FileSystemName[16];
355 	struct aac_container_creation	CreateInfo;
356 	uint32_t		Capacity;
357 	uint32_t		VolType;
358 	uint32_t		ObjType;
359 	uint32_t		ContentState;
360 	union {
361 		uint32_t	pad[8];
362 	} ObjExtension;
363 	uint32_t		AlterEgoId;
364 
365 	uint32_t		CapacityHigh; /* 64-bit LBA */
366 };
367 
368 struct aac_mntinfo {
369 	uint32_t	Command;
370 	uint32_t	MntType;
371 	uint32_t	MntCount;
372 };
373 
374 struct aac_mntinforesp {
375 	uint32_t		Status;
376 	uint32_t		MntType;
377 	uint32_t		MntRespCount;
378 	struct aac_mntobj	MntObj;
379 };
380 
381 /*
382  * Structures used to access physical drives
383  */
384 struct aac_bus_info {
385 	uint32_t	Command;	/* VM_Ioctl */
386 	uint32_t	ObjType;	/* FT_DRIVE */
387 	uint32_t	MethodId;	/* 1 = SCSI Layer */
388 	uint32_t	ObjectId;	/* Handle */
389 	uint32_t	CtlCmd;		/* GetBusInfo */
390 };
391 
392 struct aac_bus_info_response {
393 	uint32_t	Status;		/* ST_OK */
394 	uint32_t	ObjType;
395 	uint32_t	MethodId;	/* unused */
396 	uint32_t	ObjectId;	/* unused */
397 	uint32_t	CtlCmd;		/* unused */
398 	uint32_t	ProbeComplete;
399 	uint32_t	BusCount;
400 	uint32_t	TargetsPerBus;
401 	uint8_t		InitiatorBusId[10];
402 	uint8_t		BusValid[10];
403 };
404 
405 #define	CT_FIB_PARAMS			6
406 #define	MAX_FIB_PARAMS			10
407 #define	CT_PACKET_SIZE \
408 	(AAC_FIB_DATASIZE - sizeof (uint32_t) - \
409 	((sizeof (uint32_t)) * (MAX_FIB_PARAMS + 1)))
410 
411 #define	CNT_SIZE			5
412 
413 /* Container types */
414 typedef enum {
415 	CT_NONE = 0,
416 	CT_VOLUME,
417 	CT_MIRROR,
418 	CT_STRIPE,
419 	CT_RAID5,
420 	CT_SSRW,
421 	CT_SSRO,
422 	CT_MORPH,
423 	CT_PASSTHRU,
424 	CT_RAID4,
425 	CT_RAID10,		/* stripe of mirror */
426 	CT_RAID00,		/* stripe of stripe */
427 	CT_VOLUME_OF_MIRRORS,	/* volume of mirror */
428 	CT_PSEUDO_RAID3,	/* really raid4 */
429 	CT_RAID50,		/* stripe of raid5 */
430 	CT_RAID5D,		/* raid5 distributed hot-sparing */
431 	CT_RAID5D0,
432 	CT_RAID1E,		/* extended raid1 mirroring */
433 	CT_RAID6,
434 	CT_RAID60
435 } AAC_FSAVolType;
436 
437 /*
438  * Container Configuration Sub-Commands
439  */
440 typedef enum {
441 	CT_Null = 0,
442 	CT_GET_SLICE_COUNT,		/* 1 */
443 	CT_GET_PARTITION_COUNT,		/* 2 */
444 	CT_GET_PARTITION_INFO,		/* 3 */
445 	CT_GET_CONTAINER_COUNT,		/* 4 */
446 	CT_GET_CONTAINER_INFO_OLD,	/* 5 */
447 	CT_WRITE_MBR,			/* 6 */
448 	CT_WRITE_PARTITION,		/* 7 */
449 	CT_UPDATE_PARTITION,		/* 8 */
450 	CT_UNLOAD_CONTAINER,		/* 9 */
451 	CT_CONFIG_SINGLE_PRIMARY,	/* 10 */
452 	CT_READ_CONFIG_AGE,		/* 11 */
453 	CT_WRITE_CONFIG_AGE,		/* 12 */
454 	CT_READ_SERIAL_NUMBER,		/* 13 */
455 	CT_ZERO_PAR_ENTRY,		/* 14 */
456 	CT_READ_MBR,			/* 15 */
457 	CT_READ_PARTITION,		/* 16 */
458 	CT_DESTROY_CONTAINER,		/* 17 */
459 	CT_DESTROY2_CONTAINER,		/* 18 */
460 	CT_SLICE_SIZE,			/* 19 */
461 	CT_CHECK_CONFLICTS,		/* 20 */
462 	CT_MOVE_CONTAINER,		/* 21 */
463 	CT_READ_LAST_DRIVE,		/* 22 */
464 	CT_WRITE_LAST_DRIVE,		/* 23 */
465 	CT_UNMIRROR,			/* 24 */
466 	CT_MIRROR_DELAY,		/* 25 */
467 	CT_GEN_MIRROR,			/* 26 */
468 	CT_GEN_MIRROR2,			/* 27 */
469 	CT_TEST_CONTAINER,		/* 28 */
470 	CT_MOVE2,			/* 29 */
471 	CT_SPLIT,			/* 30 */
472 	CT_SPLIT2,			/* 31 */
473 	CT_SPLIT_BROKEN,		/* 32 */
474 	CT_SPLIT_BROKEN2,		/* 33 */
475 	CT_RECONFIG,			/* 34 */
476 	CT_BREAK2,			/* 35 */
477 	CT_BREAK,			/* 36 */
478 	CT_MERGE2,			/* 37 */
479 	CT_MERGE,			/* 38 */
480 	CT_FORCE_ERROR,			/* 39 */
481 	CT_CLEAR_ERROR,			/* 40 */
482 	CT_ASSIGN_FAILOVER,		/* 41 */
483 	CT_CLEAR_FAILOVER,		/* 42 */
484 	CT_GET_FAILOVER_DATA,		/* 43 */
485 	CT_VOLUME_ADD,			/* 44 */
486 	CT_VOLUME_ADD2,			/* 45 */
487 	CT_MIRROR_STATUS,		/* 46 */
488 	CT_COPY_STATUS,			/* 47 */
489 	CT_COPY,			/* 48 */
490 	CT_UNLOCK_CONTAINER,		/* 49 */
491 	CT_LOCK_CONTAINER,		/* 50 */
492 	CT_MAKE_READ_ONLY,		/* 51 */
493 	CT_MAKE_READ_WRITE,		/* 52 */
494 	CT_CLEAN_DEAD,			/* 53 */
495 	CT_ABORT_MIRROR_COMMAND,	/* 54 */
496 	CT_SET,				/* 55 */
497 	CT_GET,				/* 56 */
498 	CT_GET_NVLOG_ENTRY,		/* 57 */
499 	CT_GET_DELAY,			/* 58 */
500 	CT_ZERO_CONTAINER_SPACE,	/* 59 */
501 	CT_GET_ZERO_STATUS,		/* 60 */
502 	CT_SCRUB,			/* 61 */
503 	CT_GET_SCRUB_STATUS,		/* 62 */
504 	CT_GET_SLICE_INFO,		/* 63 */
505 	CT_GET_SCSI_METHOD,		/* 64 */
506 	CT_PAUSE_IO,			/* 65 */
507 	CT_RELEASE_IO,			/* 66 */
508 	CT_SCRUB2,			/* 67 */
509 	CT_MCHECK,			/* 68 */
510 	CT_CORRUPT,			/* 69 */
511 	CT_GET_TASK_COUNT,		/* 70 */
512 	CT_PROMOTE,			/* 71 */
513 	CT_SET_DEAD,			/* 72 */
514 	CT_CONTAINER_OPTIONS,		/* 73 */
515 	CT_GET_NV_PARAM,		/* 74 */
516 	CT_GET_PARAM,			/* 75 */
517 	CT_NV_PARAM_SIZE,		/* 76 */
518 	CT_COMMON_PARAM_SIZE,		/* 77 */
519 	CT_PLATFORM_PARAM_SIZE,		/* 78 */
520 	CT_SET_NV_PARAM,		/* 79 */
521 	CT_ABORT_SCRUB,			/* 80 */
522 	CT_GET_SCRUB_ERROR,		/* 81 */
523 	CT_LABEL_CONTAINER,		/* 82 */
524 	CT_CONTINUE_DATA,		/* 83 */
525 	CT_STOP_DATA,			/* 84 */
526 	CT_GET_PARTITION_TABLE,		/* 85 */
527 	CT_GET_DISK_PARTITIONS,		/* 86 */
528 	CT_GET_MISC_STATUS,		/* 87 */
529 	CT_GET_CONTAINER_PERF_INFO,	/* 88 */
530 	CT_GET_TIME,			/* 89 */
531 	CT_READ_DATA,			/* 90 */
532 	CT_CTR,				/* 91 */
533 	CT_CTL,				/* 92 */
534 	CT_DRAINIO,			/* 93 */
535 	CT_RELEASEIO,			/* 94 */
536 	CT_GET_NVRAM,			/* 95 */
537 	CT_GET_MEMORY,			/* 96 */
538 	CT_PRINT_CT_LOG,		/* 97 */
539 	CT_ADD_LEVEL,			/* 98 */
540 	CT_NV_ZERO,			/* 99 */
541 	CT_READ_SIGNATURE,		/* 100 */
542 	CT_THROTTLE_ON,			/* 101 */
543 	CT_THROTTLE_OFF,		/* 102 */
544 	CT_GET_THROTTLE_STATS,		/* 103 */
545 	CT_MAKE_SNAPSHOT,		/* 104 */
546 	CT_REMOVE_SNAPSHOT,		/* 105 */
547 	CT_WRITE_USER_FLAGS,		/* 106 */
548 	CT_READ_USER_FLAGS,		/* 107 */
549 	CT_MONITOR,			/* 108 */
550 	CT_GEN_MORPH,			/* 109 */
551 	CT_GET_SNAPSHOT_INFO,		/* 110 */
552 	CT_CACHE_SET,			/* 111 */
553 	CT_CACHE_STAT,			/* 112 */
554 	CT_TRACE_START,			/* 113 */
555 	CT_TRACE_STOP,			/* 114 */
556 	CT_TRACE_ENABLE,		/* 115 */
557 	CT_TRACE_DISABLE,		/* 116 */
558 	CT_FORCE_CORE_DUMP,		/* 117 */
559 	CT_SET_SERIAL_NUMBER,		/* 118 */
560 	CT_RESET_SERIAL_NUMBER,		/* 119 */
561 	CT_ENABLE_RAID5,		/* 120 */
562 	CT_CLEAR_VALID_DUMP_FLAG,	/* 121 */
563 	CT_GET_MEM_STATS,		/* 122 */
564 	CT_GET_CORE_SIZE,		/* 123 */
565 	CT_CREATE_CONTAINER_OLD,	/* 124 */
566 	CT_STOP_DUMPS,			/* 125 */
567 	CT_PANIC_ON_TAKE_A_BREAK,	/* 126 */
568 	CT_GET_CACHE_STATS,		/* 127 */
569 	CT_MOVE_PARTITION,		/* 128 */
570 	CT_FLUSH_CACHE,			/* 129 */
571 	CT_READ_NAME,			/* 130 */
572 	CT_WRITE_NAME,			/* 131 */
573 	CT_TOSS_CACHE,			/* 132 */
574 	CT_LOCK_DRAINIO,		/* 133 */
575 	CT_CONTAINER_OFFLINE,		/* 134 */
576 	CT_SET_CACHE_SIZE,		/* 135 */
577 	CT_CLEAN_SHUTDOWN_STATUS,	/* 136 */
578 	CT_CLEAR_DISKLOG_ON_DISK,	/* 137 */
579 	CT_CLEAR_ALL_DISKLOG,		/* 138 */
580 	CT_CACHE_FAVOR,			/* 139 */
581 	CT_READ_PASSTHRU_MBR,		/* 140 */
582 	CT_SCRUB_NOFIX,			/* 141 */
583 	CT_SCRUB2_NOFIX,		/* 142 */
584 	CT_FLUSH,			/* 143 */
585 	CT_REBUILD,	/* 144 rma, not really a command, partner to CT_SCRUB */
586 	CT_FLUSH_CONTAINER,		/* 145 */
587 	CT_RESTART,			/* 146 */
588 	CT_GET_CONFIG_STATUS,		/* 147 */
589 	CT_TRACE_FLAG,			/* 148 */
590 	CT_RESTART_MORPH,		/* 149 */
591 	CT_GET_TRACE_INFO,		/* 150 */
592 	CT_GET_TRACE_ITEM,		/* 151 */
593 	CT_COMMIT_CONFIG,		/* 152 */
594 	CT_CONTAINER_EXISTS,		/* 153 */
595 	CT_GET_SLICE_FROM_DEVT,		/* 154 */
596 	CT_OPEN_READ_WRITE,		/* 155 */
597 	CT_WRITE_MEMORY_BLOCK,		/* 156 */
598 	CT_GET_CACHE_PARAMS,		/* 157 */
599 	CT_CRAZY_CACHE,			/* 158 */
600 	CT_GET_PROFILE_STRUCT,		/* 159 */
601 	CT_SET_IO_TRACE_FLAG,		/* 160 */
602 	CT_GET_IO_TRACE_STRUCT,		/* 161 */
603 	CT_CID_TO_64BITS_UID,		/* 162 */
604 	CT_64BITS_UID_TO_CID,		/* 163 */
605 	CT_PAR_TO_64BITS_UID,		/* 164 */
606 	CT_CID_TO_32BITS_UID,		/* 165 */
607 	CT_32BITS_UID_TO_CID,		/* 166 */
608 	CT_PAR_TO_32BITS_UID,		/* 167 */
609 	CT_SET_FAILOVER_OPTION,		/* 168 */
610 	CT_GET_FAILOVER_OPTION,		/* 169 */
611 	CT_STRIPE_ADD2,			/* 170 */
612 	CT_CREATE_VOLUME_SET,		/* 171 */
613 	CT_CREATE_STRIPE_SET,		/* 172 */
614 	/* 173	command and partner to scrub and rebuild task types */
615 	CT_VERIFY_CONTAINER,
616 	CT_IS_CONTAINER_DEAD,		/* 174 */
617 	CT_GET_CONTAINER_OPTION,	/* 175 */
618 	CT_GET_SNAPSHOT_UNUSED_STRUCT,	/* 176 */
619 	CT_CLEAR_SNAPSHOT_UNUSED_STRUCT,	/* 177 */
620 	CT_GET_CONTAINER_INFO,		/* 178 */
621 	CT_CREATE_CONTAINER,		/* 179 */
622 	CT_CHANGE_CREATIONINFO,		/* 180 */
623 	CT_CHECK_CONFLICT_UID,		/* 181 */
624 	CT_CONTAINER_UID_CHECK,		/* 182 */
625 
626 	/* 183 :RECmm: 20011220 added to support the Babylon */
627 	CT_IS_CONTAINER_MEATADATA_STANDARD,
628 	/* 184 :RECmm: 20011220 array imports */
629 	CT_IS_SLICE_METADATA_STANDARD,
630 
631 	/* :BIOS_TEST: */
632 	/* 185 :RECmm: 20020116	added to support BIOS interface for */
633 	CT_GET_IMPORT_COUNT,
634 	/* 186 :RECmm: 20020116	metadata conversion */
635 	CT_CANCEL_ALL_IMPORTS,
636 	CT_GET_IMPORT_INFO,		/* 187 :RECmm: 20020116	" */
637 	CT_IMPORT_ARRAY,		/* 188 :RECmm: 20020116	" */
638 	CT_GET_LOG_SIZE,		/* 189  */
639 
640 	/* Not BIOS TEST */
641 	CT_ALARM_GET_STATE,		/* 190 */
642 	CT_ALARM_SET_STATE,		/* 191 */
643 	CT_ALARM_ON_OFF,		/* 192 */
644 
645 	CT_GET_EE_OEM_ID,		/* 193 */
646 
647 	CT_GET_PPI_HEADERS,		/* 194  get header fields only */
648 	CT_GET_PPI_DATA,		/* 195  get all ppitable.data */
649 	/* 196  get only range of entries specified in c_params */
650 	CT_GET_PPI_ENTRIES,
651 	/* 197  remove ppitable bundle specified by uid in c_param0 */
652 	CT_DELETE_PPI_BUNDLE,
653 
654 	/* 198  current partition structure (not legacy) */
655 	CT_GET_PARTITION_TABLE_2,
656 	CT_GET_PARTITION_INFO_2,
657 	CT_GET_DISK_PARTITIONS_2,
658 
659 	CT_QUIESCE_ADAPTER,		/* 201  chill dude */
660 	CT_CLEAR_PPI_TABLE,		/* 202  clear ppi table */
661 
662 	CT_SET_DEVICE_CACHE_POLICY,	/* 203 */
663 	CT_GET_DEVICE_CACHE_POLICY,	/* 204 */
664 
665 	CT_SET_VERIFY_DELAY,		/* 205 */
666 	CT_GET_VERIFY_DELAY,		/* 206 */
667 
668 	/* 207 delete all PPI bundles that have an entry for device at devt */
669 	CT_DELETE_PPI_BUNDLES_FOR_DEVT,
670 
671 	CT_READ_SW_SECTOR,		/* 208 */
672 	CT_WRITE_SW_SECTOR,		/* 209 */
673 
674 	/* 210 added to support firmware cache sync operations */
675 	CT_GET_CACHE_SYNC_INFO,
676 	CT_SET_CACHE_SYNC_MODE,		/* 211 */
677 
678 	CT_LAST_COMMAND			/* last command */
679 } AAC_CTCommand;
680 
681 /* General return status */
682 #define	CT_OK				218
683 
684 struct aac_fsa_ctm {
685 	uint32_t	command;
686 	uint32_t	param[CT_FIB_PARAMS];
687 	int8_t		data[CT_PACKET_SIZE];
688 };
689 
690 struct aac_Container {
691 	uint32_t		Command;
692 	struct aac_fsa_ctm	CTCommand;
693 };
694 
695 struct aac_fsa_ctr {
696 	uint32_t	response;
697 	uint32_t	param[CT_FIB_PARAMS];
698 	int8_t		data[CT_PACKET_SIZE];
699 };
700 
701 struct aac_Container_resp {
702 	uint32_t		Status;
703 	struct aac_fsa_ctr	CTResponse;
704 };
705 
706 struct aac_cf_status_header {
707 	uint32_t	action;
708 	uint16_t	flags;
709 	int16_t		recordcount;
710 };
711 
712 enum aac_cf_action_type {
713 	CFACT_CONTINUE = 0,		/* Continue without pause */
714 	CFACT_PAUSE,			/* Pause, then continue */
715 	CFACT_ABORT			/* Abort */
716 };
717 
718 enum aac_mpe {
719 	AACMPE_OK = 0x0,
720 	AACMPE_GET_CONFIG_STATUS = 0x1,
721 	AACMPE_CONFIG_STATUS = 0x2,
722 	AACMPE_COMMIT_CONFIG = 0x3
723 };
724 
725 /*
726  * CT_PAUSE_IO is immediate minimal runtime command that is used
727  * to restart the applications and cache.
728  */
729 struct aac_pause_command {
730 	uint32_t	Command;
731 	uint32_t	Type;
732 	uint32_t	Timeout;
733 	uint32_t	Min;
734 	uint32_t	NoRescan;
735 	uint32_t	Parm3;
736 	uint32_t	Parm4;
737 	uint32_t	Count;
738 };
739 
740 /*
741  * The following two definitions come from Adaptec:
742  *
743  * Used to flush drive cache for container "cid"
744  */
745 struct aac_synchronize_command {
746 	uint32_t	Command;	/* VM_ContainerConfig */
747 	uint32_t	Type;		/* CT_FLUSH_CACHE */
748 	uint32_t	Cid;
749 	uint32_t	Parm1;
750 	uint32_t	Parm2;
751 	uint32_t	Parm3;
752 	uint32_t	Parm4;
753 	uint32_t	Count;
754 };
755 
756 struct aac_synchronize_reply {
757 	uint32_t	Dummy0;
758 	uint32_t	Dummy1;
759 	uint32_t	Status;
760 	uint32_t	Parm1;
761 	uint32_t	Parm2;
762 	uint32_t	Parm3;
763 	uint32_t	Parm4;
764 	uint32_t	Parm5;
765 	uint8_t		Data[16];
766 };
767 
768 /*
769  * Command status values
770  */
771 typedef enum {
772 	ST_OK = 0,
773 	ST_PERM = 1,
774 	ST_NOENT = 2,
775 	ST_IO = 5,
776 	ST_NXIO = 6,
777 	ST_E2BIG = 7,
778 	ST_ACCES = 13,
779 	ST_EXIST = 17,
780 	ST_XDEV = 18,
781 	ST_NODEV = 19,
782 	ST_NOTDIR = 20,
783 	ST_ISDIR = 21,
784 	ST_INVAL = 22,
785 	ST_FBIG = 27,
786 	ST_NOSPC = 28,
787 	ST_ROFS = 30,
788 	ST_MLINK = 31,
789 	ST_WOULDBLOCK = 35,
790 	ST_NAMETOOLONG = 63,
791 	ST_NOTEMPTY = 66,
792 	ST_DQUOT = 69,
793 	ST_STALE = 70,
794 	ST_REMOTE = 71,
795 	ST_BADHANDLE = 10001,
796 	ST_NOT_SYNC = 10002,
797 	ST_BAD_COOKIE = 10003,
798 	ST_NOTSUPP = 10004,
799 	ST_TOOSMALL = 10005,
800 	ST_SERVERFAULT = 10006,
801 	ST_BADTYPE = 10007,
802 	ST_JUKEBOX = 10008,
803 	ST_NOTMOUNTED = 10009,
804 	ST_MAINTMODE = 10010,
805 	ST_STALEACL = 10011
806 } AAC_FSAStatus;
807 
808 /*
809  * Object-Server / Volume-Manager Dispatch Classes
810  */
811 typedef enum {
812 	VM_Null = 0,
813 	VM_NameServe,
814 	VM_ContainerConfig,
815 	VM_Ioctl,
816 	VM_FilesystemIoctl,
817 	VM_CloseAll,
818 	VM_CtBlockRead,
819 	VM_CtBlockWrite,
820 	VM_SliceBlockRead,	/* raw access to configured "storage objects" */
821 	VM_SliceBlockWrite,
822 	VM_DriveBlockRead,	/* raw access to physical devices */
823 	VM_DriveBlockWrite,
824 	VM_EnclosureMgt,	/* enclosure management */
825 	VM_Unused,		/* used to be diskset management */
826 	VM_CtBlockVerify,
827 	VM_CtPerf,		/* performance test */
828 	VM_CtBlockRead64,
829 	VM_CtBlockWrite64,
830 	VM_CtBlockVerify64,
831 	VM_CtHostRead64,
832 	VM_CtHostWrite64,
833 	VM_NameServe64 = 22,
834 	MAX_VMCOMMAND_NUM	/* used for sizing stats array - leave last */
835 } AAC_VMCommand;
836 
837 /*
838  * Host-addressable object types
839  */
840 typedef enum {
841 	FT_REG = 1,	/* regular file */
842 	FT_DIR,		/* directory */
843 	FT_BLK,		/* "block" device - reserved */
844 	FT_CHR,		/* "character special" device - reserved */
845 	FT_LNK,		/* symbolic link */
846 	FT_SOCK,	/* socket */
847 	FT_FIFO,	/* fifo */
848 	FT_FILESYS,	/* ADAPTEC's "FSA"(tm) filesystem */
849 	FT_DRIVE,	/* physical disk - addressable in scsi by b/t/l */
850 	FT_SLICE,	/* virtual disk - raw volume - slice */
851 	FT_PARTITION,	/* FSA partition - carved out of a slice - building */
852 			/* block for containers */
853 	FT_VOLUME,	/* Container - Volume Set */
854 	FT_STRIPE,	/* Container - Stripe Set */
855 	FT_MIRROR,	/* Container - Mirror Set */
856 	FT_RAID5,	/* Container - Raid 5 Set */
857 	FT_DATABASE	/* Storage object with "foreign" content manager */
858 } AAC_FType;
859 
860 /* Host-side scatter/gather list for 32-bit, 64-bit, raw commands */
861 struct aac_sg_entry {
862 	uint32_t	SgAddress;
863 	uint32_t	SgByteCount;
864 };
865 
866 struct aac_sg_entry64 {
867 	uint64_t	SgAddress;
868 	uint32_t	SgByteCount;
869 };
870 
871 struct aac_sg_entryraw {
872 	uint32_t	Next;		/* reserved */
873 	uint32_t	Prev;		/* reserved */
874 	uint64_t	SgAddress;
875 	uint32_t	SgByteCount;
876 	uint32_t	Flags;		/* reserved */
877 };
878 
879 struct aac_sg_table {
880 	uint32_t		SgCount;
881 	struct aac_sg_entry	SgEntry[1]; /* at least there is one */
882 					    /* SUN's CC cannot accept [0] */
883 };
884 
885 struct aac_sg_table64 {
886 	uint32_t		SgCount;
887 	struct aac_sg_entry64	SgEntry64[1];
888 };
889 
890 struct aac_sg_tableraw {
891 	uint32_t		SgCount;
892 	struct aac_sg_entryraw	SgEntryRaw[1];
893 };
894 
895 /*
896  * Block read/write operations.
897  * These structures are packed into the 'data' area in the FIB.
898  */
899 struct aac_blockread {
900 	uint32_t		Command;
901 	uint32_t		ContainerId;
902 	uint32_t		BlockNumber;
903 	uint32_t		ByteCount;
904 	struct aac_sg_table	SgMap;
905 };
906 
907 struct aac_blockread64 {
908 	uint32_t		Command;
909 	uint16_t		ContainerId;
910 	uint16_t		SectorCount;
911 	uint32_t		BlockNumber;
912 	uint16_t		Pad;
913 	uint16_t		Flags;
914 	struct aac_sg_table64	SgMap64;
915 };
916 
917 struct aac_blockread_response {
918 	uint32_t		Status;
919 	uint32_t		ByteCount;
920 };
921 
922 struct aac_blockwrite {
923 	uint32_t		Command;
924 	uint32_t		ContainerId;
925 	uint32_t		BlockNumber;
926 	uint32_t		ByteCount;
927 	uint32_t		Stable;
928 	struct aac_sg_table	SgMap;
929 };
930 
931 struct aac_blockwrite64 {
932 	uint32_t		Command;
933 	uint16_t		ContainerId;
934 	uint16_t		SectorCount;
935 	uint32_t		BlockNumber;
936 	uint16_t		Pad;
937 	uint16_t		Flags;
938 	struct aac_sg_table64	SgMap64;
939 };
940 
941 struct aac_blockwrite_response {
942 	uint32_t		Status;
943 	uint32_t		ByteCount;
944 	uint32_t		Committed;
945 };
946 
947 struct aac_raw_io {
948 	uint64_t		BlockNumber;
949 	uint32_t		ByteCount;
950 	uint16_t		ContainerId;
951 	uint16_t		Flags;		/* 0: W, 1: R */
952 	uint16_t		BpTotal;	/* reserved */
953 	uint16_t		BpComplete;	/* reserved */
954 	struct aac_sg_tableraw	SgMapRaw;
955 };
956 
957 /*
958  * Container shutdown command.
959  */
960 struct aac_close_command {
961 	uint32_t		Command;
962 	uint32_t		ContainerId;
963 };
964 
965 /*
966  * Container Config Command
967  */
968 struct aac_ctcfg {
969 	uint32_t		Command;
970 	uint32_t		cmd;
971 	uint32_t		param;
972 };
973 
974 struct aac_ctcfg_resp {
975 	uint32_t		Status;
976 	uint32_t		resp;
977 	uint32_t		param;
978 };
979 
980 /* Write 'stability' options */
981 #define	CSTABLE			1
982 #define	CUNSTABLE		2
983 
984 /* Number of FIBs for the controller to send us messages */
985 #define	AAC_ADAPTER_FIBS	8
986 
987 /* Number of FIBs for the host I/O request */
988 #define	AAC_HOST_FIBS		256
989 
990 /* Size of buffer for text messages from the controller */
991 #define	AAC_ADAPTER_PRINT_BUFSIZE		256
992 
993 #define	AAC_INIT_STRUCT_REVISION		3
994 #define	AAC_INIT_STRUCT_REVISION_4		4
995 #define	AAC_INIT_STRUCT_MINIPORT_REVISION	1
996 #define	AAC_INIT_FLAGS_NEW_COMM_SUPPORTED	1
997 #define	AAC_PAGE_SIZE				4096
998 struct aac_adapter_init {
999 	uint32_t	InitStructRevision;
1000 	uint32_t	MiniPortRevision;
1001 	uint32_t	FilesystemRevision;
1002 	uint32_t	CommHeaderAddress;
1003 	uint32_t	FastIoCommAreaAddress;
1004 	uint32_t	AdapterFibsPhysicalAddress;
1005 	uint32_t	AdapterFibsVirtualAddress;
1006 	uint32_t	AdapterFibsSize;
1007 	uint32_t	AdapterFibAlign;
1008 	uint32_t	PrintfBufferAddress;
1009 	uint32_t	PrintfBufferSize;
1010 	uint32_t	HostPhysMemPages;
1011 	uint32_t	HostElapsedSeconds;
1012 	/* ADAPTER_INIT_STRUCT_REVISION_4 begins here */
1013 	uint32_t	InitFlags;
1014 	uint32_t	MaxIoCommands;
1015 	uint32_t	MaxIoSize;
1016 	uint32_t	MaxFibSize;
1017 };
1018 
1019 /* ************AAC QUEUE DEFINES (BELOW)*********** */
1020 
1021 #define	AAC_QUEUE_ALIGN		16
1022 #define	AAC_QUEUE_COUNT		8
1023 #define	AAC_PRODUCER_INDEX	0
1024 #define	AAC_CONSUMER_INDEX	1
1025 
1026 struct aac_queue_entry {
1027 	uint32_t aq_fib_size;	/* FIB size in bytes */
1028 	uint32_t aq_fib_addr;	/* receiver-space address of the FIB */
1029 };
1030 
1031 /*
1032  * Queue names
1033  *
1034  * Note that we base these at 0 in order to use them as array indices.
1035  * Adaptec used base 1 for some unknown reason, and sorted them in a
1036  * different order.
1037  */
1038 #define	AAC_HOST_NORM_CMD_Q	0
1039 #define	AAC_HOST_HIGH_CMD_Q	1
1040 #define	AAC_ADAP_NORM_CMD_Q	2
1041 #define	AAC_ADAP_HIGH_CMD_Q	3
1042 #define	AAC_HOST_NORM_RESP_Q	4
1043 #define	AAC_HOST_HIGH_RESP_Q	5
1044 #define	AAC_ADAP_NORM_RESP_Q	6
1045 #define	AAC_ADAP_HIGH_RESP_Q	7
1046 
1047 /*
1048  * We establish 4 command queues and matching response queues. Queues must
1049  * be 16-byte aligned, and are sized as follows:
1050  */
1051 /* command adapter->host, normal priority */
1052 #define	AAC_HOST_NORM_CMD_ENTRIES	8
1053 /* command adapter->host, high priority */
1054 #define	AAC_HOST_HIGH_CMD_ENTRIES	4
1055 /* command host->adapter, normal priority */
1056 #define	AAC_ADAP_NORM_CMD_ENTRIES	512
1057 /* command host->adapter, high priority */
1058 #define	AAC_ADAP_HIGH_CMD_ENTRIES	4
1059 /* response, adapter->host, normal priority */
1060 #define	AAC_HOST_NORM_RESP_ENTRIES	512
1061 /* response, adapter->host, high priority */
1062 #define	AAC_HOST_HIGH_RESP_ENTRIES	4
1063 /* response, host->adapter, normal priority */
1064 #define	AAC_ADAP_NORM_RESP_ENTRIES	8
1065 /* response, host->adapter, high priority */
1066 #define	AAC_ADAP_HIGH_RESP_ENTRIES	4
1067 
1068 #define	AAC_TOTALQ_LENGTH	(AAC_HOST_HIGH_CMD_ENTRIES + \
1069 				AAC_HOST_NORM_CMD_ENTRIES + \
1070 				AAC_ADAP_HIGH_CMD_ENTRIES + \
1071 				AAC_ADAP_NORM_CMD_ENTRIES + \
1072 				AAC_HOST_HIGH_RESP_ENTRIES + \
1073 				AAC_HOST_NORM_RESP_ENTRIES + \
1074 				AAC_ADAP_HIGH_RESP_ENTRIES + \
1075 				AAC_ADAP_NORM_RESP_ENTRIES)
1076 
1077 /*
1078  * Table of queue indices and queues used to communicate with the
1079  * controller. This structure must be aligned to AAC_QUEUE_ALIGN.
1080  */
1081 struct aac_queue_table {
1082 	/* queue consumer/producer indexes (layout mandated by adapter) */
1083 	uint32_t qt_qindex[AAC_QUEUE_COUNT][2];
1084 
1085 	/* queue entry structures (layout mandated by adapter) */
1086 	struct aac_queue_entry qt_HostNormCmdQueue \
1087 	    [AAC_HOST_NORM_CMD_ENTRIES];
1088 	struct aac_queue_entry qt_HostHighCmdQueue \
1089 	    [AAC_HOST_HIGH_CMD_ENTRIES];
1090 	struct aac_queue_entry qt_AdapNormCmdQueue \
1091 	    [AAC_ADAP_NORM_CMD_ENTRIES];
1092 	struct aac_queue_entry qt_AdapHighCmdQueue \
1093 	    [AAC_ADAP_HIGH_CMD_ENTRIES];
1094 	struct aac_queue_entry qt_HostNormRespQueue \
1095 	    [AAC_HOST_NORM_RESP_ENTRIES];
1096 	struct aac_queue_entry qt_HostHighRespQueue \
1097 	    [AAC_HOST_HIGH_RESP_ENTRIES];
1098 	struct aac_queue_entry qt_AdapNormRespQueue \
1099 	    [AAC_ADAP_NORM_RESP_ENTRIES];
1100 	struct aac_queue_entry qt_AdapHighRespQueue \
1101 	    [AAC_ADAP_HIGH_RESP_ENTRIES];
1102 };
1103 /* ************AAC QUEUE DEFINES (ABOVE)*********** */
1104 
1105 /*
1106  * NVRAM/Write Cache subsystem battery component states
1107  */
1108 typedef enum {
1109 	NVBATTSTATUS_NONE = 0,	/* battery has no power or is not present */
1110 	NVBATTSTATUS_LOW,	/* battery is low on power */
1111 	NVBATTSTATUS_OK,	/* battery is okay - normal operation */
1112 				/* possible only in this state */
1113 	NVBATTSTATUS_RECONDITIONING	/* no battery present */
1114 					/* - reconditioning in process */
1115 } AAC_NVBATTSTATUS;
1116 
1117 /*
1118  * Battery transition type
1119  */
1120 typedef enum {
1121 	NVBATT_TRANSITION_NONE = 0,	/* battery now has no power or is not */
1122 					/* present */
1123 	NVBATT_TRANSITION_LOW,	/* battery is now low on power */
1124 	NVBATT_TRANSITION_OK	/* battery is now okay - normal */
1125 				/* operation possible only in this state */
1126 } AAC_NVBATT_TRANSITION;
1127 
1128 /*
1129  * Data types relating to AIFs
1130  */
1131 
1132 /*
1133  * Progress Reports
1134  */
1135 typedef enum {
1136 	AifJobStsSuccess = 1,
1137 	AifJobStsFinished,
1138 	AifJobStsAborted,
1139 	AifJobStsFailed,
1140 	AifJobStsLastReportMarker = 100,	/* All prior mean last report */
1141 	AifJobStsSuspended,
1142 	AifJobStsRunning
1143 } AAC_AifJobStatus;
1144 
1145 typedef enum {
1146 	AifJobScsiMin = 1,	/* Minimum value for Scsi operation */
1147 	AifJobScsiZero,		/* SCSI device clear operation */
1148 	AifJobScsiVerify,	/* SCSI device Verify operation NO REPAIR */
1149 	AifJobScsiExercise,	/* SCSI device Exercise operation */
1150 	AifJobScsiVerifyRepair,	/* SCSI device Verify operation WITH repair */
1151 	AifJobScsiWritePattern,	/* write pattern */
1152 	AifJobScsiMax = 99,	/* Max Scsi value */
1153 	AifJobCtrMin,		/* Min Ctr op value */
1154 	AifJobCtrZero,		/* Container clear operation */
1155 	AifJobCtrCopy,		/* Container copy operation */
1156 	AifJobCtrCreateMirror,	/* Container Create Mirror operation */
1157 	AifJobCtrMergeMirror,	/* Container Merge Mirror operation */
1158 	AifJobCtrScrubMirror,	/* Container Scrub Mirror operation */
1159 	AifJobCtrRebuildRaid5,	/* Container Rebuild Raid5 operation */
1160 	AifJobCtrScrubRaid5,	/* Container Scrub Raid5 operation */
1161 	AifJobCtrMorph,		/* Container morph operation */
1162 	AifJobCtrPartCopy,	/* Container Partition copy operation */
1163 	AifJobCtrRebuildMirror,	/* Container Rebuild Mirror operation */
1164 	AifJobCtrCrazyCache,	/* crazy cache */
1165 	AifJobCtrCopyback,	/* Container Copyback operation */
1166 	AifJobCtrCompactRaid5D,	/* Container Compaction operation */
1167 	AifJobCtrExpandRaid5D,	/* Container Expansion operation */
1168 	AifJobCtrRebuildRaid6,	/* Container Rebuild Raid6 operation */
1169 	AifJobCtrScrubRaid6,	/* Container Scrub Raid6 operation */
1170 	AifJobCtrSSBackup,	/* Container snapshot backup task */
1171 	AifJobCtrMax = 199,	/* Max Ctr type operation */
1172 	AifJobFsMin,		/* Min Fs type operation */
1173 	AifJobFsCreate,		/* File System Create operation */
1174 	AifJobFsVerify,		/* File System Verify operation */
1175 	AifJobFsExtend,		/* File System Extend operation */
1176 	AifJobFsMax = 299,	/* Max Fs type operation */
1177 	AifJobApiFormatNTFS,	/* Format a drive to NTFS */
1178 	AifJobApiFormatFAT,	/* Format a drive to FAT */
1179 	AifJobApiUpdateSnapshot, /* update the read/write half of a snapshot */
1180 	AifJobApiFormatFAT32,	/* Format a drive to FAT32 */
1181 	AifJobApiMax = 399,		/* Max API type operation */
1182 	AifJobCtlContinuousCtrVerify,	/* Adapter operation */
1183 	AifJobCtlMax = 499		/* Max Adapter type operation */
1184 } AAC_AifJobType;
1185 
1186 struct aac_AifContainers {
1187 	uint32_t	src;		/* from/master */
1188 	uint32_t	dst;		/* to/slave */
1189 };
1190 
1191 union aac_AifJobClient {
1192 	struct aac_AifContainers container;	/* For Container and */
1193 						/* filesystem progress ops */
1194 	int32_t scsi_dh;			/* For SCSI progress ops */
1195 };
1196 
1197 struct aac_AifJobDesc {
1198 	uint32_t	jobID;	/* DO NOT FILL IN! Will be filled in by AIF */
1199 	AAC_AifJobType	type;	/* Operation that is being performed */
1200 	union aac_AifJobClient	client;	/* Details */
1201 };
1202 
1203 struct aac_AifJobProgressReport {
1204 	struct aac_AifJobDesc	jd;
1205 	AAC_AifJobStatus	status;
1206 	uint32_t		finalTick;
1207 	uint32_t		currentTick;
1208 	uint32_t		jobSpecificData1;
1209 	uint32_t		jobSpecificData2;
1210 };
1211 
1212 /*
1213  * Event Notification
1214  */
1215 typedef enum {
1216 	/* General application notifies start here */
1217 	AifEnGeneric = 1,	/* Generic notification */
1218 	AifEnTaskComplete,	/* Task has completed */
1219 	AifEnConfigChange,	/* Adapter config change occurred */
1220 	AifEnContainerChange,	/* Adapter specific container cfg. change */
1221 	AifEnDeviceFailure,	/* SCSI device failed */
1222 	AifEnMirrorFailover,	/* Mirror failover started */
1223 	AifEnContainerEvent,	/* Significant container event */
1224 	AifEnFileSystemChange,	/* File system changed */
1225 	AifEnConfigPause,	/* Container pause event */
1226 	AifEnConfigResume,	/* Container resume event */
1227 	AifEnFailoverChange,	/* Failover space assignment changed */
1228 	AifEnRAID5RebuildDone,	/* RAID5 rebuild finished */
1229 	AifEnEnclosureManagement,	/* Enclosure management event */
1230 	AifEnBatteryEvent,	/* Significant NV battery event */
1231 	AifEnAddContainer,	/* A new container was created. */
1232 	AifEnDeleteContainer,	/* A container was deleted. */
1233 	AifEnSMARTEvent,	/* SMART Event */
1234 	AifEnBatteryNeedsRecond,	/* The battery needs reconditioning */
1235 	AifEnClusterEvent,		/* Some cluster event */
1236 	AifEnDiskSetEvent,		/* A disk set event occured. */
1237 	AifDriverNotifyStart = 199,	/* Notifies for host driver go here */
1238 	/* Host driver notifications start here */
1239 	AifDenMorphComplete,		/* A morph operation completed */
1240 	AifDenVolumeExtendComplete	/* Volume expand operation completed */
1241 } AAC_AifEventNotifyType;
1242 
1243 struct aac_AifEnsGeneric {
1244 	char	text[132];		/* Generic text */
1245 };
1246 
1247 struct aac_AifEnsDeviceFailure {
1248 	uint32_t	deviceHandle;	/* SCSI device handle */
1249 };
1250 
1251 struct aac_AifEnsMirrorFailover {
1252 	uint32_t	container;	/* Container with failed element */
1253 	uint32_t	failedSlice;	/* Old slice which failed */
1254 	uint32_t	creatingSlice;	/* New slice used for auto-create */
1255 };
1256 
1257 struct aac_AifEnsContainerChange {
1258 	uint32_t	container[2];	/* container that changed, -1 if */
1259 					/* no container */
1260 };
1261 
1262 struct aac_AifEnsContainerEvent {
1263 	uint32_t	container;	/* container number  */
1264 	uint32_t	eventType;	/* event type */
1265 };
1266 
1267 struct aac_AifEnsEnclosureEvent {
1268 	uint32_t	empID;		/* enclosure management proc number  */
1269 	uint32_t	unitID;		/* unitId, fan id, power supply id, */
1270 					/* slot id, tempsensor id. */
1271 	uint32_t	eventType;	/* event type */
1272 };
1273 
1274 struct aac_AifEnsBatteryEvent {
1275 	AAC_NVBATT_TRANSITION	transition_type;	/* eg from low to ok */
1276 	AAC_NVBATTSTATUS	current_state;	/* current batt state */
1277 	AAC_NVBATTSTATUS	prior_state;	/* prev batt state */
1278 };
1279 
1280 struct aac_AifEnsDiskSetEvent {
1281 	uint32_t	eventType;
1282 	uint64_t	DsNum;
1283 	uint64_t	CreatorId;
1284 };
1285 
1286 typedef enum {
1287 	CLUSTER_NULL_EVENT = 0,
1288 	CLUSTER_PARTNER_NAME_EVENT,	/* change in partner hostname or */
1289 					/* adaptername from NULL to non-NULL */
1290 					/* (partner's agent may be up) */
1291 	CLUSTER_PARTNER_NULL_NAME_EVENT	/* change in partner hostname or */
1292 					/* adaptername from non-null to NULL */
1293 					/* (partner has rebooted) */
1294 } AAC_ClusterAifEvent;
1295 
1296 struct aac_AifEnsClusterEvent {
1297 	AAC_ClusterAifEvent	eventType;
1298 };
1299 
1300 struct aac_AifEventNotify {
1301 	AAC_AifEventNotifyType	type;
1302 	union {
1303 		struct aac_AifEnsGeneric		EG;
1304 		struct aac_AifEnsDeviceFailure		EDF;
1305 		struct aac_AifEnsMirrorFailover		EMF;
1306 		struct aac_AifEnsContainerChange	ECC;
1307 		struct aac_AifEnsContainerEvent		ECE;
1308 		struct aac_AifEnsEnclosureEvent		EEE;
1309 		struct aac_AifEnsBatteryEvent		EBE;
1310 		struct aac_AifEnsDiskSetEvent		EDS;
1311 /*		struct aac_AifEnsSMARTEvent		ES; */
1312 		struct aac_AifEnsClusterEvent		ECLE;
1313 	} data;
1314 };
1315 
1316 /*
1317  * Adapter Initiated FIB command structures. Start with the adapter
1318  * initiated FIBs that really come from the adapter, and get responded
1319  * to by the host.
1320  */
1321 #define	AAC_AIF_REPORT_MAX_SIZE 64
1322 
1323 typedef enum {
1324 	AifCmdEventNotify = 1,	/* Notify of event */
1325 	AifCmdJobProgress,	/* Progress report */
1326 	AifCmdAPIReport,	/* Report from other user of API */
1327 	AifCmdDriverNotify,	/* Notify host driver of event */
1328 	AifReqJobList = 100,	/* Gets back complete job list */
1329 	AifReqJobsForCtr,	/* Gets back jobs for specific container */
1330 	AifReqJobsForScsi,	/* Gets back jobs for specific SCSI device */
1331 	AifReqJobReport,	/* Gets back a specific job report or list */
1332 	AifReqTerminateJob,	/* Terminates job */
1333 	AifReqSuspendJob,	/* Suspends a job */
1334 	AifReqResumeJob,	/* Resumes a job */
1335 	AifReqSendAPIReport,	/* API generic report requests */
1336 	AifReqAPIJobStart,	/* Start a job from the API */
1337 	AifReqAPIJobUpdate,	/* Update a job report from the API */
1338 	AifReqAPIJobFinish	/* Finish a job from the API */
1339 } AAC_AifCommand;
1340 
1341 struct aac_aif_command {
1342 	AAC_AifCommand	command; /* Tell host what type of notify this is */
1343 	uint32_t	seqNumber;	/* To allow ordering of reports */
1344 					/* (if necessary) */
1345 	union {
1346 		struct aac_AifEventNotify	EN;	/* Event notify */
1347 		struct aac_AifJobProgressReport	PR[1];	/* Progress report */
1348 		uint8_t	AR[AAC_AIF_REPORT_MAX_SIZE];
1349 		uint8_t	data[AAC_FIB_DATASIZE - 8];
1350 	} data;
1351 };
1352 
1353 #define	CT_PUP_MISSING_DRIVE	27
1354 
1355 /*
1356  * Cluster Management Commands
1357  */
1358 typedef enum {
1359 	CL_NULL = 0,		/* 0x00 null */
1360 	/* disk set commands */
1361 	DS_INIT = 1,		/* 0x01 init disk set control block */
1362 	DS_RESCAN,		/* 0x02 refresh drive, disk set, and slice */
1363 				/* structs */
1364 	DS_CREATE,		/* 0x03 create a disk set */
1365 	DS_DELETE,		/* 0x04 delete a disk set */
1366 	DS_ADD_DISK,		/* 0x05 add a disk to an existing disk set */
1367 	DS_REMOVE_DISK,		/* 0x06 remove a disk from an existing disk */
1368 				/* set */
1369 	DS_MOVE_DISK,		/* 0x07 move a disk from one existing disk */
1370 				/* set to another */
1371 	DS_TAKE_OWNERSHIP,	/* 0x08 take ownership of an unowned disk set */
1372 	DS_RELEASE_OWNERSHIP,	/* 0x09 release ownership of a disk set */
1373 	DS_FORCE_OWNERSHIP,	/* 0x0A force ownership of an disk set */
1374 	DS_GET_DISK_SET_PARAM,	/* 0x0B get info on a disk set */
1375 	DS_GET_DRIVE_PARAM,	/* 0x0C get info on a drive */
1376 	DS_GET_SLICE_PARAM,	/* 0x0D get info on a slice */
1377 	DS_GET_DISK_SETS,	/* 0x0E get a list of disk sets */
1378 	DS_GET_DRIVES,		/* 0x0F get a list of drives */
1379 	DS_SET_DISK_SET_PARAM,	/* 0x10 set info of a disk set */
1380 	DS_ONLINE,		/* 0x11 take disk set online */
1381 	DS_OFFLINE,		/* 0x12 take disk set offline */
1382 	DS_ONLINE_CONTAINERS,	/* 0x13 bring containers in diskset online */
1383 	DS_FSAPRINT,		/* 0x14 do an FsaPrint */
1384 
1385 	/* config commands */
1386 	CL_CFG_SET_HOST_IDS = 0x100,	/* 0x100 set host ids (host name and */
1387 					/* adapter name) */
1388 	CL_CFG_SET_PARTNER_HOST_IDS,	/* 0x101 set partner host ids (host */
1389 					/* name and adapter name) */
1390 	CL_CFG_GET_CLUSTER_CONFIG,	/* 0x102 get cluster configuration */
1391 
1392 	/* cluster comm commands */
1393 	CC_CLI_CLEAR_MESSAGE_BUFFER = 0x200,	/* 0x200 CC - client - clear */
1394 						/* contents of message buffer */
1395 	CC_SRV_CLEAR_MESSAGE_BUFFER,	/* 0x201 CC - server - clear contents */
1396 					/* of message buffer */
1397 	CC_CLI_SHOW_MESSAGE_BUFFER,	/* 0x202 CC - client - show contents */
1398 					/* of message buffer */
1399 	CC_SRV_SHOW_MESSAGE_BUFFER,	/* 0x203 CC - server - show contents */
1400 					/* of message buffer */
1401 	CC_CLI_SEND_MESSAGE,	/* 0x204 CC - client - send (req) message to */
1402 				/* server side */
1403 	CC_SRV_SEND_MESSAGE,	/* 0x205 CC - server - send (reply) message */
1404 				/* to client side */
1405 	CC_CLI_GET_MESSAGE,	/* 0x206 CC - client - read thru read message */
1406 				/* buffer */
1407 	CC_SRV_GET_MESSAGE,	/* 0x207 CC - server - read thru read message */
1408 				/* buffer */
1409 	CC_SEND_TEST_MESSAGE,	/* 0x208 CC - send a special subclass message */
1410 	CC_GET_BUSINFO,		/* 0x209 CC - get bus info */
1411 	CC_GET_PORTINFO,	/* 0x20A CC - get bus,port info */
1412 	CC_GET_NAMEINFO,	/* 0x20B CC - get misc info */
1413 	CC_GET_CONFIGINFO,	/* 0x20C CC - get misc info */
1414 	CQ_QUORUM_OP = 0x300,	/* 0x300 CQ - quorum messages */
1415 
1416 	/* last command */
1417 	CL_LAST_COMMAND		/* used for bounds checking */
1418 } AAC_CLCommand;
1419 
1420 /*
1421  * Disk IOCTL Functions
1422  */
1423 #define	Reserved_IOCTL			0x0000
1424 #define	GetDeviceHandle			0x0001
1425 #define	BusTargetLun_to_DeviceHandle	0x0002
1426 #define	DeviceHandle_to_BusTargetLun	0x0003
1427 #define	RescanBus			0x0004
1428 #define	GetDeviceProbeInfo		0x0005
1429 #define	GetDeviceCapacity		0x0006
1430 #define	GetContainerProbeInfo		0x0007	/* Container, not diskclass */
1431 						/* ioctl */
1432 #define	GetRequestedMemorySize		0x0008
1433 #define	GetBusInfo			0x0009
1434 #define	GetVendorSpecific		0x000a
1435 
1436 #define	EnhancedGetDeviceProbeInfo	0x000b
1437 #define	EnhancedGetBusInfo		0x000c
1438 
1439 #define	SetupExtendedCounters		0x000d
1440 #define	GetPerformanceCounters		0x000f
1441 #define	ResetPerformanceCounters	0x0010
1442 #define	ReadModePage			0x0011
1443 #define	WriteModePage			0x0012
1444 #define	ReadDriveParameter		0x0013
1445 #define	WriteDriveParameter		0x0014
1446 #define	ResetAdapter			0x0015
1447 #define	ResetBus			0x0016
1448 #define	ResetBusDevice			0x0017
1449 #define	ExecuteSrb			0x0018
1450 
1451 #define	Create_IO_Task			0x0030
1452 #define	Delete_IO_Task			0x0031
1453 #define	Get_IO_Task_Info		0x0032
1454 #define	Check_Task_Progress		0x0033
1455 
1456 #define	InjectError			0x0040
1457 #define	GetDeviceDefectCounts		0x0041
1458 #define	GetDeviceDefectInfo		0x0042
1459 #define	GetDeviceStatus			0x0043
1460 #define	ClearDeviceStatus		0x0044
1461 #define	DiskSpinControl			0x0045
1462 #define	DiskSmartControl		0x0046
1463 #define	WriteSame			0x0047
1464 #define	ReadWriteLong			0x0048
1465 #define	FormatUnit			0x0049
1466 
1467 #define	TargetDeviceControl		0x0050
1468 #define	TargetChannelControl		0x0051
1469 
1470 #define	FlashNewCode			0x0052
1471 #define	DiskCheck			0x0053
1472 #define	RequestSense			0x0054
1473 #define	DiskPERControl			0x0055
1474 #define	Read10				0x0056
1475 #define	Write10				0x0057
1476 
1477 /*
1478  * The following definitions come from Adaptec:
1479  *
1480  * SRB is required for the new management tools
1481  * and non-DASD support.
1482  */
1483 struct aac_srb
1484 {
1485 	uint32_t function;
1486 	uint32_t channel;
1487 	uint32_t id;
1488 	uint32_t lun;
1489 	uint32_t timeout;	/* timeout in sec. */
1490 	uint32_t flags;
1491 	uint32_t count;		/* data xfer size */
1492 	uint32_t retry_limit;	/* obsolete */
1493 	uint32_t cdb_size;
1494 	uint8_t cdb[16];
1495 	struct aac_sg_table sg;
1496 };
1497 
1498 #define	AAC_SENSE_BUFFERSIZE	 30
1499 
1500 struct aac_srb_reply
1501 {
1502 	uint32_t status;
1503 	uint32_t srb_status;
1504 	uint32_t scsi_status;
1505 	uint32_t data_xfer_length;
1506 	uint32_t sense_data_size;
1507 	uint8_t sense_data[AAC_SENSE_BUFFERSIZE];
1508 };
1509 
1510 /*
1511  * SRB Flags
1512  */
1513 #define	SRB_NoDataXfer			0x0000
1514 #define	SRB_DisableDisconnect		0x0004
1515 #define	SRB_DisableSynchTransfer	0x0008
1516 #define	SRB_BypassFrozenQueue		0x0010
1517 #define	SRB_DisableAutosense		0x0020
1518 #define	SRB_DataIn			0x0040
1519 #define	SRB_DataOut			0x0080
1520 
1521 /*
1522  * SRB Functions - set in aac_srb->function
1523  */
1524 #define	SRBF_ExecuteScsi		0x0000
1525 #define	SRBF_ClaimDevice		0x0001
1526 #define	SRBF_IO_Control			0x0002
1527 #define	SRBF_ReceiveEvent		0x0003
1528 #define	SRBF_ReleaseQueue		0x0004
1529 #define	SRBF_AttachDevice		0x0005
1530 #define	SRBF_ReleaseDevice		0x0006
1531 #define	SRBF_Shutdown			0x0007
1532 #define	SRBF_Flush			0x0008
1533 #define	SRBF_AbortCommand		0x0010
1534 #define	SRBF_ReleaseRecovery		0x0011
1535 #define	SRBF_ResetBus			0x0012
1536 #define	SRBF_ResetDevice		0x0013
1537 #define	SRBF_TerminateIO		0x0014
1538 #define	SRBF_FlushQueue			0x0015
1539 #define	SRBF_RemoveDevice		0x0016
1540 #define	SRBF_DomainValidation		0x0017
1541 
1542 /*
1543  * SRB SCSI Status
1544  * Status codes for SCSI passthrough commands,
1545  * set in aac_srb->scsi_status
1546  */
1547 #define	SRB_STATUS_PENDING			0x00
1548 #define	SRB_STATUS_SUCCESS			0x01
1549 #define	SRB_STATUS_ABORTED			0x02
1550 #define	SRB_STATUS_ABORT_FAILED			0x03
1551 #define	SRB_STATUS_ERROR			0x04
1552 #define	SRB_STATUS_BUSY				0x05
1553 #define	SRB_STATUS_INVALID_REQUEST		0x06
1554 #define	SRB_STATUS_INVALID_PATH_ID		0x07
1555 #define	SRB_STATUS_NO_DEVICE			0x08
1556 #define	SRB_STATUS_TIMEOUT			0x09
1557 #define	SRB_STATUS_SELECTION_TIMEOUT		0x0A
1558 #define	SRB_STATUS_COMMAND_TIMEOUT		0x0B
1559 #define	SRB_STATUS_MESSAGE_REJECTED		0x0D
1560 #define	SRB_STATUS_BUS_RESET			0x0E
1561 #define	SRB_STATUS_PARITY_ERROR			0x0F
1562 #define	SRB_STATUS_REQUEST_SENSE_FAILED		0x10
1563 #define	SRB_STATUS_NO_HBA			0x11
1564 #define	SRB_STATUS_DATA_OVERRUN			0x12
1565 #define	SRB_STATUS_UNEXPECTED_BUS_FREE		0x13
1566 #define	SRB_STATUS_PHASE_SEQUENCE_FAILURE	0x14
1567 #define	SRB_STATUS_BAD_SRB_BLOCK_LENGTH		0x15
1568 #define	SRB_STATUS_REQUEST_FLUSHED		0x16
1569 #define	SRB_STATUS_DELAYED_RETRY		0x17
1570 #define	SRB_STATUS_INVALID_LUN			0x20
1571 #define	SRB_STATUS_INVALID_TARGET_ID		0x21
1572 #define	SRB_STATUS_BAD_FUNCTION			0x22
1573 #define	SRB_STATUS_ERROR_RECOVERY		0x23
1574 #define	SRB_STATUS_NOT_STARTED			0x24
1575 #define	SRB_STATUS_NOT_IN_USE			0x30
1576 #define	SRB_STATUS_FORCE_ABORT			0x31
1577 #define	SRB_STATUS_DOMAIN_VALIDATION_FAIL	0x32
1578 
1579 #pragma	pack()
1580 
1581 /*
1582  * Aligned structure definition for variable declarations that require
1583  * alignment.
1584  */
1585 union aac_fib_align {
1586 	struct aac_fib d;
1587 	uint32_t dumb;
1588 };
1589 
1590 /* AAC Communication Space */
1591 struct aac_comm_space {
1592 	struct aac_fib adapter_fibs[AAC_ADAPTER_FIBS];
1593 	struct aac_adapter_init init_data;
1594 	struct aac_queue_table qtable;
1595 	char qt_align_pad[AAC_QUEUE_ALIGN];
1596 	char adapter_print_buf[AAC_ADAPTER_PRINT_BUFSIZE];
1597 	struct aac_fib sync_fib;
1598 };
1599 
1600 #ifdef	__cplusplus
1601 }
1602 #endif
1603 
1604 #endif /* __AAC_REGS_H__ */
1605