VirtualBox

Changeset 101433 in vbox for trunk/src/VBox/Devices/EFI


Ignore:
Timestamp:
Oct 13, 2023 9:51:38 AM (18 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
159491
Message:

Devices/EFI/Firmware/ArmVirtPkg: Start using the VirtualBox Armv8 platform for getting at the FDT instead of relying on the hardcoded PcdDeviceTreeInitialBaseAddress PCD, bugref:10528

This requires disabling the early ID mapping feature (by switching away from ArmPlatformLibQemu to ArmPlatformLibNull) and keeping the MMU disabled until later because the page tables
are fixed and the location of the VirtualBox Armv8 platform descriptor is located at the end of the physical address range which can be different depending on the CPU, and MMIO and RAM regions
are dynamic as well. It is impossible to modify the page tables because they reside in the ROM region and can't be modified (and we don't know the base RAM region when it is activated).

Location:
trunk/src/VBox/Devices/EFI/Firmware/ArmVirtPkg
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware/ArmVirtPkg/ArmVirt.dsc.inc

    r101291 r101433  
    3636!ifdef $(VBOX)
    3737[BuildOptions.Arm]
    38     GCC:*_*_*_CC_FLAGS = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=32 -DHC_ARCH_BITS=32 -DVBOX_REV=$(VBOX_REV)
    39    MSFT:*_*_*_CC_FLAGS = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=32 -DHC_ARCH_BITS=32 -DVBOX_REV=$(VBOX_REV)
    40   INTEL:*_*_*_CC_FLAGS = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=32 -DHC_ARCH_BITS=32 -DVBOX_REV=$(VBOX_REV)
     38    GCC:*_*_*_CC_FLAGS  = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=32 -DHC_ARCH_BITS=32 -DVBOX_REV=$(VBOX_REV)
     39    GCC:*_*_*_ASM_FLAGS = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=32 -DHC_ARCH_BITS=32 -DVBOX_REV=$(VBOX_REV)
     40    GCC:*_*_*_PP_FLAGS  = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=32 -DHC_ARCH_BITS=32 -DVBOX_REV=$(VBOX_REV)
     41   MSFT:*_*_*_CC_FLAGS  = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=32 -DHC_ARCH_BITS=32 -DVBOX_REV=$(VBOX_REV)
     42  INTEL:*_*_*_CC_FLAGS  = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=32 -DHC_ARCH_BITS=32 -DVBOX_REV=$(VBOX_REV)
    4143[BuildOptions.AArch64]
    42     GCC:*_*_*_CC_FLAGS = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=64 -DHC_ARCH_BITS=64 -DVBOX_REV=$(VBOX_REV)
    43    MSFT:*_*_*_CC_FLAGS = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=64 -DHC_ARCH_BITS=64 -DVBOX_REV=$(VBOX_REV)
    44   INTEL:*_*_*_CC_FLAGS = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=64 -DHC_ARCH_BITS=64 -DVBOX_REV=$(VBOX_REV)
     44    GCC:*_*_*_CC_FLAGS  = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=64 -DHC_ARCH_BITS=64 -DVBOX_REV=$(VBOX_REV)
     45    GCC:*_*_*_ASM_FLAGS = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=64 -DHC_ARCH_BITS=64 -DVBOX_REV=$(VBOX_REV)
     46    GCC:*_*_*_PP_FLAGS  = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=64 -DHC_ARCH_BITS=64 -DVBOX_REV=$(VBOX_REV)
     47   MSFT:*_*_*_CC_FLAGS  = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=64 -DHC_ARCH_BITS=64 -DVBOX_REV=$(VBOX_REV)
     48  INTEL:*_*_*_CC_FLAGS  = -DVBOX -DIPRT_NO_CRT -DRT_OS_UEFI -DARCH_BITS=64 -DHC_ARCH_BITS=64 -DVBOX_REV=$(VBOX_REV)
    4549
    4650!ifdef $(SOURCE_DEBUG_ENABLE)
     
    197201
    198202  ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
     203
     204!ifdef $(VBOX)
     205  VBoxArmPlatformLib|VBoxPkg/Library/VBoxArmPlatformLib/VBoxArmPlatformLib.inf
     206!endif
    199207
    200208[LibraryClasses.common.SEC]
  • trunk/src/VBox/Devices/EFI/Firmware/ArmVirtPkg/ArmVirtQemu.dsc

    r101291 r101433  
    102102
    103103[LibraryClasses.AARCH64]
     104!ifndef $(VBOX)
    104105  ArmPlatformLib|ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.inf
     106!else
     107  ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
     108!endif
    105109
    106110[LibraryClasses.ARM]
     
    108112
    109113[LibraryClasses.common.PEIM]
     114!ifndef $(VBOX)
    110115  ArmVirtMemInfoLib|ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf
     116!else
     117  ArmVirtMemInfoLib|VBoxPkg/Library/VBoxVirtMemInfoLib/VBoxVirtMemInfoPeiLib.inf
     118!endif
    111119
    112120!if $(TPM2_ENABLE) == TRUE
     
    131139
    132140[BuildOptions]
     141!ifndef $(VBOX) # Don't clear the XIPFLAGS as we run with MMU disabled (no early ID mapping).
    133142!if $(CAVIUM_ERRATUM_27456) == TRUE
    134143  GCC:*_*_AARCH64_PP_FLAGS = -DCAVIUM_ERRATUM_27456
    135144!else
    136145  GCC:*_*_AARCH64_CC_XIPFLAGS ==
     146!endif
    137147!endif
    138148
  • trunk/src/VBox/Devices/EFI/Firmware/ArmVirtPkg/Library/ArmVirtPsciResetSystemPeiLib/ArmVirtPsciResetSystemPeiLib.c

    r101291 r101433  
    2020#include <Library/HobLib.h>
    2121#include <Library/ResetSystemLib.h>
     22#ifdef VBOX
     23# include <Library/VBoxArmPlatformLib.h>
     24#endif
    2225
    2326#include <IndustryStandard/ArmStdSmc.h>
     
    4245  CONST VOID   *Prop;
    4346
     47#ifndef VBOX
    4448  DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
     49#else
     50  DeviceTreeBase = VBoxArmPlatformFdtGet();
     51#endif
    4552  ASSERT (fdt_check_header (DeviceTreeBase) == 0);
    4653
  • trunk/src/VBox/Devices/EFI/Firmware/ArmVirtPkg/Library/ArmVirtPsciResetSystemPeiLib/ArmVirtPsciResetSystemPeiLib.inf

    r99464 r101433  
    2727  MdeModulePkg/MdeModulePkg.dec
    2828  MdePkg/MdePkg.dec
     29  VBoxPkg/VBoxPkg.dec           # VBox: Added
    2930
    3031[LibraryClasses]
     
    3536  FdtLib
    3637  HobLib
     38  VBoxArmPlatformLib
    3739
    3840[Pcd]
  • trunk/src/VBox/Devices/EFI/Firmware/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c

    r99464 r101433  
    1717#include <Library/SerialPortLib.h>
    1818#include <libfdt.h>
     19#ifdef VBOX
     20# include <Library/VBoxArmPlatformLib.h>
     21#endif
    1922
    2023RETURN_STATUS
     
    6669  RETURN_STATUS       Status;
    6770
     71#ifndef VBOX
    6872  DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
     73#else
     74  DeviceTreeBase = VBoxArmPlatformFdtGet();
     75#endif
    6976
    7077  if ((DeviceTreeBase == NULL) || (fdt_check_header (DeviceTreeBase) != 0)) {
  • trunk/src/VBox/Devices/EFI/Firmware/ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf

    r99464 r101433  
    2424  PcdLib
    2525  FdtLib
     26  VBoxArmPlatformLib            # VBox: Added
    2627
    2728[Packages]
     
    3031  ArmPlatformPkg/ArmPlatformPkg.dec
    3132  ArmVirtPkg/ArmVirtPkg.dec
     33  VBoxPkg/VBoxPkg.dec           # VBox: Added
    3234
    3335[Pcd]
  • trunk/src/VBox/Devices/EFI/Firmware/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c

    r101291 r101433  
    1616#include <Library/PeiServicesLib.h>
    1717#include <libfdt.h>
     18#ifdef VBOX
     19# include <Library/VBoxArmPlatformLib.h>
     20#endif
    1821
    1922#include <Guid/EarlyPL011BaseAddress.h>
     
    5861  EFI_STATUS    Status;
    5962
     63#ifndef VBOX
    6064  Base = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
     65#else
     66  Base = VBoxArmPlatformFdtGet();
     67#endif
    6168  ASSERT (Base != NULL);
    6269  ASSERT (fdt_check_header (Base) == 0);
  • trunk/src/VBox/Devices/EFI/Firmware/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.inf

    r99464 r101433  
    2727  OvmfPkg/OvmfPkg.dec
    2828  SecurityPkg/SecurityPkg.dec
     29  VBoxPkg/VBoxPkg.dec           # VBox: Added
    2930
    3031[FeaturePcd]
Note: See TracChangeset for help on using the changeset viewer.

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