UefiPayloadPkg: Update logic of fetching Processor Physical Address size

UefiPayloadEntry utilizes CPUID 0x80000008 leaf to retrieve the Processor's
Physical Address size for X86 architecture. To enable support for multiple
architectures, replace the direct implementation with an architecture-level
function provided by the UefiCpuPkg library, abstracting the underlying details.

Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
This commit is contained in:
Ajan Zhong
2025-01-12 16:11:12 +08:00
committed by mergify[bot]
parent 9fe0980a77
commit 9757ffaa38
4 changed files with 5 additions and 12 deletions

View File

@@ -6,6 +6,7 @@
**/
#include <Guid/MemoryTypeInformation.h>
#include <Library/BaseArchLibSupport.h>
#include "UefiPayloadEntry.h"
STATIC UINT32 mTopOfLowerUsableDram = 0;
@@ -351,24 +352,13 @@ BuildGenericHob (
VOID
)
{
UINT32 RegEax;
UINT8 PhysicalAddressBits;
EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
// The UEFI payload FV
BuildMemoryAllocationHob (PcdGet32 (PcdPayloadFdMemBase), PcdGet32 (PcdPayloadFdMemSize), EfiBootServicesData);
//
// Build CPU memory space and IO space hob
//
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000008) {
AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
PhysicalAddressBits = (UINT8)RegEax;
} else {
PhysicalAddressBits = 36;
}
PhysicalAddressBits = ArchGetPhysicalAddressBits ();
BuildCpuHob (PhysicalAddressBits, 16);
//

View File

@@ -56,6 +56,7 @@
PlatformSupportLib
CpuLib
StackCheckLib
UefiCpuBaseArchSupportLib
[Guids]
gEfiMemoryTypeInformationGuid

View File

@@ -48,6 +48,7 @@
CpuLib
HobPrintLib
StackCheckLib
UefiCpuBaseArchSupportLib
[Guids]
gEfiMemoryTypeInformationGuid

View File

@@ -346,6 +346,7 @@
SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
!endif
UefiCpuBaseArchSupportLib|UefiCpuPkg/Library/BaseArchSupportLib/BaseArchSupportLib.inf
[LibraryClasses.X64]
#