From nobody Sun Feb 8 22:48:54 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+87924+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+87924+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1648079390; cv=none; d=zohomail.com; s=zohoarc; b=FYop/S+38bGgqEvkYeczOmSCvdNGZWFY506yBtpkPRlbb2HV86SqnCZzcr34KcqHpVzAMSjMN4vZUX1W3GHuLVo4cGs0NGdVzZ0Q2OeYpLiPz29GUIyrO9my2yu14BZJ5zdAtvhrblAxDw1DuNgzkN6l9v1dbEn0z39o+6qBgwo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648079390; 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=uai03ZETONb3oZ5XoHsQUJoWRLWXS1b+1yIYMaKmMHI=; b=AHZ26D/PLqk5rP92pN7AhfUJc+aBMnkhOars44oG6Pk1IKD131ilLs6OZhnCmzQ7tCKgiImn/Qbo5K/9Szn2gZGGoydDsVsQOnZ2tU/okcvYNsikmzJ5dkoyc3sETTlHEU2px9mA+hQXouzecuyqqR3qROPyRoRkDZa6miMKIv8= 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+87924+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 1648079390435117.94272753936002; Wed, 23 Mar 2022 16:49:50 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id u9RNYY1788612xIjfpnfUxyh; Wed, 23 Mar 2022 16:49:50 -0700 X-Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web08.7983.1648036097703028981 for ; Wed, 23 Mar 2022 04:48:40 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10294"; a="256911877" X-IronPort-AV: E=Sophos;i="5.90,204,1643702400"; d="scan'208";a="256911877" X-Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2022 04:48:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,204,1643702400"; d="scan'208";a="544160530" X-Received: from shwdeopenlab704.ccr.corp.intel.com ([10.239.182.50]) by orsmga007.jf.intel.com with ESMTP; 23 Mar 2022 04:48:38 -0700 From: Yu Pu To: devel@edk2.groups.io Cc: Yu Pu , Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [edk2-devel] [PATCH v1 08/17] MdePkg: Move API and implementation from UefiCpuLib to CpuLib Date: Wed, 23 Mar 2022 19:47:53 +0800 Message-Id: <20220323114802.1008-9-yu.pu@intel.com> In-Reply-To: <20220323114802.1008-1-yu.pu@intel.com> References: <20220323114802.1008-1-yu.pu@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,yu.pu@intel.com X-Gm-Message-State: tC44E16Y6wADVoyDsm79DBOWx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1648079390; bh=3UCuUDCsf8JaR96jW2sTF2boYvjgcPNkHmCcktckyd8=; h=Cc:Date:From:Reply-To:Subject:To; b=QQ+126EXWVT9ieMBiP4wEIehbiW9/BpoCAzFk9sNTEWR2NCxpELwPxWwGlvFmAey/94 gNMAPXzJWIiXPteTjRWC3fRFpLyq54XcpQjxZbB3Nu8TjszQF8FMAquYS2ZrabaQTeCTu qhkvqjPDrtG/dcywqJ6e7DOwqt9qYQHJAWI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1648079391754100036 Content-Type: text/plain; charset="utf-8" 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 =3D> MdePkg/Library/Bas= eCpuLib/X86BaseCpuLib.c | 8 +-- MdePkg/Include/Library/CpuLib.h = | 53 ++++++++++++++++++++ MdePkg/Library/BaseCpuLib/BaseCpuLib.inf = | 7 +++ {UefiCpuPkg/Library/BaseUefiCpuLib =3D> MdePkg/Library/BaseCpuLib}/Ia32/In= itializeFpu.nasm | 0 {UefiCpuPkg/Library/BaseUefiCpuLib =3D> MdePkg/Library/BaseCpuLib}/X64/Ini= tializeFpu.nasm | 0 5 files changed, 61 insertions(+), 7 deletions(-) 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 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 - **/ =20 #include #include =20 #include -#include +#include =20 /** 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 ( =20 /** 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/CpuLi= b.h index 25f6d9478c52..c548c65a4445 100644 --- a/MdePkg/Include/Library/CpuLib.h +++ b/MdePkg/Include/Library/CpuLib.h @@ -41,4 +41,57 @@ 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 950f5229b2a4..8d6eed3745b3 100644 --- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf +++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf @@ -28,6 +28,9 @@ # VALID_ARCHITECTURES =3D IA32 X64 EBC ARM AARCH64 RISCV64 # =20 +[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 =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 --=20 2.30.0.windows.2 -=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 (#87924): https://edk2.groups.io/g/devel/message/87924 Mute This Topic: https://groups.io/mt/89988798/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-