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