REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3394
Invoke GetPhysicalAddressBits() defined in UefiCpuPkg for CPU physical address mask calculation and remove the duplicated code in OvmfPkg\XenPlatformPei\MemDetect.c. Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org> Cc: Jiewen Yao <jiewen....@intel.com> Signed-off-by: Yu Pu <yu...@intel.com> --- OvmfPkg/XenPlatformPei/MemDetect.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/OvmfPkg/XenPlatformPei/MemDetect.c b/OvmfPkg/XenPlatformPei/MemDetect.c index d412d1f4db6f..bd24612c21ef 100644 --- a/OvmfPkg/XenPlatformPei/MemDetect.c +++ b/OvmfPkg/XenPlatformPei/MemDetect.c @@ -30,6 +30,7 @@ Module Name: #include <Library/PciLib.h> #include <Library/PeimEntryPoint.h> #include <Library/ResourcePublicationLib.h> +#include <Library/UefiCpuLib.h> #include "Platform.h" #include "Cmos.h" @@ -180,15 +181,7 @@ AddressWidthInitialization ( VOID ) { - UINT32 RegEax; - - AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); - if (RegEax >= 0x80000008) { - AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); - mPhysMemAddressWidth = (UINT8)RegEax; - } else { - mPhysMemAddressWidth = 36; - } + mPhysMemAddressWidth = GetPhysicalAddressBits(NULL, NULL); // // IA-32e paging translates 48-bit linear addresses to 52-bit physical addresses. -- 2.30.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87238): https://edk2.groups.io/g/devel/message/87238 Mute This Topic: https://groups.io/mt/89503328/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-