[PATCH v4 1/7] IntelSiliconPkg/ReportCpuHobLib: Add ReportCpuHobLib


sofiax.chuang@...
 

From: SofiaX Chuang <sofiax.chuang@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3298

Add ReportCpuHobLib

Signed-off-by: SofiaX Chuang <sofiax.chuang@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
---
.../Include/Library/ReportCpuHobLib.h | 30 +++++++++++++
.../Intel/IntelSiliconPkg/IntelSiliconPkg.dec | 6 ++-
.../Intel/IntelSiliconPkg/IntelSiliconPkg.dsc | 1 +
.../Library/ReportCpuHobLib/ReportCpuHobLib.c | 42 +++++++++++++++++++
.../ReportCpuHobLib/ReportCpuHobLib.inf | 26 ++++++++++++
5 files changed, 104 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..be0382b9cf
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Include/Library/ReportCpuHobLib.h
@@ -0,0 +1,30 @@
+/** @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.<BR>=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 <BaseTypes.h>=0D
+=0D
+/**=0D
+ Function for Report CPU HOB library=0D
+=0D
+ This library report the CPU HOB with Physical Address bits.=0D
+=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.<BR>=0D
+# Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.<BR>=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..f907de9423
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib=
.c
@@ -0,0 +1,42 @@
+/** @file=0D
+ Source code file for Report CPU HOB library.=0D
+=0D
+Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>=0D
+SPDX-License-Identifier: BSD-2-Clause-Patent=0D
+=0D
+**/=0D
+=0D
+#include <PiPei.h>=0D
+#include <Library/BaseLib.h>=0D
+#include <Library/HobLib.h>=0D
+#include <Register/Intel/Cpuid.h>=0D
+=0D
+=0D
+/**=0D
+ Function for Report CPU HOB library=0D
+=0D
+ This library report the CPU HOB with Physical Address bits.=0D
+=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 (UINT8) AddressSizeEax.Uint32;=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.<BR>=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

Join devel@edk2.groups.io to automatically receive all group messages.