📄 dac960.h
字号:
/* Linux Driver for Mylex DAC960/AcceleRAID/eXtremeRAID PCI RAID Controllers Copyright 1998-2001 by Leonard N. Zubkoff <lnz@dandelion.com> This program is free software; you may redistribute and/or modify it under the terms of the GNU General Public License Version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for complete details. The author respectfully requests that any modifications to this software be sent directly to him for evaluation and testing.*//* Define the maximum number of DAC960 Controllers supported by this driver.*/#define DAC960_MaxControllers 8/* Define the maximum number of Controller Channels supported by DAC960 V1 and V2 Firmware Controllers.*/#define DAC960_V1_MaxChannels 3#define DAC960_V2_MaxChannels 4/* Define the maximum number of Targets per Channel supported by DAC960 V1 and V2 Firmware Controllers.*/#define DAC960_V1_MaxTargets 16#define DAC960_V2_MaxTargets 128/* Define the maximum number of Logical Drives supported by DAC960 V1 and V2 Firmware Controllers.*/#define DAC960_MaxLogicalDrives 32/* Define the maximum number of Physical Devices supported by DAC960 V1 and V2 Firmware Controllers.*/#define DAC960_V1_MaxPhysicalDevices 45#define DAC960_V2_MaxPhysicalDevices 272/* Define the pci dma mask supported by DAC960 V1 and V2 Firmware Controlers */#define DAC690_V1_PciDmaMask 0xffffffff#define DAC690_V2_PciDmaMask 0xffffffffffffffffULL/* Define a Boolean data type.*/typedef enum { false, true } __attribute__ ((packed)) boolean;/* Define a 32/64 bit I/O Address data type.*/typedef unsigned long DAC960_IO_Address_T;/* Define a 32/64 bit PCI Bus Address data type.*/typedef unsigned long DAC960_PCI_Address_T;/* Define a 32 bit Bus Address data type.*/typedef unsigned int DAC960_BusAddress32_T;/* Define a 64 bit Bus Address data type.*/typedef unsigned long long DAC960_BusAddress64_T;/* Define a 32 bit Byte Count data type.*/typedef unsigned int DAC960_ByteCount32_T;/* Define a 64 bit Byte Count data type.*/typedef unsigned long long DAC960_ByteCount64_T;/* dma_loaf is used by helper routines to divide a region of dma mapped memory into smaller pieces, where those pieces are not of uniform size. */struct dma_loaf { void *cpu_base; dma_addr_t dma_base; size_t length; void *cpu_free; dma_addr_t dma_free;};/* Define the SCSI INQUIRY Standard Data structure.*/typedef struct DAC960_SCSI_Inquiry{ unsigned char PeripheralDeviceType:5; /* Byte 0 Bits 0-4 */ unsigned char PeripheralQualifier:3; /* Byte 0 Bits 5-7 */ unsigned char DeviceTypeModifier:7; /* Byte 1 Bits 0-6 */ boolean RMB:1; /* Byte 1 Bit 7 */ unsigned char ANSI_ApprovedVersion:3; /* Byte 2 Bits 0-2 */ unsigned char ECMA_Version:3; /* Byte 2 Bits 3-5 */ unsigned char ISO_Version:2; /* Byte 2 Bits 6-7 */ unsigned char ResponseDataFormat:4; /* Byte 3 Bits 0-3 */ unsigned char :2; /* Byte 3 Bits 4-5 */ boolean TrmIOP:1; /* Byte 3 Bit 6 */ boolean AENC:1; /* Byte 3 Bit 7 */ unsigned char AdditionalLength; /* Byte 4 */ unsigned char :8; /* Byte 5 */ unsigned char :8; /* Byte 6 */ boolean SftRe:1; /* Byte 7 Bit 0 */ boolean CmdQue:1; /* Byte 7 Bit 1 */ boolean :1; /* Byte 7 Bit 2 */ boolean Linked:1; /* Byte 7 Bit 3 */ boolean Sync:1; /* Byte 7 Bit 4 */ boolean WBus16:1; /* Byte 7 Bit 5 */ boolean WBus32:1; /* Byte 7 Bit 6 */ boolean RelAdr:1; /* Byte 7 Bit 7 */ unsigned char VendorIdentification[8]; /* Bytes 8-15 */ unsigned char ProductIdentification[16]; /* Bytes 16-31 */ unsigned char ProductRevisionLevel[4]; /* Bytes 32-35 */}DAC960_SCSI_Inquiry_T;/* Define the SCSI INQUIRY Unit Serial Number structure.*/typedef struct DAC960_SCSI_Inquiry_UnitSerialNumber{ unsigned char PeripheralDeviceType:5; /* Byte 0 Bits 0-4 */ unsigned char PeripheralQualifier:3; /* Byte 0 Bits 5-7 */ unsigned char PageCode; /* Byte 1 */ unsigned char :8; /* Byte 2 */ unsigned char PageLength; /* Byte 3 */ unsigned char ProductSerialNumber[28]; /* Bytes 4-31 */}DAC960_SCSI_Inquiry_UnitSerialNumber_T;/* Define the SCSI REQUEST SENSE Sense Key type.*/typedef enum{ DAC960_SenseKey_NoSense = 0x0, DAC960_SenseKey_RecoveredError = 0x1, DAC960_SenseKey_NotReady = 0x2, DAC960_SenseKey_MediumError = 0x3, DAC960_SenseKey_HardwareError = 0x4, DAC960_SenseKey_IllegalRequest = 0x5, DAC960_SenseKey_UnitAttention = 0x6, DAC960_SenseKey_DataProtect = 0x7, DAC960_SenseKey_BlankCheck = 0x8, DAC960_SenseKey_VendorSpecific = 0x9, DAC960_SenseKey_CopyAborted = 0xA, DAC960_SenseKey_AbortedCommand = 0xB, DAC960_SenseKey_Equal = 0xC, DAC960_SenseKey_VolumeOverflow = 0xD, DAC960_SenseKey_Miscompare = 0xE, DAC960_SenseKey_Reserved = 0xF}__attribute__ ((packed))DAC960_SCSI_RequestSenseKey_T;/* Define the SCSI REQUEST SENSE structure.*/typedef struct DAC960_SCSI_RequestSense{ unsigned char ErrorCode:7; /* Byte 0 Bits 0-6 */ boolean Valid:1; /* Byte 0 Bit 7 */ unsigned char SegmentNumber; /* Byte 1 */ DAC960_SCSI_RequestSenseKey_T SenseKey:4; /* Byte 2 Bits 0-3 */ unsigned char :1; /* Byte 2 Bit 4 */ boolean ILI:1; /* Byte 2 Bit 5 */ boolean EOM:1; /* Byte 2 Bit 6 */ boolean Filemark:1; /* Byte 2 Bit 7 */ unsigned char Information[4]; /* Bytes 3-6 */ unsigned char AdditionalSenseLength; /* Byte 7 */ unsigned char CommandSpecificInformation[4]; /* Bytes 8-11 */ unsigned char AdditionalSenseCode; /* Byte 12 */ unsigned char AdditionalSenseCodeQualifier; /* Byte 13 */}DAC960_SCSI_RequestSense_T;/* Define the DAC960 V1 Firmware Command Opcodes.*/typedef enum{ /* I/O Commands */ DAC960_V1_ReadExtended = 0x33, DAC960_V1_WriteExtended = 0x34, DAC960_V1_ReadAheadExtended = 0x35, DAC960_V1_ReadExtendedWithScatterGather = 0xB3, DAC960_V1_WriteExtendedWithScatterGather = 0xB4, DAC960_V1_Read = 0x36, DAC960_V1_ReadWithScatterGather = 0xB6, DAC960_V1_Write = 0x37, DAC960_V1_WriteWithScatterGather = 0xB7, DAC960_V1_DCDB = 0x04, DAC960_V1_DCDBWithScatterGather = 0x84, DAC960_V1_Flush = 0x0A, /* Controller Status Related Commands */ DAC960_V1_Enquiry = 0x53, DAC960_V1_Enquiry2 = 0x1C, DAC960_V1_GetLogicalDriveElement = 0x55, DAC960_V1_GetLogicalDriveInformation = 0x19, DAC960_V1_IOPortRead = 0x39, DAC960_V1_IOPortWrite = 0x3A, DAC960_V1_GetSDStats = 0x3E, DAC960_V1_GetPDStats = 0x3F, DAC960_V1_PerformEventLogOperation = 0x72, /* Device Related Commands */ DAC960_V1_StartDevice = 0x10, DAC960_V1_GetDeviceState = 0x50, DAC960_V1_StopChannel = 0x13, DAC960_V1_StartChannel = 0x12, DAC960_V1_ResetChannel = 0x1A, /* Commands Associated with Data Consistency and Errors */ DAC960_V1_Rebuild = 0x09, DAC960_V1_RebuildAsync = 0x16, DAC960_V1_CheckConsistency = 0x0F, DAC960_V1_CheckConsistencyAsync = 0x1E, DAC960_V1_RebuildStat = 0x0C, DAC960_V1_GetRebuildProgress = 0x27, DAC960_V1_RebuildControl = 0x1F, DAC960_V1_ReadBadBlockTable = 0x0B, DAC960_V1_ReadBadDataTable = 0x25, DAC960_V1_ClearBadDataTable = 0x26, DAC960_V1_GetErrorTable = 0x17, DAC960_V1_AddCapacityAsync = 0x2A, DAC960_V1_BackgroundInitializationControl = 0x2B, /* Configuration Related Commands */ DAC960_V1_ReadConfig2 = 0x3D, DAC960_V1_WriteConfig2 = 0x3C, DAC960_V1_ReadConfigurationOnDisk = 0x4A, DAC960_V1_WriteConfigurationOnDisk = 0x4B, DAC960_V1_ReadConfiguration = 0x4E, DAC960_V1_ReadBackupConfiguration = 0x4D, DAC960_V1_WriteConfiguration = 0x4F, DAC960_V1_AddConfiguration = 0x4C, DAC960_V1_ReadConfigurationLabel = 0x48, DAC960_V1_WriteConfigurationLabel = 0x49, /* Firmware Upgrade Related Commands */ DAC960_V1_LoadImage = 0x20, DAC960_V1_StoreImage = 0x21, DAC960_V1_ProgramImage = 0x22, /* Diagnostic Commands */ DAC960_V1_SetDiagnosticMode = 0x31, DAC960_V1_RunDiagnostic = 0x32, /* Subsystem Service Commands */ DAC960_V1_GetSubsystemData = 0x70, DAC960_V1_SetSubsystemParameters = 0x71, /* Version 2.xx Firmware Commands */ DAC960_V1_Enquiry_Old = 0x05, DAC960_V1_GetDeviceState_Old = 0x14, DAC960_V1_Read_Old = 0x02, DAC960_V1_Write_Old = 0x03, DAC960_V1_ReadWithScatterGather_Old = 0x82, DAC960_V1_WriteWithScatterGather_Old = 0x83}__attribute__ ((packed))DAC960_V1_CommandOpcode_T;/* Define the DAC960 V1 Firmware Command Identifier type.*/typedef unsigned char DAC960_V1_CommandIdentifier_T;/* Define the DAC960 V1 Firmware Command Status Codes.*/#define DAC960_V1_NormalCompletion 0x0000 /* Common */#define DAC960_V1_CheckConditionReceived 0x0002 /* Common */#define DAC960_V1_NoDeviceAtAddress 0x0102 /* Common */#define DAC960_V1_InvalidDeviceAddress 0x0105 /* Common */#define DAC960_V1_InvalidParameter 0x0105 /* Common */#define DAC960_V1_IrrecoverableDataError 0x0001 /* I/O */#define DAC960_V1_LogicalDriveNonexistentOrOffline 0x0002 /* I/O */#define DAC960_V1_AccessBeyondEndOfLogicalDrive 0x0105 /* I/O */#define DAC960_V1_BadDataEncountered 0x010C /* I/O */#define DAC960_V1_DeviceBusy 0x0008 /* DCDB */#define DAC960_V1_DeviceNonresponsive 0x000E /* DCDB */#define DAC960_V1_CommandTerminatedAbnormally 0x000F /* DCDB */#define DAC960_V1_UnableToStartDevice 0x0002 /* Device */#define DAC960_V1_InvalidChannelOrTargetOrModifier 0x0105 /* Device */#define DAC960_V1_ChannelBusy 0x0106 /* Device */#define DAC960_V1_ChannelNotStopped 0x0002 /* Device */#define DAC960_V1_AttemptToRebuildOnlineDrive 0x0002 /* Consistency */#define DAC960_V1_RebuildBadBlocksEncountered 0x0003 /* Consistency */#define DAC960_V1_NewDiskFailedDuringRebuild 0x0004 /* Consistency */#define DAC960_V1_RebuildOrCheckAlreadyInProgress 0x0106 /* Consistency */#define DAC960_V1_DependentDiskIsDead 0x0002 /* Consistency */#define DAC960_V1_InconsistentBlocksFound 0x0003 /* Consistency */#define DAC960_V1_InvalidOrNonredundantLogicalDrive 0x0105 /* Consistency */#define DAC960_V1_NoRebuildOrCheckInProgress 0x0105 /* Consistency */#define DAC960_V1_RebuildInProgress_DataValid 0x0000 /* Consistency */#define DAC960_V1_RebuildFailed_LogicalDriveFailure 0x0002 /* Consistency */#define DAC960_V1_RebuildFailed_BadBlocksOnOther 0x0003 /* Consistency */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -