From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=io0ZWTJH; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: yu.pu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648036120; x=1679572120; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5DvLdD9lObO1lloY2hOAo96d83o9vrDQr8UFmHQdykU=; b=io0ZWTJHDig3/dcvo6H36UloTiLeUlTNec8hdnH7fN7qT3Ui+zhvh/MB I3ZxuIb3J3vk45MfsckxysEzKoA3YvGhqbaUcVMPrhUqbDqXfn07PvfzN 9TUQJNDhebTmPm7EI271tXBsGFJep1N4pcQAcbiXt0JV1htnUGSPGvtnl bCVS1UBO3K+HkgQcDwb+7Avc0wG1xoqphO2Diqu3Bk580zGbaoMAAyKwD XvZMNEyVz26pQRdfQrq83+Cmy41MKNKaTTq01pQjaGn9XZGGG5qCBV47J PILNu+EAjN7ZUH8TiaW+jlFyMRBcU+wmsonU+hKKeugqnmhpdPRyyjKDn Q==; 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" 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" 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: [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> X-Mailer: git-send-email 2.30.0.windows.2 In-Reply-To: <20220323114802.1008-1-yu.pu@intel.com> References: <20220323114802.1008-1-yu.pu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=0D This library defines some routines that are generic for IA32 family CPU.= =0D -=0D The library routines are UEFI specification compliant.=0D -=0D Copyright (c) 2020, AMD Inc. All rights reserved.
=0D Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D -=0D **/=0D =0D #include =0D #include =0D =0D #include =0D -#include =0D +#include =0D =0D /**=0D Determine if the standard CPU signature is "AuthenticAMD".=0D -=0D @retval TRUE The CPU signature matches.=0D @retval FALSE The CPU signature does not match.=0D -=0D **/=0D BOOLEAN=0D EFIAPI=0D @@ -40,7 +35,6 @@ StandardSignatureIsAuthenticAMD ( =0D /**=0D Return the 32bit CPU family and model value.=0D -=0D @return CPUID[01h].EAX with Processor Type and Stepping ID cleared.=0D **/=0D UINT32=0D 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=0D );=0D =0D +#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)=0D +=0D +/**=0D + Initializes floating point units for requirement of UEFI specification.= =0D +=0D + This function initializes floating-point control word to 0x027F (all exc= eptions=0D + masked,double-precision, round-to-nearest) and multimedia-extensions con= trol word=0D + (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush= to zero=0D + for masked underflow).=0D +=0D +**/=0D +VOID=0D +EFIAPI=0D +InitializeFloatingPointUnits (=0D + VOID=0D + );=0D +=0D +/**=0D + Determine if the standard CPU signature is "AuthenticAMD".=0D +=0D + @retval TRUE The CPU signature matches.=0D + @retval FALSE The CPU signature does not match.=0D +=0D +**/=0D +BOOLEAN=0D +EFIAPI=0D +StandardSignatureIsAuthenticAMD (=0D + VOID=0D + );=0D +=0D +/**=0D + Return the 32bit CPU family and model value.=0D +=0D + @return CPUID[01h].EAX with Processor Type and Stepping ID cleared.=0D +**/=0D +UINT32=0D +EFIAPI=0D +GetCpuFamilyModel (=0D + VOID=0D + );=0D +=0D +/**=0D + Return the CPU stepping ID.=0D + @return CPU stepping ID value in CPUID[01h].EAX.=0D +**/=0D +UINT8=0D +EFIAPI=0D +GetCpuSteppingId (=0D + VOID=0D + );=0D +=0D +#endif=0D +=0D #endif=0D 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=0D #=0D =0D +[Sources.IA32, Sources.X64]=0D + X86BaseCpuLib.c=0D +=0D [Sources.IA32]=0D Ia32/CpuSleep.c | MSFT=0D Ia32/CpuFlushTlb.c | MSFT=0D @@ -38,10 +41,14 @@ Ia32/CpuSleepGcc.c | GCC=0D Ia32/CpuFlushTlbGcc.c | GCC=0D =0D + Ia32/InitializeFpu.nasm=0D +=0D [Sources.X64]=0D X64/CpuFlushTlb.nasm=0D X64/CpuSleep.nasm=0D =0D + X64/InitializeFpu.nasm=0D +=0D =0D [Sources.EBC]=0D Ebc/CpuSleepFlushTlb.c=0D 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