1 /* 2 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 3 * Use is subject to license terms. 4 */ 5 6 /* 7 * Copyright 2005-06 Adaptec, Inc. 8 * Copyright (c) 2005-06 Adaptec Inc., Achim Leubner 9 * Copyright (c) 2000 Michael Smith 10 * Copyright (c) 2000-2001 Scott Long 11 * Copyright (c) 2000 BSDi 12 * All rights reserved. 13 * 14 * Redistribution and use in source and binary forms, with or without 15 * modification, are permitted provided that the following conditions 16 * are met: 17 * 1. Redistributions of source code must retain the above copyright 18 * notice, this list of conditions and the following disclaimer. 19 * 2. Redistributions in binary form must reproduce the above copyright 20 * notice, this list of conditions and the following disclaimer in the 21 * documentation and/or other materials provided with the distribution. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * $FreeBSD: src/sys/dev/aac/aacreg.h,v 1.23 2005/10/14 16:22:45 scottl Exp $ 36 */ 37 38 #ifndef __AAC_REGS_H__ 39 #define __AAC_REGS_H__ 40 41 #pragma ident "%Z%%M% %I% %E% SMI" 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 /* Status bits in the doorbell registers */ 48 #define AAC_DB_SYNC_COMMAND (1<<0) /* send/completed synchronous */ 49 /* FIB */ 50 #define AAC_DB_COMMAND_READY (1<<1) /* posted one or more */ 51 /* commands */ 52 #define AAC_DB_RESPONSE_READY (1<<2) /* one or more commands */ 53 /* complete */ 54 #define AAC_DB_COMMAND_NOT_FULL (1<<3) /* command queue not full */ 55 #define AAC_DB_RESPONSE_NOT_FULL (1<<4) /* response queue not full */ 56 #define AAC_DB_PRINTF_READY (1<<5) /* adapter requests host */ 57 /* printf */ 58 #define AAC_DB_INTR_BITS (AAC_DB_COMMAND_READY | \ 59 AAC_DB_RESPONSE_READY | AAC_DB_PRINTF_READY) 60 #define AAC_DB_INTR_NEW 0x08 61 62 /* Status bits in firmware status reg */ 63 #define AAC_SELF_TEST_FAILED 0x00000004 64 #define AAC_MONITOR_PANIC 0x00000020 65 #define AAC_KERNEL_UP_AND_RUNNING 0x00000080 66 #define AAC_KERNEL_PANIC 0x00000100 67 68 /* aac registers definitions */ 69 #define AAC_OMR0 0x18 /* outbound message register 0 */ 70 #define AAC_OMR1 0x1c /* outbound message register 1 */ 71 #define AAC_IDBR 0x20 /* inbound doorbell reg */ 72 #define AAC_ODBR 0x2c /* outbound doorbell reg */ 73 #define AAC_OIMR 0x34 /* outbound interrupt mask reg */ 74 #define AAC_IRCSR 0x38 /* inbound dual cores reset (SRL) */ 75 #define AAC_IQUE 0x40 /* inbound queue */ 76 #define AAC_OQUE 0x44 /* outbound queue */ 77 #define AAC_RX_MAILBOX 0x50 /* mailbox, size=20bytes, rx */ 78 #define AAC_RX_FWSTATUS 0x6c /* firmware status, rx */ 79 #define AAC_RKT_MAILBOX 0x1000 /* mailbox, size=20bytes, rkt */ 80 #define AAC_RKT_FWSTATUS 0x101c /* firmware status, rkt */ 81 82 /* Synchronous commands to the monitor/kernel. */ 83 #define AAC_BREAKPOINT_REQ 0x04 84 #define AAC_MONKER_INITSTRUCT 0x05 85 #define AAC_MONKER_SYNCFIB 0x0c 86 #define AAC_MONKER_GETKERNVER 0x11 87 #define AAC_MONKER_GETINFO 0x19 88 #define AAC_MONKER_GETDRVPROP 0x23 89 #define AAC_MONKER_GETCOMMPREF 0x26 90 #define AAC_IOP_RESET 0x1000 91 92 /* Sunrise Lake dual core reset */ 93 #define AAC_IRCSR_CORES_RST 3 94 95 #define AAC_SECTOR_SIZE 512 96 #define AAC_NUMBER_OF_HEADS 255 97 #define AAC_SECTORS_PER_TRACK 63 98 #define AAC_ROTATION_SPEED 10000 99 #define AAC_MAX_PFN 0xfffff 100 101 #define AAC_ADDITIONAL_LEN 31 102 #define AAC_ANSI_VER 2 103 #define AAC_RESP_DATA_FORMAT 2 104 105 #define AAC_MAX_LD 64 /* max number of logical disks */ 106 #define AAC_BLK_SIZE AAC_SECTOR_SIZE 107 #define AAC_DMA_ALIGN 4 108 #define AAC_DMA_ALIGN_MASK (AAC_DMA_ALIGN - 1) 109 110 #define AAC_MAX_CONTAINERS AAC_MAX_LD 111 112 /* 113 * Minimum memory sizes we need to map to address the adapter. Before 114 * we know the actual size to map, minimum memory is used instead. 115 */ 116 #define AAC_MAP_SIZE_MIN_RX 4096 117 #define AAC_MAP_SIZE_MIN_RKT 8192 118 119 /* 120 * Options supported by the adapter 121 */ 122 #define AAC_SUPPORTED_SNAPSHOT 0x01 123 #define AAC_SUPPORTED_CLUSTERS 0x02 124 #define AAC_SUPPORTED_WRITE_CACHE 0x04 125 #define AAC_SUPPORTED_64BIT_DATA 0x08 126 #define AAC_SUPPORTED_HOST_TIME_FIB 0x10 127 #define AAC_SUPPORTED_RAID50 0x20 128 #define AAC_SUPPORTED_4GB_WINDOW 0x40 129 #define AAC_SUPPORTED_SCSI_UPGRADEABLE 0x80 130 #define AAC_SUPPORTED_SOFT_ERR_REPORT 0x100 131 #define AAC_SUPPORTED_NOT_RECONDITION 0x200 132 #define AAC_SUPPORTED_SGMAP_HOST64 0x400 133 #define AAC_SUPPORTED_ALARM 0x800 134 #define AAC_SUPPORTED_NONDASD 0x1000 135 #define AAC_SUPPORTED_SCSI_MANAGED 0x2000 136 #define AAC_SUPPORTED_RAID_SCSI_MODE 0x4000 137 #define AAC_SUPPORTED_SUPPLEMENT_ADAPTER_INFO 0x10000 138 #define AAC_SUPPORTED_NEW_COMM 0x20000 139 #define AAC_SUPPORTED_64BIT_ARRAYSIZE 0x40000 140 #define AAC_SUPPORTED_HEAT_SENSOR 0x80000 141 142 #pragma pack(1) 143 144 /* 145 * FIB (FSA Interface Block) this is the data structure passed between 146 * the host and adapter. 147 */ 148 struct aac_fib_header { 149 uint32_t XferState; 150 uint16_t Command; 151 uint8_t StructType; 152 uint8_t Flags; 153 uint16_t Size; 154 uint16_t SenderSize; 155 uint32_t SenderFibAddress; 156 uint32_t ReceiverFibAddress; 157 uint32_t SenderData; 158 int prev; 159 int next; 160 }; 161 162 /* FIB completed without error or no data was transferred in the FIB */ 163 #define AAC_SENDERADDR_MASK_FAST_RESPONSE 0x01 164 /* The received FIB is an AIF */ 165 #define AAC_SENDERADDR_MASK_AIF 0x02 166 167 #define AAC_FIB_SIZE 512 /* size of a fib block in byte */ 168 #define AAC_FIB_DATASIZE (AAC_FIB_SIZE - sizeof (struct aac_fib_header)) 169 170 struct aac_fib { 171 struct aac_fib_header Header; 172 uint8_t data[AAC_FIB_DATASIZE]; 173 }; 174 175 /* FIB transfer state */ 176 #define AAC_FIBSTATE_HOSTOWNED (1<<0) /* owned by the host */ 177 #define AAC_FIBSTATE_ADAPTEROWNED (1<<1) /* owned by the adapter */ 178 #define AAC_FIBSTATE_INITIALISED (1<<2) /* has been initialised */ 179 #define AAC_FIBSTATE_EMPTY (1<<3) /* is empty now */ 180 #define AAC_FIBSTATE_FROMHOST (1<<5) /* sent from the host */ 181 #define AAC_FIBSTATE_FROMADAP (1<<6) /* sent from the adapter */ 182 #define AAC_FIBSTATE_REXPECTED (1<<7) /* response is expected */ 183 #define AAC_FIBSTATE_NOREXPECTED (1<<8) /* no response is expected */ 184 #define AAC_FIBSTATE_DONEADAP (1<<9) /* processed by the adapter */ 185 #define AAC_FIBSTATE_DONEHOST (1<<10) /* processed by the host */ 186 #define AAC_FIBSTATE_NORM (1<<12) /* normal priority */ 187 #define AAC_FIBSTATE_ASYNC (1<<13) 188 #define AAC_FIBSTATE_FAST_RESPONSE (1<<19) /* fast response capable */ 189 190 /* FIB types */ 191 #define AAC_FIBTYPE_TFIB 1 192 193 /* 194 * FIB commands 195 */ 196 197 #define TestCommandResponse 1 198 #define TestAdapterCommand 2 199 /* Lowlevel and comm commands */ 200 #define LastTestCommand 100 201 #define ReinitHostNormCommandQueue 101 202 #define ReinitHostHighCommandQueue 102 203 #define ReinitHostHighRespQueue 103 204 #define ReinitHostNormRespQueue 104 205 #define ReinitAdapNormCommandQueue 105 206 #define ReinitAdapHighCommandQueue 107 207 #define ReinitAdapHighRespQueue 108 208 #define ReinitAdapNormRespQueue 109 209 #define InterfaceShutdown 110 210 #define DmaCommandFib 120 211 #define StartProfile 121 212 #define TermProfile 122 213 #define SpeedTest 123 214 #define TakeABreakPt 124 215 #define RequestPerfData 125 216 #define SetInterruptDefTimer 126 217 #define SetInterruptDefCount 127 218 #define GetInterruptDefStatus 128 219 #define LastCommCommand 129 220 /* Filesystem commands */ 221 #define NuFileSystem 300 222 #define UFS 301 223 #define HostFileSystem 302 224 #define LastFileSystemCommand 303 225 /* Container commands */ 226 #define ContainerCommand 500 227 #define ContainerCommand64 501 228 #define RawIo 502 229 /* Cluster commands */ 230 #define ClusterCommand 550 231 /* Scsi Port commands (scsi passthrough) */ 232 #define ScsiPortCommand 600 233 #define ScsiPortCommandU64 601 234 /* Misc house keeping and generic adapter initiated commands */ 235 #define AifRequest 700 236 #define CheckRevision 701 237 #define FsaHostShutdown 702 238 #define RequestAdapterInfo 703 239 #define IsAdapterPaused 704 240 #define SendHostTime 705 241 #define RequestSupplementAdapterInfo 706 242 #define LastMiscCommand 707 243 #define OnLineDiagnostic 800 244 #define FduAdapterTest 801 245 246 /* 247 * Revision number handling 248 */ 249 struct FsaRev { 250 union { 251 struct { 252 uint8_t dash; 253 uint8_t type; 254 uint8_t minor; 255 uint8_t major; 256 } comp; 257 uint32_t ul; 258 } external; 259 uint32_t buildNumber; 260 }; 261 262 /* 263 * Structures used to respond to a RequestAdapterInfo FIB 264 */ 265 struct aac_adapter_info { 266 uint32_t PlatformBase; /* adapter type */ 267 uint32_t CpuArchitecture; /* adapter CPU type */ 268 uint32_t CpuVariant; /* adapter CPU subtype */ 269 uint32_t ClockSpeed; /* adapter CPU clockspeed */ 270 uint32_t ExecutionMem; /* adapter Execution Memory size */ 271 uint32_t BufferMem; /* adapter Data Memory */ 272 uint32_t TotalMem; /* adapter Total Memory */ 273 struct FsaRev KernelRevision; /* adapter Kernel Software Revision */ 274 struct FsaRev MonitorRevision; /* adapter Monitor Software Revision */ 275 struct FsaRev HardwareRevision; 276 struct FsaRev BIOSRevision; /* adapter BIOS Revision */ 277 uint32_t ClusteringEnabled; 278 uint32_t ClusterChannelMask; 279 uint64_t SerialNumber; 280 uint32_t batteryPlatform; 281 uint32_t SupportedOptions; /* supported features */ 282 uint32_t OemVariant; 283 }; 284 285 /* 286 * The following definitions on Supplement Adapter Information 287 * come from Adaptec: 288 */ 289 struct vpd_info { 290 uint8_t AssemblyPn[8]; 291 uint8_t FruPn[8]; 292 uint8_t BatteryFruPn[8]; 293 uint8_t EcVersionString[8]; 294 uint8_t Tsid[12]; 295 }; 296 297 #define MFG_PCBA_SERIAL_NUMBER_WIDTH 12 298 #define MFG_WWN_WIDTH 8 299 300 struct aac_supplement_adapter_info { 301 /* The assigned Adapter Type Text, extra byte for null termination */ 302 int8_t AdapterTypeText[17+1]; 303 /* Pad for the text above */ 304 int8_t Pad[2]; 305 /* Size in bytes of the memory that is flashed */ 306 uint32_t FlashMemoryByteSize; 307 /* The assigned IMAGEID_xxx for this adapter */ 308 uint32_t FlashImageId; 309 /* 310 * The maximum number of Phys available on a SATA/SAS 311 * Controller, 0 otherwise 312 */ 313 uint32_t MaxNumberPorts; 314 /* Version of expansion area */ 315 uint32_t Version; 316 uint32_t FeatureBits; 317 uint8_t SlotNumber; 318 uint8_t ReservedPad0[3]; 319 uint8_t BuildDate[12]; 320 /* The current number of Ports on a SAS controller, 0 otherwise */ 321 uint32_t CurrentNumberPorts; 322 323 struct vpd_info VpdInfo; 324 325 /* Firmware Revision (Vmaj.min-dash.) */ 326 struct FsaRev FlashFirmwareRevision; 327 uint32_t RaidTypeMorphOptions; 328 /* Firmware's boot code Revision (Vmaj.min-dash.) */ 329 struct FsaRev FlashFirmwareBootRevision; 330 /* PCBA serial no. from th MFG sector */ 331 uint8_t MfgPcbaSerialNo[MFG_PCBA_SERIAL_NUMBER_WIDTH]; 332 /* WWN from the MFG sector */ 333 uint8_t MfgWWNName[MFG_WWN_WIDTH]; 334 /* Growth Area for future expansion ((7*4) - 12 - 8)/4 = 2 words */ 335 uint32_t ReservedGrowth[2]; 336 }; 337 338 /* Container creation data */ 339 struct aac_container_creation { 340 uint8_t ViaBuildNumber; 341 uint8_t MicroSecond; 342 uint8_t Via; /* 1 = FSU, 2 = API, etc */ 343 uint8_t Years; /* Since1900 */ 344 uint32_t Month:4; /* 1-12 */ 345 uint32_t Day:6; /* 1-32 */ 346 uint32_t Hour:6; /* 0-23 */ 347 uint32_t Minute:6; /* 0-59 */ 348 uint32_t Second:6; /* 0-59 */ 349 uint64_t ViaAdapterSerialNumber; 350 }; 351 352 struct aac_mntobj { 353 uint32_t ObjectId; 354 char FileSystemName[16]; 355 struct aac_container_creation CreateInfo; 356 uint32_t Capacity; 357 uint32_t VolType; 358 uint32_t ObjType; 359 uint32_t ContentState; 360 union { 361 uint32_t pad[8]; 362 } ObjExtension; 363 uint32_t AlterEgoId; 364 365 uint32_t CapacityHigh; /* 64-bit LBA */ 366 }; 367 368 struct aac_mntinfo { 369 uint32_t Command; 370 uint32_t MntType; 371 uint32_t MntCount; 372 }; 373 374 struct aac_mntinforesp { 375 uint32_t Status; 376 uint32_t MntType; 377 uint32_t MntRespCount; 378 struct aac_mntobj MntObj; 379 }; 380 381 #define CT_FIB_PARAMS 6 382 #define MAX_FIB_PARAMS 10 383 #define CT_PACKET_SIZE \ 384 (AAC_FIB_DATASIZE - sizeof (uint32_t) - \ 385 ((sizeof (uint32_t)) * (MAX_FIB_PARAMS + 1))) 386 387 #define CNT_SIZE 5 388 389 /* Container types */ 390 typedef enum { 391 CT_NONE = 0, 392 CT_VOLUME, 393 CT_MIRROR, 394 CT_STRIPE, 395 CT_RAID5, 396 CT_SSRW, 397 CT_SSRO, 398 CT_MORPH, 399 CT_PASSTHRU, 400 CT_RAID4, 401 CT_RAID10, /* stripe of mirror */ 402 CT_RAID00, /* stripe of stripe */ 403 CT_VOLUME_OF_MIRRORS, /* volume of mirror */ 404 CT_PSEUDO_RAID3, /* really raid4 */ 405 CT_RAID50, /* stripe of raid5 */ 406 CT_RAID5D, /* raid5 distributed hot-sparing */ 407 CT_RAID5D0, 408 CT_RAID1E, /* extended raid1 mirroring */ 409 CT_RAID6, 410 CT_RAID60 411 } AAC_FSAVolType; 412 413 /* 414 * Container Configuration Sub-Commands 415 */ 416 typedef enum { 417 CT_Null = 0, 418 CT_GET_SLICE_COUNT, /* 1 */ 419 CT_GET_PARTITION_COUNT, /* 2 */ 420 CT_GET_PARTITION_INFO, /* 3 */ 421 CT_GET_CONTAINER_COUNT, /* 4 */ 422 CT_GET_CONTAINER_INFO_OLD, /* 5 */ 423 CT_WRITE_MBR, /* 6 */ 424 CT_WRITE_PARTITION, /* 7 */ 425 CT_UPDATE_PARTITION, /* 8 */ 426 CT_UNLOAD_CONTAINER, /* 9 */ 427 CT_CONFIG_SINGLE_PRIMARY, /* 10 */ 428 CT_READ_CONFIG_AGE, /* 11 */ 429 CT_WRITE_CONFIG_AGE, /* 12 */ 430 CT_READ_SERIAL_NUMBER, /* 13 */ 431 CT_ZERO_PAR_ENTRY, /* 14 */ 432 CT_READ_MBR, /* 15 */ 433 CT_READ_PARTITION, /* 16 */ 434 CT_DESTROY_CONTAINER, /* 17 */ 435 CT_DESTROY2_CONTAINER, /* 18 */ 436 CT_SLICE_SIZE, /* 19 */ 437 CT_CHECK_CONFLICTS, /* 20 */ 438 CT_MOVE_CONTAINER, /* 21 */ 439 CT_READ_LAST_DRIVE, /* 22 */ 440 CT_WRITE_LAST_DRIVE, /* 23 */ 441 CT_UNMIRROR, /* 24 */ 442 CT_MIRROR_DELAY, /* 25 */ 443 CT_GEN_MIRROR, /* 26 */ 444 CT_GEN_MIRROR2, /* 27 */ 445 CT_TEST_CONTAINER, /* 28 */ 446 CT_MOVE2, /* 29 */ 447 CT_SPLIT, /* 30 */ 448 CT_SPLIT2, /* 31 */ 449 CT_SPLIT_BROKEN, /* 32 */ 450 CT_SPLIT_BROKEN2, /* 33 */ 451 CT_RECONFIG, /* 34 */ 452 CT_BREAK2, /* 35 */ 453 CT_BREAK, /* 36 */ 454 CT_MERGE2, /* 37 */ 455 CT_MERGE, /* 38 */ 456 CT_FORCE_ERROR, /* 39 */ 457 CT_CLEAR_ERROR, /* 40 */ 458 CT_ASSIGN_FAILOVER, /* 41 */ 459 CT_CLEAR_FAILOVER, /* 42 */ 460 CT_GET_FAILOVER_DATA, /* 43 */ 461 CT_VOLUME_ADD, /* 44 */ 462 CT_VOLUME_ADD2, /* 45 */ 463 CT_MIRROR_STATUS, /* 46 */ 464 CT_COPY_STATUS, /* 47 */ 465 CT_COPY, /* 48 */ 466 CT_UNLOCK_CONTAINER, /* 49 */ 467 CT_LOCK_CONTAINER, /* 50 */ 468 CT_MAKE_READ_ONLY, /* 51 */ 469 CT_MAKE_READ_WRITE, /* 52 */ 470 CT_CLEAN_DEAD, /* 53 */ 471 CT_ABORT_MIRROR_COMMAND, /* 54 */ 472 CT_SET, /* 55 */ 473 CT_GET, /* 56 */ 474 CT_GET_NVLOG_ENTRY, /* 57 */ 475 CT_GET_DELAY, /* 58 */ 476 CT_ZERO_CONTAINER_SPACE, /* 59 */ 477 CT_GET_ZERO_STATUS, /* 60 */ 478 CT_SCRUB, /* 61 */ 479 CT_GET_SCRUB_STATUS, /* 62 */ 480 CT_GET_SLICE_INFO, /* 63 */ 481 CT_GET_SCSI_METHOD, /* 64 */ 482 CT_PAUSE_IO, /* 65 */ 483 CT_RELEASE_IO, /* 66 */ 484 CT_SCRUB2, /* 67 */ 485 CT_MCHECK, /* 68 */ 486 CT_CORRUPT, /* 69 */ 487 CT_GET_TASK_COUNT, /* 70 */ 488 CT_PROMOTE, /* 71 */ 489 CT_SET_DEAD, /* 72 */ 490 CT_CONTAINER_OPTIONS, /* 73 */ 491 CT_GET_NV_PARAM, /* 74 */ 492 CT_GET_PARAM, /* 75 */ 493 CT_NV_PARAM_SIZE, /* 76 */ 494 CT_COMMON_PARAM_SIZE, /* 77 */ 495 CT_PLATFORM_PARAM_SIZE, /* 78 */ 496 CT_SET_NV_PARAM, /* 79 */ 497 CT_ABORT_SCRUB, /* 80 */ 498 CT_GET_SCRUB_ERROR, /* 81 */ 499 CT_LABEL_CONTAINER, /* 82 */ 500 CT_CONTINUE_DATA, /* 83 */ 501 CT_STOP_DATA, /* 84 */ 502 CT_GET_PARTITION_TABLE, /* 85 */ 503 CT_GET_DISK_PARTITIONS, /* 86 */ 504 CT_GET_MISC_STATUS, /* 87 */ 505 CT_GET_CONTAINER_PERF_INFO, /* 88 */ 506 CT_GET_TIME, /* 89 */ 507 CT_READ_DATA, /* 90 */ 508 CT_CTR, /* 91 */ 509 CT_CTL, /* 92 */ 510 CT_DRAINIO, /* 93 */ 511 CT_RELEASEIO, /* 94 */ 512 CT_GET_NVRAM, /* 95 */ 513 CT_GET_MEMORY, /* 96 */ 514 CT_PRINT_CT_LOG, /* 97 */ 515 CT_ADD_LEVEL, /* 98 */ 516 CT_NV_ZERO, /* 99 */ 517 CT_READ_SIGNATURE, /* 100 */ 518 CT_THROTTLE_ON, /* 101 */ 519 CT_THROTTLE_OFF, /* 102 */ 520 CT_GET_THROTTLE_STATS, /* 103 */ 521 CT_MAKE_SNAPSHOT, /* 104 */ 522 CT_REMOVE_SNAPSHOT, /* 105 */ 523 CT_WRITE_USER_FLAGS, /* 106 */ 524 CT_READ_USER_FLAGS, /* 107 */ 525 CT_MONITOR, /* 108 */ 526 CT_GEN_MORPH, /* 109 */ 527 CT_GET_SNAPSHOT_INFO, /* 110 */ 528 CT_CACHE_SET, /* 111 */ 529 CT_CACHE_STAT, /* 112 */ 530 CT_TRACE_START, /* 113 */ 531 CT_TRACE_STOP, /* 114 */ 532 CT_TRACE_ENABLE, /* 115 */ 533 CT_TRACE_DISABLE, /* 116 */ 534 CT_FORCE_CORE_DUMP, /* 117 */ 535 CT_SET_SERIAL_NUMBER, /* 118 */ 536 CT_RESET_SERIAL_NUMBER, /* 119 */ 537 CT_ENABLE_RAID5, /* 120 */ 538 CT_CLEAR_VALID_DUMP_FLAG, /* 121 */ 539 CT_GET_MEM_STATS, /* 122 */ 540 CT_GET_CORE_SIZE, /* 123 */ 541 CT_CREATE_CONTAINER_OLD, /* 124 */ 542 CT_STOP_DUMPS, /* 125 */ 543 CT_PANIC_ON_TAKE_A_BREAK, /* 126 */ 544 CT_GET_CACHE_STATS, /* 127 */ 545 CT_MOVE_PARTITION, /* 128 */ 546 CT_FLUSH_CACHE, /* 129 */ 547 CT_READ_NAME, /* 130 */ 548 CT_WRITE_NAME, /* 131 */ 549 CT_TOSS_CACHE, /* 132 */ 550 CT_LOCK_DRAINIO, /* 133 */ 551 CT_CONTAINER_OFFLINE, /* 134 */ 552 CT_SET_CACHE_SIZE, /* 135 */ 553 CT_CLEAN_SHUTDOWN_STATUS, /* 136 */ 554 CT_CLEAR_DISKLOG_ON_DISK, /* 137 */ 555 CT_CLEAR_ALL_DISKLOG, /* 138 */ 556 CT_CACHE_FAVOR, /* 139 */ 557 CT_READ_PASSTHRU_MBR, /* 140 */ 558 CT_SCRUB_NOFIX, /* 141 */ 559 CT_SCRUB2_NOFIX, /* 142 */ 560 CT_FLUSH, /* 143 */ 561 CT_REBUILD, /* 144 rma, not really a command, partner to CT_SCRUB */ 562 CT_FLUSH_CONTAINER, /* 145 */ 563 CT_RESTART, /* 146 */ 564 CT_GET_CONFIG_STATUS, /* 147 */ 565 CT_TRACE_FLAG, /* 148 */ 566 CT_RESTART_MORPH, /* 149 */ 567 CT_GET_TRACE_INFO, /* 150 */ 568 CT_GET_TRACE_ITEM, /* 151 */ 569 CT_COMMIT_CONFIG, /* 152 */ 570 CT_CONTAINER_EXISTS, /* 153 */ 571 CT_GET_SLICE_FROM_DEVT, /* 154 */ 572 CT_OPEN_READ_WRITE, /* 155 */ 573 CT_WRITE_MEMORY_BLOCK, /* 156 */ 574 CT_GET_CACHE_PARAMS, /* 157 */ 575 CT_CRAZY_CACHE, /* 158 */ 576 CT_GET_PROFILE_STRUCT, /* 159 */ 577 CT_SET_IO_TRACE_FLAG, /* 160 */ 578 CT_GET_IO_TRACE_STRUCT, /* 161 */ 579 CT_CID_TO_64BITS_UID, /* 162 */ 580 CT_64BITS_UID_TO_CID, /* 163 */ 581 CT_PAR_TO_64BITS_UID, /* 164 */ 582 CT_CID_TO_32BITS_UID, /* 165 */ 583 CT_32BITS_UID_TO_CID, /* 166 */ 584 CT_PAR_TO_32BITS_UID, /* 167 */ 585 CT_SET_FAILOVER_OPTION, /* 168 */ 586 CT_GET_FAILOVER_OPTION, /* 169 */ 587 CT_STRIPE_ADD2, /* 170 */ 588 CT_CREATE_VOLUME_SET, /* 171 */ 589 CT_CREATE_STRIPE_SET, /* 172 */ 590 /* 173 command and partner to scrub and rebuild task types */ 591 CT_VERIFY_CONTAINER, 592 CT_IS_CONTAINER_DEAD, /* 174 */ 593 CT_GET_CONTAINER_OPTION, /* 175 */ 594 CT_GET_SNAPSHOT_UNUSED_STRUCT, /* 176 */ 595 CT_CLEAR_SNAPSHOT_UNUSED_STRUCT, /* 177 */ 596 CT_GET_CONTAINER_INFO, /* 178 */ 597 CT_CREATE_CONTAINER, /* 179 */ 598 CT_CHANGE_CREATIONINFO, /* 180 */ 599 CT_CHECK_CONFLICT_UID, /* 181 */ 600 CT_CONTAINER_UID_CHECK, /* 182 */ 601 602 /* 183 :RECmm: 20011220 added to support the Babylon */ 603 CT_IS_CONTAINER_MEATADATA_STANDARD, 604 /* 184 :RECmm: 20011220 array imports */ 605 CT_IS_SLICE_METADATA_STANDARD, 606 607 /* :BIOS_TEST: */ 608 /* 185 :RECmm: 20020116 added to support BIOS interface for */ 609 CT_GET_IMPORT_COUNT, 610 /* 186 :RECmm: 20020116 metadata conversion */ 611 CT_CANCEL_ALL_IMPORTS, 612 CT_GET_IMPORT_INFO, /* 187 :RECmm: 20020116 " */ 613 CT_IMPORT_ARRAY, /* 188 :RECmm: 20020116 " */ 614 CT_GET_LOG_SIZE, /* 189 */ 615 616 /* Not BIOS TEST */ 617 CT_ALARM_GET_STATE, /* 190 */ 618 CT_ALARM_SET_STATE, /* 191 */ 619 CT_ALARM_ON_OFF, /* 192 */ 620 621 CT_GET_EE_OEM_ID, /* 193 */ 622 623 CT_GET_PPI_HEADERS, /* 194 get header fields only */ 624 CT_GET_PPI_DATA, /* 195 get all ppitable.data */ 625 /* 196 get only range of entries specified in c_params */ 626 CT_GET_PPI_ENTRIES, 627 /* 197 remove ppitable bundle specified by uid in c_param0 */ 628 CT_DELETE_PPI_BUNDLE, 629 630 /* 198 current partition structure (not legacy) */ 631 CT_GET_PARTITION_TABLE_2, 632 CT_GET_PARTITION_INFO_2, 633 CT_GET_DISK_PARTITIONS_2, 634 635 CT_QUIESCE_ADAPTER, /* 201 chill dude */ 636 CT_CLEAR_PPI_TABLE, /* 202 clear ppi table */ 637 638 CT_SET_DEVICE_CACHE_POLICY, /* 203 */ 639 CT_GET_DEVICE_CACHE_POLICY, /* 204 */ 640 641 CT_SET_VERIFY_DELAY, /* 205 */ 642 CT_GET_VERIFY_DELAY, /* 206 */ 643 644 /* 207 delete all PPI bundles that have an entry for device at devt */ 645 CT_DELETE_PPI_BUNDLES_FOR_DEVT, 646 647 CT_READ_SW_SECTOR, /* 208 */ 648 CT_WRITE_SW_SECTOR, /* 209 */ 649 650 /* 210 added to support firmware cache sync operations */ 651 CT_GET_CACHE_SYNC_INFO, 652 CT_SET_CACHE_SYNC_MODE, /* 211 */ 653 654 CT_LAST_COMMAND /* last command */ 655 } AAC_CTCommand; 656 657 /* General return status */ 658 #define CT_OK 218 659 660 struct aac_fsa_ctm { 661 uint32_t command; 662 uint32_t param[CT_FIB_PARAMS]; 663 int8_t data[CT_PACKET_SIZE]; 664 }; 665 666 struct aac_Container { 667 uint32_t Command; 668 struct aac_fsa_ctm CTCommand; 669 }; 670 671 struct aac_fsa_ctr { 672 uint32_t response; 673 uint32_t param[CT_FIB_PARAMS]; 674 int8_t data[CT_PACKET_SIZE]; 675 }; 676 677 struct aac_Container_resp { 678 uint32_t Status; 679 struct aac_fsa_ctr CTResponse; 680 }; 681 682 struct aac_cf_status_header { 683 uint32_t action; 684 uint16_t flags; 685 int16_t recordcount; 686 }; 687 688 enum aac_cf_action_type { 689 CFACT_CONTINUE = 0, /* Continue without pause */ 690 CFACT_PAUSE, /* Pause, then continue */ 691 CFACT_ABORT /* Abort */ 692 }; 693 694 enum aac_mpe { 695 AACMPE_OK = 0x0, 696 AACMPE_GET_CONFIG_STATUS = 0x1, 697 AACMPE_CONFIG_STATUS = 0x2, 698 AACMPE_COMMIT_CONFIG = 0x3 699 }; 700 701 /* 702 * CT_PAUSE_IO is immediate minimal runtime command that is used 703 * to restart the applications and cache. 704 */ 705 struct aac_pause_command { 706 uint32_t Command; 707 uint32_t Type; 708 uint32_t Timeout; 709 uint32_t Min; 710 uint32_t NoRescan; 711 uint32_t Parm3; 712 uint32_t Parm4; 713 uint32_t Count; 714 }; 715 716 /* 717 * The following two definitions come from Adaptec: 718 * 719 * Used to flush drive cache for container "cid" 720 */ 721 struct aac_synchronize_command { 722 uint32_t Command; /* VM_ContainerConfig */ 723 uint32_t Type; /* CT_FLUSH_CACHE */ 724 uint32_t Cid; 725 uint32_t Parm1; 726 uint32_t Parm2; 727 uint32_t Parm3; 728 uint32_t Parm4; 729 uint32_t Count; 730 }; 731 732 struct aac_synchronize_reply { 733 uint32_t Dummy0; 734 uint32_t Dummy1; 735 uint32_t Status; 736 uint32_t Parm1; 737 uint32_t Parm2; 738 uint32_t Parm3; 739 uint32_t Parm4; 740 uint32_t Parm5; 741 uint8_t Data[16]; 742 }; 743 744 /* 745 * Command status values 746 */ 747 typedef enum { 748 ST_OK = 0, 749 ST_PERM = 1, 750 ST_NOENT = 2, 751 ST_IO = 5, 752 ST_NXIO = 6, 753 ST_E2BIG = 7, 754 ST_ACCES = 13, 755 ST_EXIST = 17, 756 ST_XDEV = 18, 757 ST_NODEV = 19, 758 ST_NOTDIR = 20, 759 ST_ISDIR = 21, 760 ST_INVAL = 22, 761 ST_FBIG = 27, 762 ST_NOSPC = 28, 763 ST_ROFS = 30, 764 ST_MLINK = 31, 765 ST_WOULDBLOCK = 35, 766 ST_NAMETOOLONG = 63, 767 ST_NOTEMPTY = 66, 768 ST_DQUOT = 69, 769 ST_STALE = 70, 770 ST_REMOTE = 71, 771 ST_BADHANDLE = 10001, 772 ST_NOT_SYNC = 10002, 773 ST_BAD_COOKIE = 10003, 774 ST_NOTSUPP = 10004, 775 ST_TOOSMALL = 10005, 776 ST_SERVERFAULT = 10006, 777 ST_BADTYPE = 10007, 778 ST_JUKEBOX = 10008, 779 ST_NOTMOUNTED = 10009, 780 ST_MAINTMODE = 10010, 781 ST_STALEACL = 10011 782 } AAC_FSAStatus; 783 784 /* 785 * Object-Server / Volume-Manager Dispatch Classes 786 */ 787 typedef enum { 788 VM_Null = 0, 789 VM_NameServe, 790 VM_ContainerConfig, 791 VM_Ioctl, 792 VM_FilesystemIoctl, 793 VM_CloseAll, 794 VM_CtBlockRead, 795 VM_CtBlockWrite, 796 VM_SliceBlockRead, /* raw access to configured "storage objects" */ 797 VM_SliceBlockWrite, 798 VM_DriveBlockRead, /* raw access to physical devices */ 799 VM_DriveBlockWrite, 800 VM_EnclosureMgt, /* enclosure management */ 801 VM_Unused, /* used to be diskset management */ 802 VM_CtBlockVerify, 803 VM_CtPerf, /* performance test */ 804 VM_CtBlockRead64, 805 VM_CtBlockWrite64, 806 VM_CtBlockVerify64, 807 VM_CtHostRead64, 808 VM_CtHostWrite64, 809 VM_NameServe64 = 22, 810 MAX_VMCOMMAND_NUM /* used for sizing stats array - leave last */ 811 } AAC_VMCommand; 812 813 /* 814 * Host-addressable object types 815 */ 816 typedef enum { 817 FT_REG = 1, /* regular file */ 818 FT_DIR, /* directory */ 819 FT_BLK, /* "block" device - reserved */ 820 FT_CHR, /* "character special" device - reserved */ 821 FT_LNK, /* symbolic link */ 822 FT_SOCK, /* socket */ 823 FT_FIFO, /* fifo */ 824 FT_FILESYS, /* ADAPTEC's "FSA"(tm) filesystem */ 825 FT_DRIVE, /* physical disk - addressable in scsi by b/t/l */ 826 FT_SLICE, /* virtual disk - raw volume - slice */ 827 FT_PARTITION, /* FSA partition - carved out of a slice - building */ 828 /* block for containers */ 829 FT_VOLUME, /* Container - Volume Set */ 830 FT_STRIPE, /* Container - Stripe Set */ 831 FT_MIRROR, /* Container - Mirror Set */ 832 FT_RAID5, /* Container - Raid 5 Set */ 833 FT_DATABASE /* Storage object with "foreign" content manager */ 834 } AAC_FType; 835 836 /* Host-side scatter/gather list for 32-bit, 64-bit, raw commands */ 837 struct aac_sg_entry { 838 uint32_t SgAddress; 839 uint32_t SgByteCount; 840 }; 841 842 struct aac_sg_entry64 { 843 uint64_t SgAddress; 844 uint32_t SgByteCount; 845 }; 846 847 struct aac_sg_entryraw { 848 uint32_t Next; /* reserved */ 849 uint32_t Prev; /* reserved */ 850 uint64_t SgAddress; 851 uint32_t SgByteCount; 852 uint32_t Flags; /* reserved */ 853 }; 854 855 struct aac_sg_table { 856 uint32_t SgCount; 857 struct aac_sg_entry SgEntry[1]; /* at least there is one */ 858 /* SUN's CC cannot accept [0] */ 859 }; 860 861 struct aac_sg_table64 { 862 uint32_t SgCount; 863 struct aac_sg_entry64 SgEntry64[1]; 864 }; 865 866 struct aac_sg_tableraw { 867 uint32_t SgCount; 868 struct aac_sg_entryraw SgEntryRaw[1]; 869 }; 870 871 /* 872 * Block read/write operations. 873 * These structures are packed into the 'data' area in the FIB. 874 */ 875 struct aac_blockread { 876 uint32_t Command; 877 uint32_t ContainerId; 878 uint32_t BlockNumber; 879 uint32_t ByteCount; 880 struct aac_sg_table SgMap; 881 }; 882 883 struct aac_blockread64 { 884 uint32_t Command; 885 uint16_t ContainerId; 886 uint16_t SectorCount; 887 uint32_t BlockNumber; 888 uint16_t Pad; 889 uint16_t Flags; 890 struct aac_sg_table64 SgMap64; 891 }; 892 893 struct aac_blockread_response { 894 uint32_t Status; 895 uint32_t ByteCount; 896 }; 897 898 struct aac_blockwrite { 899 uint32_t Command; 900 uint32_t ContainerId; 901 uint32_t BlockNumber; 902 uint32_t ByteCount; 903 uint32_t Stable; 904 struct aac_sg_table SgMap; 905 }; 906 907 struct aac_blockwrite64 { 908 uint32_t Command; 909 uint16_t ContainerId; 910 uint16_t SectorCount; 911 uint32_t BlockNumber; 912 uint16_t Pad; 913 uint16_t Flags; 914 struct aac_sg_table64 SgMap64; 915 }; 916 917 struct aac_blockwrite_response { 918 uint32_t Status; 919 uint32_t ByteCount; 920 uint32_t Committed; 921 }; 922 923 struct aac_raw_io { 924 uint64_t BlockNumber; 925 uint32_t ByteCount; 926 uint16_t ContainerId; 927 uint16_t Flags; /* 0: W, 1: R */ 928 uint16_t BpTotal; /* reserved */ 929 uint16_t BpComplete; /* reserved */ 930 struct aac_sg_tableraw SgMapRaw; 931 }; 932 933 /* 934 * Container shutdown command. 935 */ 936 struct aac_close_command { 937 uint32_t Command; 938 uint32_t ContainerId; 939 }; 940 941 /* Write 'stability' options */ 942 #define CSTABLE 1 943 #define CUNSTABLE 2 944 945 /* Number of FIBs for the controller to send us messages */ 946 #define AAC_ADAPTER_FIBS 8 947 948 /* Number of FIBs for the host I/O request */ 949 #define AAC_HOST_FIBS 256 950 951 /* Size of buffer for text messages from the controller */ 952 #define AAC_ADAPTER_PRINT_BUFSIZE 256 953 954 #define AAC_INIT_STRUCT_REVISION 3 955 #define AAC_INIT_STRUCT_REVISION_4 4 956 #define AAC_INIT_STRUCT_MINIPORT_REVISION 1 957 #define AAC_INIT_FLAGS_NEW_COMM_SUPPORTED 1 958 #define AAC_PAGE_SIZE 4096 959 struct aac_adapter_init { 960 uint32_t InitStructRevision; 961 uint32_t MiniPortRevision; 962 uint32_t FilesystemRevision; 963 uint32_t CommHeaderAddress; 964 uint32_t FastIoCommAreaAddress; 965 uint32_t AdapterFibsPhysicalAddress; 966 uint32_t AdapterFibsVirtualAddress; 967 uint32_t AdapterFibsSize; 968 uint32_t AdapterFibAlign; 969 uint32_t PrintfBufferAddress; 970 uint32_t PrintfBufferSize; 971 uint32_t HostPhysMemPages; 972 uint32_t HostElapsedSeconds; 973 /* ADAPTER_INIT_STRUCT_REVISION_4 begins here */ 974 uint32_t InitFlags; 975 uint32_t MaxIoCommands; 976 uint32_t MaxIoSize; 977 uint32_t MaxFibSize; 978 }; 979 980 /* ************AAC QUEUE DEFINES (BELOW)*********** */ 981 982 #define AAC_QUEUE_ALIGN 16 983 #define AAC_QUEUE_COUNT 8 984 #define AAC_PRODUCER_INDEX 0 985 #define AAC_CONSUMER_INDEX 1 986 987 struct aac_queue_entry { 988 uint32_t aq_fib_size; /* FIB size in bytes */ 989 uint32_t aq_fib_addr; /* receiver-space address of the FIB */ 990 }; 991 992 /* 993 * Queue names 994 * 995 * Note that we base these at 0 in order to use them as array indices. 996 * Adaptec used base 1 for some unknown reason, and sorted them in a 997 * different order. 998 */ 999 #define AAC_HOST_NORM_CMD_Q 0 1000 #define AAC_HOST_HIGH_CMD_Q 1 1001 #define AAC_ADAP_NORM_CMD_Q 2 1002 #define AAC_ADAP_HIGH_CMD_Q 3 1003 #define AAC_HOST_NORM_RESP_Q 4 1004 #define AAC_HOST_HIGH_RESP_Q 5 1005 #define AAC_ADAP_NORM_RESP_Q 6 1006 #define AAC_ADAP_HIGH_RESP_Q 7 1007 1008 /* 1009 * We establish 4 command queues and matching response queues. Queues must 1010 * be 16-byte aligned, and are sized as follows: 1011 */ 1012 /* command adapter->host, normal priority */ 1013 #define AAC_HOST_NORM_CMD_ENTRIES 8 1014 /* command adapter->host, high priority */ 1015 #define AAC_HOST_HIGH_CMD_ENTRIES 4 1016 /* command host->adapter, normal priority */ 1017 #define AAC_ADAP_NORM_CMD_ENTRIES 512 1018 /* command host->adapter, high priority */ 1019 #define AAC_ADAP_HIGH_CMD_ENTRIES 4 1020 /* response, adapter->host, normal priority */ 1021 #define AAC_HOST_NORM_RESP_ENTRIES 512 1022 /* response, adapter->host, high priority */ 1023 #define AAC_HOST_HIGH_RESP_ENTRIES 4 1024 /* response, host->adapter, normal priority */ 1025 #define AAC_ADAP_NORM_RESP_ENTRIES 8 1026 /* response, host->adapter, high priority */ 1027 #define AAC_ADAP_HIGH_RESP_ENTRIES 4 1028 1029 #define AAC_TOTALQ_LENGTH (AAC_HOST_HIGH_CMD_ENTRIES + \ 1030 AAC_HOST_NORM_CMD_ENTRIES + \ 1031 AAC_ADAP_HIGH_CMD_ENTRIES + \ 1032 AAC_ADAP_NORM_CMD_ENTRIES + \ 1033 AAC_HOST_HIGH_RESP_ENTRIES + \ 1034 AAC_HOST_NORM_RESP_ENTRIES + \ 1035 AAC_ADAP_HIGH_RESP_ENTRIES + \ 1036 AAC_ADAP_NORM_RESP_ENTRIES) 1037 1038 /* 1039 * Table of queue indices and queues used to communicate with the 1040 * controller. This structure must be aligned to AAC_QUEUE_ALIGN. 1041 */ 1042 struct aac_queue_table { 1043 /* queue consumer/producer indexes (layout mandated by adapter) */ 1044 uint32_t qt_qindex[AAC_QUEUE_COUNT][2]; 1045 1046 /* queue entry structures (layout mandated by adapter) */ 1047 struct aac_queue_entry qt_HostNormCmdQueue \ 1048 [AAC_HOST_NORM_CMD_ENTRIES]; 1049 struct aac_queue_entry qt_HostHighCmdQueue \ 1050 [AAC_HOST_HIGH_CMD_ENTRIES]; 1051 struct aac_queue_entry qt_AdapNormCmdQueue \ 1052 [AAC_ADAP_NORM_CMD_ENTRIES]; 1053 struct aac_queue_entry qt_AdapHighCmdQueue \ 1054 [AAC_ADAP_HIGH_CMD_ENTRIES]; 1055 struct aac_queue_entry qt_HostNormRespQueue \ 1056 [AAC_HOST_NORM_RESP_ENTRIES]; 1057 struct aac_queue_entry qt_HostHighRespQueue \ 1058 [AAC_HOST_HIGH_RESP_ENTRIES]; 1059 struct aac_queue_entry qt_AdapNormRespQueue \ 1060 [AAC_ADAP_NORM_RESP_ENTRIES]; 1061 struct aac_queue_entry qt_AdapHighRespQueue \ 1062 [AAC_ADAP_HIGH_RESP_ENTRIES]; 1063 }; 1064 /* ************AAC QUEUE DEFINES (ABOVE)*********** */ 1065 1066 /* 1067 * NVRAM/Write Cache subsystem battery component states 1068 */ 1069 typedef enum { 1070 NVBATTSTATUS_NONE = 0, /* battery has no power or is not present */ 1071 NVBATTSTATUS_LOW, /* battery is low on power */ 1072 NVBATTSTATUS_OK, /* battery is okay - normal operation */ 1073 /* possible only in this state */ 1074 NVBATTSTATUS_RECONDITIONING /* no battery present */ 1075 /* - reconditioning in process */ 1076 } AAC_NVBATTSTATUS; 1077 1078 /* 1079 * Battery transition type 1080 */ 1081 typedef enum { 1082 NVBATT_TRANSITION_NONE = 0, /* battery now has no power or is not */ 1083 /* present */ 1084 NVBATT_TRANSITION_LOW, /* battery is now low on power */ 1085 NVBATT_TRANSITION_OK /* battery is now okay - normal */ 1086 /* operation possible only in this state */ 1087 } AAC_NVBATT_TRANSITION; 1088 1089 /* 1090 * Data types relating to AIFs 1091 */ 1092 1093 /* 1094 * Progress Reports 1095 */ 1096 typedef enum { 1097 AifJobStsSuccess = 1, 1098 AifJobStsFinished, 1099 AifJobStsAborted, 1100 AifJobStsFailed, 1101 AifJobStsLastReportMarker = 100, /* All prior mean last report */ 1102 AifJobStsSuspended, 1103 AifJobStsRunning 1104 } AAC_AifJobStatus; 1105 1106 typedef enum { 1107 AifJobScsiMin = 1, /* Minimum value for Scsi operation */ 1108 AifJobScsiZero, /* SCSI device clear operation */ 1109 AifJobScsiVerify, /* SCSI device Verify operation NO REPAIR */ 1110 AifJobScsiExercise, /* SCSI device Exercise operation */ 1111 AifJobScsiVerifyRepair, /* SCSI device Verify operation WITH repair */ 1112 AifJobScsiWritePattern, /* write pattern */ 1113 AifJobScsiMax = 99, /* Max Scsi value */ 1114 AifJobCtrMin, /* Min Ctr op value */ 1115 AifJobCtrZero, /* Container clear operation */ 1116 AifJobCtrCopy, /* Container copy operation */ 1117 AifJobCtrCreateMirror, /* Container Create Mirror operation */ 1118 AifJobCtrMergeMirror, /* Container Merge Mirror operation */ 1119 AifJobCtrScrubMirror, /* Container Scrub Mirror operation */ 1120 AifJobCtrRebuildRaid5, /* Container Rebuild Raid5 operation */ 1121 AifJobCtrScrubRaid5, /* Container Scrub Raid5 operation */ 1122 AifJobCtrMorph, /* Container morph operation */ 1123 AifJobCtrPartCopy, /* Container Partition copy operation */ 1124 AifJobCtrRebuildMirror, /* Container Rebuild Mirror operation */ 1125 AifJobCtrCrazyCache, /* crazy cache */ 1126 AifJobCtrCopyback, /* Container Copyback operation */ 1127 AifJobCtrCompactRaid5D, /* Container Compaction operation */ 1128 AifJobCtrExpandRaid5D, /* Container Expansion operation */ 1129 AifJobCtrRebuildRaid6, /* Container Rebuild Raid6 operation */ 1130 AifJobCtrScrubRaid6, /* Container Scrub Raid6 operation */ 1131 AifJobCtrSSBackup, /* Container snapshot backup task */ 1132 AifJobCtrMax = 199, /* Max Ctr type operation */ 1133 AifJobFsMin, /* Min Fs type operation */ 1134 AifJobFsCreate, /* File System Create operation */ 1135 AifJobFsVerify, /* File System Verify operation */ 1136 AifJobFsExtend, /* File System Extend operation */ 1137 AifJobFsMax = 299, /* Max Fs type operation */ 1138 AifJobApiFormatNTFS, /* Format a drive to NTFS */ 1139 AifJobApiFormatFAT, /* Format a drive to FAT */ 1140 AifJobApiUpdateSnapshot, /* update the read/write half of a snapshot */ 1141 AifJobApiFormatFAT32, /* Format a drive to FAT32 */ 1142 AifJobApiMax = 399, /* Max API type operation */ 1143 AifJobCtlContinuousCtrVerify, /* Adapter operation */ 1144 AifJobCtlMax = 499 /* Max Adapter type operation */ 1145 } AAC_AifJobType; 1146 1147 struct aac_AifContainers { 1148 uint32_t src; /* from/master */ 1149 uint32_t dst; /* to/slave */ 1150 }; 1151 1152 union aac_AifJobClient { 1153 struct aac_AifContainers container; /* For Container and */ 1154 /* filesystem progress ops */ 1155 int32_t scsi_dh; /* For SCSI progress ops */ 1156 }; 1157 1158 struct aac_AifJobDesc { 1159 uint32_t jobID; /* DO NOT FILL IN! Will be filled in by AIF */ 1160 AAC_AifJobType type; /* Operation that is being performed */ 1161 union aac_AifJobClient client; /* Details */ 1162 }; 1163 1164 struct aac_AifJobProgressReport { 1165 struct aac_AifJobDesc jd; 1166 AAC_AifJobStatus status; 1167 uint32_t finalTick; 1168 uint32_t currentTick; 1169 uint32_t jobSpecificData1; 1170 uint32_t jobSpecificData2; 1171 }; 1172 1173 /* 1174 * Event Notification 1175 */ 1176 typedef enum { 1177 /* General application notifies start here */ 1178 AifEnGeneric = 1, /* Generic notification */ 1179 AifEnTaskComplete, /* Task has completed */ 1180 AifEnConfigChange, /* Adapter config change occurred */ 1181 AifEnContainerChange, /* Adapter specific container cfg. change */ 1182 AifEnDeviceFailure, /* SCSI device failed */ 1183 AifEnMirrorFailover, /* Mirror failover started */ 1184 AifEnContainerEvent, /* Significant container event */ 1185 AifEnFileSystemChange, /* File system changed */ 1186 AifEnConfigPause, /* Container pause event */ 1187 AifEnConfigResume, /* Container resume event */ 1188 AifEnFailoverChange, /* Failover space assignment changed */ 1189 AifEnRAID5RebuildDone, /* RAID5 rebuild finished */ 1190 AifEnEnclosureManagement, /* Enclosure management event */ 1191 AifEnBatteryEvent, /* Significant NV battery event */ 1192 AifEnAddContainer, /* A new container was created. */ 1193 AifEnDeleteContainer, /* A container was deleted. */ 1194 AifEnSMARTEvent, /* SMART Event */ 1195 AifEnBatteryNeedsRecond, /* The battery needs reconditioning */ 1196 AifEnClusterEvent, /* Some cluster event */ 1197 AifEnDiskSetEvent, /* A disk set event occured. */ 1198 AifDriverNotifyStart = 199, /* Notifies for host driver go here */ 1199 /* Host driver notifications start here */ 1200 AifDenMorphComplete, /* A morph operation completed */ 1201 AifDenVolumeExtendComplete /* Volume expand operation completed */ 1202 } AAC_AifEventNotifyType; 1203 1204 struct aac_AifEnsGeneric { 1205 char text[132]; /* Generic text */ 1206 }; 1207 1208 struct aac_AifEnsDeviceFailure { 1209 uint32_t deviceHandle; /* SCSI device handle */ 1210 }; 1211 1212 struct aac_AifEnsMirrorFailover { 1213 uint32_t container; /* Container with failed element */ 1214 uint32_t failedSlice; /* Old slice which failed */ 1215 uint32_t creatingSlice; /* New slice used for auto-create */ 1216 }; 1217 1218 struct aac_AifEnsContainerChange { 1219 uint32_t container[2]; /* container that changed, -1 if */ 1220 /* no container */ 1221 }; 1222 1223 struct aac_AifEnsContainerEvent { 1224 uint32_t container; /* container number */ 1225 uint32_t eventType; /* event type */ 1226 }; 1227 1228 struct aac_AifEnsEnclosureEvent { 1229 uint32_t empID; /* enclosure management proc number */ 1230 uint32_t unitID; /* unitId, fan id, power supply id, */ 1231 /* slot id, tempsensor id. */ 1232 uint32_t eventType; /* event type */ 1233 }; 1234 1235 struct aac_AifEnsBatteryEvent { 1236 AAC_NVBATT_TRANSITION transition_type; /* eg from low to ok */ 1237 AAC_NVBATTSTATUS current_state; /* current batt state */ 1238 AAC_NVBATTSTATUS prior_state; /* prev batt state */ 1239 }; 1240 1241 struct aac_AifEnsDiskSetEvent { 1242 uint32_t eventType; 1243 uint64_t DsNum; 1244 uint64_t CreatorId; 1245 }; 1246 1247 typedef enum { 1248 CLUSTER_NULL_EVENT = 0, 1249 CLUSTER_PARTNER_NAME_EVENT, /* change in partner hostname or */ 1250 /* adaptername from NULL to non-NULL */ 1251 /* (partner's agent may be up) */ 1252 CLUSTER_PARTNER_NULL_NAME_EVENT /* change in partner hostname or */ 1253 /* adaptername from non-null to NULL */ 1254 /* (partner has rebooted) */ 1255 } AAC_ClusterAifEvent; 1256 1257 struct aac_AifEnsClusterEvent { 1258 AAC_ClusterAifEvent eventType; 1259 }; 1260 1261 struct aac_AifEventNotify { 1262 AAC_AifEventNotifyType type; 1263 union { 1264 struct aac_AifEnsGeneric EG; 1265 struct aac_AifEnsDeviceFailure EDF; 1266 struct aac_AifEnsMirrorFailover EMF; 1267 struct aac_AifEnsContainerChange ECC; 1268 struct aac_AifEnsContainerEvent ECE; 1269 struct aac_AifEnsEnclosureEvent EEE; 1270 struct aac_AifEnsBatteryEvent EBE; 1271 struct aac_AifEnsDiskSetEvent EDS; 1272 /* struct aac_AifEnsSMARTEvent ES; */ 1273 struct aac_AifEnsClusterEvent ECLE; 1274 } data; 1275 }; 1276 1277 /* 1278 * Adapter Initiated FIB command structures. Start with the adapter 1279 * initiated FIBs that really come from the adapter, and get responded 1280 * to by the host. 1281 */ 1282 #define AAC_AIF_REPORT_MAX_SIZE 64 1283 1284 typedef enum { 1285 AifCmdEventNotify = 1, /* Notify of event */ 1286 AifCmdJobProgress, /* Progress report */ 1287 AifCmdAPIReport, /* Report from other user of API */ 1288 AifCmdDriverNotify, /* Notify host driver of event */ 1289 AifReqJobList = 100, /* Gets back complete job list */ 1290 AifReqJobsForCtr, /* Gets back jobs for specific container */ 1291 AifReqJobsForScsi, /* Gets back jobs for specific SCSI device */ 1292 AifReqJobReport, /* Gets back a specific job report or list */ 1293 AifReqTerminateJob, /* Terminates job */ 1294 AifReqSuspendJob, /* Suspends a job */ 1295 AifReqResumeJob, /* Resumes a job */ 1296 AifReqSendAPIReport, /* API generic report requests */ 1297 AifReqAPIJobStart, /* Start a job from the API */ 1298 AifReqAPIJobUpdate, /* Update a job report from the API */ 1299 AifReqAPIJobFinish /* Finish a job from the API */ 1300 } AAC_AifCommand; 1301 1302 struct aac_aif_command { 1303 AAC_AifCommand command; /* Tell host what type of notify this is */ 1304 uint32_t seqNumber; /* To allow ordering of reports */ 1305 /* (if necessary) */ 1306 union { 1307 struct aac_AifEventNotify EN; /* Event notify */ 1308 struct aac_AifJobProgressReport PR[1]; /* Progress report */ 1309 uint8_t AR[AAC_AIF_REPORT_MAX_SIZE]; 1310 uint8_t data[AAC_FIB_DATASIZE - 8]; 1311 } data; 1312 }; 1313 1314 #define CT_PUP_MISSING_DRIVE 27 1315 1316 /* 1317 * Cluster Management Commands 1318 */ 1319 typedef enum { 1320 CL_NULL = 0, /* 0x00 null */ 1321 /* disk set commands */ 1322 DS_INIT = 1, /* 0x01 init disk set control block */ 1323 DS_RESCAN, /* 0x02 refresh drive, disk set, and slice */ 1324 /* structs */ 1325 DS_CREATE, /* 0x03 create a disk set */ 1326 DS_DELETE, /* 0x04 delete a disk set */ 1327 DS_ADD_DISK, /* 0x05 add a disk to an existing disk set */ 1328 DS_REMOVE_DISK, /* 0x06 remove a disk from an existing disk */ 1329 /* set */ 1330 DS_MOVE_DISK, /* 0x07 move a disk from one existing disk */ 1331 /* set to another */ 1332 DS_TAKE_OWNERSHIP, /* 0x08 take ownership of an unowned disk set */ 1333 DS_RELEASE_OWNERSHIP, /* 0x09 release ownership of a disk set */ 1334 DS_FORCE_OWNERSHIP, /* 0x0A force ownership of an disk set */ 1335 DS_GET_DISK_SET_PARAM, /* 0x0B get info on a disk set */ 1336 DS_GET_DRIVE_PARAM, /* 0x0C get info on a drive */ 1337 DS_GET_SLICE_PARAM, /* 0x0D get info on a slice */ 1338 DS_GET_DISK_SETS, /* 0x0E get a list of disk sets */ 1339 DS_GET_DRIVES, /* 0x0F get a list of drives */ 1340 DS_SET_DISK_SET_PARAM, /* 0x10 set info of a disk set */ 1341 DS_ONLINE, /* 0x11 take disk set online */ 1342 DS_OFFLINE, /* 0x12 take disk set offline */ 1343 DS_ONLINE_CONTAINERS, /* 0x13 bring containers in diskset online */ 1344 DS_FSAPRINT, /* 0x14 do an FsaPrint */ 1345 1346 /* config commands */ 1347 CL_CFG_SET_HOST_IDS = 0x100, /* 0x100 set host ids (host name and */ 1348 /* adapter name) */ 1349 CL_CFG_SET_PARTNER_HOST_IDS, /* 0x101 set partner host ids (host */ 1350 /* name and adapter name) */ 1351 CL_CFG_GET_CLUSTER_CONFIG, /* 0x102 get cluster configuration */ 1352 1353 /* cluster comm commands */ 1354 CC_CLI_CLEAR_MESSAGE_BUFFER = 0x200, /* 0x200 CC - client - clear */ 1355 /* contents of message buffer */ 1356 CC_SRV_CLEAR_MESSAGE_BUFFER, /* 0x201 CC - server - clear contents */ 1357 /* of message buffer */ 1358 CC_CLI_SHOW_MESSAGE_BUFFER, /* 0x202 CC - client - show contents */ 1359 /* of message buffer */ 1360 CC_SRV_SHOW_MESSAGE_BUFFER, /* 0x203 CC - server - show contents */ 1361 /* of message buffer */ 1362 CC_CLI_SEND_MESSAGE, /* 0x204 CC - client - send (req) message to */ 1363 /* server side */ 1364 CC_SRV_SEND_MESSAGE, /* 0x205 CC - server - send (reply) message */ 1365 /* to client side */ 1366 CC_CLI_GET_MESSAGE, /* 0x206 CC - client - read thru read message */ 1367 /* buffer */ 1368 CC_SRV_GET_MESSAGE, /* 0x207 CC - server - read thru read message */ 1369 /* buffer */ 1370 CC_SEND_TEST_MESSAGE, /* 0x208 CC - send a special subclass message */ 1371 CC_GET_BUSINFO, /* 0x209 CC - get bus info */ 1372 CC_GET_PORTINFO, /* 0x20A CC - get bus,port info */ 1373 CC_GET_NAMEINFO, /* 0x20B CC - get misc info */ 1374 CC_GET_CONFIGINFO, /* 0x20C CC - get misc info */ 1375 CQ_QUORUM_OP = 0x300, /* 0x300 CQ - quorum messages */ 1376 1377 /* last command */ 1378 CL_LAST_COMMAND /* used for bounds checking */ 1379 } AAC_CLCommand; 1380 1381 /* 1382 * Disk IOCTL Functions 1383 */ 1384 #define Reserved_IOCTL 0x0000 1385 #define GetDeviceHandle 0x0001 1386 #define BusTargetLun_to_DeviceHandle 0x0002 1387 #define DeviceHandle_to_BusTargetLun 0x0003 1388 #define RescanBus 0x0004 1389 #define GetDeviceProbeInfo 0x0005 1390 #define GetDeviceCapacity 0x0006 1391 #define GetContainerProbeInfo 0x0007 /* Container, not diskclass */ 1392 /* ioctl */ 1393 #define GetRequestedMemorySize 0x0008 1394 #define GetBusInfo 0x0009 1395 #define GetVendorSpecific 0x000a 1396 1397 #define EnhancedGetDeviceProbeInfo 0x000b 1398 #define EnhancedGetBusInfo 0x000c 1399 1400 #define SetupExtendedCounters 0x000d 1401 #define GetPerformanceCounters 0x000f 1402 #define ResetPerformanceCounters 0x0010 1403 #define ReadModePage 0x0011 1404 #define WriteModePage 0x0012 1405 #define ReadDriveParameter 0x0013 1406 #define WriteDriveParameter 0x0014 1407 #define ResetAdapter 0x0015 1408 #define ResetBus 0x0016 1409 #define ResetBusDevice 0x0017 1410 #define ExecuteSrb 0x0018 1411 1412 #define Create_IO_Task 0x0030 1413 #define Delete_IO_Task 0x0031 1414 #define Get_IO_Task_Info 0x0032 1415 #define Check_Task_Progress 0x0033 1416 1417 #define InjectError 0x0040 1418 #define GetDeviceDefectCounts 0x0041 1419 #define GetDeviceDefectInfo 0x0042 1420 #define GetDeviceStatus 0x0043 1421 #define ClearDeviceStatus 0x0044 1422 #define DiskSpinControl 0x0045 1423 #define DiskSmartControl 0x0046 1424 #define WriteSame 0x0047 1425 #define ReadWriteLong 0x0048 1426 #define FormatUnit 0x0049 1427 1428 #define TargetDeviceControl 0x0050 1429 #define TargetChannelControl 0x0051 1430 1431 #define FlashNewCode 0x0052 1432 #define DiskCheck 0x0053 1433 #define RequestSense 0x0054 1434 #define DiskPERControl 0x0055 1435 #define Read10 0x0056 1436 #define Write10 0x0057 1437 1438 /* 1439 * The following definitions come from Adaptec: 1440 * 1441 * SRB is required for the new management tools 1442 * and non-DASD support. 1443 */ 1444 struct aac_srb 1445 { 1446 uint32_t function; 1447 uint32_t channel; 1448 uint32_t id; 1449 uint32_t lun; 1450 uint32_t timeout; /* timeout in sec. */ 1451 uint32_t flags; 1452 uint32_t count; /* data xfer size */ 1453 uint32_t retry_limit; /* obsolete */ 1454 uint32_t cdb_size; 1455 uint8_t cdb[16]; 1456 struct aac_sg_table sg; 1457 }; 1458 1459 #define AAC_SENSE_BUFFERSIZE 30 1460 1461 struct aac_srb_reply 1462 { 1463 uint32_t status; 1464 uint32_t srb_status; 1465 uint32_t scsi_status; 1466 uint32_t data_xfer_length; 1467 uint32_t sense_data_size; 1468 uint8_t sense_data[AAC_SENSE_BUFFERSIZE]; /* Can this be */ 1469 /* SCSI_SENSE_BUFFERSIZE */ 1470 }; 1471 1472 /* 1473 * SRB Flags 1474 */ 1475 #define SRB_NoDataXfer 0x0000 1476 #define SRB_DisableDisconnect 0x0004 1477 #define SRB_DisableSynchTransfer 0x0008 1478 #define SRB_BypassFrozenQueue 0x0010 1479 #define SRB_DisableAutosense 0x0020 1480 #define SRB_DataIn 0x0040 1481 #define SRB_DataOut 0x0080 1482 1483 /* 1484 * SRB Functions - set in aac_srb->function 1485 */ 1486 #define SRBF_ExecuteScsi 0x0000 1487 #define SRBF_ClaimDevice 0x0001 1488 #define SRBF_IO_Control 0x0002 1489 #define SRBF_ReceiveEvent 0x0003 1490 #define SRBF_ReleaseQueue 0x0004 1491 #define SRBF_AttachDevice 0x0005 1492 #define SRBF_ReleaseDevice 0x0006 1493 #define SRBF_Shutdown 0x0007 1494 #define SRBF_Flush 0x0008 1495 #define SRBF_AbortCommand 0x0010 1496 #define SRBF_ReleaseRecovery 0x0011 1497 #define SRBF_ResetBus 0x0012 1498 #define SRBF_ResetDevice 0x0013 1499 #define SRBF_TerminateIO 0x0014 1500 #define SRBF_FlushQueue 0x0015 1501 #define SRBF_RemoveDevice 0x0016 1502 #define SRBF_DomainValidation 0x0017 1503 1504 /* 1505 * SRB SCSI Status 1506 * Status codes for SCSI passthrough commands, 1507 * set in aac_srb->scsi_status 1508 */ 1509 #define SRB_STATUS_PENDING 0x00 1510 #define SRB_STATUS_SUCCESS 0x01 1511 #define SRB_STATUS_ABORTED 0x02 1512 #define SRB_STATUS_ABORT_FAILED 0x03 1513 #define SRB_STATUS_ERROR 0x04 1514 #define SRB_STATUS_BUSY 0x05 1515 #define SRB_STATUS_INVALID_REQUEST 0x06 1516 #define SRB_STATUS_INVALID_PATH_ID 0x07 1517 #define SRB_STATUS_NO_DEVICE 0x08 1518 #define SRB_STATUS_TIMEOUT 0x09 1519 #define SRB_STATUS_SELECTION_TIMEOUT 0x0A 1520 #define SRB_STATUS_COMMAND_TIMEOUT 0x0B 1521 #define SRB_STATUS_MESSAGE_REJECTED 0x0D 1522 #define SRB_STATUS_BUS_RESET 0x0E 1523 #define SRB_STATUS_PARITY_ERROR 0x0F 1524 #define SRB_STATUS_REQUEST_SENSE_FAILED 0x10 1525 #define SRB_STATUS_NO_HBA 0x11 1526 #define SRB_STATUS_DATA_OVERRUN 0x12 1527 #define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13 1528 #define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14 1529 #define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15 1530 #define SRB_STATUS_REQUEST_FLUSHED 0x16 1531 #define SRB_STATUS_DELAYED_RETRY 0x17 1532 #define SRB_STATUS_INVALID_LUN 0x20 1533 #define SRB_STATUS_INVALID_TARGET_ID 0x21 1534 #define SRB_STATUS_BAD_FUNCTION 0x22 1535 #define SRB_STATUS_ERROR_RECOVERY 0x23 1536 #define SRB_STATUS_NOT_STARTED 0x24 1537 #define SRB_STATUS_NOT_IN_USE 0x30 1538 #define SRB_STATUS_FORCE_ABORT 0x31 1539 #define SRB_STATUS_DOMAIN_VALIDATION_FAIL 0x32 1540 1541 #pragma pack() 1542 1543 /* 1544 * Aligned structure definition for variable declarations that require 1545 * alignment. 1546 */ 1547 union aac_fib_align { 1548 struct aac_fib d; 1549 uint32_t dumb; 1550 }; 1551 1552 /* AAC Communication Space */ 1553 struct aac_comm_space { 1554 struct aac_fib adapter_fibs[AAC_ADAPTER_FIBS]; 1555 struct aac_adapter_init init_data; 1556 struct aac_queue_table qtable; 1557 char qt_align_pad[AAC_QUEUE_ALIGN]; 1558 char adapter_print_buf[AAC_ADAPTER_PRINT_BUFSIZE]; 1559 struct aac_fib sync_fib; 1560 }; 1561 1562 #ifdef __cplusplus 1563 } 1564 #endif 1565 1566 #endif /* __AAC_REGS_H__ */ 1567