⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 buslogic.c

📁 讲述linux的初始化过程
💻 C
📖 第 1 页 / 共 5 页
字号:
  if (BusLogic_Command(HostAdapter,		       BusLogic_InquireExtendedSetupInformation,		       &RequestedReplyLength,		       sizeof(RequestedReplyLength),		       &ExtendedSetupInformation,		       sizeof(ExtendedSetupInformation))      != sizeof(ExtendedSetupInformation))    Result = false;  /*    Provide tracing information if requested and return.  */  if (BusLogic_GlobalOptions.TraceProbe)    BusLogic_Notice("BusLogic_Check(0x%X): MultiMaster %s\n", HostAdapter,		    HostAdapter->IO_Address, (Result ? "Found" : "Not Found"));  return Result;}/*  BusLogic_ReadHostAdapterConfiguration reads the Configuration Information  from Host Adapter and initializes the Host Adapter structure.*/static boolean BusLogic_ReadHostAdapterConfiguration(BusLogic_HostAdapter_T						     *HostAdapter){  BusLogic_BoardID_T BoardID;  BusLogic_Configuration_T Configuration;  BusLogic_SetupInformation_T SetupInformation;  BusLogic_ExtendedSetupInformation_T ExtendedSetupInformation;  BusLogic_HostAdapterModelNumber_T HostAdapterModelNumber;  BusLogic_FirmwareVersion3rdDigit_T FirmwareVersion3rdDigit;  BusLogic_FirmwareVersionLetter_T FirmwareVersionLetter;  BusLogic_PCIHostAdapterInformation_T PCIHostAdapterInformation;  BusLogic_FetchHostAdapterLocalRAMRequest_T FetchHostAdapterLocalRAMRequest;  BusLogic_AutoSCSIData_T AutoSCSIData;  BusLogic_GeometryRegister_T GeometryRegister;  BusLogic_RequestedReplyLength_T RequestedReplyLength;  unsigned char *TargetPointer, Character;  int TargetID, i;  /*    Configuration Information for FlashPoint Host Adapters is provided in the    FlashPoint_Info structure by the FlashPoint SCCB Manager's Probe Function.    Initialize fields in the Host Adapter structure from the FlashPoint_Info    structure.  */  if (BusLogic_FlashPointHostAdapterP(HostAdapter))    {      FlashPoint_Info_T *FlashPointInfo = &HostAdapter->FlashPointInfo;      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.Bits.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)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -