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:
@@ -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);
|
||||
|
||||
//
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
PlatformSupportLib
|
||||
CpuLib
|
||||
StackCheckLib
|
||||
UefiCpuBaseArchSupportLib
|
||||
|
||||
[Guids]
|
||||
gEfiMemoryTypeInformationGuid
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
CpuLib
|
||||
HobPrintLib
|
||||
StackCheckLib
|
||||
UefiCpuBaseArchSupportLib
|
||||
|
||||
[Guids]
|
||||
gEfiMemoryTypeInformationGuid
|
||||
|
||||
@@ -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]
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user