From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.11666.1649775112421373944 for ; Tue, 12 Apr 2022 07:52:02 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=getp/NwY; spf=pass (domain: intel.com, ip: 192.55.52.93, 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=1649775122; x=1681311122; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NOxOWcvDuvEKsSw2Zm1fGxLOm5LwdIm7ipYlH6rO5oo=; b=getp/NwYJEYKDWOo5jgnItjYVD0cQFtHqays2x0kUfLvmCtSw2W9CZfq yjYU1ICFJQ0PuYOseWUhsc013KvzSjDBlN1g8qwfMkhxbKS0UmuqauMfL bRrpFZSYHPqYOueLBRcb8hEDKOjIbLcHY9XsnyQnwb+3AztIWf0B93Ndg r/+ZkVX6dK8R1sAbHKKfO6b98KUDrtp/SV5sqmLwZcO911yl/t2xTW0qW xkBhcEHJXEM1ywcXqMeVpylmMejPohEcy9C5GdQjotBi1S9Z+/vMCWJLp abJi3M6DYXCCiwJPDN+IYhuh7g8hsFjFzsyrzbHub4kS0P4daHZDtUjR+ Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10315"; a="259986633" X-IronPort-AV: E=Sophos;i="5.90,254,1643702400"; d="scan'208";a="259986633" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2022 07:52:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,254,1643702400"; d="scan'208";a="551740293" Received: from shwdeopenlab704.ccr.corp.intel.com ([10.239.182.50]) by orsmga007.jf.intel.com with ESMTP; 12 Apr 2022 07:51:59 -0700 From: Yu Pu To: devel@edk2.groups.io Cc: Yu Pu , Michael D Kinney , Liming Gao , Zhiguang Liu , Eric Dong , Ray Ni , Rahul Kumar Subject: [PATCH v2 07/14] MdePkg: Move API and implementation from UefiCpuLib to CpuLib Date: Tue, 12 Apr 2022 22:51:37 +0800 Message-Id: <20220412145144.3521-8-yu.pu@intel.com> X-Mailer: git-send-email 2.30.0.windows.2 In-Reply-To: <20220412145144.3521-1-yu.pu@intel.com> References: <20220412145144.3521-1-yu.pu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 =3D> MdePkg/Library/Bas= eCpuLib/X86BaseCpuLib.c | 2 +- UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c = | 16 +++++++ MdePkg/Include/Library/CpuLib.h = | 48 +++++++++++++++++++ MdePkg/Library/BaseCpuLib/BaseCpuLib.inf = | 6 +++ {UefiCpuPkg/Library/BaseUefiCpuLib =3D> MdePkg/Library/BaseCpuLib}/Ia32/In= itializeFpu.nasm | 0 {UefiCpuPkg/Library/BaseUefiCpuLib =3D> MdePkg/Library/BaseCpuLib}/X64/Ini= tializeFpu.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/Li= brary/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 =0D =0D #include =0D -#include =0D +#include =0D =0D /**=0D Determine if the standard CPU signature is "AuthenticAMD".=0D diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c b/UefiC= puPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c new file mode 100644 index 000000000000..eaecd4ae5ed7 --- /dev/null +++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLibNull.c @@ -0,0 +1,16 @@ +/** @file=0D +This library contains a dummy function to pass build.=0D +=0D +Copyright (c) 2022, Intel Corporation. All rights reserved.=0D +=0D +SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +#include =0D +STATIC=0D +VOID=0D +Dummy (=0D + VOID=0D + )=0D +{=0D +=0D +}=0D diff --git a/MdePkg/Include/Library/CpuLib.h b/MdePkg/Include/Library/CpuLi= b.h index 25f6d9478c52..3f29937dc71b 100644 --- a/MdePkg/Include/Library/CpuLib.h +++ b/MdePkg/Include/Library/CpuLib.h @@ -41,4 +41,52 @@ 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 + 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 +VOID=0D +EFIAPI=0D +InitializeFloatingPointUnits (=0D + VOID=0D + );=0D +=0D +/**=0D + Determine if the standard CPU signature is "AuthenticAMD".=0D + @retval TRUE The CPU signature matches.=0D + @retval FALSE The CPU signature does not match.=0D +**/=0D +BOOLEAN=0D +EFIAPI=0D +StandardSignatureIsAuthenticAMD (=0D + VOID=0D + );=0D +=0D +/**=0D + Return the 32bit CPU family and model value.=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..7cdbb552c08c 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,13 @@ 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 [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 diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h b/UefiCpuPkg/Include/L= ibrary/UefiCpuLib.h index 0ff4a35774c1..ab6982db6e9c 100644 --- a/UefiCpuPkg/Include/Library/UefiCpuLib.h +++ b/UefiCpuPkg/Include/Library/UefiCpuLib.h @@ -13,53 +13,4 @@ #ifndef __UEFI_CPU_LIB_H__=0D #define __UEFI_CPU_LIB_H__=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 diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf b/UefiCpu= Pkg/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 =3D IA32 X64=0D #=0D =0D -[Sources.IA32]=0D - Ia32/InitializeFpu.nasm=0D -=0D -[Sources.X64]=0D - X64/InitializeFpu.nasm=0D -=0D [Sources]=0D - BaseUefiCpuLib.c=0D + BaseUefiCpuLibNull.c=0D =0D [Packages]=0D MdePkg/MdePkg.dec=0D --=20 2.30.0.windows.2