public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1 00/15] Merge UefiCpuLib to CpuLib
@ 2022-03-29  6:36 Yu Pu
  2022-03-29  6:36 ` [PATCH v1 01/15] IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib Yu Pu
                   ` (17 more replies)
  0 siblings, 18 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:36 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3394

Today lots of duplicated code call CPUID and calculates the address 
mask. Adding an API named GetPhysicalAddressBits in UefiCpuLib can 
solve this problem, but at the same time cause MdeModulePkg depend 
on UefiCpuPkg which does not meet the design spec. So merge UefiCpuLib 
to CpuLib is a good way to sovle these problems. To minimize the impact,
this operation is divided into four steps.

Yu Pu (15):
  IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib
  IntelFsp2WrapperPkg: Add CpuLib to module INFs that depend on
    UefiCpuLib.
  MdePkg: Add CpuLib to module INFs that depend on UefiCpuLib.
  OvmfPkg: Add CpuLib to module INFs that depend on  UefiCpuLib.
  UefiCpuPkg: Add CpuLib to module INFs that depend on  UefiCpuLib.
  UefiPayloadPkg: Add CpuLib to module INFs that  depend on UefiCpuLib.
  MdePkg: Move API and implementation from UefiCpuLib to CpuLib
  UefiCpuPkg: Move API and implementation from UefiCpuLib to CpuLib
  IntelFsp2Pkg: Remove UefiCpuLib from module INFs.
  OvmfPkg: Remove UefiCpuLib from module INFs.
  PcAtChipsetPkg: Remove UefiCpuLib from module INFs.
  SourceLevelDebugPkg: Remove UefiCpuLib from module  INFs.
  UefiCpuPkg: Remove UefiCpuLib from module INFs.
  UefiPayloadPkg: Remove UefiCpuLib from module INFs.
  UefiCpuLib: Remove UefiCpuLib.

 MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c                                                | 122 ++++++++++++++++++++
 OvmfPkg/Sec/SecMain.c                                                                    |   2 +-
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c                                       |  81 -------------
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c                                           |   2 +-
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c                               |   2 +-
 IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf                                                  |   2 +-
 IntelFsp2Pkg/FspSecCore/SecMain.h                                                        |   2 +-
 IntelFsp2Pkg/IntelFsp2Pkg.dsc                                                            |   1 -
 IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc                                                  |   1 -
 IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf                                  |   2 +-
 IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf                                  |   2 +-
 IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc                                              |   1 -
 MdePkg/Include/Library/CpuLib.h                                                          |  65 +++++++++++
 MdePkg/Library/BaseCpuLib/BaseCpuLib.inf                                                 |   6 +
 {UefiCpuPkg/Library/BaseUefiCpuLib => MdePkg/Library/BaseCpuLib}/Ia32/InitializeFpu.nasm |   0
 {UefiCpuPkg/Library/BaseUefiCpuLib => MdePkg/Library/BaseCpuLib}/X64/InitializeFpu.nasm  |   0
 MdePkg/MdeLibs.dsc.inc                                                                   |   1 +
 OvmfPkg/AmdSev/AmdSevX64.dsc                                                             |   1 -
 OvmfPkg/Bhyve/BhyveX64.dsc                                                               |   1 -
 OvmfPkg/CloudHv/CloudHvX64.dsc                                                           |   1 -
 OvmfPkg/Microvm/MicrovmX64.dsc                                                           |   1 -
 OvmfPkg/OvmfPkgIa32.dsc                                                                  |   1 -
 OvmfPkg/OvmfPkgIa32X64.dsc                                                               |   1 -
 OvmfPkg/OvmfPkgX64.dsc                                                                   |   1 -
 OvmfPkg/OvmfXen.dsc                                                                      |   1 -
 OvmfPkg/Sec/SecMain.inf                                                                  |   2 +-
 PcAtChipsetPkg/PcAtChipsetPkg.dsc                                                        |   1 -
 SourceLevelDebugPkg/SourceLevelDebugPkg.dsc                                              |   1 -
 UefiCpuPkg/CpuDxe/CpuDxe.h                                                               |   1 -
 UefiCpuPkg/CpuDxe/CpuDxe.inf                                                             |   1 -
 UefiCpuPkg/Include/Library/UefiCpuLib.h                                                  |  65 -----------
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf                                     |  41 -------
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni                                     |  16 ---
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf                                         |   2 +-
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf                             |   2 +-
 UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf                                            |   1 -
 UefiCpuPkg/Library/MpInitLib/MpLib.h                                                     |   1 -
 UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf                                            |   1 -
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h                                               |   2 +-
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf                                             |   1 -
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h                                           |   1 -
 UefiCpuPkg/SecCore/SecCore.inf                                                           |   2 +-
 UefiCpuPkg/SecCore/SecCoreNative.inf                                                     |   2 +-
 UefiCpuPkg/SecCore/SecMain.h                                                             |   2 +-
 UefiCpuPkg/UefiCpuPkg.dec                                                                |   5 -
 UefiCpuPkg/UefiCpuPkg.dsc                                                                |   2 -
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h                                       |   2 +-
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf                                     |   2 +-
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf                                |   2 +-
 UefiPayloadPkg/UefiPayloadPkg.dsc                                                        |   1 -
 50 files changed, 211 insertions(+), 248 deletions(-)
 create mode 100644 MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
 delete mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
 rename {UefiCpuPkg/Library/BaseUefiCpuLib => MdePkg/Library/BaseCpuLib}/Ia32/InitializeFpu.nasm (100%)
 rename {UefiCpuPkg/Library/BaseUefiCpuLib => MdePkg/Library/BaseCpuLib}/X64/InitializeFpu.nasm (100%)
 delete mode 100644 UefiCpuPkg/Include/Library/UefiCpuLib.h
 delete mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
 delete mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni

-- 
2.30.0.windows.2


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v1 01/15] IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
@ 2022-03-29  6:36 ` Yu Pu
  2022-03-29  6:36 ` [PATCH v1 02/15] IntelFsp2WrapperPkg: " Yu Pu
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:36 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Chasel Chiu, Nate DeSimone, Star Zeng

Step 1 to merge UefiCpuLib to CpuLib.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Yu Pu <yu.pu@intel.com>
---
 IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf | 1 +
 IntelFsp2Pkg/FspSecCore/SecMain.h       | 1 +
 2 files changed, 2 insertions(+)

diff --git a/IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf b/IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf
index 7b05cae64130..830471adcf2f 100644
--- a/IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf
+++ b/IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf
@@ -51,6 +51,7 @@
   FspSwitchStackLib
   FspCommonLib
   FspSecPlatformLib
+  CpuLib
   UefiCpuLib
 
 [Pcd]
diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.h b/IntelFsp2Pkg/FspSecCore/SecMain.h
index 7794255af13d..edb7447d9eff 100644
--- a/IntelFsp2Pkg/FspSecCore/SecMain.h
+++ b/IntelFsp2Pkg/FspSecCore/SecMain.h
@@ -20,6 +20,7 @@
 #include <Library/SerialPortLib.h>
 #include <Library/FspSwitchStackLib.h>
 #include <Library/FspCommonLib.h>
+#include <Library/CpuLib.h>
 #include <Library/UefiCpuLib.h>
 #include <FspEas.h>
 
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 02/15] IntelFsp2WrapperPkg: Add CpuLib to module INFs that depend on UefiCpuLib.
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
  2022-03-29  6:36 ` [PATCH v1 01/15] IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib Yu Pu
@ 2022-03-29  6:36 ` Yu Pu
  2022-03-29  6:36 ` [PATCH v1 03/15] MdePkg: " Yu Pu
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:36 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Chasel Chiu, Nate DeSimone, Star Zeng

Step 1 to merge UefiCpuLib to CpuLib.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Yu Pu <yu.pu@intel.com>
---
 IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf | 1 +
 IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf | 1 +
 2 files changed, 2 insertions(+)

diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
index 5d0e0214015f..e2262d693c55 100644
--- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
+++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
@@ -37,6 +37,7 @@
   HobLib
   FspWrapperPlatformLib
   FspWrapperHobProcessLib
+  CpuLib
   UefiCpuLib
   PeCoffGetEntryPointLib
   PeCoffExtraActionLib
diff --git a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
index da0049a65435..0598f85ab3ac 100644
--- a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
+++ b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
@@ -38,6 +38,7 @@
   MemoryAllocationLib
   FspWrapperPlatformLib
   FspWrapperHobProcessLib
+  CpuLib
   UefiCpuLib
   PeCoffGetEntryPointLib
   PeCoffExtraActionLib
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 03/15] MdePkg: Add CpuLib to module INFs that depend on UefiCpuLib.
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
  2022-03-29  6:36 ` [PATCH v1 01/15] IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib Yu Pu
  2022-03-29  6:36 ` [PATCH v1 02/15] IntelFsp2WrapperPkg: " Yu Pu
@ 2022-03-29  6:36 ` Yu Pu
  2022-03-29  6:36 ` [PATCH v1 04/15] OvmfPkg: " Yu Pu
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:36 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Michael D Kinney, Liming Gao, Zhiguang Liu

Step 1 to merge UefiCpuLib to CpuLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Yu Pu <yu.pu@intel.com>
---
 MdePkg/MdeLibs.dsc.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdePkg/MdeLibs.dsc.inc b/MdePkg/MdeLibs.dsc.inc
index 3c70daf87a0c..322575090239 100644
--- a/MdePkg/MdeLibs.dsc.inc
+++ b/MdePkg/MdeLibs.dsc.inc
@@ -13,3 +13,4 @@
 
 [LibraryClasses]
   RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
+  CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 04/15] OvmfPkg: Add CpuLib to module INFs that depend on UefiCpuLib.
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
                   ` (2 preceding siblings ...)
  2022-03-29  6:36 ` [PATCH v1 03/15] MdePkg: " Yu Pu
@ 2022-03-29  6:36 ` Yu Pu
  2022-03-29  6:36 ` [PATCH v1 05/15] UefiCpuPkg: " Yu Pu
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:36 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Ard Biesheuvel, Jiewen Yao, Jordan Justen, Gerd Hoffmann

Step 1 to merge UefiCpuLib to CpuLib.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Yu Pu <yu.pu@intel.com>
---
 OvmfPkg/Sec/SecMain.c   | 1 +
 OvmfPkg/Sec/SecMain.inf | 1 +
 2 files changed, 2 insertions(+)

diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c
index 2c5561661ef3..2c9e439800c7 100644
--- a/OvmfPkg/Sec/SecMain.c
+++ b/OvmfPkg/Sec/SecMain.c
@@ -17,6 +17,7 @@
 #include <Library/BaseMemoryLib.h>
 #include <Library/PeiServicesLib.h>
 #include <Library/PcdLib.h>
+#include <Library/CpuLib.h>
 #include <Library/UefiCpuLib.h>
 #include <Library/DebugAgentLib.h>
 #include <Library/IoLib.h>
diff --git a/OvmfPkg/Sec/SecMain.inf b/OvmfPkg/Sec/SecMain.inf
index 95cf0025e100..6ad366a89333 100644
--- a/OvmfPkg/Sec/SecMain.inf
+++ b/OvmfPkg/Sec/SecMain.inf
@@ -44,6 +44,7 @@
   BaseMemoryLib
   PeiServicesLib
   PcdLib
+  CpuLib
   UefiCpuLib
   DebugAgentLib
   IoLib
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 05/15] UefiCpuPkg: Add CpuLib to module INFs that depend on UefiCpuLib.
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
                   ` (3 preceding siblings ...)
  2022-03-29  6:36 ` [PATCH v1 04/15] OvmfPkg: " Yu Pu
@ 2022-03-29  6:36 ` Yu Pu
  2022-03-29  6:36 ` [PATCH v1 06/15] UefiPayloadPkg: " Yu Pu
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:36 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Eric Dong, Ray Ni, Rahul Kumar

Step 1 to merge UefiCpuLib to CpuLib.

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>
---
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c               | 1 +
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c   | 1 +
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf             | 1 +
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf | 1 +
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h                   | 1 +
 UefiCpuPkg/SecCore/SecCore.inf                               | 1 +
 UefiCpuPkg/SecCore/SecCoreNative.inf                         | 1 +
 UefiCpuPkg/SecCore/SecMain.h                                 | 1 +
 8 files changed, 8 insertions(+)

diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
index f9e06b2fca45..a944c3d01cf7 100644
--- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
+++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
@@ -21,6 +21,7 @@
 #include <Library/IoLib.h>
 #include <Library/TimerLib.h>
 #include <Library/PcdLib.h>
+#include <Library/CpuLib.h>
 #include <Library/UefiCpuLib.h>
 
 //
diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
index aaa42ff8450b..8b3630d7a302 100644
--- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
+++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
@@ -22,6 +22,7 @@
 #include <Library/IoLib.h>
 #include <Library/TimerLib.h>
 #include <Library/PcdLib.h>
+#include <Library/CpuLib.h>
 #include <Library/UefiCpuLib.h>
 
 //
diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
index 561baa44b0e6..a85b69e0a11c 100644
--- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
+++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
@@ -38,6 +38,7 @@
   TimerLib
   IoLib
   PcdLib
+  CpuLib
   UefiCpuLib
 
 [Pcd]
diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
index 1e2a4f8b790f..31ebdd39c616 100644
--- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
+++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
@@ -38,6 +38,7 @@
   TimerLib
   IoLib
   PcdLib
+  CpuLib
   UefiCpuLib
 
 [Pcd]
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
index aed872836c99..dfeceec2aadc 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
@@ -43,6 +43,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/UefiLib.h>
 #include <Library/HobLib.h>
 #include <Library/LocalApicLib.h>
+#include <Library/CpuLib.h>
 #include <Library/UefiCpuLib.h>
 #include <Library/CpuExceptionHandlerLib.h>
 #include <Library/ReportStatusCodeLib.h>
diff --git a/UefiCpuPkg/SecCore/SecCore.inf b/UefiCpuPkg/SecCore/SecCore.inf
index ded83beb5272..f021997f271c 100644
--- a/UefiCpuPkg/SecCore/SecCore.inf
+++ b/UefiCpuPkg/SecCore/SecCore.inf
@@ -47,6 +47,7 @@
   PlatformSecLib
   PcdLib
   DebugAgentLib
+  CpuLib
   UefiCpuLib
   PeCoffGetEntryPointLib
   PeCoffExtraActionLib
diff --git a/UefiCpuPkg/SecCore/SecCoreNative.inf b/UefiCpuPkg/SecCore/SecCoreNative.inf
index b528c5987947..e0a1b44a7e23 100644
--- a/UefiCpuPkg/SecCore/SecCoreNative.inf
+++ b/UefiCpuPkg/SecCore/SecCoreNative.inf
@@ -44,6 +44,7 @@
   PlatformSecLib
   PcdLib
   DebugAgentLib
+  CpuLib
   UefiCpuLib
   PeCoffGetEntryPointLib
   PeCoffExtraActionLib
diff --git a/UefiCpuPkg/SecCore/SecMain.h b/UefiCpuPkg/SecCore/SecMain.h
index 029bee3e7e40..189fcf932625 100644
--- a/UefiCpuPkg/SecCore/SecMain.h
+++ b/UefiCpuPkg/SecCore/SecMain.h
@@ -23,6 +23,7 @@
 #include <Library/PcdLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/PlatformSecLib.h>
+#include <Library/CpuLib.h>
 #include <Library/UefiCpuLib.h>
 #include <Library/PeCoffGetEntryPointLib.h>
 #include <Library/PeCoffExtraActionLib.h>
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 06/15] UefiPayloadPkg: Add CpuLib to module INFs that depend on UefiCpuLib.
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
                   ` (4 preceding siblings ...)
  2022-03-29  6:36 ` [PATCH v1 05/15] UefiCpuPkg: " Yu Pu
@ 2022-03-29  6:36 ` Yu Pu
  2022-03-29  6:36 ` [PATCH v1 07/15] MdePkg: Move API and implementation from UefiCpuLib to CpuLib Yu Pu
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:36 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Guo Dong, Ray Ni, Maurice Ma, Benjamin You, Sean Rhodes

Step 1 to merge UefiCpuLib to CpuLib.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Yu Pu <yu.pu@intel.com>
---
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h        | 1 +
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf      | 1 +
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf | 1 +
 3 files changed, 3 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
index 56e0a4c639a0..d1c7425b28f2 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
@@ -23,6 +23,7 @@
 #include <Library/PeCoffLib.h>
 #include <Library/BlParseLib.h>
 #include <Library/PlatformSupportLib.h>
+#include <Library/CpuLib.h>
 #include <Library/UefiCpuLib.h>
 #include <IndustryStandard/Acpi.h>
 #include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
index c4e4339ede4b..95446dd99729 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
@@ -54,6 +54,7 @@
   HobLib
   PeCoffLib
   PlatformSupportLib
+  CpuLib
   UefiCpuLib
 
 [Guids]
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
index 80af5afe0a3f..3b4836042a06 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
@@ -52,6 +52,7 @@
   IoLib
   HobLib
   PeCoffLib
+  CpuLib
   UefiCpuLib
 
 [Guids]
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 07/15] MdePkg: Move API and implementation from UefiCpuLib to CpuLib
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
                   ` (5 preceding siblings ...)
  2022-03-29  6:36 ` [PATCH v1 06/15] UefiPayloadPkg: " Yu Pu
@ 2022-03-29  6:36 ` Yu Pu
  2022-03-29  6:36 ` [PATCH v1 08/15] UefiCpuPkg: " Yu Pu
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:36 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Michael D Kinney, Liming Gao, Zhiguang Liu

Step 2 to merge UefiCpuLib to CpuLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Yu Pu <yu.pu@intel.com>
---
 MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c         | 122 ++++++++++++++++++++
 MdePkg/Include/Library/CpuLib.h                   |  65 +++++++++++
 MdePkg/Library/BaseCpuLib/BaseCpuLib.inf          |   6 +
 MdePkg/Library/BaseCpuLib/Ia32/InitializeFpu.nasm |  68 +++++++++++
 MdePkg/Library/BaseCpuLib/X64/InitializeFpu.nasm  |  51 ++++++++
 5 files changed, 312 insertions(+)

diff --git a/MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c b/MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
new file mode 100644
index 000000000000..82c8f29137f3
--- /dev/null
+++ b/MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
@@ -0,0 +1,122 @@
+/** @file
+  This library defines some routines that are generic for IA32 family CPU.
+  The library routines are UEFI specification compliant.
+  Copyright (c) 2020, AMD Inc. All rights reserved.<BR>
+  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <Register/Intel/Cpuid.h>
+#include <Register/Amd/Cpuid.h>
+
+#include <Library/BaseLib.h>
+#include <Library/CpuLib.h>
+
+/**
+  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
+  )
+{
+  UINT32  RegEbx;
+  UINT32  RegEcx;
+  UINT32  RegEdx;
+
+  AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx);
+  return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
+          RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
+          RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
+}
+
+/**
+  Return the 32bit CPU family and model value.
+  @return CPUID[01h].EAX with Processor Type and Stepping ID cleared.
+**/
+UINT32
+EFIAPI
+GetCpuFamilyModel (
+  VOID
+  )
+{
+  CPUID_VERSION_INFO_EAX  Eax;
+
+  AsmCpuid (CPUID_VERSION_INFO, &Eax.Uint32, NULL, NULL, NULL);
+
+  //
+  // Mask other fields than Family and Model.
+  //
+  Eax.Bits.SteppingId    = 0;
+  Eax.Bits.ProcessorType = 0;
+  Eax.Bits.Reserved1     = 0;
+  Eax.Bits.Reserved2     = 0;
+  return Eax.Uint32;
+}
+
+/**
+  Return the CPU stepping ID.
+  @return CPU stepping ID value in CPUID[01h].EAX.
+**/
+UINT8
+EFIAPI
+GetCpuSteppingId (
+  VOID
+  )
+{
+  CPUID_VERSION_INFO_EAX  Eax;
+
+  AsmCpuid (CPUID_VERSION_INFO, &Eax.Uint32, NULL, NULL, NULL);
+
+  return (UINT8)Eax.Bits.SteppingId;
+}
+
+/**
+  Get the physical address width supported by the processor.
+  @param[out] ValidAddressMask          Bitmask with valid address bits set to
+                                        one; other bits are clear. Optional
+                                        parameter.
+  @param[out] ValidPageBaseAddressMask  Bitmask with valid page base address
+                                        bits set to one; other bits are clear.
+                                        Optional parameter.
+  @return  The physical address width supported by the processor.
+**/
+UINT8
+EFIAPI
+GetPhysicalAddressBits (
+  OUT UINT64 *ValidAddressMask         OPTIONAL,
+  OUT UINT64 *ValidPageBaseAddressMask OPTIONAL
+  )
+{
+  UINT32                         MaxExtendedFunction;
+  CPUID_VIR_PHY_ADDRESS_SIZE_EAX VirPhyAddressSize;
+  UINT64                         AddressMask;
+  UINT64                         PageBaseAddressMask;
+
+  AsmCpuid (CPUID_EXTENDED_FUNCTION, &MaxExtendedFunction, NULL, NULL, NULL);
+  if (MaxExtendedFunction >= CPUID_VIR_PHY_ADDRESS_SIZE) {
+    AsmCpuid (
+      CPUID_VIR_PHY_ADDRESS_SIZE,
+      &VirPhyAddressSize.Uint32,
+      NULL,
+      NULL,
+      NULL
+      );
+  } else {
+    VirPhyAddressSize.Bits.PhysicalAddressBits = 36;
+  }
+
+  AddressMask = LShiftU64 (1, VirPhyAddressSize.Bits.PhysicalAddressBits) - 1;
+  PageBaseAddressMask = AddressMask & ~(UINT64)0xFFF;
+
+  if (ValidAddressMask != NULL) {
+    *ValidAddressMask = AddressMask;
+  }
+  if (ValidPageBaseAddressMask != NULL) {
+    *ValidPageBaseAddressMask = PageBaseAddressMask;
+  }
+  return (UINT8)VirPhyAddressSize.Bits.PhysicalAddressBits;
+}
diff --git a/MdePkg/Include/Library/CpuLib.h b/MdePkg/Include/Library/CpuLib.h
index 25f6d9478c52..559de859a26e 100644
--- a/MdePkg/Include/Library/CpuLib.h
+++ b/MdePkg/Include/Library/CpuLib.h
@@ -41,4 +41,69 @@ 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
+  );
+
+/**
+  Get the physical address width supported by the processor.
+  @param[out] ValidAddressMask          Bitmask with valid address bits set to
+                                        one; other bits are clear. Optional
+                                        parameter.
+  @param[out] ValidPageBaseAddressMask  Bitmask with valid page base address
+                                        bits set to one; other bits are clear.
+                                        Optional parameter.
+  @return  The physical address width supported by the processor.
+**/
+UINT8
+EFIAPI
+GetPhysicalAddressBits (
+  OUT UINT64 *ValidAddressMask         OPTIONAL,
+  OUT UINT64 *ValidPageBaseAddressMask OPTIONAL
+  );
+
+#endif
+
 #endif
diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
index 950f5229b2a4..7cdbb552c08c 100644
--- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
@@ -28,6 +28,9 @@
 #  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64 RISCV64
 #
 
+[Sources.IA32, Sources.X64]
+  X86BaseCpuLib.c
+
 [Sources.IA32]
   Ia32/CpuSleep.c | MSFT
   Ia32/CpuFlushTlb.c | MSFT
@@ -38,10 +41,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/MdePkg/Library/BaseCpuLib/Ia32/InitializeFpu.nasm b/MdePkg/Library/BaseCpuLib/Ia32/InitializeFpu.nasm
new file mode 100644
index 000000000000..5e27cc325012
--- /dev/null
+++ b/MdePkg/Library/BaseCpuLib/Ia32/InitializeFpu.nasm
@@ -0,0 +1,68 @@
+;------------------------------------------------------------------------------
+;*
+;*   Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
+;*   SPDX-License-Identifier: BSD-2-Clause-Patent
+;*
+;*
+;------------------------------------------------------------------------------
+
+    SECTION .rodata
+
+;
+; Float control word initial value:
+; all exceptions masked, double-precision, round-to-nearest
+;
+mFpuControlWord: DW 0x27F
+;
+; Multimedia-extensions control word:
+; all exceptions masked, round-to-nearest, flush to zero for masked underflow
+;
+mMmxControlWord: DD 0x1F80
+
+    SECTION .text
+
+;
+; 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).
+;
+global ASM_PFX(InitializeFloatingPointUnits)
+ASM_PFX(InitializeFloatingPointUnits):
+
+    push    ebx
+
+    ;
+    ; Initialize floating point units
+    ;
+    finit
+    fldcw   [mFpuControlWord]
+
+    ;
+    ; Use CpuId instructuion (CPUID.01H:EDX.SSE[bit 25] = 1) to test
+    ; whether the processor supports SSE instruction.
+    ;
+    mov     eax, 1
+    cpuid
+    bt      edx, 25
+    jnc     Done
+
+    ;
+    ; Set OSFXSR bit 9 in CR4
+    ;
+    mov     eax, cr4
+    or      eax, BIT9
+    mov     cr4, eax
+
+    ;
+    ; The processor should support SSE instruction and we can use
+    ; ldmxcsr instruction
+    ;
+    ldmxcsr [mMmxControlWord]
+Done:
+    pop     ebx
+
+    ret
+
diff --git a/MdePkg/Library/BaseCpuLib/X64/InitializeFpu.nasm b/MdePkg/Library/BaseCpuLib/X64/InitializeFpu.nasm
new file mode 100644
index 000000000000..8485b4713548
--- /dev/null
+++ b/MdePkg/Library/BaseCpuLib/X64/InitializeFpu.nasm
@@ -0,0 +1,51 @@
+;------------------------------------------------------------------------------
+;*
+;*   Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+;*   SPDX-License-Identifier: BSD-2-Clause-Patent
+;*
+;*
+;------------------------------------------------------------------------------
+
+    SECTION .rodata
+;
+; Float control word initial value:
+; all exceptions masked, double-extended-precision, round-to-nearest
+;
+mFpuControlWord: DW 0x37F
+;
+; Multimedia-extensions control word:
+; all exceptions masked, round-to-nearest, flush to zero for masked underflow
+;
+mMmxControlWord: DD 0x1F80
+
+DEFAULT REL
+SECTION .text
+
+;
+; 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).
+;
+global ASM_PFX(InitializeFloatingPointUnits)
+ASM_PFX(InitializeFloatingPointUnits):
+
+    ;
+    ; Initialize floating point units
+    ;
+    finit
+    fldcw   [mFpuControlWord]
+
+    ;
+    ; Set OSFXSR bit 9 in CR4
+    ;
+    mov     rax, cr4
+    or      rax, BIT9
+    mov     cr4, rax
+
+    ldmxcsr [mMmxControlWord]
+
+    ret
+
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 08/15] UefiCpuPkg: Move API and implementation from UefiCpuLib to CpuLib
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
                   ` (6 preceding siblings ...)
  2022-03-29  6:36 ` [PATCH v1 07/15] MdePkg: Move API and implementation from UefiCpuLib to CpuLib Yu Pu
@ 2022-03-29  6:36 ` Yu Pu
  2022-03-29  6:36 ` [PATCH v1 09/15] IntelFsp2Pkg: Remove UefiCpuLib from module INFs Yu Pu
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:36 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Eric Dong, Ray Ni, Rahul Kumar

Step 2 to merge UefiCpuLib to CpuLib.

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>
---
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c        | 81 --------------------
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c    | 16 ++++
 UefiCpuPkg/Include/Library/UefiCpuLib.h                   | 61 ---------------
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf      |  8 +-
 UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm | 68 ----------------
 UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm  | 51 ------------
 6 files changed, 17 insertions(+), 268 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
deleted file mode 100644
index 5d925bc273f8..000000000000
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/** @file
-  This library defines some routines that are generic for IA32 family CPU.
-
-  The library routines are UEFI specification compliant.
-
-  Copyright (c) 2020, AMD Inc. All rights reserved.<BR>
-  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Register/Intel/Cpuid.h>
-#include <Register/Amd/Cpuid.h>
-
-#include <Library/BaseLib.h>
-#include <Library/UefiCpuLib.h>
-
-/**
-  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
-  )
-{
-  UINT32  RegEbx;
-  UINT32  RegEcx;
-  UINT32  RegEdx;
-
-  AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx);
-  return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
-          RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
-          RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
-}
-
-/**
-  Return the 32bit CPU family and model value.
-
-  @return CPUID[01h].EAX with Processor Type and Stepping ID cleared.
-**/
-UINT32
-EFIAPI
-GetCpuFamilyModel (
-  VOID
-  )
-{
-  CPUID_VERSION_INFO_EAX  Eax;
-
-  AsmCpuid (CPUID_VERSION_INFO, &Eax.Uint32, NULL, NULL, NULL);
-
-  //
-  // Mask other fields than Family and Model.
-  //
-  Eax.Bits.SteppingId    = 0;
-  Eax.Bits.ProcessorType = 0;
-  Eax.Bits.Reserved1     = 0;
-  Eax.Bits.Reserved2     = 0;
-  return Eax.Uint32;
-}
-
-/**
-  Return the CPU stepping ID.
-  @return CPU stepping ID value in CPUID[01h].EAX.
-**/
-UINT8
-EFIAPI
-GetCpuSteppingId (
-  VOID
-  )
-{
-  CPUID_VERSION_INFO_EAX  Eax;
-
-  AsmCpuid (CPUID_VERSION_INFO, &Eax.Uint32, NULL, NULL, NULL);
-
-  return (UINT8)Eax.Bits.SteppingId;
-}
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c
new file mode 100644
index 000000000000..eaecd4ae5ed7
--- /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>
+STATIC
+VOID
+Dummy (
+  VOID
+  )
+{
+
+}
diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h b/UefiCpuPkg/Include/Library/UefiCpuLib.h
index 0ff4a35774c1..c9de5a62d991 100644
--- a/UefiCpuPkg/Include/Library/UefiCpuLib.h
+++ b/UefiCpuPkg/Include/Library/UefiCpuLib.h
@@ -1,65 +1,4 @@
-/** @file
-  Public header file for UEFI CPU library class.
-
-  This library class defines some routines that are generic for IA32 family CPU
-  to be UEFI specification compliant.
-
-  Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.<BR>
-  Copyright (c) 2020, AMD Inc. All rights reserved.<BR>
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
 #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 34d3a7bb4303..9f8b62d87aae 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/Ia32/InitializeFpu.nasm b/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm
deleted file mode 100644
index 5e27cc325012..000000000000
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm
+++ /dev/null
@@ -1,68 +0,0 @@
-;------------------------------------------------------------------------------
-;*
-;*   Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
-;*   SPDX-License-Identifier: BSD-2-Clause-Patent
-;*
-;*
-;------------------------------------------------------------------------------
-
-    SECTION .rodata
-
-;
-; Float control word initial value:
-; all exceptions masked, double-precision, round-to-nearest
-;
-mFpuControlWord: DW 0x27F
-;
-; Multimedia-extensions control word:
-; all exceptions masked, round-to-nearest, flush to zero for masked underflow
-;
-mMmxControlWord: DD 0x1F80
-
-    SECTION .text
-
-;
-; 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).
-;
-global ASM_PFX(InitializeFloatingPointUnits)
-ASM_PFX(InitializeFloatingPointUnits):
-
-    push    ebx
-
-    ;
-    ; Initialize floating point units
-    ;
-    finit
-    fldcw   [mFpuControlWord]
-
-    ;
-    ; Use CpuId instructuion (CPUID.01H:EDX.SSE[bit 25] = 1) to test
-    ; whether the processor supports SSE instruction.
-    ;
-    mov     eax, 1
-    cpuid
-    bt      edx, 25
-    jnc     Done
-
-    ;
-    ; Set OSFXSR bit 9 in CR4
-    ;
-    mov     eax, cr4
-    or      eax, BIT9
-    mov     cr4, eax
-
-    ;
-    ; The processor should support SSE instruction and we can use
-    ; ldmxcsr instruction
-    ;
-    ldmxcsr [mMmxControlWord]
-Done:
-    pop     ebx
-
-    ret
-
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm b/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm
deleted file mode 100644
index 8485b4713548..000000000000
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm
+++ /dev/null
@@ -1,51 +0,0 @@
-;------------------------------------------------------------------------------
-;*
-;*   Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
-;*   SPDX-License-Identifier: BSD-2-Clause-Patent
-;*
-;*
-;------------------------------------------------------------------------------
-
-    SECTION .rodata
-;
-; Float control word initial value:
-; all exceptions masked, double-extended-precision, round-to-nearest
-;
-mFpuControlWord: DW 0x37F
-;
-; Multimedia-extensions control word:
-; all exceptions masked, round-to-nearest, flush to zero for masked underflow
-;
-mMmxControlWord: DD 0x1F80
-
-DEFAULT REL
-SECTION .text
-
-;
-; 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).
-;
-global ASM_PFX(InitializeFloatingPointUnits)
-ASM_PFX(InitializeFloatingPointUnits):
-
-    ;
-    ; Initialize floating point units
-    ;
-    finit
-    fldcw   [mFpuControlWord]
-
-    ;
-    ; Set OSFXSR bit 9 in CR4
-    ;
-    mov     rax, cr4
-    or      rax, BIT9
-    mov     cr4, rax
-
-    ldmxcsr [mMmxControlWord]
-
-    ret
-
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 09/15] IntelFsp2Pkg: Remove UefiCpuLib from module INFs.
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
                   ` (7 preceding siblings ...)
  2022-03-29  6:36 ` [PATCH v1 08/15] UefiCpuPkg: " Yu Pu
@ 2022-03-29  6:36 ` Yu Pu
  2022-03-29  6:36 ` [PATCH v1 10/15] OvmfPkg: " Yu Pu
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:36 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Chasel Chiu, Nate DeSimone, Star Zeng

Step 3 to merge UefiCpuLib to CpuLib.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Yu Pu <yu.pu@intel.com>
---
 IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf                 | 1 -
 IntelFsp2Pkg/FspSecCore/SecMain.h                       | 1 -
 IntelFsp2Pkg/IntelFsp2Pkg.dsc                           | 1 -
 IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc                 | 1 -
 IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf | 1 -
 IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf | 1 -
 IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc             | 1 -
 7 files changed, 7 deletions(-)

diff --git a/IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf b/IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf
index 830471adcf2f..c07b49c4045f 100644
--- a/IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf
+++ b/IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf
@@ -52,7 +52,6 @@
   FspCommonLib
   FspSecPlatformLib
   CpuLib
-  UefiCpuLib
 
 [Pcd]
   gIntelFsp2PkgTokenSpaceGuid.PcdTemporaryRamBase              ## CONSUMES
diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.h b/IntelFsp2Pkg/FspSecCore/SecMain.h
index edb7447d9eff..7288086cc493 100644
--- a/IntelFsp2Pkg/FspSecCore/SecMain.h
+++ b/IntelFsp2Pkg/FspSecCore/SecMain.h
@@ -21,7 +21,6 @@
 #include <Library/FspSwitchStackLib.h>
 #include <Library/FspCommonLib.h>
 #include <Library/CpuLib.h>
-#include <Library/UefiCpuLib.h>
 #include <FspEas.h>
 
 typedef VOID (*PEI_CORE_ENTRY) ( \
diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dsc b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
index c1414f7e75b8..b90be5397d37 100644
--- a/IntelFsp2Pkg/IntelFsp2Pkg.dsc
+++ b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
@@ -27,7 +27,6 @@
   PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
   UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
 
   ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
diff --git a/IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc b/IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc
index 961576c9a73a..31558121185d 100644
--- a/IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc
+++ b/IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc
@@ -107,7 +107,6 @@
   PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
   OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
 !if $(TARGET) == DEBUG
   DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
   SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
index e2262d693c55..77af97207990 100644
--- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
+++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
@@ -38,7 +38,6 @@
   FspWrapperPlatformLib
   FspWrapperHobProcessLib
   CpuLib
-  UefiCpuLib
   PeCoffGetEntryPointLib
   PeCoffExtraActionLib
   PerformanceLib
diff --git a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
index 0598f85ab3ac..cad9fad96829 100644
--- a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
+++ b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
@@ -39,7 +39,6 @@
   FspWrapperPlatformLib
   FspWrapperHobProcessLib
   CpuLib
-  UefiCpuLib
   PeCoffGetEntryPointLib
   PeCoffExtraActionLib
   PerformanceLib
diff --git a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
index 21e089000eaf..233cb3d9ce2b 100644
--- a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
+++ b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
@@ -41,7 +41,6 @@
   DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
 
   # UefiCpuPkg
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
 
   # FSP Wrapper Lib
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 10/15] OvmfPkg: Remove UefiCpuLib from module INFs.
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
                   ` (8 preceding siblings ...)
  2022-03-29  6:36 ` [PATCH v1 09/15] IntelFsp2Pkg: Remove UefiCpuLib from module INFs Yu Pu
@ 2022-03-29  6:36 ` Yu Pu
  2022-03-29  6:36 ` [PATCH v1 11/15] PcAtChipsetPkg: " Yu Pu
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:36 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Ard Biesheuvel, Jiewen Yao, Jordan Justen, Gerd Hoffmann

Step 3 to merge UefiCpuLib to CpuLib.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Yu Pu <yu.pu@intel.com>
---
 OvmfPkg/Sec/SecMain.c          | 1 -
 OvmfPkg/AmdSev/AmdSevX64.dsc   | 1 -
 OvmfPkg/Bhyve/BhyveX64.dsc     | 1 -
 OvmfPkg/CloudHv/CloudHvX64.dsc | 1 -
 OvmfPkg/Microvm/MicrovmX64.dsc | 1 -
 OvmfPkg/OvmfPkgIa32.dsc        | 1 -
 OvmfPkg/OvmfPkgIa32X64.dsc     | 1 -
 OvmfPkg/OvmfPkgX64.dsc         | 1 -
 OvmfPkg/OvmfXen.dsc            | 1 -
 OvmfPkg/Sec/SecMain.inf        | 1 -
 10 files changed, 10 deletions(-)

diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c
index 2c9e439800c7..012ba0ede88a 100644
--- a/OvmfPkg/Sec/SecMain.c
+++ b/OvmfPkg/Sec/SecMain.c
@@ -18,7 +18,6 @@
 #include <Library/PeiServicesLib.h>
 #include <Library/PcdLib.h>
 #include <Library/CpuLib.h>
-#include <Library/UefiCpuLib.h>
 #include <Library/DebugAgentLib.h>
 #include <Library/IoLib.h>
 #include <Library/PeCoffLib.h>
diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index fd56176796d5..6a8dd3c1204a 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -161,7 +161,6 @@
   UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 5fa08bebd73c..567a44290258 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -159,7 +159,6 @@
   DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
   NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc
index b4d855d80f56..a543bea6f8cb 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.dsc
+++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
@@ -171,7 +171,6 @@
   DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
   NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
   QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index 1ea43443ae97..65a8c5698284 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -169,7 +169,6 @@
   DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
   NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 85abed24c1a7..8210eb447d5e 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -167,7 +167,6 @@
   DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
   NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index a9c1daecc1a8..806ae6696631 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -171,7 +171,6 @@
   DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
   NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 718399299f57..fafa8eea567d 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -171,7 +171,6 @@
   DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
   NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index efa97f09f32b..f62e8ab552e3 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -160,7 +160,6 @@
   DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
   NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
diff --git a/OvmfPkg/Sec/SecMain.inf b/OvmfPkg/Sec/SecMain.inf
index 6ad366a89333..c0cad1c2aed3 100644
--- a/OvmfPkg/Sec/SecMain.inf
+++ b/OvmfPkg/Sec/SecMain.inf
@@ -45,7 +45,6 @@
   PeiServicesLib
   PcdLib
   CpuLib
-  UefiCpuLib
   DebugAgentLib
   IoLib
   PeCoffLib
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 11/15] PcAtChipsetPkg: Remove UefiCpuLib from module INFs.
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
                   ` (9 preceding siblings ...)
  2022-03-29  6:36 ` [PATCH v1 10/15] OvmfPkg: " Yu Pu
@ 2022-03-29  6:36 ` Yu Pu
  2022-03-29  6:37 ` [PATCH v1 12/15] SourceLevelDebugPkg: " Yu Pu
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:36 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Ray Ni

Step 3 to merge UefiCpuLib to CpuLib.

Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Yu Pu <yu.pu@intel.com>
---
 PcAtChipsetPkg/PcAtChipsetPkg.dsc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dsc b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
index 451e60ddc857..2f02ecf6fd11 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.dsc
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
@@ -42,7 +42,6 @@
   ResetSystemLib|PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf
   IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf
   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
 
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 12/15] SourceLevelDebugPkg: Remove UefiCpuLib from module INFs.
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
                   ` (10 preceding siblings ...)
  2022-03-29  6:36 ` [PATCH v1 11/15] PcAtChipsetPkg: " Yu Pu
@ 2022-03-29  6:37 ` Yu Pu
  2022-03-29  6:37 ` [PATCH v1 13/15] UefiCpuPkg: " Yu Pu
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:37 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Hao A Wu

Step 3 to merge UefiCpuLib to CpuLib.

Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Yu Pu <yu.pu@intel.com>
---
 SourceLevelDebugPkg/SourceLevelDebugPkg.dsc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
index eba64a7b7877..986dd5a769d3 100644
--- a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
+++ b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
@@ -35,7 +35,6 @@
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
   SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
   SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
   PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 13/15] UefiCpuPkg: Remove UefiCpuLib from module INFs.
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
                   ` (11 preceding siblings ...)
  2022-03-29  6:37 ` [PATCH v1 12/15] SourceLevelDebugPkg: " Yu Pu
@ 2022-03-29  6:37 ` Yu Pu
  2022-03-29  6:37 ` [PATCH v1 14/15] UefiPayloadPkg: " Yu Pu
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:37 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Eric Dong, Ray Ni, Rahul Kumar

Step 3 to merge UefiCpuLib to CpuLib.

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>
---
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c               | 1 -
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c   | 1 -
 UefiCpuPkg/CpuDxe/CpuDxe.h                                   | 1 -
 UefiCpuPkg/CpuDxe/CpuDxe.inf                                 | 1 -
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf             | 1 -
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf | 1 -
 UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf                | 1 -
 UefiCpuPkg/Library/MpInitLib/MpLib.h                         | 1 -
 UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf                | 1 -
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h                   | 1 -
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf                 | 1 -
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h               | 1 -
 UefiCpuPkg/SecCore/SecCore.inf                               | 1 -
 UefiCpuPkg/SecCore/SecCoreNative.inf                         | 1 -
 UefiCpuPkg/SecCore/SecMain.h                                 | 1 -
 15 files changed, 15 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
index a944c3d01cf7..008b8a070bf9 100644
--- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
+++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
@@ -22,7 +22,6 @@
 #include <Library/TimerLib.h>
 #include <Library/PcdLib.h>
 #include <Library/CpuLib.h>
-#include <Library/UefiCpuLib.h>
 
 //
 // Library internal functions
diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
index 8b3630d7a302..f00c9bf4c05f 100644
--- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
+++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
@@ -23,7 +23,6 @@
 #include <Library/TimerLib.h>
 #include <Library/PcdLib.h>
 #include <Library/CpuLib.h>
-#include <Library/UefiCpuLib.h>
 
 //
 // Library internal functions
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.h b/UefiCpuPkg/CpuDxe/CpuDxe.h
index 2208671cb932..49a390b4c404 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.h
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.h
@@ -28,7 +28,6 @@
 #include <Library/DebugLib.h>
 #include <Library/MtrrLib.h>
 #include <Library/LocalApicLib.h>
-#include <Library/UefiCpuLib.h>
 #include <Library/UefiLib.h>
 #include <Library/CpuExceptionHandlerLib.h>
 #include <Library/HobLib.h>
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.inf b/UefiCpuPkg/CpuDxe/CpuDxe.inf
index d87fe503d152..c14ee3f2784a 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.inf
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.inf
@@ -33,7 +33,6 @@
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   LocalApicLib
-  UefiCpuLib
   UefiLib
   CpuExceptionHandlerLib
   HobLib
diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
index a85b69e0a11c..8c4eb655481d 100644
--- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
+++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
@@ -39,7 +39,6 @@
   IoLib
   PcdLib
   CpuLib
-  UefiCpuLib
 
 [Pcd]
   gUefiCpuPkgTokenSpaceGuid.PcdCpuInitIpiDelayInMicroSeconds  ## SOMETIMES_CONSUMES
diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
index 31ebdd39c616..713f1859c2e7 100644
--- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
+++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
@@ -39,7 +39,6 @@
   IoLib
   PcdLib
   CpuLib
-  UefiCpuLib
 
 [Pcd]
   gUefiCpuPkgTokenSpaceGuid.PcdCpuInitIpiDelayInMicroSeconds  ## SOMETIMES_CONSUMES
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
index e1cd0b350008..7450d9c729c9 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
@@ -49,7 +49,6 @@
   HobLib
   MtrrLib
   CpuLib
-  UefiCpuLib
   UefiBootServicesTableLib
   DebugAgentLib
   SynchronizationLib
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index f8c52426dd5f..693211ae3508 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -27,7 +27,6 @@
 #include <Library/DebugLib.h>
 #include <Library/LocalApicLib.h>
 #include <Library/CpuLib.h>
-#include <Library/UefiCpuLib.h>
 #include <Library/TimerLib.h>
 #include <Library/SynchronizationLib.h>
 #include <Library/MtrrLib.h>
diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
index 5facf4db9499..98864c648438 100644
--- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
@@ -49,7 +49,6 @@
   HobLib
   MtrrLib
   CpuLib
-  UefiCpuLib
   SynchronizationLib
   PeiServicesLib
   PcdLib
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
index dfeceec2aadc..d3a6e1702fdd 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
@@ -44,7 +44,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/HobLib.h>
 #include <Library/LocalApicLib.h>
 #include <Library/CpuLib.h>
-#include <Library/UefiCpuLib.h>
 #include <Library/CpuExceptionHandlerLib.h>
 #include <Library/ReportStatusCodeLib.h>
 #include <Library/SmmCpuFeaturesLib.h>
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
index deef00f9c6e9..fdd89da2239c 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
@@ -89,7 +89,6 @@
   HobLib
   PciLib
   LocalApicLib
-  UefiCpuLib
   SmmCpuPlatformHookLib
   CpuExceptionHandlerLib
   UefiLib
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
index 0e60509e20a8..964dd5281780 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
@@ -14,7 +14,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/UefiRuntimeServicesTableLib.h>
 #include <Library/DxeServicesTableLib.h>
 #include <Library/CpuLib.h>
-#include <Library/UefiCpuLib.h>
 #include <IndustryStandard/Acpi.h>
 
 #include "SmmProfileArch.h"
diff --git a/UefiCpuPkg/SecCore/SecCore.inf b/UefiCpuPkg/SecCore/SecCore.inf
index f021997f271c..3758aded3b49 100644
--- a/UefiCpuPkg/SecCore/SecCore.inf
+++ b/UefiCpuPkg/SecCore/SecCore.inf
@@ -48,7 +48,6 @@
   PcdLib
   DebugAgentLib
   CpuLib
-  UefiCpuLib
   PeCoffGetEntryPointLib
   PeCoffExtraActionLib
   CpuExceptionHandlerLib
diff --git a/UefiCpuPkg/SecCore/SecCoreNative.inf b/UefiCpuPkg/SecCore/SecCoreNative.inf
index e0a1b44a7e23..1ee6ff7d8817 100644
--- a/UefiCpuPkg/SecCore/SecCoreNative.inf
+++ b/UefiCpuPkg/SecCore/SecCoreNative.inf
@@ -45,7 +45,6 @@
   PcdLib
   DebugAgentLib
   CpuLib
-  UefiCpuLib
   PeCoffGetEntryPointLib
   PeCoffExtraActionLib
   CpuExceptionHandlerLib
diff --git a/UefiCpuPkg/SecCore/SecMain.h b/UefiCpuPkg/SecCore/SecMain.h
index 189fcf932625..b25f5d0f5e1b 100644
--- a/UefiCpuPkg/SecCore/SecMain.h
+++ b/UefiCpuPkg/SecCore/SecMain.h
@@ -24,7 +24,6 @@
 #include <Library/BaseMemoryLib.h>
 #include <Library/PlatformSecLib.h>
 #include <Library/CpuLib.h>
-#include <Library/UefiCpuLib.h>
 #include <Library/PeCoffGetEntryPointLib.h>
 #include <Library/PeCoffExtraActionLib.h>
 #include <Library/DebugAgentLib.h>
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 14/15] UefiPayloadPkg: Remove UefiCpuLib from module INFs.
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
                   ` (12 preceding siblings ...)
  2022-03-29  6:37 ` [PATCH v1 13/15] UefiCpuPkg: " Yu Pu
@ 2022-03-29  6:37 ` Yu Pu
  2022-03-29  6:37 ` [PATCH v1 15/15] UefiCpuLib: Remove UefiCpuLib Yu Pu
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:37 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Guo Dong, Ray Ni, Maurice Ma, Benjamin You, Sean Rhodes

Step 3 to merge UefiCpuLib to CpuLib.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Yu Pu <yu.pu@intel.com>
---
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h        | 1 -
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf      | 1 -
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf | 1 -
 UefiPayloadPkg/UefiPayloadPkg.dsc                         | 1 -
 4 files changed, 4 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
index d1c7425b28f2..ad8a9fd22b66 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
@@ -24,7 +24,6 @@
 #include <Library/BlParseLib.h>
 #include <Library/PlatformSupportLib.h>
 #include <Library/CpuLib.h>
-#include <Library/UefiCpuLib.h>
 #include <IndustryStandard/Acpi.h>
 #include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
 #include <Guid/SerialPortInfoGuid.h>
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
index 95446dd99729..d47e8e76cf4c 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
@@ -55,7 +55,6 @@
   PeCoffLib
   PlatformSupportLib
   CpuLib
-  UefiCpuLib
 
 [Guids]
   gEfiMemoryTypeInformationGuid
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
index 3b4836042a06..c4f4f28eaa86 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
@@ -53,7 +53,6 @@
   HobLib
   PeCoffLib
   CpuLib
-  UefiCpuLib
 
 [Guids]
   gEfiMemoryTypeInformationGuid
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 14a8d157a292..d0527e6e5bce 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -200,7 +200,6 @@
   UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
   DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
 
   #
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v1 15/15] UefiCpuLib: Remove UefiCpuLib.
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
                   ` (13 preceding siblings ...)
  2022-03-29  6:37 ` [PATCH v1 14/15] UefiPayloadPkg: " Yu Pu
@ 2022-03-29  6:37 ` Yu Pu
  2022-03-31  0:51 ` 回复: [edk2-devel] [PATCH v1 00/15] Merge UefiCpuLib to CpuLib gaoliming
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-03-29  6:37 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Eric Dong, Ray Ni, Rahul Kumar

Step 4 to merge UefiCpuLib to CpuLib.

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>
---
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c | 16 ---------
 UefiCpuPkg/Include/Library/UefiCpuLib.h                |  4 ---
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf   | 35 --------------------
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni   | 16 ---------
 UefiCpuPkg/UefiCpuPkg.dec                              |  5 ---
 UefiCpuPkg/UefiCpuPkg.dsc                              |  2 --
 6 files changed, 78 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c
deleted file mode 100644
index eaecd4ae5ed7..000000000000
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/** @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>
-STATIC
-VOID
-Dummy (
-  VOID
-  )
-{
-
-}
diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h b/UefiCpuPkg/Include/Library/UefiCpuLib.h
deleted file mode 100644
index c9de5a62d991..000000000000
--- a/UefiCpuPkg/Include/Library/UefiCpuLib.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __UEFI_CPU_LIB_H__
-#define __UEFI_CPU_LIB_H__
-
-#endif
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
deleted file mode 100644
index 9f8b62d87aae..000000000000
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
+++ /dev/null
@@ -1,35 +0,0 @@
-## @file
-#  This library defines some routines that are generic for IA32 family CPU.
-#
-#  The library routines are UEFI specification compliant.
-#
-#  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-#  Copyright (c) 2020, AMD Inc. All rights reserved.<BR>
-#  SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
-  INF_VERSION                    = 0x00010005
-  BASE_NAME                      = BaseUefiCpuLib
-  MODULE_UNI_FILE                = BaseUefiCpuLib.uni
-  FILE_GUID                      = 34C24FD7-7A90-45c2-89FD-946473D9CE98
-  MODULE_TYPE                    = BASE
-  VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = UefiCpuLib
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-#  VALID_ARCHITECTURES           = IA32 X64
-#
-
-[Sources]
-  BaseUefiCpuLibNull.c
-
-[Packages]
-  MdePkg/MdePkg.dec
-  UefiCpuPkg/UefiCpuPkg.dec
-
-[LibraryClasses]
-  BaseLib
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni
deleted file mode 100644
index 83c96cea67ce..000000000000
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni
+++ /dev/null
@@ -1,16 +0,0 @@
-// /** @file
-// This library defines some routines that are generic for IA32 family CPU.
-//
-// The library routines are UEFI specification compliant.
-//
-// Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT             #language en-US "Defines generic routines for IA32 family CPUs."
-
-#string STR_MODULE_DESCRIPTION          #language en-US "The library routines comply with the UEFI Specification."
-
diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
index 525cde463435..e40d78348f75 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -18,11 +18,6 @@
   Include
 
 [LibraryClasses]
-  ##  @libraryclass  Defines some routines that are generic for IA32 family CPU
-  ##                 to be UEFI specification compliant.
-  ##
-  UefiCpuLib|Include/Library/UefiCpuLib.h
-
   ##  @libraryclass  Defines some routines that are used to register/manage/program
   ##                 CPU features.
   ##
diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index a0bbde9985d3..985a271f18cf 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -31,7 +31,6 @@
   SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
-  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
   MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
@@ -136,7 +135,6 @@
   UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.inf
   UefiCpuPkg/CpuMpPei/CpuMpPei.inf
   UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
-  UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
   UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
   UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* 回复: [edk2-devel] [PATCH v1 00/15] Merge UefiCpuLib to CpuLib
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
                   ` (14 preceding siblings ...)
  2022-03-29  6:37 ` [PATCH v1 15/15] UefiCpuLib: Remove UefiCpuLib Yu Pu
@ 2022-03-31  0:51 ` gaoliming
  2022-04-01 13:45 ` Abner Chang
       [not found] ` <16E1C9BAAD925E7E.30116@groups.io>
  17 siblings, 0 replies; 20+ messages in thread
From: gaoliming @ 2022-03-31  0:51 UTC (permalink / raw)
  To: devel, yu.pu

The change in MdePkg is good to me.  Reviewed-by: Liming Gao
<gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Yu Pu
> 发送时间: 2022年3月29日 14:37
> 收件人: devel@edk2.groups.io
> 抄送: Yu Pu <yu.pu@intel.com>
> 主题: [edk2-devel] [PATCH v1 00/15] Merge UefiCpuLib to CpuLib
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3394
> 
> 
> 
> Today lots of duplicated code call CPUID and calculates the address
> 
> mask. Adding an API named GetPhysicalAddressBits in UefiCpuLib can
> 
> solve this problem, but at the same time cause MdeModulePkg depend
> 
> on UefiCpuPkg which does not meet the design spec. So merge UefiCpuLib
> 
> to CpuLib is a good way to sovle these problems. To minimize the impact,
> 
> this operation is divided into four steps.
> 
> Yu Pu (15):
>   IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib
>   IntelFsp2WrapperPkg: Add CpuLib to module INFs that depend on
>     UefiCpuLib.
>   MdePkg: Add CpuLib to module INFs that depend on UefiCpuLib.
>   OvmfPkg: Add CpuLib to module INFs that depend on  UefiCpuLib.
>   UefiCpuPkg: Add CpuLib to module INFs that depend on  UefiCpuLib.
>   UefiPayloadPkg: Add CpuLib to module INFs that  depend on UefiCpuLib.
>   MdePkg: Move API and implementation from UefiCpuLib to CpuLib
>   UefiCpuPkg: Move API and implementation from UefiCpuLib to CpuLib
>   IntelFsp2Pkg: Remove UefiCpuLib from module INFs.
>   OvmfPkg: Remove UefiCpuLib from module INFs.
>   PcAtChipsetPkg: Remove UefiCpuLib from module INFs.
>   SourceLevelDebugPkg: Remove UefiCpuLib from module  INFs.
>   UefiCpuPkg: Remove UefiCpuLib from module INFs.
>   UefiPayloadPkg: Remove UefiCpuLib from module INFs.
>   UefiCpuLib: Remove UefiCpuLib.
> 
>  MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
> | 122 ++++++++++++++++++++
>  OvmfPkg/Sec/SecMain.c
> |   2 +-
>  UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
> |  81 -------------
>  UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
> |   2 +-
>  UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
> |   2 +-
>  IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf
> |   2 +-
>  IntelFsp2Pkg/FspSecCore/SecMain.h
> |   2 +-
>  IntelFsp2Pkg/IntelFsp2Pkg.dsc
> |   1 -
>  IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc
> |   1 -
>  IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
> |   2 +-
>  IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
> |   2 +-
>  IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
> |   1 -
>  MdePkg/Include/Library/CpuLib.h
> |  65 +++++++++++
>  MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> |   6 +
>  {UefiCpuPkg/Library/BaseUefiCpuLib =>
> MdePkg/Library/BaseCpuLib}/Ia32/InitializeFpu.nasm |   0
>  {UefiCpuPkg/Library/BaseUefiCpuLib =>
> MdePkg/Library/BaseCpuLib}/X64/InitializeFpu.nasm  |   0
>  MdePkg/MdeLibs.dsc.inc
> |   1 +
>  OvmfPkg/AmdSev/AmdSevX64.dsc
> |   1 -
>  OvmfPkg/Bhyve/BhyveX64.dsc
> |   1 -
>  OvmfPkg/CloudHv/CloudHvX64.dsc
> |   1 -
>  OvmfPkg/Microvm/MicrovmX64.dsc
> |   1 -
>  OvmfPkg/OvmfPkgIa32.dsc
> |   1 -
>  OvmfPkg/OvmfPkgIa32X64.dsc
> |   1 -
>  OvmfPkg/OvmfPkgX64.dsc
> |   1 -
>  OvmfPkg/OvmfXen.dsc
> |   1 -
>  OvmfPkg/Sec/SecMain.inf
> |   2 +-
>  PcAtChipsetPkg/PcAtChipsetPkg.dsc
> |   1 -
>  SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
> |   1 -
>  UefiCpuPkg/CpuDxe/CpuDxe.h
> |   1 -
>  UefiCpuPkg/CpuDxe/CpuDxe.inf
> |   1 -
>  UefiCpuPkg/Include/Library/UefiCpuLib.h
> |  65 -----------
>  UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
> |  41 -------
>  UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni
> |  16 ---
>  UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
> |   2 +-
>  UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
> |   2 +-
>  UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
> |   1 -
>  UefiCpuPkg/Library/MpInitLib/MpLib.h
> |   1 -
>  UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
> |   1 -
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> |   2 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
> |   1 -
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
> |   1 -
>  UefiCpuPkg/SecCore/SecCore.inf
> |   2 +-
>  UefiCpuPkg/SecCore/SecCoreNative.inf
> |   2 +-
>  UefiCpuPkg/SecCore/SecMain.h
> |   2 +-
>  UefiCpuPkg/UefiCpuPkg.dec
> |   5 -
>  UefiCpuPkg/UefiCpuPkg.dsc
> |   2 -
>  UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
> |   2 +-
>  UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> |   2 +-
>  UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
> |   2 +-
>  UefiPayloadPkg/UefiPayloadPkg.dsc
> |   1 -
>  50 files changed, 211 insertions(+), 248 deletions(-)
>  create mode 100644 MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
>  delete mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
>  rename {UefiCpuPkg/Library/BaseUefiCpuLib =>
> MdePkg/Library/BaseCpuLib}/Ia32/InitializeFpu.nasm (100%)
>  rename {UefiCpuPkg/Library/BaseUefiCpuLib =>
> MdePkg/Library/BaseCpuLib}/X64/InitializeFpu.nasm (100%)
>  delete mode 100644 UefiCpuPkg/Include/Library/UefiCpuLib.h
>  delete mode 100644
> UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
>  delete mode 100644
> UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni
> 
> --
> 2.30.0.windows.2
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#88187): https://edk2.groups.io/g/devel/message/88187
> Mute This Topic: https://groups.io/mt/90116960/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
> 




^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [edk2-devel] [PATCH v1 00/15] Merge UefiCpuLib to CpuLib
  2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
                   ` (15 preceding siblings ...)
  2022-03-31  0:51 ` 回复: [edk2-devel] [PATCH v1 00/15] Merge UefiCpuLib to CpuLib gaoliming
@ 2022-04-01 13:45 ` Abner Chang
       [not found] ` <16E1C9BAAD925E7E.30116@groups.io>
  17 siblings, 0 replies; 20+ messages in thread
From: Abner Chang @ 2022-04-01 13:45 UTC (permalink / raw)
  To: devel@edk2.groups.io, yu.pu@intel.com

RISC-V port will follow this implementation.

Acked-by: Abner Chang <abner.chang@hpe.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Yu Pu
> Sent: Tuesday, March 29, 2022 2:37 PM
> To: devel@edk2.groups.io
> Cc: Yu Pu <yu.pu@intel.com>
> Subject: [edk2-devel] [PATCH v1 00/15] Merge UefiCpuLib to CpuLib
> 
> REF:INVALID URI REMOVED.
> cgi?id=3394__;!!NpxR!xX2rZhlg2fzyUFxuyOaXIdXyQT_5yKUpj_ImUmTUQvQ
> cy3zCD4VRcBtL-uHKGxM$
> 
> Today lots of duplicated code call CPUID and calculates the address
> mask. Adding an API named GetPhysicalAddressBits in UefiCpuLib can
> solve this problem, but at the same time cause MdeModulePkg depend
> on UefiCpuPkg which does not meet the design spec. So merge UefiCpuLib
> to CpuLib is a good way to sovle these problems. To minimize the impact,
> this operation is divided into four steps.
> 
> Yu Pu (15):
>   IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib
>   IntelFsp2WrapperPkg: Add CpuLib to module INFs that depend on
>     UefiCpuLib.
>   MdePkg: Add CpuLib to module INFs that depend on UefiCpuLib.
>   OvmfPkg: Add CpuLib to module INFs that depend on  UefiCpuLib.
>   UefiCpuPkg: Add CpuLib to module INFs that depend on  UefiCpuLib.
>   UefiPayloadPkg: Add CpuLib to module INFs that  depend on UefiCpuLib.
>   MdePkg: Move API and implementation from UefiCpuLib to CpuLib
>   UefiCpuPkg: Move API and implementation from UefiCpuLib to CpuLib
>   IntelFsp2Pkg: Remove UefiCpuLib from module INFs.
>   OvmfPkg: Remove UefiCpuLib from module INFs.
>   PcAtChipsetPkg: Remove UefiCpuLib from module INFs.
>   SourceLevelDebugPkg: Remove UefiCpuLib from module  INFs.
>   UefiCpuPkg: Remove UefiCpuLib from module INFs.
>   UefiPayloadPkg: Remove UefiCpuLib from module INFs.
>   UefiCpuLib: Remove UefiCpuLib.
> 
>  MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c                                                | 122
> ++++++++++++++++++++
>  OvmfPkg/Sec/SecMain.c                                                                    |   2 +-
>  UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c                                       |
> 81 -------------
>  UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c                                           |   2
> +-
>  UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
> |   2 +-
>  IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf                                                  |   2 +-
>  IntelFsp2Pkg/FspSecCore/SecMain.h                                                        |   2 +-
>  IntelFsp2Pkg/IntelFsp2Pkg.dsc                                                            |   1 -
>  IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc                                                  |   1 -
>  IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
> |   2 +-
>  IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
> |   2 +-
>  IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc                                              |   1 -
>  MdePkg/Include/Library/CpuLib.h                                                          |  65
> +++++++++++
>  MdePkg/Library/BaseCpuLib/BaseCpuLib.inf                                                 |   6 +
>  {UefiCpuPkg/Library/BaseUefiCpuLib =>
> MdePkg/Library/BaseCpuLib}/Ia32/InitializeFpu.nasm |   0
>  {UefiCpuPkg/Library/BaseUefiCpuLib =>
> MdePkg/Library/BaseCpuLib}/X64/InitializeFpu.nasm  |   0
>  MdePkg/MdeLibs.dsc.inc                                                                   |   1 +
>  OvmfPkg/AmdSev/AmdSevX64.dsc                                                             |   1 -
>  OvmfPkg/Bhyve/BhyveX64.dsc                                                               |   1 -
>  OvmfPkg/CloudHv/CloudHvX64.dsc                                                           |   1 -
>  OvmfPkg/Microvm/MicrovmX64.dsc                                                           |   1 -
>  OvmfPkg/OvmfPkgIa32.dsc                                                                  |   1 -
>  OvmfPkg/OvmfPkgIa32X64.dsc                                                               |   1 -
>  OvmfPkg/OvmfPkgX64.dsc                                                                   |   1 -
>  OvmfPkg/OvmfXen.dsc                                                                      |   1 -
>  OvmfPkg/Sec/SecMain.inf                                                                  |   2 +-
>  PcAtChipsetPkg/PcAtChipsetPkg.dsc                                                        |   1 -
>  SourceLevelDebugPkg/SourceLevelDebugPkg.dsc                                              |   1
> -
>  UefiCpuPkg/CpuDxe/CpuDxe.h                                                               |   1 -
>  UefiCpuPkg/CpuDxe/CpuDxe.inf                                                             |   1 -
>  UefiCpuPkg/Include/Library/UefiCpuLib.h                                                  |  65 ------
> -----
>  UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf                                     |
> 41 -------
>  UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni                                     |
> 16 ---
>  UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf                                         |   2
> +-
>  UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
> |   2 +-
>  UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf                                            |   1 -
>  UefiCpuPkg/Library/MpInitLib/MpLib.h                                                     |   1 -
>  UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf                                            |   1 -
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> |   2 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
> |   1 -
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
> |   1 -
>  UefiCpuPkg/SecCore/SecCore.inf                                                           |   2 +-
>  UefiCpuPkg/SecCore/SecCoreNative.inf                                                     |   2 +-
>  UefiCpuPkg/SecCore/SecMain.h                                                             |   2 +-
>  UefiCpuPkg/UefiCpuPkg.dec                                                                |   5 -
>  UefiCpuPkg/UefiCpuPkg.dsc                                                                |   2 -
>  UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h                                       |
> 2 +-
>  UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf                                     |
> 2 +-
>  UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
> |   2 +-
>  UefiPayloadPkg/UefiPayloadPkg.dsc                                                        |   1 -
>  50 files changed, 211 insertions(+), 248 deletions(-)
>  create mode 100644 MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
>  delete mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
>  rename {UefiCpuPkg/Library/BaseUefiCpuLib =>
> MdePkg/Library/BaseCpuLib}/Ia32/InitializeFpu.nasm (100%)
>  rename {UefiCpuPkg/Library/BaseUefiCpuLib =>
> MdePkg/Library/BaseCpuLib}/X64/InitializeFpu.nasm (100%)
>  delete mode 100644 UefiCpuPkg/Include/Library/UefiCpuLib.h
>  delete mode 100644
> UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
>  delete mode 100644
> UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni
> 
> --
> 2.30.0.windows.2
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v1 06/15] UefiPayloadPkg: Add CpuLib to module INFs that depend on UefiCpuLib.
  2022-04-11  9:45 [PATCH v1 00/15] Merge UefiCpuPkg/UefiCpuLib to MdePkg/CpuLib Yu Pu
@ 2022-04-11  9:45 ` Yu Pu
  0 siblings, 0 replies; 20+ messages in thread
From: Yu Pu @ 2022-04-11  9:45 UTC (permalink / raw)
  To: devel; +Cc: Yu Pu, Guo Dong, Ray Ni, Maurice Ma, Benjamin You, Sean Rhodes

There are two libraries: MdePkg/CpuLib and UefiCpuPkg/UefiCpuLib and
UefiCpuPkg/UefiCpuLib will be merged to MdePkg/CpuLib. To avoid build
failure, add CpuLib dependency to all modules that depend on UefiCpuLib.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Yu Pu <yu.pu@intel.com>
---
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h        | 1 +
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf      | 1 +
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf | 1 +
 3 files changed, 3 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
index 56e0a4c639a0..d1c7425b28f2 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
@@ -23,6 +23,7 @@
 #include <Library/PeCoffLib.h>
 #include <Library/BlParseLib.h>
 #include <Library/PlatformSupportLib.h>
+#include <Library/CpuLib.h>
 #include <Library/UefiCpuLib.h>
 #include <IndustryStandard/Acpi.h>
 #include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
index c4e4339ede4b..95446dd99729 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
@@ -54,6 +54,7 @@
   HobLib
   PeCoffLib
   PlatformSupportLib
+  CpuLib
   UefiCpuLib
 
 [Guids]
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
index 80af5afe0a3f..3b4836042a06 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
@@ -52,6 +52,7 @@
   IoLib
   HobLib
   PeCoffLib
+  CpuLib
   UefiCpuLib
 
 [Guids]
-- 
2.30.0.windows.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [edk2-devel] [PATCH v1 00/15] Merge UefiCpuLib to CpuLib
       [not found] ` <16E1C9BAAD925E7E.30116@groups.io>
@ 2022-04-19  6:50   ` Abner Chang
  0 siblings, 0 replies; 20+ messages in thread
From: Abner Chang @ 2022-04-19  6:50 UTC (permalink / raw)
  To: devel@edk2.groups.io, yu.pu@intel.com,
	Chang, Abner (HPS SW/FW Technologist)

[-- Attachment #1: Type: text/plain, Size: 7867 bytes --]

Hi Pu,
When would you expect having CpuLib merged to edk2 mainstream?
Regards,
Abner
________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Abner Chang <abner.chang@hpe.com>
Sent: Friday, April 1, 2022 9:45 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>; yu.pu@intel.com <yu.pu@intel.com>
Subject: Re: [edk2-devel] [PATCH v1 00/15] Merge UefiCpuLib to CpuLib

RISC-V port will follow this implementation.

Acked-by: Abner Chang <abner.chang@hpe.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Yu Pu
> Sent: Tuesday, March 29, 2022 2:37 PM
> To: devel@edk2.groups.io
> Cc: Yu Pu <yu.pu@intel.com>
> Subject: [edk2-devel] [PATCH v1 00/15] Merge UefiCpuLib to CpuLib
>
> REF:INVALID URI REMOVED.
> cgi?id=3394__;!!NpxR!xX2rZhlg2fzyUFxuyOaXIdXyQT_5yKUpj_ImUmTUQvQ
> cy3zCD4VRcBtL-uHKGxM$
>
> Today lots of duplicated code call CPUID and calculates the address
> mask. Adding an API named GetPhysicalAddressBits in UefiCpuLib can
> solve this problem, but at the same time cause MdeModulePkg depend
> on UefiCpuPkg which does not meet the design spec. So merge UefiCpuLib
> to CpuLib is a good way to sovle these problems. To minimize the impact,
> this operation is divided into four steps.
>
> Yu Pu (15):
>   IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib
>   IntelFsp2WrapperPkg: Add CpuLib to module INFs that depend on
>     UefiCpuLib.
>   MdePkg: Add CpuLib to module INFs that depend on UefiCpuLib.
>   OvmfPkg: Add CpuLib to module INFs that depend on  UefiCpuLib.
>   UefiCpuPkg: Add CpuLib to module INFs that depend on  UefiCpuLib.
>   UefiPayloadPkg: Add CpuLib to module INFs that  depend on UefiCpuLib.
>   MdePkg: Move API and implementation from UefiCpuLib to CpuLib
>   UefiCpuPkg: Move API and implementation from UefiCpuLib to CpuLib
>   IntelFsp2Pkg: Remove UefiCpuLib from module INFs.
>   OvmfPkg: Remove UefiCpuLib from module INFs.
>   PcAtChipsetPkg: Remove UefiCpuLib from module INFs.
>   SourceLevelDebugPkg: Remove UefiCpuLib from module  INFs.
>   UefiCpuPkg: Remove UefiCpuLib from module INFs.
>   UefiPayloadPkg: Remove UefiCpuLib from module INFs.
>   UefiCpuLib: Remove UefiCpuLib.
>
>  MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c                                                | 122
> ++++++++++++++++++++
>  OvmfPkg/Sec/SecMain.c                                                                    |   2 +-
>  UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c                                       |
> 81 -------------
>  UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c                                           |   2
> +-
>  UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
> |   2 +-
>  IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf                                                  |   2 +-
>  IntelFsp2Pkg/FspSecCore/SecMain.h                                                        |   2 +-
>  IntelFsp2Pkg/IntelFsp2Pkg.dsc                                                            |   1 -
>  IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc                                                  |   1 -
>  IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
> |   2 +-
>  IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
> |   2 +-
>  IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc                                              |   1 -
>  MdePkg/Include/Library/CpuLib.h                                                          |  65
> +++++++++++
>  MdePkg/Library/BaseCpuLib/BaseCpuLib.inf                                                 |   6 +
>  {UefiCpuPkg/Library/BaseUefiCpuLib =>
> MdePkg/Library/BaseCpuLib}/Ia32/InitializeFpu.nasm |   0
>  {UefiCpuPkg/Library/BaseUefiCpuLib =>
> MdePkg/Library/BaseCpuLib}/X64/InitializeFpu.nasm  |   0
>  MdePkg/MdeLibs.dsc.inc                                                                   |   1 +
>  OvmfPkg/AmdSev/AmdSevX64.dsc                                                             |   1 -
>  OvmfPkg/Bhyve/BhyveX64.dsc                                                               |   1 -
>  OvmfPkg/CloudHv/CloudHvX64.dsc                                                           |   1 -
>  OvmfPkg/Microvm/MicrovmX64.dsc                                                           |   1 -
>  OvmfPkg/OvmfPkgIa32.dsc                                                                  |   1 -
>  OvmfPkg/OvmfPkgIa32X64.dsc                                                               |   1 -
>  OvmfPkg/OvmfPkgX64.dsc                                                                   |   1 -
>  OvmfPkg/OvmfXen.dsc                                                                      |   1 -
>  OvmfPkg/Sec/SecMain.inf                                                                  |   2 +-
>  PcAtChipsetPkg/PcAtChipsetPkg.dsc                                                        |   1 -
>  SourceLevelDebugPkg/SourceLevelDebugPkg.dsc                                              |   1
> -
>  UefiCpuPkg/CpuDxe/CpuDxe.h                                                               |   1 -
>  UefiCpuPkg/CpuDxe/CpuDxe.inf                                                             |   1 -
>  UefiCpuPkg/Include/Library/UefiCpuLib.h                                                  |  65 ------
> -----
>  UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf                                     |
> 41 -------
>  UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni                                     |
> 16 ---
>  UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf                                         |   2
> +-
>  UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
> |   2 +-
>  UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf                                            |   1 -
>  UefiCpuPkg/Library/MpInitLib/MpLib.h                                                     |   1 -
>  UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf                                            |   1 -
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> |   2 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
> |   1 -
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
> |   1 -
>  UefiCpuPkg/SecCore/SecCore.inf                                                           |   2 +-
>  UefiCpuPkg/SecCore/SecCoreNative.inf                                                     |   2 +-
>  UefiCpuPkg/SecCore/SecMain.h                                                             |   2 +-
>  UefiCpuPkg/UefiCpuPkg.dec                                                                |   5 -
>  UefiCpuPkg/UefiCpuPkg.dsc                                                                |   2 -
>  UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h                                       |
> 2 +-
>  UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf                                     |
> 2 +-
>  UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
> |   2 +-
>  UefiPayloadPkg/UefiPayloadPkg.dsc                                                        |   1 -
>  50 files changed, 211 insertions(+), 248 deletions(-)
>  create mode 100644 MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
>  delete mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
>  rename {UefiCpuPkg/Library/BaseUefiCpuLib =>
> MdePkg/Library/BaseCpuLib}/Ia32/InitializeFpu.nasm (100%)
>  rename {UefiCpuPkg/Library/BaseUefiCpuLib =>
> MdePkg/Library/BaseCpuLib}/X64/InitializeFpu.nasm (100%)
>  delete mode 100644 UefiCpuPkg/Include/Library/UefiCpuLib.h
>  delete mode 100644
> UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
>  delete mode 100644
> UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni
>
> --
> 2.30.0.windows.2
>
>
>
>
>







[-- Attachment #2: Type: text/html, Size: 21625 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-04-19  6:50 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-29  6:36 [PATCH v1 00/15] Merge UefiCpuLib to CpuLib Yu Pu
2022-03-29  6:36 ` [PATCH v1 01/15] IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib Yu Pu
2022-03-29  6:36 ` [PATCH v1 02/15] IntelFsp2WrapperPkg: " Yu Pu
2022-03-29  6:36 ` [PATCH v1 03/15] MdePkg: " Yu Pu
2022-03-29  6:36 ` [PATCH v1 04/15] OvmfPkg: " Yu Pu
2022-03-29  6:36 ` [PATCH v1 05/15] UefiCpuPkg: " Yu Pu
2022-03-29  6:36 ` [PATCH v1 06/15] UefiPayloadPkg: " Yu Pu
2022-03-29  6:36 ` [PATCH v1 07/15] MdePkg: Move API and implementation from UefiCpuLib to CpuLib Yu Pu
2022-03-29  6:36 ` [PATCH v1 08/15] UefiCpuPkg: " Yu Pu
2022-03-29  6:36 ` [PATCH v1 09/15] IntelFsp2Pkg: Remove UefiCpuLib from module INFs Yu Pu
2022-03-29  6:36 ` [PATCH v1 10/15] OvmfPkg: " Yu Pu
2022-03-29  6:36 ` [PATCH v1 11/15] PcAtChipsetPkg: " Yu Pu
2022-03-29  6:37 ` [PATCH v1 12/15] SourceLevelDebugPkg: " Yu Pu
2022-03-29  6:37 ` [PATCH v1 13/15] UefiCpuPkg: " Yu Pu
2022-03-29  6:37 ` [PATCH v1 14/15] UefiPayloadPkg: " Yu Pu
2022-03-29  6:37 ` [PATCH v1 15/15] UefiCpuLib: Remove UefiCpuLib Yu Pu
2022-03-31  0:51 ` 回复: [edk2-devel] [PATCH v1 00/15] Merge UefiCpuLib to CpuLib gaoliming
2022-04-01 13:45 ` Abner Chang
     [not found] ` <16E1C9BAAD925E7E.30116@groups.io>
2022-04-19  6:50   ` Abner Chang
  -- strict thread matches above, loose matches on Subject: below --
2022-04-11  9:45 [PATCH v1 00/15] Merge UefiCpuPkg/UefiCpuLib to MdePkg/CpuLib Yu Pu
2022-04-11  9:45 ` [PATCH v1 06/15] UefiPayloadPkg: Add CpuLib to module INFs that depend on UefiCpuLib Yu Pu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox