From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com []) by mx.groups.io with SMTP id smtpd.web08.5800.1619515104140018817 for ; Tue, 27 Apr 2021 02:18:24 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: sofiax.chuang@intel.com) IronPort-SDR: vlyE+mUUxH8JwMGC/NEIH7e92FZSj3PE6aFTWx5SloOpJHvug8u9yatopK0MDC9UiD2cb/hTDi QCNcVSLNN+sA== X-IronPort-AV: E=McAfee;i="6200,9189,9966"; a="175960090" X-IronPort-AV: E=Sophos;i="5.82,254,1613462400"; d="scan'208";a="175960090" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2021 02:18:23 -0700 IronPort-SDR: jYqc32oIdZQ9D56RHRPfaSlqFEwpI/we9TKEwLE144dbgEcMXOO4AnT0M9N+RHhJ785/2xMw2d MGEU6jvlNpNQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,254,1613462400"; d="scan'208";a="465420307" Received: from ikuox-tiger-lake-client-platform.itwn.intel.com ([10.5.215.23]) by orsmga001.jf.intel.com with ESMTP; 27 Apr 2021 02:18:22 -0700 From: sofiax.chuang@intel.com To: devel@edk2.groups.io Cc: SofiaX Chuang , Ray Ni , Rangasai V Chaganty Subject: [PATCH v2 1/7] IntelSiliconPkg/ReportCpuHobLib: Add ReportCpuHobLib Date: Tue, 27 Apr 2021 05:55:43 +0800 Message-Id: <84de1b2ca444acef98975874f52e3ba2f355f923.1619473900.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 | 24 +++++++++++++ .../Intel/IntelSiliconPkg/IntelSiliconPkg.dec | 6 +++- .../Library/ReportCpuHobLib/ReportCpuHobLib.c | 35 +++++++++++++++++++ .../ReportCpuHobLib/ReportCpuHobLib.inf | 26 ++++++++++++++ 4 files changed, 90 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..46f502d616 --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Include/Library/ReportCpuHobLib.h @@ -0,0 +1,24 @@ +/** @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 +#include =0D +=0D +VOID=0D +EFIAPI=0D +ReportCpuHob (=0D + VOID=0D + );=0D +=0D +#endif=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/Library/ReportCpuHobLib/ReportCp= uHobLib.c b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpu= HobLib.c new file mode 100644 index 0000000000..97cacb7110 --- /dev/null +++ b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib= .c @@ -0,0 +1,35 @@ +/** @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 +VOID=0D +EFIAPI=0D +ReportCpuHob (=0D + VOID=0D + )=0D +{=0D + UINT8 PhysicalAddressBits;=0D + UINT32 RegEax;=0D +=0D + AsmCpuid (CPUID_EXTENDED_FUNCTION, &RegEax, NULL, NULL, NULL);=0D + if (RegEax >=3D CPUID_VIR_PHY_ADDRESS_SIZE) {=0D + AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, &RegEax, NULL, NULL, NULL);=0D + PhysicalAddressBits =3D (UINT8) RegEax;=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