public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Yu Pu <yu.pu@intel.com>
To: devel@edk2.groups.io
Cc: Yu Pu <yu.pu@intel.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Zhiguang Liu <zhiguang.liu@intel.com>
Subject: [PATCH v1 08/17] MdePkg: Move API and implementation from UefiCpuLib to CpuLib
Date: Wed, 23 Mar 2022 19:47:53 +0800	[thread overview]
Message-ID: <20220323114802.1008-9-yu.pu@intel.com> (raw)
In-Reply-To: <20220323114802.1008-1-yu.pu@intel.com>

Step 2 to merge UefiCpuLib to CpuLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Yu Pu <yu.pu@intel.com>
---
 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.<BR>
   Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
-
 **/
 
 #include <Register/Intel/Cpuid.h>
 #include <Register/Amd/Cpuid.h>
 
 #include <Library/BaseLib.h>
-#include <Library/UefiCpuLib.h>
+#include <Library/CpuLib.h>
 
 /**
   Determine if the standard CPU signature is "AuthenticAMD".
-
   @retval TRUE  The CPU signature matches.
   @retval FALSE The CPU signature does not match.
-
 **/
 BOOLEAN
 EFIAPI
@@ -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


  parent reply	other threads:[~2022-03-23 11:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 11:47 [PATCH v1 00/17] *** SUBJECT HERE *** Yu Pu
2022-03-23 11:47 ` [PATCH v1 01/17] IntelFsp2Pkg: Add CpuLib to module INFs that depend on UefiCpuLib Yu Pu
2022-03-23 23:53   ` [edk2-devel] " Michael D Kinney
2022-03-23 11:47 ` [PATCH v1 02/17] IntelFsp2WrapperPkg: " Yu Pu
2022-03-23 11:47 ` [PATCH v1 03/17] OvmfPkg: " Yu Pu
2022-03-23 11:47 ` [PATCH v1 04/17] PcAtChipsetPkg: " Yu Pu
2022-03-23 11:47 ` [PATCH v1 05/17] SourceLevelDebugPkg: " Yu Pu
2022-03-23 11:47 ` [PATCH v1 06/17] UefiCpuPkg: " Yu Pu
2022-03-23 11:47 ` [PATCH v1 07/17] UefiPayloadPkg: " Yu Pu
2022-03-23 11:47 ` Yu Pu [this message]
2022-03-23 11:47 ` [PATCH v1 09/17] UefiCpuPkg: Move API and implementation from Yu Pu
2022-03-23 11:47 ` [PATCH v1 10/17] IntelFsp2Pkg: Remove UefiCpuLib from module INFs Yu Pu
2022-03-23 11:47 ` [PATCH v1 11/17] IntelFsp2WrapperPkg: " Yu Pu
2022-03-23 11:47 ` [PATCH v1 12/17] OvmfPkg: " Yu Pu
2022-03-23 11:47 ` [PATCH v1 13/17] PcAtChipsetPkg: " Yu Pu
2022-03-23 11:47 ` [PATCH v1 14/17] SourceLevelDebugPkg: " Yu Pu
2022-03-23 11:48 ` [PATCH v1 15/17] UefiCpuPkg: " Yu Pu
2022-03-23 11:48 ` [PATCH v1 16/17] UefiPayloadPkg: " Yu Pu
2022-03-23 11:48 ` [PATCH v1 17/17] UefiCpuLib: Remove UefiCpuLib Yu Pu
2022-03-28  8:45 ` 回复: [edk2-devel] [PATCH v1 00/17] *** SUBJECT HERE *** gaoliming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220323114802.1008-9-yu.pu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox