From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com []) by mx.groups.io with SMTP id smtpd.web11.9432.1620717422491379209 for ; Tue, 11 May 2021 00:17:03 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: sofiax.chuang@intel.com) IronPort-SDR: DdUTYz0/fULbLM0cOITpDf4veufbRiB3WD6e9jNKEneEAEvr+uSkNG5IxucOPF5i7cDZEYExeS 99Z6nftNZUBQ== X-IronPort-AV: E=McAfee;i="6200,9189,9980"; a="199443048" X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="199443048" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2021 00:17:01 -0700 IronPort-SDR: 2IYBspOZDxmDQ0z+RXZ2mCPSs2m/xTs26F0eQO62q/4L/29lKdIDEZ1A0Ao9PcNSM/g81OZwSU ZJVPfYCG0HQQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="399211169" Received: from ikuox-tiger-lake-client-platform.itwn.intel.com ([10.5.215.23]) by fmsmga007.fm.intel.com with ESMTP; 11 May 2021 00:17:00 -0700 From: sofiax.chuang@intel.com To: devel@edk2.groups.io Cc: SofiaX Chuang , Ray Ni , Rangasai V Chaganty Subject: [edk2-devel][PATCH v5 1/7] IntelSiliconPkg/ReportCpuHobLib: Add ReportCpuHobLib Date: Tue, 11 May 2021 03:54:24 +0800 Message-Id: <78432ebda1f57efffe258a6d2999188a83664673.1620675658.git.sofiax.chuang@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: SofiaX Chuang REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3298 Add ReportCpuHobLib Signed-off-by: SofiaX Chuang Cc: Ray Ni Cc: Rangasai V Chaganty --- .../Include/Library/ReportCpuHobLib.h | 27 +++++++++++++ .../Intel/IntelSiliconPkg/IntelSiliconPkg.dec | 6 ++- .../Intel/IntelSiliconPkg/IntelSiliconPkg.dsc | 1 + .../Library/ReportCpuHobLib/ReportCpuHobLib.c | 39 +++++++++++++++++++ .../ReportCpuHobLib/ReportCpuHobLib.inf | 26 +++++++++++++ 5 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 Silicon/Intel/IntelSiliconPkg/Include/Library/ReportCpu= HobLib.h create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/R= eportCpuHobLib.c create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/R= eportCpuHobLib.inf diff --git a/Silicon/Intel/IntelSiliconPkg/Include/Library/ReportCpuHobLib.= h b/Silicon/Intel/IntelSiliconPkg/Include/Library/ReportCpuHobLib.h new file mode 100644 index 0000000000..106ab3d436 --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Include/Library/ReportCpuHobLib.h @@ -0,0 +1,27 @@ +/** @file=0D +=0D + Report CPU HOB library=0D +=0D + This library report the CPU HOB with Physical Address bits.=0D +=0D +Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D +SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef _REPORT_CPU_HOB_LIB_H_=0D +#define _REPORT_CPU_HOB_LIB_H_=0D +=0D +#include =0D +=0D +/**=0D + Build a HOB for the CPU.=0D +**/=0D +VOID=0D +EFIAPI=0D +ReportCpuHob (=0D + VOID=0D + );=0D +=0D +#endif=0D +=0D diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec b/Silicon/In= tel/IntelSiliconPkg/IntelSiliconPkg.dec index 4a2cbca5c1..2461ab8e06 100644 --- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec +++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec @@ -3,7 +3,7 @@ #=0D # This package provides common open source Intel silicon modules.=0D #=0D -# Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.
=0D +# Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.
=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D ##=0D @@ -42,6 +42,10 @@ #=0D AslUpdateLib|Include/Library/AslUpdateLib.h=0D =0D + ## @libraryclass Provides services to report CPU hob=0D + #=0D + ReportCpuHobLib|Include/Library/ReportCpuHobLib.h=0D +=0D [Guids]=0D ## GUID for Package token space=0D # {A9F8D54E-1107-4F0A-ADD0-4587E7A4A735}=0D diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc b/Silicon/In= tel/IntelSiliconPkg/IntelSiliconPkg.dsc index 5e0de7e19a..1092371d84 100644 --- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc +++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc @@ -93,6 +93,7 @@ IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.in= f=0D IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib= .inf=0D IntelSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.inf=0D + IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf=0D =0D [BuildOptions]=0D *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES=0D diff --git a/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCp= uHobLib.c b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpu= HobLib.c new file mode 100644 index 0000000000..3f67b477d2 --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib= .c @@ -0,0 +1,39 @@ +/** @file=0D + Source code file for Report CPU HOB library.=0D +=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 +#include =0D +#include =0D +=0D +=0D +/**=0D + Build a HOB for the CPU.=0D +**/=0D +VOID=0D +EFIAPI=0D +ReportCpuHob (=0D + VOID=0D + )=0D +{=0D + UINT8 PhysicalAddressBits;=0D + CPUID_VIR_PHY_ADDRESS_SIZE_EAX AddressSizeEax;=0D +=0D + AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, &AddressSizeEax.Uint32, NULL, NULL= , NULL);=0D + if (AddressSizeEax.Uint32 >=3D CPUID_VIR_PHY_ADDRESS_SIZE) {=0D + AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, &AddressSizeEax.Uint32, NULL, NU= LL, NULL);=0D + PhysicalAddressBits =3D AddressSizeEax.Bits.PhysicalAddressBits;=0D + } else {=0D + PhysicalAddressBits =3D 36;=0D + }=0D +=0D + ///=0D + /// Create a CPU hand-off information=0D + ///=0D + BuildCpuHob (PhysicalAddressBits, 16);=0D +}=0D diff --git a/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCp= uHobLib.inf b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportC= puHobLib.inf new file mode 100644 index 0000000000..1d2d6b4151 --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib= .inf @@ -0,0 +1,26 @@ +### @file=0D +# Component information file for the Report CPU HOB library.=0D +#=0D +# Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +###=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D ReportCpuHobLib=0D + FILE_GUID =3D 0A1C9D6B-44BE-4FD7-A4A2-D0E68D436848= =0D + VERSION_STRING =3D 1.0=0D + MODULE_TYPE =3D PEIM=0D + LIBRARY_CLASS =3D ReportCpuHobLib=0D +=0D +[LibraryClasses]=0D + BaseLib=0D + HobLib=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D +=0D +[Sources]=0D + ReportCpuHobLib.c=0D --=20 2.27.0