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