[edk2-devel][PATCH v5 1/7] IntelSiliconPkg/ReportCpuHobLib: Add ReportCpuHobLib

sofiax.chuang@intel.com posted 7 patches 4 years, 9 months ago
[edk2-devel][PATCH v5 1/7] IntelSiliconPkg/ReportCpuHobLib: Add ReportCpuHobLib
Posted by sofiax.chuang@intel.com 4 years, 9 months ago
From: SofiaX Chuang <sofiax.chuang@intel.com>

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

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         | 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/ReportCpuHobLib.h
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.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
+
+  Report CPU HOB library
+
+  This library report the CPU HOB with Physical Address bits.
+
+Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _REPORT_CPU_HOB_LIB_H_
+#define _REPORT_CPU_HOB_LIB_H_
+
+#include <BaseTypes.h>
+
+/**
+  Build a HOB for the CPU.
+**/
+VOID
+EFIAPI
+ReportCpuHob (
+  VOID
+  );
+
+#endif
+
diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
index 4a2cbca5c1..2461ab8e06 100644
--- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
+++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
@@ -3,7 +3,7 @@
 #
 # This package provides common open source Intel silicon modules.
 #
-# Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -42,6 +42,10 @@
   #
   AslUpdateLib|Include/Library/AslUpdateLib.h
 
+  ## @libraryclass Provides services to report CPU hob
+  #
+  ReportCpuHobLib|Include/Library/ReportCpuHobLib.h
+
 [Guids]
   ## GUID for Package token space
   # {A9F8D54E-1107-4F0A-ADD0-4587E7A4A735}
diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc b/Silicon/Intel/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.inf
   IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.inf
   IntelSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.inf
+  IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
 [BuildOptions]
   *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
diff --git a/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c
new file mode 100644
index 0000000000..3f67b477d2
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c
@@ -0,0 +1,39 @@
+/** @file
+  Source code file for Report CPU HOB library.
+
+Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiPei.h>
+#include <Library/BaseLib.h>
+#include <Library/HobLib.h>
+#include <Register/Intel/Cpuid.h>
+
+
+/**
+  Build a HOB for the CPU.
+**/
+VOID
+EFIAPI
+ReportCpuHob (
+  VOID
+  )
+{
+  UINT8                           PhysicalAddressBits;
+  CPUID_VIR_PHY_ADDRESS_SIZE_EAX  AddressSizeEax;
+
+  AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, &AddressSizeEax.Uint32, NULL, NULL, NULL);
+  if (AddressSizeEax.Uint32 >= CPUID_VIR_PHY_ADDRESS_SIZE) {
+    AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, &AddressSizeEax.Uint32, NULL, NULL, NULL);
+    PhysicalAddressBits = AddressSizeEax.Bits.PhysicalAddressBits;
+  } else {
+    PhysicalAddressBits = 36;
+  }
+
+  ///
+  /// Create a CPU hand-off information
+  ///
+  BuildCpuHob (PhysicalAddressBits, 16);
+}
diff --git a/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf
new file mode 100644
index 0000000000..1d2d6b4151
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf
@@ -0,0 +1,26 @@
+### @file
+# Component information file for the Report CPU HOB library.
+#
+# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = ReportCpuHobLib
+  FILE_GUID                      = 0A1C9D6B-44BE-4FD7-A4A2-D0E68D436848
+  VERSION_STRING                 = 1.0
+  MODULE_TYPE                    = PEIM
+  LIBRARY_CLASS                  = ReportCpuHobLib
+
+[LibraryClasses]
+  BaseLib
+  HobLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+
+[Sources]
+  ReportCpuHobLib.c
-- 
2.27.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#74939): https://edk2.groups.io/g/devel/message/74939
Mute This Topic: https://groups.io/mt/82741014/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel][PATCH v5 1/7] IntelSiliconPkg/ReportCpuHobLib: Add ReportCpuHobLib
Posted by Ni, Ray 4 years, 9 months ago
Reviewed-by: Ray Ni <ray.ni@intel.com>
> -----Original Message-----
> From: Chuang, SofiaX <sofiax.chuang@intel.com>
> Sent: Tuesday, May 11, 2021 3:54 AM
> To: devel@edk2.groups.io
> Cc: Chuang, SofiaX <sofiax.chuang@intel.com>; Ni, Ray <ray.ni@intel.com>; Chaganty, Rangasai V
> <rangasai.v.chaganty@intel.com>
> Subject: [edk2-devel][PATCH v5 1/7] IntelSiliconPkg/ReportCpuHobLib: Add ReportCpuHobLib
> 
> From: SofiaX Chuang <sofiax.chuang@intel.com>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3298
> 
> 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         | 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/ReportCpuHobLib.h
>  create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c
>  create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.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
> 
> +
> 
> +  Report CPU HOB library
> 
> +
> 
> +  This library report the CPU HOB with Physical Address bits.
> 
> +
> 
> +Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> 
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +
> 
> +**/
> 
> +
> 
> +#ifndef _REPORT_CPU_HOB_LIB_H_
> 
> +#define _REPORT_CPU_HOB_LIB_H_
> 
> +
> 
> +#include <BaseTypes.h>
> 
> +
> 
> +/**
> 
> +  Build a HOB for the CPU.
> 
> +**/
> 
> +VOID
> 
> +EFIAPI
> 
> +ReportCpuHob (
> 
> +  VOID
> 
> +  );
> 
> +
> 
> +#endif
> 
> +
> 
> diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
> index 4a2cbca5c1..2461ab8e06 100644
> --- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
> +++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
> @@ -3,7 +3,7 @@
>  #
> 
>  # This package provides common open source Intel silicon modules.
> 
>  #
> 
> -# Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.<BR>
> 
> +# Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.<BR>
> 
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  #
> 
>  ##
> 
> @@ -42,6 +42,10 @@
>    #
> 
>    AslUpdateLib|Include/Library/AslUpdateLib.h
> 
> 
> 
> +  ## @libraryclass Provides services to report CPU hob
> 
> +  #
> 
> +  ReportCpuHobLib|Include/Library/ReportCpuHobLib.h
> 
> +
> 
>  [Guids]
> 
>    ## GUID for Package token space
> 
>    # {A9F8D54E-1107-4F0A-ADD0-4587E7A4A735}
> 
> diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc b/Silicon/Intel/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.inf
> 
>    IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.inf
> 
>    IntelSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.inf
> 
> +  IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf
> 
> 
> 
>  [BuildOptions]
> 
>    *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
> 
> diff --git a/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c
> b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c
> new file mode 100644
> index 0000000000..3f67b477d2
> --- /dev/null
> +++ b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c
> @@ -0,0 +1,39 @@
> +/** @file
> 
> +  Source code file for Report CPU HOB library.
> 
> +
> 
> +Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> 
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +
> 
> +**/
> 
> +
> 
> +#include <PiPei.h>
> 
> +#include <Library/BaseLib.h>
> 
> +#include <Library/HobLib.h>
> 
> +#include <Register/Intel/Cpuid.h>
> 
> +
> 
> +
> 
> +/**
> 
> +  Build a HOB for the CPU.
> 
> +**/
> 
> +VOID
> 
> +EFIAPI
> 
> +ReportCpuHob (
> 
> +  VOID
> 
> +  )
> 
> +{
> 
> +  UINT8                           PhysicalAddressBits;
> 
> +  CPUID_VIR_PHY_ADDRESS_SIZE_EAX  AddressSizeEax;
> 
> +
> 
> +  AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, &AddressSizeEax.Uint32, NULL, NULL, NULL);
> 
> +  if (AddressSizeEax.Uint32 >= CPUID_VIR_PHY_ADDRESS_SIZE) {
> 
> +    AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, &AddressSizeEax.Uint32, NULL, NULL, NULL);
> 
> +    PhysicalAddressBits = AddressSizeEax.Bits.PhysicalAddressBits;
> 
> +  } else {
> 
> +    PhysicalAddressBits = 36;
> 
> +  }
> 
> +
> 
> +  ///
> 
> +  /// Create a CPU hand-off information
> 
> +  ///
> 
> +  BuildCpuHob (PhysicalAddressBits, 16);
> 
> +}
> 
> diff --git a/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf
> b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf
> new file mode 100644
> index 0000000000..1d2d6b4151
> --- /dev/null
> +++ b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf
> @@ -0,0 +1,26 @@
> +### @file
> 
> +# Component information file for the Report CPU HOB library.
> 
> +#
> 
> +# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> 
> +#
> 
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +#
> 
> +###
> 
> +
> 
> +[Defines]
> 
> +  INF_VERSION                    = 0x00010005
> 
> +  BASE_NAME                      = ReportCpuHobLib
> 
> +  FILE_GUID                      = 0A1C9D6B-44BE-4FD7-A4A2-D0E68D436848
> 
> +  VERSION_STRING                 = 1.0
> 
> +  MODULE_TYPE                    = PEIM
> 
> +  LIBRARY_CLASS                  = ReportCpuHobLib
> 
> +
> 
> +[LibraryClasses]
> 
> +  BaseLib
> 
> +  HobLib
> 
> +
> 
> +[Packages]
> 
> +  MdePkg/MdePkg.dec
> 
> +
> 
> +[Sources]
> 
> +  ReportCpuHobLib.c
> 
> --
> 2.27.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75054): https://edk2.groups.io/g/devel/message/75054
Mute This Topic: https://groups.io/mt/82741014/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel][PATCH v5 1/7] IntelSiliconPkg/ReportCpuHobLib: Add ReportCpuHobLib
Posted by Chaganty, Rangasai V 4 years, 9 months ago
Reviewed-by: Sai Chaganty <rangasai.v.chaganty@intel.com>  

-----Original Message-----
From: Chuang, SofiaX <sofiax.chuang@intel.com> 
Sent: Monday, May 10, 2021 12:54 PM
To: devel@edk2.groups.io
Cc: Chuang, SofiaX <sofiax.chuang@intel.com>; Ni, Ray <ray.ni@intel.com>; Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>
Subject: [edk2-devel][PATCH v5 1/7] IntelSiliconPkg/ReportCpuHobLib: Add ReportCpuHobLib

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

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

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         | 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/ReportCpuHobLib.h
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c
 create mode 100644 Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.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++  Report CPU HOB library++  This library report the CPU HOB 
+with Physical Address bits.++Copyright (c) 2021, Intel Corporation. All 
+rights reserved.<BR>+SPDX-License-Identifier: 
+BSD-2-Clause-Patent++**/++#ifndef _REPORT_CPU_HOB_LIB_H_+#define 
+_REPORT_CPU_HOB_LIB_H_++#include <BaseTypes.h>++/**+  Build a HOB for 
+the CPU.+**/+VOID+EFIAPI+ReportCpuHob (+  VOID+  );++#endif+diff --git 
+a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec 
+b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
index 4a2cbca5c1..2461ab8e06 100644
--- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
+++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
@@ -3,7 +3,7 @@
 # # This package provides common open source Intel silicon modules. #-# Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.<BR>+# Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ##@@ -42,6 +42,10 @@
   #   AslUpdateLib|Include/Library/AslUpdateLib.h +  ## @libraryclass Provides services to report CPU hob+  #+  ReportCpuHobLib|Include/Library/ReportCpuHobLib.h+ [Guids]   ## GUID for Package token space   # {A9F8D54E-1107-4F0A-ADD0-4587E7A4A735}diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc b/Silicon/Intel/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.inf   IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.inf   IntelSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.inf+  IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf  [BuildOptions]   *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACESdiff --git a/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c
new file mode 100644
index 0000000000..3f67b477d2
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHob
+++ Lib.c
@@ -0,0 +1,39 @@
+/** @file+  Source code file for Report CPU HOB library.++Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>+SPDX-License-Identifier: BSD-2-Clause-Patent++**/++#include <PiPei.h>+#include <Library/BaseLib.h>+#include <Library/HobLib.h>+#include <Register/Intel/Cpuid.h>+++/**+  Build a HOB for the CPU.+**/+VOID+EFIAPI+ReportCpuHob (+  VOID+  )+{+  UINT8                           PhysicalAddressBits;+  CPUID_VIR_PHY_ADDRESS_SIZE_EAX  AddressSizeEax;++  AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, &AddressSizeEax.Uint32, NULL, NULL, NULL);+  if (AddressSizeEax.Uint32 >= CPUID_VIR_PHY_ADDRESS_SIZE) {+    AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, &AddressSizeEax.Uint32, NULL, NULL, NULL);+    PhysicalAddressBits = AddressSizeEax.Bits.PhysicalAddressBits;+  } else {+    PhysicalAddressBits = 36;+  }++  ///+  /// Create a CPU hand-off information+  ///+  BuildCpuHob (PhysicalAddressBits, 16);+}diff --git a/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf
new file mode 100644
index 0000000000..1d2d6b4151
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHob
+++ Lib.inf
@@ -0,0 +1,26 @@
+### @file+# Component information file for the Report CPU HOB library.+#+# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>+#+# SPDX-License-Identifier: BSD-2-Clause-Patent+#+###++[Defines]+  INF_VERSION                    = 0x00010005+  BASE_NAME                      = ReportCpuHobLib+  FILE_GUID                      = 0A1C9D6B-44BE-4FD7-A4A2-D0E68D436848+  VERSION_STRING                 = 1.0+  MODULE_TYPE                    = PEIM+  LIBRARY_CLASS                  = ReportCpuHobLib++[LibraryClasses]+  BaseLib+  HobLib++[Packages]+  MdePkg/MdePkg.dec++[Sources]+  ReportCpuHobLib.c-- 
2.27.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75055): https://edk2.groups.io/g/devel/message/75055
Mute This Topic: https://groups.io/mt/82741014/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-