From nobody Tue Feb 10 04:14:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95806+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95806+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1667289567; cv=none; d=zohomail.com; s=zohoarc; b=MJlRu9heyzH7duWgbuvy6QHPRoQY7UrAvaVXJ52Qyhm0TKOiR9vBkPahkM6lOe4YQ8voBsB+QiFrClnSQvZPWC0KTmFIKchpF56UFtBeCJnWIoOMjThysdhSRsMtSbN03veAoV97zBUB/rRi0cr15tUVv174/PogtnE0u/JLfQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667289567; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=gwMUyBw8K4fS8dbXwE/NyjSK2+QhPyMRqlVZVeMmRQA=; b=KcQDXjBvOnNyfy/MX9iDuF9XxLraHPIabWxpCUvl04fplvkKCQbbRGYW69XCwx3WvIpgW/ef4Ddg3yKhP+QDg+AcSEBw7+tD7U+XKA3nJoPKlPMGugWFP0fFwnJpoJxzR/ilrLpGgdvJg8Czi/JC4QTrQ7FEtJl6o+thxIfQHt8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95806+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 166728956781621.27168382833611; Tue, 1 Nov 2022 00:59:27 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id xS6HYY1788612xqlqaqhon7z; Tue, 01 Nov 2022 00:59:26 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web08.3590.1667289564350834226 for ; Tue, 01 Nov 2022 00:59:26 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10517"; a="306705604" X-IronPort-AV: E=Sophos;i="5.95,230,1661842800"; d="scan'208";a="306705604" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2022 00:59:25 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10517"; a="697324278" X-IronPort-AV: E=Sophos;i="5.95,230,1661842800"; d="scan'208";a="697324278" X-Received: from shwdesfp01.ccr.corp.intel.com ([10.239.158.151]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2022 00:59:23 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Yu Pu , Michael D Kinney , Liming Gao , Zhiguang Liu , Eric Dong , Ray Ni , Rahul Kumar Subject: [edk2-devel] [PATCH v3 2/9] MdePkg: Move API and implementation from UefiCpuLib to CpuLib Date: Tue, 1 Nov 2022 15:58:35 +0800 Message-Id: <20221101075842.1218-3-zhiguang.liu@intel.com> In-Reply-To: <20221101075842.1218-1-zhiguang.liu@intel.com> References: <20221101075842.1218-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: Z3d2FUHpJEbf8ImOroifpU7zx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1667289566; bh=RFiTKGkd/vcpfiyjwFvYFbIRboWgcKK7Rk3Py354P94=; h=Cc:Date:From:Reply-To:Subject:To; b=Q+4/twrynhx1v755EpRjWHM1AjHMa88B8dIkBkqQzFDFg1hYlklSqz1bUGeAYw1IFSr fPgwcNE2//8S5N8eqzTMuyUBG1lcJ2ei8hsHt9ZjplJrhbdoXKCDKhXAVChXptZGQwvN8 A3xyUKDFK+rPyc+v6ropFellFzyHM2WfrPA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1667289569130100009 Content-Type: text/plain; charset="utf-8" From: 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 Reviewed-by: Liming Gao --- MdePkg/Include/Library/CpuLib.h | 48 ++++++++++++++++++ MdePkg/Library/BaseCpuLib/BaseCpuLib.inf | 6 +++ .../BaseCpuLib}/Ia32/InitializeFpu.nasm | 0 .../BaseCpuLib}/X64/InitializeFpu.nasm | 0 .../Library/BaseCpuLib/X86BaseCpuLib.c | 2 +- UefiCpuPkg/Include/Library/UefiCpuLib.h | 49 ------------------- .../Library/BaseUefiCpuLib/BaseUefiCpuLib.inf | 8 +-- .../BaseUefiCpuLib/BaseUefiCpuLibNull.c | 16 ++++++ 8 files changed, 72 insertions(+), 57 deletions(-) rename {UefiCpuPkg/Library/BaseUefiCpuLib =3D> MdePkg/Library/BaseCpuLib}/= Ia32/InitializeFpu.nasm (100%) rename {UefiCpuPkg/Library/BaseUefiCpuLib =3D> MdePkg/Library/BaseCpuLib}/= X64/InitializeFpu.nasm (100%) rename UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c =3D> MdePkg/Libr= ary/BaseCpuLib/X86BaseCpuLib.c (93%) create mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c diff --git a/MdePkg/Include/Library/CpuLib.h b/MdePkg/Include/Library/CpuLi= b.h index 25f6d9478c..3f29937dc7 100644 --- a/MdePkg/Include/Library/CpuLib.h +++ b/MdePkg/Include/Library/CpuLib.h @@ -41,4 +41,52 @@ CpuFlushTlb ( VOID ); =20 +#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 exc= eptions + masked,double-precision, round-to-nearest) and multimedia-extensions con= trol 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/Base= CpuLib/BaseCpuLib.inf index 6b230f6e6d..b2bc958ec8 100644 --- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf +++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf @@ -29,6 +29,9 @@ # VALID_ARCHITECTURES =3D IA32 X64 EBC ARM AARCH64 RISCV64 LOON= GARCH64 # =20 +[Sources.IA32, Sources.X64] + X86BaseCpuLib.c + [Sources.IA32] Ia32/CpuSleep.c | MSFT Ia32/CpuFlushTlb.c | MSFT @@ -39,10 +42,13 @@ Ia32/CpuSleepGcc.c | GCC Ia32/CpuFlushTlbGcc.c | GCC =20 + Ia32/InitializeFpu.nasm + [Sources.X64] X64/CpuFlushTlb.nasm X64/CpuSleep.nasm =20 + X64/InitializeFpu.nasm =20 [Sources.EBC] Ebc/CpuSleepFlushTlb.c diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.nasm b/Md= ePkg/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/Mde= Pkg/Library/BaseCpuLib/X64/InitializeFpu.nasm similarity index 100% rename from UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.nasm rename to MdePkg/Library/BaseCpuLib/X64/InitializeFpu.nasm diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c b/MdePkg/Li= brary/BaseCpuLib/X86BaseCpuLib.c similarity index 93% rename from UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c rename to MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c index 5d925bc273..1cad32a4be 100644 --- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c +++ b/MdePkg/Library/BaseCpuLib/X86BaseCpuLib.c @@ -13,7 +13,7 @@ #include =20 #include -#include +#include =20 /** Determine if the standard CPU signature is "AuthenticAMD". diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h b/UefiCpuPkg/Include/L= ibrary/UefiCpuLib.h index 0ff4a35774..ab6982db6e 100644 --- a/UefiCpuPkg/Include/Library/UefiCpuLib.h +++ b/UefiCpuPkg/Include/Library/UefiCpuLib.h @@ -13,53 +13,4 @@ #ifndef __UEFI_CPU_LIB_H__ #define __UEFI_CPU_LIB_H__ =20 -/** - Initializes floating point units for requirement of UEFI specification. - - This function initializes floating-point control word to 0x027F (all exc= eptions - masked,double-precision, round-to-nearest) and multimedia-extensions con= trol 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/UefiCpu= Pkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf index 34d3a7bb43..9f8b62d87a 100644 --- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf +++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf @@ -24,14 +24,8 @@ # VALID_ARCHITECTURES =3D IA32 X64 # =20 -[Sources.IA32] - Ia32/InitializeFpu.nasm - -[Sources.X64] - X64/InitializeFpu.nasm - [Sources] - BaseUefiCpuLib.c + BaseUefiCpuLibNull.c =20 [Packages] MdePkg/MdePkg.dec diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c b/UefiC= puPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c new file mode 100644 index 0000000000..24693635e4 --- /dev/null +++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c @@ -0,0 +1,16 @@ +/** @file +This library contains a dummy function to pass build. + +Copyright (c) 2022, Intel Corporation. All rights reserved. + +SPDX-License-Identifier: BSD-2-Clause-Patent +**/ +#include + +VOID +Dummy ( + VOID + ) +{ + +} --=20 2.31.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95806): https://edk2.groups.io/g/devel/message/95806 Mute This Topic: https://groups.io/mt/94704515/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-