From 15d6e397e9b6aa583a094e1a792ab870e296bd33 Mon Sep 17 00:00:00 2001 From: Amos Bu Date: Thu, 26 Sep 2024 10:19:13 +0800 Subject: [PATCH] UefiPayloadPkg: Add AARCH64 support Add basic support for FIT image on the AARCH64 architecture, reuse exsitting DSC and FDF files for IA32, X64 and AARCH64 architectures. Introduce new PCD: PcdUseUniversalPayloadSerialPort to indicate which serial port module is used due to some serial port parameters are fixed for ARM SoC and Platform. Please use following command to build AARCH64 UPL FIT image: " export GCC5_AARCH64_PREFIX=aarch64-linux-gnu- python UefiPayloadPkg/UniversalPayloadBuild.py -a AARCH64 -t GCC5 -b DEBUG --Fit " Signed-off-by: Amos Bu Signed-off-by: Ajan Zhong --- .../PciSegmentInfoLibAcpiBoardInfo.inf | 1 + .../Library/PlatformHookLib/PlatformHookLib.c | 4 + .../UefiPayloadEntry/AArch64/DxeHandoff.c | 69 +++ .../UefiPayloadEntry/AArch64/DxeLoadFuncFit.c | 26 + .../UefiPayloadEntry/AArch64/StubLib.c | 17 + .../FitUniversalPayloadEntry.inf | 9 +- UefiPayloadPkg/UefiPayloadEntry/PrintHob.c | 2 + .../UefiPayloadEntry/UefiPayloadEntry.h | 6 + .../UefiPayloadEntry/UefiPayloadEntry.inf | 9 +- .../UniversalPayloadEntry.inf | 8 +- UefiPayloadPkg/UefiPayloadPkg.dec | 5 + UefiPayloadPkg/UefiPayloadPkg.dsc | 569 ++++++++++++++++-- UefiPayloadPkg/UefiPayloadPkg.fdf | 50 +- UefiPayloadPkg/UniversalPayloadBuild.py | 7 +- 14 files changed, 716 insertions(+), 66 deletions(-) create mode 100644 UefiPayloadPkg/UefiPayloadEntry/AArch64/DxeHandoff.c create mode 100644 UefiPayloadPkg/UefiPayloadEntry/AArch64/DxeLoadFuncFit.c create mode 100644 UefiPayloadPkg/UefiPayloadEntry/AArch64/StubLib.c diff --git a/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.inf b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.inf index 2ec700e08c10..273287a24757 100644 --- a/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.inf +++ b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.inf @@ -39,6 +39,7 @@ [Guids] gUefiAcpiBoardInfoGuid gUplPciSegmentInfoHobGuid + gUniversalPayloadPciRootBridgeInfoGuid [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration diff --git a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c b/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c index efaab326bb68..962ebd666405 100644 --- a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c +++ b/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c @@ -89,11 +89,15 @@ PlatformHookSerialPortInitialize ( return Status; } + #if FixedPcdGetBool (PcdUseUniversalPayloadSerialPort) == 1 + Status = PcdSet32S (PcdSerialBaudRate, SerialPortInfo->BaudRate); if (RETURN_ERROR (Status)) { return Status; } + #endif + return RETURN_SUCCESS; } diff --git a/UefiPayloadPkg/UefiPayloadEntry/AArch64/DxeHandoff.c b/UefiPayloadPkg/UefiPayloadEntry/AArch64/DxeHandoff.c new file mode 100644 index 000000000000..aa296769d189 --- /dev/null +++ b/UefiPayloadPkg/UefiPayloadEntry/AArch64/DxeHandoff.c @@ -0,0 +1,69 @@ +/** @file + Generic version of arch-specific functionality for DxeLoad. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ Copyright 2024 Google LLC + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include +#include +#include + +#include "UefiPayloadEntry.h" + +#define STACK_SIZE 0x20000 + +/** + Transfers control to DxeCore. + + This function performs a CPU architecture specific operations to execute + the entry point of DxeCore with the parameters of HobList. + It also installs EFI_END_OF_PEI_PPI to signal the end of PEI phase. + + @param DxeCoreEntryPoint The entry point of DxeCore. + @param HobList The start of HobList passed to DxeCore. + +**/ +VOID +HandOffToDxeCore ( + IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint, + IN EFI_PEI_HOB_POINTERS HobList + ) +{ + VOID *BaseOfStack; + VOID *TopOfStack; + + // + // Allocate 128KB for the Stack + // + BaseOfStack = AllocatePages (EFI_SIZE_TO_PAGES (STACK_SIZE)); + ASSERT (BaseOfStack != NULL); + + // + // Compute the top of the stack we were allocated. Pre-allocate a UINTN + // for safety. + // + TopOfStack = (VOID *)((UINTN)BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT); + TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT); + + // + // Update the contents of BSP stack HOB to reflect the real stack info passed to DxeCore. + // + UpdateStackHob ((EFI_PHYSICAL_ADDRESS)(UINTN)BaseOfStack, STACK_SIZE); + + // + // Transfer the control to the entry point of DxeCore. + // + SwitchStack ( + (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint, + HobList.Raw, + NULL, + TopOfStack + ); +} diff --git a/UefiPayloadPkg/UefiPayloadEntry/AArch64/DxeLoadFuncFit.c b/UefiPayloadPkg/UefiPayloadEntry/AArch64/DxeLoadFuncFit.c new file mode 100644 index 000000000000..a2782207c749 --- /dev/null +++ b/UefiPayloadPkg/UefiPayloadEntry/AArch64/DxeLoadFuncFit.c @@ -0,0 +1,26 @@ +/** @file + aarch64-specifc functionality for Module Entry Point. + + Copyright 2024 Google LLC + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include "UefiPayloadEntry.h" + +/** + Entry point to the C language phase of UEFI payload. + @param[in] FdtBaseAddr Pointer to the FDT + @param[in] AdditionalPara Not used yet + @retval It will not return if SUCCESS, and return error + when passing bootloader parameter. +**/ +EFI_STATUS +EFIAPI +_ModuleEntryPoint ( + IN UINTN FdtBaseAddr, + IN UINTN AddtionalPara + ) +{ + return FitUplEntryPoint (FdtBaseAddr); +} diff --git a/UefiPayloadPkg/UefiPayloadEntry/AArch64/StubLib.c b/UefiPayloadPkg/UefiPayloadEntry/AArch64/StubLib.c new file mode 100644 index 000000000000..2ed309ff1ca0 --- /dev/null +++ b/UefiPayloadPkg/UefiPayloadEntry/AArch64/StubLib.c @@ -0,0 +1,17 @@ +/** @file + Null instance of CPU related Library for AArch64 specific services. + + Copyright 2024 Google LLC + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include "UefiPayloadEntry.h" + +VOID +EFIAPI +InitializeFloatingPointUnits ( + VOID + ) +{ +} diff --git a/UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.inf index 5887830e3f39..b41b3c93fcd3 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.inf @@ -2,6 +2,7 @@ # This is the first module for UEFI payload. # # Copyright (c) 2023, Intel Corporation. All rights reserved.
+# Copyright 2024 Google LLC # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -17,7 +18,7 @@ # # The following information is for reference only and not required by the build tools. # -# VALID_ARCHITECTURES = IA32 X64 +# VALID_ARCHITECTURES = IA32 X64 AARCH64 # [Sources] @@ -42,6 +43,10 @@ RiscV64/DxeLoadFunc.c RiscV64/DxeLoadFuncFit.c +[Sources.AARCH64] + AArch64/DxeHandoff.c + AArch64/DxeLoadFuncFit.c + [Packages] MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec @@ -86,7 +91,7 @@ [FeaturePcd.X64] gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplBuildPageTables ## CONSUMES -[Pcd.IA32,Pcd.X64,Pcd.RISCV64] +[Pcd.IA32,Pcd.X64,Pcd.RISCV64,Pcd.AARCH64] gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ## CONSUMES diff --git a/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c index 44c99774ee29..2211c6690e1c 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c +++ b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c @@ -271,7 +271,9 @@ PrintMemoryTypeInfoGuidHob ( // GUID_HOB_PRINT_HANDLE GuidHobPrintHandleTable[] = { { &gUniversalPayloadAcpiTableGuid, PrintAcpiGuidHob, "gUniversalPayloadAcpiTableGuid(ACPI table Guid)" }, + #if FixedPcdGetBool (PcdUseUniversalPayloadSerialPort) == 1 { &gUniversalPayloadSerialPortInfoGuid, PrintSerialGuidHob, "gUniversalPayloadSerialPortInfoGuid(Serial Port Info)" }, + #endif { &gUniversalPayloadSmbios3TableGuid, PrintSmbios3GuidHob, "gUniversalPayloadSmbios3TableGuid(SmBios Guid)" }, { &gUniversalPayloadSmbiosTableGuid, PrintSmbiosTablGuidHob, "gUniversalPayloadSmbiosTableGuid(SmBios Guid)" }, { &gUefiAcpiBoardInfoGuid, PrintAcpiBoardInfoGuidHob, "gUefiAcpiBoardInfoGuid(Acpi Guid)" }, diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h index 09fce8dbcf35..077e526ea8ea 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h @@ -274,4 +274,10 @@ UplEntryPoint ( IN UINTN BootloaderParameter ); +VOID +EFIAPI +InitializeFloatingPointUnits ( + VOID + ); + #endif diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf index e84ef664d3d5..0f9b96f3c5d2 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf @@ -18,7 +18,7 @@ # # The following information is for reference only and not required by the build tools. # -# VALID_ARCHITECTURES = IA32 X64 +# VALID_ARCHITECTURES = IA32 X64 AARCH64 # [Sources] @@ -38,6 +38,11 @@ X64/VirtualMemory.c X64/DxeLoadFunc.c +[Sources.AARCH64] + AArch64/DxeHandoff.c + AArch64/DxeLoadFuncFit.c + AArch64/StubLib.c + [Packages] MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec @@ -73,7 +78,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplBuildPageTables ## CONSUMES -[Pcd.IA32,Pcd.X64] +[Pcd.IA32,Pcd.X64,Pcd.AARCH64] gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask ## CONSUMES diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf index 01bb9a118a7d..dd7ed69b8c6f 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf @@ -15,7 +15,7 @@ # # The following information is for reference only and not required by the build tools. # -# VALID_ARCHITECTURES = IA32 X64 +# VALID_ARCHITECTURES = IA32 X64 AARCH64 # [Sources] UniversalPayloadEntry.c @@ -32,6 +32,10 @@ X64/VirtualMemory.h X64/VirtualMemory.c X64/DxeLoadFunc.c +[Sources.AARCH64] + AArch64/DxeHandoff.c + AArch64/DxeLoadFuncFit.c + AArch64/StubLib.c [Packages] MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec @@ -67,7 +71,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES [FeaturePcd.X64] gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplBuildPageTables ## CONSUMES -[Pcd.IA32,Pcd.X64] +[Pcd.IA32,Pcd.X64,Pcd.AARCH64] gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ## CONSUMES diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec b/UefiPayloadPkg/UefiPayloadPkg.dec index 900642bc1129..a6ab2dd81555 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dec +++ b/UefiPayloadPkg/UefiPayloadPkg.dec @@ -103,3 +103,8 @@ gUefiPayloadPkgTokenSpaceGuid.PcdPciReservedPMemAbove4GBLimit|0x0000000000000000 gUefiPayloadPkgTokenSpaceGuid.SizeOfIoSpace|0|UINT8|0x0000002B gUefiPayloadPkgTokenSpaceGuid.PcdFDTPageSize|8|UINT8|0x0000002C + +## Indicates if Universal Payload Serial Port feature is used +#- PcdUseUniversalPayloadSerialPort is TRUE, Serial Port parameters will be updated +#- PcdUseUniversalPayloadSerialPort is FALSE, Serial Port parameters are fixed +gUefiPayloadPkgTokenSpaceGuid.PcdUseUniversalPayloadSerialPort|TRUE|BOOLEAN|0x0000002D diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc index 9ff326a6cb67..1002d6f85840 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -5,6 +5,7 @@ # # Copyright (c) 2014 - 2023, Intel Corporation. All rights reserved.
# Copyright (c) Microsoft Corporation. +# Copyright (c) 2024, Google LLC. # SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -19,7 +20,7 @@ PLATFORM_GUID = F71608AB-D63D-4491-B744-A99998C8CD96 PLATFORM_VERSION = 0.1 DSC_SPECIFICATION = 0x00010005 - SUPPORTED_ARCHITECTURES = IA32|X64 + SUPPORTED_ARCHITECTURES = IA32|X64|AARCH64 BUILD_TARGETS = DEBUG|RELEASE|NOOPT SKUID_IDENTIFIER = DEFAULT OUTPUT_DIRECTORY = Build/UefiPayloadPkg$(BUILD_ARCH) @@ -160,19 +161,31 @@ DEFINE SECURE_BOOT_ENABLE = FALSE [BuildOptions] +!if "AARCH64" in "$(ARCH)" +# AARCH compile flags + GCC:*_*_*_CC_FLAGS = -mcmodel=tiny -mstrict-align +!else +# IA32 and AMD64 compile flags *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES !if $(USE_CBMEM_FOR_CONSOLE) == FALSE GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG INTEL:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG MSFT:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG !endif +!endif [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] +!if "AARCH64" in "$(ARCH)" +# AARCH link flags + GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x10000 +!else +# IA32 and AMD64 link flags GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 XCODE:*_*_*_DLINK_FLAGS = -seg1addr 0x1000 -segalign 0x1000 XCODE:*_*_*_MTOC_FLAGS = -align 0x1000 CLANGPDB:*_*_*_DLINK_FLAGS = /ALIGN:4096 MSFT:*_*_*_DLINK_FLAGS = /ALIGN:4096 +!endif ################################################################################ # @@ -202,23 +215,14 @@ # Basic # BaseLib|MdePkg/Library/BaseLib/BaseLib.inf - BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf -!if $(PCIE_BASE_SUPPORT) == FALSE - PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf - PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf -!else - PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf - PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf -!endif PciSegmentLib|MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLibSegmentInfo.inf PciSegmentInfoLib|UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.inf PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf - CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf DxeHobListLib|UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.inf !if $(CRYPTO_PROTOCOL_SUPPORT) == TRUE @@ -346,8 +350,17 @@ SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf !endif + BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf +!if $(PCIE_BASE_SUPPORT) == FALSE + PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf + PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf +!else + PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf + PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf +!endif -[LibraryClasses.X64] +[LibraryClasses.IA32, LibraryClasses.X64] + CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf # # CPU # @@ -363,6 +376,58 @@ CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf +[LibraryClasses.AARCH64] + ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf + ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf + ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf + ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf + EfiResetSystemLib|ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf + PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf + PL011UartClockLib|ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf + SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf + + QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioDxeLib.inf + QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf + QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf + QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf + + TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf + VirtNorFlashPlatformLib|OvmfPkg/Library/FdtNorFlashQemuLib/FdtNorFlashQemuLib.inf + + # ARM Architectural Libraries + ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf + ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf + ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf + ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf + CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf + DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf + + # ARM PL031 RTC Driver + RealTimeClockLib|ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf + TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf + + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf + DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf + DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf + + OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf + PeiHardwareInfoLib|OvmfPkg/Library/HardwareInfoLib/PeiHardwareInfoLib.inf + QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf + + # PCI Libraries + DxeHardwareInfoLib|OvmfPkg/Library/HardwareInfoLib/DxeHardwareInfoLib.inf + PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf + PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPciSegmentLib.inf + PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf + PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf + + ArmPlatformLib|ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.inf + VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf + VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf + [LibraryClasses.common.SEC] HobLib|UefiPayloadPkg/Library/PayloadEntryHobLib/HobLib.inf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf @@ -395,9 +460,6 @@ ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf -[LibraryClasses.X64.DXE_DRIVER] - CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf - MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf !if $(SOURCE_DEBUG_ENABLE) DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf !endif @@ -473,14 +535,19 @@ [PcdsFeatureFlag] gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE + +[PcdsFeatureFlag.IA32, PcdsFeatureFlag.X64] + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|TRUE + gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmEnableBspElection|FALSE ## This PCD specified whether ACPI SDT protocol is installed. gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdHiiOsRuntimeSupport|FALSE gEfiMdeModulePkgTokenSpaceGuid.PcdPciDegradeResourceForOptionRom|FALSE -[PcdsFeatureFlag.X64] - gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|TRUE - gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmEnableBspElection|FALSE +[PcdsFeatureFlag.AARCH64] + gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderPciTranslation|TRUE + gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderMmioTranslation|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE [PcdsFixedAtBuild] gEfiMdePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel|1 @@ -498,7 +565,6 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable|TRUE gUefiPayloadPkgTokenSpaceGuid.PcdHandOffFdtEnable|FALSE - gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 } gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80, 0xab, 0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 0xd8, 0x95, 0x41 } @@ -549,17 +615,89 @@ gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04 !endif -[PcdsPatchableInModule.X64] +[PcdsFixedAtBuild.AARCH64] + gArmTokenSpaceGuid.PcdVFPEnabled|1 + + # System Memory Base -- fixed at 0x4000_0000 + gArmTokenSpaceGuid.PcdSystemMemoryBase|0x40000000 + + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x4007c000 + gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000 + + # Size of the region used by UEFI in permanent memory (Reserved 64MB) + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000 + + # + # ARM General Interrupt Controller + # + gArmTokenSpaceGuid.PcdGicDistributorBase|0x8000000 + gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x80a0000 + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x8080000 + + # + # Enable NX memory protection for all non-code regions, including OEM and OS + # reserved ones, with the exception of LoaderData regions, of which OS loaders + # (i.e., GRUB) may assume that its contents are executable. + # + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xC000000000007FD1 + + # initial location of the device tree blob passed by QEMU -- base of DRAM + gUefiOvmfPkgTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress|0x40000000 + + # + # The maximum physical I/O addressability of the processor, set with + # BuildCpuHob(). + # + gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|16 + + # + # Enable the non-executable DXE stack. (This gets set up by DxeIpl) + # + gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE + + # Shadowing PEI modules is absolutely pointless when the NOR flash is emulated + gEfiMdeModulePkgTokenSpaceGuid.PcdShadowPeimOnBoot|FALSE + + # System Memory Size -- 128 MB initially, actual size will be fetched from DT + gArmTokenSpaceGuid.PcdSystemMemorySize|0x8000000 + + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize | 0x40000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize | 0x40000 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize | 0x40000 + + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x9000000 + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|1 + gEfiMdeModulePkgTokenSpaceGuid.PcdPciSerialParameters|$(PCI_SERIAL_PARAMETERS) + + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosEntryPointProvideMethod|0x2 + + # + # AARCH64 use PL011 Serial Port device instead of UniversalPayload Serial + # + gUefiPayloadPkgTokenSpaceGuid.PcdUseUniversalPayloadSerialPort|FALSE + +[PcdsPatchableInModule.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 } + gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x7 + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000004F + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|$(MAX_SIZE_NON_POPULATE_CAPSULE) + +[PcdsPatchableInModule.IA32, PcdsPatchableInModule.X64] !if $(NETWORK_DRIVER_ENABLE) == TRUE gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE !endif gUefiPayloadPkgTokenSpaceGuid.SizeOfIoSpace|16 gUefiPayloadPkgTokenSpaceGuid.PcdFDTPageSize|8 -[PcdsPatchableInModule.common] - gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 } - gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x7 - gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000004F + # + # The following parameters are set by Library/PlatformHookLib + # + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x3F8 + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate|$(BAUD_RATE) + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|1 + !if $(USE_CBMEM_FOR_CONSOLE) == FALSE !if $(SOURCE_DEBUG_ENABLE) gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17 @@ -573,15 +711,21 @@ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x03 !endif !endif - gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|$(MAX_SIZE_NON_POPULATE_CAPSULE) - # - # The following parameters are set by Library/PlatformHookLib - # - gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|FALSE - gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x3F8 - gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate|$(BAUD_RATE) + +[PcdsPatchableInModule.AARCH64] + gUefiPayloadPkgTokenSpaceGuid.SizeOfIoSpace|16 + gUefiPayloadPkgTokenSpaceGuid.PcdFDTPageSize|8 + + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x9000000 gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|1 +!if $(TARGET) == DEBUG + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x07 +!else + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x03 +!endif + # # Enable these parameters to be set on the command line # @@ -603,11 +747,7 @@ # ################################################################################ -[PcdsDynamicExDefault] - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|$(UART_DEFAULT_BAUD_RATE) - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|$(UART_DEFAULT_DATA_BITS) - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|$(UART_DEFAULT_PARITY) - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits|$(UART_DEFAULT_STOP_BITS) +[PcdsDynamicExDefault.common] gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|$(DEFAULT_TERMINAL_TYPE) gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdMrIovSupport|FALSE @@ -638,6 +778,23 @@ # Disable SMM S3 script gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed|FALSE + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE + +[PcdsDynamicExDefault.IA32, PcdsDynamicExDefault.X64] + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|$(UART_DEFAULT_BAUD_RATE) + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|$(UART_DEFAULT_DATA_BITS) + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|$(UART_DEFAULT_PARITY) + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits|$(UART_DEFAULT_STOP_BITS) + + gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER) + gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister|$(RTC_TARGET_REGISTER) + + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0 + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize|0 + ## This PCD defines the video horizontal resolution. # This PCD could be set to 0 then video resolution could be at highest resolution. gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|0 @@ -649,18 +806,55 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|0 ## The PCD is used to specify the video vertical resolution of text setup. gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|0 - gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|31 gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|100 - gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0 - gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize|0 - gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase|0 - gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed|FALSE - gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled|0 - gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE - gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER) - gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister|$(RTC_TARGET_REGISTER) +[PcdsDynamicExDefault.AARCH64] + + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase | 0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 | 0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 | 0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase | 0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase | 0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 | 0 + + # Timer IRQs + # PPI #13 + gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|29 + # PPI #14 + gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|30 + # PPI #11 -- Not used in QEMU platform + gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0 + # PPI #10 + gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|26 + gArmTokenSpaceGuid.PcdArmArchTimerHypVirtIntrNum|0x0 + + # PL031 RealTimeClock + gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x9010000 + + # set PcdPciExpressBaseAddress to MAX_UINT64, which signifies that this + # PCD and PcdPciDisableBusEnumeration above have not been assigned yet + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x4010000000 + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize|0xfffffff + gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation|0x0 + + # + # Set video resolution for boot options and for text setup. + # PlatformDxe can set the former at runtime. + # + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1280 + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|800 + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640 + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480 + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|0 + + # + # SMBIOS entry point version + # + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion|0x0300 + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosDocRev|0x0 + gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated|FALSE ################################################################################ # @@ -689,7 +883,7 @@ !else UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf !endif -!else +!elseif "X64" in "$(ARCH)" [Components.X64] !if $(UNIVERSAL_PAYLOAD) == TRUE !if $(UNIVERSAL_PAYLOAD_FORMAT) == "ELF" @@ -710,6 +904,29 @@ !else UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf !endif +!else + [Components.AARCH64] + + !if $(UNIVERSAL_PAYLOAD) == TRUE + !if $(UNIVERSAL_PAYLOAD_FORMAT) == "ELF" + UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf + !elseif $(UNIVERSAL_PAYLOAD_FORMAT) == "FIT" + UefiPayloadPkg/UefiPayloadEntry/FitUniversalPayloadEntry.inf { + + !if gUefiPayloadPkgTokenSpaceGuid.PcdHandOffFdtEnable == TRUE + FdtLib|MdePkg/Library/BaseFdtLib/BaseFdtLib.inf + CustomFdtNodeParserLib|UefiPayloadPkg/Library/CustomFdtNodeParserLib/CustomFdtNodeParserLib.inf + NULL|UefiPayloadPkg/Library/FdtParserLib/FdtParseLib.inf + !endif + NULL|UefiPayloadPkg/Library/HobParseLib/HobParseLib.inf + } + !else + UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf + !endif + !else + UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf + !endif + !endif # @@ -842,6 +1059,7 @@ MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf FatPkg/EnhancedFatDxe/Fat.inf + !if $(ATA_ENABLE) == TRUE MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf @@ -951,6 +1169,221 @@ !endif !endif +[Components.AARCH64] + # + # DXE + # + MdeModulePkg/Core/Dxe/DxeMain.inf + + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf + + # + # Architectural Protocols + # + ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf + ArmPkg/Drivers/CpuDxe/CpuDxe.inf + ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf + UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf + +!if $(MEMORY_TEST) == "GENERIC" + MdeModulePkg/Universal/MemoryTest/GenericMemoryTestDxe/GenericMemoryTestDxe.inf +!elseif $(MEMORY_TEST) == "NULL" + MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf +!endif + + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf { + + NULL|EmbeddedPkg/Library/NvVarStoreFormattedLib/NvVarStoreFormattedLib.inf + } + MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + MdeModulePkg/Universal/Metronome/Metronome.inf + + # + # Console Support + # + MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf +!if $(DISABLE_SERIAL_TERMINAL) == FALSE + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf +!endif + UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutputDxe.inf + + # + # ISA Support + # +!if $(SERIAL_DRIVER_ENABLE) == TRUE + MdeModulePkg/Universal/SerialDxe/SerialDxe.inf +!endif +!if $(SIO_BUS_ENABLE) == TRUE + OvmfPkg/SioBusDxe/SioBusDxe.inf +!endif +!if $(PS2_KEYBOARD_ENABLE) == TRUE + MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf +!endif +!if $(PS2_MOUSE_ENABLE) == TRUE + MdeModulePkg/Bus/Isa/Ps2MouseDxe/Ps2MouseDxe.inf +!endif + + MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + + ArmPkg/Drivers/ArmGic/ArmGicDxe.inf + ArmPkg/Drivers/TimerDxe/TimerDxe.inf + OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf { + + # don't use unaligned CopyMem () on the UEFI varstore NOR flash region + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + } + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + + SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf + + # + # Status Code Routing + # + MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf + MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf + + # + # Platform Driver + # + OvmfPkg/PlatformDxe/Platform.inf + OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf + OvmfPkg/Fdt/HighMemDxe/HighMemDxe.inf + OvmfPkg/VirtioBlkDxe/VirtioBlk.inf + OvmfPkg/VirtioScsiDxe/VirtioScsi.inf + OvmfPkg/VirtioNetDxe/VirtioNet.inf + OvmfPkg/VirtioRngDxe/VirtioRng.inf + OvmfPkg/VirtioSerialDxe/VirtioSerial.inf + + # + # FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs + # + FatPkg/EnhancedFatDxe/Fat.inf + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf + OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf + + # + # Bds + # + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf { + + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + + MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf + MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf + MdeModulePkg/Universal/EbcDxe/EbcDxe.inf + MdeModulePkg/Universal/BdsDxe/BdsDxe.inf + + MdeModulePkg/Logo/LogoDxe.inf + MdeModulePkg/Application/UiApp/UiApp.inf { + + NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf + NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf + NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf + } + MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf + OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf { + + NULL|OvmfPkg/Library/BlobVerifierLibNull/BlobVerifierLibNull.inf + } + + # + # SCSI Bus and Disk Driver + # + MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf + MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf + +!if $(ATA_ENABLE) == TRUE + MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf + MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf +!endif + MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf + MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf + MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf +!if $(NVME_ENABLE) == TRUE + MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf +!endif + +!if $(RAM_DISK_ENABLE) == TRUE + MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf +!endif + # + # SD/eMMC Support + # +!if $(SD_ENABLE) == TRUE + MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.inf + MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.inf + MdeModulePkg/Bus/Sd/SdDxe/SdDxe.inf +!endif + + # + # SMBIOS Support + # + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf { + + NULL|OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.inf + } + + # + # PCI support + # + UefiCpuPkg/CpuMmio2Dxe/CpuMmio2Dxe.inf { + + NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf + } + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf + MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf { + + PciHostBridgeLib|UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf + } + OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf + OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf + OvmfPkg/Virtio10Dxe/Virtio10.inf + + # + # Video support + # + OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf + OvmfPkg/VirtioGpuDxe/VirtioGpu.inf + + # + # USB Support + # + MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf + MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf + MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf + MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf + MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf + MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf + MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf + + # + # Hash2 Protocol Support + # + SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.inf + + # + # ACPI Support + # + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + OvmfPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf + + #------------------------------ # Build the shell #------------------------------ @@ -1021,4 +1454,50 @@ SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf } +[Components.AARCH64] + ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf { + + ## This flag is used to control initialization of the shell library + # This should be FALSE for compiling the dynamic command. + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE + } + ShellPkg/Application/Shell/Shell.inf { + + ## This flag is used to control initialization of the shell library + # This should be FALSE for compiling the shell application itself only. + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE + + #------------------------------ + # Basic commands + #------------------------------ + + + NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf + NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf + NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf + NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf + NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf + NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf + + #------------------------------ + # Networking commands + #------------------------------ + + + NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf + + #------------------------------ + # Support libraries + #------------------------------ + + + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf + OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf + ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf + SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf + } + !endif diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf b/UefiPayloadPkg/UefiPayloadPkg.fdf index e788f27cc122..f33f345741af 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.fdf +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf @@ -4,6 +4,7 @@ # Provides drivers and definitions to create uefi payload for bootloaders. # # Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.
+# Copyright (c) 2024, Google LLC. # SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -153,31 +154,52 @@ INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf -!if $(CRYPTO_PROTOCOL_SUPPORT) == TRUE -!if $(CRYPTO_DRIVER_EXTERNAL_SUPPORT) == FALSE -INF CryptoPkg/Driver/CryptoDxe.inf -!endif +!if "X64" IN "$(ARCH)" + INF UefiCpuPkg/CpuDxe/CpuDxe.inf + INF MdeModulePkg/Universal/Metronome/Metronome.inf + INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf + + !if $(CRYPTO_PROTOCOL_SUPPORT) == TRUE + !if $(CRYPTO_DRIVER_EXTERNAL_SUPPORT) == FALSE + INF CryptoPkg/Driver/CryptoDxe.inf + !endif + !endif + + !if $(TIMER_SUPPORT) == "HPET" + INF PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf + !elseif $(TIMER_SUPPORT) == "LAPIC" + INF OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf + !endif +!elseif "AARCH64" IN "$(ARCH)" + INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf + INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf + INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf + + INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + INF OvmfPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf + INF UefiCpuPkg/CpuMmio2Dxe/CpuMmio2Dxe.inf + INF OvmfPkg/Virtio10Dxe/Virtio10.inf + INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf + INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf + INF OvmfPkg/VirtioGpuDxe/VirtioGpu.inf + + INF OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf + INF OvmfPkg/PlatformDxe/Platform.inf !endif + !if $(SECURITY_STUB_ENABLE) == TRUE -INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf !endif -INF UefiCpuPkg/CpuDxe/CpuDxe.inf -!if $(TIMER_SUPPORT) == "HPET" -INF PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf -!elseif $(TIMER_SUPPORT) == "LAPIC" -INF OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf -!endif -INF MdeModulePkg/Universal/Metronome/Metronome.inf -INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf +INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf !if $(DISABLE_RESET_SYSTEM) == FALSE INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf !endif -INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf !if $(PERFORMANCE_MEASUREMENT_ENABLE) INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf !endif diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py b/UefiPayloadPkg/UniversalPayloadBuild.py index c56194e23163..3d1a17754407 100644 --- a/UefiPayloadPkg/UniversalPayloadBuild.py +++ b/UefiPayloadPkg/UniversalPayloadBuild.py @@ -137,6 +137,9 @@ def BuildUniversalPayload(Args): elif Args.Arch == 'RISCV64': BuildArch = "RISCV64" FitArch = "RISCV64" + elif Args.Arch == 'AARCH64': + BuildArch = "AARCH64" + FitArch = "AARCH64" else: print("Incorrect arch option provided") @@ -265,6 +268,7 @@ def BuildUniversalPayload(Args): # Open PECOFF relocation table binary. # RelocBinary = b'' + PeCoff = pefile.PE (TargetRebaseFile) if hasattr(PeCoff, 'DIRECTORY_ENTRY_BASERELOC'): for reloc in PeCoff.DIRECTORY_ENTRY_BASERELOC: @@ -284,6 +288,7 @@ def BuildUniversalPayload(Args): TempBinary.close () TianoEntryBinary = TianoBinary + RelocBinary + TianoEntryBinary += (b'\x00' * (0x1000 - (len(TianoBinary) % 0x1000))) TianoEntryBinarySize = len (TianoEntryBinary) @@ -312,7 +317,7 @@ def main(): parser = argparse.ArgumentParser(description='For building Universal Payload') parser.add_argument('-t', '--ToolChain') parser.add_argument('-b', '--Target', default='DEBUG') - parser.add_argument('-a', '--Arch', choices=['IA32', 'X64', 'RISCV64'], help='Specify the ARCH for payload entry module. Default build X64 image.', default ='X64') + parser.add_argument('-a', '--Arch', choices=['IA32', 'X64', 'RISCV64', 'AARCH64'], help='Specify the ARCH for payload entry module. Default build X64 image.', default ='X64') parser.add_argument("-D", "--Macro", action="append", default=["UNIVERSAL_PAYLOAD=TRUE"]) parser.add_argument('-i', '--ImageId', type=str, help='Specify payload ID (16 bytes maximal).', default ='UEFI') parser.add_argument('-q', '--Quiet', action='store_true', help='Disable all build messages except FATAL ERRORS.')