📄 buslogic.h
字号:
/* Linux Driver for BusLogic MultiMaster and FlashPoint SCSI Host Adapters Copyright 1995-1998 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. Special thanks to Wayne Yen, Jin-Lon Hon, and Alex Win of BusLogic, whose advice has been invaluable, to David Gentzel, for writing the original Linux BusLogic driver, and to Paul Gortmaker, for being such a dedicated test site. Finally, special thanks to Mylex/BusLogic for making the FlashPoint SCCB Manager available as freely redistributable source code.*/#ifndef _BUSLOGIC_H#define _BUSLOGIC_H#ifndef PACKED#define PACKED __attribute__((packed))#endif/* FlashPoint support is only available for the Intel x86 Architecture with CONFIG_PCI set.*/#ifndef __i386__#undef CONFIG_SCSI_OMIT_FLASHPOINT#define CONFIG_SCSI_OMIT_FLASHPOINT#endif#ifndef CONFIG_PCI#undef CONFIG_SCSI_OMIT_FLASHPOINT#define CONFIG_SCSI_OMIT_FLASHPOINT#define BusLogic_InitializeProbeInfoListISA BusLogic_InitializeProbeInfoList#endif/* Define the maximum number of BusLogic Host Adapters supported by this driver.*/#define BusLogic_MaxHostAdapters 16/* Define the maximum number of Target Devices supported by this driver.*/#define BusLogic_MaxTargetDevices 16/* Define the maximum number of Scatter/Gather Segments used by this driver. For optimal performance, it is important that this limit be at least as large as the largest single request generated by the I/O Subsystem.*/#define BusLogic_ScatterGatherLimit 128/* Define the maximum, maximum automatic, minimum automatic, and default Queue Depth to allow for Target Devices depending on whether or not they support Tagged Queuing and whether or not ISA Bounce Buffers are required.*/#define BusLogic_MaxTaggedQueueDepth 64#define BusLogic_MaxAutomaticTaggedQueueDepth 28#define BusLogic_MinAutomaticTaggedQueueDepth 7#define BusLogic_TaggedQueueDepthBB 3#define BusLogic_UntaggedQueueDepth 3#define BusLogic_UntaggedQueueDepthBB 2/* Define the default amount of time in seconds to wait between a Host Adapter Hard Reset which initiates a SCSI Bus Reset and issuing any SCSI commands. Some SCSI devices get confused if they receive SCSI commands too soon after a SCSI Bus Reset.*/#define BusLogic_DefaultBusSettleTime 2/* Define the maximum number of Mailboxes that should be used for MultiMaster Host Adapters. This number is chosen to be larger than the maximum Host Adapter Queue Depth and small enough so that the Host Adapter structure does not cross an allocation block size boundary.*/#define BusLogic_MaxMailboxes 211/* Define the number of CCBs that should be allocated as a group to optimize Kernel memory allocation.*/#define BusLogic_CCB_AllocationGroupSize 7/* Define the Host Adapter Line and Message Buffer Sizes.*/#define BusLogic_LineBufferSize 100#define BusLogic_MessageBufferSize 9700/* Define the Driver Message Levels.*/enum BusLogic_MessageLevel { BusLogic_AnnounceLevel = 0, BusLogic_InfoLevel = 1, BusLogic_NoticeLevel = 2, BusLogic_WarningLevel = 3, BusLogic_ErrorLevel = 4};static char *BusLogic_MessageLevelMap[] = { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR };/* Define Driver Message macros.*/#define BusLogic_Announce(Format, Arguments...) \ BusLogic_Message(BusLogic_AnnounceLevel, Format, ##Arguments)#define BusLogic_Info(Format, Arguments...) \ BusLogic_Message(BusLogic_InfoLevel, Format, ##Arguments)#define BusLogic_Notice(Format, Arguments...) \ BusLogic_Message(BusLogic_NoticeLevel, Format, ##Arguments)#define BusLogic_Warning(Format, Arguments...) \ BusLogic_Message(BusLogic_WarningLevel, Format, ##Arguments)#define BusLogic_Error(Format, Arguments...) \ BusLogic_Message(BusLogic_ErrorLevel, Format, ##Arguments)/* Define the types of BusLogic Host Adapters that are supported and the number of I/O Addresses required by each type.*/enum BusLogic_HostAdapterType { BusLogic_MultiMaster = 1, BusLogic_FlashPoint = 2} PACKED;#define BusLogic_MultiMasterAddressCount 4#define BusLogic_FlashPointAddressCount 256static int BusLogic_HostAdapterAddressCount[3] = { 0, BusLogic_MultiMasterAddressCount, BusLogic_FlashPointAddressCount };/* Define macros for testing the Host Adapter Type.*/#ifndef CONFIG_SCSI_OMIT_FLASHPOINT#define BusLogic_MultiMasterHostAdapterP(HostAdapter) \ (HostAdapter->HostAdapterType == BusLogic_MultiMaster)#define BusLogic_FlashPointHostAdapterP(HostAdapter) \ (HostAdapter->HostAdapterType == BusLogic_FlashPoint)#else#define BusLogic_MultiMasterHostAdapterP(HostAdapter) \ (true)#define BusLogic_FlashPointHostAdapterP(HostAdapter) \ (false)#endif/* Define the possible Host Adapter Bus Types.*/enum BusLogic_HostAdapterBusType { BusLogic_Unknown_Bus = 0, BusLogic_ISA_Bus = 1, BusLogic_EISA_Bus = 2, BusLogic_PCI_Bus = 3, BusLogic_VESA_Bus = 4, BusLogic_MCA_Bus = 5} PACKED;static char *BusLogic_HostAdapterBusNames[] = { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" };static enum BusLogic_HostAdapterBusType BusLogic_HostAdapterBusTypes[] = { BusLogic_VESA_Bus, /* BT-4xx */ BusLogic_ISA_Bus, /* BT-5xx */ BusLogic_MCA_Bus, /* BT-6xx */ BusLogic_EISA_Bus, /* BT-7xx */ BusLogic_Unknown_Bus, /* BT-8xx */ BusLogic_PCI_Bus /* BT-9xx */};/* Define the possible Host Adapter BIOS Disk Geometry Translations.*/enum BusLogic_BIOS_DiskGeometryTranslation { BusLogic_BIOS_Disk_Not_Installed = 0, BusLogic_BIOS_Disk_Installed_64x32 = 1, BusLogic_BIOS_Disk_Installed_128x32 = 2, BusLogic_BIOS_Disk_Installed_255x63 = 3} PACKED;/* Define a 10^18 Statistics Byte Counter data type.*/struct BusLogic_ByteCounter { unsigned int Units; unsigned int Billions;};/* Define the structure for I/O Address and Bus Probing Information.*/struct BusLogic_ProbeInfo { enum BusLogic_HostAdapterType HostAdapterType; enum BusLogic_HostAdapterBusType HostAdapterBusType; unsigned long IO_Address; unsigned long PCI_Address; struct pci_dev *PCI_Device; unsigned char Bus; unsigned char Device; unsigned char IRQ_Channel;};/* Define the Probe Options.*/struct BusLogic_ProbeOptions { bool NoProbe:1; /* Bit 0 */ bool NoProbeISA:1; /* Bit 1 */ bool NoProbePCI:1; /* Bit 2 */ bool NoSortPCI:1; /* Bit 3 */ bool MultiMasterFirst:1;/* Bit 4 */ bool FlashPointFirst:1; /* Bit 5 */ bool LimitedProbeISA:1; /* Bit 6 */ bool Probe330:1; /* Bit 7 */ bool Probe334:1; /* Bit 8 */ bool Probe230:1; /* Bit 9 */ bool Probe234:1; /* Bit 10 */ bool Probe130:1; /* Bit 11 */ bool Probe134:1; /* Bit 12 */};/* Define the Global Options.*/struct BusLogic_GlobalOptions { bool TraceProbe:1; /* Bit 0 */ bool TraceHardwareReset:1; /* Bit 1 */ bool TraceConfiguration:1; /* Bit 2 */ bool TraceErrors:1; /* Bit 3 */};/* Define the Local Options.*/struct BusLogic_LocalOptions { bool InhibitTargetInquiry:1; /* Bit 0 */};/* Define the BusLogic SCSI Host Adapter I/O Register Offsets.*/#define BusLogic_ControlRegisterOffset 0 /* WO register */#define BusLogic_StatusRegisterOffset 0 /* RO register */#define BusLogic_CommandParameterRegisterOffset 1 /* WO register */#define BusLogic_DataInRegisterOffset 1 /* RO register */#define BusLogic_InterruptRegisterOffset 2 /* RO register */#define BusLogic_GeometryRegisterOffset 3 /* RO register *//* Define the structure of the write-only Control Register.*/union BusLogic_ControlRegister { unsigned char All; struct { unsigned char:4; /* Bits 0-3 */ bool SCSIBusReset:1; /* Bit 4 */ bool InterruptReset:1; /* Bit 5 */ bool SoftReset:1; /* Bit 6 */ bool HardReset:1; /* Bit 7 */ } cr;};/* Define the structure of the read-only Status Register.*/union BusLogic_StatusRegister { unsigned char All; struct { bool CommandInvalid:1; /* Bit 0 */ bool Reserved:1; /* Bit 1 */ bool DataInRegisterReady:1; /* Bit 2 */ bool CommandParameterRegisterBusy:1; /* Bit 3 */ bool HostAdapterReady:1; /* Bit 4 */ bool InitializationRequired:1; /* Bit 5 */ bool DiagnosticFailure:1; /* Bit 6 */ bool DiagnosticActive:1; /* Bit 7 */ } sr;};/* Define the structure of the read-only Interrupt Register.*/union BusLogic_InterruptRegister { unsigned char All; struct { bool IncomingMailboxLoaded:1; /* Bit 0 */ bool OutgoingMailboxAvailable:1;/* Bit 1 */ bool CommandComplete:1; /* Bit 2 */ bool ExternalBusReset:1; /* Bit 3 */ unsigned char Reserved:3; /* Bits 4-6 */ bool InterruptValid:1; /* Bit 7 */ } ir;};/* Define the structure of the read-only Geometry Register.*/union BusLogic_GeometryRegister { unsigned char All; struct { enum BusLogic_BIOS_DiskGeometryTranslation Drive0Geometry:2; /* Bits 0-1 */ enum BusLogic_BIOS_DiskGeometryTranslation Drive1Geometry:2; /* Bits 2-3 */ unsigned char:3; /* Bits 4-6 */ bool ExtendedTranslationEnabled:1; /* Bit 7 */ } gr;};/* Define the BusLogic SCSI Host Adapter Command Register Operation Codes.*/enum BusLogic_OperationCode { BusLogic_TestCommandCompleteInterrupt = 0x00, BusLogic_InitializeMailbox = 0x01, BusLogic_ExecuteMailboxCommand = 0x02, BusLogic_ExecuteBIOSCommand = 0x03, BusLogic_InquireBoardID = 0x04, BusLogic_EnableOutgoingMailboxAvailableInt = 0x05, BusLogic_SetSCSISelectionTimeout = 0x06, BusLogic_SetPreemptTimeOnBus = 0x07, BusLogic_SetTimeOffBus = 0x08, BusLogic_SetBusTransferRate = 0x09, BusLogic_InquireInstalledDevicesID0to7 = 0x0A, BusLogic_InquireConfiguration = 0x0B, BusLogic_EnableTargetMode = 0x0C, BusLogic_InquireSetupInformation = 0x0D, BusLogic_WriteAdapterLocalRAM = 0x1A, BusLogic_ReadAdapterLocalRAM = 0x1B, BusLogic_WriteBusMasterChipFIFO = 0x1C, BusLogic_ReadBusMasterChipFIFO = 0x1D, BusLogic_EchoCommandData = 0x1F, BusLogic_HostAdapterDiagnostic = 0x20, BusLogic_SetAdapterOptions = 0x21, BusLogic_InquireInstalledDevicesID8to15 = 0x23, BusLogic_InquireTargetDevices = 0x24, BusLogic_DisableHostAdapterInterrupt = 0x25, BusLogic_InitializeExtendedMailbox = 0x81, BusLogic_ExecuteSCSICommand = 0x83, BusLogic_InquireFirmwareVersion3rdDigit = 0x84, BusLogic_InquireFirmwareVersionLetter = 0x85, BusLogic_InquirePCIHostAdapterInformation = 0x86, BusLogic_InquireHostAdapterModelNumber = 0x8B, BusLogic_InquireSynchronousPeriod = 0x8C, BusLogic_InquireExtendedSetupInformation = 0x8D, BusLogic_EnableStrictRoundRobinMode = 0x8F, BusLogic_StoreHostAdapterLocalRAM = 0x90, BusLogic_FetchHostAdapterLocalRAM = 0x91, BusLogic_StoreLocalDataInEEPROM = 0x92, BusLogic_UploadAutoSCSICode = 0x94, BusLogic_ModifyIOAddress = 0x95, BusLogic_SetCCBFormat = 0x96, BusLogic_WriteInquiryBuffer = 0x9A, BusLogic_ReadInquiryBuffer = 0x9B, BusLogic_FlashROMUploadDownload = 0xA7, BusLogic_ReadSCAMData = 0xA8, BusLogic_WriteSCAMData = 0xA9};/* Define the Inquire Board ID reply structure.*/struct BusLogic_BoardID { unsigned char BoardType; /* Byte 0 */ unsigned char CustomFeatures; /* Byte 1 */ unsigned char FirmwareVersion1stDigit; /* Byte 2 */ unsigned char FirmwareVersion2ndDigit; /* Byte 3 */};/* Define the Inquire Configuration reply structure.*/struct BusLogic_Configuration { unsigned char:5; /* Byte 0 Bits 0-4 */ bool DMA_Channel5:1; /* Byte 0 Bit 5 */ bool DMA_Channel6:1; /* Byte 0 Bit 6 */ bool DMA_Channel7:1; /* Byte 0 Bit 7 */ bool IRQ_Channel9:1; /* Byte 1 Bit 0 */ bool IRQ_Channel10:1; /* Byte 1 Bit 1 */ bool IRQ_Channel11:1; /* Byte 1 Bit 2 */ bool IRQ_Channel12:1; /* Byte 1 Bit 3 */ unsigned char:1; /* Byte 1 Bit 4 */ bool IRQ_Channel14:1; /* Byte 1 Bit 5 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -