165793Smsmith/*- 265793Smsmith * Copyright (c) 2000 Michael Smith 381150Sscottl * Copyright (c) 2000-2001 Scott Long 465793Smsmith * Copyright (c) 2000 BSDi 581082Sscottl * Copyright (c) 2001 Adaptec, Inc. 665793Smsmith * All rights reserved. 765793Smsmith * 865793Smsmith * Redistribution and use in source and binary forms, with or without 965793Smsmith * modification, are permitted provided that the following conditions 1065793Smsmith * are met: 1165793Smsmith * 1. Redistributions of source code must retain the above copyright 1265793Smsmith * notice, this list of conditions and the following disclaimer. 1365793Smsmith * 2. Redistributions in binary form must reproduce the above copyright 1465793Smsmith * notice, this list of conditions and the following disclaimer in the 1565793Smsmith * documentation and/or other materials provided with the distribution. 1665793Smsmith * 1765793Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1865793Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1965793Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2065793Smsmith * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2165793Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2265793Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2365793Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2465793Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2565793Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2665793Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2765793Smsmith * SUCH DAMAGE. 2865793Smsmith * 2965793Smsmith * $FreeBSD$ 3065793Smsmith */ 3165793Smsmith 3265793Smsmith/* 3365793Smsmith * Data structures defining the interface between the driver and the Adaptec 3465793Smsmith * 'FSA' adapters. Note that many field names and comments here are taken 3565793Smsmith * verbatim from the Adaptec driver source in order to make comparing the 3665793Smsmith * two slightly easier. 3765793Smsmith */ 3865793Smsmith 3983114Sscottl/* 4065793Smsmith * Misc. magic numbers. 4165793Smsmith */ 4265793Smsmith#define AAC_MAX_CONTAINERS 64 4365793Smsmith#define AAC_BLOCK_SIZE 512 4465793Smsmith 4583114Sscottl/* 4665793Smsmith * Communications interface. 4765793Smsmith * 4865793Smsmith * Where datastructure layouts are closely parallel to the Adaptec sample code, 4965793Smsmith * retain their naming conventions (for now) to aid in cross-referencing. 5065793Smsmith */ 5165793Smsmith 5265793Smsmith/* 5365793Smsmith * We establish 4 command queues and matching response queues. Queues must 5465793Smsmith * be 16-byte aligned, and are sized as follows: 5565793Smsmith */ 5681082Sscottl#define AAC_HOST_NORM_CMD_ENTRIES 8 /* command adapter->host, 5781082Sscottl * normal priority */ 5881082Sscottl#define AAC_HOST_HIGH_CMD_ENTRIES 4 /* command adapter->host, 5981082Sscottl * high priority */ 6081082Sscottl#define AAC_ADAP_NORM_CMD_ENTRIES 512 /* command host->adapter, 6181082Sscottl * normal priority */ 6281082Sscottl#define AAC_ADAP_HIGH_CMD_ENTRIES 4 /* command host->adapter, 6381082Sscottl * high priority */ 6481082Sscottl#define AAC_HOST_NORM_RESP_ENTRIES 512 /* response, adapter->host, 6581082Sscottl * normal priority */ 6681082Sscottl#define AAC_HOST_HIGH_RESP_ENTRIES 4 /* response, adapter->host, 6781082Sscottl * high priority */ 6881082Sscottl#define AAC_ADAP_NORM_RESP_ENTRIES 8 /* response, host->adapter, 6981082Sscottl * normal priority */ 7081082Sscottl#define AAC_ADAP_HIGH_RESP_ENTRIES 4 /* response, host->adapter, 7181082Sscottl * high priority */ 7265793Smsmith 7365793Smsmith#define AAC_TOTALQ_LENGTH (AAC_HOST_HIGH_CMD_ENTRIES + \ 7465793Smsmith AAC_HOST_NORM_CMD_ENTRIES + \ 7565793Smsmith AAC_ADAP_HIGH_CMD_ENTRIES + \ 7665793Smsmith AAC_ADAP_NORM_CMD_ENTRIES + \ 7765793Smsmith AAC_HOST_HIGH_RESP_ENTRIES + \ 7865793Smsmith AAC_HOST_NORM_RESP_ENTRIES + \ 7965793Smsmith AAC_ADAP_HIGH_RESP_ENTRIES + \ 8065793Smsmith AAC_ADAP_NORM_RESP_ENTRIES) 8165793Smsmith#define AAC_QUEUE_COUNT 8 8265793Smsmith#define AAC_QUEUE_ALIGN 16 8365793Smsmith 8465793Smsmithstruct aac_queue_entry { 8583114Sscottl u_int32_t aq_fib_size; /* FIB size in bytes */ 8683114Sscottl u_int32_t aq_fib_addr; /* receiver-space address of the FIB */ 87103870Salfred} __packed; 8865793Smsmith 8965793Smsmith#define AAC_PRODUCER_INDEX 0 9065793Smsmith#define AAC_CONSUMER_INDEX 1 9165793Smsmith 9265793Smsmith/* 9365793Smsmith * Table of queue indices and queues used to communicate with the 9465793Smsmith * controller. This structure must be aligned to AAC_QUEUE_ALIGN 9565793Smsmith */ 9665793Smsmithstruct aac_queue_table { 9783114Sscottl /* queue consumer/producer indexes (layout mandated by adapter) */ 9883114Sscottl u_int32_t qt_qindex[AAC_QUEUE_COUNT][2]; 9965793Smsmith 10083114Sscottl /* queue entry structures (layout mandated by adapter) */ 10183114Sscottl struct aac_queue_entry qt_HostNormCmdQueue [AAC_HOST_NORM_CMD_ENTRIES]; 10283114Sscottl struct aac_queue_entry qt_HostHighCmdQueue [AAC_HOST_HIGH_CMD_ENTRIES]; 10383114Sscottl struct aac_queue_entry qt_AdapNormCmdQueue [AAC_ADAP_NORM_CMD_ENTRIES]; 10483114Sscottl struct aac_queue_entry qt_AdapHighCmdQueue [AAC_ADAP_HIGH_CMD_ENTRIES]; 10583114Sscottl struct aac_queue_entry qt_HostNormRespQueue[AAC_HOST_NORM_RESP_ENTRIES]; 10683114Sscottl struct aac_queue_entry qt_HostHighRespQueue[AAC_HOST_HIGH_RESP_ENTRIES]; 10783114Sscottl struct aac_queue_entry qt_AdapNormRespQueue[AAC_ADAP_NORM_RESP_ENTRIES]; 10883114Sscottl struct aac_queue_entry qt_AdapHighRespQueue[AAC_ADAP_HIGH_RESP_ENTRIES]; 109103870Salfred} __packed; 11065793Smsmith 11165793Smsmith/* 11265793Smsmith * Queue names 11365793Smsmith * 11465793Smsmith * Note that we base these at 0 in order to use them as array indices. Adaptec 11565793Smsmith * used base 1 for some unknown reason, and sorted them in a different order. 11665793Smsmith */ 11765793Smsmith#define AAC_HOST_NORM_CMD_QUEUE 0 11865793Smsmith#define AAC_HOST_HIGH_CMD_QUEUE 1 11965793Smsmith#define AAC_ADAP_NORM_CMD_QUEUE 2 12065793Smsmith#define AAC_ADAP_HIGH_CMD_QUEUE 3 12165793Smsmith#define AAC_HOST_NORM_RESP_QUEUE 4 12265793Smsmith#define AAC_HOST_HIGH_RESP_QUEUE 5 12365793Smsmith#define AAC_ADAP_NORM_RESP_QUEUE 6 12465793Smsmith#define AAC_ADAP_HIGH_RESP_QUEUE 7 12565793Smsmith 12665793Smsmith/* 12765793Smsmith * List structure used to chain FIBs (used by the adapter - we hang FIBs off 12865793Smsmith * our private command structure and don't touch these) 12965793Smsmith */ 13065793Smsmithstruct aac_fib_list_entry { 131109088Sscottl u_int32_t Flink; 132109088Sscottl u_int32_t Blink; 133103870Salfred} __packed; 13465793Smsmith 13565793Smsmith/* 13665793Smsmith * FIB (FSA Interface Block?); this is the datastructure passed between the host 13765793Smsmith * and adapter. 13865793Smsmith */ 13965793Smsmithstruct aac_fib_header { 14083114Sscottl u_int32_t XferState; 14183114Sscottl u_int16_t Command; 14283114Sscottl u_int8_t StructType; 14383114Sscottl u_int8_t Flags; 14483114Sscottl u_int16_t Size; 14583114Sscottl u_int16_t SenderSize; 14683114Sscottl u_int32_t SenderFibAddress; 14783114Sscottl u_int32_t ReceiverFibAddress; 14883114Sscottl u_int32_t SenderData; 14983114Sscottl union { 15083114Sscottl struct { 15183114Sscottl u_int32_t ReceiverTimeStart; 15283114Sscottl u_int32_t ReceiverTimeDone; 15383114Sscottl } _s; 15483114Sscottl struct aac_fib_list_entry FibLinks; 15583114Sscottl } _u; 156103870Salfred} __packed; 15765793Smsmith 15865793Smsmith#define AAC_FIB_DATASIZE (512 - sizeof(struct aac_fib_header)) 15965793Smsmith 16065793Smsmithstruct aac_fib { 16183114Sscottl struct aac_fib_header Header; 16283114Sscottl u_int8_t data[AAC_FIB_DATASIZE]; 163103870Salfred} __packed; 16465793Smsmith 16565793Smsmith/* 16665793Smsmith * FIB commands 16765793Smsmith */ 16865793Smsmithtypedef enum { 16983114Sscottl TestCommandResponse = 1, 17083114Sscottl TestAdapterCommand = 2, 17165793Smsmith 17283114Sscottl /* lowlevel and comm commands */ 17383114Sscottl LastTestCommand = 100, 17483114Sscottl ReinitHostNormCommandQueue = 101, 17583114Sscottl ReinitHostHighCommandQueue = 102, 17683114Sscottl ReinitHostHighRespQueue = 103, 17783114Sscottl ReinitHostNormRespQueue = 104, 17883114Sscottl ReinitAdapNormCommandQueue = 105, 17983114Sscottl ReinitAdapHighCommandQueue = 107, 18083114Sscottl ReinitAdapHighRespQueue = 108, 18183114Sscottl ReinitAdapNormRespQueue = 109, 18283114Sscottl InterfaceShutdown = 110, 18383114Sscottl DmaCommandFib = 120, 18483114Sscottl StartProfile = 121, 18583114Sscottl TermProfile = 122, 18683114Sscottl SpeedTest = 123, 18783114Sscottl TakeABreakPt = 124, 18883114Sscottl RequestPerfData = 125, 18983114Sscottl SetInterruptDefTimer= 126, 19083114Sscottl SetInterruptDefCount= 127, 19183114Sscottl GetInterruptDefStatus= 128, 19283114Sscottl LastCommCommand = 129, 19365793Smsmith 19483114Sscottl /* filesystem commands */ 19583114Sscottl NuFileSystem = 300, 19683114Sscottl UFS = 301, 19783114Sscottl HostFileSystem = 302, 19883114Sscottl LastFileSystemCommand = 303, 19965793Smsmith 20083114Sscottl /* Container Commands */ 20183114Sscottl ContainerCommand = 500, 20283114Sscottl ContainerCommand64 = 501, 203151086Sscottl RawIo = 502, 20465793Smsmith 20583114Sscottl /* Cluster Commands */ 20683114Sscottl ClusterCommand = 550, 20765793Smsmith 20883114Sscottl /* Scsi Port commands (scsi passthrough) */ 20983114Sscottl ScsiPortCommand = 600, 210151086Sscottl ScsiPortCommandU64 = 601, 211151086Sscottl SataPortCommandU64 = 602, 212151086Sscottl SasSmpPassThrough = 603, 213151086Sscottl SasRequestPhyInfo = 612, 21465793Smsmith 21583114Sscottl /* misc house keeping and generic adapter initiated commands */ 21683114Sscottl AifRequest = 700, 21783114Sscottl CheckRevision = 701, 21883114Sscottl FsaHostShutdown = 702, 21983114Sscottl RequestAdapterInfo = 703, 22083114Sscottl IsAdapterPaused = 704, 22183114Sscottl SendHostTime = 705, 222151086Sscottl RequestSupplementAdapterInfo = 706, /* Supp. Info for set in UCC 223206534Semaste * use only if supported 224151086Sscottl * (RequestAdapterInfo first) */ 225151086Sscottl LastMiscCommand = 707, 226206534Semaste 227206534Semaste OnLineDiagnostic = 800, 228206534Semaste FduAdapterTest = 801, 229151086Sscottl RequestCompatibilityId = 802, 230151086Sscottl AdapterEnvironmentInfo = 803, /* temp. sensors */ 231151086Sscottl NvsramEventLog = 900, 232151086Sscottl ResetNvsramEventLogPointers = 901, 233151086Sscottl EnableEventLog = 902, 234151086Sscottl DisableEventLog = 903, 235206534Semaste EncryptedKeyTransportFIB= 904, 236206534Semaste KeyableFeaturesFIB= 905 23765793Smsmith} AAC_FibCommands; 23865793Smsmith 23965793Smsmith/* 24065793Smsmith * FIB types 24165793Smsmith */ 24265793Smsmith#define AAC_FIBTYPE_TFIB 1 24365793Smsmith#define AAC_FIBTYPE_TQE 2 24465793Smsmith#define AAC_FIBTYPE_TCTPERF 3 24565793Smsmith 24665793Smsmith/* 24765793Smsmith * FIB transfer state 24865793Smsmith */ 24981082Sscottl#define AAC_FIBSTATE_HOSTOWNED (1<<0) /* owned by the host */ 25081082Sscottl#define AAC_FIBSTATE_ADAPTEROWNED (1<<1) /* owned by the adapter */ 25181082Sscottl#define AAC_FIBSTATE_INITIALISED (1<<2) /* initialised */ 25281082Sscottl#define AAC_FIBSTATE_EMPTY (1<<3) /* empty */ 25381082Sscottl#define AAC_FIBSTATE_FROMPOOL (1<<4) /* allocated from pool */ 25481082Sscottl#define AAC_FIBSTATE_FROMHOST (1<<5) /* sent from the host */ 25581082Sscottl#define AAC_FIBSTATE_FROMADAP (1<<6) /* sent from the adapter */ 25681082Sscottl#define AAC_FIBSTATE_REXPECTED (1<<7) /* response is expected */ 25781082Sscottl#define AAC_FIBSTATE_RNOTEXPECTED (1<<8) /* response is not expected */ 25881082Sscottl#define AAC_FIBSTATE_DONEADAP (1<<9) /* processed by the adapter */ 25981082Sscottl#define AAC_FIBSTATE_DONEHOST (1<<10) /* processed by the host */ 26081082Sscottl#define AAC_FIBSTATE_HIGH (1<<11) /* high priority */ 26181082Sscottl#define AAC_FIBSTATE_NORM (1<<12) /* normal priority */ 26281082Sscottl#define AAC_FIBSTATE_ASYNC (1<<13) 26381082Sscottl#define AAC_FIBSTATE_ASYNCIO (1<<13) /* to be removed */ 26481082Sscottl#define AAC_FIBSTATE_PAGEFILEIO (1<<14) /* to be removed */ 26581082Sscottl#define AAC_FIBSTATE_SHUTDOWN (1<<15) 26681082Sscottl#define AAC_FIBSTATE_LAZYWRITE (1<<16) /* to be removed */ 26781082Sscottl#define AAC_FIBSTATE_ADAPMICROFIB (1<<17) 26881082Sscottl#define AAC_FIBSTATE_BIOSFIB (1<<18) 26981082Sscottl#define AAC_FIBSTATE_FAST_RESPONSE (1<<19) /* fast response capable */ 27081082Sscottl#define AAC_FIBSTATE_APIFIB (1<<20) 27165793Smsmith 27265793Smsmith/* 27365793Smsmith * FIB error values 27465793Smsmith */ 27565793Smsmith#define AAC_ERROR_NORMAL 0x00 27665793Smsmith#define AAC_ERROR_PENDING 0x01 27765793Smsmith#define AAC_ERROR_FATAL 0x02 27865793Smsmith#define AAC_ERROR_INVALID_QUEUE 0x03 27965793Smsmith#define AAC_ERROR_NOENTRIES 0x04 28065793Smsmith#define AAC_ERROR_SENDFAILED 0x05 28165793Smsmith#define AAC_ERROR_INVALID_QUEUE_PRIORITY 0x06 28265793Smsmith#define AAC_ERROR_FIB_ALLOCATION_FAILED 0x07 28365793Smsmith#define AAC_ERROR_FIB_DEALLOCATION_FAILED 0x08 28465793Smsmith 28565793Smsmith/* 286206534Semaste * Adapter Init Structure: this is passed to the adapter with the 28765793Smsmith * AAC_MONKER_INITSTRUCT command to point it at our control structures. 28865793Smsmith */ 28965793Smsmithstruct aac_adapter_init { 29083114Sscottl u_int32_t InitStructRevision; 291109088Sscottl#define AAC_INIT_STRUCT_REVISION 3 292151086Sscottl#define AAC_INIT_STRUCT_REVISION_4 4 29383114Sscottl u_int32_t MiniPortRevision; 294109088Sscottl#define AAC_INIT_STRUCT_MINIPORT_REVISION 1 29583114Sscottl u_int32_t FilesystemRevision; 29683114Sscottl u_int32_t CommHeaderAddress; 29783114Sscottl u_int32_t FastIoCommAreaAddress; 29883114Sscottl u_int32_t AdapterFibsPhysicalAddress; 299109088Sscottl u_int32_t AdapterFibsVirtualAddress; 30083114Sscottl u_int32_t AdapterFibsSize; 30183114Sscottl u_int32_t AdapterFibAlign; 30283114Sscottl u_int32_t PrintfBufferAddress; 30383114Sscottl u_int32_t PrintfBufferSize; 304109088Sscottl#define AAC_PAGE_SIZE 4096 30583114Sscottl u_int32_t HostPhysMemPages; 30683114Sscottl u_int32_t HostElapsedSeconds; 307151086Sscottl /* ADAPTER_INIT_STRUCT_REVISION_4 begins here */ 308151086Sscottl u_int32_t InitFlags; /* flags for supported features */ 309212628Semaste#define AAC_INITFLAGS_NEW_COMM_SUPPORTED 1 310212628Semaste#define AAC_INITFLAGS_DRIVER_USES_UTC_TIME 0x10 311212628Semaste#define AAC_INITFLAGS_DRIVER_SUPPORTS_PM 0x20 312151086Sscottl u_int32_t MaxIoCommands; /* max outstanding commands */ 313151086Sscottl u_int32_t MaxIoSize; /* largest I/O command */ 314151086Sscottl u_int32_t MaxFibSize; /* largest FIB to adapter */ 315103870Salfred} __packed; 31665793Smsmith 31783114Sscottl/* 31865793Smsmith * Shared data types 31965793Smsmith */ 32065793Smsmith/* 32165793Smsmith * Container types 32265793Smsmith */ 32365793Smsmithtypedef enum { 32483114Sscottl CT_NONE = 0, 32583114Sscottl CT_VOLUME, 32683114Sscottl CT_MIRROR, 32783114Sscottl CT_STRIPE, 32883114Sscottl CT_RAID5, 32983114Sscottl CT_SSRW, 33083114Sscottl CT_SSRO, 33183114Sscottl CT_MORPH, 33283114Sscottl CT_PASSTHRU, 33383114Sscottl CT_RAID4, 334206534Semaste CT_RAID10, /* stripe of mirror */ 335206534Semaste CT_RAID00, /* stripe of stripe */ 336206534Semaste CT_VOLUME_OF_MIRRORS, /* volume of mirror */ 337206534Semaste CT_PSEUDO_RAID3, /* really raid4 */ 338206534Semaste CT_RAID50, /* stripe of raid5 */ 339206534Semaste CT_RAID5D, /* raid5 distributed hot-sparing */ 340151086Sscottl CT_RAID5D0, 341206534Semaste CT_RAID1E, /* extended raid1 mirroring */ 342151086Sscottl CT_RAID6, 343151086Sscottl CT_RAID60, 34465793Smsmith} AAC_FSAVolType; 34565793Smsmith 34665793Smsmith/* 34765793Smsmith * Host-addressable object types 34865793Smsmith */ 34965793Smsmithtypedef enum { 350206534Semaste FT_REG = 1, /* regular file */ 351206534Semaste FT_DIR, /* directory */ 352206534Semaste FT_BLK, /* "block" device - reserved */ 353206534Semaste FT_CHR, /* "character special" device - reserved */ 354206534Semaste FT_LNK, /* symbolic link */ 355206534Semaste FT_SOCK, /* socket */ 356206534Semaste FT_FIFO, /* fifo */ 357206534Semaste FT_FILESYS, /* ADAPTEC's "FSA"(tm) filesystem */ 358206534Semaste FT_DRIVE, /* physical disk - addressable in scsi by b/t/l */ 359206534Semaste FT_SLICE, /* virtual disk - raw volume - slice */ 360206534Semaste FT_PARTITION, /* FSA partition - carved out of a slice - building 36183114Sscottl * block for containers */ 362206534Semaste FT_VOLUME, /* Container - Volume Set */ 363206534Semaste FT_STRIPE, /* Container - Stripe Set */ 364206534Semaste FT_MIRROR, /* Container - Mirror Set */ 365206534Semaste FT_RAID5, /* Container - Raid 5 Set */ 366206534Semaste FT_DATABASE /* Storage object with "foreign" content manager */ 36765793Smsmith} AAC_FType; 36865793Smsmith 36965793Smsmith/* 37065793Smsmith * Host-side scatter/gather list for 32-bit commands. 37165793Smsmith */ 37265793Smsmithstruct aac_sg_entry { 37383114Sscottl u_int32_t SgAddress; 37483114Sscottl u_int32_t SgByteCount; 375103870Salfred} __packed; 37665793Smsmith 377112679Sscottlstruct aac_sg_entry64 { 378112679Sscottl u_int64_t SgAddress; 379112679Sscottl u_int32_t SgByteCount; 380112679Sscottl} __packed; 381112679Sscottl 382151086Sscottlstruct aac_sg_entryraw { 383151086Sscottl u_int32_t Next; /* reserved for FW use */ 384151086Sscottl u_int32_t Prev; /* reserved for FW use */ 385151086Sscottl u_int64_t SgAddress; 386151086Sscottl u_int32_t SgByteCount; 387151086Sscottl u_int32_t Flags; /* reserved for FW use */ 388151086Sscottl} __packed; 389151086Sscottl 39065793Smsmithstruct aac_sg_table { 39183114Sscottl u_int32_t SgCount; 39283114Sscottl struct aac_sg_entry SgEntry[0]; 393103870Salfred} __packed; 39465793Smsmith 39565793Smsmith/* 39665793Smsmith * Host-side scatter/gather list for 64-bit commands. 39765793Smsmith */ 39865793Smsmithstruct aac_sg_table64 { 399112679Sscottl u_int32_t SgCount; 400112679Sscottl struct aac_sg_entry64 SgEntry64[0]; 401103870Salfred} __packed; 40265793Smsmith 40365793Smsmith/* 404151086Sscottl * s/g list for raw commands 405151086Sscottl */ 406151086Sscottlstruct aac_sg_tableraw { 407151086Sscottl u_int32_t SgCount; 408151086Sscottl struct aac_sg_entryraw SgEntryRaw[0]; 409151086Sscottl} __packed; 410151086Sscottl 411151086Sscottl/* 41265793Smsmith * Container creation data 41365793Smsmith */ 41465793Smsmithstruct aac_container_creation { 41583114Sscottl u_int8_t ViaBuildNumber; 41683114Sscottl u_int8_t MicroSecond; 41783114Sscottl u_int8_t Via; /* 1 = FSU, 2 = API, etc. */ 41883114Sscottl u_int8_t YearsSince1900; 41983114Sscottl u_int32_t Month:4; /* 1-12 */ 42083114Sscottl u_int32_t Day:6; /* 1-32 */ 42183114Sscottl u_int32_t Hour:6; /* 0-23 */ 42283114Sscottl u_int32_t Minute:6; /* 0-59 */ 42383114Sscottl u_int32_t Second:6; /* 0-59 */ 42483114Sscottl u_int64_t ViaAdapterSerialNumber; 425103870Salfred} __packed; 42665793Smsmith 42783114Sscottl/* 42865793Smsmith * Revision number handling 42965793Smsmith */ 43065793Smsmith 43165793Smsmithtypedef enum { 43283114Sscottl RevApplication = 1, 43383114Sscottl RevDkiCli, 43483114Sscottl RevNetService, 43583114Sscottl RevApi, 43683114Sscottl RevFileSysDriver, 43783114Sscottl RevMiniportDriver, 43883114Sscottl RevAdapterSW, 43983114Sscottl RevMonitor, 44083114Sscottl RevRemoteApi 44165793Smsmith} RevComponent; 44265793Smsmith 44365793Smsmithstruct FsaRevision { 44483114Sscottl union { 44583114Sscottl struct { 44683114Sscottl u_int8_t dash; 44783114Sscottl u_int8_t type; 44883114Sscottl u_int8_t minor; 44983114Sscottl u_int8_t major; 45083114Sscottl } comp; 45183114Sscottl u_int32_t ul; 45283114Sscottl } external; 45383114Sscottl u_int32_t buildNumber; 454103870Salfred} __packed; 45565793Smsmith 45683114Sscottl/* 45765793Smsmith * Adapter Information 45865793Smsmith */ 45965793Smsmith 46065793Smsmithtypedef enum { 46183114Sscottl CPU_NTSIM = 1, 46283114Sscottl CPU_I960, 46383114Sscottl CPU_ARM, 46483114Sscottl CPU_SPARC, 46583114Sscottl CPU_POWERPC, 46683114Sscottl CPU_ALPHA, 46783114Sscottl CPU_P7, 46883114Sscottl CPU_I960_RX, 469151086Sscottl CPU_MIPS, 470151086Sscottl CPU_XSCALE, 47183114Sscottl CPU__last 472206534Semaste} AAC_CpuType; 47365793Smsmith 47465793Smsmithtypedef enum { 47583114Sscottl CPUI960_JX = 1, 47683114Sscottl CPUI960_CX, 47783114Sscottl CPUI960_HX, 47883114Sscottl CPUI960_RX, 47983114Sscottl CPUARM_SA110, 48083114Sscottl CPUARM_xxx, 481151086Sscottl CPUPPC_603e, 48283114Sscottl CPUPPC_xxx, 483151086Sscottl CPUI960_80303, 484151086Sscottl CPU_XSCALE_80321, 485151086Sscottl CPU_MIPS_4KC, 486151086Sscottl CPU_MIPS_5KC, 48783114Sscottl CPUSUBTYPE__last 48865793Smsmith} AAC_CpuSubType; 48965793Smsmith 49065793Smsmithtypedef enum { 49183114Sscottl PLAT_NTSIM = 1, 49283114Sscottl PLAT_V3ADU, 49383114Sscottl PLAT_CYCLONE, 49483114Sscottl PLAT_CYCLONE_HD, 49583114Sscottl PLAT_BATBOARD, 49683114Sscottl PLAT_BATBOARD_HD, 49783114Sscottl PLAT_YOLO, 49883114Sscottl PLAT_COBRA, 49983114Sscottl PLAT_ANAHEIM, 50083114Sscottl PLAT_JALAPENO, 50183114Sscottl PLAT_QUEENS, 50283114Sscottl PLAT_JALAPENO_DELL, 50383114Sscottl PLAT_POBLANO, 50483114Sscottl PLAT_POBLANO_OPAL, 50583114Sscottl PLAT_POBLANO_SL0, 50683114Sscottl PLAT_POBLANO_SL1, 50783114Sscottl PLAT_POBLANO_SL2, 50883114Sscottl PLAT_POBLANO_XXX, 50983114Sscottl PLAT_JALAPENO_P2, 51083114Sscottl PLAT_HABANERO, 511151086Sscottl PLAT_VULCAN, 512151086Sscottl PLAT_CRUSADER, 513151086Sscottl PLAT_LANCER, 514151086Sscottl PLAT_HARRIER, 515151086Sscottl PLAT_TERMINATOR, 516151086Sscottl PLAT_SKYHAWK, 517151086Sscottl PLAT_CORSAIR, 518151086Sscottl PLAT_JAGUAR, 519151086Sscottl PLAT_SATAHAWK, 520151086Sscottl PLAT_SATANATOR, 521151086Sscottl PLAT_PROWLER, 522151086Sscottl PLAT_BLACKBIRD, 523151086Sscottl PLAT_SABREEXPRESS, 524151086Sscottl PLAT_INTRUDER, 52583114Sscottl PLAT__last 52665793Smsmith} AAC_Platform; 52765793Smsmith 52865793Smsmithtypedef enum { 52983114Sscottl OEM_FLAVOR_ADAPTEC = 1, 53083114Sscottl OEM_FLAVOR_DELL, 53183114Sscottl OEM_FLAVOR_HP, 53283114Sscottl OEM_FLAVOR_IBM, 53383114Sscottl OEM_FLAVOR_CPQ, 534151086Sscottl OEM_FLAVOR_FSC, 535151086Sscottl OEM_FLAVOR_DWS, 53683114Sscottl OEM_FLAVOR_BRAND_Z, 537151086Sscottl OEM_FLAVOR_LEGEND, 538151086Sscottl OEM_FLAVOR_HITACHI, 539151086Sscottl OEM_FLAVOR_ESG, 540151086Sscottl OEM_FLAVOR_ICP, 541151086Sscottl OEM_FLAVOR_SCM, 54283114Sscottl OEM_FLAVOR__last 54365793Smsmith} AAC_OemFlavor; 54465793Smsmith 54565793Smsmith/* 54665793Smsmith * XXX the aac-2622 with no battery present reports PLATFORM_BAT_OPT_PRESENT 54765793Smsmith */ 54865793Smsmithtypedef enum 549206534Semaste{ 55083114Sscottl PLATFORM_BAT_REQ_PRESENT = 1, /* BATTERY REQUIRED AND PRESENT */ 55183114Sscottl PLATFORM_BAT_REQ_NOTPRESENT, /* BATTERY REQUIRED AND NOT PRESENT */ 55283114Sscottl PLATFORM_BAT_OPT_PRESENT, /* BATTERY OPTIONAL AND PRESENT */ 55383114Sscottl PLATFORM_BAT_OPT_NOTPRESENT, /* BATTERY OPTIONAL AND NOT PRESENT */ 55483114Sscottl PLATFORM_BAT_NOT_SUPPORTED /* BATTERY NOT SUPPORTED */ 55565793Smsmith} AAC_BatteryPlatform; 55665793Smsmith 557206534Semaste/* 55865793Smsmith * options supported by this board 559206534Semaste * there has to be a one to one mapping of these defines and the ones in 56065793Smsmith * fsaapi.h, search for FSA_SUPPORT_SNAPSHOT 56165793Smsmith */ 56265793Smsmith#define AAC_SUPPORTED_SNAPSHOT 0x01 56365793Smsmith#define AAC_SUPPORTED_CLUSTERS 0x02 56465793Smsmith#define AAC_SUPPORTED_WRITE_CACHE 0x04 56565793Smsmith#define AAC_SUPPORTED_64BIT_DATA 0x08 56665793Smsmith#define AAC_SUPPORTED_HOST_TIME_FIB 0x10 56765793Smsmith#define AAC_SUPPORTED_RAID50 0x20 568112679Sscottl#define AAC_SUPPORTED_4GB_WINDOW 0x40 569112679Sscottl#define AAC_SUPPORTED_SCSI_UPGRADEABLE 0x80 570112679Sscottl#define AAC_SUPPORTED_SOFT_ERR_REPORT 0x100 571112679Sscottl#define AAC_SUPPORTED_NOT_RECONDITION 0x200 572112679Sscottl#define AAC_SUPPORTED_SGMAP_HOST64 0x400 573112679Sscottl#define AAC_SUPPORTED_ALARM 0x800 574112679Sscottl#define AAC_SUPPORTED_NONDASD 0x1000 575151086Sscottl#define AAC_SUPPORTED_SCSI_MANAGED 0x2000 576151086Sscottl#define AAC_SUPPORTED_RAID_SCSI_MODE 0x4000 577151086Sscottl#define AAC_SUPPORTED_SUPPLEMENT_ADAPTER_INFO 0x10000 578151086Sscottl#define AAC_SUPPORTED_NEW_COMM 0x20000 579151086Sscottl#define AAC_SUPPORTED_64BIT_ARRAYSIZE 0x40000 580151086Sscottl#define AAC_SUPPORTED_HEAT_SENSOR 0x80000 58165793Smsmith 582206534Semaste/* 58365793Smsmith * Structure used to respond to a RequestAdapterInfo fib. 58465793Smsmith */ 58565793Smsmithstruct aac_adapter_info { 586206534Semaste AAC_Platform PlatformBase; /* adapter type */ 58783114Sscottl AAC_CpuType CpuArchitecture; /* adapter CPU type */ 588206534Semaste AAC_CpuSubType CpuVariant; /* adapter CPU subtype */ 589206534Semaste u_int32_t ClockSpeed; /* adapter CPU clockspeed */ 590206534Semaste u_int32_t ExecutionMem; /* adapter Execution Memory 59183114Sscottl * size */ 592206534Semaste u_int32_t BufferMem; /* adapter Data Memory */ 593206534Semaste u_int32_t TotalMem; /* adapter Total Memory */ 59483114Sscottl struct FsaRevision KernelRevision; /* adapter Kernel Software 59583114Sscottl * Revision */ 59683114Sscottl struct FsaRevision MonitorRevision; /* adapter Monitor/Diagnostic 59783114Sscottl * Software Revision */ 59883114Sscottl struct FsaRevision HardwareRevision;/* TBD */ 599206534Semaste struct FsaRevision BIOSRevision; /* adapter BIOS Revision */ 60083114Sscottl u_int32_t ClusteringEnabled; 60183114Sscottl u_int32_t ClusterChannelMask; 60283114Sscottl u_int64_t SerialNumber; 60383114Sscottl AAC_BatteryPlatform batteryPlatform; 60483114Sscottl u_int32_t SupportedOptions; /* supported features of this 60583114Sscottl * controller */ 60683114Sscottl AAC_OemFlavor OemVariant; 607103870Salfred} __packed; 60865793Smsmith 609206534Semaste/* 610174412Semaste * Structure used to respond to a RequestSupplementAdapterInfo fib. 611174412Semaste */ 612174412Semastestruct vpd_info { 613174412Semaste u_int8_t AssemblyPn[8]; 614174412Semaste u_int8_t FruPn[8]; 615174412Semaste u_int8_t BatteryFruPn[8]; 616174412Semaste u_int8_t EcVersionString[8]; 617174412Semaste u_int8_t Tsid[12]; 618174412Semaste} __packed; 619174412Semaste 620174412Semaste#define MFG_PCBA_SERIAL_NUMBER_WIDTH 12 621174412Semaste#define MFG_WWN_WIDTH 8 622174412Semaste 623174412Semastestruct aac_supplement_adapter_info { 624174412Semaste /* The assigned Adapter Type Text, extra byte for null termination */ 625174412Semaste int8_t AdapterTypeText[17+1]; 626174412Semaste /* Pad for the text above */ 627174412Semaste int8_t Pad[2]; 628174412Semaste /* Size in bytes of the memory that is flashed */ 629174412Semaste u_int32_t FlashMemoryByteSize; 630174412Semaste /* The assigned IMAGEID_xxx for this adapter */ 631174412Semaste u_int32_t FlashImageId; 632174412Semaste /* 633174412Semaste * The maximum number of Phys available on a SATA/SAS 634174412Semaste * Controller, 0 otherwise 635174412Semaste */ 636174412Semaste u_int32_t MaxNumberPorts; 637174412Semaste /* Version of expansion area */ 638174412Semaste u_int32_t Version; 639174412Semaste u_int32_t FeatureBits; 640174412Semaste u_int8_t SlotNumber; 641174412Semaste u_int8_t ReservedPad0[3]; 642174412Semaste u_int8_t BuildDate[12]; 643174412Semaste /* The current number of Ports on a SAS controller, 0 otherwise */ 644174412Semaste u_int32_t CurrentNumberPorts; 645174412Semaste 646174412Semaste struct vpd_info VpdInfo; 647174412Semaste 648174412Semaste /* Firmware Revision (Vmaj.min-dash.) */ 649174412Semaste struct FsaRevision FlashFirmwareRevision; 650174412Semaste u_int32_t RaidTypeMorphOptions; 651174412Semaste /* Firmware's boot code Revision (Vmaj.min-dash.) */ 652174412Semaste struct FsaRevision FlashFirmwareBootRevision; 653174412Semaste /* PCBA serial no. from th MFG sector */ 654174412Semaste u_int8_t MfgPcbaSerialNo[MFG_PCBA_SERIAL_NUMBER_WIDTH]; 655174412Semaste /* WWN from the MFG sector */ 656174412Semaste u_int8_t MfgWWNName[MFG_WWN_WIDTH]; 657174412Semaste /* Growth Area for future expansion ((7*4) - 12 - 8)/4 = 2 words */ 658174412Semaste u_int32_t ReservedGrowth[2]; 659174412Semaste} __packed; 660174412Semaste 66183114Sscottl/* 66265793Smsmith * Monitor/Kernel interface. 66365793Smsmith */ 66465793Smsmith 66565793Smsmith/* 66665793Smsmith * Synchronous commands to the monitor/kernel. 66765793Smsmith */ 668151086Sscottl#define AAC_MONKER_BREAKPOINT 0x04 66965793Smsmith#define AAC_MONKER_INITSTRUCT 0x05 67065793Smsmith#define AAC_MONKER_SYNCFIB 0x0c 67190275Sscottl#define AAC_MONKER_GETKERNVER 0x11 672151086Sscottl#define AAC_MONKER_POSTRESULTS 0x14 673112679Sscottl#define AAC_MONKER_GETINFO 0x19 674151086Sscottl#define AAC_MONKER_GETDRVPROP 0x23 675151086Sscottl#define AAC_MONKER_RCVTEMP 0x25 676151086Sscottl#define AAC_MONKER_GETCOMMPREF 0x26 677151086Sscottl#define AAC_MONKER_REINIT 0xee 67865793Smsmith 67965793Smsmith/* 68065793Smsmith * Adapter Status Register 68165793Smsmith * 68265793Smsmith * Phase Staus mailbox is 32bits: 68365793Smsmith * <31:16> = Phase Status 68465793Smsmith * <15:0> = Phase 68565793Smsmith * 68665793Smsmith * The adapter reports its present state through the phase. Only 68765793Smsmith * a single phase should be ever be set. Each phase can have multiple 68865793Smsmith * phase status bits to provide more detailed information about the 68965793Smsmith * state of the adapter. 69065793Smsmith */ 69165793Smsmith#define AAC_SELF_TEST_FAILED 0x00000004 692140669Sscottl#define AAC_MONITOR_PANIC 0x00000020 69365793Smsmith#define AAC_UP_AND_RUNNING 0x00000080 69465793Smsmith#define AAC_KERNEL_PANIC 0x00000100 69565793Smsmith 69683114Sscottl/* 697206534Semaste * Data types relating to control and monitoring of the NVRAM/WriteCache 69865793Smsmith * subsystem. 69965793Smsmith */ 70065793Smsmith 70165793Smsmith#define AAC_NFILESYS 24 /* maximum number of filesystems */ 70265793Smsmith 70365793Smsmith/* 70465793Smsmith * NVRAM/Write Cache subsystem states 70565793Smsmith */ 70665793Smsmithtypedef enum { 70783114Sscottl NVSTATUS_DISABLED = 0, /* present, clean, not being used */ 70883114Sscottl NVSTATUS_ENABLED, /* present, possibly dirty, ready for use */ 70983114Sscottl NVSTATUS_ERROR, /* present, dirty, contains dirty data */ 71083114Sscottl NVSTATUS_BATTERY, /* present, bad or low battery, may contain 71183114Sscottl * dirty data */ 71283114Sscottl NVSTATUS_UNKNOWN /* for bad/missing device */ 71365793Smsmith} AAC_NVSTATUS; 71465793Smsmith 71565793Smsmith/* 71665793Smsmith * NVRAM/Write Cache subsystem battery component states 71765793Smsmith * 71865793Smsmith */ 71965793Smsmithtypedef enum { 72083114Sscottl NVBATTSTATUS_NONE = 0, /* battery has no power or is not present */ 72183114Sscottl NVBATTSTATUS_LOW, /* battery is low on power */ 72283114Sscottl NVBATTSTATUS_OK, /* battery is okay - normal operation possible 72383114Sscottl * only in this state */ 72483114Sscottl NVBATTSTATUS_RECONDITIONING /* no battery present - reconditioning 72583114Sscottl * in process */ 72665793Smsmith} AAC_NVBATTSTATUS; 72765793Smsmith 72865793Smsmith/* 72965793Smsmith * Battery transition type 73065793Smsmith */ 73165793Smsmithtypedef enum { 73283114Sscottl NVBATT_TRANSITION_NONE = 0, /* battery now has no power or is not 73383114Sscottl * present */ 73483114Sscottl NVBATT_TRANSITION_LOW, /* battery is now low on power */ 73583114Sscottl NVBATT_TRANSITION_OK /* battery is now okay - normal 73683114Sscottl * operation possible only in this 73783114Sscottl * state */ 73865793Smsmith} AAC_NVBATT_TRANSITION; 73965793Smsmith 74065793Smsmith/* 74165793Smsmith * NVRAM Info structure returned for NVRAM_GetInfo call 74265793Smsmith */ 74365793Smsmithstruct aac_nvramdevinfo { 74483114Sscottl u_int32_t NV_Enabled; /* write caching enabled */ 74583114Sscottl u_int32_t NV_Error; /* device in error state */ 74683114Sscottl u_int32_t NV_NDirty; /* count of dirty NVRAM buffers */ 74783114Sscottl u_int32_t NV_NActive; /* count of NVRAM buffers being 74883114Sscottl * written */ 749103870Salfred} __packed; 75065793Smsmith 75165793Smsmithstruct aac_nvraminfo { 75283114Sscottl AAC_NVSTATUS NV_Status; /* nvram subsystem status */ 75383114Sscottl AAC_NVBATTSTATUS NV_BattStatus; /* battery status */ 75483114Sscottl u_int32_t NV_Size; /* size of WriteCache NVRAM in 75581082Sscottl * bytes */ 75683114Sscottl u_int32_t NV_BufSize; /* size of NVRAM buffers in 75781082Sscottl * bytes */ 75883114Sscottl u_int32_t NV_NBufs; /* number of NVRAM buffers */ 75983114Sscottl u_int32_t NV_NDirty; /* Num dirty NVRAM buffers */ 76083114Sscottl u_int32_t NV_NClean; /* Num clean NVRAM buffers */ 76183114Sscottl u_int32_t NV_NActive; /* Num NVRAM buffers being 76281082Sscottl * written */ 76383114Sscottl u_int32_t NV_NBrokered; /* Num brokered NVRAM buffers */ 76483114Sscottl struct aac_nvramdevinfo NV_DevInfo[AAC_NFILESYS]; /* per device 76581082Sscottl * info */ 76683114Sscottl u_int32_t NV_BattNeedsReconditioning; /* boolean */ 76783114Sscottl u_int32_t NV_TotalSize; /* size of all non-volatile 76881082Sscottl * memories in bytes */ 769103870Salfred} __packed; 77065793Smsmith 77183114Sscottl/* 77265793Smsmith * Data types relating to adapter-initiated FIBs 77365793Smsmith * 77465793Smsmith * Based on types and structures in <aifstruc.h> 77565793Smsmith */ 77665793Smsmith 77765793Smsmith/* 77865793Smsmith * Progress Reports 77965793Smsmith */ 78065793Smsmithtypedef enum { 78183114Sscottl AifJobStsSuccess = 1, 78283114Sscottl AifJobStsFinished, 78383114Sscottl AifJobStsAborted, 78483114Sscottl AifJobStsFailed, 78583114Sscottl AifJobStsLastReportMarker = 100, /* All prior mean last report */ 78683114Sscottl AifJobStsSuspended, 78783114Sscottl AifJobStsRunning 78865793Smsmith} AAC_AifJobStatus; 78965793Smsmith 79065793Smsmithtypedef enum { 79183114Sscottl AifJobScsiMin = 1, /* Minimum value for Scsi operation */ 79283114Sscottl AifJobScsiZero, /* SCSI device clear operation */ 79383114Sscottl AifJobScsiVerify, /* SCSI device Verify operation NO 79481082Sscottl * REPAIR */ 79583114Sscottl AifJobScsiExercise, /* SCSI device Exercise operation */ 79683114Sscottl AifJobScsiVerifyRepair, /* SCSI device Verify operation WITH 79781082Sscottl * repair */ 798151086Sscottl AifJobScsiWritePattern, /* write pattern */ 79983114Sscottl AifJobScsiMax = 99, /* Max Scsi value */ 80083114Sscottl AifJobCtrMin, /* Min Ctr op value */ 80183114Sscottl AifJobCtrZero, /* Container clear operation */ 80283114Sscottl AifJobCtrCopy, /* Container copy operation */ 80383114Sscottl AifJobCtrCreateMirror, /* Container Create Mirror operation */ 80483114Sscottl AifJobCtrMergeMirror, /* Container Merge Mirror operation */ 80583114Sscottl AifJobCtrScrubMirror, /* Container Scrub Mirror operation */ 80683114Sscottl AifJobCtrRebuildRaid5, /* Container Rebuild Raid5 operation */ 80783114Sscottl AifJobCtrScrubRaid5, /* Container Scrub Raid5 operation */ 80883114Sscottl AifJobCtrMorph, /* Container morph operation */ 80983114Sscottl AifJobCtrPartCopy, /* Container Partition copy operation */ 81083114Sscottl AifJobCtrRebuildMirror, /* Container Rebuild Mirror operation */ 81183114Sscottl AifJobCtrCrazyCache, /* crazy cache */ 812151086Sscottl AifJobCtrCopyback, /* Container Copyback operation */ 813151086Sscottl AifJobCtrCompactRaid5D, /* Container Compaction operation */ 814151086Sscottl AifJobCtrExpandRaid5D, /* Container Expansion operation */ 815151086Sscottl AifJobCtrRebuildRaid6, /* Container Rebuild Raid6 operation */ 816151086Sscottl AifJobCtrScrubRaid6, /* Container Scrub Raid6 operation */ 817151086Sscottl AifJobCtrSSBackup, /* Container snapshot backup task */ 81883114Sscottl AifJobCtrMax = 199, /* Max Ctr type operation */ 81983114Sscottl AifJobFsMin, /* Min Fs type operation */ 82083114Sscottl AifJobFsCreate, /* File System Create operation */ 82183114Sscottl AifJobFsVerify, /* File System Verify operation */ 82283114Sscottl AifJobFsExtend, /* File System Extend operation */ 82383114Sscottl AifJobFsMax = 299, /* Max Fs type operation */ 82483114Sscottl AifJobApiFormatNTFS, /* Format a drive to NTFS */ 82583114Sscottl AifJobApiFormatFAT, /* Format a drive to FAT */ 82683114Sscottl AifJobApiUpdateSnapshot, /* update the read/write half of a 82781082Sscottl * snapshot */ 82883114Sscottl AifJobApiFormatFAT32, /* Format a drive to FAT32 */ 82983114Sscottl AifJobApiMax = 399, /* Max API type operation */ 83083114Sscottl AifJobCtlContinuousCtrVerify, /* Adapter operation */ 83183114Sscottl AifJobCtlMax = 499 /* Max Adapter type operation */ 83265793Smsmith} AAC_AifJobType; 83365793Smsmith 83465793Smsmithstruct aac_AifContainers { 83583114Sscottl u_int32_t src; /* from/master */ 83683114Sscottl u_int32_t dst; /* to/slave */ 837103870Salfred} __packed; 83865793Smsmith 83965793Smsmithunion aac_AifJobClient { 84083114Sscottl struct aac_AifContainers container; /* For Container and 84196755Strhodes * filesystem progress 84283114Sscottl * ops; */ 84383114Sscottl int32_t scsi_dh; /* For SCSI progress 84483114Sscottl * ops */ 84565793Smsmith}; 84665793Smsmith 84765793Smsmithstruct aac_AifJobDesc { 84883114Sscottl u_int32_t jobID; /* DO NOT FILL IN! Will be 84981082Sscottl * filled in by AIF */ 85083114Sscottl AAC_AifJobType type; /* Operation that is being 85181082Sscottl * performed */ 85283114Sscottl union aac_AifJobClient client; /* Details */ 853103870Salfred} __packed; 85465793Smsmith 85565793Smsmithstruct aac_AifJobProgressReport { 85683114Sscottl struct aac_AifJobDesc jd; 85783114Sscottl AAC_AifJobStatus status; 85883114Sscottl u_int32_t finalTick; 85983114Sscottl u_int32_t currentTick; 86083114Sscottl u_int32_t jobSpecificData1; 86183114Sscottl u_int32_t jobSpecificData2; 862103870Salfred} __packed; 86365793Smsmith 86465793Smsmith/* 86565793Smsmith * Event Notification 86665793Smsmith */ 86765793Smsmithtypedef enum { 86883114Sscottl /* General application notifies start here */ 86983114Sscottl AifEnGeneric = 1, /* Generic notification */ 87083114Sscottl AifEnTaskComplete, /* Task has completed */ 87183114Sscottl AifEnConfigChange, /* Adapter config change occurred */ 872206534Semaste AifEnContainerChange, /* Adapter specific container 87381082Sscottl * configuration change */ 87483114Sscottl AifEnDeviceFailure, /* SCSI device failed */ 87583114Sscottl AifEnMirrorFailover, /* Mirror failover started */ 87683114Sscottl AifEnContainerEvent, /* Significant container event */ 87783114Sscottl AifEnFileSystemChange, /* File system changed */ 87883114Sscottl AifEnConfigPause, /* Container pause event */ 87983114Sscottl AifEnConfigResume, /* Container resume event */ 88083114Sscottl AifEnFailoverChange, /* Failover space assignment changed */ 88183114Sscottl AifEnRAID5RebuildDone, /* RAID5 rebuild finished */ 88283114Sscottl AifEnEnclosureManagement, /* Enclosure management event */ 88383114Sscottl AifEnBatteryEvent, /* Significant NV battery event */ 88483114Sscottl AifEnAddContainer, /* A new container was created. */ 88583114Sscottl AifEnDeleteContainer, /* A container was deleted. */ 886206534Semaste AifEnSMARTEvent, /* SMART Event */ 88783114Sscottl AifEnBatteryNeedsRecond, /* The battery needs reconditioning */ 88883114Sscottl AifEnClusterEvent, /* Some cluster event */ 88983114Sscottl AifEnDiskSetEvent, /* A disk set event occured. */ 890212628Semaste AifEnContainerScsiEvent, /* a container event with no. and scsi id */ 891212628Semaste AifEnPicBatteryEvent, /* An event gen. by pic_battery.c for an ABM */ 892212628Semaste AifEnExpEvent, /* Exp. Event Type to replace CTPopUp messages */ 893212628Semaste AifEnRAID6RebuildDone, /* RAID6 rebuild finished */ 894212628Semaste AifEnSensorOverHeat, /* Heat Sensor indicate overheat */ 895212628Semaste AifEnSensorCoolDown, /* Heat Sensor ind. cooled down after overheat */ 896212628Semaste AifFeatureKeysModified, /* notif. of updated feature keys */ 897212628Semaste AifApplicationExpirationEvent, /* notif. on app. expiration status */ 898212628Semaste AifEnBackgroundConsistencyCheck,/* BCC notif. for NEC - DDTS 94700 */ 899212628Semaste AifEnAddJBOD, /* A new JBOD type drive was created (30) */ 900212628Semaste AifEnDeleteJBOD, /* A JBOD type drive was deleted (31) */ 90183114Sscottl AifDriverNotifyStart=199, /* Notifies for host driver go here */ 90283114Sscottl /* Host driver notifications start here */ 90383114Sscottl AifDenMorphComplete, /* A morph operation completed */ 90483114Sscottl AifDenVolumeExtendComplete /* Volume expand operation completed */ 90565793Smsmith} AAC_AifEventNotifyType; 90665793Smsmith 90765793Smsmithstruct aac_AifEnsGeneric { 90883114Sscottl char text[132]; /* Generic text */ 909103870Salfred} __packed; 91065793Smsmith 91165793Smsmithstruct aac_AifEnsDeviceFailure { 91283114Sscottl u_int32_t deviceHandle; /* SCSI device handle */ 913103870Salfred} __packed; 91465793Smsmith 91565793Smsmithstruct aac_AifEnsMirrorFailover { 91683114Sscottl u_int32_t container; /* Container with failed element */ 91783114Sscottl u_int32_t failedSlice; /* Old slice which failed */ 91883114Sscottl u_int32_t creatingSlice; /* New slice used for auto-create */ 919103870Salfred} __packed; 92065793Smsmith 92165793Smsmithstruct aac_AifEnsContainerChange { 92283114Sscottl u_int32_t container[2]; /* container that changed, -1 if no 92381082Sscottl * container */ 924103870Salfred} __packed; 92565793Smsmith 92665793Smsmithstruct aac_AifEnsContainerEvent { 92783114Sscottl u_int32_t container; /* container number */ 92883114Sscottl u_int32_t eventType; /* event type */ 929103870Salfred} __packed; 93065793Smsmith 93165793Smsmithstruct aac_AifEnsEnclosureEvent { 93283114Sscottl u_int32_t empID; /* enclosure management proc number */ 93383114Sscottl u_int32_t unitID; /* unitId, fan id, power supply id, 93481082Sscottl * slot id, tempsensor id. */ 93583114Sscottl u_int32_t eventType; /* event type */ 936103870Salfred} __packed; 93765793Smsmith 938213272Semastetypedef enum { 939213272Semaste AIF_EM_DRIVE_INSERTION=31, 940213272Semaste AIF_EM_DRIVE_REMOVAL 941213272Semaste} aac_AifEMEventType; 942213272Semaste 94365793Smsmithstruct aac_AifEnsBatteryEvent { 94483114Sscottl AAC_NVBATT_TRANSITION transition_type; /* eg from low to ok */ 94583114Sscottl AAC_NVBATTSTATUS current_state; /* current batt state */ 94683114Sscottl AAC_NVBATTSTATUS prior_state; /* prev batt state */ 947103870Salfred} __packed; 94865793Smsmith 94965793Smsmithstruct aac_AifEnsDiskSetEvent { 95083114Sscottl u_int32_t eventType; 95183114Sscottl u_int64_t DsNum; 95283114Sscottl u_int64_t CreatorId; 953103870Salfred} __packed; 95465793Smsmith 95565793Smsmithtypedef enum { 95683114Sscottl CLUSTER_NULL_EVENT = 0, 95783114Sscottl CLUSTER_PARTNER_NAME_EVENT, /* change in partner hostname or 95881082Sscottl * adaptername from NULL to non-NULL */ 95983114Sscottl /* (partner's agent may be up) */ 96083114Sscottl CLUSTER_PARTNER_NULL_NAME_EVENT /* change in partner hostname or 96181082Sscottl * adaptername from non-null to NULL */ 96283114Sscottl /* (partner has rebooted) */ 96365793Smsmith} AAC_ClusterAifEvent; 96465793Smsmith 96565793Smsmithstruct aac_AifEnsClusterEvent { 96683114Sscottl AAC_ClusterAifEvent eventType; 967103870Salfred} __packed; 96865793Smsmith 96965793Smsmithstruct aac_AifEventNotify { 97083114Sscottl AAC_AifEventNotifyType type; 97183114Sscottl union { 97283114Sscottl struct aac_AifEnsGeneric EG; 97383114Sscottl struct aac_AifEnsDeviceFailure EDF; 97483114Sscottl struct aac_AifEnsMirrorFailover EMF; 97583114Sscottl struct aac_AifEnsContainerChange ECC; 97683114Sscottl struct aac_AifEnsContainerEvent ECE; 97783114Sscottl struct aac_AifEnsEnclosureEvent EEE; 97883114Sscottl struct aac_AifEnsBatteryEvent EBE; 97983114Sscottl struct aac_AifEnsDiskSetEvent EDS; 98083114Sscottl/* struct aac_AifEnsSMARTEvent ES;*/ 98183114Sscottl struct aac_AifEnsClusterEvent ECLE; 98283114Sscottl } data; 983103870Salfred} __packed; 98465793Smsmith 98565793Smsmith/* 98665793Smsmith * Adapter Initiated FIB command structures. Start with the adapter 98765793Smsmith * initiated FIBs that really come from the adapter, and get responded 988206534Semaste * to by the host. 98965793Smsmith */ 99065793Smsmith#define AAC_AIF_REPORT_MAX_SIZE 64 99165793Smsmith 99265793Smsmithtypedef enum { 99383114Sscottl AifCmdEventNotify = 1, /* Notify of event */ 99483114Sscottl AifCmdJobProgress, /* Progress report */ 99583114Sscottl AifCmdAPIReport, /* Report from other user of API */ 99683114Sscottl AifCmdDriverNotify, /* Notify host driver of event */ 99783114Sscottl AifReqJobList = 100, /* Gets back complete job list */ 99883114Sscottl AifReqJobsForCtr, /* Gets back jobs for specific container */ 99983114Sscottl AifReqJobsForScsi, /* Gets back jobs for specific SCSI device */ 100083114Sscottl AifReqJobReport, /* Gets back a specific job report or list */ 100183114Sscottl AifReqTerminateJob, /* Terminates job */ 100283114Sscottl AifReqSuspendJob, /* Suspends a job */ 100383114Sscottl AifReqResumeJob, /* Resumes a job */ 100483114Sscottl AifReqSendAPIReport, /* API generic report requests */ 100583114Sscottl AifReqAPIJobStart, /* Start a job from the API */ 100683114Sscottl AifReqAPIJobUpdate, /* Update a job report from the API */ 100783114Sscottl AifReqAPIJobFinish /* Finish a job from the API */ 100865793Smsmith} AAC_AifCommand; 100965793Smsmith 101065793Smsmithstruct aac_aif_command { 101183114Sscottl AAC_AifCommand command; /* Tell host what type of 101283114Sscottl * notify this is */ 101383114Sscottl u_int32_t seqNumber; /* To allow ordering of 101483114Sscottl * reports (if necessary) */ 101583114Sscottl union { 1016121173Sscottl struct aac_AifEventNotify EN; /* Event notify */ 1017121173Sscottl struct aac_AifJobProgressReport PR[1]; /* Progress report */ 1018121173Sscottl u_int8_t AR[AAC_AIF_REPORT_MAX_SIZE]; 1019121173Sscottl u_int8_t data[AAC_FIB_DATASIZE - 8]; 102083114Sscottl } data; 1021103870Salfred} __packed; 102265793Smsmith 102383114Sscottl/* 102465793Smsmith * Filesystem commands/data 102565793Smsmith * 102665793Smsmith * The adapter has a very complex filesystem interface, most of which we ignore. 102765793Smsmith * (And which seems not to be implemented, anyway.) 102865793Smsmith */ 102965793Smsmith 103065793Smsmith/* 103165793Smsmith * FSA commands 103265793Smsmith * (not used?) 103365793Smsmith */ 103465793Smsmithtypedef enum { 103583114Sscottl Null = 0, 103683114Sscottl GetAttributes, 103783114Sscottl SetAttributes, 103883114Sscottl Lookup, 103983114Sscottl ReadLink, 104083114Sscottl Read, 104183114Sscottl Write, 104283114Sscottl Create, 104383114Sscottl MakeDirectory, 104483114Sscottl SymbolicLink, 104583114Sscottl MakeNode, 104683114Sscottl Removex, 104783114Sscottl RemoveDirectory, 104883114Sscottl Rename, 104983114Sscottl Link, 105083114Sscottl ReadDirectory, 105183114Sscottl ReadDirectoryPlus, 105283114Sscottl FileSystemStatus, 105383114Sscottl FileSystemInfo, 105483114Sscottl PathConfigure, 105583114Sscottl Commit, 105683114Sscottl Mount, 105783114Sscottl UnMount, 105883114Sscottl Newfs, 105983114Sscottl FsCheck, 106083114Sscottl FsSync, 106183114Sscottl SimReadWrite, 106283114Sscottl SetFileSystemStatus, 106383114Sscottl BlockRead, 106483114Sscottl BlockWrite, 106583114Sscottl NvramIoctl, 106683114Sscottl FsSyncWait, 106783114Sscottl ClearArchiveBit, 106883114Sscottl SetAcl, 106983114Sscottl GetAcl, 107083114Sscottl AssignAcl, 107183114Sscottl FaultInsertion, 107283114Sscottl CrazyCache 107365793Smsmith} AAC_FSACommand; 107465793Smsmith 107565793Smsmith/* 107665793Smsmith * Command status values 107765793Smsmith */ 107865793Smsmithtypedef enum { 107983114Sscottl ST_OK = 0, 108083114Sscottl ST_PERM = 1, 108183114Sscottl ST_NOENT = 2, 108283114Sscottl ST_IO = 5, 108383114Sscottl ST_NXIO = 6, 108483114Sscottl ST_E2BIG = 7, 108583114Sscottl ST_ACCES = 13, 108683114Sscottl ST_EXIST = 17, 108783114Sscottl ST_XDEV = 18, 108883114Sscottl ST_NODEV = 19, 108983114Sscottl ST_NOTDIR = 20, 109083114Sscottl ST_ISDIR = 21, 109183114Sscottl ST_INVAL = 22, 109283114Sscottl ST_FBIG = 27, 109383114Sscottl ST_NOSPC = 28, 109483114Sscottl ST_ROFS = 30, 109583114Sscottl ST_MLINK = 31, 109683114Sscottl ST_WOULDBLOCK = 35, 109783114Sscottl ST_NAMETOOLONG = 63, 109883114Sscottl ST_NOTEMPTY = 66, 109983114Sscottl ST_DQUOT = 69, 110083114Sscottl ST_STALE = 70, 110183114Sscottl ST_REMOTE = 71, 1102206540Semaste ST_NOT_READY = 72, 110383114Sscottl ST_BADHANDLE = 10001, 110483114Sscottl ST_NOT_SYNC = 10002, 110583114Sscottl ST_BAD_COOKIE = 10003, 110683114Sscottl ST_NOTSUPP = 10004, 110783114Sscottl ST_TOOSMALL = 10005, 110883114Sscottl ST_SERVERFAULT = 10006, 110983114Sscottl ST_BADTYPE = 10007, 111083114Sscottl ST_JUKEBOX = 10008, 111183114Sscottl ST_NOTMOUNTED = 10009, 111283114Sscottl ST_MAINTMODE = 10010, 1113206540Semaste ST_STALEACL = 10011, 1114206540Semaste ST_BUS_RESET = 20001 111565793Smsmith} AAC_FSAStatus; 111665793Smsmith 111765793Smsmith/* 111865793Smsmith * Volume manager commands 111965793Smsmith */ 112065793Smsmithtypedef enum _VM_COMMANDS { 112183114Sscottl VM_Null = 0, 112283114Sscottl VM_NameServe, 112383114Sscottl VM_ContainerConfig, 112483114Sscottl VM_Ioctl, 112583114Sscottl VM_FilesystemIoctl, 112683114Sscottl VM_CloseAll, 112783114Sscottl VM_CtBlockRead, 112883114Sscottl VM_CtBlockWrite, 112983114Sscottl VM_SliceBlockRead, /* raw access to configured storage objects */ 113083114Sscottl VM_SliceBlockWrite, 113183114Sscottl VM_DriveBlockRead, /* raw access to physical devices */ 113283114Sscottl VM_DriveBlockWrite, 113383114Sscottl VM_EnclosureMgt, /* enclosure management */ 113483114Sscottl VM_Unused, /* used to be diskset management */ 113583114Sscottl VM_CtBlockVerify, 113683114Sscottl VM_CtPerf, /* performance test */ 113783114Sscottl VM_CtBlockRead64, 113883114Sscottl VM_CtBlockWrite64, 113983114Sscottl VM_CtBlockVerify64, 1140112679Sscottl VM_CtHostRead64, 1141112679Sscottl VM_CtHostWrite64, 1142151086Sscottl VM_DrvErrTblLog, /* drive error table/log type of command */ 1143206534Semaste VM_NameServe64 114465793Smsmith} AAC_VMCommand; 114565793Smsmith 114665793Smsmith/* 114765793Smsmith * "mountable object" 114865793Smsmith */ 114965793Smsmithstruct aac_mntobj { 115083114Sscottl u_int32_t ObjectId; 115183114Sscottl char FileSystemName[16]; 115283114Sscottl struct aac_container_creation CreateInfo; 115383114Sscottl u_int32_t Capacity; 1154109088Sscottl u_int32_t VolType; 1155109088Sscottl u_int32_t ObjType; 115683114Sscottl u_int32_t ContentState; 115781082Sscottl#define FSCS_READONLY 0x0002 /* XXX need more information 115881082Sscottl * than this */ 115983114Sscottl union { 116083114Sscottl u_int32_t pad[8]; 116183114Sscottl } ObjExtension; 116283114Sscottl u_int32_t AlterEgoId; 1163177619Semaste u_int32_t CapacityHigh; 1164103870Salfred} __packed; 116565793Smsmith 116665793Smsmithstruct aac_mntinfo { 1167109088Sscottl u_int32_t Command; 1168109088Sscottl u_int32_t MntType; 116983114Sscottl u_int32_t MntCount; 1170103870Salfred} __packed; 117165793Smsmith 117295350Sscottlstruct aac_mntinforesp { 1173109088Sscottl u_int32_t Status; 1174109088Sscottl u_int32_t MntType; 117583114Sscottl u_int32_t MntRespCount; 117683114Sscottl struct aac_mntobj MntTable[1]; 1177103870Salfred} __packed; 117865793Smsmith 117965793Smsmith/* 118065793Smsmith * Container shutdown command. 118165793Smsmith */ 118265793Smsmithstruct aac_closecommand { 118383114Sscottl u_int32_t Command; 118483114Sscottl u_int32_t ContainerId; 1185103870Salfred} __packed; 118665793Smsmith 118765793Smsmith/* 118895536Sscottl * Container Config Command 118995536Sscottl */ 119095536Sscottl#define CT_GET_SCSI_METHOD 64 119195536Sscottlstruct aac_ctcfg { 1192109088Sscottl u_int32_t Command; 119395536Sscottl u_int32_t cmd; 119495536Sscottl u_int32_t param; 1195103870Salfred} __packed; 119695536Sscottl 119795536Sscottlstruct aac_ctcfg_resp { 1198109088Sscottl u_int32_t Status; 119995536Sscottl u_int32_t resp; 120095536Sscottl u_int32_t param; 1201103870Salfred} __packed; 120295536Sscottl 120395536Sscottl/* 120495536Sscottl * 'Ioctl' commads 120595536Sscottl */ 120695536Sscottl#define AAC_SCSI_MAX_PORTS 10 120795536Sscottl#define AAC_BUS_NO_EXIST 0 120895536Sscottl#define AAC_BUS_VALID 1 120995536Sscottl#define AAC_BUS_FAULTED 2 121095536Sscottl#define AAC_BUS_DISABLED 3 121195536Sscottl#define GetBusInfo 0x9 121295536Sscottl 121395536Sscottlstruct aac_getbusinf { 121495536Sscottl u_int32_t ProbeComplete; 121595536Sscottl u_int32_t BusCount; 121695536Sscottl u_int32_t TargetsPerBus; 121795536Sscottl u_int8_t InitiatorBusId[AAC_SCSI_MAX_PORTS]; 121895536Sscottl u_int8_t BusValid[AAC_SCSI_MAX_PORTS]; 1219103870Salfred} __packed; 122095536Sscottl 122195536Sscottlstruct aac_vmioctl { 1222109088Sscottl u_int32_t Command; 1223109088Sscottl u_int32_t ObjType; 122495536Sscottl u_int32_t MethId; 122595536Sscottl u_int32_t ObjId; 122695536Sscottl u_int32_t IoctlCmd; 122795536Sscottl u_int32_t IoctlBuf[1]; /* Placeholder? */ 1228103870Salfred} __packed; 122995536Sscottl 123095536Sscottlstruct aac_vmi_businf_resp { 1231109088Sscottl u_int32_t Status; 1232109088Sscottl u_int32_t ObjType; 123395536Sscottl u_int32_t MethId; 123495536Sscottl u_int32_t ObjId; 123595536Sscottl u_int32_t IoctlCmd; 123695536Sscottl struct aac_getbusinf BusInf; 1237103870Salfred} __packed; 123895536Sscottl 1239151086Sscottl#if 0 124095536Sscottl#define AAC_BTL_TO_HANDLE(b, t, l) \ 124195536Sscottl (((b & 0x3f) << 7) | ((l & 0x7) << 4) | (t & 0xf)) 1242151086Sscottl#else 1243151086Sscottl#define AAC_BTL_TO_HANDLE(b, t, l) \ 1244151086Sscottl ((((u_int32_t)b & 0x0f) << 24) | \ 1245151086Sscottl (((u_int32_t)l & 0xff) << 16) | \ 1246151086Sscottl ((u_int32_t)t & 0xffff)) 1247151086Sscottl#endif 124895536Sscottl#define GetDeviceProbeInfo 0x5 124995536Sscottl 125095536Sscottlstruct aac_vmi_devinfo_resp { 1251109088Sscottl u_int32_t Status; 1252109088Sscottl u_int32_t ObjType; 125395536Sscottl u_int32_t MethId; 125495536Sscottl u_int32_t ObjId; 125595536Sscottl u_int32_t IoctlCmd; 125695536Sscottl u_int8_t VendorId[8]; 125795536Sscottl u_int8_t ProductId[16]; 125895536Sscottl u_int8_t ProductRev[4]; 125995536Sscottl u_int32_t Inquiry7; 126095536Sscottl u_int32_t align1; 126195536Sscottl u_int32_t Inquiry0; 126295536Sscottl u_int32_t align2; 126395536Sscottl u_int32_t Inquiry1; 126495536Sscottl u_int32_t align3; 126595536Sscottl u_int32_t reserved[2]; 126695536Sscottl u_int8_t VendorSpecific[20]; 126795536Sscottl u_int32_t Smart:1; 126895536Sscottl u_int32_t AAC_Managed:1; 126995536Sscottl u_int32_t align4; 127095536Sscottl u_int32_t reserved2:6; 127195536Sscottl u_int32_t Bus; 127295536Sscottl u_int32_t Target; 127395536Sscottl u_int32_t Lun; 127495536Sscottl u_int32_t ultraEnable:1, 127595536Sscottl disconnectEnable:1, 127695536Sscottl fast20EnabledW:1, 127795536Sscottl scamDevice:1, 127895536Sscottl scamTolerant:1, 127995536Sscottl setForSync:1, 128095536Sscottl setForWide:1, 128195536Sscottl syncDevice:1, 128295536Sscottl wideDevice:1, 128395536Sscottl reserved1:7, 128495536Sscottl ScsiRate:8, 128595536Sscottl ScsiOffset:8; 128695536Sscottl}; /* Do not pack */ 128795536Sscottl 128895536Sscottl#define ResetBus 0x16 128995536Sscottlstruct aac_resetbus { 129095536Sscottl u_int32_t BusNumber; 129195536Sscottl}; 129295536Sscottl 129395536Sscottl/* 129465793Smsmith * Write 'stability' options. 129565793Smsmith */ 129665793Smsmithtypedef enum { 129783114Sscottl CSTABLE = 1, 129883114Sscottl CUNSTABLE 129965793Smsmith} AAC_CacheLevel; 130065793Smsmith 130165793Smsmith/* 130265793Smsmith * Commit level response for a write request. 130365793Smsmith */ 130465793Smsmithtypedef enum { 130583114Sscottl CMFILE_SYNC_NVRAM = 1, 130683114Sscottl CMDATA_SYNC_NVRAM, 130783114Sscottl CMFILE_SYNC, 130883114Sscottl CMDATA_SYNC, 130983114Sscottl CMUNSTABLE 131065793Smsmith} AAC_CommitLevel; 131165793Smsmith 131265793Smsmith/* 131365793Smsmith * Block read/write operations. 131465793Smsmith * These structures are packed into the 'data' area in the FIB. 131565793Smsmith */ 131665793Smsmith 131765793Smsmithstruct aac_blockread { 1318109088Sscottl u_int32_t Command; /* not FSACommand! */ 131983114Sscottl u_int32_t ContainerId; 132083114Sscottl u_int32_t BlockNumber; 132183114Sscottl u_int32_t ByteCount; 132283114Sscottl struct aac_sg_table SgMap; /* variable size */ 1323103870Salfred} __packed; 132465793Smsmith 1325112679Sscottlstruct aac_blockread64 { 1326112679Sscottl u_int32_t Command; 1327112679Sscottl u_int16_t ContainerId; 1328112679Sscottl u_int16_t SectorCount; 1329112679Sscottl u_int32_t BlockNumber; 1330112679Sscottl u_int16_t Pad; 1331112679Sscottl u_int16_t Flags; 1332112679Sscottl struct aac_sg_table64 SgMap64; 1333112679Sscottl} __packed; 1334112679Sscottl 133565793Smsmithstruct aac_blockread_response { 1336109088Sscottl u_int32_t Status; 133783114Sscottl u_int32_t ByteCount; 1338103870Salfred} __packed; 133965793Smsmith 134065793Smsmithstruct aac_blockwrite { 1341109088Sscottl u_int32_t Command; /* not FSACommand! */ 134283114Sscottl u_int32_t ContainerId; 134383114Sscottl u_int32_t BlockNumber; 134483114Sscottl u_int32_t ByteCount; 1345109088Sscottl u_int32_t Stable; 134683114Sscottl struct aac_sg_table SgMap; /* variable size */ 1347103870Salfred} __packed; 134865793Smsmith 1349112679Sscottlstruct aac_blockwrite64 { 1350112679Sscottl u_int32_t Command; /* not FSACommand! */ 1351112679Sscottl u_int16_t ContainerId; 1352112679Sscottl u_int16_t SectorCount; 1353112679Sscottl u_int32_t BlockNumber; 1354112679Sscottl u_int16_t Pad; 1355112679Sscottl u_int16_t Flags; 1356112679Sscottl struct aac_sg_table64 SgMap64; /* variable size */ 1357112679Sscottl} __packed; 1358112679Sscottl 135965793Smsmithstruct aac_blockwrite_response { 1360109088Sscottl u_int32_t Status; 136183114Sscottl u_int32_t ByteCount; 1362109088Sscottl u_int32_t Committed; 1363103870Salfred} __packed; 136465793Smsmith 1365151086Sscottlstruct aac_raw_io { 1366151086Sscottl u_int64_t BlockNumber; 1367151086Sscottl u_int32_t ByteCount; 1368151086Sscottl u_int16_t ContainerId; 1369151086Sscottl u_int16_t Flags; /* 0: W, 1: R */ 1370151086Sscottl u_int16_t BpTotal; /* reserved for FW use */ 1371151086Sscottl u_int16_t BpComplete; /* reserved for FW use */ 1372151086Sscottl struct aac_sg_tableraw SgMapRaw; /* variable size */ 1373151086Sscottl} __packed; 1374151086Sscottl 137565793Smsmith/* 137665793Smsmith * Container shutdown command. 137765793Smsmith */ 137865793Smsmithstruct aac_close_command { 1379109088Sscottl u_int32_t Command; 1380109088Sscottl u_int32_t ContainerId; 138165793Smsmith}; 138265793Smsmith 138383114Sscottl/* 138495536Sscottl * SCSI Passthrough structures 138595536Sscottl */ 1386198617Semastestruct aac_srb { 138795536Sscottl u_int32_t function; 138895536Sscottl u_int32_t bus; 138995536Sscottl u_int32_t target; 139095536Sscottl u_int32_t lun; 139195536Sscottl u_int32_t timeout; 139295536Sscottl u_int32_t flags; 139395536Sscottl u_int32_t data_len; 139495536Sscottl u_int32_t retry_limit; 139595536Sscottl u_int32_t cdb_len; 139695536Sscottl u_int8_t cdb[16]; 1397203885Semaste struct aac_sg_table sg_map; 139895536Sscottl}; 139995536Sscottl 140095536Sscottlenum { 140195536Sscottl AAC_SRB_FUNC_EXECUTE_SCSI = 0x00, 140295536Sscottl AAC_SRB_FUNC_CLAIM_DEVICE, 140395536Sscottl AAC_SRB_FUNC_IO_CONTROL, 140495536Sscottl AAC_SRB_FUNC_RECEIVE_EVENT, 140595536Sscottl AAC_SRB_FUNC_RELEASE_QUEUE, 140695536Sscottl AAC_SRB_FUNC_ATTACH_DEVICE, 140795536Sscottl AAC_SRB_FUNC_RELEASE_DEVICE, 140895536Sscottl AAC_SRB_FUNC_SHUTDOWN, 140995536Sscottl AAC_SRB_FUNC_FLUSH, 141095536Sscottl AAC_SRB_FUNC_ABORT_COMMAND = 0x10, 141195536Sscottl AAC_SRB_FUNC_RELEASE_RECOVERY, 141295536Sscottl AAC_SRB_FUNC_RESET_BUS, 141395536Sscottl AAC_SRB_FUNC_RESET_DEVICE, 141495536Sscottl AAC_SRB_FUNC_TERMINATE_IO, 141595536Sscottl AAC_SRB_FUNC_FLUSH_QUEUE, 141695536Sscottl AAC_SRB_FUNC_REMOVE_DEVICE, 141795536Sscottl AAC_SRB_FUNC_DOMAIN_VALIDATION 141895536Sscottl}; 141995536Sscottl 142095536Sscottl#define AAC_SRB_FLAGS_NO_DATA_XFER 0x0000 142195536Sscottl#define AAC_SRB_FLAGS_DISABLE_DISCONNECT 0x0004 142295536Sscottl#define AAC_SRB_FLAGS_DISABLE_SYNC_TRANSFER 0x0008 142395536Sscottl#define AAC_SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x0010 142495536Sscottl#define AAC_SRB_FLAGS_DISABLE_AUTOSENSE 0x0020 142595536Sscottl#define AAC_SRB_FLAGS_DATA_IN 0x0040 142695536Sscottl#define AAC_SRB_FLAGS_DATA_OUT 0x0080 142795536Sscottl#define AAC_SRB_FLAGS_UNSPECIFIED_DIRECTION \ 142895536Sscottl (AAC_SRB_FLAGS_DATA_IN | AAC_SRB_FLAGS_DATA_OUT) 142995536Sscottl 143095536Sscottl#define AAC_HOST_SENSE_DATA_MAX 30 143195536Sscottl 143295536Sscottlstruct aac_srb_response { 143395536Sscottl u_int32_t fib_status; 143495536Sscottl u_int32_t srb_status; 143595536Sscottl u_int32_t scsi_status; 143695536Sscottl u_int32_t data_len; 143795536Sscottl u_int32_t sense_len; 143895536Sscottl u_int8_t sense[AAC_HOST_SENSE_DATA_MAX]; 143995536Sscottl}; 144095536Sscottl 1441151330Sscottl/* 1442151330Sscottl * Status codes for SCSI passthrough commands. Since they are based on ASPI, 1443151330Sscottl * they also exactly match CAM status codes in both enumeration and meaning. 1444151330Sscottl * They seem to also be used as status codes for synchronous FIBs. 1445151330Sscottl */ 144695536Sscottlenum { 144795536Sscottl AAC_SRB_STS_PENDING = 0x00, 144895536Sscottl AAC_SRB_STS_SUCCESS, 144995536Sscottl AAC_SRB_STS_ABORTED, 145095536Sscottl AAC_SRB_STS_ABORT_FAILED, 145195536Sscottl AAC_SRB_STS_ERROR, 145295536Sscottl AAC_SRB_STS_BUSY, 145395536Sscottl AAC_SRB_STS_INVALID_REQUEST, 145495536Sscottl AAC_SRB_STS_INVALID_PATH_ID, 145595536Sscottl AAC_SRB_STS_NO_DEVICE, 145695536Sscottl AAC_SRB_STS_TIMEOUT, 145795536Sscottl AAC_SRB_STS_SELECTION_TIMEOUT, 145895536Sscottl AAC_SRB_STS_COMMAND_TIMEOUT, 145995536Sscottl AAC_SRB_STS_MESSAGE_REJECTED = 0x0D, 146095536Sscottl AAC_SRB_STS_BUS_RESET, 146195536Sscottl AAC_SRB_STS_PARITY_ERROR, 146295536Sscottl AAC_SRB_STS_REQUEST_SENSE_FAILED, 146395536Sscottl AAC_SRB_STS_NO_HBA, 146495536Sscottl AAC_SRB_STS_DATA_OVERRUN, 146595536Sscottl AAC_SRB_STS_UNEXPECTED_BUS_FREE, 146695536Sscottl AAC_SRB_STS_PHASE_SEQUENCE_FAILURE, 146795536Sscottl AAC_SRB_STS_BAD_SRB_BLOCK_LENGTH, 146895536Sscottl AAC_SRB_STS_REQUEST_FLUSHED, 146995536Sscottl AAC_SRB_STS_INVALID_LUN = 0x20, 147095536Sscottl AAC_SRB_STS_INVALID_TARGET_ID, 147195536Sscottl AAC_SRB_STS_BAD_FUNCTION, 147295536Sscottl AAC_SRB_STS_ERROR_RECOVERY 147395536Sscottl}; 147495536Sscottl 147595536Sscottl/* 147665793Smsmith * Register definitions for the Adaptec AAC-364 'Jalapeno I/II' adapters, based 147765793Smsmith * on the SA110 'StrongArm'. 147865793Smsmith */ 147965793Smsmith 148065793Smsmith#define AAC_SA_DOORBELL0_CLEAR 0x98 /* doorbell 0 (adapter->host) */ 148165793Smsmith#define AAC_SA_DOORBELL0_SET 0x9c 148265793Smsmith#define AAC_SA_DOORBELL0 0x9c 148365793Smsmith#define AAC_SA_MASK0_CLEAR 0xa0 148465793Smsmith#define AAC_SA_MASK0_SET 0xa4 148565793Smsmith 148665793Smsmith#define AAC_SA_DOORBELL1_CLEAR 0x9a /* doorbell 1 (host->adapter) */ 148765793Smsmith#define AAC_SA_DOORBELL1_SET 0x9e 148887183Sscottl#define AAC_SA_DOORBELL1 0x9e 148965793Smsmith#define AAC_SA_MASK1_CLEAR 0xa2 149065793Smsmith#define AAC_SA_MASK1_SET 0xa6 149165793Smsmith 149265793Smsmith#define AAC_SA_MAILBOX 0xa8 /* mailbox (20 bytes) */ 149365793Smsmith#define AAC_SA_FWSTATUS 0xc4 149465793Smsmith 149583114Sscottl/* 149665793Smsmith * Register definitions for the Adaptec 'Pablano' adapters, based on the i960Rx, 149765793Smsmith * and other related adapters. 149865793Smsmith */ 149965793Smsmith 1500188743Semaste#define AAC_RX_OMR0 0x18 /* outbound message register 0 */ 1501188743Semaste#define AAC_RX_OMR1 0x1c /* outbound message register 1 */ 150281082Sscottl#define AAC_RX_IDBR 0x20 /* inbound doorbell register */ 150381082Sscottl#define AAC_RX_IISR 0x24 /* inbound interrupt status register */ 150481082Sscottl#define AAC_RX_IIMR 0x28 /* inbound interrupt mask register */ 150581082Sscottl#define AAC_RX_ODBR 0x2c /* outbound doorbell register */ 150681082Sscottl#define AAC_RX_OISR 0x30 /* outbound interrupt status register */ 150781082Sscottl#define AAC_RX_OIMR 0x34 /* outbound interrupt mask register */ 1508151086Sscottl#define AAC_RX_IQUE 0x40 /* inbound queue */ 1509151086Sscottl#define AAC_RX_OQUE 0x44 /* outbound queue */ 151065793Smsmith 151181082Sscottl#define AAC_RX_MAILBOX 0x50 /* mailbox (20 bytes) */ 151281082Sscottl#define AAC_RX_FWSTATUS 0x6c 151365793Smsmith 151483114Sscottl/* 1515133606Sscottl * Register definitions for the Adaptec 'Rocket' RAID-On-Chip adapters. 1516133606Sscottl * Unsurprisingly, it's quite similar to the i960! 1517133606Sscottl */ 1518133606Sscottl 1519188743Semaste#define AAC_RKT_OMR0 0x18 /* outbound message register 0 */ 1520188743Semaste#define AAC_RKT_OMR1 0x1c /* outbound message register 1 */ 1521133606Sscottl#define AAC_RKT_IDBR 0x20 /* inbound doorbell register */ 1522133606Sscottl#define AAC_RKT_IISR 0x24 /* inbound interrupt status register */ 1523133606Sscottl#define AAC_RKT_IIMR 0x28 /* inbound interrupt mask register */ 1524133606Sscottl#define AAC_RKT_ODBR 0x2c /* outbound doorbell register */ 1525133606Sscottl#define AAC_RKT_OISR 0x30 /* outbound interrupt status register */ 1526133606Sscottl#define AAC_RKT_OIMR 0x34 /* outbound interrupt mask register */ 1527151086Sscottl#define AAC_RKT_IQUE 0x40 /* inbound queue */ 1528151086Sscottl#define AAC_RKT_OQUE 0x44 /* outbound queue */ 1529133606Sscottl 1530133606Sscottl#define AAC_RKT_MAILBOX 0x1000 /* mailbox */ 1531133606Sscottl#define AAC_RKT_FWSTATUS 0x101c /* Firmware Status (mailbox 7) */ 1532133606Sscottl 1533133606Sscottl/* 153465793Smsmith * Common bit definitions for the doorbell registers. 153565793Smsmith */ 153665793Smsmith 153765793Smsmith/* 153865793Smsmith * Status bits in the doorbell registers. 153965793Smsmith */ 154081082Sscottl#define AAC_DB_SYNC_COMMAND (1<<0) /* send/completed synchronous FIB */ 154181082Sscottl#define AAC_DB_COMMAND_READY (1<<1) /* posted one or more commands */ 154281082Sscottl#define AAC_DB_RESPONSE_READY (1<<2) /* one or more commands complete */ 154381082Sscottl#define AAC_DB_COMMAND_NOT_FULL (1<<3) /* command queue not full */ 154481082Sscottl#define AAC_DB_RESPONSE_NOT_FULL (1<<4) /* response queue not full */ 154565793Smsmith 154665793Smsmith/* 154765793Smsmith * The adapter can request the host print a message by setting the 154865793Smsmith * DB_PRINTF flag in DOORBELL0. The driver responds by collecting the 1549206534Semaste * message from the printf buffer, clearing the DB_PRINTF flag in 155065793Smsmith * DOORBELL0 and setting it in DOORBELL1. 155165793Smsmith * (ODBR and IDBR respectively for the i960Rx adapters) 155265793Smsmith */ 155381082Sscottl#define AAC_DB_PRINTF (1<<5) /* adapter requests host printf */ 155487183Sscottl#define AAC_PRINTF_DONE (1<<5) /* Host completed printf processing */ 155565793Smsmith 155665793Smsmith/* 155781082Sscottl * Mask containing the interrupt bits we care about. We don't anticipate (or 155881082Sscottl * want) interrupts not in this mask. 155965793Smsmith */ 156083114Sscottl#define AAC_DB_INTERRUPTS (AAC_DB_COMMAND_READY | \ 156183114Sscottl AAC_DB_RESPONSE_READY | \ 156283114Sscottl AAC_DB_PRINTF) 1563151086Sscottl#define AAC_DB_INT_NEW_COMM 0x08 1564151086Sscottl 1565