📄 buslogic.h
字号:
unsigned int:24; /* Bytes 4-6 */ enum BusLogic_ActionCode ActionCode; /* Byte 7 */};/* Define the 32 Bit Mode Incoming Mailbox structure.*/struct BusLogic_IncomingMailbox { u32 CCB; /* Bytes 0-3 */ enum BusLogic_HostAdapterStatus HostAdapterStatus; /* Byte 4 */ enum BusLogic_TargetDeviceStatus TargetDeviceStatus; /* Byte 5 */ unsigned char:8; /* Byte 6 */ enum BusLogic_CompletionCode CompletionCode; /* Byte 7 */};/* Define the BusLogic Driver Options structure.*/struct BusLogic_DriverOptions { unsigned short TaggedQueuingPermitted; unsigned short TaggedQueuingPermittedMask; unsigned short BusSettleTime; struct BusLogic_LocalOptions LocalOptions; unsigned char CommonQueueDepth; unsigned char QueueDepth[BusLogic_MaxTargetDevices];};/* Define the Host Adapter Target Flags structure.*/struct BusLogic_TargetFlags { bool TargetExists:1; bool TaggedQueuingSupported:1; bool WideTransfersSupported:1; bool TaggedQueuingActive:1; bool WideTransfersActive:1; bool CommandSuccessfulFlag:1; bool TargetInfoReported:1;};/* Define the Host Adapter Target Statistics structure.*/#define BusLogic_SizeBuckets 10typedef unsigned int BusLogic_CommandSizeBuckets_T[BusLogic_SizeBuckets];struct BusLogic_TargetStatistics { unsigned int CommandsAttempted; unsigned int CommandsCompleted; unsigned int ReadCommands; unsigned int WriteCommands; struct BusLogic_ByteCounter TotalBytesRead; struct BusLogic_ByteCounter TotalBytesWritten; BusLogic_CommandSizeBuckets_T ReadCommandSizeBuckets; BusLogic_CommandSizeBuckets_T WriteCommandSizeBuckets; unsigned short CommandAbortsRequested; unsigned short CommandAbortsAttempted; unsigned short CommandAbortsCompleted; unsigned short BusDeviceResetsRequested; unsigned short BusDeviceResetsAttempted; unsigned short BusDeviceResetsCompleted; unsigned short HostAdapterResetsRequested; unsigned short HostAdapterResetsAttempted; unsigned short HostAdapterResetsCompleted;};/* Define the FlashPoint Card Handle data type.*/#define FlashPoint_BadCardHandle 0xFFFFFFFFtypedef unsigned int FlashPoint_CardHandle_T;/* Define the FlashPoint Information structure. This structure is defined by the FlashPoint SCCB Manager.*/struct FlashPoint_Info { u32 BaseAddress; /* Bytes 0-3 */ bool Present; /* Byte 4 */ unsigned char IRQ_Channel; /* Byte 5 */ unsigned char SCSI_ID; /* Byte 6 */ unsigned char SCSI_LUN; /* Byte 7 */ unsigned short FirmwareRevision; /* Bytes 8-9 */ unsigned short SynchronousPermitted; /* Bytes 10-11 */ unsigned short FastPermitted; /* Bytes 12-13 */ unsigned short UltraPermitted; /* Bytes 14-15 */ unsigned short DisconnectPermitted; /* Bytes 16-17 */ unsigned short WidePermitted; /* Bytes 18-19 */ bool ParityCheckingEnabled:1; /* Byte 20 Bit 0 */ bool HostWideSCSI:1; /* Byte 20 Bit 1 */ bool HostSoftReset:1; /* Byte 20 Bit 2 */ bool ExtendedTranslationEnabled:1; /* Byte 20 Bit 3 */ bool LowByteTerminated:1; /* Byte 20 Bit 4 */ bool HighByteTerminated:1; /* Byte 20 Bit 5 */ bool ReportDataUnderrun:1; /* Byte 20 Bit 6 */ bool SCAM_Enabled:1; /* Byte 20 Bit 7 */ bool SCAM_Level2:1; /* Byte 21 Bit 0 */ unsigned char:7; /* Byte 21 Bits 1-7 */ unsigned char Family; /* Byte 22 */ unsigned char BusType; /* Byte 23 */ unsigned char ModelNumber[3]; /* Bytes 24-26 */ unsigned char RelativeCardNumber; /* Byte 27 */ unsigned char Reserved[4]; /* Bytes 28-31 */ unsigned int OS_Reserved; /* Bytes 32-35 */ unsigned char TranslationInfo[4]; /* Bytes 36-39 */ unsigned int Reserved2[5]; /* Bytes 40-59 */ unsigned int SecondaryRange; /* Bytes 60-63 */};/* Define the BusLogic Driver Host Adapter structure.*/struct BusLogic_HostAdapter { struct Scsi_Host *SCSI_Host; struct pci_dev *PCI_Device; enum BusLogic_HostAdapterType HostAdapterType; enum BusLogic_HostAdapterBusType HostAdapterBusType; unsigned long IO_Address; unsigned long PCI_Address; unsigned short AddressCount; unsigned char HostNumber; unsigned char ModelName[9]; unsigned char FirmwareVersion[6]; unsigned char FullModelName[18]; unsigned char Bus; unsigned char Device; unsigned char IRQ_Channel; unsigned char DMA_Channel; unsigned char SCSI_ID; bool IRQ_ChannelAcquired:1; bool DMA_ChannelAcquired:1; bool ExtendedTranslationEnabled:1; bool ParityCheckingEnabled:1; bool BusResetEnabled:1; bool LevelSensitiveInterrupt:1; bool HostWideSCSI:1; bool HostDifferentialSCSI:1; bool HostSupportsSCAM:1; bool HostUltraSCSI:1; bool ExtendedLUNSupport:1; bool TerminationInfoValid:1; bool LowByteTerminated:1; bool HighByteTerminated:1; bool BounceBuffersRequired:1; bool StrictRoundRobinModeSupport:1; bool SCAM_Enabled:1; bool SCAM_Level2:1; bool HostAdapterInitialized:1; bool HostAdapterExternalReset:1; bool HostAdapterInternalError:1; bool ProcessCompletedCCBsActive; volatile bool HostAdapterCommandCompleted; unsigned short HostAdapterScatterGatherLimit; unsigned short DriverScatterGatherLimit; unsigned short MaxTargetDevices; unsigned short MaxLogicalUnits; unsigned short MailboxCount; unsigned short InitialCCBs; unsigned short IncrementalCCBs; unsigned short AllocatedCCBs; unsigned short DriverQueueDepth; unsigned short HostAdapterQueueDepth; unsigned short UntaggedQueueDepth; unsigned short CommonQueueDepth; unsigned short BusSettleTime; unsigned short SynchronousPermitted; unsigned short FastPermitted; unsigned short UltraPermitted; unsigned short WidePermitted; unsigned short DisconnectPermitted; unsigned short TaggedQueuingPermitted; unsigned short ExternalHostAdapterResets; unsigned short HostAdapterInternalErrors; unsigned short TargetDeviceCount; unsigned short MessageBufferLength; u32 BIOS_Address; struct BusLogic_DriverOptions *DriverOptions; struct FlashPoint_Info FlashPointInfo; FlashPoint_CardHandle_T CardHandle; struct list_head host_list; struct BusLogic_CCB *All_CCBs; struct BusLogic_CCB *Free_CCBs; struct BusLogic_CCB *FirstCompletedCCB; struct BusLogic_CCB *LastCompletedCCB; struct BusLogic_CCB *BusDeviceResetPendingCCB[BusLogic_MaxTargetDevices]; struct BusLogic_TargetFlags TargetFlags[BusLogic_MaxTargetDevices]; unsigned char QueueDepth[BusLogic_MaxTargetDevices]; unsigned char SynchronousPeriod[BusLogic_MaxTargetDevices]; unsigned char SynchronousOffset[BusLogic_MaxTargetDevices]; unsigned char ActiveCommands[BusLogic_MaxTargetDevices]; unsigned int CommandsSinceReset[BusLogic_MaxTargetDevices]; unsigned long LastSequencePoint[BusLogic_MaxTargetDevices]; unsigned long LastResetAttempted[BusLogic_MaxTargetDevices]; unsigned long LastResetCompleted[BusLogic_MaxTargetDevices]; struct BusLogic_OutgoingMailbox *FirstOutgoingMailbox; struct BusLogic_OutgoingMailbox *LastOutgoingMailbox; struct BusLogic_OutgoingMailbox *NextOutgoingMailbox; struct BusLogic_IncomingMailbox *FirstIncomingMailbox; struct BusLogic_IncomingMailbox *LastIncomingMailbox; struct BusLogic_IncomingMailbox *NextIncomingMailbox; struct BusLogic_TargetStatistics TargetStatistics[BusLogic_MaxTargetDevices]; unsigned char *MailboxSpace; dma_addr_t MailboxSpaceHandle; unsigned int MailboxSize; unsigned long CCB_Offset; char MessageBuffer[BusLogic_MessageBufferSize];};/* Define a structure for the BIOS Disk Parameters.*/struct BIOS_DiskParameters { int Heads; int Sectors; int Cylinders;};/* Define a structure for the SCSI Inquiry command results.*/struct 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 */ bool 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 */ bool TrmIOP:1; /* Byte 3 Bit 6 */ bool AENC:1; /* Byte 3 Bit 7 */ unsigned char AdditionalLength; /* Byte 4 */ unsigned char:8; /* Byte 5 */ unsigned char:8; /* Byte 6 */ bool SftRe:1; /* Byte 7 Bit 0 */ bool CmdQue:1; /* Byte 7 Bit 1 */ bool:1; /* Byte 7 Bit 2 */ bool Linked:1; /* Byte 7 Bit 3 */ bool Sync:1; /* Byte 7 Bit 4 */ bool WBus16:1; /* Byte 7 Bit 5 */ bool WBus32:1; /* Byte 7 Bit 6 */ bool 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 */};/* Define functions to provide an abstraction for reading and writing the Host Adapter I/O Registers.*/static inline void BusLogic_SCSIBusReset(struct BusLogic_HostAdapter *HostAdapter){ union BusLogic_ControlRegister ControlRegister; ControlRegister.All = 0; ControlRegister.cr.SCSIBusReset = true; outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);}static inline void BusLogic_InterruptReset(struct BusLogic_HostAdapter *HostAdapter){ union BusLogic_ControlRegister ControlRegister; ControlRegister.All = 0; ControlRegister.cr.InterruptReset = true; outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);}static inline void BusLogic_SoftReset(struct BusLogic_HostAdapter *HostAdapter){ union BusLogic_ControlRegister ControlRegister; ControlRegister.All = 0; ControlRegister.cr.SoftReset = true; outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);}static inline void BusLogic_HardReset(struct BusLogic_HostAdapter *HostAdapter){ union BusLogic_ControlRegister ControlRegister; ControlRegister.All = 0; ControlRegister.cr.HardReset = true; outb(ControlRegister.All, HostAdapter->IO_Address + BusLogic_ControlRegisterOffset);}static inline unsigned char BusLogic_ReadStatusRegister(struct BusLogic_HostAdapter *HostAdapter){ return inb(HostAdapter->IO_Address + BusLogic_StatusRegisterOffset);}static inline void BusLogic_WriteCommandParameterRegister(struct BusLogic_HostAdapter *HostAdapter, unsigned char Value){ outb(Value, HostAdapter->IO_Address + BusLogic_CommandParameterRegisterOffset);}static inline unsigned char BusLogic_ReadDataInRegister(struct BusLogic_HostAdapter *HostAdapter){ return inb(HostAdapter->IO_Address + BusLogic_DataInRegisterOffset);}static inline unsigned char BusLogic_ReadInterruptRegister(struct BusLogic_HostAdapter *HostAdapter){ return inb(HostAdapter->IO_Address + BusLogic_InterruptRegisterOffset);}static inline unsigned char BusLogic_ReadGeometryRegister(struct BusLogic_HostAdapter *HostAdapter){ return inb(HostAdapter->IO_Address + BusLogic_GeometryRegisterOffset);}/* BusLogic_StartMailboxCommand issues an Execute Mailbox Command, which notifies the Host Adapter that an entry has been made in an Outgoing Mailbox.*/static inline void BusLogic_StartMailboxCommand(struct BusLogic_HostAdapter *HostAdapter){ BusLogic_WriteCommandParameterRegister(HostAdapter, BusLogic_ExecuteMailboxCommand);}/* BusLogic_Delay waits for Seconds to elapse.*/static inline void BusLogic_Delay(int Seconds){ mdelay(1000 * Seconds);}/* Virtual_to_Bus and Bus_to_Virtual map between Kernel Virtual Addresses and PCI/VLB/EISA/ISA Bus Addresses.*/static inline u32 Virtual_to_Bus(void *VirtualAddress){ return (u32) virt_to_bus(VirtualAddress);}static inline void *Bus_to_Virtual(u32 BusAddress){ return (void *) bus_to_virt(BusAddress);}/* Virtual_to_32Bit_Virtual maps between Kernel Virtual Addresses and 32 bit Kernel Virtual Addresses. This avoids compilation warnings on 64 bit architectures.*/static inline u32 Virtual_to_32Bit_Virtual(void *VirtualAddress){ return (u32) (unsigned long) VirtualAddress;}/* BusLogic_IncrementErrorCounter increments Error Counter by 1, stopping at 65535 rather than wrapping around to 0.*/static inline void BusLogic_IncrementErrorCounter(unsigned short *ErrorCounter){ if (*ErrorCounter < 65535) (*ErrorCounter)++;}/* BusLogic_IncrementByteCounter increments Byte Counter by Amount.*/static inline void BusLogic_IncrementByteCounter(struct BusLogic_ByteCounter *ByteCounter, unsigned int Amount){ ByteCounter->Units += Amount; if (ByteCounter->Units > 999999999) { ByteCounter->Units -= 1000000000; ByteCounter->Billions++; }}/* BusLogic_IncrementSizeBucket increments the Bucket for Amount.*/static inline void BusLogic_IncrementSizeBucket(BusLogic_CommandSizeBuckets_T CommandSizeBuckets, unsigned int Amount){ int Index = 0; if (Amount < 8 * 1024) { if (Amount < 2 * 1024) Index = (Amount < 1 * 1024 ? 0 : 1); else Index = (Amount < 4 * 1024 ? 2 : 3); } else if (Amount < 128 * 1024) { if (Amount < 32 * 1024) Index = (Amount < 16 * 1024 ? 4 : 5); else Index = (Amount < 64 * 1024 ? 6 : 7); } else Index = (Amount < 256 * 1024 ? 8 : 9); CommandSizeBuckets[Index]++;}/* Define the version number of the FlashPoint Firmware (SCCB Manager).*/#define FlashPoint_FirmwareVersion "5.02"/* Define the possible return values from FlashPoint_HandleInterrupt.*/#define FlashPoint_NormalInterrupt 0x00#define FlashPoint_InternalError 0xFE#define FlashPoint_ExternalBusReset 0xFF/* Define prototypes for the forward referenced BusLogic Driver Internal Functions.*/static const char *BusLogic_DriverInfo(struct Scsi_Host *);static int BusLogic_QueueCommand(struct scsi_cmnd *, void (*CompletionRoutine) (struct scsi_cmnd *));static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *);static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *, char *, char **, off_t, int, int);static int BusLogic_SlaveConfigure(struct scsi_device *);static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *);static irqreturn_t BusLogic_InterruptHandler(int, void *);static int BusLogic_ResetHostAdapter(struct BusLogic_HostAdapter *, bool HardReset);static void BusLogic_Message(enum BusLogic_MessageLevel, char *, struct BusLogic_HostAdapter *, ...);static int __init BusLogic_Setup(char *);#endif /* _BUSLOGIC_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -