From: Yu Pu <yu.pu@intel.com>
To: devel@edk2.groups.io
Cc: Yu Pu <yu.pu@intel.com>, Guo Dong <guo.dong@intel.com>,
Ray Ni <ray.ni@intel.com>
Subject: [PATCH v1 7/7] UefiPayloadPkg: Invoke GetPhysicalAddressBits() and remove the duplicated code
Date: Wed, 2 Mar 2022 17:18:59 +0800 [thread overview]
Message-ID: <20220302091859.2783-8-yu.pu@intel.com> (raw)
In-Reply-To: <20220302091859.2783-1-yu.pu@intel.com>
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 UefiPayloadPkg\UefiPayloadEntry
Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Yu Pu <yu.pu@intel.com>
---
UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 10 ++--------
UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c | 9 ++-------
2 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
index 0fed1e36918a..4378aa4f1d97 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -4,6 +4,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
+#include <Library/UefiCpuLib.h>
#include "UefiPayloadEntry.h"
@@ -341,7 +342,6 @@ BuildGenericHob (
VOID
)
{
- UINT32 RegEax;
UINT8 PhysicalAddressBits;
EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
@@ -351,13 +351,7 @@ BuildGenericHob (
//
// 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 = GetPhysicalAddressBits(NULL, NULL);
BuildCpuHob (PhysicalAddressBits, 16);
diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c
index ac0d58e685c8..c61aeeda7f2e 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c
@@ -25,6 +25,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <PiPei.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
+#include <Library/UefiCpuLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PcdLib.h>
@@ -738,13 +739,7 @@ CreateIdentityMappingPageTables (
if (Hob != NULL) {
PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
} else {
- AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
- if (RegEax >= 0x80000008) {
- AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
- PhysicalAddressBits = (UINT8)RegEax;
- } else {
- PhysicalAddressBits = 36;
- }
+ PhysicalAddressBits = GetPhysicalAddressBits (NULL, NULL);
}
//
--
2.30.0.windows.2
next prev parent reply other threads:[~2022-03-02 9:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-02 9:18 [PATCH v1 0/7] *** SUBJECT HERE *** Yu Pu
2022-03-02 9:18 ` [PATCH v1 1/7] UefiCpuPackage: Add APIs for CPU physical address mask calculation Yu Pu
2022-03-02 9:18 ` [PATCH v1 2/7] MdeModulePkg: Invoke GetPhysicalAddressBits() and remove the duplicated code Yu Pu
2022-03-07 3:54 ` [edk2-devel] " Ni, Ray
2022-03-10 8:47 ` Pu, Yu
2022-03-11 1:02 ` 回复: " gaoliming
2022-03-02 9:18 ` [PATCH v1 3/7] IntelFsp2Pkg: " Yu Pu
2022-03-02 9:26 ` Chiu, Chasel
2022-03-02 9:18 ` [PATCH v1 4/7] StandaloneMmPkg: " Yu Pu
2022-03-03 9:58 ` Ard Biesheuvel
2022-03-04 7:39 ` [edk2-devel] " Ni, Ray
2022-03-02 9:18 ` [PATCH v1 5/7] OvmfPkg: " Yu Pu
2022-03-02 9:18 ` [PATCH v1 6/7] EmulatorPkg: fixed a bug caused by Invoking GetPhysicalAddressBits() Yu Pu
2022-03-02 9:18 ` Yu Pu [this message]
2022-03-04 18:09 ` [PATCH v1 7/7] UefiPayloadPkg: Invoke GetPhysicalAddressBits() and remove the duplicated code Guo Dong
[not found] ` <16D93FE5C3E39310.28436@groups.io>
2022-03-05 3:43 ` [edk2-devel] " Guo Dong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220302091859.2783-8-yu.pu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox