📄 buslogic.c
字号:
TargetPointer = HostAdapter->ModelName; *TargetPointer++ = 'B'; *TargetPointer++ = 'T'; *TargetPointer++ = '-'; for (i = 0; i < sizeof(FlashPointInfo->ModelNumber); i++) *TargetPointer++ = FlashPointInfo->ModelNumber[i]; *TargetPointer++ = '\0'; strcpy(HostAdapter->FirmwareVersion, FlashPoint_FirmwareVersion); HostAdapter->SCSI_ID = FlashPointInfo->SCSI_ID; HostAdapter->ExtendedTranslationEnabled = FlashPointInfo->ExtendedTranslationEnabled; HostAdapter->ParityCheckingEnabled = FlashPointInfo->ParityCheckingEnabled; HostAdapter->BusResetEnabled = !FlashPointInfo->HostSoftReset; HostAdapter->LevelSensitiveInterrupt = true; HostAdapter->HostWideSCSI = FlashPointInfo->HostWideSCSI; HostAdapter->HostDifferentialSCSI = false; HostAdapter->HostSupportsSCAM = true; HostAdapter->HostUltraSCSI = true; HostAdapter->ExtendedLUNSupport = true; HostAdapter->TerminationInfoValid = true; HostAdapter->LowByteTerminated = FlashPointInfo->LowByteTerminated; HostAdapter->HighByteTerminated = FlashPointInfo->HighByteTerminated; HostAdapter->SCAM_Enabled = FlashPointInfo->SCAM_Enabled; HostAdapter->SCAM_Level2 = FlashPointInfo->SCAM_Level2; HostAdapter->DriverScatterGatherLimit = BusLogic_ScatterGatherLimit; HostAdapter->MaxTargetDevices = (HostAdapter->HostWideSCSI ? 16 : 8); HostAdapter->MaxLogicalUnits = 32; HostAdapter->InitialCCBs = 4 * BusLogic_CCB_AllocationGroupSize; HostAdapter->IncrementalCCBs = BusLogic_CCB_AllocationGroupSize; HostAdapter->DriverQueueDepth = 255; HostAdapter->HostAdapterQueueDepth = HostAdapter->DriverQueueDepth; HostAdapter->SynchronousPermitted = FlashPointInfo->SynchronousPermitted; HostAdapter->FastPermitted = FlashPointInfo->FastPermitted; HostAdapter->UltraPermitted = FlashPointInfo->UltraPermitted; HostAdapter->WidePermitted = FlashPointInfo->WidePermitted; HostAdapter->DisconnectPermitted = FlashPointInfo->DisconnectPermitted; HostAdapter->TaggedQueuingPermitted = 0xFFFF; goto Common; } /* Issue the Inquire Board ID command. */ if (BusLogic_Command(HostAdapter, BusLogic_InquireBoardID, NULL, 0, &BoardID, sizeof(BoardID)) != sizeof(BoardID)) return BusLogic_Failure(HostAdapter, "INQUIRE BOARD ID"); /* Issue the Inquire Configuration command. */ if (BusLogic_Command(HostAdapter, BusLogic_InquireConfiguration, NULL, 0, &Configuration, sizeof(Configuration)) != sizeof(Configuration)) return BusLogic_Failure(HostAdapter, "INQUIRE CONFIGURATION"); /* Issue the Inquire Setup Information command. */ RequestedReplyLength = sizeof(SetupInformation); if (BusLogic_Command(HostAdapter, BusLogic_InquireSetupInformation, &RequestedReplyLength, sizeof(RequestedReplyLength), &SetupInformation, sizeof(SetupInformation)) != sizeof(SetupInformation)) return BusLogic_Failure(HostAdapter, "INQUIRE SETUP INFORMATION"); /* Issue the Inquire Extended Setup Information command. */ RequestedReplyLength = sizeof(ExtendedSetupInformation); if (BusLogic_Command(HostAdapter, BusLogic_InquireExtendedSetupInformation, &RequestedReplyLength, sizeof(RequestedReplyLength), &ExtendedSetupInformation, sizeof(ExtendedSetupInformation)) != sizeof(ExtendedSetupInformation)) return BusLogic_Failure(HostAdapter, "INQUIRE EXTENDED SETUP INFORMATION"); /* Issue the Inquire Firmware Version 3rd Digit command. */ FirmwareVersion3rdDigit = '\0'; if (BoardID.FirmwareVersion1stDigit > '0') if (BusLogic_Command(HostAdapter, BusLogic_InquireFirmwareVersion3rdDigit, NULL, 0, &FirmwareVersion3rdDigit, sizeof(FirmwareVersion3rdDigit)) != sizeof(FirmwareVersion3rdDigit)) return BusLogic_Failure(HostAdapter, "INQUIRE FIRMWARE 3RD DIGIT"); /* Issue the Inquire Host Adapter Model Number command. */ if (ExtendedSetupInformation.BusType == 'A' && BoardID.FirmwareVersion1stDigit == '2') /* BusLogic BT-542B ISA 2.xx */ strcpy(HostAdapterModelNumber, "542B"); else if (ExtendedSetupInformation.BusType == 'E' && BoardID.FirmwareVersion1stDigit == '2' && (BoardID.FirmwareVersion2ndDigit <= '1' || (BoardID.FirmwareVersion2ndDigit == '2' && FirmwareVersion3rdDigit == '0'))) /* BusLogic BT-742A EISA 2.1x or 2.20 */ strcpy(HostAdapterModelNumber, "742A"); else if (ExtendedSetupInformation.BusType == 'E' && BoardID.FirmwareVersion1stDigit == '0') /* AMI FastDisk EISA Series 441 0.x */ strcpy(HostAdapterModelNumber, "747A"); else { RequestedReplyLength = sizeof(HostAdapterModelNumber); if (BusLogic_Command(HostAdapter, BusLogic_InquireHostAdapterModelNumber, &RequestedReplyLength, sizeof(RequestedReplyLength), &HostAdapterModelNumber, sizeof(HostAdapterModelNumber)) != sizeof(HostAdapterModelNumber)) return BusLogic_Failure(HostAdapter, "INQUIRE HOST ADAPTER MODEL NUMBER"); } /* BusLogic MultiMaster Host Adapters can be identified by their model number and the major version number of their firmware as follows: 5.xx BusLogic "W" Series Host Adapters: BT-948/958/958D 4.xx BusLogic "C" Series Host Adapters: BT-946C/956C/956CD/747C/757C/757CD/445C/545C/540CF 3.xx BusLogic "S" Series Host Adapters: BT-747S/747D/757S/757D/445S/545S/542D BT-542B/742A (revision H) 2.xx BusLogic "A" Series Host Adapters: BT-542B/742A (revision G and below) 0.xx AMI FastDisk VLB/EISA BusLogic Clone Host Adapter */ /* Save the Model Name and Host Adapter Name in the Host Adapter structure. */ TargetPointer = HostAdapter->ModelName; *TargetPointer++ = 'B'; *TargetPointer++ = 'T'; *TargetPointer++ = '-'; for (i = 0; i < sizeof(HostAdapterModelNumber); i++) { Character = HostAdapterModelNumber[i]; if (Character == ' ' || Character == '\0') break; *TargetPointer++ = Character; } *TargetPointer++ = '\0'; /* Save the Firmware Version in the Host Adapter structure. */ TargetPointer = HostAdapter->FirmwareVersion; *TargetPointer++ = BoardID.FirmwareVersion1stDigit; *TargetPointer++ = '.'; *TargetPointer++ = BoardID.FirmwareVersion2ndDigit; if (FirmwareVersion3rdDigit != ' ' && FirmwareVersion3rdDigit != '\0') *TargetPointer++ = FirmwareVersion3rdDigit; *TargetPointer = '\0'; /* Issue the Inquire Firmware Version Letter command. */ if (strcmp(HostAdapter->FirmwareVersion, "3.3") >= 0) { if (BusLogic_Command(HostAdapter, BusLogic_InquireFirmwareVersionLetter, NULL, 0, &FirmwareVersionLetter, sizeof(FirmwareVersionLetter)) != sizeof(FirmwareVersionLetter)) return BusLogic_Failure(HostAdapter, "INQUIRE FIRMWARE VERSION LETTER"); if (FirmwareVersionLetter != ' ' && FirmwareVersionLetter != '\0') *TargetPointer++ = FirmwareVersionLetter; *TargetPointer = '\0'; } /* Save the Host Adapter SCSI ID in the Host Adapter structure. */ HostAdapter->SCSI_ID = Configuration.HostAdapterID; /* Determine the Bus Type and save it in the Host Adapter structure, determine and save the IRQ Channel if necessary, and determine and save the DMA Channel for ISA Host Adapters. */ HostAdapter->HostAdapterBusType = BusLogic_HostAdapterBusTypes[HostAdapter->ModelName[3] - '4']; if (HostAdapter->IRQ_Channel == 0) { if (Configuration.IRQ_Channel9) HostAdapter->IRQ_Channel = 9; else if (Configuration.IRQ_Channel10) HostAdapter->IRQ_Channel = 10; else if (Configuration.IRQ_Channel11) HostAdapter->IRQ_Channel = 11; else if (Configuration.IRQ_Channel12) HostAdapter->IRQ_Channel = 12; else if (Configuration.IRQ_Channel14) HostAdapter->IRQ_Channel = 14; else if (Configuration.IRQ_Channel15) HostAdapter->IRQ_Channel = 15; } if (HostAdapter->HostAdapterBusType == BusLogic_ISA_Bus) { if (Configuration.DMA_Channel5) HostAdapter->DMA_Channel = 5; else if (Configuration.DMA_Channel6) HostAdapter->DMA_Channel = 6; else if (Configuration.DMA_Channel7) HostAdapter->DMA_Channel = 7; } /* Determine whether Extended Translation is enabled and save it in the Host Adapter structure. */ GeometryRegister.All = BusLogic_ReadGeometryRegister(HostAdapter); HostAdapter->ExtendedTranslationEnabled = GeometryRegister.gr.ExtendedTranslationEnabled; /* Save the Scatter Gather Limits, Level Sensitive Interrupt flag, Wide SCSI flag, Differential SCSI flag, SCAM Supported flag, and Ultra SCSI flag in the Host Adapter structure. */ HostAdapter->HostAdapterScatterGatherLimit = ExtendedSetupInformation.ScatterGatherLimit; HostAdapter->DriverScatterGatherLimit = HostAdapter->HostAdapterScatterGatherLimit; if (HostAdapter->HostAdapterScatterGatherLimit > BusLogic_ScatterGatherLimit) HostAdapter->DriverScatterGatherLimit = BusLogic_ScatterGatherLimit; if (ExtendedSetupInformation.Misc.LevelSensitiveInterrupt) HostAdapter->LevelSensitiveInterrupt = true; HostAdapter->HostWideSCSI = ExtendedSetupInformation.HostWideSCSI; HostAdapter->HostDifferentialSCSI = ExtendedSetupInformation.HostDifferentialSCSI; HostAdapter->HostSupportsSCAM = ExtendedSetupInformation.HostSupportsSCAM; HostAdapter->HostUltraSCSI = ExtendedSetupInformation.HostUltraSCSI; /* Determine whether Extended LUN Format CCBs are supported and save the information in the Host Adapter structure. */ if (HostAdapter->FirmwareVersion[0] == '5' || (HostAdapter->FirmwareVersion[0] == '4' && HostAdapter->HostWideSCSI)) HostAdapter->ExtendedLUNSupport = true; /* Issue the Inquire PCI Host Adapter Information command to read the Termination Information from "W" series MultiMaster Host Adapters. */ if (HostAdapter->FirmwareVersion[0] == '5') { if (BusLogic_Command(HostAdapter, BusLogic_InquirePCIHostAdapterInformation, NULL, 0, &PCIHostAdapterInformation, sizeof(PCIHostAdapterInformation)) != sizeof(PCIHostAdapterInformation)) return BusLogic_Failure(HostAdapter, "INQUIRE PCI HOST ADAPTER INFORMATION"); /* Save the Termination Information in the Host Adapter structure. */ if (PCIHostAdapterInformation.GenericInfoValid) { HostAdapter->TerminationInfoValid = true; HostAdapter->LowByteTerminated = PCIHostAdapterInformation.LowByteTerminated; HostAdapter->HighByteTerminated = PCIHostAdapterInformation.HighByteTerminated; } } /* Issue the Fetch Host Adapter Local RAM command to read the AutoSCSI data from "W" and "C" series MultiMaster Host Adapters. */ if (HostAdapter->FirmwareVersion[0] >= '4') { FetchHostAdapterLocalRAMRequest.ByteOffset = BusLogic_AutoSCSI_BaseOffset; FetchHostAdapterLocalRAMRequest.ByteCount = sizeof(AutoSCSIData); if (BusLogic_Command(HostAdapter, BusLogic_FetchHostAdapterLocalRAM, &FetchHostAdapterLocalRAMRequest, sizeof(FetchHostAdapterLocalRAMRequest), &AutoSCSIData, sizeof(AutoSCSIData)) != sizeof(AutoSCSIData)) return BusLogic_Failure(HostAdapter, "FETCH HOST ADAPTER LOCAL RAM"); /* Save the Parity Checking Enabled, Bus Reset Enabled, and Termination Information in the Host Adapter structure. */ HostAdapter->ParityCheckingEnabled = AutoSCSIData.ParityCheckingEnabled; HostAdapter->BusResetEnabled = AutoSCSIData.BusResetEnabled; if (HostAdapter->FirmwareVersion[0] == '4') { HostAdapter->TerminationInfoValid = true; HostAdapter->LowByteTerminated = AutoSCSIData.LowByteTerminated; HostAdapter->HighByteTerminated = AutoSCSIData.HighByteTerminated; } /* Save the Wide Permitted, Fast Permitted, Synchronous Permitted, Disconnect Permitted, Ultra Permitted, and SCAM Information in the Host Adapter structure. */ HostAdapter->WidePermitted = AutoSCSIData.WidePermitted; HostAdapter->FastPermitted = AutoSCSIData.FastPermitted; HostAdapter->SynchronousPermitted = AutoSCSIData.SynchronousPermitted; HostAdapter->DisconnectPermitted = AutoSCSIData.DisconnectPermitted; if (HostAdapter->HostUltraSCSI) HostAdapter->UltraPermitted = AutoSCSIData.UltraPermitted; if (HostAdapter->HostSupportsSCAM) { HostAdapter->SCAM_Enabled = AutoSCSIData.SCAM_Enabled; HostAdapter->SCAM_Level2 = AutoSCSIData.SCAM_Level2; } } /* Initialize fields in the Host Adapter structure for "S" and "A" series MultiMaster Host Adapters. */ if (HostAdapter->FirmwareVersion[0] < '4') { if (SetupInformation.SynchronousInitiationEnabled) { HostAdapter->SynchronousPermitted = 0xFF; if (HostAdapter->HostAdapterBusType == BusLogic_EISA_Bus) { if (ExtendedSetupInformation.Misc.FastOnEISA) HostAdapter->FastPermitted = 0xFF; if (strcmp(HostAdapter->ModelName, "BT-757") == 0) HostAdapter->WidePermitted = 0xFF; } } HostAdapter->DisconnectPermitted = 0xFF; HostAdapter->ParityCheckingEnabled = SetupInformation.ParityCheckingEnabled; HostAdapter->BusResetEnabled = true; } /* Determine the maximum number of Target IDs and Logical Units supported by this driver for Wide and Narrow Host Adapters. */ HostAdapter->MaxTargetDevices = (HostAdapter->HostWideSCSI ? 16 : 8); HostAdapter->MaxLogicalUnits = (HostAdapter->ExtendedLUNSupport ? 32 : 8); /* Select appropriate values for the Mailbox Count, Driver Queue Depth, Initial CCBs, and Incremental CCBs variables based on whether or not Strict Round Robin Mode is supported. If Strict Round Robin Mode is supported, then there is no performance degradation in using the maximum possible number of Outgoing and Incoming Mailboxes and allowing the Tagged and Untagged Queue Depths to determine the actual utilization. If Strict Round Robin Mode is not supported, then the Host Adapter must scan all the Outgoing Mailboxes whenever an Outgoing Mailbox entry is made, which can cause a substantial performance penalty. The host adapters actually have room to store the following number of CCBs internally; that is, they can internally queue and manage this many active commands on the SCSI bus simultaneously. Performance measurements demonstrate that the Driver Queue Depth should be set to the Mailbox Count, rather than the Host Adapter Queue Depth (internal CCB capacity), as it is more efficient to have the queued commands waiting in Outgoing Mailboxes if necessary than to block the process in the higher levels of the SCSI Subsystem. 192 BT-948/958/958D 100 BT-946C/956C/956CD/747C/757C/757CD/445C 50 BT-545C/540CF 30 BT-747S/747D/757S/757D/445S/545S/542D/542B/742A */ if (HostAdapter->FirmwareVersion[0] == '5') HostAdapter->HostAdapterQueueDepth = 192; else if (HostAdapter->FirmwareVersion[0] == '4') HostAdapter->HostAdapterQueueDepth = (HostAdapter->HostAdapterBusType != BusLogic_ISA_Bus ? 100 : 50); else HostAdapter->HostAdapterQueueDepth = 30; if (strcmp(HostAdapter->FirmwareVersion, "3.31") >= 0) { HostAdapter->StrictRoundRobinModeSupport = true; HostAdapter->MailboxCount = BusLogic_MaxMailboxes; } else { HostAdapter->StrictRoundRobinModeSupport = false; HostAdapter->MailboxCount = 32; } HostAdapter->DriverQueueDepth = HostAdapter->MailboxCount; HostAdapter->InitialCCBs = 4 * BusLogic_CCB_AllocationGroupSize; HostAdapter->IncrementalCCBs = BusLogic_CCB_AllocationGroupSize; /* Tagged Qu
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -