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