1250963Sachim/*- 2250963Sachim * Copyright (c) 2000 Michael Smith 3250963Sachim * Copyright (c) 2000-2001 Scott Long 4250963Sachim * Copyright (c) 2000 BSDi 5250963Sachim * Copyright (c) 2001-2010 Adaptec, Inc. 6250963Sachim * Copyright (c) 2010-2012 PMC-Sierra, Inc. 7250963Sachim * All rights reserved. 8250963Sachim * 9250963Sachim * Redistribution and use in source and binary forms, with or without 10250963Sachim * modification, are permitted provided that the following conditions 11250963Sachim * are met: 12250963Sachim * 1. Redistributions of source code must retain the above copyright 13250963Sachim * notice, this list of conditions and the following disclaimer. 14250963Sachim * 2. Redistributions in binary form must reproduce the above copyright 15250963Sachim * notice, this list of conditions and the following disclaimer in the 16250963Sachim * documentation and/or other materials provided with the distribution. 17250963Sachim * 18250963Sachim * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19250963Sachim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20250963Sachim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21250963Sachim * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22250963Sachim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23250963Sachim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24250963Sachim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25250963Sachim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26250963Sachim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27250963Sachim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28250963Sachim * SUCH DAMAGE. 29250963Sachim * 30250963Sachim * $FreeBSD$ 31250963Sachim */ 32250963Sachim 33250963Sachim/* 34250963Sachim * Data structures defining the interface between the driver and the Adaptec 35250963Sachim * 'FSA' adapters. Note that many field names and comments here are taken 36250963Sachim * verbatim from the Adaptec driver source in order to make comparing the 37250963Sachim * two slightly easier. 38250963Sachim */ 39250963Sachim 40250963Sachim/* 41250963Sachim * Misc. magic numbers. 42250963Sachim */ 43250963Sachim#define AAC_MAX_CONTAINERS 64 44250963Sachim#define AAC_BLOCK_SIZE 512 45250963Sachim 46250963Sachim/* 47250963Sachim * Communications interface. 48250963Sachim * 49250963Sachim * Where datastructure layouts are closely parallel to the Adaptec sample code, 50250963Sachim * retain their naming conventions (for now) to aid in cross-referencing. 51250963Sachim */ 52250963Sachim 53250963Sachim/* transport FIB header (PMC) */ 54250963Sachimstruct aac_fib_xporthdr { 55250963Sachim u_int64_t HostAddress; /* FIB host address w/o xport header */ 56250963Sachim u_int32_t Size; /* FIB size excluding xport header */ 57250963Sachim u_int32_t Handle; /* driver handle to reference the FIB */ 58250963Sachim u_int64_t Reserved[2]; 59250963Sachim} __packed; 60250963Sachim 61250963Sachim/* 62250963Sachim * List structure used to chain FIBs (used by the adapter - we hang FIBs off 63250963Sachim * our private command structure and don't touch these) 64250963Sachim */ 65250963Sachimstruct aac_fib_list_entry { 66250963Sachim u_int32_t Flink; 67250963Sachim u_int32_t Blink; 68250963Sachim} __packed; 69250963Sachim 70250963Sachim/* 71250963Sachim * FIB (FSA Interface Block?); this is the datastructure passed between the host 72250963Sachim * and adapter. 73250963Sachim */ 74250963Sachimstruct aac_fib_header { 75250963Sachim u_int32_t XferState; 76250963Sachim u_int16_t Command; 77250963Sachim u_int8_t StructType; 78250963Sachim u_int8_t Unused; 79250963Sachim u_int16_t Size; 80250963Sachim u_int16_t SenderSize; 81250963Sachim u_int32_t SenderFibAddress; 82250963Sachim union { 83250963Sachim u_int32_t ReceiverFibAddress; 84250963Sachim u_int32_t SenderFibAddressHigh; 85250963Sachim u_int32_t TimeStamp; 86250963Sachim } u; 87250963Sachim u_int32_t Handle; 88250963Sachim u_int32_t Previous; 89250963Sachim u_int32_t Next; 90250963Sachim} __packed; 91250963Sachim 92250963Sachim#define AAC_FIB_DATASIZE (512 - sizeof(struct aac_fib_header)) 93250963Sachim 94250963Sachimstruct aac_fib { 95250963Sachim struct aac_fib_header Header; 96250963Sachim u_int8_t data[AAC_FIB_DATASIZE]; 97250963Sachim} __packed; 98250963Sachim 99250963Sachim/* 100250963Sachim * FIB commands 101250963Sachim */ 102250963Sachimtypedef enum { 103250963Sachim TestCommandResponse = 1, 104250963Sachim TestAdapterCommand = 2, 105250963Sachim 106250963Sachim /* lowlevel and comm commands */ 107250963Sachim LastTestCommand = 100, 108250963Sachim ReinitHostNormCommandQueue = 101, 109250963Sachim ReinitHostHighCommandQueue = 102, 110250963Sachim ReinitHostHighRespQueue = 103, 111250963Sachim ReinitHostNormRespQueue = 104, 112250963Sachim ReinitAdapNormCommandQueue = 105, 113250963Sachim ReinitAdapHighCommandQueue = 107, 114250963Sachim ReinitAdapHighRespQueue = 108, 115250963Sachim ReinitAdapNormRespQueue = 109, 116250963Sachim InterfaceShutdown = 110, 117250963Sachim DmaCommandFib = 120, 118250963Sachim StartProfile = 121, 119250963Sachim TermProfile = 122, 120250963Sachim SpeedTest = 123, 121250963Sachim TakeABreakPt = 124, 122250963Sachim RequestPerfData = 125, 123250963Sachim SetInterruptDefTimer= 126, 124250963Sachim SetInterruptDefCount= 127, 125250963Sachim GetInterruptDefStatus= 128, 126250963Sachim LastCommCommand = 129, 127250963Sachim 128250963Sachim /* filesystem commands */ 129250963Sachim NuFileSystem = 300, 130250963Sachim UFS = 301, 131250963Sachim HostFileSystem = 302, 132250963Sachim LastFileSystemCommand = 303, 133250963Sachim 134250963Sachim /* Container Commands */ 135250963Sachim ContainerCommand = 500, 136250963Sachim ContainerCommand64 = 501, 137250963Sachim RawIo = 502, 138250963Sachim RawIo2 = 503, 139250963Sachim 140250963Sachim /* Cluster Commands */ 141250963Sachim ClusterCommand = 550, 142250963Sachim 143250963Sachim /* Scsi Port commands (scsi passthrough) */ 144250963Sachim ScsiPortCommand = 600, 145250963Sachim ScsiPortCommandU64 = 601, 146250963Sachim SataPortCommandU64 = 602, 147250963Sachim SasSmpPassThrough = 603, 148250963Sachim SasRequestPhyInfo = 612, 149250963Sachim 150250963Sachim /* misc house keeping and generic adapter initiated commands */ 151250963Sachim AifRequest = 700, 152250963Sachim CheckRevision = 701, 153250963Sachim FsaHostShutdown = 702, 154250963Sachim RequestAdapterInfo = 703, 155250963Sachim IsAdapterPaused = 704, 156250963Sachim SendHostTime = 705, 157250963Sachim RequestSupplementAdapterInfo = 706, /* Supp. Info for set in UCC 158250963Sachim * use only if supported 159250963Sachim * (RequestAdapterInfo first) */ 160250963Sachim LastMiscCommand = 707, 161250963Sachim 162250963Sachim OnLineDiagnostic = 800, 163250963Sachim FduAdapterTest = 801, 164250963Sachim RequestCompatibilityId = 802, 165250963Sachim AdapterEnvironmentInfo = 803, /* temp. sensors */ 166250963Sachim NvsramEventLog = 900, 167250963Sachim ResetNvsramEventLogPointers = 901, 168250963Sachim EnableEventLog = 902, 169250963Sachim DisableEventLog = 903, 170250963Sachim EncryptedKeyTransportFIB= 904, 171250963Sachim KeyableFeaturesFIB= 905 172250963Sachim} AAC_FibCommands; 173250963Sachim 174250963Sachim/* 175250963Sachim * FIB types 176250963Sachim */ 177250963Sachim#define AAC_FIBTYPE_TFIB 1 178250963Sachim#define AAC_FIBTYPE_TQE 2 179250963Sachim#define AAC_FIBTYPE_TCTPERF 3 180250963Sachim#define AAC_FIBTYPE_TFIB2 4 181250963Sachim#define AAC_FIBTYPE_TFIB2_64 5 182250963Sachim 183250963Sachim/* 184250963Sachim * FIB transfer state 185250963Sachim */ 186250963Sachim#define AAC_FIBSTATE_HOSTOWNED (1<<0) /* owned by the host */ 187250963Sachim#define AAC_FIBSTATE_ADAPTEROWNED (1<<1) /* owned by the adapter */ 188250963Sachim#define AAC_FIBSTATE_INITIALISED (1<<2) /* initialised */ 189250963Sachim#define AAC_FIBSTATE_EMPTY (1<<3) /* empty */ 190250963Sachim#define AAC_FIBSTATE_FROMPOOL (1<<4) /* allocated from pool */ 191250963Sachim#define AAC_FIBSTATE_FROMHOST (1<<5) /* sent from the host */ 192250963Sachim#define AAC_FIBSTATE_FROMADAP (1<<6) /* sent from the adapter */ 193250963Sachim#define AAC_FIBSTATE_REXPECTED (1<<7) /* response is expected */ 194250963Sachim#define AAC_FIBSTATE_RNOTEXPECTED (1<<8) /* response is not expected */ 195250963Sachim#define AAC_FIBSTATE_DONEADAP (1<<9) /* processed by the adapter */ 196250963Sachim#define AAC_FIBSTATE_DONEHOST (1<<10) /* processed by the host */ 197250963Sachim#define AAC_FIBSTATE_HIGH (1<<11) /* high priority */ 198250963Sachim#define AAC_FIBSTATE_NORM (1<<12) /* normal priority */ 199250963Sachim#define AAC_FIBSTATE_ASYNC (1<<13) 200250963Sachim#define AAC_FIBSTATE_ASYNCIO (1<<13) /* to be removed */ 201250963Sachim#define AAC_FIBSTATE_PAGEFILEIO (1<<14) /* to be removed */ 202250963Sachim#define AAC_FIBSTATE_SHUTDOWN (1<<15) 203250963Sachim#define AAC_FIBSTATE_LAZYWRITE (1<<16) /* to be removed */ 204250963Sachim#define AAC_FIBSTATE_ADAPMICROFIB (1<<17) 205250963Sachim#define AAC_FIBSTATE_BIOSFIB (1<<18) 206250963Sachim#define AAC_FIBSTATE_FAST_RESPONSE (1<<19) /* fast response capable */ 207250963Sachim#define AAC_FIBSTATE_APIFIB (1<<20) 208250963Sachim#define AAC_FIBSTATE_NOMOREAIF (1<<21) 209250963Sachim 210250963Sachim/* 211250963Sachim * FIB error values 212250963Sachim */ 213250963Sachim#define AAC_ERROR_NORMAL 0x00 214250963Sachim#define AAC_ERROR_PENDING 0x01 215250963Sachim#define AAC_ERROR_FATAL 0x02 216250963Sachim#define AAC_ERROR_INVALID_QUEUE 0x03 217250963Sachim#define AAC_ERROR_NOENTRIES 0x04 218250963Sachim#define AAC_ERROR_SENDFAILED 0x05 219250963Sachim#define AAC_ERROR_INVALID_QUEUE_PRIORITY 0x06 220250963Sachim#define AAC_ERROR_FIB_ALLOCATION_FAILED 0x07 221250963Sachim#define AAC_ERROR_FIB_DEALLOCATION_FAILED 0x08 222250963Sachim 223250963Sachim/* 224250963Sachim * Adapter Init Structure: this is passed to the adapter with the 225250963Sachim * AAC_MONKER_INITSTRUCT command to point it at our control structures. 226250963Sachim */ 227250963Sachimstruct aac_adapter_init { 228250963Sachim u_int32_t InitStructRevision; 229250963Sachim#define AAC_INIT_STRUCT_REVISION 3 230250963Sachim#define AAC_INIT_STRUCT_REVISION_4 4 231250963Sachim#define AAC_INIT_STRUCT_REVISION_6 6 232250963Sachim#define AAC_INIT_STRUCT_REVISION_7 7 233263024Sachim u_int32_t NoOfMSIXVectors; 234250963Sachim u_int32_t FilesystemRevision; 235250963Sachim u_int32_t CommHeaderAddress; 236250963Sachim u_int32_t FastIoCommAreaAddress; 237250963Sachim u_int32_t AdapterFibsPhysicalAddress; 238250963Sachim u_int32_t AdapterFibsVirtualAddress; 239250963Sachim u_int32_t AdapterFibsSize; 240250963Sachim u_int32_t AdapterFibAlign; 241250963Sachim u_int32_t PrintfBufferAddress; 242250963Sachim u_int32_t PrintfBufferSize; 243250963Sachim#define AAC_PAGE_SIZE 4096 244250963Sachim u_int32_t HostPhysMemPages; 245250963Sachim u_int32_t HostElapsedSeconds; 246250963Sachim /* ADAPTER_INIT_STRUCT_REVISION_4 begins here */ 247250963Sachim u_int32_t InitFlags; /* flags for supported features */ 248250963Sachim#define AAC_INITFLAGS_NEW_COMM_SUPPORTED 1 249250963Sachim#define AAC_INITFLAGS_DRIVER_USES_UTC_TIME 0x10 250250963Sachim#define AAC_INITFLAGS_DRIVER_SUPPORTS_PM 0x20 251250963Sachim#define AAC_INITFLAGS_NEW_COMM_TYPE1_SUPPORTED 0x40 252250963Sachim#define AAC_INITFLAGS_FAST_JBOD_SUPPORTED 0x80 253250963Sachim#define AAC_INITFLAGS_NEW_COMM_TYPE2_SUPPORTED 0x100 254250963Sachim u_int32_t MaxIoCommands; /* max outstanding commands */ 255250963Sachim u_int32_t MaxIoSize; /* largest I/O command */ 256250963Sachim u_int32_t MaxFibSize; /* largest FIB to adapter */ 257250963Sachim /* ADAPTER_INIT_STRUCT_REVISION_5 begins here */ 258250963Sachim u_int32_t MaxNumAif; /* max number of aif */ 259250963Sachim /* ADAPTER_INIT_STRUCT_REVISION_6 begins here */ 260250963Sachim u_int32_t HostRRQ_AddrLow; 261250963Sachim u_int32_t HostRRQ_AddrHigh; /* Host RRQ (response queue) for SRC */ 262250963Sachim} __packed; 263250963Sachim 264250963Sachim/* 265250963Sachim * Shared data types 266250963Sachim */ 267250963Sachim/* 268250963Sachim * Container types 269250963Sachim */ 270250963Sachimtypedef enum { 271250963Sachim CT_NONE = 0, 272250963Sachim CT_VOLUME, 273250963Sachim CT_MIRROR, 274250963Sachim CT_STRIPE, 275250963Sachim CT_RAID5, 276250963Sachim CT_SSRW, 277250963Sachim CT_SSRO, 278250963Sachim CT_MORPH, 279250963Sachim CT_PASSTHRU, 280250963Sachim CT_RAID4, 281250963Sachim CT_RAID10, /* stripe of mirror */ 282250963Sachim CT_RAID00, /* stripe of stripe */ 283250963Sachim CT_VOLUME_OF_MIRRORS, /* volume of mirror */ 284250963Sachim CT_PSEUDO_RAID3, /* really raid4 */ 285250963Sachim CT_RAID50, /* stripe of raid5 */ 286250963Sachim CT_RAID5D, /* raid5 distributed hot-sparing */ 287250963Sachim CT_RAID5D0, 288250963Sachim CT_RAID1E, /* extended raid1 mirroring */ 289250963Sachim CT_RAID6, 290250963Sachim CT_RAID60, 291250963Sachim} AAC_FSAVolType; 292250963Sachim 293250963Sachim/* 294250963Sachim * Host-addressable object types 295250963Sachim */ 296250963Sachimtypedef enum { 297250963Sachim FT_REG = 1, /* regular file */ 298250963Sachim FT_DIR, /* directory */ 299250963Sachim FT_BLK, /* "block" device - reserved */ 300250963Sachim FT_CHR, /* "character special" device - reserved */ 301250963Sachim FT_LNK, /* symbolic link */ 302250963Sachim FT_SOCK, /* socket */ 303250963Sachim FT_FIFO, /* fifo */ 304250963Sachim FT_FILESYS, /* ADAPTEC's "FSA"(tm) filesystem */ 305250963Sachim FT_DRIVE, /* physical disk - addressable in scsi by b/t/l */ 306250963Sachim FT_SLICE, /* virtual disk - raw volume - slice */ 307250963Sachim FT_PARTITION, /* FSA partition - carved out of a slice - building 308250963Sachim * block for containers */ 309250963Sachim FT_VOLUME, /* Container - Volume Set */ 310250963Sachim FT_STRIPE, /* Container - Stripe Set */ 311250963Sachim FT_MIRROR, /* Container - Mirror Set */ 312250963Sachim FT_RAID5, /* Container - Raid 5 Set */ 313250963Sachim FT_DATABASE /* Storage object with "foreign" content manager */ 314250963Sachim} AAC_FType; 315250963Sachim 316250963Sachim/* 317250963Sachim * Host-side scatter/gather list for 32-bit commands. 318250963Sachim */ 319250963Sachimstruct aac_sg_entry { 320250963Sachim u_int32_t SgAddress; 321250963Sachim u_int32_t SgByteCount; 322250963Sachim} __packed; 323250963Sachim 324250963Sachimstruct aac_sg_entry64 { 325250963Sachim u_int64_t SgAddress; 326250963Sachim u_int32_t SgByteCount; 327250963Sachim} __packed; 328250963Sachim 329250963Sachimstruct aac_sg_entryraw { 330250963Sachim u_int32_t Next; /* reserved for FW use */ 331250963Sachim u_int32_t Prev; /* reserved for FW use */ 332250963Sachim u_int64_t SgAddress; 333250963Sachim u_int32_t SgByteCount; 334250963Sachim u_int32_t Flags; /* reserved for FW use */ 335250963Sachim} __packed; 336250963Sachim 337250963Sachimstruct aac_sg_table { 338250963Sachim u_int32_t SgCount; 339250963Sachim struct aac_sg_entry SgEntry[0]; 340250963Sachim} __packed; 341250963Sachim 342250963Sachim/* 343250963Sachim * Host-side scatter/gather list for 64-bit commands. 344250963Sachim */ 345250963Sachimstruct aac_sg_table64 { 346250963Sachim u_int32_t SgCount; 347250963Sachim struct aac_sg_entry64 SgEntry64[0]; 348250963Sachim} __packed; 349250963Sachim 350250963Sachim/* 351250963Sachim * s/g list for raw commands 352250963Sachim */ 353250963Sachimstruct aac_sg_tableraw { 354250963Sachim u_int32_t SgCount; 355250963Sachim struct aac_sg_entryraw SgEntryRaw[0]; 356250963Sachim} __packed; 357250963Sachim 358250963Sachim/* 359250963Sachim * new ieee1212 s/g element 360250963Sachim */ 361250963Sachimstruct aac_sge_ieee1212 { 362250963Sachim u_int32_t addrLow; 363250963Sachim u_int32_t addrHigh; 364250963Sachim u_int32_t length; 365250963Sachim u_int32_t flags; /* always 0 from host side */ 366250963Sachim} __packed; 367250963Sachim 368250963Sachim/* 369250963Sachim * Container creation data 370250963Sachim */ 371250963Sachimstruct aac_container_creation { 372250963Sachim u_int8_t ViaBuildNumber; 373250963Sachim u_int8_t MicroSecond; 374250963Sachim u_int8_t Via; /* 1 = FSU, 2 = API, etc. */ 375250963Sachim u_int8_t YearsSince1900; 376250963Sachim u_int32_t Month:4; /* 1-12 */ 377250963Sachim u_int32_t Day:6; /* 1-32 */ 378250963Sachim u_int32_t Hour:6; /* 0-23 */ 379250963Sachim u_int32_t Minute:6; /* 0-59 */ 380250963Sachim u_int32_t Second:6; /* 0-59 */ 381250963Sachim u_int64_t ViaAdapterSerialNumber; 382250963Sachim} __packed; 383250963Sachim 384250963Sachim/* 385250963Sachim * Revision number handling 386250963Sachim */ 387250963Sachim 388250963Sachimtypedef enum { 389250963Sachim RevApplication = 1, 390250963Sachim RevDkiCli, 391250963Sachim RevNetService, 392250963Sachim RevApi, 393250963Sachim RevFileSysDriver, 394250963Sachim RevMiniportDriver, 395250963Sachim RevAdapterSW, 396250963Sachim RevMonitor, 397250963Sachim RevRemoteApi 398250963Sachim} RevComponent; 399250963Sachim 400250963Sachimstruct FsaRevision { 401250963Sachim union { 402250963Sachim struct { 403250963Sachim u_int8_t dash; 404250963Sachim u_int8_t type; 405250963Sachim u_int8_t minor; 406250963Sachim u_int8_t major; 407250963Sachim } comp; 408250963Sachim u_int32_t ul; 409250963Sachim } external; 410250963Sachim u_int32_t buildNumber; 411250963Sachim} __packed; 412250963Sachim 413250963Sachim/* 414250963Sachim * Adapter Information 415250963Sachim */ 416250963Sachim 417250963Sachimtypedef enum { 418250963Sachim CPU_NTSIM = 1, 419250963Sachim CPU_I960, 420250963Sachim CPU_ARM, 421250963Sachim CPU_SPARC, 422250963Sachim CPU_POWERPC, 423250963Sachim CPU_ALPHA, 424250963Sachim CPU_P7, 425250963Sachim CPU_I960_RX, 426250963Sachim CPU_MIPS, 427250963Sachim CPU_XSCALE, 428250963Sachim CPU__last 429250963Sachim} AAC_CpuType; 430250963Sachim 431250963Sachimtypedef enum { 432250963Sachim CPUI960_JX = 1, 433250963Sachim CPUI960_CX, 434250963Sachim CPUI960_HX, 435250963Sachim CPUI960_RX, 436250963Sachim CPUARM_SA110, 437250963Sachim CPUARM_xxx, 438250963Sachim CPUPPC_603e, 439250963Sachim CPUPPC_xxx, 440250963Sachim CPUI960_80303, 441250963Sachim CPU_XSCALE_80321, 442250963Sachim CPU_MIPS_4KC, 443250963Sachim CPU_MIPS_5KC, 444250963Sachim CPUSUBTYPE__last 445250963Sachim} AAC_CpuSubType; 446250963Sachim 447250963Sachimtypedef enum { 448250963Sachim PLAT_NTSIM = 1, 449250963Sachim PLAT_V3ADU, 450250963Sachim PLAT_CYCLONE, 451250963Sachim PLAT_CYCLONE_HD, 452250963Sachim PLAT_BATBOARD, 453250963Sachim PLAT_BATBOARD_HD, 454250963Sachim PLAT_YOLO, 455250963Sachim PLAT_COBRA, 456250963Sachim PLAT_ANAHEIM, 457250963Sachim PLAT_JALAPENO, 458250963Sachim PLAT_QUEENS, 459250963Sachim PLAT_JALAPENO_DELL, 460250963Sachim PLAT_POBLANO, 461250963Sachim PLAT_POBLANO_OPAL, 462250963Sachim PLAT_POBLANO_SL0, 463250963Sachim PLAT_POBLANO_SL1, 464250963Sachim PLAT_POBLANO_SL2, 465250963Sachim PLAT_POBLANO_XXX, 466250963Sachim PLAT_JALAPENO_P2, 467250963Sachim PLAT_HABANERO, 468250963Sachim PLAT_VULCAN, 469250963Sachim PLAT_CRUSADER, 470250963Sachim PLAT_LANCER, 471250963Sachim PLAT_HARRIER, 472250963Sachim PLAT_TERMINATOR, 473250963Sachim PLAT_SKYHAWK, 474250963Sachim PLAT_CORSAIR, 475250963Sachim PLAT_JAGUAR, 476250963Sachim PLAT_SATAHAWK, 477250963Sachim PLAT_SATANATOR, 478250963Sachim PLAT_PROWLER, 479250963Sachim PLAT_BLACKBIRD, 480250963Sachim PLAT_SABREEXPRESS, 481250963Sachim PLAT_INTRUDER, 482250963Sachim PLAT__last 483250963Sachim} AAC_Platform; 484250963Sachim 485250963Sachimtypedef enum { 486250963Sachim OEM_FLAVOR_ADAPTEC = 1, 487250963Sachim OEM_FLAVOR_DELL, 488250963Sachim OEM_FLAVOR_HP, 489250963Sachim OEM_FLAVOR_IBM, 490250963Sachim OEM_FLAVOR_CPQ, 491250963Sachim OEM_FLAVOR_FSC, 492250963Sachim OEM_FLAVOR_DWS, 493250963Sachim OEM_FLAVOR_BRAND_Z, 494250963Sachim OEM_FLAVOR_LEGEND, 495250963Sachim OEM_FLAVOR_HITACHI, 496250963Sachim OEM_FLAVOR_ESG, 497250963Sachim OEM_FLAVOR_ICP, 498250963Sachim OEM_FLAVOR_SCM, 499250963Sachim OEM_FLAVOR__last 500250963Sachim} AAC_OemFlavor; 501250963Sachim 502250963Sachim/* 503250963Sachim * XXX the aac-2622 with no battery present reports PLATFORM_BAT_OPT_PRESENT 504250963Sachim */ 505250963Sachimtypedef enum 506250963Sachim{ 507250963Sachim PLATFORM_BAT_REQ_PRESENT = 1, /* BATTERY REQUIRED AND PRESENT */ 508250963Sachim PLATFORM_BAT_REQ_NOTPRESENT, /* BATTERY REQUIRED AND NOT PRESENT */ 509250963Sachim PLATFORM_BAT_OPT_PRESENT, /* BATTERY OPTIONAL AND PRESENT */ 510250963Sachim PLATFORM_BAT_OPT_NOTPRESENT, /* BATTERY OPTIONAL AND NOT PRESENT */ 511250963Sachim PLATFORM_BAT_NOT_SUPPORTED /* BATTERY NOT SUPPORTED */ 512250963Sachim} AAC_BatteryPlatform; 513250963Sachim 514250963Sachim/* 515250963Sachim * options supported by this board 516250963Sachim * there has to be a one to one mapping of these defines and the ones in 517250963Sachim * fsaapi.h, search for FSA_SUPPORT_SNAPSHOT 518250963Sachim */ 519250963Sachim#define AAC_SUPPORTED_SNAPSHOT 0x01 520250963Sachim#define AAC_SUPPORTED_CLUSTERS 0x02 521250963Sachim#define AAC_SUPPORTED_WRITE_CACHE 0x04 522250963Sachim#define AAC_SUPPORTED_64BIT_DATA 0x08 523250963Sachim#define AAC_SUPPORTED_HOST_TIME_FIB 0x10 524250963Sachim#define AAC_SUPPORTED_RAID50 0x20 525250963Sachim#define AAC_SUPPORTED_4GB_WINDOW 0x40 526250963Sachim#define AAC_SUPPORTED_SCSI_UPGRADEABLE 0x80 527250963Sachim#define AAC_SUPPORTED_SOFT_ERR_REPORT 0x100 528250963Sachim#define AAC_SUPPORTED_NOT_RECONDITION 0x200 529250963Sachim#define AAC_SUPPORTED_SGMAP_HOST64 0x400 530250963Sachim#define AAC_SUPPORTED_ALARM 0x800 531250963Sachim#define AAC_SUPPORTED_NONDASD 0x1000 532250963Sachim#define AAC_SUPPORTED_SCSI_MANAGED 0x2000 533250963Sachim#define AAC_SUPPORTED_RAID_SCSI_MODE 0x4000 534250963Sachim#define AAC_SUPPORTED_SUPPLEMENT_ADAPTER_INFO 0x10000 535250963Sachim#define AAC_SUPPORTED_NEW_COMM 0x20000 536250963Sachim#define AAC_SUPPORTED_64BIT_ARRAYSIZE 0x40000 537250963Sachim#define AAC_SUPPORTED_HEAT_SENSOR 0x80000 538250963Sachim#define AAC_SUPPORTED_NEW_COMM_TYPE1 0x10000000 /* Tupelo new comm */ 539250963Sachim#define AAC_SUPPORTED_NEW_COMM_TYPE2 0x20000000 /* Denali new comm */ 540250963Sachim#define AAC_SUPPORTED_NEW_COMM_TYPE3 0x40000000 /* Series 8 new comm */ 541250963Sachim#define AAC_SUPPORTED_NEW_COMM_TYPE4 0x80000000 /* Series 9 new comm */ 542250963Sachim 543250963Sachim/* 544250963Sachim * Structure used to respond to a RequestAdapterInfo fib. 545250963Sachim */ 546250963Sachimstruct aac_adapter_info { 547250963Sachim AAC_Platform PlatformBase; /* adapter type */ 548250963Sachim AAC_CpuType CpuArchitecture; /* adapter CPU type */ 549250963Sachim AAC_CpuSubType CpuVariant; /* adapter CPU subtype */ 550250963Sachim u_int32_t ClockSpeed; /* adapter CPU clockspeed */ 551250963Sachim u_int32_t ExecutionMem; /* adapter Execution Memory 552250963Sachim * size */ 553250963Sachim u_int32_t BufferMem; /* adapter Data Memory */ 554250963Sachim u_int32_t TotalMem; /* adapter Total Memory */ 555250963Sachim struct FsaRevision KernelRevision; /* adapter Kernel Software 556250963Sachim * Revision */ 557250963Sachim struct FsaRevision MonitorRevision; /* adapter Monitor/Diagnostic 558250963Sachim * Software Revision */ 559250963Sachim struct FsaRevision HardwareRevision;/* TBD */ 560250963Sachim struct FsaRevision BIOSRevision; /* adapter BIOS Revision */ 561250963Sachim u_int32_t ClusteringEnabled; 562250963Sachim u_int32_t ClusterChannelMask; 563250963Sachim u_int64_t SerialNumber; 564250963Sachim AAC_BatteryPlatform batteryPlatform; 565250963Sachim u_int32_t SupportedOptions; /* supported features of this 566250963Sachim * controller */ 567250963Sachim AAC_OemFlavor OemVariant; 568250963Sachim} __packed; 569250963Sachim 570250963Sachim/* 571250963Sachim * More options from supplement info - SupportedOptions2 572250963Sachim */ 573250963Sachim#define AAC_SUPPORTED_MU_RESET 0x01 574250963Sachim#define AAC_SUPPORTED_IGNORE_RESET 0x02 575250963Sachim#define AAC_SUPPORTED_POWER_MANAGEMENT 0x04 576250963Sachim#define AAC_SUPPORTED_ARCIO_PHYDEV 0x08 577250963Sachim#define AAC_SUPPORTED_DOORBELL_RESET 0x4000 578250963Sachim#define AAC_SUPPORTED_VARIABLE_BLOCK_SIZE 0x40000 /* 4KB sector size */ 579250963Sachim 580250963Sachim/* 581250963Sachim * FeatureBits of RequestSupplementAdapterInfo used in the driver 582250963Sachim */ 583250963Sachim#define AAC_SUPPL_SUPPORTED_JBOD 0x08000000 584250963Sachim 585250963Sachim/* 586250963Sachim * Structure used to respond to a RequestSupplementAdapterInfo fib. 587250963Sachim */ 588250963Sachimstruct vpd_info { 589250963Sachim u_int8_t AssemblyPn[8]; 590250963Sachim u_int8_t FruPn[8]; 591250963Sachim u_int8_t BatteryFruPn[8]; 592250963Sachim u_int8_t EcVersionString[8]; 593250963Sachim u_int8_t Tsid[12]; 594250963Sachim} __packed; 595250963Sachim 596250963Sachim#define MFG_PCBA_SERIAL_NUMBER_WIDTH 12 597250963Sachim#define MFG_WWN_WIDTH 8 598250963Sachim 599250963Sachimstruct aac_supplement_adapter_info { 600250963Sachim /* The assigned Adapter Type Text, extra byte for null termination */ 601250963Sachim int8_t AdapterTypeText[17+1]; 602250963Sachim /* Pad for the text above */ 603250963Sachim int8_t Pad[2]; 604250963Sachim /* Size in bytes of the memory that is flashed */ 605250963Sachim u_int32_t FlashMemoryByteSize; 606250963Sachim /* The assigned IMAGEID_xxx for this adapter */ 607250963Sachim u_int32_t FlashImageId; 608250963Sachim /* 609250963Sachim * The maximum number of Phys available on a SATA/SAS 610250963Sachim * Controller, 0 otherwise 611250963Sachim */ 612250963Sachim u_int32_t MaxNumberPorts; 613250963Sachim /* Version of expansion area */ 614250963Sachim u_int32_t Version; 615250963Sachim u_int32_t FeatureBits; 616250963Sachim u_int8_t SlotNumber; 617250963Sachim u_int8_t ReservedPad0[3]; 618250963Sachim u_int8_t BuildDate[12]; 619250963Sachim /* The current number of Ports on a SAS controller, 0 otherwise */ 620250963Sachim u_int32_t CurrentNumberPorts; 621250963Sachim 622250963Sachim struct vpd_info VpdInfo; 623250963Sachim 624250963Sachim /* Firmware Revision (Vmaj.min-dash.) */ 625250963Sachim struct FsaRevision FlashFirmwareRevision; 626250963Sachim u_int32_t RaidTypeMorphOptions; 627250963Sachim /* Firmware's boot code Revision (Vmaj.min-dash.) */ 628250963Sachim struct FsaRevision FlashFirmwareBootRevision; 629250963Sachim /* PCBA serial no. from th MFG sector */ 630250963Sachim u_int8_t MfgPcbaSerialNo[MFG_PCBA_SERIAL_NUMBER_WIDTH]; 631250963Sachim /* WWN from the MFG sector */ 632250963Sachim u_int8_t MfgWWNName[MFG_WWN_WIDTH]; 633250963Sachim u_int32_t SupportedOptions2; /* more supported features */ 634250963Sachim u_int32_t ExpansionFlag; /* 1 - following fields are valid */ 635250963Sachim u_int32_t FeatureBits3; 636250963Sachim u_int32_t SupportedPerformanceMode; 637250963Sachim /* Growth Area for future expansion */ 638250963Sachim u_int32_t ReservedGrowth[80]; 639250963Sachim} __packed; 640250963Sachim 641250963Sachim/* 642250963Sachim * Monitor/Kernel interface. 643250963Sachim */ 644250963Sachim 645250963Sachim/* 646250963Sachim * Synchronous commands to the monitor/kernel. 647250963Sachim */ 648250963Sachim#define AAC_MONKER_BREAKPOINT 0x04 649250963Sachim#define AAC_MONKER_INITSTRUCT 0x05 650250963Sachim#define AAC_MONKER_SYNCFIB 0x0c 651250963Sachim#define AAC_MONKER_GETKERNVER 0x11 652250963Sachim#define AAC_MONKER_POSTRESULTS 0x14 653250963Sachim#define AAC_MONKER_GETINFO 0x19 654250963Sachim#define AAC_MONKER_GETDRVPROP 0x23 655250963Sachim#define AAC_MONKER_RCVTEMP 0x25 656250963Sachim#define AAC_MONKER_GETCOMMPREF 0x26 657250963Sachim#define AAC_MONKER_REINIT 0xee 658250963Sachim#define AAC_IOP_RESET 0x1000 659250963Sachim#define AAC_IOP_RESET_ALWAYS 0x1001 660250963Sachim 661250963Sachim/* 662250963Sachim * Adapter Status Register 663250963Sachim * 664250963Sachim * Phase Staus mailbox is 32bits: 665250963Sachim * <31:16> = Phase Status 666250963Sachim * <15:0> = Phase 667250963Sachim * 668250963Sachim * The adapter reports its present state through the phase. Only 669250963Sachim * a single phase should be ever be set. Each phase can have multiple 670250963Sachim * phase status bits to provide more detailed information about the 671250963Sachim * state of the adapter. 672250963Sachim */ 673250963Sachim#define AAC_SELF_TEST_FAILED 0x00000004 674250963Sachim#define AAC_MONITOR_PANIC 0x00000020 675250963Sachim#define AAC_UP_AND_RUNNING 0x00000080 676250963Sachim#define AAC_KERNEL_PANIC 0x00000100 677250963Sachim 678250963Sachim/* 679263024Sachim * for dual FW image support 680263024Sachim */ 681263024Sachim#define AAC_FLASH_UPD_PENDING 0x00002000 682263024Sachim#define AAC_FLASH_UPD_SUCCESS 0x00004000 683263024Sachim#define AAC_FLASH_UPD_FAILED 0x00008000 684263024Sachim 685263024Sachim/* 686250963Sachim * Data types relating to control and monitoring of the NVRAM/WriteCache 687250963Sachim * subsystem. 688250963Sachim */ 689250963Sachim 690250963Sachim#define AAC_NFILESYS 24 /* maximum number of filesystems */ 691250963Sachim 692250963Sachim/* 693250963Sachim * NVRAM/Write Cache subsystem states 694250963Sachim */ 695250963Sachimtypedef enum { 696250963Sachim NVSTATUS_DISABLED = 0, /* present, clean, not being used */ 697250963Sachim NVSTATUS_ENABLED, /* present, possibly dirty, ready for use */ 698250963Sachim NVSTATUS_ERROR, /* present, dirty, contains dirty data */ 699250963Sachim NVSTATUS_BATTERY, /* present, bad or low battery, may contain 700250963Sachim * dirty data */ 701250963Sachim NVSTATUS_UNKNOWN /* for bad/missing device */ 702250963Sachim} AAC_NVSTATUS; 703250963Sachim 704250963Sachim/* 705250963Sachim * NVRAM/Write Cache subsystem battery component states 706250963Sachim * 707250963Sachim */ 708250963Sachimtypedef enum { 709250963Sachim NVBATTSTATUS_NONE = 0, /* battery has no power or is not present */ 710250963Sachim NVBATTSTATUS_LOW, /* battery is low on power */ 711250963Sachim NVBATTSTATUS_OK, /* battery is okay - normal operation possible 712250963Sachim * only in this state */ 713250963Sachim NVBATTSTATUS_RECONDITIONING /* no battery present - reconditioning 714250963Sachim * in process */ 715250963Sachim} AAC_NVBATTSTATUS; 716250963Sachim 717250963Sachim/* 718250963Sachim * Battery transition type 719250963Sachim */ 720250963Sachimtypedef enum { 721250963Sachim NVBATT_TRANSITION_NONE = 0, /* battery now has no power or is not 722250963Sachim * present */ 723250963Sachim NVBATT_TRANSITION_LOW, /* battery is now low on power */ 724250963Sachim NVBATT_TRANSITION_OK /* battery is now okay - normal 725250963Sachim * operation possible only in this 726250963Sachim * state */ 727250963Sachim} AAC_NVBATT_TRANSITION; 728250963Sachim 729250963Sachim/* 730250963Sachim * NVRAM Info structure returned for NVRAM_GetInfo call 731250963Sachim */ 732250963Sachimstruct aac_nvramdevinfo { 733250963Sachim u_int32_t NV_Enabled; /* write caching enabled */ 734250963Sachim u_int32_t NV_Error; /* device in error state */ 735250963Sachim u_int32_t NV_NDirty; /* count of dirty NVRAM buffers */ 736250963Sachim u_int32_t NV_NActive; /* count of NVRAM buffers being 737250963Sachim * written */ 738250963Sachim} __packed; 739250963Sachim 740250963Sachimstruct aac_nvraminfo { 741250963Sachim AAC_NVSTATUS NV_Status; /* nvram subsystem status */ 742250963Sachim AAC_NVBATTSTATUS NV_BattStatus; /* battery status */ 743250963Sachim u_int32_t NV_Size; /* size of WriteCache NVRAM in 744250963Sachim * bytes */ 745250963Sachim u_int32_t NV_BufSize; /* size of NVRAM buffers in 746250963Sachim * bytes */ 747250963Sachim u_int32_t NV_NBufs; /* number of NVRAM buffers */ 748250963Sachim u_int32_t NV_NDirty; /* Num dirty NVRAM buffers */ 749250963Sachim u_int32_t NV_NClean; /* Num clean NVRAM buffers */ 750250963Sachim u_int32_t NV_NActive; /* Num NVRAM buffers being 751250963Sachim * written */ 752250963Sachim u_int32_t NV_NBrokered; /* Num brokered NVRAM buffers */ 753250963Sachim struct aac_nvramdevinfo NV_DevInfo[AAC_NFILESYS]; /* per device 754250963Sachim * info */ 755250963Sachim u_int32_t NV_BattNeedsReconditioning; /* boolean */ 756250963Sachim u_int32_t NV_TotalSize; /* size of all non-volatile 757250963Sachim * memories in bytes */ 758250963Sachim} __packed; 759250963Sachim 760250963Sachim/* 761250963Sachim * Data types relating to adapter-initiated FIBs 762250963Sachim * 763250963Sachim * Based on types and structures in <aifstruc.h> 764250963Sachim */ 765250963Sachim 766250963Sachim/* 767250963Sachim * Progress Reports 768250963Sachim */ 769250963Sachimtypedef enum { 770250963Sachim AifJobStsSuccess = 1, 771250963Sachim AifJobStsFinished, 772250963Sachim AifJobStsAborted, 773250963Sachim AifJobStsFailed, 774250963Sachim AifJobStsLastReportMarker = 100, /* All prior mean last report */ 775250963Sachim AifJobStsSuspended, 776250963Sachim AifJobStsRunning 777250963Sachim} AAC_AifJobStatus; 778250963Sachim 779250963Sachimtypedef enum { 780250963Sachim AifJobScsiMin = 1, /* Minimum value for Scsi operation */ 781250963Sachim AifJobScsiZero, /* SCSI device clear operation */ 782250963Sachim AifJobScsiVerify, /* SCSI device Verify operation NO 783250963Sachim * REPAIR */ 784250963Sachim AifJobScsiExercise, /* SCSI device Exercise operation */ 785250963Sachim AifJobScsiVerifyRepair, /* SCSI device Verify operation WITH 786250963Sachim * repair */ 787250963Sachim AifJobScsiWritePattern, /* write pattern */ 788250963Sachim AifJobScsiMax = 99, /* Max Scsi value */ 789250963Sachim AifJobCtrMin, /* Min Ctr op value */ 790250963Sachim AifJobCtrZero, /* Container clear operation */ 791250963Sachim AifJobCtrCopy, /* Container copy operation */ 792250963Sachim AifJobCtrCreateMirror, /* Container Create Mirror operation */ 793250963Sachim AifJobCtrMergeMirror, /* Container Merge Mirror operation */ 794250963Sachim AifJobCtrScrubMirror, /* Container Scrub Mirror operation */ 795250963Sachim AifJobCtrRebuildRaid5, /* Container Rebuild Raid5 operation */ 796250963Sachim AifJobCtrScrubRaid5, /* Container Scrub Raid5 operation */ 797250963Sachim AifJobCtrMorph, /* Container morph operation */ 798250963Sachim AifJobCtrPartCopy, /* Container Partition copy operation */ 799250963Sachim AifJobCtrRebuildMirror, /* Container Rebuild Mirror operation */ 800250963Sachim AifJobCtrCrazyCache, /* crazy cache */ 801250963Sachim AifJobCtrCopyback, /* Container Copyback operation */ 802250963Sachim AifJobCtrCompactRaid5D, /* Container Compaction operation */ 803250963Sachim AifJobCtrExpandRaid5D, /* Container Expansion operation */ 804250963Sachim AifJobCtrRebuildRaid6, /* Container Rebuild Raid6 operation */ 805250963Sachim AifJobCtrScrubRaid6, /* Container Scrub Raid6 operation */ 806250963Sachim AifJobCtrSSBackup, /* Container snapshot backup task */ 807250963Sachim AifJobCtrMax = 199, /* Max Ctr type operation */ 808250963Sachim AifJobFsMin, /* Min Fs type operation */ 809250963Sachim AifJobFsCreate, /* File System Create operation */ 810250963Sachim AifJobFsVerify, /* File System Verify operation */ 811250963Sachim AifJobFsExtend, /* File System Extend operation */ 812250963Sachim AifJobFsMax = 299, /* Max Fs type operation */ 813250963Sachim AifJobApiFormatNTFS, /* Format a drive to NTFS */ 814250963Sachim AifJobApiFormatFAT, /* Format a drive to FAT */ 815250963Sachim AifJobApiUpdateSnapshot, /* update the read/write half of a 816250963Sachim * snapshot */ 817250963Sachim AifJobApiFormatFAT32, /* Format a drive to FAT32 */ 818250963Sachim AifJobApiMax = 399, /* Max API type operation */ 819250963Sachim AifJobCtlContinuousCtrVerify, /* Adapter operation */ 820250963Sachim AifJobCtlMax = 499 /* Max Adapter type operation */ 821250963Sachim} AAC_AifJobType; 822250963Sachim 823250963Sachimstruct aac_AifContainers { 824250963Sachim u_int32_t src; /* from/master */ 825250963Sachim u_int32_t dst; /* to/slave */ 826250963Sachim} __packed; 827250963Sachim 828250963Sachimunion aac_AifJobClient { 829250963Sachim struct aac_AifContainers container; /* For Container and 830250963Sachim * filesystem progress 831250963Sachim * ops; */ 832250963Sachim int32_t scsi_dh; /* For SCSI progress 833250963Sachim * ops */ 834250963Sachim}; 835250963Sachim 836250963Sachimstruct aac_AifJobDesc { 837250963Sachim u_int32_t jobID; /* DO NOT FILL IN! Will be 838250963Sachim * filled in by AIF */ 839250963Sachim AAC_AifJobType type; /* Operation that is being 840250963Sachim * performed */ 841250963Sachim union aac_AifJobClient client; /* Details */ 842250963Sachim} __packed; 843250963Sachim 844250963Sachimstruct aac_AifJobProgressReport { 845250963Sachim struct aac_AifJobDesc jd; 846250963Sachim AAC_AifJobStatus status; 847250963Sachim u_int32_t finalTick; 848250963Sachim u_int32_t currentTick; 849250963Sachim u_int32_t jobSpecificData1; 850250963Sachim u_int32_t jobSpecificData2; 851250963Sachim} __packed; 852250963Sachim 853250963Sachim/* 854250963Sachim * Event Notification 855250963Sachim */ 856250963Sachimtypedef enum { 857250963Sachim /* General application notifies start here */ 858250963Sachim AifEnGeneric = 1, /* Generic notification */ 859250963Sachim AifEnTaskComplete, /* Task has completed */ 860250963Sachim AifEnConfigChange, /* Adapter config change occurred */ 861250963Sachim AifEnContainerChange, /* Adapter specific container 862250963Sachim * configuration change */ 863250963Sachim AifEnDeviceFailure, /* SCSI device failed */ 864250963Sachim AifEnMirrorFailover, /* Mirror failover started */ 865250963Sachim AifEnContainerEvent, /* Significant container event */ 866250963Sachim AifEnFileSystemChange, /* File system changed */ 867250963Sachim AifEnConfigPause, /* Container pause event */ 868250963Sachim AifEnConfigResume, /* Container resume event */ 869250963Sachim AifEnFailoverChange, /* Failover space assignment changed */ 870250963Sachim AifEnRAID5RebuildDone, /* RAID5 rebuild finished */ 871250963Sachim AifEnEnclosureManagement, /* Enclosure management event */ 872250963Sachim AifEnBatteryEvent, /* Significant NV battery event */ 873250963Sachim AifEnAddContainer, /* A new container was created. */ 874250963Sachim AifEnDeleteContainer, /* A container was deleted. */ 875250963Sachim AifEnSMARTEvent, /* SMART Event */ 876250963Sachim AifEnBatteryNeedsRecond, /* The battery needs reconditioning */ 877250963Sachim AifEnClusterEvent, /* Some cluster event */ 878250963Sachim AifEnDiskSetEvent, /* A disk set event occured. */ 879250963Sachim AifEnContainerScsiEvent, /* a container event with no. and scsi id */ 880250963Sachim AifEnPicBatteryEvent, /* An event gen. by pic_battery.c for an ABM */ 881250963Sachim AifEnExpEvent, /* Exp. Event Type to replace CTPopUp messages */ 882250963Sachim AifEnRAID6RebuildDone, /* RAID6 rebuild finished */ 883250963Sachim AifEnSensorOverHeat, /* Heat Sensor indicate overheat */ 884250963Sachim AifEnSensorCoolDown, /* Heat Sensor ind. cooled down after overheat */ 885250963Sachim AifFeatureKeysModified, /* notif. of updated feature keys */ 886250963Sachim AifApplicationExpirationEvent, /* notif. on app. expiration status */ 887250963Sachim AifEnBackgroundConsistencyCheck,/* BCC notif. for NEC - DDTS 94700 */ 888250963Sachim AifEnAddJBOD, /* A new JBOD type drive was created (30) */ 889250963Sachim AifEnDeleteJBOD, /* A JBOD type drive was deleted (31) */ 890250963Sachim AifDriverNotifyStart=199, /* Notifies for host driver go here */ 891250963Sachim /* Host driver notifications start here */ 892250963Sachim AifDenMorphComplete, /* A morph operation completed */ 893250963Sachim AifDenVolumeExtendComplete, /* Volume expand operation completed */ 894250963Sachim AifDriverNotifyDelay, 895250963Sachim AifRawDeviceRemove /* Raw device Failure event */ 896250963Sachim} AAC_AifEventNotifyType; 897250963Sachim 898250963Sachimstruct aac_AifEnsGeneric { 899250963Sachim char text[132]; /* Generic text */ 900250963Sachim} __packed; 901250963Sachim 902250963Sachimstruct aac_AifEnsDeviceFailure { 903250963Sachim u_int32_t deviceHandle; /* SCSI device handle */ 904250963Sachim} __packed; 905250963Sachim 906250963Sachimstruct aac_AifEnsMirrorFailover { 907250963Sachim u_int32_t container; /* Container with failed element */ 908250963Sachim u_int32_t failedSlice; /* Old slice which failed */ 909250963Sachim u_int32_t creatingSlice; /* New slice used for auto-create */ 910250963Sachim} __packed; 911250963Sachim 912250963Sachimstruct aac_AifEnsContainerChange { 913250963Sachim u_int32_t container[2]; /* container that changed, -1 if no 914250963Sachim * container */ 915250963Sachim} __packed; 916250963Sachim 917250963Sachimstruct aac_AifEnsContainerEvent { 918250963Sachim u_int32_t container; /* container number */ 919250963Sachim u_int32_t eventType; /* event type */ 920250963Sachim} __packed; 921250963Sachim 922250963Sachimstruct aac_AifEnsEnclosureEvent { 923250963Sachim u_int32_t empID; /* enclosure management proc number */ 924250963Sachim u_int32_t unitID; /* unitId, fan id, power supply id, 925250963Sachim * slot id, tempsensor id. */ 926250963Sachim u_int32_t eventType; /* event type */ 927250963Sachim} __packed; 928250963Sachim 929250963Sachimtypedef enum { 930250963Sachim AIF_EM_DRIVE_INSERTION=31, 931250963Sachim AIF_EM_DRIVE_REMOVAL 932250963Sachim} aac_AifEMEventType; 933250963Sachim 934250963Sachimstruct aac_AifEnsBatteryEvent { 935250963Sachim AAC_NVBATT_TRANSITION transition_type; /* eg from low to ok */ 936250963Sachim AAC_NVBATTSTATUS current_state; /* current batt state */ 937250963Sachim AAC_NVBATTSTATUS prior_state; /* prev batt state */ 938250963Sachim} __packed; 939250963Sachim 940250963Sachimstruct aac_AifEnsDiskSetEvent { 941250963Sachim u_int32_t eventType; 942250963Sachim u_int64_t DsNum; 943250963Sachim u_int64_t CreatorId; 944250963Sachim} __packed; 945250963Sachim 946250963Sachimtypedef enum { 947250963Sachim CLUSTER_NULL_EVENT = 0, 948250963Sachim CLUSTER_PARTNER_NAME_EVENT, /* change in partner hostname or 949250963Sachim * adaptername from NULL to non-NULL */ 950250963Sachim /* (partner's agent may be up) */ 951250963Sachim CLUSTER_PARTNER_NULL_NAME_EVENT /* change in partner hostname or 952250963Sachim * adaptername from non-null to NULL */ 953250963Sachim /* (partner has rebooted) */ 954250963Sachim} AAC_ClusterAifEvent; 955250963Sachim 956250963Sachimstruct aac_AifEnsClusterEvent { 957250963Sachim AAC_ClusterAifEvent eventType; 958250963Sachim} __packed; 959250963Sachim 960250963Sachimstruct aac_AifEventNotify { 961250963Sachim AAC_AifEventNotifyType type; 962250963Sachim union { 963250963Sachim struct aac_AifEnsGeneric EG; 964250963Sachim struct aac_AifEnsDeviceFailure EDF; 965250963Sachim struct aac_AifEnsMirrorFailover EMF; 966250963Sachim struct aac_AifEnsContainerChange ECC; 967250963Sachim struct aac_AifEnsContainerEvent ECE; 968250963Sachim struct aac_AifEnsEnclosureEvent EEE; 969250963Sachim struct aac_AifEnsBatteryEvent EBE; 970250963Sachim struct aac_AifEnsDiskSetEvent EDS; 971250963Sachim/* struct aac_AifEnsSMARTEvent ES;*/ 972250963Sachim struct aac_AifEnsClusterEvent ECLE; 973250963Sachim } data; 974250963Sachim} __packed; 975250963Sachim 976250963Sachim/* 977250963Sachim * Adapter Initiated FIB command structures. Start with the adapter 978250963Sachim * initiated FIBs that really come from the adapter, and get responded 979250963Sachim * to by the host. 980250963Sachim */ 981250963Sachim#define AAC_AIF_REPORT_MAX_SIZE 64 982250963Sachim 983250963Sachimtypedef enum { 984250963Sachim AifCmdEventNotify = 1, /* Notify of event */ 985250963Sachim AifCmdJobProgress, /* Progress report */ 986250963Sachim AifCmdAPIReport, /* Report from other user of API */ 987250963Sachim AifCmdDriverNotify, /* Notify host driver of event */ 988250963Sachim AifReqJobList = 100, /* Gets back complete job list */ 989250963Sachim AifReqJobsForCtr, /* Gets back jobs for specific container */ 990250963Sachim AifReqJobsForScsi, /* Gets back jobs for specific SCSI device */ 991250963Sachim AifReqJobReport, /* Gets back a specific job report or list */ 992250963Sachim AifReqTerminateJob, /* Terminates job */ 993250963Sachim AifReqSuspendJob, /* Suspends a job */ 994250963Sachim AifReqResumeJob, /* Resumes a job */ 995250963Sachim AifReqSendAPIReport, /* API generic report requests */ 996250963Sachim AifReqAPIJobStart, /* Start a job from the API */ 997250963Sachim AifReqAPIJobUpdate, /* Update a job report from the API */ 998250963Sachim AifReqAPIJobFinish, /* Finish a job from the API */ 999250963Sachim AifReqEvent = 200 /* PMC NEW COMM: Request the event data */ 1000250963Sachim} AAC_AifCommand; 1001250963Sachim 1002250963Sachimstruct aac_aif_command { 1003250963Sachim AAC_AifCommand command; /* Tell host what type of 1004250963Sachim * notify this is */ 1005250963Sachim u_int32_t seqNumber; /* To allow ordering of 1006250963Sachim * reports (if necessary) */ 1007250963Sachim union { 1008250963Sachim struct aac_AifEventNotify EN; /* Event notify */ 1009250963Sachim struct aac_AifJobProgressReport PR[1]; /* Progress report */ 1010250963Sachim u_int8_t AR[AAC_AIF_REPORT_MAX_SIZE]; 1011250963Sachim u_int8_t data[AAC_FIB_DATASIZE - 8]; 1012250963Sachim } data; 1013250963Sachim} __packed; 1014250963Sachim 1015250963Sachim/* 1016250963Sachim * Filesystem commands/data 1017250963Sachim * 1018250963Sachim * The adapter has a very complex filesystem interface, most of which we ignore. 1019250963Sachim * (And which seems not to be implemented, anyway.) 1020250963Sachim */ 1021250963Sachim 1022250963Sachim/* 1023250963Sachim * FSA commands 1024250963Sachim * (not used?) 1025250963Sachim */ 1026250963Sachimtypedef enum { 1027250963Sachim Null = 0, 1028250963Sachim GetAttributes, 1029250963Sachim SetAttributes, 1030250963Sachim Lookup, 1031250963Sachim ReadLink, 1032250963Sachim Read, 1033250963Sachim Write, 1034250963Sachim Create, 1035250963Sachim MakeDirectory, 1036250963Sachim SymbolicLink, 1037250963Sachim MakeNode, 1038250963Sachim Removex, 1039250963Sachim RemoveDirectory, 1040250963Sachim Rename, 1041250963Sachim Link, 1042250963Sachim ReadDirectory, 1043250963Sachim ReadDirectoryPlus, 1044250963Sachim FileSystemStatus, 1045250963Sachim FileSystemInfo, 1046250963Sachim PathConfigure, 1047250963Sachim Commit, 1048250963Sachim Mount, 1049250963Sachim UnMount, 1050250963Sachim Newfs, 1051250963Sachim FsCheck, 1052250963Sachim FsSync, 1053250963Sachim SimReadWrite, 1054250963Sachim SetFileSystemStatus, 1055250963Sachim BlockRead, 1056250963Sachim BlockWrite, 1057250963Sachim NvramIoctl, 1058250963Sachim FsSyncWait, 1059250963Sachim ClearArchiveBit, 1060250963Sachim SetAcl, 1061250963Sachim GetAcl, 1062250963Sachim AssignAcl, 1063250963Sachim FaultInsertion, 1064250963Sachim CrazyCache 1065250963Sachim} AAC_FSACommand; 1066250963Sachim 1067250963Sachim/* 1068250963Sachim * Command status values 1069250963Sachim */ 1070250963Sachimtypedef enum { 1071250963Sachim ST_OK = 0, 1072250963Sachim ST_PERM = 1, 1073250963Sachim ST_NOENT = 2, 1074250963Sachim ST_IO = 5, 1075250963Sachim ST_NXIO = 6, 1076250963Sachim ST_E2BIG = 7, 1077250963Sachim ST_ACCES = 13, 1078250963Sachim ST_EXIST = 17, 1079250963Sachim ST_XDEV = 18, 1080250963Sachim ST_NODEV = 19, 1081250963Sachim ST_NOTDIR = 20, 1082250963Sachim ST_ISDIR = 21, 1083250963Sachim ST_INVAL = 22, 1084250963Sachim ST_FBIG = 27, 1085250963Sachim ST_NOSPC = 28, 1086250963Sachim ST_ROFS = 30, 1087250963Sachim ST_MLINK = 31, 1088250963Sachim ST_WOULDBLOCK = 35, 1089250963Sachim ST_NAMETOOLONG = 63, 1090250963Sachim ST_NOTEMPTY = 66, 1091250963Sachim ST_DQUOT = 69, 1092250963Sachim ST_STALE = 70, 1093250963Sachim ST_REMOTE = 71, 1094250963Sachim ST_NOT_READY = 72, 1095250963Sachim ST_BADHANDLE = 10001, 1096250963Sachim ST_NOT_SYNC = 10002, 1097250963Sachim ST_BAD_COOKIE = 10003, 1098250963Sachim ST_NOTSUPP = 10004, 1099250963Sachim ST_TOOSMALL = 10005, 1100250963Sachim ST_SERVERFAULT = 10006, 1101250963Sachim ST_BADTYPE = 10007, 1102250963Sachim ST_JUKEBOX = 10008, 1103250963Sachim ST_NOTMOUNTED = 10009, 1104250963Sachim ST_MAINTMODE = 10010, 1105250963Sachim ST_STALEACL = 10011, 1106250963Sachim ST_BUS_RESET = 20001 1107250963Sachim} AAC_FSAStatus; 1108250963Sachim 1109250963Sachim/* 1110250963Sachim * Volume manager commands 1111250963Sachim */ 1112250963Sachimtypedef enum _VM_COMMANDS { 1113250963Sachim VM_Null = 0, 1114250963Sachim VM_NameServe, /* query for mountable objects (containers) */ 1115250963Sachim VM_ContainerConfig, 1116250963Sachim VM_Ioctl, 1117250963Sachim VM_FilesystemIoctl, 1118250963Sachim VM_CloseAll, 1119250963Sachim VM_CtBlockRead, 1120250963Sachim VM_CtBlockWrite, 1121250963Sachim VM_SliceBlockRead, /* raw access to configured "storage objects" */ 1122250963Sachim VM_SliceBlockWrite, 1123250963Sachim VM_DriveBlockRead, /* raw access to physical devices */ 1124250963Sachim VM_DriveBlockWrite, 1125250963Sachim VM_EnclosureMgt, /* enclosure management */ 1126250963Sachim VM_Unused, /* used to be diskset management */ 1127250963Sachim VM_CtBlockVerify, 1128250963Sachim VM_CtPerf, /* performance test */ 1129250963Sachim VM_CtBlockRead64, 1130250963Sachim VM_CtBlockWrite64, 1131250963Sachim VM_CtBlockVerify64, 1132250963Sachim VM_CtHostRead64, 1133250963Sachim VM_CtHostWrite64, 1134250963Sachim VM_DrvErrTblLog, /* drive error table/log type of command */ 1135250963Sachim VM_NameServe64, /* query also for containers >2TB */ 1136250963Sachim VM_SasNvsramAccess, /* for sas nvsram layout function */ 1137250963Sachim VM_HandleExpiration, /* handles application expiration, internal use! */ 1138250963Sachim VM_GetDynAdapProps, /* retrieves dynamic adapter properties */ 1139250963Sachim VM_SetDynAdapProps, /* sets a dynamic adapter property */ 1140250963Sachim VM_UpdateSSDODM, /* updates the on-disk metadata for SSD caching */ 1141250963Sachim VM_GetSPMParameters, /* get SPM parameters for one of the perf. modes */ 1142250963Sachim VM_SetSPMParameters, /* set SPM parameters for user defined perf. mode */ 1143250963Sachim VM_NameServeAllBlk, /* query also for containers with 4KB sector size */ 1144250963Sachim MAX_VMCOMMAND_NUM /* used for sizing stats array - leave last */ 1145250963Sachim} AAC_VMCommand; 1146250963Sachim 1147250963Sachim/* Container Configuration Sub-Commands */ 1148250963Sachim#define CT_GET_SCSI_METHOD 64 1149250963Sachim#define CT_PAUSE_IO 65 1150250963Sachim#define CT_RELEASE_IO 66 1151250963Sachim#define CT_GET_CONFIG_STATUS 147 1152250963Sachim#define CT_COMMIT_CONFIG 152 1153250963Sachim#define CT_CID_TO_32BITS_UID 165 1154250963Sachim#define CT_PM_DRIVER_SUPPORT 245 1155250963Sachim 1156263024Sachim/* General CT_xxx return status */ 1157263024Sachim#define CT_OK 218 1158263024Sachim 1159250963Sachim/* CT_PM_DRIVER_SUPPORT parameter */ 1160250963Sachimtypedef enum { 1161250963Sachim AAC_PM_DRIVERSUP_GET_STATUS = 1, 1162250963Sachim AAC_PM_DRIVERSUP_START_UNIT, 1163250963Sachim AAC_PM_DRIVERSUP_STOP_UNIT 1164250963Sachim} AAC_CT_PM_DRIVER_SUPPORT_SUB_COM; 1165250963Sachim 1166250963Sachim/* 1167250963Sachim * CT_PAUSE_IO is immediate minimal runtime command that is used 1168250963Sachim * to restart the applications and cache. 1169250963Sachim */ 1170250963Sachimstruct aac_pause_command { 1171250963Sachim u_int32_t Command; 1172250963Sachim u_int32_t Type; 1173250963Sachim u_int32_t Timeout; 1174250963Sachim u_int32_t Min; 1175250963Sachim u_int32_t NoRescan; 1176250963Sachim u_int32_t Parm3; 1177250963Sachim u_int32_t Parm4; 1178250963Sachim u_int32_t Count; 1179250963Sachim} __packed; 1180250963Sachim 1181250963Sachim/* Flag values for ContentState */ 1182250963Sachim#define AAC_FSCS_NOTCLEAN 0x1 /* fscheck is necessary before mounting */ 1183250963Sachim#define AAC_FSCS_READONLY 0x2 /* possible result of broken mirror */ 1184250963Sachim#define AAC_FSCS_HIDDEN 0x4 /* container should be ignored by driver */ 1185250963Sachim#define AAC_FSCS_NOT_READY 0x8 /* cnt is in spinn. state, not rdy for IO's */ 1186250963Sachim 1187250963Sachim/* 1188250963Sachim * "mountable object" 1189250963Sachim */ 1190250963Sachimstruct aac_mntobj { 1191250963Sachim u_int32_t ObjectId; 1192250963Sachim char FileSystemName[16]; 1193250963Sachim struct aac_container_creation CreateInfo; 1194250963Sachim u_int32_t Capacity; 1195250963Sachim u_int32_t VolType; 1196250963Sachim u_int32_t ObjType; 1197250963Sachim u_int32_t ContentState; 1198250963Sachim union { 1199250963Sachim u_int32_t pad[8]; 1200263024Sachim struct { 1201263024Sachim u_int32_t BlockSize; 1202263024Sachim u_int32_t bdLgclPhysMap; 1203263024Sachim } BlockDevice; 1204250963Sachim } ObjExtension; 1205250963Sachim u_int32_t AlterEgoId; 1206250963Sachim u_int32_t CapacityHigh; 1207250963Sachim} __packed; 1208250963Sachim 1209250963Sachimstruct aac_mntinfo { 1210250963Sachim u_int32_t Command; 1211250963Sachim u_int32_t MntType; 1212250963Sachim u_int32_t MntCount; 1213250963Sachim} __packed; 1214250963Sachim 1215250963Sachimstruct aac_mntinforesp { 1216250963Sachim u_int32_t Status; 1217250963Sachim u_int32_t MntType; 1218250963Sachim u_int32_t MntRespCount; 1219250963Sachim struct aac_mntobj MntTable[1]; 1220250963Sachim} __packed; 1221250963Sachim 1222250963Sachim/* 1223250963Sachim * Container shutdown command. 1224250963Sachim */ 1225250963Sachimstruct aac_closecommand { 1226250963Sachim u_int32_t Command; 1227250963Sachim u_int32_t ContainerId; 1228250963Sachim} __packed; 1229250963Sachim 1230250963Sachim/* 1231250963Sachim * Container Config Command 1232250963Sachim */ 1233250963Sachimstruct aac_ctcfg { 1234250963Sachim u_int32_t Command; 1235250963Sachim u_int32_t cmd; 1236250963Sachim u_int32_t param; 1237250963Sachim} __packed; 1238250963Sachim 1239250963Sachimstruct aac_ctcfg_resp { 1240250963Sachim u_int32_t Status; 1241250963Sachim u_int32_t resp; 1242250963Sachim u_int32_t param; 1243250963Sachim} __packed; 1244250963Sachim 1245250963Sachim/* 1246250963Sachim * 'Ioctl' commads 1247250963Sachim */ 1248250963Sachim#define AAC_SCSI_MAX_PORTS 10 1249250963Sachim#define AAC_BUS_NO_EXIST 0 1250250963Sachim#define AAC_BUS_VALID 1 1251250963Sachim#define AAC_BUS_FAULTED 2 1252250963Sachim#define AAC_BUS_DISABLED 3 1253250963Sachim#define GetBusInfo 0x9 1254250963Sachim 1255250963Sachimstruct aac_getbusinf { 1256250963Sachim u_int32_t ProbeComplete; 1257250963Sachim u_int32_t BusCount; 1258250963Sachim u_int32_t TargetsPerBus; 1259250963Sachim u_int8_t InitiatorBusId[AAC_SCSI_MAX_PORTS]; 1260250963Sachim u_int8_t BusValid[AAC_SCSI_MAX_PORTS]; 1261250963Sachim} __packed; 1262250963Sachim 1263250963Sachimstruct aac_vmioctl { 1264250963Sachim u_int32_t Command; 1265250963Sachim u_int32_t ObjType; 1266250963Sachim u_int32_t MethId; 1267250963Sachim u_int32_t ObjId; 1268250963Sachim u_int32_t IoctlCmd; 1269250963Sachim u_int32_t IoctlBuf[1]; /* Placeholder? */ 1270250963Sachim} __packed; 1271250963Sachim 1272250963Sachimstruct aac_vmi_businf_resp { 1273250963Sachim u_int32_t Status; 1274250963Sachim u_int32_t ObjType; 1275250963Sachim u_int32_t MethId; 1276250963Sachim u_int32_t ObjId; 1277250963Sachim u_int32_t IoctlCmd; 1278250963Sachim struct aac_getbusinf BusInf; 1279250963Sachim} __packed; 1280250963Sachim 1281250963Sachimstruct aac_vmi_devinfo_resp { 1282250963Sachim u_int32_t Status; 1283250963Sachim u_int32_t ObjType; 1284250963Sachim u_int32_t MethId; 1285250963Sachim u_int32_t ObjId; 1286250963Sachim u_int32_t IoctlCmd; 1287250963Sachim u_int8_t VendorId[8]; 1288250963Sachim u_int8_t ProductId[16]; 1289250963Sachim u_int8_t ProductRev[4]; 1290250963Sachim u_int32_t Inquiry7; 1291250963Sachim u_int32_t align1; 1292250963Sachim u_int32_t Inquiry0; 1293250963Sachim u_int32_t align2; 1294250963Sachim u_int32_t Inquiry1; 1295250963Sachim u_int32_t align3; 1296250963Sachim u_int32_t reserved[2]; 1297250963Sachim u_int8_t VendorSpecific[20]; 1298250963Sachim u_int32_t Smart:1; 1299250963Sachim u_int32_t AAC_Managed:1; 1300250963Sachim u_int32_t align4; 1301250963Sachim u_int32_t reserved2:6; 1302250963Sachim u_int32_t Bus; 1303250963Sachim u_int32_t Target; 1304250963Sachim u_int32_t Lun; 1305250963Sachim u_int32_t ultraEnable:1, 1306250963Sachim disconnectEnable:1, 1307250963Sachim fast20EnabledW:1, 1308250963Sachim scamDevice:1, 1309250963Sachim scamTolerant:1, 1310250963Sachim setForSync:1, 1311250963Sachim setForWide:1, 1312250963Sachim syncDevice:1, 1313250963Sachim wideDevice:1, 1314250963Sachim reserved1:7, 1315250963Sachim ScsiRate:8, 1316250963Sachim ScsiOffset:8; 1317250963Sachim}; /* Do not pack */ 1318250963Sachim 1319250963Sachim#define ResetBus 0x16 1320250963Sachimstruct aac_resetbus { 1321250963Sachim u_int32_t BusNumber; 1322250963Sachim}; 1323250963Sachim 1324250963Sachim/* 1325250963Sachim * Write 'stability' options. 1326250963Sachim */ 1327250963Sachimtypedef enum { 1328250963Sachim CSTABLE = 1, 1329250963Sachim CUNSTABLE 1330250963Sachim} AAC_CacheLevel; 1331250963Sachim 1332250963Sachim/* 1333250963Sachim * Commit level response for a write request. 1334250963Sachim */ 1335250963Sachimtypedef enum { 1336250963Sachim CMFILE_SYNC_NVRAM = 1, 1337250963Sachim CMDATA_SYNC_NVRAM, 1338250963Sachim CMFILE_SYNC, 1339250963Sachim CMDATA_SYNC, 1340250963Sachim CMUNSTABLE 1341250963Sachim} AAC_CommitLevel; 1342250963Sachim 1343250963Sachim 1344250963Sachim#define CT_FIB_PARAMS 6 1345250963Sachim#define MAX_FIB_PARAMS 10 1346250963Sachim#define CT_PACKET_SIZE \ 1347250963Sachim (AAC_FIB_DATASIZE - sizeof (u_int32_t) - \ 1348250963Sachim ((sizeof (u_int32_t)) * (MAX_FIB_PARAMS + 1))) 1349263024Sachim#define CNT_SIZE 5 1350250963Sachim 1351250963Sachimstruct aac_fsa_ctm { 1352250963Sachim u_int32_t command; 1353250963Sachim u_int32_t param[CT_FIB_PARAMS]; 1354250963Sachim int8_t data[CT_PACKET_SIZE]; 1355250963Sachim}; 1356250963Sachim 1357250963Sachimstruct aac_cnt_config { 1358250963Sachim u_int32_t Command; 1359250963Sachim struct aac_fsa_ctm CTCommand; 1360250963Sachim}; 1361250963Sachim 1362263024Sachim/* check config. */ 1363263024Sachimenum { 1364263024Sachim CFACT_CONTINUE = 0, /* continue without pause */ 1365263024Sachim CFACT_PAUSE, /* pause, then continue */ 1366263024Sachim CFACT_ABORT /* abort */ 1367263024Sachim}; 1368263024Sachim 1369263024Sachimstruct aac_cf_status_hdr { 1370263024Sachim u_int32_t action; 1371263024Sachim u_int32_t flags; 1372263024Sachim u_int32_t recordcount; 1373263024Sachim}; 1374263024Sachim 1375250963Sachim/* 1376250963Sachim * Block read/write operations. 1377250963Sachim * These structures are packed into the 'data' area in the FIB. 1378250963Sachim */ 1379250963Sachim 1380250963Sachimstruct aac_blockread { 1381250963Sachim u_int32_t Command; /* not FSACommand! */ 1382250963Sachim u_int32_t ContainerId; 1383250963Sachim u_int32_t BlockNumber; 1384250963Sachim u_int32_t ByteCount; 1385250963Sachim struct aac_sg_table SgMap; /* variable size */ 1386250963Sachim} __packed; 1387250963Sachim 1388250963Sachimstruct aac_blockread64 { 1389250963Sachim u_int32_t Command; 1390250963Sachim u_int16_t ContainerId; 1391250963Sachim u_int16_t SectorCount; 1392250963Sachim u_int32_t BlockNumber; 1393250963Sachim u_int16_t Pad; 1394250963Sachim u_int16_t Flags; 1395250963Sachim struct aac_sg_table64 SgMap64; 1396250963Sachim} __packed; 1397250963Sachim 1398250963Sachimstruct aac_blockread_response { 1399250963Sachim u_int32_t Status; 1400250963Sachim u_int32_t ByteCount; 1401250963Sachim} __packed; 1402250963Sachim 1403250963Sachimstruct aac_blockwrite { 1404250963Sachim u_int32_t Command; /* not FSACommand! */ 1405250963Sachim u_int32_t ContainerId; 1406250963Sachim u_int32_t BlockNumber; 1407250963Sachim u_int32_t ByteCount; 1408250963Sachim u_int32_t Stable; 1409250963Sachim struct aac_sg_table SgMap; /* variable size */ 1410250963Sachim} __packed; 1411250963Sachim 1412250963Sachimstruct aac_blockwrite64 { 1413250963Sachim u_int32_t Command; /* not FSACommand! */ 1414250963Sachim u_int16_t ContainerId; 1415250963Sachim u_int16_t SectorCount; 1416250963Sachim u_int32_t BlockNumber; 1417250963Sachim u_int16_t Pad; 1418250963Sachim u_int16_t Flags; 1419250963Sachim struct aac_sg_table64 SgMap64; /* variable size */ 1420250963Sachim} __packed; 1421250963Sachim 1422250963Sachimstruct aac_blockwrite_response { 1423250963Sachim u_int32_t Status; 1424250963Sachim u_int32_t ByteCount; 1425250963Sachim u_int32_t Committed; 1426250963Sachim} __packed; 1427250963Sachim 1428250963Sachimstruct aac_raw_io { 1429250963Sachim u_int64_t BlockNumber; 1430250963Sachim u_int32_t ByteCount; 1431250963Sachim u_int16_t ContainerId; 1432250963Sachim u_int16_t Flags; /* 0: W, 1: R */ 1433250963Sachim u_int16_t BpTotal; /* reserved for FW use */ 1434250963Sachim u_int16_t BpComplete; /* reserved for FW use */ 1435250963Sachim struct aac_sg_tableraw SgMapRaw; /* variable size */ 1436250963Sachim} __packed; 1437250963Sachim 1438250963Sachim#define RIO2_IO_TYPE 0x0003 1439250963Sachim#define RIO2_IO_TYPE_WRITE 0x0000 1440250963Sachim#define RIO2_IO_TYPE_READ 0x0001 1441250963Sachim#define RIO2_IO_TYPE_VERIFY 0x0002 1442250963Sachim#define RIO2_IO_ERROR 0x0004 1443250963Sachim#define RIO2_IO_SUREWRITE 0x0008 1444250963Sachim#define RIO2_SGL_CONFORMANT 0x0010 1445250963Sachim#define RIO2_SG_FORMAT 0xF000 1446250963Sachim#define RIO2_SG_FORMAT_ARC 0x0000 1447250963Sachim#define RIO2_SG_FORMAT_SRL 0x1000 1448250963Sachim#define RIO2_SG_FORMAT_IEEE1212 0x2000 1449250963Sachimstruct aac_raw_io2 { 1450250963Sachim u_int32_t strtBlkLow; 1451250963Sachim u_int32_t strtBlkHigh; 1452250963Sachim u_int32_t byteCnt; 1453250963Sachim u_int16_t ldNum; 1454250963Sachim u_int16_t flags; /* RIO2_xxx */ 1455250963Sachim u_int32_t sgeFirstSize; /* size of first SG element */ 1456250963Sachim u_int32_t sgeNominalSize; /* size of 2nd SG element */ 1457250963Sachim u_int8_t sgeCnt; 1458250963Sachim u_int8_t bpTotal; /* reserved for FW use */ 1459250963Sachim u_int8_t bpComplete; /* reserved for FW use */ 1460250963Sachim u_int8_t sgeFirstIndex; /* reserved for FW use */ 1461250963Sachim u_int8_t unused[4]; 1462250963Sachim struct aac_sge_ieee1212 sge[0]; /* variable size */ 1463250963Sachim} __packed; 1464250963Sachim 1465250963Sachim/* 1466250963Sachim * Container shutdown command. 1467250963Sachim */ 1468250963Sachimstruct aac_close_command { 1469250963Sachim u_int32_t Command; 1470250963Sachim u_int32_t ContainerId; 1471250963Sachim} __packed; 1472250963Sachim 1473250963Sachim/* 1474250963Sachim * SCSI Passthrough structures 1475250963Sachim */ 1476250963Sachimstruct aac_srb { 1477250963Sachim u_int32_t function; 1478250963Sachim u_int32_t bus; 1479250963Sachim u_int32_t target; 1480250963Sachim u_int32_t lun; 1481250963Sachim u_int32_t timeout; 1482250963Sachim u_int32_t flags; 1483250963Sachim u_int32_t data_len; 1484250963Sachim u_int32_t retry_limit; 1485250963Sachim u_int32_t cdb_len; 1486250963Sachim u_int8_t cdb[16]; 1487250963Sachim struct aac_sg_table sg_map; 1488250963Sachim} __packed; 1489250963Sachim 1490250963Sachimenum { 1491250963Sachim AAC_SRB_FUNC_EXECUTE_SCSI = 0x00, 1492250963Sachim AAC_SRB_FUNC_CLAIM_DEVICE, 1493250963Sachim AAC_SRB_FUNC_IO_CONTROL, 1494250963Sachim AAC_SRB_FUNC_RECEIVE_EVENT, 1495250963Sachim AAC_SRB_FUNC_RELEASE_QUEUE, 1496250963Sachim AAC_SRB_FUNC_ATTACH_DEVICE, 1497250963Sachim AAC_SRB_FUNC_RELEASE_DEVICE, 1498250963Sachim AAC_SRB_FUNC_SHUTDOWN, 1499250963Sachim AAC_SRB_FUNC_FLUSH, 1500250963Sachim AAC_SRB_FUNC_ABORT_COMMAND = 0x10, 1501250963Sachim AAC_SRB_FUNC_RELEASE_RECOVERY, 1502250963Sachim AAC_SRB_FUNC_RESET_BUS, 1503250963Sachim AAC_SRB_FUNC_RESET_DEVICE, 1504250963Sachim AAC_SRB_FUNC_TERMINATE_IO, 1505250963Sachim AAC_SRB_FUNC_FLUSH_QUEUE, 1506250963Sachim AAC_SRB_FUNC_REMOVE_DEVICE, 1507250963Sachim AAC_SRB_FUNC_DOMAIN_VALIDATION 1508250963Sachim}; 1509250963Sachim 1510250963Sachim#define AAC_SRB_FLAGS_NO_DATA_XFER 0x0000 1511250963Sachim#define AAC_SRB_FLAGS_DISABLE_DISCONNECT 0x0004 1512250963Sachim#define AAC_SRB_FLAGS_DISABLE_SYNC_TRANSFER 0x0008 1513250963Sachim#define AAC_SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x0010 1514250963Sachim#define AAC_SRB_FLAGS_DISABLE_AUTOSENSE 0x0020 1515250963Sachim#define AAC_SRB_FLAGS_DATA_IN 0x0040 1516250963Sachim#define AAC_SRB_FLAGS_DATA_OUT 0x0080 1517250963Sachim#define AAC_SRB_FLAGS_UNSPECIFIED_DIRECTION \ 1518250963Sachim (AAC_SRB_FLAGS_DATA_IN | AAC_SRB_FLAGS_DATA_OUT) 1519250963Sachim 1520250963Sachim#define AAC_HOST_SENSE_DATA_MAX 30 1521250963Sachim 1522250963Sachimstruct aac_srb_response { 1523250963Sachim u_int32_t fib_status; 1524250963Sachim u_int32_t srb_status; 1525250963Sachim u_int32_t scsi_status; 1526250963Sachim u_int32_t data_len; 1527250963Sachim u_int32_t sense_len; 1528250963Sachim u_int8_t sense[AAC_HOST_SENSE_DATA_MAX]; 1529250963Sachim} __packed; 1530250963Sachim 1531250963Sachim/* 1532250963Sachim * Status codes for SCSI passthrough commands. Since they are based on ASPI, 1533250963Sachim * they also exactly match CAM status codes in both enumeration and meaning. 1534250963Sachim * They seem to also be used as status codes for synchronous FIBs. 1535250963Sachim */ 1536250963Sachimenum { 1537250963Sachim AAC_SRB_STS_PENDING = 0x00, 1538250963Sachim AAC_SRB_STS_SUCCESS, 1539250963Sachim AAC_SRB_STS_ABORTED, 1540250963Sachim AAC_SRB_STS_ABORT_FAILED, 1541250963Sachim AAC_SRB_STS_ERROR, 1542250963Sachim AAC_SRB_STS_BUSY, 1543250963Sachim AAC_SRB_STS_INVALID_REQUEST, 1544250963Sachim AAC_SRB_STS_INVALID_PATH_ID, 1545250963Sachim AAC_SRB_STS_NO_DEVICE, 1546250963Sachim AAC_SRB_STS_TIMEOUT, 1547250963Sachim AAC_SRB_STS_SELECTION_TIMEOUT, 1548250963Sachim AAC_SRB_STS_COMMAND_TIMEOUT, 1549250963Sachim AAC_SRB_STS_MESSAGE_REJECTED = 0x0D, 1550250963Sachim AAC_SRB_STS_BUS_RESET, 1551250963Sachim AAC_SRB_STS_PARITY_ERROR, 1552250963Sachim AAC_SRB_STS_REQUEST_SENSE_FAILED, 1553250963Sachim AAC_SRB_STS_NO_HBA, 1554250963Sachim AAC_SRB_STS_DATA_OVERRUN, 1555250963Sachim AAC_SRB_STS_UNEXPECTED_BUS_FREE, 1556250963Sachim AAC_SRB_STS_PHASE_SEQUENCE_FAILURE, 1557250963Sachim AAC_SRB_STS_BAD_SRB_BLOCK_LENGTH, 1558250963Sachim AAC_SRB_STS_REQUEST_FLUSHED, 1559250963Sachim AAC_SRB_STS_INVALID_LUN = 0x20, 1560250963Sachim AAC_SRB_STS_INVALID_TARGET_ID, 1561250963Sachim AAC_SRB_STS_BAD_FUNCTION, 1562250963Sachim AAC_SRB_STS_ERROR_RECOVERY 1563250963Sachim}; 1564250963Sachim 1565250963Sachim/* 1566250963Sachim * Register definitions for the Adaptec PMC SRC/SRCv adapters. 1567250963Sachim */ 1568250963Sachim/* accessible via BAR0 */ 1569263024Sachim#define AAC_SRC_OMR 0xbc /* outbound message register */ 1570263024Sachim#define AAC_SRC_IOAR 0x18 /* IOA->host interrupt register */ 1571250963Sachim#define AAC_SRC_IDBR 0x20 /* inbound doorbell register */ 1572250963Sachim#define AAC_SRC_IISR 0x24 /* inbound interrupt status register */ 1573250963Sachim#define AAC_SRC_ODBR_R 0x9c /* outbound doorbell register read */ 1574250963Sachim#define AAC_SRC_ODBR_C 0xa0 /* outbound doorbell register clear */ 1575250963Sachim#define AAC_SRC_OIMR 0x34 /* outbound interrupt mask register */ 1576250963Sachim#define AAC_SRC_IQUE32 0x40 /* inbound queue address 32-bit */ 1577250963Sachim#define AAC_SRC_IQUE64_L 0xc0 /* inbound queue address 64-bit (low) */ 1578263024Sachim#define AAC_SRC_IQUE64_H 0xc4 /* inbound queue address 64-bit (high)*/ 1579263024Sachim#define AAC_SRC_ODBR_MSI 0xc8 /* MSI register for sync./AIF */ 1580250963Sachim 1581250963Sachim#define AAC_SRC_MAILBOX 0x7fc60 /* mailbox (20 bytes) */ 1582250963Sachim#define AAC_SRCV_MAILBOX 0x1000 /* mailbox (20 bytes) */ 1583250963Sachim 1584250963Sachim#define AAC_SRC_ODR_SHIFT 12 /* outbound doorbell shift */ 1585250963Sachim#define AAC_SRC_IDR_SHIFT 9 /* inbound doorbell shift */ 1586250963Sachim 1587250963Sachim/* Sunrise Lake dual core reset */ 1588250963Sachim#define AAC_IRCSR 0x38 /* inbound dual cores reset */ 1589250963Sachim#define AAC_IRCSR_CORES_RST 3 1590250963Sachim 1591250963Sachim 1592250963Sachim/* 1593250963Sachim * Common bit definitions for the doorbell registers. 1594250963Sachim */ 1595250963Sachim 1596250963Sachim/* 1597250963Sachim * Status bits in the doorbell registers. 1598250963Sachim */ 1599250963Sachim#define AAC_DB_SYNC_COMMAND (1<<0) /* send/completed synchronous FIB */ 1600263024Sachim#define AAC_DB_AIF_PENDING (1<<6) /* pending AIF (new comm. type1) */ 1601250963Sachim/* PMC specific outbound doorbell bits */ 1602263024Sachim#define AAC_DB_RESPONSE_SENT_NS (1<<1) /* response sent (not shifted)*/ 1603250963Sachim 1604250963Sachim/* 1605250963Sachim * The adapter can request the host print a message by setting the 1606250963Sachim * DB_PRINTF flag in DOORBELL0. The driver responds by collecting the 1607250963Sachim * message from the printf buffer, clearing the DB_PRINTF flag in 1608250963Sachim * DOORBELL0 and setting it in DOORBELL1. 1609250963Sachim * (ODBR and IDBR respectively for the i960Rx adapters) 1610250963Sachim */ 1611250963Sachim#define AAC_DB_PRINTF (1<<5) /* adapter requests host printf */ 1612250963Sachim#define AAC_PRINTF_DONE (1<<5) /* Host completed printf processing */ 1613250963Sachim 1614250963Sachim/* 1615263024Sachim * Interrupts 1616250963Sachim */ 1617263024Sachim#define AAC_MAX_MSIX 32 /* vectors */ 1618263024Sachim#define AAC_PCI_MSI_ENABLE 0x8000 1619263024Sachim#define AAC_MSI_SYNC_STATUS 0x1000 1620263024Sachim 1621263024Sachimenum { 1622263024Sachim AAC_ENABLE_INTERRUPT = 0x0, 1623263024Sachim AAC_DISABLE_INTERRUPT, 1624263024Sachim AAC_ENABLE_MSIX, 1625263024Sachim AAC_DISABLE_MSIX, 1626263024Sachim AAC_CLEAR_AIF_BIT, 1627263024Sachim AAC_CLEAR_SYNC_BIT, 1628263024Sachim AAC_ENABLE_INTX 1629263024Sachim}; 1630263024Sachim 1631263024Sachim#define AAC_INT_MODE_INTX (1<<0) 1632263024Sachim#define AAC_INT_MODE_MSI (1<<1) 1633263024Sachim#define AAC_INT_MODE_AIF (1<<2) 1634263024Sachim#define AAC_INT_MODE_SYNC (1<<3) 1635263024Sachim 1636263024Sachim#define AAC_INT_ENABLE_TYPE1_INTX 0xfffffffb 1637263024Sachim#define AAC_INT_ENABLE_TYPE1_MSIX 0xfffffffa 1638263024Sachim#define AAC_INT_DISABLE_ALL 0xffffffff 1639263024Sachim 1640263024Sachim/* Bit definitions in IOA->Host Interrupt Register */ 1641263024Sachim#define PMC_TRANSITION_TO_OPERATIONAL (0x80000000 >> 0) 1642263024Sachim#define PMC_IOARCB_TRANSFER_FAILED (0x80000000 >> 3) 1643263024Sachim#define PMC_IOA_UNIT_CHECK (0x80000000 >> 4) 1644263024Sachim#define PMC_NO_HOST_RRQ_FOR_CMD_RESPONSE (0x80000000 >> 5) 1645263024Sachim#define PMC_CRITICAL_IOA_OP_IN_PROGRESS (0x80000000 >> 6) 1646263024Sachim#define PMC_IOARRIN_LOST (0x80000000 >> 27) 1647263024Sachim#define PMC_SYSTEM_BUS_MMIO_ERROR (0x80000000 >> 28) 1648263024Sachim#define PMC_IOA_PROCESSOR_IN_ERROR_STATE (0x80000000 >> 29) 1649263024Sachim#define PMC_HOST_RRQ_VALID (0x80000000 >> 30) 1650263024Sachim#define PMC_OPERATIONAL_STATUS (0x80000000 >> 0) 1651263024Sachim#define PMC_ALLOW_MSIX_VECTOR0 (0x80000000 >> 31) 1652263024Sachim 1653263024Sachim#define PMC_IOA_ERROR_INTERRUPTS (PMC_IOARCB_TRANSFER_FAILED | \ 1654263024Sachim PMC_IOA_UNIT_CHECK | \ 1655263024Sachim PMC_NO_HOST_RRQ_FOR_CMD_RESPONSE | \ 1656263024Sachim PMC_IOARRIN_LOST | \ 1657263024Sachim PMC_SYSTEM_BUS_MMIO_ERROR | \ 1658263024Sachim PMC_IOA_PROCESSOR_IN_ERROR_STATE) 1659263024Sachim 1660263024Sachim#define PMC_ALL_INTERRUPT_BITS (PMC_IOA_ERROR_INTERRUPTS | \ 1661263024Sachim PMC_HOST_RRQ_VALID | \ 1662263024Sachim PMC_TRANSITION_TO_OPERATIONAL | \ 1663263024Sachim PMC_ALLOW_MSIX_VECTOR0) 1664263024Sachim 1665263024Sachim#define PMC_GLOBAL_INT_BIT2 0x00000004 1666263024Sachim#define PMC_GLOBAL_INT_BIT0 0x00000001 1667