VirtualBox

Changeset 77729 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 15, 2019 4:38:24 PM (6 years ago)
Author:
vboxsync
Message:

EFI: More adaptations for PCIe chipset, source debugging.

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c

    r77662 r77729  
    4949  switch (HostBridgeDevId) {
    5050    case INTEL_82441_DEVICE_ID:
     51#ifdef VBOX
     52    // HACK ALERT! There is no host bridge device in the PCIe chipset, and the same PIIX4 PM device is used.
     53    case 0xffff:
     54#endif
    5155      Pmba       = POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA);
    5256      PmbaAndVal = ~(UINT32)PIIX4_PMBA_MASK;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c

    r77662 r77729  
    4747  switch (HostBridgeDevId) {
    4848    case INTEL_82441_DEVICE_ID:
     49#ifdef VBOX
     50    // HACK ALERT! There is no host bridge device in the PCIe chipset, and the same PIIX4 PM device is used.
     51    case 0xffff:
     52#endif
    4953      Pmba       = POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA);
    5054      PmbaAndVal = ~(UINT32)PIIX4_PMBA_MASK;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c

    r77662 r77729  
    5151  HostBridgeDevId = PcdGet16 (PcdOvmfHostBridgePciDevId);
    5252  switch (HostBridgeDevId) {
     53#ifdef VBOX
     54    // HACK ALERT! In the PCIe chipset, the same PIIX4 PM device is used.
     55    case INTEL_Q35_MCH_DEVICE_ID:
     56#endif
    5357    case INTEL_82441_DEVICE_ID:
    5458      Pmba = POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA);
    5559      break;
     60#ifndef VBOX
    5661    case INTEL_Q35_MCH_DEVICE_ID:
    5762      Pmba = POWER_MGMT_REGISTER_Q35 (ICH9_PMBASE);
    5863      break;
     64#endif
    5965    default:
    6066      DEBUG ((EFI_D_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n",
  • trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/OvmfPkgIa32.dsc

    r77678 r77729  
    526526!endif
    527527
     528!ifndef $(VBOX)
    528529  # This PCD is used to set the base address of the PCI express hierarchy. It
    529530  # is only consulted when OVMF runs on Q35. In that case it is programmed into
     
    533534  # never lets the RAM below 4 GB exceed 2 GB.
    534535  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x80000000
     536!endif
    535537
    536538!ifdef $(SOURCE_DEBUG_ENABLE)
     
    613615
    614616  gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x00
     617
     618!ifdef $(VBOX)
     619  # This PCD is used to set the base address of the PCI express hierarchy. It
     620  # is only consulted when OVMF runs on Q35. In that case it is programmed into
     621  # the PCIEXBAR register.
     622  #
     623  # On Q35 machine types that QEMU intends to support in the long term, QEMU
     624  # never lets the RAM below 4 GB exceed 2 GB.
     625  #
     626  # On VirtualBox it is dynamic.
     627  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x80000000
     628!endif
    615629
    616630################################################################################
  • trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/OvmfPkgX64.dsc

    r77678 r77729  
    4444  DEFINE SMM_REQUIRE             = FALSE
    4545  DEFINE TLS_ENABLE              = FALSE
     46
     47  DEFINE SOURCE_DEBUG_ENABLE     = TRUE
    4648
    4749  #
     
    104106   MSFT:*_*_*_CC_FLAGS = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=64 -DHC_ARCH_BITS=64 -DVBOX_REV=$(VBOX_REV)
    105107  INTEL:*_*_*_CC_FLAGS = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=64 -DHC_ARCH_BITS=64 -DVBOX_REV=$(VBOX_REV)
     108
     109!ifdef $(SOURCE_DEBUG_ENABLE)
     110   # Get much better source-level debugging
     111   MSFT:DEBUG_*_*_CC_FLAGS = /Od
     112!endif
     113
    106114!endif
    107115
     
    134142  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
    135143!else
     144!ifdef $(SOURCE_DEBUG_ENABLE)
     145  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
     146!else
    136147  PeCoffLib|VBoxPkg/Library/VBoxPeCoffLib/VBoxPeCoffLib.inf
     148!endif
    137149!endif
    138150  CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
     
    182194  FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
    183195
     196!ifdef $(SOURCE_DEBUG_ENABLE)
     197  PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
     198  DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.inf
     199!else
    184200!ifdef $(VBOX)
    185201  PeCoffExtraActionLib|VBoxPkg/Library/VBoxPeCoffExtraActionLib/VBoxPeCoffExtraActionLib.inf
    186202  DebugAgentLib|VBoxPkg/Library/VBoxDebugAgentLib/VBoxDebugAgentLib.inf
    187 !else
    188 !ifdef $(SOURCE_DEBUG_ENABLE)
    189   PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
    190   DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.inf
    191203!else
    192204  PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
     
    247259!endif
    248260!else
     261!ifdef $(SOURCE_DEBUG_ENABLE)
     262  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     263!else
    249264  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     265!endif
    250266!endif
    251267  ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
    252268  ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf
    253 !ifdef $(VBOX)
    254269!ifdef $(SOURCE_DEBUG_ENABLE)
    255270  DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgentLib.inf
    256 !endif
    257271!endif
    258272  HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
     
    279293  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
    280294!else
     295!ifdef $(SOURCE_DEBUG_ENABLE)
     296  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     297  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
     298!else
    281299  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
    282300  PeCoffLib|VBoxPkg/Library/VBoxPeCoffLib/VBoxPeCoffLib.inf
     301!endif
    283302!endif
    284303
     
    297316!else
    298317  DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
    299 !endif  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
     318!endif
     319  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
     320!else
     321!ifdef $(SOURCE_DEBUG_ENABLE)
     322  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     323  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
    300324!else
    301325  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
    302326  PeCoffLib|VBoxPkg/Library/VBoxPeCoffLib/VBoxPeCoffLib.inf
     327!endif
    303328!endif
    304329  PeiResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
     
    325350!endif
    326351!else
     352!ifdef $(SOURCE_DEBUG_ENABLE)
     353  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     354!else
    327355  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     356!endif
    328357!endif
    329358  ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
     
    348377!endif
    349378!else
     379!ifdef $(SOURCE_DEBUG_ENABLE)
     380  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     381!else
    350382  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     383!endif
    351384!endif
    352385  UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
     
    369402!endif
    370403!else
     404!ifdef $(SOURCE_DEBUG_ENABLE)
     405  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     406!else
    371407  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     408!endif
    372409!endif
    373410  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
     
    388425!endif
    389426!else
     427!ifdef $(SOURCE_DEBUG_ENABLE)
     428  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     429!else
    390430  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     431!endif
    391432!endif
    392433  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
     
    422463!endif
    423464!else
     465!ifdef $(SOURCE_DEBUG_ENABLE)
     466  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
     467!else
    424468  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
     469!endif
    425470!endif
    426471  PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
     
    530575!endif
    531576
     577!ifndef $(VBOX)
    532578  # This PCD is used to set the base address of the PCI express hierarchy. It
    533579  # is only consulted when OVMF runs on Q35. In that case it is programmed into
     
    537583  # never lets the RAM below 4 GB exceed 2 GB.
    538584  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x80000000
     585!endif
    539586
    540587!ifdef $(SOURCE_DEBUG_ENABLE)
     
    619666
    620667  gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x00
     668
     669!ifdef $(VBOX)
     670  # This PCD is used to set the base address of the PCI express hierarchy. It
     671  # is only consulted when OVMF runs on Q35. In that case it is programmed into
     672  # the PCIEXBAR register.
     673  #
     674  # On VirtualBox it is dynamic.
     675  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x80000000
     676!endif
    621677
    622678################################################################################
  • trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/PlatformPei/Platform.c

    r77669 r77729  
    271271      // the base of the 32-bit PCI host aperture.
    272272      //
    273       PciExBarBase = FixedPcdGet64 (PcdPciExpressBaseAddress);
     273      PciExBarBase = PcdGet64 (PcdPciExpressBaseAddress);
    274274      ASSERT (TopOfLowRam <= PciExBarBase);
    275275      ASSERT (PciExBarBase <= MAX_UINT32 - SIZE_256MB);
     
    309309      AddIoMemoryRangeHob (TopOfLowRam, McfgBase);
    310310    AddIoMemoryRangeHob (McfgBase + McfgSize, 0xFC000000);
     311    PcdSet64S (PcdPciExpressBaseAddress, McfgBase);
    311312#else
    312313    AddIoMemoryRangeHob (TopOfLowRam < BASE_2GB ?
     
    470471  // for DXE's page tables to cover the MMCONFIG area.
    471472  //
    472   PciExBarBase.Uint64 = FixedPcdGet64 (PcdPciExpressBaseAddress);
     473  PciExBarBase.Uint64 = PcdGet64 (PcdPciExpressBaseAddress);
    473474  ASSERT ((PciExBarBase.Uint32[1] & MCH_PCIEXBAR_HIGHMASK) == 0);
    474475  ASSERT ((PciExBarBase.Uint32[0] & MCH_PCIEXBAR_LOWMASK) == 0);
     
    755756  //
    756757  mHostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
     758#ifdef VBOX
     759  // HACK ALERT! There is no host bridge device in the PCIe chipset, but we pretend it's a 3 Series chip.
     760  if (mHostBridgeDevId == 0xffff)
     761        mHostBridgeDevId = INTEL_Q35_MCH_DEVICE_ID;
     762#endif
    757763
    758764  if (FeaturePcdGet (PcdSmmSmramRequire)) {
  • trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/PlatformPei/PlatformPei.inf

    r77662 r77729  
    8989  gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes
    9090  gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress
     91  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
    9192  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
    9293  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
     
    105106  gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize
    106107
    107 [FixedPcd]
    108   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
     108#[FixedPcd]
     109#  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
    109110
    110111[FeaturePcd]
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette