[BACK]Return to aacreg.h CVS log [TXT][DIR] Up to [local] / sys / dev / ic

Annotation of sys/dev/ic/aacreg.h, Revision 1.1

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

CVSweb