From: "Zhiguang Liu" <zhiguang.liu@intel.com>
To: devel@edk2.groups.io
Cc: Yu Pu <yu.pu@intel.com>,
Michael D Kinney <michael.d.kinney@intel.com>,
Liming Gao <gaoliming@byosoft.com.cn>,
Zhiguang Liu <zhiguang.liu@intel.com>,
Eric Dong <eric.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
Rahul Kumar <rahul1.kumar@intel.com>
Subject: [PATCH v3 2/9] MdePkg: Move API and implementation from UefiCpuLib to CpuLib
Date: Tue, 1 Nov 2022 15:58:35 +0800 [thread overview]
Message-ID: <20221101075842.1218-3-zhiguang.liu@intel.com> (raw)
In-Reply-To: <20221101075842.1218-1-zhiguang.liu@intel.com>
From: Yu Pu <yu.pu@intel.com>
There are two libraries: MdePkg/CpuLib and UefiCpuPkg/UefiCpuLib. This
patch merges UefiCpuPkg/UefiCpuLib to MdePkg/CpuLib.
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Yu Pu <yu.pu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
---
MdePkg/Include/Library/CpuLib.h | 48 ++++++++++++++++++
MdePkg/Library/BaseCpuLib/BaseCpuLib.inf | 6 +++
.../BaseCpuLib}/Ia32/InitializeFpu.nasm | 0
.../BaseCpuLib}/X64/InitializeFpu.nasm | 0
.../Library/BaseCpuLib/X86BaseCpuLib.c | 2 +-
UefiCpuPkg/Include/Library/UefiCpuLib.h | 49 -------------------
.../Library/BaseUefiCpuLib/BaseUefiCpuLib.inf | 8 +--
.../BaseUefiCpuLib/BaseUefiCpuLibNull.c | 16 ++++++
8 files changed, 72 insertions(+), 57 deletions(-)
rename {UefiCpuPkg/Library/BaseUefiCpuLib => MdePkg/Library/BaseCpuLib}/Ia32/InitializeFpu.nasm (100%)
rename {UefiCpuPkg/Library/BaseUefiCpuLib => MdePkg/Library/BaseCpuLib}/X64/InitializeFpu.nasm (100%)
rename UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c => MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c (93%)
create mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c
diff --git a/MdePkg/Include/Library/CpuLib.h b/MdePkg/Include/Library/CpuLib.h
index 25f6d9478c..3f29937dc7 100644
--- a/MdePkg/Include/Library/CpuLib.h
+++ b/MdePkg/Include/Library/CpuLib.h
@@ -41,4 +41,52 @@ CpuFlushTlb (
VOID
);
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
+
+/**
+ Initializes floating point units for requirement of UEFI specification.
+ This function initializes floating-point control word to 0x027F (all exceptions
+ masked,double-precision, round-to-nearest) and multimedia-extensions control word
+ (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to zero
+ for masked underflow).
+**/
+VOID
+EFIAPI
+InitializeFloatingPointUnits (
+ VOID
+ );
+
+/**
+ Determine if the standard CPU signature is "AuthenticAMD".
+ @retval TRUE The CPU signature matches.
+ @retval FALSE The CPU signature does not match.
+**/
+BOOLEAN
+EFIAPI
+StandardSignatureIsAuthenticAMD (
+ VOID
+ );
+
+/**
+ Return the 32bit CPU family and model value.
+ @return CPUID[01h].EAX with Processor Type and Stepping ID cleared.
+**/
+UINT32
+EFIAPI
+GetCpuFamilyModel (
+ VOID
+ );
+
+/**
+ Return the CPU stepping ID.
+ @return CPU stepping ID value in CPUID[01h].EAX.
+**/
+UINT8
+EFIAPI
+GetCpuSteppingId (
+ VOID
+ );
+
+#endif
+
#endif
diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
index 6b230f6e6d..b2bc958ec8 100644
--- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
@@ -29,6 +29,9 @@
# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 RISCV64 LOONGARCH64
#
+[Sources.IA32, Sources.X64]
+ X86BaseCpuLib.c
+
[Sources.IA32]
Ia32/CpuSleep.c | MSFT
Ia32/CpuFlushTlb.c | MSFT
@@ -39,10 +42,13 @@
Ia32/CpuSleepGcc.c | GCC
Ia32/CpuFlushTlbGcc.c | GCC
+ Ia32/InitializeFpu.nasm
+
[Sources.X64]
X64/CpuFlushTlb.nasm
X64/CpuSleep.nasm
+ X64/InitializeFpu.nasm
[Sources.EBC]
Ebc/CpuSleepFlushTlb.c
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm b/MdePkg/Library/BaseCpuLib/Ia32/InitializeFpu.nasm
similarity index 100%
rename from UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm
rename to MdePkg/Library/BaseCpuLib/Ia32/InitializeFpu.nasm
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm b/MdePkg/Library/BaseCpuLib/X64/InitializeFpu.nasm
similarity index 100%
rename from UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm
rename to MdePkg/Library/BaseCpuLib/X64/InitializeFpu.nasm
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c b/MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
similarity index 93%
rename from UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
rename to MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
index 5d925bc273..1cad32a4be 100644
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
+++ b/MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
@@ -13,7 +13,7 @@
#include <Register/Amd/Cpuid.h>
#include <Library/BaseLib.h>
-#include <Library/UefiCpuLib.h>
+#include <Library/CpuLib.h>
/**
Determine if the standard CPU signature is "AuthenticAMD".
diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h b/UefiCpuPkg/Include/Library/UefiCpuLib.h
index 0ff4a35774..ab6982db6e 100644
--- a/UefiCpuPkg/Include/Library/UefiCpuLib.h
+++ b/UefiCpuPkg/Include/Library/UefiCpuLib.h
@@ -13,53 +13,4 @@
#ifndef __UEFI_CPU_LIB_H__
#define __UEFI_CPU_LIB_H__
-/**
- Initializes floating point units for requirement of UEFI specification.
-
- This function initializes floating-point control word to 0x027F (all exceptions
- masked,double-precision, round-to-nearest) and multimedia-extensions control word
- (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to zero
- for masked underflow).
-
-**/
-VOID
-EFIAPI
-InitializeFloatingPointUnits (
- VOID
- );
-
-/**
- Determine if the standard CPU signature is "AuthenticAMD".
-
- @retval TRUE The CPU signature matches.
- @retval FALSE The CPU signature does not match.
-
-**/
-BOOLEAN
-EFIAPI
-StandardSignatureIsAuthenticAMD (
- VOID
- );
-
-/**
- Return the 32bit CPU family and model value.
-
- @return CPUID[01h].EAX with Processor Type and Stepping ID cleared.
-**/
-UINT32
-EFIAPI
-GetCpuFamilyModel (
- VOID
- );
-
-/**
- Return the CPU stepping ID.
- @return CPU stepping ID value in CPUID[01h].EAX.
-**/
-UINT8
-EFIAPI
-GetCpuSteppingId (
- VOID
- );
-
#endif
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
index 34d3a7bb43..9f8b62d87a 100644
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
+++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
@@ -24,14 +24,8 @@
# VALID_ARCHITECTURES = IA32 X64
#
-[Sources.IA32]
- Ia32/InitializeFpu.nasm
-
-[Sources.X64]
- X64/InitializeFpu.nasm
-
[Sources]
- BaseUefiCpuLib.c
+ BaseUefiCpuLibNull.c
[Packages]
MdePkg/MdePkg.dec
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c
new file mode 100644
index 0000000000..24693635e4
--- /dev/null
+++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c
@@ -0,0 +1,16 @@
+/** @file
+This library contains a dummy function to pass build.
+
+Copyright (c) 2022, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+#include <Base.h>
+
+VOID
+Dummy (
+ VOID
+ )
+{
+
+}
--
2.31.1.windows.1
next prev parent reply other threads:[~2022-11-01 7:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-01 7:58 [PATCH v3 0/9] merge UefiCpuPkg/UefiCpuLib to MdePkg/CpuLib Zhiguang Liu
2022-11-01 7:58 ` [PATCH v3 1/9] OvmfPkg: Add CpuLib to module INFs that depend on UefiCpuLib Zhiguang Liu
2022-11-04 6:43 ` [edk2-devel] " Ni, Ray
2022-11-04 6:44 ` Zhiguang Liu
2022-11-01 7:58 ` Zhiguang Liu [this message]
2022-11-01 7:58 ` [PATCH v3 3/9] IntelFsp2Pkg: Remove UefiCpuLib from module INFs Zhiguang Liu
2022-11-01 16:11 ` Chiu, Chasel
2022-11-01 7:58 ` [PATCH v3 4/9] OvmfPkg: " Zhiguang Liu
2022-11-04 6:43 ` [edk2-devel] " Ni, Ray
2022-11-01 7:58 ` [PATCH v3 5/9] PcAtChipsetPkg: " Zhiguang Liu
2022-11-01 7:58 ` [PATCH v3 6/9] SourceLevelDebugPkg: " Zhiguang Liu
2022-11-02 1:04 ` Wu, Hao A
2022-11-01 7:58 ` [PATCH v3 7/9] UefiCpuPkg: " Zhiguang Liu
2022-11-01 7:58 ` [PATCH v3 8/9] UefiPayloadPkg: " Zhiguang Liu
2022-11-02 5:22 ` [edk2-devel] " Lu, James
2022-11-02 5:30 ` Guo, Gua
2022-11-03 14:11 ` Guo Dong
2022-11-01 7:58 ` [PATCH v3 9/9] UefiCpuLib: Remove UefiCpuLib Zhiguang Liu
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=20221101075842.1218-3-zhiguang.liu@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