[edk2-devel] [PATCH v2 13/14] UefiPayloadPkg: Remove UefiCpuLib from module INFs.

2022-04-12 Thread Yu Pu
Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib, remove the
dependency of UefiCpuLib.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Cc: Sean Rhodes 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88820): https://edk2.groups.io/g/devel/message/88820
Mute This Topic: https://groups.io/mt/90431730/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 12/14] UefiCpuPkg: Remove UefiCpuLib from module INFs.

2022-04-12 Thread Yu Pu
Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib, remove the
dependency of UefiCpuLib.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
-#include 
 
 //
 // 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 
 #include 
 #include 
-#include 
 
 //
 // 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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf 
b/UefiCpuPkg/PiSmmCpuDxeSmm

[edk2-devel] [PATCH v2 14/14] UefiCpuLib: Remove UefiCpuLib.

2022-04-12 Thread Yu Pu
Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib and all modules
are updated to not depend on this library, remove it completely.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c | 16 -
 UefiCpuPkg/Include/Library/UefiCpuLib.h| 16 -
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf   | 35 

 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni   | 16 -
 UefiCpuPkg/UefiCpuPkg.dec  |  5 ---
 UefiCpuPkg/UefiCpuPkg.dsc  |  2 --
 6 files changed, 90 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c 
b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c
deleted file mode 100644
index eaecd4ae5ed7..
--- 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 
-STATIC
-VOID
-Dummy (
-  VOID
-  )
-{
-
-}
diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h 
b/UefiCpuPkg/Include/Library/UefiCpuLib.h
deleted file mode 100644
index ab6982db6e9c..
--- a/UefiCpuPkg/Include/Library/UefiCpuLib.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/** @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.
-  Copyright (c) 2020, AMD Inc. All rights reserved.
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#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..
--- 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.
-#  Copyright (c) 2020, AMD Inc. All rights reserved.
-#  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..
--- 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.
-//
-// 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/Librar

[edk2-devel] [PATCH v2 11/14] SourceLevelDebugPkg: Remove UefiCpuLib from module INFs.

2022-04-12 Thread Yu Pu
Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib, remove the
dependency of UefiCpuLib.

Cc: Hao A Wu 
Signed-off-by: Yu Pu 
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88818): https://edk2.groups.io/g/devel/message/88818
Mute This Topic: https://groups.io/mt/90431728/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 09/14] OvmfPkg: Remove UefiCpuLib from module INFs.

2022-04-12 Thread Yu Pu
Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib, remove the
dependency of UefiCpuLib.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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

[edk2-devel] [PATCH v2 10/14] PcAtChipsetPkg: Remove UefiCpuLib from module INFs.

2022-04-12 Thread Yu Pu
Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib, remove the
dependency of UefiCpuLib.

Cc: Ray Ni 
Signed-off-by: Yu Pu 
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88817): https://edk2.groups.io/g/devel/message/88817
Mute This Topic: https://groups.io/mt/90431727/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 08/14] IntelFsp2Pkg: Remove UefiCpuLib from module INFs.

2022-04-12 Thread Yu Pu
Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib, remove the
dependency of UefiCpuLib.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
-#include 
 #include 
 
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88815): https://edk2.groups.io/g/devel/message/88815
Mute This Topic: https://groups.io/mt/90431725/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 05/14] UefiCpuPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-12 Thread Yu Pu
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: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 
 //
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 
 #include 
 #include 
+#include 
 #include 
 
 //
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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88812): https://edk2.groups.io/g/devel/message/88812
Mute This Topic: https://groups.io/mt/90431722/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 06/14] UefiPayloadPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-12 Thread Yu Pu
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 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Cc: Sean Rhodes 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88813): https://edk2.groups.io/g/devel/message/88813
Mute This Topic: https://groups.io/mt/90431723/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 07/14] MdePkg: Move API and implementation from UefiCpuLib to CpuLib

2022-04-12 Thread Yu Pu
There are two libraries: MdePkg/CpuLib and UefiCpuPkg/UefiCpuLib. This
patch merges UefiCpuPkg/UefiCpuLib to MdePkg/CpuLib.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c => 
MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c |  2 +-
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c 
 | 16 +++
 MdePkg/Include/Library/CpuLib.h
 | 48 +++
 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
 UefiCpuPkg/Include/Library/UefiCpuLib.h
 | 49 
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf   
 |  8 +---
 8 files changed, 72 insertions(+), 57 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c 
b/MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
similarity index 93%
rename from UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
rename to MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
index 5d925bc273f8..1cad32a4beb0 100644
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
+++ b/MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
@@ -13,7 +13,7 @@
 #include 
 
 #include 
-#include 
+#include 
 
 /**
   Determine if the standard CPU signature is "AuthenticAMD".
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c 
b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c
new file mode 100644
index ..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 
+STATIC
+VOID
+Dummy (
+  VOID
+  )
+{
+
+}
diff --git a/MdePkg/Include/Library/CpuLib.h b/MdePkg/Include/Library/CpuLib.h
index 25f6d9478c52..3f29937dc71b 100644
--- a/MdePkg/Include/Library/CpuLib.h
+++ b/MdePkg/Include/Library/CpuLib.h
@@ -41,4 +41,52 @@ CpuFlushTlb (
   VOID
   );
 
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
+
+/**
+  Initializes floating point units for requirement of UEFI specification.
+  This function initializes floating-point control word to 0x027F (all 
exceptions
+  masked,double-precision, round-to-nearest) and multimedia-extensions control 
word
+  (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to 
zero
+  for masked underflow).
+**/
+VOID
+EFIAPI
+InitializeFloatingPointUnits (
+  VOID
+  );
+
+/**
+  Determine if the standard CPU signature is "AuthenticAMD".
+  @retval TRUE  The CPU signature matches.
+  @retval FALSE The CPU signature does not match.
+**/
+BOOLEAN
+EFIAPI
+StandardSignatureIsAuthenticAMD (
+  VOID
+  );
+
+/**
+  Return the 32bit CPU family and model value.
+  @return CPUID[01h].EAX with Processor Type and Stepping ID cleared.
+**/
+UINT32
+EFIAPI
+GetCpuFamilyModel (
+  VOID
+  );
+
+/**
+  Return the CPU stepping ID.
+  @return CPU stepping ID value in CPUID[01h].EAX.
+**/
+UINT8
+EFIAPI
+GetCpuSteppingId (
+  VOID
+  );
+
+#endif
+
 #endif
diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf 
b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
index 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/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm 
b/MdePkg/Library/BaseCpuLib/Ia32/InitializeFpu.nasm
similarity index 100%
rename from UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm
rename to MdePkg/Library/BaseCpuLib/Ia32/InitializeFpu.nasm
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm 
b/MdePkg/Library/BaseCpuLib/X64/InitializeFpu.nasm
similarity index 100%
rename from UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm
rename to MdePkg/Library/BaseCpuLib/X64/InitializeFpu.nasm
diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h 
b/UefiCpuPkg/Include/Library/UefiCpuLib.h
index 0ff4a35774c1..ab6982db6e9c 100644
--- a/UefiCpuPkg/Include/Library/UefiCpuLib.h
+++ b/UefiCpuPkg/Include/L

[edk2-devel] [PATCH v2 04/14] OvmfPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-12 Thread Yu Pu
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: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88811): https://edk2.groups.io/g/devel/message/88811
Mute This Topic: https://groups.io/mt/90431721/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 03/14] IntelFsp2WrapperPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-12 Thread Yu Pu
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: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88810): https://edk2.groups.io/g/devel/message/88810
Mute This Topic: https://groups.io/mt/90431720/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 02/14] IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib

2022-04-12 Thread Yu Pu
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: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88809): https://edk2.groups.io/g/devel/message/88809
Mute This Topic: https://groups.io/mt/90431719/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 01/14] MdePkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-12 Thread Yu Pu
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: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Signed-off-by: Yu Pu 
---
 MdePkg/MdeLibs.dsc.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdePkg/MdeLibs.dsc.inc b/MdePkg/MdeLibs.dsc.inc
index 3c70daf87a0c..015ce46f7d3b 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88808): https://edk2.groups.io/g/devel/message/88808
Mute This Topic: https://groups.io/mt/90431718/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 00/14] merge UefiCpuPkg/UefiCpuLib to MdePkg/CpuLib

2022-04-12 Thread 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 change is carried out in four steps.

Yu Pu (14):
  MdePkg: Add CpuLib to module INFs that depend on UefiCpuLib.
  IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib
  IntelFsp2WrapperPkg: 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
  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.

 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c => 
MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c |  2 +-
 OvmfPkg/Sec/SecMain.c  
 |  2 +-
 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
 | 48 +++
 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/DxeMpIn

[edk2-devel] [PATCH v1 14/15] UefiPayloadPkg: Remove UefiCpuLib from module INFs.

2022-04-11 Thread Yu Pu
Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib, remove the
dependency of UefiCpuLib.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Cc: Sean Rhodes 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88744): https://edk2.groups.io/g/devel/message/88744
Mute This Topic: https://groups.io/mt/90407124/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 13/15] UefiCpuPkg: Remove UefiCpuLib from module INFs.

2022-04-11 Thread Yu Pu
Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib, remove the
dependency of UefiCpuLib.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
-#include 
 
 //
 // 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 
 #include 
 #include 
-#include 
 
 //
 // 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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf 
b/UefiCpuPkg/PiSmmCpuDxeSmm

[edk2-devel] [PATCH v1 12/15] SourceLevelDebugPkg: Remove UefiCpuLib from module INFs.

2022-04-11 Thread Yu Pu
Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib, remove the
dependency of UefiCpuLib.

Cc: Hao A Wu 
Signed-off-by: Yu Pu 
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88742): https://edk2.groups.io/g/devel/message/88742
Mute This Topic: https://groups.io/mt/90407122/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 15/15] UefiCpuLib: Remove UefiCpuLib.

2022-04-11 Thread Yu Pu
Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib and all modules
are updated to not depend on this library, remove it completely.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c | 16 -
 UefiCpuPkg/Include/Library/UefiCpuLib.h| 12 ---
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf   | 35 

 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni   | 16 -
 UefiCpuPkg/UefiCpuPkg.dec  |  5 ---
 UefiCpuPkg/UefiCpuPkg.dsc  |  2 --
 6 files changed, 86 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c 
b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c
deleted file mode 100644
index eaecd4ae5ed7..
--- 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 
-STATIC
-VOID
-Dummy (
-  VOID
-  )
-{
-
-}
diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h 
b/UefiCpuPkg/Include/Library/UefiCpuLib.h
deleted file mode 100644
index 88fc69494c1c..
--- a/UefiCpuPkg/Include/Library/UefiCpuLib.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/** @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.
-  Copyright (c) 2020, AMD Inc. All rights reserved.
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-#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..
--- 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.
-#  Copyright (c) 2020, AMD Inc. All rights reserved.
-#  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..
--- 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.
-//
-// 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/Ba

[edk2-devel] [PATCH v1 08/15] UefiCpuPkg: Move API and implementation from UefiCpuLib to CpuLib

2022-04-11 Thread Yu Pu
There are two libraries: MdePkg/CpuLib and UefiCpuPkg/UefiCpuLib. This
patch merges UefiCpuPkg/UefiCpuLib to MdePkg/CpuLib.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c| 81 

 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c| 16 
 UefiCpuPkg/Include/Library/UefiCpuLib.h   | 53 -
 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(+), 260 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c 
b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
deleted file mode 100644
index 5d925bc273f8..
--- 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.
-  Copyright (c) 2021, Intel Corporation. All rights reserved.
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include 
-#include 
-
-#include 
-#include 
-
-/**
-  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, , , );
-  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, , 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, , 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 ..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 
+STATIC
+VOID
+Dummy (
+  VOID
+  )
+{
+
+}
diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h 
b/UefiCpuPkg/Include/Library/UefiCpuLib.h
index 0ff4a35774c1..88fc69494c1c 100644
--- a/UefiCpuPkg/Include/Library/UefiCpuLib.h
+++ b/UefiCpuPkg/Include/Library/UefiCpuLib.h
@@ -1,65 +1,12 @@
 /** @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.
   Copyright (c) 2020, AMD Inc. All rights reserved.
   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..9f8b62d8

[edk2-devel] [PATCH v1 09/15] IntelFsp2Pkg: Remove UefiCpuLib from module INFs.

2022-04-11 Thread Yu Pu
Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib, remove the
dependency of UefiCpuLib.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
-#include 
 #include 
 
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88738): https://edk2.groups.io/g/devel/message/88738
Mute This Topic: https://groups.io/mt/90407118/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 10/15] OvmfPkg: Remove UefiCpuLib from module INFs.

2022-04-11 Thread Yu Pu
Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib, remove the
dependency of UefiCpuLib.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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

[edk2-devel] [PATCH v1 11/15] PcAtChipsetPkg: Remove UefiCpuLib from module INFs.

2022-04-11 Thread Yu Pu
Because UefiCpuPkg/UefiCpuLib is merged to MdePkg/CpuLib, remove the
dependency of UefiCpuLib.

Cc: Ray Ni 
Signed-off-by: Yu Pu 
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88741): https://edk2.groups.io/g/devel/message/88741
Mute This Topic: https://groups.io/mt/90407121/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 07/15] MdePkg: Move API and implementation from UefiCpuLib to CpuLib

2022-04-11 Thread Yu Pu
There are two libraries: MdePkg/CpuLib and UefiCpuPkg/UefiCpuLib. This
patch merges UefiCpuPkg/UefiCpuLib to MdePkg/CpuLib.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Signed-off-by: Yu Pu 
---
 MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c | 75 
 MdePkg/Include/Library/CpuLib.h   | 48 +
 MdePkg/Library/BaseCpuLib/BaseCpuLib.inf  |  6 ++
 MdePkg/Library/BaseCpuLib/Ia32/InitializeFpu.nasm | 68 ++
 MdePkg/Library/BaseCpuLib/X64/InitializeFpu.nasm  | 51 +
 5 files changed, 248 insertions(+)

diff --git a/MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c 
b/MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
new file mode 100644
index ..e69f00417022
--- /dev/null
+++ b/MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
@@ -0,0 +1,75 @@
+/** @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.
+  Copyright (c) 2021, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+#include 
+
+#include 
+#include 
+
+/**
+  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, , , );
+  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, , 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, , NULL, NULL, NULL);
+
+  return (UINT8)Eax.Bits.SteppingId;
+}
diff --git a/MdePkg/Include/Library/CpuLib.h b/MdePkg/Include/Library/CpuLib.h
index 25f6d9478c52..3f29937dc71b 100644
--- a/MdePkg/Include/Library/CpuLib.h
+++ b/MdePkg/Include/Library/CpuLib.h
@@ -41,4 +41,52 @@ CpuFlushTlb (
   VOID
   );
 
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
+
+/**
+  Initializes floating point units for requirement of UEFI specification.
+  This function initializes floating-point control word to 0x027F (all 
exceptions
+  masked,double-precision, round-to-nearest) and multimedia-extensions control 
word
+  (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to 
zero
+  for masked underflow).
+**/
+VOID
+EFIAPI
+InitializeFloatingPointUnits (
+  VOID
+  );
+
+/**
+  Determine if the standard CPU signature is "AuthenticAMD".
+  @retval TRUE  The CPU signature matches.
+  @retval FALSE The CPU signature does not match.
+**/
+BOOLEAN
+EFIAPI
+StandardSignatureIsAuthenticAMD (
+  VOID
+  );
+
+/**
+  Return the 32bit CPU family and model value.
+  @return CPUID[01h].EAX with Processor Type and Stepping ID cleared.
+**/
+UINT32
+EFIAPI
+GetCpuFamilyModel (
+  VOID
+  );
+
+/**
+  Return the CPU stepping ID.
+  @return CPU stepping ID value in CPUID[01h].EAX.
+**/
+UINT8
+EFIAPI
+GetCpuSteppingId (
+  VOID
+  );
+
+#endif
+
 #endif
diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf 
b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
index 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 ..5e27cc325012
--- /dev/null
+++ b/MdePkg/Library/BaseCpuLib/Ia32/InitializeFpu.nasm
@@ -0,0 +1,68 @@
+;--
+;*
+;*   Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
+;*   SPDX-Lic

[edk2-devel] [PATCH v1 04/15] OvmfPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-11 Thread Yu Pu
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: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88734): https://edk2.groups.io/g/devel/message/88734
Mute This Topic: https://groups.io/mt/90407114/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 06/15] UefiPayloadPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-11 Thread Yu Pu
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 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Cc: Sean Rhodes 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88736): https://edk2.groups.io/g/devel/message/88736
Mute This Topic: https://groups.io/mt/90407116/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 05/15] UefiCpuPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-11 Thread Yu Pu
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: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 
 //
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 
 #include 
 #include 
+#include 
 #include 
 
 //
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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88735): https://edk2.groups.io/g/devel/message/88735
Mute This Topic: https://groups.io/mt/90407115/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 01/15] IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib

2022-04-11 Thread Yu Pu
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: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88731): https://edk2.groups.io/g/devel/message/88731
Mute This Topic: https://groups.io/mt/90407111/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 00/15] Merge UefiCpuPkg/UefiCpuLib to MdePkg/CpuLib

2022-04-11 Thread 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. This patch sets contain the first step: add
CpuLib to module INFs that depend on UefiCpuLib.

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.

 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c => 
MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c |  8 +--
 OvmfPkg/Sec/SecMain.c  
 |  2 +-
 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
 | 48 +++
 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 +-
 UefiCpuPk

[edk2-devel] [PATCH v1 03/15] MdePkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-11 Thread Yu Pu
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: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Signed-off-by: Yu Pu 
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88733): https://edk2.groups.io/g/devel/message/88733
Mute This Topic: https://groups.io/mt/90407113/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 02/15] IntelFsp2WrapperPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-11 Thread Yu Pu
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: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88732): https://edk2.groups.io/g/devel/message/88732
Mute This Topic: https://groups.io/mt/90407112/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 5/6] UefiCpuPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-01 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 
 //
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 
 #include 
 #include 
+#include 
 #include 
 
 //
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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88331): https://edk2.groups.io/g/devel/message/88331
Mute This Topic: https://groups.io/mt/90179541/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 6/6] UefiPayloadPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-01 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Cc: Sean Rhodes 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88332): https://edk2.groups.io/g/devel/message/88332
Mute This Topic: https://groups.io/mt/90179542/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 2/6] IntelFsp2WrapperPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-01 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88328): https://edk2.groups.io/g/devel/message/88328
Mute This Topic: https://groups.io/mt/90179537/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 4/6] OvmfPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-01 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88330): https://edk2.groups.io/g/devel/message/88330
Mute This Topic: https://groups.io/mt/90179540/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 3/6] MdePkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-04-01 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Signed-off-by: Yu Pu 
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88329): https://edk2.groups.io/g/devel/message/88329
Mute This Topic: https://groups.io/mt/90179538/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 1/6] IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib

2022-04-01 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88327): https://edk2.groups.io/g/devel/message/88327
Mute This Topic: https://groups.io/mt/90179536/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 0/6] Merge UefiCpuLib to CpuLib

2022-04-01 Thread 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. This patch sets contain the first step: add
CpuLib to module INFs that depend on UefiCpuLib.

Yu Pu (6):
  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.

 OvmfPkg/Sec/SecMain.c| 1 +
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c   | 1 +
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c   | 1 +
 IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf  | 1 +
 IntelFsp2Pkg/FspSecCore/SecMain.h| 1 +
 IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf  | 1 +
 IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf  | 1 +
 MdePkg/MdeLibs.dsc.inc   | 1 +
 OvmfPkg/Sec/SecMain.inf  | 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 +
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h   | 1 +
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf | 1 +
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf| 1 +
 18 files changed, 18 insertions(+)

-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88326): https://edk2.groups.io/g/devel/message/88326
Mute This Topic: https://groups.io/mt/90179534/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 15/15] UefiCpuLib: Remove UefiCpuLib.

2022-03-29 Thread Yu Pu
Step 4 to merge UefiCpuLib to CpuLib.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 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..
--- 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 
-STATIC
-VOID
-Dummy (
-  VOID
-  )
-{
-
-}
diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h 
b/UefiCpuPkg/Include/Library/UefiCpuLib.h
deleted file mode 100644
index c9de5a62d991..
--- 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..
--- 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.
-#  Copyright (c) 2020, AMD Inc. All rights reserved.
-#  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..
--- 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.
-//
-// 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
 

[edk2-devel] [PATCH v1 06/15] UefiPayloadPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-03-29 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Cc: Sean Rhodes 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88193): https://edk2.groups.io/g/devel/message/88193
Mute This Topic: https://groups.io/mt/90116966/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 14/15] UefiPayloadPkg: Remove UefiCpuLib from module INFs.

2022-03-29 Thread Yu Pu
Step 3 to merge UefiCpuLib to CpuLib.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Cc: Sean Rhodes 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88201): https://edk2.groups.io/g/devel/message/88201
Mute This Topic: https://groups.io/mt/90116974/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 10/15] OvmfPkg: Remove UefiCpuLib from module INFs.

2022-03-29 Thread Yu Pu
Step 3 to merge UefiCpuLib to CpuLib.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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

[edk2-devel] [PATCH v1 11/15] PcAtChipsetPkg: Remove UefiCpuLib from module INFs.

2022-03-29 Thread Yu Pu
Step 3 to merge UefiCpuLib to CpuLib.

Cc: Ray Ni 
Signed-off-by: Yu Pu 
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88198): https://edk2.groups.io/g/devel/message/88198
Mute This Topic: https://groups.io/mt/90116971/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 12/15] SourceLevelDebugPkg: Remove UefiCpuLib from module INFs.

2022-03-29 Thread Yu Pu
Step 3 to merge UefiCpuLib to CpuLib.

Cc: Hao A Wu 
Signed-off-by: Yu Pu 
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88199): https://edk2.groups.io/g/devel/message/88199
Mute This Topic: https://groups.io/mt/90116972/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 13/15] UefiCpuPkg: Remove UefiCpuLib from module INFs.

2022-03-29 Thread Yu Pu
Step 3 to merge UefiCpuLib to CpuLib.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
-#include 
 
 //
 // 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 
 #include 
 #include 
-#include 
 
 //
 // 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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf 
b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
index deef00f9c6e9..fdd89da2239c 100644

[edk2-devel] [PATCH v1 09/15] IntelFsp2Pkg: Remove UefiCpuLib from module INFs.

2022-03-29 Thread Yu Pu
Step 3 to merge UefiCpuLib to CpuLib.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
-#include 
 #include 
 
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88196): https://edk2.groups.io/g/devel/message/88196
Mute This Topic: https://groups.io/mt/90116969/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 07/15] MdePkg: Move API and implementation from UefiCpuLib to CpuLib

2022-03-29 Thread Yu Pu
Step 2 to merge UefiCpuLib to CpuLib.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Signed-off-by: Yu Pu 
---
 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 ..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.
+  Copyright (c) 2021, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+#include 
+
+#include 
+#include 
+
+/**
+  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, , , );
+  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, , 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, , 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, , NULL, NULL, NULL);
+  if (MaxExtendedFunction >= CPUID_VIR_PHY_ADDRESS_SIZE) {
+AsmCpuid (
+  CPUID_VIR_PHY_ADDRESS_SIZE,
+  ,
+  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
+  );
+
+/**
+  

[edk2-devel] [PATCH v1 08/15] UefiCpuPkg: Move API and implementation from UefiCpuLib to CpuLib

2022-03-29 Thread Yu Pu
Step 2 to merge UefiCpuLib to CpuLib.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 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..
--- 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.
-  Copyright (c) 2021, Intel Corporation. All rights reserved.
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include 
-#include 
-
-#include 
-#include 
-
-/**
-  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, , , );
-  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, , 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, , 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 ..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 
+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.
-  Copyright (c) 2020, AMD Inc. All rights reserved.
-  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/Libra

[edk2-devel] [PATCH v1 05/15] UefiCpuPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-03-29 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 
 //
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 
 #include 
 #include 
+#include 
 #include 
 
 //
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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88192): https://edk2.groups.io/g/devel/message/88192
Mute This Topic: https://groups.io/mt/90116965/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 04/15] OvmfPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-03-29 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88191): https://edk2.groups.io/g/devel/message/88191
Mute This Topic: https://groups.io/mt/90116964/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 00/15] Merge UefiCpuLib to CpuLib

2022-03-29 Thread 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  
 

[edk2-devel] [PATCH v1 01/15] IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib

2022-03-29 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88188): https://edk2.groups.io/g/devel/message/88188
Mute This Topic: https://groups.io/mt/90116961/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 02/15] IntelFsp2WrapperPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-03-29 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88189): https://edk2.groups.io/g/devel/message/88189
Mute This Topic: https://groups.io/mt/90116962/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 03/15] MdePkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-03-29 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Signed-off-by: Yu Pu 
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88190): https://edk2.groups.io/g/devel/message/88190
Mute This Topic: https://groups.io/mt/90116963/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 17/17] UefiCpuLib: Remove UefiCpuLib.

2022-03-23 Thread Yu Pu
Step 4 to merge UefiCpuLib to CpuLib.

Cc: Debkumar De 
Cc: Harry Han 
Cc: Catharine West 
Signed-off-by: Yu Pu 
---
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c | 17 --
 UefiCpuPkg/Include/Library/UefiCpuLib.h|  5 ---
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf   | 35 

 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.uni   | 16 -
 UefiCpuPkg/UefiCpuPkg.dec  |  5 ---
 5 files changed, 78 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c 
b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c
deleted file mode 100644
index a5e7a20c35f5..
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c
+++ /dev/null
@@ -1,17 +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 
-
-STATIC
-VOID
-Dummy (
-  VOID
-  )
-{
-  ;
-}
\ No newline at end of file
diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h 
b/UefiCpuPkg/Include/Library/UefiCpuLib.h
deleted file mode 100644
index 378ef88c6676..
--- a/UefiCpuPkg/Include/Library/UefiCpuLib.h
+++ /dev/null
@@ -1,5 +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..
--- 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.
-#  Copyright (c) 2020, AMD Inc. All rights reserved.
-#  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..
--- 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.
-//
-// 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.
   ##
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87933): https://edk2.groups.io/g/devel/message/87933
Mute This Topic: https://groups.io/mt/89988809/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 13/17] PcAtChipsetPkg: Remove UefiCpuLib from module INFs.

2022-03-23 Thread Yu Pu
Step 3 to merge UefiCpuLib to CpuLib.

Cc: Ray Ni 
Signed-off-by: Yu Pu 
---
 PcAtChipsetPkg/PcAtChipsetPkg.dsc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dsc 
b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
index 6db2bbc0b89d..b5441d0f2f23 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.dsc
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
@@ -43,7 +43,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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87929): https://edk2.groups.io/g/devel/message/87929
Mute This Topic: https://groups.io/mt/89988804/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 16/17] UefiPayloadPkg: Remove UefiCpuLib from module INFs.

2022-03-23 Thread Yu Pu
Step 3 to merge UefiCpuLib to CpuLib.

Cc: Guo Dong  [gdong1]
Cc: Ray Ni  [niruiyu]
Cc: Maurice Ma  [mauricema]
Cc: Benjamin You  [BenjaminYou]
Cc: Sean Rhodes 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87932): https://edk2.groups.io/g/devel/message/87932
Mute This Topic: https://groups.io/mt/89988808/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 15/17] UefiCpuPkg: Remove UefiCpuLib from module INFs.

2022-03-23 Thread Yu Pu
Step 3 to merge UefiCpuLib to CpuLib.

Cc: Eric Dong  [ydong10]
Cc: Ray Ni  [niruiyu]
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 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 -
 UefiCpuPkg/UefiCpuPkg.dsc| 2 --
 16 files changed, 17 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 
 #include 
 #include 
-#include 
 
 //
 // 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 
 #include 
 #include 
-#include 
 
 //
 // 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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf 
b

[edk2-devel] [PATCH v1 14/17] SourceLevelDebugPkg: Remove UefiCpuLib from module INFs.

2022-03-23 Thread Yu Pu
Step 3 to merge UefiCpuLib to CpuLib.

Cc: Hao A Wu 
Signed-off-by: Yu Pu 
---
 SourceLevelDebugPkg/SourceLevelDebugPkg.dsc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc 
b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
index 2f565d923bd4..71c5e93b99f5 100644
--- a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
+++ b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
@@ -36,7 +36,6 @@
   
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87930): https://edk2.groups.io/g/devel/message/87930
Mute This Topic: https://groups.io/mt/89988806/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 12/17] OvmfPkg: Remove UefiCpuLib from module INFs.

2022-03-23 Thread Yu Pu
Step 3 to merge UefiCpuLib to CpuLib.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
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

[edk2-devel] [PATCH v1 09/17] UefiCpuPkg: Move API and implementation from

2022-03-23 Thread Yu Pu
Step 2 to merge UefiCpuLib to CpuLib.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c | 17 ++
 UefiCpuPkg/Include/Library/UefiCpuLib.h| 60 

 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf   |  8 +--
 3 files changed, 18 insertions(+), 67 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c 
b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c
new file mode 100644
index ..a5e7a20c35f5
--- /dev/null
+++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c
@@ -0,0 +1,17 @@
+/** @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 
+
+STATIC
+VOID
+Dummy (
+  VOID
+  )
+{
+  ;
+}
\ No newline at end of file
diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h 
b/UefiCpuPkg/Include/Library/UefiCpuLib.h
index 0ff4a35774c1..378ef88c6676 100644
--- a/UefiCpuPkg/Include/Library/UefiCpuLib.h
+++ b/UefiCpuPkg/Include/Library/UefiCpuLib.h
@@ -1,65 +1,5 @@
-/** @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.
-  Copyright (c) 2020, AMD Inc. All rights reserved.
-  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
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87925): https://edk2.groups.io/g/devel/message/87925
Mute This Topic: https://groups.io/mt/89988799/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 11/17] IntelFsp2WrapperPkg: Remove UefiCpuLib from module INFs.

2022-03-23 Thread Yu Pu
Step 3 to merge UefiCpuLib to CpuLib.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf | 1 -
 IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf | 1 -
 IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc | 1 -
 3 files changed, 3 deletions(-)

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 587ed14f6df1..6e2c4de8923e 100644
--- a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
+++ b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
@@ -42,7 +42,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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87927): https://edk2.groups.io/g/devel/message/87927
Mute This Topic: https://groups.io/mt/89988801/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 10/17] IntelFsp2Pkg: Remove UefiCpuLib from module INFs.

2022-03-23 Thread Yu Pu
Step 3 to merge UefiCpuLib to CpuLib.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf | 1 -
 IntelFsp2Pkg/FspSecCore/SecMain.h   | 1 -
 IntelFsp2Pkg/IntelFsp2Pkg.dsc   | 1 -
 IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc | 1 -
 4 files changed, 4 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 
 #include 
 #include 
-#include 
 #include 
 
 typedef VOID (*PEI_CORE_ENTRY) ( \
diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dsc b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
index b7d20adef5a2..29e14b319847 100644
--- a/IntelFsp2Pkg/IntelFsp2Pkg.dsc
+++ b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
@@ -28,7 +28,6 @@
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
   
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.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
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87926): https://edk2.groups.io/g/devel/message/87926
Mute This Topic: https://groups.io/mt/89988800/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 08/17] MdePkg: Move API and implementation from UefiCpuLib to CpuLib

2022-03-23 Thread Yu Pu
Step 2 to merge UefiCpuLib to CpuLib.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Signed-off-by: Yu Pu 
---
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c => 
MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c |  8 +--
 MdePkg/Include/Library/CpuLib.h
 | 53 
 MdePkg/Library/BaseCpuLib/BaseCpuLib.inf   
 |  7 +++
 {UefiCpuPkg/Library/BaseUefiCpuLib => 
MdePkg/Library/BaseCpuLib}/Ia32/InitializeFpu.nasm|  0
 {UefiCpuPkg/Library/BaseUefiCpuLib => 
MdePkg/Library/BaseCpuLib}/X64/InitializeFpu.nasm |  0
 5 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c 
b/MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
similarity index 93%
rename from UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
rename to MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
index 5d925bc273f8..e69f00417022 100644
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
+++ b/MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c
@@ -1,26 +1,21 @@
 /** @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.
   Copyright (c) 2021, Intel Corporation. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
-
 **/
 
 #include 
 #include 
 
 #include 
-#include 
+#include 
 
 /**
   Determine if the standard CPU signature is "AuthenticAMD".
-
   @retval TRUE  The CPU signature matches.
   @retval FALSE The CPU signature does not match.
-
 **/
 BOOLEAN
 EFIAPI
@@ -40,7 +35,6 @@ StandardSignatureIsAuthenticAMD (
 
 /**
   Return the 32bit CPU family and model value.
-
   @return CPUID[01h].EAX with Processor Type and Stepping ID cleared.
 **/
 UINT32
diff --git a/MdePkg/Include/Library/CpuLib.h b/MdePkg/Include/Library/CpuLib.h
index 25f6d9478c52..c548c65a4445 100644
--- a/MdePkg/Include/Library/CpuLib.h
+++ b/MdePkg/Include/Library/CpuLib.h
@@ -41,4 +41,57 @@ CpuFlushTlb (
   VOID
   );
 
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
+
+/**
+  Initializes floating point units for requirement of UEFI specification.
+
+  This function initializes floating-point control word to 0x027F (all 
exceptions
+  masked,double-precision, round-to-nearest) and multimedia-extensions control 
word
+  (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to 
zero
+  for masked underflow).
+
+**/
+VOID
+EFIAPI
+InitializeFloatingPointUnits (
+  VOID
+  );
+
+/**
+  Determine if the standard CPU signature is "AuthenticAMD".
+
+  @retval TRUE  The CPU signature matches.
+  @retval FALSE The CPU signature does not match.
+
+**/
+BOOLEAN
+EFIAPI
+StandardSignatureIsAuthenticAMD (
+  VOID
+  );
+
+/**
+  Return the 32bit CPU family and model value.
+
+  @return CPUID[01h].EAX with Processor Type and Stepping ID cleared.
+**/
+UINT32
+EFIAPI
+GetCpuFamilyModel (
+  VOID
+  );
+
+/**
+  Return the CPU stepping ID.
+  @return CPU stepping ID value in CPUID[01h].EAX.
+**/
+UINT8
+EFIAPI
+GetCpuSteppingId (
+  VOID
+  );
+
+#endif
+
 #endif
diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf 
b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
index 950f5229b2a4..8d6eed3745b3 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,14 @@
   Ia32/CpuSleepGcc.c | GCC
   Ia32/CpuFlushTlbGcc.c | GCC
 
+  Ia32/InitializeFpu.nasm
+
 [Sources.X64]
   X64/CpuFlushTlb.nasm
   X64/CpuSleep.nasm
 
+  X64/InitializeFpu.nasm
+
 
 [Sources.EBC]
   Ebc/CpuSleepFlushTlb.c
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm 
b/MdePkg/Library/BaseCpuLib/Ia32/InitializeFpu.nasm
similarity index 100%
rename from UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm
rename to MdePkg/Library/BaseCpuLib/Ia32/InitializeFpu.nasm
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm 
b/MdePkg/Library/BaseCpuLib/X64/InitializeFpu.nasm
similarity index 100%
rename from UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm
rename to MdePkg/Library/BaseCpuLib/X64/InitializeFpu.nasm
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87924): https://edk2.groups.io/g/devel/message/87924
Mute This Topic: https://groups.io/mt/89988798/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 07/17] UefiPayloadPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-03-23 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Cc: Sean Rhodes 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87923): https://edk2.groups.io/g/devel/message/87923
Mute This Topic: https://groups.io/mt/89988797/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 05/17] SourceLevelDebugPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-03-23 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Hao A Wu 
Signed-off-by: Yu Pu 
---
 SourceLevelDebugPkg/SourceLevelDebugPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87921): https://edk2.groups.io/g/devel/message/87921
Mute This Topic: https://groups.io/mt/89988794/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 04/17] PcAtChipsetPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-03-23 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Ray Ni 
Signed-off-by: Yu Pu 
---
 PcAtChipsetPkg/PcAtChipsetPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dsc 
b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
index 451e60ddc857..6db2bbc0b89d 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.dsc
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
@@ -33,6 +33,7 @@
   UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
   
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
   
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+  CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
   
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
   
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87920): https://edk2.groups.io/g/devel/message/87920
Mute This Topic: https://groups.io/mt/89988793/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 06/17] UefiCpuPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-03-23 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 
 //
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 
 #include 
 #include 
+#include 
 #include 
 
 //
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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87922): https://edk2.groups.io/g/devel/message/87922
Mute This Topic: https://groups.io/mt/89988795/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 03/17] OvmfPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-03-23 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Signed-off-by: Yu Pu 
---
 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87919): https://edk2.groups.io/g/devel/message/87919
Mute This Topic: https://groups.io/mt/89988792/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 02/17] IntelFsp2WrapperPkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-03-23 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf | 1 +
 IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf | 1 +
 IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc | 1 +
 3 files changed, 3 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
diff --git a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc 
b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
index 21e089000eaf..587ed14f6df1 100644
--- a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
+++ b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
@@ -31,6 +31,7 @@
   
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
   PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
   
CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
+  CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
 
   
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
   SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87918): https://edk2.groups.io/g/devel/message/87918
Mute This Topic: https://groups.io/mt/89988791/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 01/17] IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib.

2022-03-23 Thread Yu Pu
Step 1 to merge UefiCpuLib to CpuLib

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Yu Pu 
---
 IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf | 1 +
 IntelFsp2Pkg/FspSecCore/SecMain.h   | 1 +
 IntelFsp2Pkg/IntelFsp2Pkg.dsc   | 1 +
 3 files changed, 3 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 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dsc b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
index c1414f7e75b8..b7d20adef5a2 100644
--- a/IntelFsp2Pkg/IntelFsp2Pkg.dsc
+++ b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
@@ -27,6 +27,7 @@
   PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
   
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
+  CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
 
   
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87917): https://edk2.groups.io/g/devel/message/87917
Mute This Topic: https://groups.io/mt/89988790/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 00/17] *** SUBJECT HERE ***

2022-03-23 Thread Yu Pu
*** BLURB HERE ***

Yu Pu (17):
  IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib.
  IntelFsp2WrapperPkg: Add CpuLib to module INFs that depend on
UefiCpuLib.
  OvmfPkg: Add CpuLib to module INFs that depend on UefiCpuLib.
  PcAtChipsetPkg: Add CpuLib to module INFs that depend on UefiCpuLib.
  SourceLevelDebugPkg: 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.
  IntelFsp2WrapperPkg: 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.

 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c => 
MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c |  8 +--
 OvmfPkg/Sec/SecMain.c  
 |  2 +-
 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  
 |  2 +-
 IntelFsp2Pkg/Tools/Tests/QemuFspPkg.dsc
 |  1 -
 IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
 |  2 +-
 IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
 |  2 +-
 IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
 |  2 +-
 MdePkg/Include/Library/CpuLib.h
 | 53 
 MdePkg/Library/BaseCpuLib/BaseCpuLib.inf   
 |  7 +++
 {UefiCpuPkg/Library/BaseUefiCpuLib => 
MdePkg/Library/BaseCpuLib}/Ia32/InitializeFpu.nasm|  0
 {UefiCpuPkg/Library/BaseUefiCpuLib => 
MdePkg/Library/BaseCpuLib}/X64/InitializeFpu.nasm |  0
 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  
 |  2 +-
 SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
 |  2 +-
 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/PiSmmCp

[edk2-devel] [PATCH v1 7/7] UefiPayloadPkg: Invoke GetPhysicalAddressBits() and remove the duplicated code

2022-03-02 Thread Yu Pu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3394

Invoke GetPhysicalAddressBits() defined in UefiCpuPkg for CPU physical address
mask calculation and remove the duplicated code in 
UefiPayloadPkg\UefiPayloadEntry

Cc: Guo Dong 
Cc: Ray Ni 

Signed-off-by: Yu Pu 
---
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c  | 10 ++
 UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c |  9 ++---
 2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c 
b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
index 0fed1e36918a..4378aa4f1d97 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -4,6 +4,7 @@
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
+#include 
 
 #include "UefiPayloadEntry.h"
 
@@ -341,7 +342,6 @@ BuildGenericHob (
   VOID
   )
 {
-  UINT32   RegEax;
   UINT8PhysicalAddressBits;
   EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute;
 
@@ -351,13 +351,7 @@ BuildGenericHob (
   //
   // Build CPU memory space and IO space hob
   //
-  AsmCpuid (0x8000, , NULL, NULL, NULL);
-  if (RegEax >= 0x8008) {
-AsmCpuid (0x8008, , NULL, NULL, NULL);
-PhysicalAddressBits = (UINT8)RegEax;
-  } else {
-PhysicalAddressBits = 36;
-  }
+  PhysicalAddressBits = GetPhysicalAddressBits(NULL, NULL);
 
   BuildCpuHob (PhysicalAddressBits, 16);
 
diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c 
b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c
index ac0d58e685c8..c61aeeda7f2e 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c
@@ -25,6 +25,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -738,13 +739,7 @@ CreateIdentityMappingPageTables (
   if (Hob != NULL) {
 PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
   } else {
-AsmCpuid (0x8000, , NULL, NULL, NULL);
-if (RegEax >= 0x8008) {
-  AsmCpuid (0x8008, , NULL, NULL, NULL);
-  PhysicalAddressBits = (UINT8)RegEax;
-} else {
-  PhysicalAddressBits = 36;
-}
+PhysicalAddressBits = GetPhysicalAddressBits (NULL, NULL);
   }
 
   //
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87240): https://edk2.groups.io/g/devel/message/87240
Mute This Topic: https://groups.io/mt/89503330/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 6/7] EmulatorPkg: fixed a bug caused by Invoking GetPhysicalAddressBits()

2022-03-02 Thread Yu Pu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3394

add the defination of UefiCpuLib in EmulatorPkg\EmulatorPkg.dsc

Cc: Andrew Fish 
Cc: Ray Ni 

Signed-off-by: Yu Pu 
---
 EmulatorPkg/EmulatorPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index 554c13ddb500..e33b98a4b682 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -78,6 +78,7 @@
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
+  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
 
   PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87239): https://edk2.groups.io/g/devel/message/87239
Mute This Topic: https://groups.io/mt/89503329/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 3/7] IntelFsp2Pkg: Invoke GetPhysicalAddressBits() and remove the duplicated code

2022-03-02 Thread Yu Pu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3394

Invoke GetPhysicalAddressBits() defined in UefiCpuPkg for CPU
physical address mask calculation and remove the duplicated
code in edk2\IntelFsp2Pkg\Library\BaseCacheLib\CacheLib.c.

Cc: Chasel Chiu 

Signed-off-by: Yu Pu 
---
 IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c   | 10 ++
 IntelFsp2Pkg/Library/BaseCacheLib/BaseCacheLib.inf |  2 ++
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c 
b/IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c
index f879c268e7ec..3f8ed122b2be 100644
--- a/IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c
+++ b/IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "CacheLibInternal.h"
 
 /**
@@ -388,15 +389,8 @@ SetCacheAttributes (
   UINT32 UsedMsrNum;
   EFI_MEMORY_CACHE_TYPE  UsedMemoryCacheType;
   UINT64 ValidMtrrAddressMask;
-  UINT32 Cpuid_RegEax;
 
-  AsmCpuid (CPUID_EXTENDED_FUNCTION, _RegEax, NULL, NULL, NULL);
-  if (Cpuid_RegEax >= CPUID_VIR_PHY_ADDRESS_SIZE) {
-AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, _RegEax, NULL, NULL, NULL);
-ValidMtrrAddressMask = (LShiftU64 ((UINT64)1, (Cpuid_RegEax & 0xFF)) - 1) 
& (~(UINT64)0x0FFF);
-  } else {
-ValidMtrrAddressMask = (LShiftU64 ((UINT64)1, 36) - 1) & (~(UINT64)0x0FFF);
-  }
+  GetPhysicalAddressBits(NULL, );
 
   //
   // Check for invalid parameter
diff --git a/IntelFsp2Pkg/Library/BaseCacheLib/BaseCacheLib.inf 
b/IntelFsp2Pkg/Library/BaseCacheLib/BaseCacheLib.inf
index 9a513fb6df77..e6b14ae4a802 100644
--- a/IntelFsp2Pkg/Library/BaseCacheLib/BaseCacheLib.inf
+++ b/IntelFsp2Pkg/Library/BaseCacheLib/BaseCacheLib.inf
@@ -21,9 +21,11 @@
 
 [Packages]
   MdePkg/MdePkg.dec
+  UefiCpuPkg/UefiCpuPkg.dec
   IntelFsp2Pkg/IntelFsp2Pkg.dec
 
 [LibraryClasses]
   BaseMemoryLib
   CacheAsRamLib
+  UefiCpuLib
 
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87236): https://edk2.groups.io/g/devel/message/87236
Mute This Topic: https://groups.io/mt/89503326/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 4/7] StandaloneMmPkg: Invoke GetPhysicalAddressBits() and remove the duplicated code

2022-03-02 Thread Yu Pu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3394

Invoke GetPhysicalAddressBits() defined in UefiCpuPkg for CPU physical address
mask calculation and remove the duplicated code in
StandaloneMmPkg\Library\StandaloneMmMemLib\X86StandaloneMmMemLibInternal.c

Cc: Ard Biesheuvel 
Cc: Sami Mujawar 
Cc: Jiewen Yao 

Signed-off-by: Yu Pu 
---
 StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c | 
10 ++
 StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf  |  
2 ++
 StandaloneMmPkg/StandaloneMmPkg.dsc|  
1 +
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c 
b/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c
index c309d1bc6a56..4afd9b938934 100644
--- a/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c
+++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -40,7 +41,6 @@ MmMemLibInternalCalculateMaximumSupportAddress (
   )
 {
   VOID*Hob;
-  UINT32  RegEax;
   UINT8   PhysicalAddressBits;
 
   //
@@ -50,13 +50,7 @@ MmMemLibInternalCalculateMaximumSupportAddress (
   if (Hob != NULL) {
 PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
   } else {
-AsmCpuid (0x8000, , NULL, NULL, NULL);
-if (RegEax >= 0x8008) {
-  AsmCpuid (0x8008, , NULL, NULL, NULL);
-  PhysicalAddressBits = (UINT8)RegEax;
-} else {
-  PhysicalAddressBits = 36;
-}
+PhysicalAddressBits = GetPhysicalAddressBits (NULL, NULL);
   }
 
   //
diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf 
b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
index b29d97a74607..94f7fbb1c4f7 100644
--- a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
+++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
@@ -43,12 +43,14 @@
 [Packages]
   MdePkg/MdePkg.dec
   StandaloneMmPkg/StandaloneMmPkg.dec
+  UefiCpuPkg/UefiCpuPkg.dec
 
 [LibraryClasses]
   BaseMemoryLib
   DebugLib
   HobLib
   MemoryAllocationLib
+  UefiCpuLib
 
 [Guids]
   gMmCoreDataHobGuid  ## SOMETIMES_CONSUMES ## HOB
diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc 
b/StandaloneMmPkg/StandaloneMmPkg.dsc
index 8012f93b7dcc..41449046799f 100644
--- a/StandaloneMmPkg/StandaloneMmPkg.dsc
+++ b/StandaloneMmPkg/StandaloneMmPkg.dsc
@@ -59,6 +59,7 @@
   
StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
   
StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
   
VariableMmDependency|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
+  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
 
 [LibraryClasses.AARCH64, LibraryClasses.ARM]
   ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87237): https://edk2.groups.io/g/devel/message/87237
Mute This Topic: https://groups.io/mt/89503327/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 5/7] OvmfPkg: Invoke GetPhysicalAddressBits() and remove the duplicated code

2022-03-02 Thread Yu Pu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3394

Invoke GetPhysicalAddressBits() defined in UefiCpuPkg for CPU physical address
mask calculation and remove the duplicated code in
OvmfPkg\XenPlatformPei\MemDetect.c.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Signed-off-by: Yu Pu 
---
 OvmfPkg/XenPlatformPei/MemDetect.c | 11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/OvmfPkg/XenPlatformPei/MemDetect.c 
b/OvmfPkg/XenPlatformPei/MemDetect.c
index d412d1f4db6f..bd24612c21ef 100644
--- a/OvmfPkg/XenPlatformPei/MemDetect.c
+++ b/OvmfPkg/XenPlatformPei/MemDetect.c
@@ -30,6 +30,7 @@ Module Name:
 #include 
 #include 
 #include 
+#include 
 
 #include "Platform.h"
 #include "Cmos.h"
@@ -180,15 +181,7 @@ AddressWidthInitialization (
   VOID
   )
 {
-  UINT32  RegEax;
-
-  AsmCpuid (0x8000, , NULL, NULL, NULL);
-  if (RegEax >= 0x8008) {
-AsmCpuid (0x8008, , NULL, NULL, NULL);
-mPhysMemAddressWidth = (UINT8)RegEax;
-  } else {
-mPhysMemAddressWidth = 36;
-  }
+  mPhysMemAddressWidth = GetPhysicalAddressBits(NULL, NULL);
 
   //
   // IA-32e paging translates 48-bit linear addresses to 52-bit physical 
addresses.
-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87238): https://edk2.groups.io/g/devel/message/87238
Mute This Topic: https://groups.io/mt/89503328/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 2/7] MdeModulePkg: Invoke GetPhysicalAddressBits() and remove the duplicated code

2022-03-02 Thread Yu Pu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3394

Invoke GetPhysicalAddressBits() defined in UefiCpuPkg for CPU physical address
mask calculation and remove the duplicated code in MdeModulePkg.

Cc: Jian J Wang 
Cc: Liming Gao 

Signed-off-by: Yu Pu 
---
 MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c|  
9 ++---
 MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c | 
14 ++
 MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c| 
14 ++
 MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf |  
2 ++
 MdeModulePkg/MdeModulePkg.dsc   |  
1 +
 MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf |  
2 ++
 MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf|  
2 ++
 7 files changed, 13 insertions(+), 31 deletions(-)

diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c 
b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
index 0700f310b203..78e91e6e9024 100644
--- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
+++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
@@ -22,6 +22,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
+#include 
 #include 
 #include "DxeIpl.h"
 #include "VirtualMemory.h"
@@ -733,13 +734,7 @@ CreateIdentityMappingPageTables (
   if (Hob != NULL) {
 PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
   } else {
-AsmCpuid (0x8000, , NULL, NULL, NULL);
-if (RegEax >= 0x8008) {
-  AsmCpuid (0x8008, , NULL, NULL, NULL);
-  PhysicalAddressBits = (UINT8)RegEax;
-} else {
-  PhysicalAddressBits = 36;
-}
+PhysicalAddressBits = GetPhysicalAddressBits(NULL, NULL);
   }
 
   Page5LevelSupport = FALSE;
diff --git 
a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c 
b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c
index 6b44f50bac70..367bf8cdd1e6 100644
--- a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c
+++ b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c
@@ -10,6 +10,7 @@ Copyright (c) 2017, AMD Incorporated. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
+#include 
 #include "ScriptExecute.h"
 
 //
@@ -51,20 +52,9 @@ HookPageFaultHandler (
   IN IA32_IDT_GATE_DESCRIPTOR  *IdtEntry
   )
 {
-  UINT32  RegEax;
-  UINT8   PhysicalAddressBits;
   UINTN   PageFaultHandlerHookAddress;
 
-  AsmCpuid (0x8000, , NULL, NULL, NULL);
-  if (RegEax >= 0x8008) {
-AsmCpuid (0x8008, , NULL, NULL, NULL);
-PhysicalAddressBits = (UINT8)RegEax;
-  } else {
-PhysicalAddressBits = 36;
-  }
-
-  mPhyMask  = LShiftU64 (1, PhysicalAddressBits) - 1;
-  mPhyMask &= (1ull << 48) - SIZE_4KB;
+  GetPhysicalAddressBits(NULL, );
 
   //
   // Set Page Fault entry to catch >4G access
diff --git a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c 
b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
index 05941f9f8d56..06d6129c5e6d 100644
--- a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
+++ b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
@@ -12,6 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include "CommonHeader.h"
 
 #define EXCEPTION_VECTOR_NUMBER  0x22
@@ -61,20 +62,9 @@ HookPageFaultHandler (
   IN OUT PAGE_FAULT_CONTEXT*PageFaultContext
   )
 {
-  UINT32  RegEax;
-  UINT8   PhysicalAddressBits;
   UINTN   PageFaultHandlerHookAddress;
 
-  AsmCpuid (0x8000, , NULL, NULL, NULL);
-  if (RegEax >= 0x8008) {
-AsmCpuid (0x8008, , NULL, NULL, NULL);
-PhysicalAddressBits = (UINT8)RegEax;
-  } else {
-PhysicalAddressBits = 36;
-  }
-
-  PageFaultContext->PhyMask  = LShiftU64 (1, PhysicalAddressBits) - 1;
-  PageFaultContext->PhyMask &= (1ull << 48) - SIZE_4KB;
+  GetPhysicalAddressBits(NULL, &(PageFaultContext->PhyMask));
 
   //
   // Set Page Fault entry to catch >4G access
diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf 
b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
index 19b8a4c8aefa..45808bcdcd6c 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
@@ -55,6 +55,7 @@
 
 [Packages]
   MdePkg/MdePkg.dec
+  UefiCpuPkg/UefiCpuPkg.dec
   MdeModulePkg/MdeModulePkg.dec
 
 [Packages.ARM, Packages.AARCH64]
@@ -75,6 +76,7 @@
   DebugAgentLib
   PeiServicesTablePointerLib
   PerformanceLib
+  UefiCpuLib
 
 [LibraryClasses.ARM, LibraryClasses.AARCH64]
   ArmMmuLib
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index b1d83461865e..da6213c02da0 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -62,6 +62,7 @@
   
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
   
UefiBootManagerLib|MdeModulePkg/L

[edk2-devel] [PATCH v1 0/7] *** SUBJECT HERE ***

2022-03-02 Thread Yu Pu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3394

Signed-off-by: Yu Pu 
*** BLURB HERE ***

Yu Pu (7):
  UefiCpuPackage: Add APIs for CPU physical address mask calculation
  MdeModulePkg: Invoke GetPhysicalAddressBits() and remove the
duplicated code
  IntelFsp2Pkg: Invoke GetPhysicalAddressBits() and remove the
duplicated code
  StandaloneMmPkg: Invoke GetPhysicalAddressBits() and remove the
duplicated code
  OvmfPkg: Invoke GetPhysicalAddressBits() and remove the duplicated
code
  EmulatorPkg: fixed a bug caused by Invoking GetPhysicalAddressBits()
  UefiPayloadPkg: Invoke GetPhysicalAddressBits() and remove the
duplicated code

 IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c| 
10 +
 MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c|  
9 +---
 MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c | 
14 +-
 MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c| 
14 +-
 OvmfPkg/XenPlatformPei/MemDetect.c  | 
11 +
 StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c  | 
10 +
 UefiCpuPkg/CpuDxe/CpuDxe.c  | 
16 +--
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c  | 
47 
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c   |  
9 +---
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c |  
9 +---
 UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c   |  
9 +---
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c  | 
10 +
 UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c |  
9 +---
 EmulatorPkg/EmulatorPkg.dsc |  
1 +
 IntelFsp2Pkg/Library/BaseCacheLib/BaseCacheLib.inf  |  
2 +
 MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf |  
2 +
 MdeModulePkg/MdeModulePkg.dsc   |  
1 +
 MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf |  
2 +
 MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf|  
2 +
 StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf   |  
2 +
 StandaloneMmPkg/StandaloneMmPkg.dsc |  
1 +
 UefiCpuPkg/Include/Library/UefiCpuLib.h | 
17 +++
 22 files changed, 99 insertions(+), 108 deletions(-)

-- 
2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87233): https://edk2.groups.io/g/devel/message/87233
Mute This Topic: https://groups.io/mt/89503323/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 1/7] UefiCpuPackage: Add APIs for CPU physical address mask calculation

2022-03-02 Thread Yu Pu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3394

Add API named GetPhysicalAddressBits() for CPU physical address mask
calculation, and remove the duplicated code in UefiCpuPackage.

Cc: Eric Dong 
Cc: Ray Ni 

Signed-off-by: Yu Pu 
---
 UefiCpuPkg/CpuDxe/CpuDxe.c | 16 +--
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c | 47 
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c  |  9 +---
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c|  9 +---
 UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c  |  9 +---
 UefiCpuPkg/Include/Library/UefiCpuLib.h| 17 +++
 6 files changed, 70 insertions(+), 37 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
index 00f3cb09572c..8aca1bf72b4c 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
@@ -503,21 +503,7 @@ InitializeMtrrMask (
   VOID
   )
 {
-  UINT32  RegEax;
-  UINT8   PhysicalAddressBits;
-
-  AsmCpuid (0x8000, , NULL, NULL, NULL);
-
-  if (RegEax >= 0x8008) {
-AsmCpuid (0x8008, , NULL, NULL, NULL);
-
-PhysicalAddressBits = (UINT8)RegEax;
-  } else {
-PhysicalAddressBits = 36;
-  }
-
-  mValidMtrrBitsMask= LShiftU64 (1, PhysicalAddressBits) - 1;
-  mValidMtrrAddressMask = mValidMtrrBitsMask & 0xf000ULL;
+  GetPhysicalAddressBits(, );
 }
 
 /**
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c 
b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
index 5d925bc273f8..bb1343f3cd21 100644
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
+++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
@@ -79,3 +79,50 @@ GetCpuSteppingId (
 
   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, , NULL, NULL, NULL);
+  if (MaxExtendedFunction >= CPUID_VIR_PHY_ADDRESS_SIZE) {
+AsmCpuid (
+  CPUID_VIR_PHY_ADDRESS_SIZE,
+  ,
+  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/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c 
b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c
index 4e8f897f5e9c..ec7cd4013132 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -330,13 +331,7 @@ SmmCpuFeaturesInstallSmiHandler (
   if (Hob != NULL) {
 Psd->PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
   } else {
-AsmCpuid (0x8000, , NULL, NULL, NULL);
-if (RegEax >= 0x8008) {
-  AsmCpuid (0x8008, , NULL, NULL, NULL);
-  Psd->PhysicalAddressBits = (UINT8)RegEax;
-} else {
-  Psd->PhysicalAddressBits = 36;
-}
+Psd->PhysicalAddressBits = GetPhysicalAddressBits (NULL, NULL);
   }
 
   if (!mStmConfigurationTableInitialized) {
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
index 538394f23910..de1385a86948 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
@@ -194,7 +194,6 @@ CalculateMaximumSupportAddress (
   VOID
   )
 {
-  UINT32  RegEax;
   UINT8   PhysicalAddressBits;
   VOID*Hob;
 
@@ -205,13 +204,7 @@ CalculateMaximumSupportAddress (
   if (Hob != NULL) {
 PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
   } else {
-AsmCpuid (0x8000, , NULL, NULL, NULL);
-if (RegEax >= 0x8008) {
-  AsmCpuid (0x8008, , NULL, NULL, NULL);
-  PhysicalAddressBits = (UINT8)RegEax;
-} else {
-  PhysicalAddressBits

[edk2-devel] [PATCH v1 1/1] UefiCpuPackage: Add APIs for CPU physical address mask calculation

2022-01-13 Thread Yu Pu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3394

Firmware contains lots of code that deals with page table.These
code need the information of cpu physical address mask which
can be calculated from CPUID result.Today all these code implements
directly calls CPUID and calculates the address mask.
This bugzilla requests to add a new API as below so that all the
duplicated code can be removed.

Cc: Eric Dong 
Cc: Ray Ni 

Signed-off-by: Yu Pu 
---
 UefiCpuPkg/CpuDxe/CpuDxe.c | 16 +--
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c | 47 
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c  |  9 +---
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c|  9 +---
 UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c  |  9 +---
 UefiCpuPkg/Include/Library/UefiCpuLib.h| 17 +++
 6 files changed, 70 insertions(+), 37 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
index 00f3cb09572c..8aca1bf72b4c 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
@@ -503,21 +503,7 @@ InitializeMtrrMask (
   VOID
   )
 {
-  UINT32  RegEax;
-  UINT8   PhysicalAddressBits;
-
-  AsmCpuid (0x8000, , NULL, NULL, NULL);
-
-  if (RegEax >= 0x8008) {
-AsmCpuid (0x8008, , NULL, NULL, NULL);
-
-PhysicalAddressBits = (UINT8)RegEax;
-  } else {
-PhysicalAddressBits = 36;
-  }
-
-  mValidMtrrBitsMask= LShiftU64 (1, PhysicalAddressBits) - 1;
-  mValidMtrrAddressMask = mValidMtrrBitsMask & 0xf000ULL;
+  GetPhysicalAddressBits(, );
 }
 
 /**
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c 
b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
index 5d925bc273f8..bb1343f3cd21 100644
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
+++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
@@ -79,3 +79,50 @@ GetCpuSteppingId (
 
   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, , NULL, NULL, NULL);
+  if (MaxExtendedFunction >= CPUID_VIR_PHY_ADDRESS_SIZE) {
+AsmCpuid (
+  CPUID_VIR_PHY_ADDRESS_SIZE,
+  ,
+  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/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c 
b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c
index 4e8f897f5e9c..ec7cd4013132 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -330,13 +331,7 @@ SmmCpuFeaturesInstallSmiHandler (
   if (Hob != NULL) {
 Psd->PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
   } else {
-AsmCpuid (0x8000, , NULL, NULL, NULL);
-if (RegEax >= 0x8008) {
-  AsmCpuid (0x8008, , NULL, NULL, NULL);
-  Psd->PhysicalAddressBits = (UINT8)RegEax;
-} else {
-  Psd->PhysicalAddressBits = 36;
-}
+Psd->PhysicalAddressBits = GetPhysicalAddressBits (NULL, NULL);
   }
 
   if (!mStmConfigurationTableInitialized) {
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
index 538394f23910..de1385a86948 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
@@ -194,7 +194,6 @@ CalculateMaximumSupportAddress (
   VOID
   )
 {
-  UINT32  RegEax;
   UINT8   PhysicalAddressBits;
   VOID*Hob;
 
@@ -205,13 +204,7 @@ CalculateMaximumSupportAddress (
   if (Hob != NULL) {
 PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
   } else {
-AsmCp

[edk2-devel] [PATCH v1 1/1] UefiCpuPackage: Add APIs for CPU physical address mask calculation

2022-01-12 Thread Yu Pu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3394

Firmware contains lots of code that deals with page table.These
code need the information of cpu physical address mask which
can be calculated from CPUID result.Today all these code implements
directly calls CPUID and calculates the address mask.
This bugzilla requests to add a new API as below so that all the
duplicated code can be removed.

Cc: Eric Dong 
Cc: Ray Ni 

Signed-off-by: Yu Pu 
Reviewed-by: Rahul Kumar 
---
 IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c| 
10 +
 MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c|  
9 +---
 MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c | 
14 +-
 MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c| 
14 +-
 OvmfPkg/XenPlatformPei/MemDetect.c  | 
11 +
 StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c  |  
9 +---
 UefiCpuPkg/CpuDxe/CpuDxe.c  | 
16 +--
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c  | 
47 
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c   |  
9 +---
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c |  
9 +---
 UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c   |  
9 +---
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c  | 
10 +
 UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c |  
9 +---
 EmulatorPkg/EmulatorPkg.dsc |  
1 +
 IntelFsp2Pkg/Library/BaseCacheLib/BaseCacheLib.inf  |  
1 +
 MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf |  
2 +
 MdeModulePkg/MdeModulePkg.dsc   |  
1 +
 MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf |  
1 +
 StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf   |  
2 +
 StandaloneMmPkg/StandaloneMmPkg.dsc |  
1 +
 UefiCpuPkg/Include/Library/UefiCpuLib.h | 
17 +++
 21 files changed, 95 insertions(+), 107 deletions(-)

diff --git a/IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c 
b/IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c
index f879c268e7ec..3f8ed122b2be 100644
--- a/IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c
+++ b/IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "CacheLibInternal.h"
 
 /**
@@ -388,15 +389,8 @@ SetCacheAttributes (
   UINT32 UsedMsrNum;
   EFI_MEMORY_CACHE_TYPE  UsedMemoryCacheType;
   UINT64 ValidMtrrAddressMask;
-  UINT32 Cpuid_RegEax;
 
-  AsmCpuid (CPUID_EXTENDED_FUNCTION, _RegEax, NULL, NULL, NULL);
-  if (Cpuid_RegEax >= CPUID_VIR_PHY_ADDRESS_SIZE) {
-AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, _RegEax, NULL, NULL, NULL);
-ValidMtrrAddressMask = (LShiftU64 ((UINT64)1, (Cpuid_RegEax & 0xFF)) - 1) 
& (~(UINT64)0x0FFF);
-  } else {
-ValidMtrrAddressMask = (LShiftU64 ((UINT64)1, 36) - 1) & (~(UINT64)0x0FFF);
-  }
+  GetPhysicalAddressBits(NULL, );
 
   //
   // Check for invalid parameter
diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c 
b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
index 0700f310b203..78e91e6e9024 100644
--- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
+++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
@@ -22,6 +22,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
+#include 
 #include 
 #include "DxeIpl.h"
 #include "VirtualMemory.h"
@@ -733,13 +734,7 @@ CreateIdentityMappingPageTables (
   if (Hob != NULL) {
 PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
   } else {
-AsmCpuid (0x8000, , NULL, NULL, NULL);
-if (RegEax >= 0x8008) {
-  AsmCpuid (0x8008, , NULL, NULL, NULL);
-  PhysicalAddressBits = (UINT8)RegEax;
-} else {
-  PhysicalAddressBits = 36;
-}
+PhysicalAddressBits = GetPhysicalAddressBits(NULL, NULL);
   }
 
   Page5LevelSupport = FALSE;
diff --git 
a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c 
b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c
index 6b44f50bac70..367bf8cdd1e6 100644
--- a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c
+++ b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c
@@ -10,6 +10,7 @@ Copyright (c) 2017, AMD Incorporated. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
+#include 
 #include "ScriptExecute.h"
 
 //
@@ -51,20 +52,9 @@ HookPageFaultHandler (
   IN IA32_IDT_GATE_DESCRIPTOR  *IdtEntry
   )