FreeBSD/Linux Kernel Cross Reference
sys/dev/ic/aacreg.h
1 /* $NetBSD: aacreg.h,v 1.5.24.2 2008/10/03 09:12:16 jdc 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 } __attribute__((__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 } __attribute__((__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 } __attribute__((__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 u_int32_t CapacityHigh; /* Only if VM_NameServe64 */
546 } __attribute__ ((__packed__));
547
548 struct aac_mntinfo {
549 u_int32_t Command;
550 u_int32_t MntType;
551 u_int32_t MntCount;
552 } __attribute__ ((__packed__));
553
554 struct aac_mntinforesponse {
555 u_int32_t Status;
556 u_int32_t MntType;
557 u_int32_t MntRespCount;
558 struct aac_mntobj MntTable[1];
559 } __attribute__ ((__packed__));
560
561 /*
562 * Container shutdown command.
563 */
564 struct aac_closecommand {
565 u_int32_t Command;
566 u_int32_t ContainerId;
567 } __attribute__ ((__packed__));
568
569 /*
570 * Container Config Command
571 */
572 #define CT_GET_SCSI_METHOD 64
573 struct aac_ctcfg {
574 u_int32_t Command;
575 u_int32_t cmd;
576 u_int32_t param;
577 } __attribute__ ((__packed__));
578
579 struct aac_ctcfg_resp {
580 u_int32_t Status;
581 u_int32_t resp;
582 u_int32_t param;
583 } __attribute__ ((__packed__));
584
585 /*
586 * 'Ioctl' commads
587 */
588 #define AAC_SCSI_MAX_PORTS 10
589 #define AAC_BUS_NO_EXIST 0
590 #define AAC_BUS_VALID 1
591 #define AAC_BUS_FAULTED 2
592 #define AAC_BUS_DISABLED 3
593 #define GetBusInfo 0x9
594
595 struct aac_getbusinf {
596 u_int32_t ProbeComplete;
597 u_int32_t BusCount;
598 u_int32_t TargetsPerBus;
599 u_int8_t InitiatorBusId[AAC_SCSI_MAX_PORTS];
600 u_int8_t BusValid[AAC_SCSI_MAX_PORTS];
601 } __attribute__ ((__packed__));
602
603 struct aac_vmioctl {
604 u_int32_t Command;
605 u_int32_t ObjType;
606 u_int32_t MethId;
607 u_int32_t ObjId;
608 u_int32_t IoctlCmd;
609 u_int32_t IoctlBuf[1]; /* Placeholder? */
610 } __attribute__ ((__packed__));
611
612 struct aac_vmi_businf_resp {
613 u_int32_t Status;
614 u_int32_t ObjType;
615 u_int32_t MethId;
616 u_int32_t ObjId;
617 u_int32_t IoctlCmd;
618 struct aac_getbusinf BusInf;
619 } __attribute__ ((__packed__));
620
621 #if 0
622 #define AAC_BTL_TO_HANDLE(b, t, l) \
623 (((b & 0x3f) << 7) | ((l & 0x7) << 4) | (t & 0xf))
624 #else
625 #define AAC_BTL_TO_HANDLE(b, t, l) \
626 ((((u_int32_t)b & 0x0f) << 24) | \
627 (((u_int32_t)l & 0xff) << 16) | \
628 ((u_int32_t)t & 0xffff))
629 #endif
630 #define GetDeviceProbeInfo 0x5
631
632 struct aac_vmi_devinfo_resp {
633 u_int32_t Status;
634 u_int32_t ObjType;
635 u_int32_t MethId;
636 u_int32_t ObjId;
637 u_int32_t IoctlCmd;
638 u_int8_t VendorId[8];
639 u_int8_t ProductId[16];
640 u_int8_t ProductRev[4];
641 u_int32_t Inquiry7;
642 u_int32_t align1;
643 u_int32_t Inquiry0;
644 u_int32_t align2;
645 u_int32_t Inquiry1;
646 u_int32_t align3;
647 u_int32_t reserved[2];
648 u_int8_t VendorSpecific[20];
649 u_int32_t Smart:1;
650 u_int32_t AAC_Managed:1;
651 u_int32_t align4;
652 u_int32_t reserved2:6;
653 u_int32_t Bus;
654 u_int32_t Target;
655 u_int32_t Lun;
656 u_int32_t ultraEnable:1,
657 disconnectEnable:1,
658 fast20EnabledW:1,
659 scamDevice:1,
660 scamTolerant:1,
661 setForSync:1,
662 setForWide:1,
663 syncDevice:1,
664 wideDevice:1,
665 reserved1:7,
666 ScsiRate:8,
667 ScsiOffset:8;
668 }; /* Do not pack */
669
670 #define ResetBus 0x16
671 struct aac_resetbus {
672 u_int32_t BusNumber;
673 };
674
675 /*
676 * Write 'stability' options.
677 */
678 #define CSTABLE 1
679 #define CUNSTABLE 2
680
681 /*
682 * Commit level response for a write request.
683 */
684 #define CMFILE_SYNC_NVRAM 1
685 #define CMDATA_SYNC_NVRAM 2
686 #define CMFILE_SYNC 3
687 #define CMDATA_SYNC 4
688 #define CMUNSTABLE 5
689
690 /*
691 * Block read/write operations. These structures are packed into the 'data'
692 * area in the FIB.
693 */
694 struct aac_blockread {
695 u_int32_t Command; /* not FSACommand! */
696 u_int32_t ContainerId;
697 u_int32_t BlockNumber;
698 u_int32_t ByteCount;
699 struct aac_sg_table SgMap; /* variable size */
700 } __attribute__ ((__packed__));
701
702 struct aac_blockread64 {
703 u_int32_t Command; /* not FSACommand! */
704 u_int16_t ContainerId;
705 u_int16_t SectorCount;
706 u_int32_t BlockNumber;
707 u_int16_t Pad;
708 u_int16_t Flags;
709 struct aac_sg_table64 SgMap64; /* variable size */
710 } __attribute__ ((__packed__));
711
712 struct aac_blockread_response {
713 u_int32_t Status;
714 u_int32_t ByteCount;
715 } __attribute__ ((__packed__));
716
717 struct aac_blockwrite {
718 u_int32_t Command; /* not FSACommand! */
719 u_int32_t ContainerId;
720 u_int32_t BlockNumber;
721 u_int32_t ByteCount;
722 u_int32_t Stable;
723 struct aac_sg_table SgMap; /* variable size */
724 } __attribute__ ((__packed__));
725
726 struct aac_blockwrite64 {
727 u_int32_t Command; /* not FSACommand! */
728 u_int16_t ContainerId;
729 u_int16_t SectorCount;
730 u_int32_t BlockNumber;
731 u_int16_t Pad;
732 u_int16_t Flags;
733 struct aac_sg_table64 SgMap64; /* variable size */
734 } __attribute__ ((__packed__));
735
736 struct aac_blockwrite_response {
737 u_int32_t Status;
738 u_int32_t ByteCount;
739 u_int32_t Committed;
740 } __attribute__ ((__packed__));
741
742 struct aac_raw_io {
743 u_int64_t BlockNumber;
744 u_int32_t ByteCount;
745 u_int16_t ContainerId;
746 u_int16_t Flags; /* 0: W, 1: R */
747 u_int16_t BpTotal; /* reserved for FW use */
748 u_int16_t BpComplete; /* reserved for FW use */
749 struct aac_sg_tableraw SgMapRaw; /* variable size */
750 } __attribute__ ((__packed__));
751
752 struct aac_close_command {
753 u_int32_t Command;
754 u_int32_t ContainerId;
755 } __attribute__ ((__packed__));
756
757 /*
758 * SCSI Passthrough structures
759 */
760 struct aac_srb32 {
761 u_int32_t function;
762 u_int32_t bus;
763 u_int32_t target;
764 u_int32_t lun;
765 u_int32_t timeout;
766 u_int32_t flags;
767 u_int32_t data_len;
768 u_int32_t retry_limit;
769 u_int32_t cdb_len;
770 u_int8_t cdb[16];
771 struct aac_sg_table sg_map32;
772 };
773
774 #define AAC_SRB_FUNC_EXECUTE_SCSI 0x00
775 #define AAC_SRB_FUNC_CLAIM_DEVICE 0x01
776 #define AAC_SRB_FUNC_IO_CONTROL 0x02
777 #define AAC_SRB_FUNC_RECEIVE_EVENT 0x03
778 #define AAC_SRB_FUNC_RELEASE_QUEUE 0x04
779 #define AAC_SRB_FUNC_ATTACH_DEVICE 0x05
780 #define AAC_SRB_FUNC_RELEASE_DEVICE 0x06
781 #define AAC_SRB_FUNC_SHUTDOWN 0x07
782 #define AAC_SRB_FUNC_FLUSH 0x08
783 #define AAC_SRB_FUNC_ABORT_COMMAND 0x10
784 #define AAC_SRB_FUNC_RELEASE_RECOVERY 0x11
785 #define AAC_SRB_FUNC_RESET_BUS 0x12
786 #define AAC_SRB_FUNC_RESET_DEVICE 0x13
787 #define AAC_SRB_FUNC_TERMINATE_IO 0x14
788 #define AAC_SRB_FUNC_FLUSH_QUEUE 0x15
789 #define AAC_SRB_FUNC_REMOVE_DEVICE 0x16
790 #define AAC_SRB_FUNC_DOMAIN_VALIDATION 0x17
791
792 #define AAC_SRB_FLAGS_NO_DATA_XFER 0x0000
793 #define AAC_SRB_FLAGS_DISABLE_DISCONNECT 0x0004
794 #define AAC_SRB_FLAGS_DISABLE_SYNC_TRANSFER 0x0008
795 #define AAC_SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x0010
796 #define AAC_SRB_FLAGS_DISABLE_AUTOSENSE 0x0020
797 #define AAC_SRB_FLAGS_DATA_IN 0x0040
798 #define AAC_SRB_FLAGS_DATA_OUT 0x0080
799 #define AAC_SRB_FLAGS_UNSPECIFIED_DIRECTION \
800 (AAC_SRB_FLAGS_DATA_IN | AAC_SRB_FLAGS_DATA_OUT)
801
802 #define AAC_HOST_SENSE_DATA_MAX 30
803
804 struct aac_srb_response {
805 u_int32_t fib_status;
806 u_int32_t srb_status;
807 u_int32_t scsi_status;
808 u_int32_t data_len;
809 u_int32_t sense_len;
810 u_int8_t sense[AAC_HOST_SENSE_DATA_MAX];
811 };
812
813 /*
814 * Status codes for SCSI passthrough commands. Since they are based on ASPI,
815 * they also exactly match CAM status codes in both enumeration and meaning.
816 * They seem to also be used as status codes for synchronous FIBs.
817 */
818 #define AAC_SRB_STS_PENDING 0x00
819 #define AAC_SRB_STS_SUCCESS 0x01
820 #define AAC_SRB_STS_ABORTED 0x02
821 #define AAC_SRB_STS_ABORT_FAILED 0x03
822 #define AAC_SRB_STS_ERROR 0x04
823 #define AAC_SRB_STS_BUSY 0x05
824 #define AAC_SRB_STS_INVALID_REQUEST 0x06
825 #define AAC_SRB_STS_INVALID_PATH_ID 0x07
826 #define AAC_SRB_STS_NO_DEVICE 0x08
827 #define AAC_SRB_STS_TIMEOUT 0x09
828 #define AAC_SRB_STS_SELECTION_TIMEOUT 0x0a
829 #define AAC_SRB_STS_COMMAND_TIMEOUT 0x0b
830 #define AAC_SRB_STS_MESSAGE_REJECTED 0x0d
831 #define AAC_SRB_STS_BUS_RESET 0x0e
832 #define AAC_SRB_STS_PARITY_ERROR 0x0f
833 #define AAC_SRB_STS_REQUEST_SENSE_FAILED 0x10
834 #define AAC_SRB_STS_NO_HBA 0x11
835 #define AAC_SRB_STS_DATA_OVERRUN 0x12
836 #define AAC_SRB_STS_UNEXPECTED_BUS_FREE 0x13
837 #define AAC_SRB_STS_PHASE_SEQUENCE_FAILURE 0x14
838 #define AAC_SRB_STS_BAD_SRB_BLOCK_LENGTH 0x15
839 #define AAC_SRB_STS_REQUEST_FLUSHED 0x16
840 #define AAC_SRB_STS_INVALID_LUN 0x20
841 #define AAC_SRB_STS_INVALID_TARGET_ID 0x21
842 #define AAC_SRB_STS_BAD_FUNCTION 0x22
843 #define AAC_SRB_STS_ERROR_RECOVER 0x23
844
845 /*
846 * Register set for adapters based on the Falcon bridge and PPC core
847 */
848
849 #define AAC_FA_DOORBELL0_CLEAR 0x00
850 #define AAC_FA_DOORBELL1_CLEAR 0x02
851 #define AAC_FA_DOORBELL0 0x04
852 #define AAC_FA_DOORBELL1 0x06
853 #define AAC_FA_MASK0_CLEAR 0x08
854 #define AAC_FA_MASK1_CLEAR 0x0a
855 #define AAC_FA_MASK0 0x0c
856 #define AAC_FA_MASK1 0x0e
857 #define AAC_FA_MAILBOX 0x10
858 #define AAC_FA_FWSTATUS 0x2c /* Mailbox 7 */
859 #define AAC_FA_INTSRC 0x900
860
861 #define AAC_FA_HACK(sc) (void)AAC_GETREG4(sc, AAC_FA_INTSRC)
862
863 /*
864 * Register definitions for the Adaptec AAC-364 'Jalapeno I/II' adapters, based
865 * on the SA110 'StrongArm'.
866 */
867
868 #define AAC_REGSIZE 0x100
869
870 /* doorbell 0 (adapter->host) */
871 #define AAC_SA_DOORBELL0_CLEAR 0x98
872 #define AAC_SA_DOORBELL0_SET 0x9c
873 #define AAC_SA_DOORBELL0 0x9c
874 #define AAC_SA_MASK0_CLEAR 0xa0
875 #define AAC_SA_MASK0_SET 0xa4
876
877 /* doorbell 1 (host->adapter) */
878 #define AAC_SA_DOORBELL1_CLEAR 0x9a
879 #define AAC_SA_DOORBELL1_SET 0x9e
880 #define AAC_SA_MASK1_CLEAR 0xa2
881 #define AAC_SA_MASK1_SET 0xa6
882
883 /* mailbox (20 bytes) */
884 #define AAC_SA_MAILBOX 0xa8
885 #define AAC_SA_FWSTATUS 0xc4
886
887 /*
888 * Register definitions for the Adaptec 'Pablano' adapters, based on the
889 * i960Rx, and other related adapters.
890 */
891
892 #define AAC_RX_IDBR 0x20 /* inbound doorbell */
893 #define AAC_RX_IISR 0x24 /* inbound interrupt status */
894 #define AAC_RX_IIMR 0x28 /* inbound interrupt mask */
895 #define AAC_RX_ODBR 0x2c /* outbound doorbell */
896 #define AAC_RX_OISR 0x30 /* outbound interrupt status */
897 #define AAC_RX_OIMR 0x34 /* outbound interrupt mask */
898 #define AAC_RX_IQUE 0x40 /* inbound queue */
899 #define AAC_RX_OQUE 0x44 /* outbound queue */
900
901 #define AAC_RX_MAILBOX 0x50 /* mailbox (20 bytes) */
902 #define AAC_RX_FWSTATUS 0x6c
903
904 /*
905 * Register definitions for the Adaptec 'Rocket' RAID-On-Chip adapters.
906 * Unsurprisingly, it's quite similar to the i960!
907 */
908
909 #define AAC_RKT_IDBR 0x20 /* inbound doorbell register */
910 #define AAC_RKT_IISR 0x24 /* inbound interrupt status register */
911 #define AAC_RKT_IIMR 0x28 /* inbound interrupt mask register */
912 #define AAC_RKT_ODBR 0x2c /* outbound doorbell register */
913 #define AAC_RKT_OISR 0x30 /* outbound interrupt status register */
914 #define AAC_RKT_OIMR 0x34 /* outbound interrupt mask register */
915 #define AAC_RKT_IQUE 0x40 /* inbound queue */
916 #define AAC_RKT_OQUE 0x44 /* outbound queue */
917
918 #define AAC_RKT_MAILBOX 0x1000 /* mailbox */
919 #define AAC_RKT_FWSTATUS 0x101c /* Firmware Status (mailbox 7) */
920
921 /*
922 * Common bit definitions for the doorbell registers.
923 */
924
925 /*
926 * Status bits in the doorbell registers.
927 */
928 #define AAC_DB_SYNC_COMMAND (1<<0) /* send/completed synchronous FIB */
929 #define AAC_DB_COMMAND_READY (1<<1) /* posted one or more commands */
930 #define AAC_DB_RESPONSE_READY (1<<2) /* one or more commands complete */
931 #define AAC_DB_COMMAND_NOT_FULL (1<<3) /* command queue not full */
932 #define AAC_DB_RESPONSE_NOT_FULL (1<<4) /* response queue not full */
933
934 /*
935 * The adapter can request the host print a message by setting the
936 * DB_PRINTF flag in DOORBELL0. The driver responds by collecting the
937 * message from the printf buffer, clearing the DB_PRINTF flag in
938 * DOORBELL0 and setting it in DOORBELL1.
939 * (ODBR and IDBR respectively for the i960Rx adapters)
940 */
941 #define AAC_DB_PRINTF (1<<5) /* adapter requests host printf */
942 #define AAC_PRINTF_DONE (1<<5) /* host completed printf processing */
943
944 /*
945 * Mask containing the interrupt bits we care about. We don't anticipate
946 * (or want) interrupts not in this mask.
947 */
948 #define AAC_DB_INTERRUPTS \
949 (AAC_DB_COMMAND_READY | AAC_DB_RESPONSE_READY | AAC_DB_PRINTF)
950 #define AAC_DB_INT_NEW_COMM 0x08
951
952 /*
953 * Queue names
954 *
955 * Note that we base these at 0 in order to use them as array indices. Adaptec
956 * used base 1 for some unknown reason, and sorted them in a different order.
957 */
958 #define AAC_HOST_NORM_CMD_QUEUE 0
959 #define AAC_HOST_HIGH_CMD_QUEUE 1
960 #define AAC_ADAP_NORM_CMD_QUEUE 2
961 #define AAC_ADAP_HIGH_CMD_QUEUE 3
962 #define AAC_HOST_NORM_RESP_QUEUE 4
963 #define AAC_HOST_HIGH_RESP_QUEUE 5
964 #define AAC_ADAP_NORM_RESP_QUEUE 6
965 #define AAC_ADAP_HIGH_RESP_QUEUE 7
966
967 /*
968 * List structure used to chain FIBs (used by the adapter - we hang FIBs off
969 * our private command structure and don't touch these)
970 */
971 struct aac_fib_list_entry {
972 u_int32_t Flink;
973 u_int32_t Blink;
974 } __attribute__((__packed__));
975
976 /*
977 * FIB (FSA Interface Block?); this is the datastructure passed between the
978 * host and adapter.
979 */
980 struct aac_fib_header {
981 u_int32_t XferState;
982 u_int16_t Command;
983 u_int8_t StructType;
984 u_int8_t Flags;
985 u_int16_t Size;
986 u_int16_t SenderSize;
987 u_int32_t SenderFibAddress;
988 u_int32_t ReceiverFibAddress;
989 u_int32_t SenderData;
990 union {
991 struct {
992 u_int32_t ReceiverTimeStart;
993 u_int32_t ReceiverTimeDone;
994 } _s;
995 struct aac_fib_list_entry FibLinks;
996 } _u;
997 } __attribute__((__packed__));
998
999 #define AAC_FIB_DATASIZE (512 - sizeof(struct aac_fib_header))
1000
1001 struct aac_fib {
1002 struct aac_fib_header Header;
1003 u_int8_t data[AAC_FIB_DATASIZE];
1004 } __attribute__((__packed__));
1005
1006 /*
1007 * FIB commands
1008 */
1009 #define TestCommandResponse 1
1010 #define TestAdapterCommand 2
1011
1012 /* Lowlevel and comm commands */
1013 #define LastTestCommand 100
1014 #define ReinitHostNormCommandQueue 101
1015 #define ReinitHostHighCommandQueue 102
1016 #define ReinitHostHighRespQueue 103
1017 #define ReinitHostNormRespQueue 104
1018 #define ReinitAdapNormCommandQueue 105
1019 #define ReinitAdapHighCommandQueue 107
1020 #define ReinitAdapHighRespQueue 108
1021 #define ReinitAdapNormRespQueue 109
1022 #define InterfaceShutdown 110
1023 #define DmaCommandFib 120
1024 #define StartProfile 121
1025 #define TermProfile 122
1026 #define SpeedTest 123
1027 #define TakeABreakPt 124
1028 #define RequestPerfData 125
1029 #define SetInterruptDefTimer 126
1030 #define SetInterruptDefCount 127
1031 #define GetInterruptDefStatus 128
1032 #define LastCommCommand 129
1033
1034 /* filesystem commands */
1035 #define NuFileSystem 300
1036 #define UFS 301
1037 #define HostFileSystem 302
1038 #define LastFileSystemCommand 303
1039
1040 /* Container Commands */
1041 #define ContainerCommand 500
1042 #define ContainerCommand64 501
1043 #define RawIo 502
1044
1045 /* Cluster Commands */
1046 #define ClusterCommand 550
1047
1048 /* Scsi Port commands (scsi passthrough) */
1049 #define ScsiPortCommand 600
1050 #define ScsiPortCommandU64 601
1051 #define SataPortCommandU64 602
1052 #define SasSmpPassThrough 603
1053 #define SasRequestPhyInfo 612
1054
1055 /* Misc house keeping and generic adapter initiated commands */
1056 #define AifRequest 700
1057 #define CheckRevision 701
1058 #define FsaHostShutdown 702
1059 #define RequestAdapterInfo 703
1060 #define IsAdapterPaused 704
1061 #define SendHostTime 705
1062 #define RequestSupplementAdapterInfo 706 /* Supp. Info for set in UCC
1063 * use only if supported
1064 * (RequestAdapterInfo first) */
1065 #define LastMiscCommand 707
1066
1067 #define OnLineDiagnostic 800
1068 #define FduAdapterTest 801
1069 #define RequestCompatibilityId 802
1070 #define AdapterEnvironmentInfo 803 /* temp. sensors */
1071
1072 #define NvsramEventLog 900
1073 #define ResetNvsramEventLogPointers 901
1074 #define EnableEventLog 902
1075 #define DisableEventLog 903
1076 #define EncryptedKeyTransportFIB 904
1077 #define KeyableFeaturesFIB 905
1078
1079 /*
1080 * FIB types
1081 */
1082 #define AAC_FIBTYPE_TFIB 1
1083 #define AAC_FIBTYPE_TQE 2
1084 #define AAC_FIBTYPE_TCTPERF 3
1085
1086 /*
1087 * FIB transfer state
1088 */
1089 #define AAC_FIBSTATE_HOSTOWNED (1<<0) /* owned by the host */
1090 #define AAC_FIBSTATE_ADAPTEROWNED (1<<1) /* owned by the adapter */
1091 #define AAC_FIBSTATE_INITIALISED (1<<2) /* initialised */
1092 #define AAC_FIBSTATE_EMPTY (1<<3) /* empty */
1093 #define AAC_FIBSTATE_FROMPOOL (1<<4) /* allocated from pool */
1094 #define AAC_FIBSTATE_FROMHOST (1<<5) /* sent from the host */
1095 #define AAC_FIBSTATE_FROMADAP (1<<6) /* sent from the adapter */
1096 #define AAC_FIBSTATE_REXPECTED (1<<7) /* response is expected */
1097 #define AAC_FIBSTATE_RNOTEXPECTED (1<<8) /* response is not expected */
1098 #define AAC_FIBSTATE_DONEADAP (1<<9) /* processed by the adapter */
1099 #define AAC_FIBSTATE_DONEHOST (1<<10) /* processed by the host */
1100 #define AAC_FIBSTATE_HIGH (1<<11) /* high priority */
1101 #define AAC_FIBSTATE_NORM (1<<12) /* normal priority */
1102 #define AAC_FIBSTATE_ASYNC (1<<13)
1103 #define AAC_FIBSTATE_ASYNCIO (1<<13) /* to be removed */
1104 #define AAC_FIBSTATE_PAGEFILEIO (1<<14) /* to be removed */
1105 #define AAC_FIBSTATE_SHUTDOWN (1<<15)
1106 #define AAC_FIBSTATE_LAZYWRITE (1<<16) /* to be removed */
1107 #define AAC_FIBSTATE_ADAPMICROFIB (1<<17)
1108 #define AAC_FIBSTATE_BIOSFIB (1<<18)
1109 #define AAC_FIBSTATE_FAST_RESPONSE (1<<19) /* fast response capable */
1110 #define AAC_FIBSTATE_APIFIB (1<<20)
1111
1112 /*
1113 * FIB error values
1114 */
1115 #define AAC_ERROR_NORMAL 0x00
1116 #define AAC_ERROR_PENDING 0x01
1117 #define AAC_ERROR_FATAL 0x02
1118 #define AAC_ERROR_INVALID_QUEUE 0x03
1119 #define AAC_ERROR_NOENTRIES 0x04
1120 #define AAC_ERROR_SENDFAILED 0x05
1121 #define AAC_ERROR_INVALID_QUEUE_PRIORITY 0x06
1122 #define AAC_ERROR_FIB_ALLOCATION_FAILED 0x07
1123 #define AAC_ERROR_FIB_DEALLOCATION_FAILED 0x08
1124
1125 /*
1126 * Adapter Status Register
1127 *
1128 * Phase Staus mailbox is 32bits:
1129 * <31:16> = Phase Status
1130 * <15:0> = Phase
1131 *
1132 * The adapter reports its present state through the phase. Only
1133 * a single phase should be ever be set. Each phase can have multiple
1134 * phase status bits to provide more detailed information about the
1135 * state of the adapter.
1136 */
1137 #define AAC_SELF_TEST_FAILED 0x00000004
1138 #define AAC_MONITOR_PANIC 0x00000020
1139 #define AAC_UP_AND_RUNNING 0x00000080
1140 #define AAC_KERNEL_PANIC 0x00000100
1141
1142 /*
1143 * Data types relating to control and monitoring of the NVRAM/WriteCache
1144 * subsystem.
1145 */
1146
1147 #define AAC_NFILESYS 24 /* maximum number of filesystems */
1148
1149 /*
1150 * NVRAM/Write Cache subsystem states
1151 */
1152 typedef enum {
1153 NVSTATUS_DISABLED = 0, /* present, clean, not being used */
1154 NVSTATUS_ENABLED, /* present, possibly dirty, ready for use */
1155 NVSTATUS_ERROR, /* present, dirty, contains dirty data */
1156 NVSTATUS_BATTERY, /* present, bad or low battery, may contain
1157 * dirty data */
1158 NVSTATUS_UNKNOWN /* for bad/missing device */
1159 } AAC_NVSTATUS;
1160
1161 /*
1162 * NVRAM/Write Cache subsystem battery component states
1163 *
1164 */
1165 typedef enum {
1166 NVBATTSTATUS_NONE = 0, /* battery has no power or is not present */
1167 NVBATTSTATUS_LOW, /* battery is low on power */
1168 NVBATTSTATUS_OK, /* battery is okay - normal operation possible
1169 * only in this state */
1170 NVBATTSTATUS_RECONDITIONING /* no battery present - reconditioning
1171 * in process */
1172 } AAC_NVBATTSTATUS;
1173
1174 /*
1175 * Battery transition type
1176 */
1177 typedef enum {
1178 NVBATT_TRANSITION_NONE = 0, /* battery now has no power or is not
1179 * present */
1180 NVBATT_TRANSITION_LOW, /* battery is now low on power */
1181 NVBATT_TRANSITION_OK /* battery is now okay - normal
1182 * operation possible only in this
1183 * state */
1184 } AAC_NVBATT_TRANSITION;
1185
1186 /*
1187 * NVRAM Info structure returned for NVRAM_GetInfo call
1188 */
1189 struct aac_nvramdevinfo {
1190 u_int32_t NV_Enabled; /* write caching enabled */
1191 u_int32_t NV_Error; /* device in error state */
1192 u_int32_t NV_NDirty; /* count of dirty NVRAM buffers */
1193 u_int32_t NV_NActive; /* count of NVRAM buffers being
1194 * written */
1195 } __attribute__ ((__packed__));
1196
1197 struct aac_nvraminfo {
1198 AAC_NVSTATUS NV_Status; /* nvram subsystem status */
1199 AAC_NVBATTSTATUS NV_BattStatus; /* battery status */
1200 u_int32_t NV_Size; /* size of WriteCache NVRAM in
1201 * bytes */
1202 u_int32_t NV_BufSize; /* size of NVRAM buffers in
1203 * bytes */
1204 u_int32_t NV_NBufs; /* number of NVRAM buffers */
1205 u_int32_t NV_NDirty; /* Num dirty NVRAM buffers */
1206 u_int32_t NV_NClean; /* Num clean NVRAM buffers */
1207 u_int32_t NV_NActive; /* Num NVRAM buffers being
1208 * written */
1209 u_int32_t NV_NBrokered; /* Num brokered NVRAM buffers */
1210 struct aac_nvramdevinfo NV_DevInfo[AAC_NFILESYS]; /* per device
1211 * info */
1212 u_int32_t NV_BattNeedsReconditioning; /* boolean */
1213 u_int32_t NV_TotalSize; /* size of all non-volatile
1214 * memories in bytes */
1215 } __attribute__ ((__packed__));
1216
1217 /*
1218 * Data types relating to adapter-initiated FIBs
1219 *
1220 * Based on types and structures in <aifstruc.h>
1221 */
1222
1223 /*
1224 * Progress Reports
1225 */
1226 typedef enum {
1227 AifJobStsSuccess = 1,
1228 AifJobStsFinished,
1229 AifJobStsAborted,
1230 AifJobStsFailed,
1231 AifJobStsLastReportMarker = 100, /* All prior mean last report */
1232 AifJobStsSuspended,
1233 AifJobStsRunning
1234 } AAC_AifJobStatus;
1235
1236 typedef enum {
1237 AifJobScsiMin = 1, /* Minimum value for Scsi operation */
1238 AifJobScsiZero, /* SCSI device clear operation */
1239 AifJobScsiVerify, /* SCSI device Verify operation NO
1240 * REPAIR */
1241 AifJobScsiExercise, /* SCSI device Exercise operation */
1242 AifJobScsiVerifyRepair, /* SCSI device Verify operation WITH
1243 * repair */
1244 AifJobScsiWritePattern, /* write pattern */
1245 AifJobScsiMax = 99, /* Max Scsi value */
1246 AifJobCtrMin, /* Min Ctr op value */
1247 AifJobCtrZero, /* Container clear operation */
1248 AifJobCtrCopy, /* Container copy operation */
1249 AifJobCtrCreateMirror, /* Container Create Mirror operation */
1250 AifJobCtrMergeMirror, /* Container Merge Mirror operation */
1251 AifJobCtrScrubMirror, /* Container Scrub Mirror operation */
1252 AifJobCtrRebuildRaid5, /* Container Rebuild Raid5 operation */
1253 AifJobCtrScrubRaid5, /* Container Scrub Raid5 operation */
1254 AifJobCtrMorph, /* Container morph operation */
1255 AifJobCtrPartCopy, /* Container Partition copy operation */
1256 AifJobCtrRebuildMirror, /* Container Rebuild Mirror operation */
1257 AifJobCtrCrazyCache, /* crazy cache */
1258 AifJobCtrCopyback, /* Container Copyback operation */
1259 AifJobCtrCompactRaid5D, /* Container Compaction operation */
1260 AifJobCtrExpandRaid5D, /* Container Expansion operation */
1261 AifJobCtrRebuildRaid6, /* Container Rebuild Raid6 operation */
1262 AifJobCtrScrubRaid6, /* Container Scrub Raid6 operation */
1263 AifJobCtrSSBackup, /* Container snapshot backup task */
1264 AifJobCtrMax = 199, /* Max Ctr type operation */
1265 AifJobFsMin, /* Min Fs type operation */
1266 AifJobFsCreate, /* File System Create operation */
1267 AifJobFsVerify, /* File System Verify operation */
1268 AifJobFsExtend, /* File System Extend operation */
1269 AifJobFsMax = 299, /* Max Fs type operation */
1270 AifJobApiFormatNTFS, /* Format a drive to NTFS */
1271 AifJobApiFormatFAT, /* Format a drive to FAT */
1272 AifJobApiUpdateSnapshot, /* update the read/write half of a
1273 * snapshot */
1274 AifJobApiFormatFAT32, /* Format a drive to FAT32 */
1275 AifJobApiMax = 399, /* Max API type operation */
1276 AifJobCtlContinuousCtrVerify, /* Adapter operation */
1277 AifJobCtlMax = 499 /* Max Adapter type operation */
1278 } AAC_AifJobType;
1279
1280 struct aac_AifContainers {
1281 u_int32_t src; /* from/master */
1282 u_int32_t dst; /* to/slave */
1283 } __attribute__ ((__packed__));
1284
1285 union aac_AifJobClient {
1286 struct aac_AifContainers container; /* For Container and
1287 * filesystem progress
1288 * ops; */
1289 int32_t scsi_dh; /* For SCSI progress
1290 * ops */
1291 };
1292
1293 struct aac_AifJobDesc {
1294 u_int32_t jobID; /* DO NOT FILL IN! Will be
1295 * filled in by AIF */
1296 AAC_AifJobType type; /* Operation that is being
1297 * performed */
1298 union aac_AifJobClient client; /* Details */
1299 } __attribute__ ((__packed__));
1300
1301 struct aac_AifJobProgressReport {
1302 struct aac_AifJobDesc jd;
1303 AAC_AifJobStatus status;
1304 u_int32_t finalTick;
1305 u_int32_t currentTick;
1306 u_int32_t jobSpecificData1;
1307 u_int32_t jobSpecificData2;
1308 } __attribute__ ((__packed__));
1309
1310 /*
1311 * Event Notification
1312 */
1313 typedef enum {
1314 /* General application notifies start here */
1315 AifEnGeneric = 1, /* Generic notification */
1316 AifEnTaskComplete, /* Task has completed */
1317 AifEnConfigChange, /* Adapter config change occurred */
1318 AifEnContainerChange, /* Adapter specific container
1319 * configuration change */
1320 AifEnDeviceFailure, /* SCSI device failed */
1321 AifEnMirrorFailover, /* Mirror failover started */
1322 AifEnContainerEvent, /* Significant container event */
1323 AifEnFileSystemChange, /* File system changed */
1324 AifEnConfigPause, /* Container pause event */
1325 AifEnConfigResume, /* Container resume event */
1326 AifEnFailoverChange, /* Failover space assignment changed */
1327 AifEnRAID5RebuildDone, /* RAID5 rebuild finished */
1328 AifEnEnclosureManagement, /* Enclosure management event */
1329 AifEnBatteryEvent, /* Significant NV battery event */
1330 AifEnAddContainer, /* A new container was created. */
1331 AifEnDeleteContainer, /* A container was deleted. */
1332 AifEnSMARTEvent, /* SMART Event */
1333 AifEnBatteryNeedsRecond, /* The battery needs reconditioning */
1334 AifEnClusterEvent, /* Some cluster event */
1335 AifEnDiskSetEvent, /* A disk set event occured. */
1336 AifDriverNotifyStart=199, /* Notifies for host driver go here */
1337 /* Host driver notifications start here */
1338 AifDenMorphComplete, /* A morph operation completed */
1339 AifDenVolumeExtendComplete /* Volume expand operation completed */
1340 } AAC_AifEventNotifyType;
1341
1342 struct aac_AifEnsGeneric {
1343 char text[132]; /* Generic text */
1344 } __attribute__ ((__packed__));
1345
1346 struct aac_AifEnsDeviceFailure {
1347 u_int32_t deviceHandle; /* SCSI device handle */
1348 } __attribute__ ((__packed__));
1349
1350 struct aac_AifEnsMirrorFailover {
1351 u_int32_t container; /* Container with failed element */
1352 u_int32_t failedSlice; /* Old slice which failed */
1353 u_int32_t creatingSlice; /* New slice used for auto-create */
1354 } __attribute__ ((__packed__));
1355
1356 struct aac_AifEnsContainerChange {
1357 u_int32_t container[2]; /* container that changed, -1 if no
1358 * container */
1359 } __attribute__ ((__packed__));
1360
1361 struct aac_AifEnsContainerEvent {
1362 u_int32_t container; /* container number */
1363 u_int32_t eventType; /* event type */
1364 } __attribute__ ((__packed__));
1365
1366 struct aac_AifEnsEnclosureEvent {
1367 u_int32_t empID; /* enclosure management proc number */
1368 u_int32_t unitID; /* unitId, fan id, power supply id,
1369 * slot id, tempsensor id. */
1370 u_int32_t eventType; /* event type */
1371 } __attribute__ ((__packed__));
1372
1373 struct aac_AifEnsBatteryEvent {
1374 AAC_NVBATT_TRANSITION transition_type; /* eg from low to ok */
1375 AAC_NVBATTSTATUS current_state; /* current batt state */
1376 AAC_NVBATTSTATUS prior_state; /* prev batt state */
1377 } __attribute__ ((__packed__));
1378
1379 struct aac_AifEnsDiskSetEvent {
1380 u_int32_t eventType;
1381 u_int64_t DsNum;
1382 u_int64_t CreatorId;
1383 } __attribute__ ((__packed__));
1384
1385 typedef enum {
1386 CLUSTER_NULL_EVENT = 0,
1387 CLUSTER_PARTNER_NAME_EVENT, /* change in partner hostname or
1388 * adaptername from NULL to non-NULL */
1389 /* (partner's agent may be up) */
1390 CLUSTER_PARTNER_NULL_NAME_EVENT /* change in partner hostname or
1391 * adaptername from non-null to NULL */
1392 /* (partner has rebooted) */
1393 } AAC_ClusterAifEvent;
1394
1395 struct aac_AifEnsClusterEvent {
1396 AAC_ClusterAifEvent eventType;
1397 } __attribute__ ((__packed__));
1398
1399 struct aac_AifEventNotify {
1400 AAC_AifEventNotifyType type;
1401 union {
1402 struct aac_AifEnsGeneric EG;
1403 struct aac_AifEnsDeviceFailure EDF;
1404 struct aac_AifEnsMirrorFailover EMF;
1405 struct aac_AifEnsContainerChange ECC;
1406 struct aac_AifEnsContainerEvent ECE;
1407 struct aac_AifEnsEnclosureEvent EEE;
1408 struct aac_AifEnsBatteryEvent EBE;
1409 struct aac_AifEnsDiskSetEvent EDS;
1410 /* struct aac_AifEnsSMARTEvent ES;*/
1411 struct aac_AifEnsClusterEvent ECLE;
1412 } data;
1413 } __attribute__ ((__packed__));
1414
1415 /*
1416 * Adapter Initiated FIB command structures. Start with the adapter
1417 * initiated FIBs that really come from the adapter, and get responded
1418 * to by the host.
1419 */
1420 #define AAC_AIF_REPORT_MAX_SIZE 64
1421
1422 typedef enum {
1423 AifCmdEventNotify = 1, /* Notify of event */
1424 AifCmdJobProgress, /* Progress report */
1425 AifCmdAPIReport, /* Report from other user of API */
1426 AifCmdDriverNotify, /* Notify host driver of event */
1427 AifReqJobList = 100, /* Gets back complete job list */
1428 AifReqJobsForCtr, /* Gets back jobs for specific container */
1429 AifReqJobsForScsi, /* Gets back jobs for specific SCSI device */
1430 AifReqJobReport, /* Gets back a specific job report or list */
1431 AifReqTerminateJob, /* Terminates job */
1432 AifReqSuspendJob, /* Suspends a job */
1433 AifReqResumeJob, /* Resumes a job */
1434 AifReqSendAPIReport, /* API generic report requests */
1435 AifReqAPIJobStart, /* Start a job from the API */
1436 AifReqAPIJobUpdate, /* Update a job report from the API */
1437 AifReqAPIJobFinish /* Finish a job from the API */
1438 } AAC_AifCommand;
1439
1440 struct aac_aif_command {
1441 AAC_AifCommand command; /* Tell host what type of
1442 * notify this is */
1443 u_int32_t seqNumber; /* To allow ordering of
1444 * reports (if necessary) */
1445 union {
1446 struct aac_AifEventNotify EN; /* Event notify */
1447 struct aac_AifJobProgressReport PR[1]; /* Progress report */
1448 u_int8_t AR[AAC_AIF_REPORT_MAX_SIZE];
1449 u_int8_t data[AAC_FIB_DATASIZE - 8];
1450 } data;
1451 } __attribute__ ((__packed__));
1452
1453 #endif /* !_PCI_AACREG_H_ */
Cache object: 6927178624e41e3a7b10c7538238629d
|