aacreg.h revision 1.10 1 /* $NetBSD: aacreg.h,v 1.10 2007/12/25 18:33:37 perry Exp $ */
2
3 /*-
4 * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 /*-
40 * Copyright (c) 2000 Michael Smith
41 * Copyright (c) 2000-2001 Scott Long
42 * Copyright (c) 2000 BSDi
43 * Copyright (c) 2000 Niklas Hallqvist
44 * All rights reserved.
45 *
46 * Redistribution and use in source and binary forms, with or without
47 * modification, are permitted provided that the following conditions
48 * are met:
49 * 1. Redistributions of source code must retain the above copyright
50 * notice, this list of conditions and the following disclaimer.
51 * 2. Redistributions in binary form must reproduce the above copyright
52 * notice, this list of conditions and the following disclaimer in the
53 * documentation and/or other materials provided with the distribution.
54 *
55 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
56 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
59 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
60 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
61 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
62 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
63 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
64 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65 * SUCH DAMAGE.
66 *
67 * from FreeBSD: aacreg.h,v 1.1 2000/09/13 03:20:34 msmith Exp
68 * via OpenBSD: aacreg.h,v 1.3 2001/06/12 15:40:29 niklas Exp
69 * incorporating some of: aacreg.h,v 1.23 2005/10/14 16:22:45 scottl Exp
70 */
71
72 /*
73 * Data structures defining the interface between the driver and the Adaptec
74 * 'FSA' adapters. Note that many field names and comments here are taken
75 * verbatim from the Adaptec driver source in order to make comparing the
76 * two slightly easier.
77 */
78
79 #ifndef _PCI_AACREG_H_
80 #define _PCI_AACREG_H_
81
82 /*
83 * Misc. magic numbers.
84 */
85 #define AAC_MAX_CONTAINERS 64
86 #define AAC_BLOCK_SIZE 512
87
88 /*
89 * Communications interface.
90 *
91 * Where datastructure layouts are closely parallel to the Adaptec sample code,
92 * retain their naming conventions (for now) to aid in cross-referencing.
93 */
94
95 /*
96 * We establish 4 command queues and matching response queues. Queues must
97 * be 16-byte aligned, and are sized as follows:
98 */
99 #define AAC_HOST_NORM_CMD_ENTRIES 8 /* cmd adapter->host, normal pri */
100 #define AAC_HOST_HIGH_CMD_ENTRIES 4 /* cmd adapter->host, high pri */
101 #define AAC_ADAP_NORM_CMD_ENTRIES 512 /* cmd host->adapter, normal pri */
102 #define AAC_ADAP_HIGH_CMD_ENTRIES 4 /* cmd host->adapter, high pri */
103 #define AAC_HOST_NORM_RESP_ENTRIES 512 /* resp, adapter->host, normal pri */
104 #define AAC_HOST_HIGH_RESP_ENTRIES 4 /* resp, adapter->host, high pri */
105 #define AAC_ADAP_NORM_RESP_ENTRIES 8 /* resp, host->adapter, normal pri */
106 #define AAC_ADAP_HIGH_RESP_ENTRIES 4 /* resp, host->adapter, high pri */
107
108 #define AAC_TOTALQ_LENGTH \
109 (AAC_HOST_HIGH_CMD_ENTRIES + AAC_HOST_NORM_CMD_ENTRIES + \
110 AAC_ADAP_HIGH_CMD_ENTRIES + AAC_ADAP_NORM_CMD_ENTRIES + \
111 AAC_HOST_HIGH_RESP_ENTRIES + AAC_HOST_NORM_RESP_ENTRIES + \
112 AAC_ADAP_HIGH_RESP_ENTRIES + AAC_ADAP_NORM_RESP_ENTRIES)
113
114 #define AAC_QUEUE_COUNT 8
115 #define AAC_QUEUE_ALIGN 16
116
117 struct aac_queue_entry {
118 u_int32_t aq_fib_size; /* FIB size in bytes */
119 u_int32_t aq_fib_addr; /* receiver-space address of the FIB */
120 } __attribute__ ((__packed__));
121
122 #define AAC_PRODUCER_INDEX 0
123 #define AAC_CONSUMER_INDEX 1
124
125 /*
126 * Table of queue indices and queues used to communicate with the
127 * controller. This structure must be aligned to AAC_QUEUE_ALIGN
128 */
129 struct aac_queue_table {
130 /* queue consumer/producer indexes (layout mandated by adapter) */
131 u_int32_t qt_qindex[AAC_QUEUE_COUNT][2];
132
133 /* queue entry structures (layout mandated by adapter) */
134 struct aac_queue_entry qt_HostNormCmdQueue[AAC_HOST_NORM_CMD_ENTRIES];
135 struct aac_queue_entry qt_HostHighCmdQueue[AAC_HOST_HIGH_CMD_ENTRIES];
136 struct aac_queue_entry qt_AdapNormCmdQueue[AAC_ADAP_NORM_CMD_ENTRIES];
137 struct aac_queue_entry qt_AdapHighCmdQueue[AAC_ADAP_HIGH_CMD_ENTRIES];
138 struct aac_queue_entry
139 qt_HostNormRespQueue[AAC_HOST_NORM_RESP_ENTRIES];
140 struct aac_queue_entry
141 qt_HostHighRespQueue[AAC_HOST_HIGH_RESP_ENTRIES];
142 struct aac_queue_entry
143 qt_AdapNormRespQueue[AAC_ADAP_NORM_RESP_ENTRIES];
144 struct aac_queue_entry
145 qt_AdapHighRespQueue[AAC_ADAP_HIGH_RESP_ENTRIES];
146 } __attribute__ ((__packed__));
147
148 /*
149 * Adapter Init Structure: this is passed to the adapter with the
150 * AAC_MONKER_INITSTRUCT command to point it at our control structures.
151 */
152 struct aac_adapter_init {
153 u_int32_t InitStructRevision;
154 u_int32_t MiniPortRevision;
155 u_int32_t FilesystemRevision;
156 u_int32_t CommHeaderAddress;
157 u_int32_t FastIoCommAreaAddress;
158 u_int32_t AdapterFibsPhysicalAddress;
159 u_int32_t AdapterFibsVirtualAddress;
160 u_int32_t AdapterFibsSize;
161 u_int32_t AdapterFibAlign;
162 u_int32_t PrintfBufferAddress;
163 u_int32_t PrintfBufferSize;
164 u_int32_t HostPhysMemPages;
165 u_int32_t HostElapsedSeconds;
166 /* ADAPTER_INIT_STRUCT_REVISION_4 begins here */
167 u_int32_t InitFlags; /* flags for supported features */
168 u_int32_t MaxIoCommands; /* max outstanding commands */
169 u_int32_t MaxIoSize; /* largest I/O command */
170 u_int32_t MaxFibSize; /* largest FIB to adapter */
171 } __packed;
172
173 #define AAC_INIT_STRUCT_REVISION 3
174 #define AAC_INIT_STRUCT_REVISION_4 4
175 #define AAC_INIT_STRUCT_MINIPORT_REVISION 1
176 #define AAC_INITFLAGS_NEW_COMM_SUPPORTED 1
177 #define AAC_PAGE_SIZE 4096 /* Used to set HostPhysMemPages */
178
179 /*
180 * Shared data types
181 */
182
183 /*
184 * Container types
185 */
186 #define CT_NONE 0
187 #define CT_VOLUME 1
188 #define CT_MIRROR 2
189 #define CT_STRIPE 3
190 #define CT_RAID5 4
191 #define CT_SSRW 5
192 #define CT_SSRO 6
193 #define CT_MORPH 7
194 #define CT_PASSTHRU 8
195 #define CT_RAID4 9
196 #define CT_RAID10 10 /* stripe of mirror */
197 #define CT_RAID00 11 /* stripe of stripe */
198 #define CT_VOLUME_OF_MIRRORS 12 /* volume of mirror */
199 #define CT_PSEUDO_RAID3 13 /* really raid4 */
200 #define CT_RAID50 14 /* stripe of raid5 */
201 #define CT_RAID5D 15 /* raid5 distributed hot-sparing */
202 #define CT_RAID5D0 16
203 #define CT_RAID1E 17 /* extended raid1 mirroring */
204 #define CT_RAID6 18
205 #define CT_RAID60 19
206
207 /*
208 * Host-addressable object types
209 */
210 #define FT_REG 1 /* regular file */
211 #define FT_DIR 2 /* directory */
212 #define FT_BLK 3 /* "block" device - reserved */
213 #define FT_CHR 4 /* "character special" device - reserved */
214 #define FT_LNK 5 /* symbolic link */
215 #define FT_SOCK 6 /* socket */
216 #define FT_FIFO 7 /* fifo */
217 #define FT_FILESYS 8 /* ADAPTEC's "FSA"(tm) filesystem */
218 #define FT_DRIVE 9 /* phys disk - addressable in scsi by bus/target/lun */
219 #define FT_SLICE 10 /* virtual disk - raw volume - slice */
220 #define FT_PARTITION 11 /* FSA part, inside slice, container building block */
221 #define FT_VOLUME 12 /* Container - Volume Set */
222 #define FT_STRIPE 13 /* Container - Stripe Set */
223 #define FT_MIRROR 14 /* Container - Mirror Set */
224 #define FT_RAID5 15 /* Container - Raid 5 Set */
225 #define FT_DATABASE 16 /* Storage object with "foreign" content manager */
226
227 /*
228 * Host-side scatter/gather list for raw commands.
229 */
230 struct aac_sg_entryraw {
231 u_int32_t Next; /* reserved for FW use */
232 u_int32_t Prev; /* reserved for FW use */
233 u_int64_t SgAddress;
234 u_int32_t SgByteCount;
235 u_int32_t Flags; /* reserved for FW use */
236 } __attribute__ ((__packed__));
237
238 struct aac_sg_tableraw {
239 u_int32_t SgCount;
240 struct aac_sg_entryraw SgEntryRaw[0];
241 } __attribute__ ((__packed__));
242
243 /*
244 * Host-side scatter/gather list for 32-bit commands.
245 */
246 struct aac_sg_entry {
247 u_int32_t SgAddress;
248 u_int32_t SgByteCount;
249 } __attribute__ ((__packed__));
250
251 struct aac_sg_table {
252 u_int32_t SgCount;
253 struct aac_sg_entry SgEntry[0];
254 } __attribute__ ((__packed__));
255
256 /*
257 * Host-side scatter/gather list for 64-bit commands.
258 */
259 struct aac_sg_entry64 {
260 u_int64_t SgAddress;
261 u_int32_t SgByteCount;
262 } __attribute__ ((__packed__));
263
264 struct aac_sg_table64 {
265 u_int32_t SgCount;
266 struct aac_sg_entry64 SgEntry64[0];
267 } __attribute__ ((__packed__));
268
269 /*
270 * Container creation data
271 */
272 struct aac_container_creation {
273 u_int8_t ViaBuildNumber;
274 u_int8_t MicroSecond;
275 u_int8_t Via; /* 1 = FSU, 2 = API, etc. */
276 u_int8_t YearsSince1900;
277 u_int32_t Month:4; /* 1-12 */
278 u_int32_t Day:6; /* 1-32 */
279 u_int32_t Hour:6; /* 0-23 */
280 u_int32_t Minute:6; /* 0-59 */
281 u_int32_t Second:6; /* 0-59 */
282 u_int64_t ViaAdapterSerialNumber;
283 } __attribute__ ((__packed__));
284
285 typedef enum {
286 RevApplication = 1,
287 RevDkiCli,
288 RevNetService,
289 RevApi,
290 RevFileSysDriver,
291 RevMiniportDriver,
292 RevAdapterSW,
293 RevMonitor,
294 RevRemoteApi,
295 } RevComponent;
296
297 struct FsaRevision {
298 union {
299 struct {
300 u_int8_t dash;
301 u_int8_t type;
302 u_int8_t minor;
303 u_int8_t major;
304 } comp;
305 u_int32_t ul;
306 } external;
307 u_int32_t buildNumber;
308 } __packed;
309
310 /*
311 * Adapter Information
312 */
313
314 #define CPU_NTSIM 1
315 #define CPU_I960 2
316 #define CPU_ARM 3
317 #define CPU_SPARC 4
318 #define CPU_POWERPC 5
319 #define CPU_ALPHA 6
320 #define CPU_P7 7
321 #define CPU_I960_RX 8
322 #define CPU__last 9
323
324 #define CPUI960_JX 1
325 #define CPUI960_CX 2
326 #define CPUI960_HX 3
327 #define CPUI960_RX 4
328 #define CPUARM_SA110 5
329 #define CPUARM_xxx 6
330 #define CPUPPC_603e 7
331 #define CPUPPC_xxx 8
332 #define CPUI80303 9
333 #define CPU_XSCALE_80321 10
334 #define CPU_MIPS_4KC 11
335 #define CPU_MIPS_5KC 12
336 #define CPUSUBTYPE__last 13
337
338 #define PLAT_NTSIM 1
339 #define PLAT_V3ADU 2
340 #define PLAT_CYCLONE 3
341 #define PLAT_CYCLONE_HD 4
342 #define PLAT_BATBOARD 5
343 #define PLAT_BATBOARD_HD 6
344 #define PLAT_YOLO 7
345 #define PLAT_COBRA 8
346 #define PLAT_ANAHEIM 9
347 #define PLAT_JALAPENO 10
348 #define PLAT_QUEENS 11
349 #define PLAT_JALAPENO_DELL 12
350 #define PLAT_POBLANO 13
351 #define PLAT_POBLANO_OPAL 14
352 #define PLAT_POBLANO_SL0 15
353 #define PLAT_POBLANO_SL1 16
354 #define PLAT_POBLANO_SL2 17
355 #define PLAT_POBLANO_XXX 18
356 #define PLAT_JALAPENO_P2 19
357 #define PLAT_HABANERO 20
358 #define PLAT_VULCAN 21
359 #define PLAT_CRUSADER 22
360 #define PLAT_LANCER 23
361 #define PLAT_HARRIER 24
362 #define PLAT_TERMINATOR 25
363 #define PLAT_SKYHAWK 26
364 #define PLAT_CORSAIR 27
365 #define PLAT_JAGUAR 28
366 #define PLAT_SATAHAWK 29
367 #define PLAT_SATANATOR 30
368 #define PLAT_PROWLER 31
369 #define PLAT_BLACKBIRD 32
370 #define PLAT_SABREEXPRESS 33
371 #define PLAT_INTRUDER 34
372 #define PLAT__last 35
373
374 #define OEM_FLAVOR_ADAPTEC 1
375 #define OEM_FLAVOR_DELL 2
376 #define OEM_FLAVOR_HP 3
377 #define OEM_FLAVOR_IBM 4
378 #define OEM_FLAVOR_CPQ 5
379 #define OEM_FLAVOR_FSC 6
380 #define OEM_FLAVOR_DWS 7
381 #define OEM_FLAVOR_BRAND_Z 8
382 #define OEM_FLAVOR_LEGEND 9
383 #define OEM_FLAVOR_HITACHI 10
384 #define OEM_FLAVOR_ESG 11
385 #define OEM_FLAVOR_ICP 12
386 #define OEM_FLAVOR_SCM 13
387 #define OEM_FLAVOR__last 14
388
389 /*
390 * XXX the aac-2622 with no battery present reports PLATFORM_BAT_OPT_PRESENT
391 */
392 #define PLATFORM_BAT_REQ_PRESENT 1 /* BATTERY REQUIRED AND PRESENT */
393 #define PLATFORM_BAT_REQ_NOTPRESENT 2 /* BATTERY REQUIRED AND NOT PRESENT */
394 #define PLATFORM_BAT_OPT_PRESENT 3 /* BATTERY OPTIONAL AND PRESENT */
395 #define PLATFORM_BAT_OPT_NOTPRESENT 4 /* BATTERY OPTIONAL AND NOT PRESENT */
396 #define PLATFORM_BAT_NOT_SUPPORTED 5 /* BATTERY NOT SUPPORTED */
397
398 /*
399 * options supported by this board
400 * there has to be a one to one mapping of these defines and the ones in
401 * fsaapi.h, search for FSA_SUPPORT_SNAPSHOT
402 */
403 #define AAC_SUPPORTED_SNAPSHOT 0x01
404 #define AAC_SUPPORTED_CLUSTERS 0x02
405 #define AAC_SUPPORTED_WRITE_CACHE 0x04
406 #define AAC_SUPPORTED_64BIT_DATA 0x08
407 #define AAC_SUPPORTED_HOST_TIME_FIB 0x10
408 #define AAC_SUPPORTED_RAID50 0x20
409 #define AAC_SUPPORTED_4GB_WINDOW 0x40
410 #define AAC_SUPPORTED_SCSI_UPGRADEABLE 0x80
411 #define AAC_SUPPORTED_SOFT_ERR_REPORT 0x100
412 #define AAC_SUPPORTED_NOT_RECONDITION 0x200
413 #define AAC_SUPPORTED_SGMAP_HOST64 0x400
414 #define AAC_SUPPORTED_ALARM 0x800
415 #define AAC_SUPPORTED_NONDASD 0x1000
416 #define AAC_SUPPORTED_SCSI_MANAGED 0x2000
417 #define AAC_SUPPORTED_RAID_SCSI_MODE 0x4000
418 #define AAC_SUPPORTED_SUPPLEMENT_ADAPTER_INFO 0x10000
419 #define AAC_SUPPORTED_NEW_COMM 0x20000
420 #define AAC_SUPPORTED_64BIT_ARRAYSIZE 0x40000
421 #define AAC_SUPPORTED_HEAT_SENSOR 0x80000
422
423 /*
424 * Structure used to respond to a RequestAdapterInfo fib.
425 */
426 struct aac_adapter_info {
427 u_int32_t PlatformBase; /* adapter type */
428 u_int32_t CpuArchitecture; /* adapter CPU type */
429 u_int32_t CpuVariant; /* adapter CPU subtype */
430 u_int32_t ClockSpeed; /* adapter CPU clockspeed */
431 u_int32_t ExecutionMem; /* adapter Execution Memory size */
432 u_int32_t BufferMem; /* adapter Data Memory */
433 u_int32_t TotalMem; /* adapter Total Memory */
434 struct FsaRevision KernelRevision; /* adapter Kernel SW Revision */
435 struct FsaRevision MonitorRevision; /* adapter Monitor/Diag SW Rev */
436 struct FsaRevision HardwareRevision; /* TDB */
437 struct FsaRevision BIOSRevision; /* adapter BIOS Revision */
438 u_int32_t ClusteringEnabled;
439 u_int32_t ClusterChannelMask;
440 u_int64_t SerialNumber;
441 u_int32_t batteryPlatform;
442 u_int32_t SupportedOptions; /* supported features of this ctrlr */
443 u_int32_t OemVariant;
444 } __packed;
445
446 /*
447 * Monitor/Kernel interface.
448 */
449
450 /*
451 * Synchronous commands to the monitor/kernel.
452 */
453 #define AAC_MONKER_BREAKPOINT 0x04
454 #define AAC_MONKER_INITSTRUCT 0x05
455 #define AAC_MONKER_SYNCFIB 0x0c
456 #define AAC_MONKER_GETKERNVER 0x11
457 #define AAC_MONKER_POSTRESULTS 0x14
458 #define AAC_MONKER_GETINFO 0x19
459 #define AAC_MONKER_GETDRVPROP 0x23
460 #define AAC_MONKER_RCVTEMP 0x25
461 #define AAC_MONKER_GETCOMMPREF 0x26
462 #define AAC_MONKER_REINIT 0xee
463
464 /*
465 * Command status values
466 */
467 #define ST_OK 0
468 #define ST_PERM 1
469 #define ST_NOENT 2
470 #define ST_IO 5
471 #define ST_NXIO 6
472 #define ST_E2BIG 7
473 #define ST_ACCES 13
474 #define ST_EXIST 17
475 #define ST_XDEV 18
476 #define ST_NODEV 19
477 #define ST_NOTDIR 20
478 #define ST_ISDIR 21
479 #define ST_INVAL 22
480 #define ST_FBIG 27
481 #define ST_NOSPC 28
482 #define ST_ROFS 30
483 #define ST_MLINK 31
484 #define ST_WOULDBLOCK 35
485 #define ST_NAMETOOLONG 63
486 #define ST_NOTEMPTY 66
487 #define ST_DQUOT 69
488 #define ST_STALE 70
489 #define ST_REMOTE 71
490 #define ST_BADHANDLE 10001
491 #define ST_NOT_SYNC 10002
492 #define ST_BAD_COOKIE 10003
493 #define ST_NOTSUPP 10004
494 #define ST_TOOSMALL 10005
495 #define ST_SERVERFAULT 10006
496 #define ST_BADTYPE 10007
497 #define ST_JUKEBOX 10008
498 #define ST_NOTMOUNTED 10009
499 #define ST_MAINTMODE 10010
500 #define ST_STALEACL 10011
501
502 /*
503 * Volume manager commands
504 */
505 #define VM_Null 0
506 #define VM_NameServe 1
507 #define VM_ContainerConfig 2
508 #define VM_Ioctl 3
509 #define VM_FilesystemIoctl 4
510 #define VM_CloseAll 5
511 #define VM_CtBlockRead 6
512 #define VM_CtBlockWrite 7
513 #define VM_SliceBlockRead 8 /* raw access to configured "storage objects" */
514 #define VM_SliceBlockWrite 9
515 #define VM_DriveBlockRead 10 /* raw access to physical devices */
516 #define VM_DriveBlockWrite 11
517 #define VM_EnclosureMgt 12 /* enclosure management */
518 #define VM_Unused 13 /* used to be diskset management */
519 #define VM_CtBlockVerify 14
520 #define VM_CtPerf 15 /* performance test */
521 #define VM_CtBlockRead64 16
522 #define VM_CtBlockWrite64 17
523 #define VM_CtBlockVerify64 18
524 #define VM_CtHostRead64 19
525 #define VM_CtHostWrite64 20
526 #define VM_DrvErrTblLog 21 /* drive error table/log type of command */
527 #define VM_NameServe64 22
528
529 /*
530 * "Mountable object"
531 */
532 struct aac_mntobj {
533 u_int32_t ObjectId;
534 char FileSystemName[16];
535 struct aac_container_creation CreateInfo;
536 u_int32_t Capacity;
537 u_int32_t VolType;
538 u_int32_t ObjType;
539 u_int32_t ContentState;
540 #define AAC_FSCS_READONLY 0x0002 /* XXX need more information than this */
541 union {
542 u_int32_t pad[8];
543 } ObjExtension;
544 u_int32_t AlterEgoId;
545 } __attribute__ ((__packed__));
546
547 struct aac_mntinfo {
548 u_int32_t Command;
549 u_int32_t MntType;
550 u_int32_t MntCount;
551 } __attribute__ ((__packed__));
552
553 struct aac_mntinforesponse {
554 u_int32_t Status;
555 u_int32_t MntType;
556 u_int32_t MntRespCount;
557 struct aac_mntobj MntTable[1];
558 } __attribute__ ((__packed__));
559
560 /*
561 * Container shutdown command.
562 */
563 struct aac_closecommand {
564 u_int32_t Command;
565 u_int32_t ContainerId;
566 } __attribute__ ((__packed__));
567
568 /*
569 * Container Config Command
570 */
571 #define CT_GET_SCSI_METHOD 64
572 struct aac_ctcfg {
573 u_int32_t Command;
574 u_int32_t cmd;
575 u_int32_t param;
576 } __attribute__ ((__packed__));
577
578 struct aac_ctcfg_resp {
579 u_int32_t Status;
580 u_int32_t resp;
581 u_int32_t param;
582 } __attribute__ ((__packed__));
583
584 /*
585 * 'Ioctl' commads
586 */
587 #define AAC_SCSI_MAX_PORTS 10
588 #define AAC_BUS_NO_EXIST 0
589 #define AAC_BUS_VALID 1
590 #define AAC_BUS_FAULTED 2
591 #define AAC_BUS_DISABLED 3
592 #define GetBusInfo 0x9
593
594 struct aac_getbusinf {
595 u_int32_t ProbeComplete;
596 u_int32_t BusCount;
597 u_int32_t TargetsPerBus;
598 u_int8_t InitiatorBusId[AAC_SCSI_MAX_PORTS];
599 u_int8_t BusValid[AAC_SCSI_MAX_PORTS];
600 } __attribute__ ((__packed__));
601
602 struct aac_vmioctl {
603 u_int32_t Command;
604 u_int32_t ObjType;
605 u_int32_t MethId;
606 u_int32_t ObjId;
607 u_int32_t IoctlCmd;
608 u_int32_t IoctlBuf[1]; /* Placeholder? */
609 } __attribute__ ((__packed__));
610
611 struct aac_vmi_businf_resp {
612 u_int32_t Status;
613 u_int32_t ObjType;
614 u_int32_t MethId;
615 u_int32_t ObjId;
616 u_int32_t IoctlCmd;
617 struct aac_getbusinf BusInf;
618 } __attribute__ ((__packed__));
619
620 #if 0
621 #define AAC_BTL_TO_HANDLE(b, t, l) \
622 (((b & 0x3f) << 7) | ((l & 0x7) << 4) | (t & 0xf))
623 #else
624 #define AAC_BTL_TO_HANDLE(b, t, l) \
625 ((((u_int32_t)b & 0x0f) << 24) | \
626 (((u_int32_t)l & 0xff) << 16) | \
627 ((u_int32_t)t & 0xffff))
628 #endif
629 #define GetDeviceProbeInfo 0x5
630
631 struct aac_vmi_devinfo_resp {
632 u_int32_t Status;
633 u_int32_t ObjType;
634 u_int32_t MethId;
635 u_int32_t ObjId;
636 u_int32_t IoctlCmd;
637 u_int8_t VendorId[8];
638 u_int8_t ProductId[16];
639 u_int8_t ProductRev[4];
640 u_int32_t Inquiry7;
641 u_int32_t align1;
642 u_int32_t Inquiry0;
643 u_int32_t align2;
644 u_int32_t Inquiry1;
645 u_int32_t align3;
646 u_int32_t reserved[2];
647 u_int8_t VendorSpecific[20];
648 u_int32_t Smart:1;
649 u_int32_t AAC_Managed:1;
650 u_int32_t align4;
651 u_int32_t reserved2:6;
652 u_int32_t Bus;
653 u_int32_t Target;
654 u_int32_t Lun;
655 u_int32_t ultraEnable:1,
656 disconnectEnable:1,
657 fast20EnabledW:1,
658 scamDevice:1,
659 scamTolerant:1,
660 setForSync:1,
661 setForWide:1,
662 syncDevice:1,
663 wideDevice:1,
664 reserved1:7,
665 ScsiRate:8,
666 ScsiOffset:8;
667 }; /* Do not pack */
668
669 #define ResetBus 0x16
670 struct aac_resetbus {
671 u_int32_t BusNumber;
672 };
673
674 /*
675 * Write 'stability' options.
676 */
677 #define CSTABLE 1
678 #define CUNSTABLE 2
679
680 /*
681 * Commit level response for a write request.
682 */
683 #define CMFILE_SYNC_NVRAM 1
684 #define CMDATA_SYNC_NVRAM 2
685 #define CMFILE_SYNC 3
686 #define CMDATA_SYNC 4
687 #define CMUNSTABLE 5
688
689 /*
690 * Block read/write operations. These structures are packed into the 'data'
691 * area in the FIB.
692 */
693 struct aac_blockread {
694 u_int32_t Command; /* not FSACommand! */
695 u_int32_t ContainerId;
696 u_int32_t BlockNumber;
697 u_int32_t ByteCount;
698 struct aac_sg_table SgMap; /* variable size */
699 } __attribute__ ((__packed__));
700
701 struct aac_blockread64 {
702 u_int32_t Command; /* not FSACommand! */
703 u_int16_t ContainerId;
704 u_int16_t SectorCount;
705 u_int32_t BlockNumber;
706 u_int16_t Pad;
707 u_int16_t Flags;
708 struct aac_sg_table64 SgMap64; /* variable size */
709 } __attribute__ ((__packed__));
710
711 struct aac_blockread_response {
712 u_int32_t Status;
713 u_int32_t ByteCount;
714 } __attribute__ ((__packed__));
715
716 struct aac_blockwrite {
717 u_int32_t Command; /* not FSACommand! */
718 u_int32_t ContainerId;
719 u_int32_t BlockNumber;
720 u_int32_t ByteCount;
721 u_int32_t Stable;
722 struct aac_sg_table SgMap; /* variable size */
723 } __attribute__ ((__packed__));
724
725 struct aac_blockwrite64 {
726 u_int32_t Command; /* not FSACommand! */
727 u_int16_t ContainerId;
728 u_int16_t SectorCount;
729 u_int32_t BlockNumber;
730 u_int16_t Pad;
731 u_int16_t Flags;
732 struct aac_sg_table64 SgMap64; /* variable size */
733 } __attribute__ ((__packed__));
734
735 struct aac_blockwrite_response {
736 u_int32_t Status;
737 u_int32_t ByteCount;
738 u_int32_t Committed;
739 } __attribute__ ((__packed__));
740
741 struct aac_raw_io {
742 u_int64_t BlockNumber;
743 u_int32_t ByteCount;
744 u_int16_t ContainerId;
745 u_int16_t Flags; /* 0: W, 1: R */
746 u_int16_t BpTotal; /* reserved for FW use */
747 u_int16_t BpComplete; /* reserved for FW use */
748 struct aac_sg_tableraw SgMapRaw; /* variable size */
749 } __attribute__ ((__packed__));
750
751 struct aac_close_command {
752 u_int32_t Command;
753 u_int32_t ContainerId;
754 } __attribute__ ((__packed__));
755
756 /*
757 * SCSI Passthrough structures
758 */
759 struct aac_srb32 {
760 u_int32_t function;
761 u_int32_t bus;
762 u_int32_t target;
763 u_int32_t lun;
764 u_int32_t timeout;
765 u_int32_t flags;
766 u_int32_t data_len;
767 u_int32_t retry_limit;
768 u_int32_t cdb_len;
769 u_int8_t cdb[16];
770 struct aac_sg_table sg_map32;
771 };
772
773 #define AAC_SRB_FUNC_EXECUTE_SCSI 0x00
774 #define AAC_SRB_FUNC_CLAIM_DEVICE 0x01
775 #define AAC_SRB_FUNC_IO_CONTROL 0x02
776 #define AAC_SRB_FUNC_RECEIVE_EVENT 0x03
777 #define AAC_SRB_FUNC_RELEASE_QUEUE 0x04
778 #define AAC_SRB_FUNC_ATTACH_DEVICE 0x05
779 #define AAC_SRB_FUNC_RELEASE_DEVICE 0x06
780 #define AAC_SRB_FUNC_SHUTDOWN 0x07
781 #define AAC_SRB_FUNC_FLUSH 0x08
782 #define AAC_SRB_FUNC_ABORT_COMMAND 0x10
783 #define AAC_SRB_FUNC_RELEASE_RECOVERY 0x11
784 #define AAC_SRB_FUNC_RESET_BUS 0x12
785 #define AAC_SRB_FUNC_RESET_DEVICE 0x13
786 #define AAC_SRB_FUNC_TERMINATE_IO 0x14
787 #define AAC_SRB_FUNC_FLUSH_QUEUE 0x15
788 #define AAC_SRB_FUNC_REMOVE_DEVICE 0x16
789 #define AAC_SRB_FUNC_DOMAIN_VALIDATION 0x17
790
791 #define AAC_SRB_FLAGS_NO_DATA_XFER 0x0000
792 #define AAC_SRB_FLAGS_DISABLE_DISCONNECT 0x0004
793 #define AAC_SRB_FLAGS_DISABLE_SYNC_TRANSFER 0x0008
794 #define AAC_SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x0010
795 #define AAC_SRB_FLAGS_DISABLE_AUTOSENSE 0x0020
796 #define AAC_SRB_FLAGS_DATA_IN 0x0040
797 #define AAC_SRB_FLAGS_DATA_OUT 0x0080
798 #define AAC_SRB_FLAGS_UNSPECIFIED_DIRECTION \
799 (AAC_SRB_FLAGS_DATA_IN | AAC_SRB_FLAGS_DATA_OUT)
800
801 #define AAC_HOST_SENSE_DATA_MAX 30
802
803 struct aac_srb_response {
804 u_int32_t fib_status;
805 u_int32_t srb_status;
806 u_int32_t scsi_status;
807 u_int32_t data_len;
808 u_int32_t sense_len;
809 u_int8_t sense[AAC_HOST_SENSE_DATA_MAX];
810 };
811
812 /*
813 * Status codes for SCSI passthrough commands. Since they are based on ASPI,
814 * they also exactly match CAM status codes in both enumeration and meaning.
815 * They seem to also be used as status codes for synchronous FIBs.
816 */
817 #define AAC_SRB_STS_PENDING 0x00
818 #define AAC_SRB_STS_SUCCESS 0x01
819 #define AAC_SRB_STS_ABORTED 0x02
820 #define AAC_SRB_STS_ABORT_FAILED 0x03
821 #define AAC_SRB_STS_ERROR 0x04
822 #define AAC_SRB_STS_BUSY 0x05
823 #define AAC_SRB_STS_INVALID_REQUEST 0x06
824 #define AAC_SRB_STS_INVALID_PATH_ID 0x07
825 #define AAC_SRB_STS_NO_DEVICE 0x08
826 #define AAC_SRB_STS_TIMEOUT 0x09
827 #define AAC_SRB_STS_SELECTION_TIMEOUT 0x0a
828 #define AAC_SRB_STS_COMMAND_TIMEOUT 0x0b
829 #define AAC_SRB_STS_MESSAGE_REJECTED 0x0d
830 #define AAC_SRB_STS_BUS_RESET 0x0e
831 #define AAC_SRB_STS_PARITY_ERROR 0x0f
832 #define AAC_SRB_STS_REQUEST_SENSE_FAILED 0x10
833 #define AAC_SRB_STS_NO_HBA 0x11
834 #define AAC_SRB_STS_DATA_OVERRUN 0x12
835 #define AAC_SRB_STS_UNEXPECTED_BUS_FREE 0x13
836 #define AAC_SRB_STS_PHASE_SEQUENCE_FAILURE 0x14
837 #define AAC_SRB_STS_BAD_SRB_BLOCK_LENGTH 0x15
838 #define AAC_SRB_STS_REQUEST_FLUSHED 0x16
839 #define AAC_SRB_STS_INVALID_LUN 0x20
840 #define AAC_SRB_STS_INVALID_TARGET_ID 0x21
841 #define AAC_SRB_STS_BAD_FUNCTION 0x22
842 #define AAC_SRB_STS_ERROR_RECOVER 0x23
843
844 /*
845 * Register set for adapters based on the Falcon bridge and PPC core
846 */
847
848 #define AAC_FA_DOORBELL0_CLEAR 0x00
849 #define AAC_FA_DOORBELL1_CLEAR 0x02
850 #define AAC_FA_DOORBELL0 0x04
851 #define AAC_FA_DOORBELL1 0x06
852 #define AAC_FA_MASK0_CLEAR 0x08
853 #define AAC_FA_MASK1_CLEAR 0x0a
854 #define AAC_FA_MASK0 0x0c
855 #define AAC_FA_MASK1 0x0e
856 #define AAC_FA_MAILBOX 0x10
857 #define AAC_FA_FWSTATUS 0x2c /* Mailbox 7 */
858 #define AAC_FA_INTSRC 0x900
859
860 #define AAC_FA_HACK(sc) (void)AAC_GETREG4(sc, AAC_FA_INTSRC)
861
862 /*
863 * Register definitions for the Adaptec AAC-364 'Jalapeno I/II' adapters, based
864 * on the SA110 'StrongArm'.
865 */
866
867 #define AAC_REGSIZE 0x100
868
869 /* doorbell 0 (adapter->host) */
870 #define AAC_SA_DOORBELL0_CLEAR 0x98
871 #define AAC_SA_DOORBELL0_SET 0x9c
872 #define AAC_SA_DOORBELL0 0x9c
873 #define AAC_SA_MASK0_CLEAR 0xa0
874 #define AAC_SA_MASK0_SET 0xa4
875
876 /* doorbell 1 (host->adapter) */
877 #define AAC_SA_DOORBELL1_CLEAR 0x9a
878 #define AAC_SA_DOORBELL1_SET 0x9e
879 #define AAC_SA_MASK1_CLEAR 0xa2
880 #define AAC_SA_MASK1_SET 0xa6
881
882 /* mailbox (20 bytes) */
883 #define AAC_SA_MAILBOX 0xa8
884 #define AAC_SA_FWSTATUS 0xc4
885
886 /*
887 * Register definitions for the Adaptec 'Pablano' adapters, based on the
888 * i960Rx, and other related adapters.
889 */
890
891 #define AAC_RX_IDBR 0x20 /* inbound doorbell */
892 #define AAC_RX_IISR 0x24 /* inbound interrupt status */
893 #define AAC_RX_IIMR 0x28 /* inbound interrupt mask */
894 #define AAC_RX_ODBR 0x2c /* outbound doorbell */
895 #define AAC_RX_OISR 0x30 /* outbound interrupt status */
896 #define AAC_RX_OIMR 0x34 /* outbound interrupt mask */
897 #define AAC_RX_IQUE 0x40 /* inbound queue */
898 #define AAC_RX_OQUE 0x44 /* outbound queue */
899
900 #define AAC_RX_MAILBOX 0x50 /* mailbox (20 bytes) */
901 #define AAC_RX_FWSTATUS 0x6c
902
903 /*
904 * Register definitions for the Adaptec 'Rocket' RAID-On-Chip adapters.
905 * Unsurprisingly, it's quite similar to the i960!
906 */
907
908 #define AAC_RKT_IDBR 0x20 /* inbound doorbell register */
909 #define AAC_RKT_IISR 0x24 /* inbound interrupt status register */
910 #define AAC_RKT_IIMR 0x28 /* inbound interrupt mask register */
911 #define AAC_RKT_ODBR 0x2c /* outbound doorbell register */
912 #define AAC_RKT_OISR 0x30 /* outbound interrupt status register */
913 #define AAC_RKT_OIMR 0x34 /* outbound interrupt mask register */
914 #define AAC_RKT_IQUE 0x40 /* inbound queue */
915 #define AAC_RKT_OQUE 0x44 /* outbound queue */
916
917 #define AAC_RKT_MAILBOX 0x1000 /* mailbox */
918 #define AAC_RKT_FWSTATUS 0x101c /* Firmware Status (mailbox 7) */
919
920 /*
921 * Common bit definitions for the doorbell registers.
922 */
923
924 /*
925 * Status bits in the doorbell registers.
926 */
927 #define AAC_DB_SYNC_COMMAND (1<<0) /* send/completed synchronous FIB */
928 #define AAC_DB_COMMAND_READY (1<<1) /* posted one or more commands */
929 #define AAC_DB_RESPONSE_READY (1<<2) /* one or more commands complete */
930 #define AAC_DB_COMMAND_NOT_FULL (1<<3) /* command queue not full */
931 #define AAC_DB_RESPONSE_NOT_FULL (1<<4) /* response queue not full */
932
933 /*
934 * The adapter can request the host print a message by setting the
935 * DB_PRINTF flag in DOORBELL0. The driver responds by collecting the
936 * message from the printf buffer, clearing the DB_PRINTF flag in
937 * DOORBELL0 and setting it in DOORBELL1.
938 * (ODBR and IDBR respectively for the i960Rx adapters)
939 */
940 #define AAC_DB_PRINTF (1<<5) /* adapter requests host printf */
941 #define AAC_PRINTF_DONE (1<<5) /* host completed printf processing */
942
943 /*
944 * Mask containing the interrupt bits we care about. We don't anticipate
945 * (or want) interrupts not in this mask.
946 */
947 #define AAC_DB_INTERRUPTS \
948 (AAC_DB_COMMAND_READY | AAC_DB_RESPONSE_READY | AAC_DB_PRINTF)
949 #define AAC_DB_INT_NEW_COMM 0x08
950
951 /*
952 * Queue names
953 *
954 * Note that we base these at 0 in order to use them as array indices. Adaptec
955 * used base 1 for some unknown reason, and sorted them in a different order.
956 */
957 #define AAC_HOST_NORM_CMD_QUEUE 0
958 #define AAC_HOST_HIGH_CMD_QUEUE 1
959 #define AAC_ADAP_NORM_CMD_QUEUE 2
960 #define AAC_ADAP_HIGH_CMD_QUEUE 3
961 #define AAC_HOST_NORM_RESP_QUEUE 4
962 #define AAC_HOST_HIGH_RESP_QUEUE 5
963 #define AAC_ADAP_NORM_RESP_QUEUE 6
964 #define AAC_ADAP_HIGH_RESP_QUEUE 7
965
966 /*
967 * List structure used to chain FIBs (used by the adapter - we hang FIBs off
968 * our private command structure and don't touch these)
969 */
970 struct aac_fib_list_entry {
971 u_int32_t Flink;
972 u_int32_t Blink;
973 } __packed;
974
975 /*
976 * FIB (FSA Interface Block?); this is the datastructure passed between the
977 * host and adapter.
978 */
979 struct aac_fib_header {
980 u_int32_t XferState;
981 u_int16_t Command;
982 u_int8_t StructType;
983 u_int8_t Flags;
984 u_int16_t Size;
985 u_int16_t SenderSize;
986 u_int32_t SenderFibAddress;
987 u_int32_t ReceiverFibAddress;
988 u_int32_t SenderData;
989 union {
990 struct {
991 u_int32_t ReceiverTimeStart;
992 u_int32_t ReceiverTimeDone;
993 } _s;
994 struct aac_fib_list_entry FibLinks;
995 } _u;
996 } __packed;
997
998 #define AAC_FIB_DATASIZE (512 - sizeof(struct aac_fib_header))
999
1000 struct aac_fib {
1001 struct aac_fib_header Header;
1002 u_int8_t data[AAC_FIB_DATASIZE];
1003 } __packed;
1004
1005 /*
1006 * FIB commands
1007 */
1008 #define TestCommandResponse 1
1009 #define TestAdapterCommand 2
1010
1011 /* Lowlevel and comm commands */
1012 #define LastTestCommand 100
1013 #define ReinitHostNormCommandQueue 101
1014 #define ReinitHostHighCommandQueue 102
1015 #define ReinitHostHighRespQueue 103
1016 #define ReinitHostNormRespQueue 104
1017 #define ReinitAdapNormCommandQueue 105
1018 #define ReinitAdapHighCommandQueue 107
1019 #define ReinitAdapHighRespQueue 108
1020 #define ReinitAdapNormRespQueue 109
1021 #define InterfaceShutdown 110
1022 #define DmaCommandFib 120
1023 #define StartProfile 121
1024 #define TermProfile 122
1025 #define SpeedTest 123
1026 #define TakeABreakPt 124
1027 #define RequestPerfData 125
1028 #define SetInterruptDefTimer 126
1029 #define SetInterruptDefCount 127
1030 #define GetInterruptDefStatus 128
1031 #define LastCommCommand 129
1032
1033 /* filesystem commands */
1034 #define NuFileSystem 300
1035 #define UFS 301
1036 #define HostFileSystem 302
1037 #define LastFileSystemCommand 303
1038
1039 /* Container Commands */
1040 #define ContainerCommand 500
1041 #define ContainerCommand64 501
1042 #define RawIo 502
1043
1044 /* Cluster Commands */
1045 #define ClusterCommand 550
1046
1047 /* Scsi Port commands (scsi passthrough) */
1048 #define ScsiPortCommand 600
1049 #define ScsiPortCommandU64 601
1050 #define SataPortCommandU64 602
1051 #define SasSmpPassThrough 603
1052 #define SasRequestPhyInfo 612
1053
1054 /* Misc house keeping and generic adapter initiated commands */
1055 #define AifRequest 700
1056 #define CheckRevision 701
1057 #define FsaHostShutdown 702
1058 #define RequestAdapterInfo 703
1059 #define IsAdapterPaused 704
1060 #define SendHostTime 705
1061 #define RequestSupplementAdapterInfo 706 /* Supp. Info for set in UCC
1062 * use only if supported
1063 * (RequestAdapterInfo first) */
1064 #define LastMiscCommand 707
1065
1066 #define OnLineDiagnostic 800
1067 #define FduAdapterTest 801
1068 #define RequestCompatibilityId 802
1069 #define AdapterEnvironmentInfo 803 /* temp. sensors */
1070
1071 #define NvsramEventLog 900
1072 #define ResetNvsramEventLogPointers 901
1073 #define EnableEventLog 902
1074 #define DisableEventLog 903
1075 #define EncryptedKeyTransportFIB 904
1076 #define KeyableFeaturesFIB 905
1077
1078 /*
1079 * FIB types
1080 */
1081 #define AAC_FIBTYPE_TFIB 1
1082 #define AAC_FIBTYPE_TQE 2
1083 #define AAC_FIBTYPE_TCTPERF 3
1084
1085 /*
1086 * FIB transfer state
1087 */
1088 #define AAC_FIBSTATE_HOSTOWNED (1<<0) /* owned by the host */
1089 #define AAC_FIBSTATE_ADAPTEROWNED (1<<1) /* owned by the adapter */
1090 #define AAC_FIBSTATE_INITIALISED (1<<2) /* initialised */
1091 #define AAC_FIBSTATE_EMPTY (1<<3) /* empty */
1092 #define AAC_FIBSTATE_FROMPOOL (1<<4) /* allocated from pool */
1093 #define AAC_FIBSTATE_FROMHOST (1<<5) /* sent from the host */
1094 #define AAC_FIBSTATE_FROMADAP (1<<6) /* sent from the adapter */
1095 #define AAC_FIBSTATE_REXPECTED (1<<7) /* response is expected */
1096 #define AAC_FIBSTATE_RNOTEXPECTED (1<<8) /* response is not expected */
1097 #define AAC_FIBSTATE_DONEADAP (1<<9) /* processed by the adapter */
1098 #define AAC_FIBSTATE_DONEHOST (1<<10) /* processed by the host */
1099 #define AAC_FIBSTATE_HIGH (1<<11) /* high priority */
1100 #define AAC_FIBSTATE_NORM (1<<12) /* normal priority */
1101 #define AAC_FIBSTATE_ASYNC (1<<13)
1102 #define AAC_FIBSTATE_ASYNCIO (1<<13) /* to be removed */
1103 #define AAC_FIBSTATE_PAGEFILEIO (1<<14) /* to be removed */
1104 #define AAC_FIBSTATE_SHUTDOWN (1<<15)
1105 #define AAC_FIBSTATE_LAZYWRITE (1<<16) /* to be removed */
1106 #define AAC_FIBSTATE_ADAPMICROFIB (1<<17)
1107 #define AAC_FIBSTATE_BIOSFIB (1<<18)
1108 #define AAC_FIBSTATE_FAST_RESPONSE (1<<19) /* fast response capable */
1109 #define AAC_FIBSTATE_APIFIB (1<<20)
1110
1111 /*
1112 * FIB error values
1113 */
1114 #define AAC_ERROR_NORMAL 0x00
1115 #define AAC_ERROR_PENDING 0x01
1116 #define AAC_ERROR_FATAL 0x02
1117 #define AAC_ERROR_INVALID_QUEUE 0x03
1118 #define AAC_ERROR_NOENTRIES 0x04
1119 #define AAC_ERROR_SENDFAILED 0x05
1120 #define AAC_ERROR_INVALID_QUEUE_PRIORITY 0x06
1121 #define AAC_ERROR_FIB_ALLOCATION_FAILED 0x07
1122 #define AAC_ERROR_FIB_DEALLOCATION_FAILED 0x08
1123
1124 /*
1125 * Adapter Status Register
1126 *
1127 * Phase Staus mailbox is 32bits:
1128 * <31:16> = Phase Status
1129 * <15:0> = Phase
1130 *
1131 * The adapter reports its present state through the phase. Only
1132 * a single phase should be ever be set. Each phase can have multiple
1133 * phase status bits to provide more detailed information about the
1134 * state of the adapter.
1135 */
1136 #define AAC_SELF_TEST_FAILED 0x00000004
1137 #define AAC_MONITOR_PANIC 0x00000020
1138 #define AAC_UP_AND_RUNNING 0x00000080
1139 #define AAC_KERNEL_PANIC 0x00000100
1140
1141 /*
1142 * Data types relating to control and monitoring of the NVRAM/WriteCache
1143 * subsystem.
1144 */
1145
1146 #define AAC_NFILESYS 24 /* maximum number of filesystems */
1147
1148 /*
1149 * NVRAM/Write Cache subsystem states
1150 */
1151 typedef enum {
1152 NVSTATUS_DISABLED = 0, /* present, clean, not being used */
1153 NVSTATUS_ENABLED, /* present, possibly dirty, ready for use */
1154 NVSTATUS_ERROR, /* present, dirty, contains dirty data */
1155 NVSTATUS_BATTERY, /* present, bad or low battery, may contain
1156 * dirty data */
1157 NVSTATUS_UNKNOWN /* for bad/missing device */
1158 } AAC_NVSTATUS;
1159
1160 /*
1161 * NVRAM/Write Cache subsystem battery component states
1162 *
1163 */
1164 typedef enum {
1165 NVBATTSTATUS_NONE = 0, /* battery has no power or is not present */
1166 NVBATTSTATUS_LOW, /* battery is low on power */
1167 NVBATTSTATUS_OK, /* battery is okay - normal operation possible
1168 * only in this state */
1169 NVBATTSTATUS_RECONDITIONING /* no battery present - reconditioning
1170 * in process */
1171 } AAC_NVBATTSTATUS;
1172
1173 /*
1174 * Battery transition type
1175 */
1176 typedef enum {
1177 NVBATT_TRANSITION_NONE = 0, /* battery now has no power or is not
1178 * present */
1179 NVBATT_TRANSITION_LOW, /* battery is now low on power */
1180 NVBATT_TRANSITION_OK /* battery is now okay - normal
1181 * operation possible only in this
1182 * state */
1183 } AAC_NVBATT_TRANSITION;
1184
1185 /*
1186 * NVRAM Info structure returned for NVRAM_GetInfo call
1187 */
1188 struct aac_nvramdevinfo {
1189 u_int32_t NV_Enabled; /* write caching enabled */
1190 u_int32_t NV_Error; /* device in error state */
1191 u_int32_t NV_NDirty; /* count of dirty NVRAM buffers */
1192 u_int32_t NV_NActive; /* count of NVRAM buffers being
1193 * written */
1194 } __attribute__ ((__packed__));
1195
1196 struct aac_nvraminfo {
1197 AAC_NVSTATUS NV_Status; /* nvram subsystem status */
1198 AAC_NVBATTSTATUS NV_BattStatus; /* battery status */
1199 u_int32_t NV_Size; /* size of WriteCache NVRAM in
1200 * bytes */
1201 u_int32_t NV_BufSize; /* size of NVRAM buffers in
1202 * bytes */
1203 u_int32_t NV_NBufs; /* number of NVRAM buffers */
1204 u_int32_t NV_NDirty; /* Num dirty NVRAM buffers */
1205 u_int32_t NV_NClean; /* Num clean NVRAM buffers */
1206 u_int32_t NV_NActive; /* Num NVRAM buffers being
1207 * written */
1208 u_int32_t NV_NBrokered; /* Num brokered NVRAM buffers */
1209 struct aac_nvramdevinfo NV_DevInfo[AAC_NFILESYS]; /* per device
1210 * info */
1211 u_int32_t NV_BattNeedsReconditioning; /* boolean */
1212 u_int32_t NV_TotalSize; /* size of all non-volatile
1213 * memories in bytes */
1214 } __attribute__ ((__packed__));
1215
1216 /*
1217 * Data types relating to adapter-initiated FIBs
1218 *
1219 * Based on types and structures in <aifstruc.h>
1220 */
1221
1222 /*
1223 * Progress Reports
1224 */
1225 typedef enum {
1226 AifJobStsSuccess = 1,
1227 AifJobStsFinished,
1228 AifJobStsAborted,
1229 AifJobStsFailed,
1230 AifJobStsLastReportMarker = 100, /* All prior mean last report */
1231 AifJobStsSuspended,
1232 AifJobStsRunning
1233 } AAC_AifJobStatus;
1234
1235 typedef enum {
1236 AifJobScsiMin = 1, /* Minimum value for Scsi operation */
1237 AifJobScsiZero, /* SCSI device clear operation */
1238 AifJobScsiVerify, /* SCSI device Verify operation NO
1239 * REPAIR */
1240 AifJobScsiExercise, /* SCSI device Exercise operation */
1241 AifJobScsiVerifyRepair, /* SCSI device Verify operation WITH
1242 * repair */
1243 AifJobScsiWritePattern, /* write pattern */
1244 AifJobScsiMax = 99, /* Max Scsi value */
1245 AifJobCtrMin, /* Min Ctr op value */
1246 AifJobCtrZero, /* Container clear operation */
1247 AifJobCtrCopy, /* Container copy operation */
1248 AifJobCtrCreateMirror, /* Container Create Mirror operation */
1249 AifJobCtrMergeMirror, /* Container Merge Mirror operation */
1250 AifJobCtrScrubMirror, /* Container Scrub Mirror operation */
1251 AifJobCtrRebuildRaid5, /* Container Rebuild Raid5 operation */
1252 AifJobCtrScrubRaid5, /* Container Scrub Raid5 operation */
1253 AifJobCtrMorph, /* Container morph operation */
1254 AifJobCtrPartCopy, /* Container Partition copy operation */
1255 AifJobCtrRebuildMirror, /* Container Rebuild Mirror operation */
1256 AifJobCtrCrazyCache, /* crazy cache */
1257 AifJobCtrCopyback, /* Container Copyback operation */
1258 AifJobCtrCompactRaid5D, /* Container Compaction operation */
1259 AifJobCtrExpandRaid5D, /* Container Expansion operation */
1260 AifJobCtrRebuildRaid6, /* Container Rebuild Raid6 operation */
1261 AifJobCtrScrubRaid6, /* Container Scrub Raid6 operation */
1262 AifJobCtrSSBackup, /* Container snapshot backup task */
1263 AifJobCtrMax = 199, /* Max Ctr type operation */
1264 AifJobFsMin, /* Min Fs type operation */
1265 AifJobFsCreate, /* File System Create operation */
1266 AifJobFsVerify, /* File System Verify operation */
1267 AifJobFsExtend, /* File System Extend operation */
1268 AifJobFsMax = 299, /* Max Fs type operation */
1269 AifJobApiFormatNTFS, /* Format a drive to NTFS */
1270 AifJobApiFormatFAT, /* Format a drive to FAT */
1271 AifJobApiUpdateSnapshot, /* update the read/write half of a
1272 * snapshot */
1273 AifJobApiFormatFAT32, /* Format a drive to FAT32 */
1274 AifJobApiMax = 399, /* Max API type operation */
1275 AifJobCtlContinuousCtrVerify, /* Adapter operation */
1276 AifJobCtlMax = 499 /* Max Adapter type operation */
1277 } AAC_AifJobType;
1278
1279 struct aac_AifContainers {
1280 u_int32_t src; /* from/master */
1281 u_int32_t dst; /* to/slave */
1282 } __attribute__ ((__packed__));
1283
1284 union aac_AifJobClient {
1285 struct aac_AifContainers container; /* For Container and
1286 * filesystem progress
1287 * ops; */
1288 int32_t scsi_dh; /* For SCSI progress
1289 * ops */
1290 };
1291
1292 struct aac_AifJobDesc {
1293 u_int32_t jobID; /* DO NOT FILL IN! Will be
1294 * filled in by AIF */
1295 AAC_AifJobType type; /* Operation that is being
1296 * performed */
1297 union aac_AifJobClient client; /* Details */
1298 } __attribute__ ((__packed__));
1299
1300 struct aac_AifJobProgressReport {
1301 struct aac_AifJobDesc jd;
1302 AAC_AifJobStatus status;
1303 u_int32_t finalTick;
1304 u_int32_t currentTick;
1305 u_int32_t jobSpecificData1;
1306 u_int32_t jobSpecificData2;
1307 } __attribute__ ((__packed__));
1308
1309 /*
1310 * Event Notification
1311 */
1312 typedef enum {
1313 /* General application notifies start here */
1314 AifEnGeneric = 1, /* Generic notification */
1315 AifEnTaskComplete, /* Task has completed */
1316 AifEnConfigChange, /* Adapter config change occurred */
1317 AifEnContainerChange, /* Adapter specific container
1318 * configuration change */
1319 AifEnDeviceFailure, /* SCSI device failed */
1320 AifEnMirrorFailover, /* Mirror failover started */
1321 AifEnContainerEvent, /* Significant container event */
1322 AifEnFileSystemChange, /* File system changed */
1323 AifEnConfigPause, /* Container pause event */
1324 AifEnConfigResume, /* Container resume event */
1325 AifEnFailoverChange, /* Failover space assignment changed */
1326 AifEnRAID5RebuildDone, /* RAID5 rebuild finished */
1327 AifEnEnclosureManagement, /* Enclosure management event */
1328 AifEnBatteryEvent, /* Significant NV battery event */
1329 AifEnAddContainer, /* A new container was created. */
1330 AifEnDeleteContainer, /* A container was deleted. */
1331 AifEnSMARTEvent, /* SMART Event */
1332 AifEnBatteryNeedsRecond, /* The battery needs reconditioning */
1333 AifEnClusterEvent, /* Some cluster event */
1334 AifEnDiskSetEvent, /* A disk set event occured. */
1335 AifDriverNotifyStart=199, /* Notifies for host driver go here */
1336 /* Host driver notifications start here */
1337 AifDenMorphComplete, /* A morph operation completed */
1338 AifDenVolumeExtendComplete /* Volume expand operation completed */
1339 } AAC_AifEventNotifyType;
1340
1341 struct aac_AifEnsGeneric {
1342 char text[132]; /* Generic text */
1343 } __attribute__ ((__packed__));
1344
1345 struct aac_AifEnsDeviceFailure {
1346 u_int32_t deviceHandle; /* SCSI device handle */
1347 } __attribute__ ((__packed__));
1348
1349 struct aac_AifEnsMirrorFailover {
1350 u_int32_t container; /* Container with failed element */
1351 u_int32_t failedSlice; /* Old slice which failed */
1352 u_int32_t creatingSlice; /* New slice used for auto-create */
1353 } __attribute__ ((__packed__));
1354
1355 struct aac_AifEnsContainerChange {
1356 u_int32_t container[2]; /* container that changed, -1 if no
1357 * container */
1358 } __attribute__ ((__packed__));
1359
1360 struct aac_AifEnsContainerEvent {
1361 u_int32_t container; /* container number */
1362 u_int32_t eventType; /* event type */
1363 } __attribute__ ((__packed__));
1364
1365 struct aac_AifEnsEnclosureEvent {
1366 u_int32_t empID; /* enclosure management proc number */
1367 u_int32_t unitID; /* unitId, fan id, power supply id,
1368 * slot id, tempsensor id. */
1369 u_int32_t eventType; /* event type */
1370 } __attribute__ ((__packed__));
1371
1372 struct aac_AifEnsBatteryEvent {
1373 AAC_NVBATT_TRANSITION transition_type; /* eg from low to ok */
1374 AAC_NVBATTSTATUS current_state; /* current batt state */
1375 AAC_NVBATTSTATUS prior_state; /* prev batt state */
1376 } __attribute__ ((__packed__));
1377
1378 struct aac_AifEnsDiskSetEvent {
1379 u_int32_t eventType;
1380 u_int64_t DsNum;
1381 u_int64_t CreatorId;
1382 } __attribute__ ((__packed__));
1383
1384 typedef enum {
1385 CLUSTER_NULL_EVENT = 0,
1386 CLUSTER_PARTNER_NAME_EVENT, /* change in partner hostname or
1387 * adaptername from NULL to non-NULL */
1388 /* (partner's agent may be up) */
1389 CLUSTER_PARTNER_NULL_NAME_EVENT /* change in partner hostname or
1390 * adaptername from non-null to NULL */
1391 /* (partner has rebooted) */
1392 } AAC_ClusterAifEvent;
1393
1394 struct aac_AifEnsClusterEvent {
1395 AAC_ClusterAifEvent eventType;
1396 } __attribute__ ((__packed__));
1397
1398 struct aac_AifEventNotify {
1399 AAC_AifEventNotifyType type;
1400 union {
1401 struct aac_AifEnsGeneric EG;
1402 struct aac_AifEnsDeviceFailure EDF;
1403 struct aac_AifEnsMirrorFailover EMF;
1404 struct aac_AifEnsContainerChange ECC;
1405 struct aac_AifEnsContainerEvent ECE;
1406 struct aac_AifEnsEnclosureEvent EEE;
1407 struct aac_AifEnsBatteryEvent EBE;
1408 struct aac_AifEnsDiskSetEvent EDS;
1409 /* struct aac_AifEnsSMARTEvent ES;*/
1410 struct aac_AifEnsClusterEvent ECLE;
1411 } data;
1412 } __attribute__ ((__packed__));
1413
1414 /*
1415 * Adapter Initiated FIB command structures. Start with the adapter
1416 * initiated FIBs that really come from the adapter, and get responded
1417 * to by the host.
1418 */
1419 #define AAC_AIF_REPORT_MAX_SIZE 64
1420
1421 typedef enum {
1422 AifCmdEventNotify = 1, /* Notify of event */
1423 AifCmdJobProgress, /* Progress report */
1424 AifCmdAPIReport, /* Report from other user of API */
1425 AifCmdDriverNotify, /* Notify host driver of event */
1426 AifReqJobList = 100, /* Gets back complete job list */
1427 AifReqJobsForCtr, /* Gets back jobs for specific container */
1428 AifReqJobsForScsi, /* Gets back jobs for specific SCSI device */
1429 AifReqJobReport, /* Gets back a specific job report or list */
1430 AifReqTerminateJob, /* Terminates job */
1431 AifReqSuspendJob, /* Suspends a job */
1432 AifReqResumeJob, /* Resumes a job */
1433 AifReqSendAPIReport, /* API generic report requests */
1434 AifReqAPIJobStart, /* Start a job from the API */
1435 AifReqAPIJobUpdate, /* Update a job report from the API */
1436 AifReqAPIJobFinish /* Finish a job from the API */
1437 } AAC_AifCommand;
1438
1439 struct aac_aif_command {
1440 AAC_AifCommand command; /* Tell host what type of
1441 * notify this is */
1442 u_int32_t seqNumber; /* To allow ordering of
1443 * reports (if necessary) */
1444 union {
1445 struct aac_AifEventNotify EN; /* Event notify */
1446 struct aac_AifJobProgressReport PR[1]; /* Progress report */
1447 u_int8_t AR[AAC_AIF_REPORT_MAX_SIZE];
1448 u_int8_t data[AAC_FIB_DATASIZE - 8];
1449 } data;
1450 } __attribute__ ((__packed__));
1451
1452 #endif /* !_PCI_AACREG_H_ */
1453