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

Ni, Ray ray.ni at intel.com
Mon Apr 26 08:39:48 UTC 2021


Sofia,
Several comments:
1. Please don't use hardcode value 0x80000000. Use the macro in MdePkg/.../Cpuid.h
2. Please don't use hardcode value 0x80000008. Use the macro and data structure in MdePkg/.../Cpuid.h
3. Please add "EFIAPI"
+VOID
+ReportCpuHob (
+  VOID
+  );
4. Can you please try to remove the IntelSiliconPkg.dec from below?
+[Packages]
+  MdePkg/MdePkg.dec
+  IntelSiliconPkg/IntelSiliconPkg.dec

> -----Original Message-----
> From: Chuang, SofiaX <sofiax.chuang at intel.com>
> Sent: Monday, April 19, 2021 4:44 PM
> To: devel at edk2.groups.io
> Cc: Chuang, SofiaX <sofiax.chuang at intel.com>; Ni, Ray <ray.ni at intel.com>;
> Chaganty, Rangasai V <rangasai.v.chaganty at intel.com>
> Subject: [PATCH 1/7] IntelSiliconPkg/ReportCpuHobLib: Add
> ReportCpuHobLib
> 
> From: SofiaX Chuang <sofiax.chuang at intel.com>
> 
> Add ReportCpuHobLib
> 
> Signed-off-by: SofiaX Chuang <sofiax.chuang at intel.com>
> Cc: Ray Ni <ray.ni at intel.com>
> Cc: Rangasai V Chaganty <rangasai.v.chaganty at intel.com>
> ---
>  .../Include/Library/ReportCpuHobLib.h         | 23 +++++++++++++
>  .../Intel/IntelSiliconPkg/IntelSiliconPkg.dec |  6 +++-
>  .../Library/ReportCpuHobLib/ReportCpuHobLib.c | 33
> +++++++++++++++++++
>  .../ReportCpuHobLib/ReportCpuHobLib.inf       | 27 +++++++++++++++
>  4 files changed, 88 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..9ca18146ed
> --- /dev/null
> +++ b/Silicon/Intel/IntelSiliconPkg/Include/Library/ReportCpuHobLib.h
> @@ -0,0 +1,23 @@
> +/** @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 <PiPei.h>
> 
> +#include <Uefi.h>
> 
> +
> 
> +VOID
> 
> +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/Library/ReportCpuHobLib/ReportCpuHobLib.c
> b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c
> new file mode 100644
> index 0000000000..1a3d60366d
> --- /dev/null
> +++
> b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c
> @@ -0,0 +1,33 @@
> +/** @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>
> 
> +
> 
> +VOID
> 
> +ReportCpuHob (
> 
> +  VOID
> 
> +  )
> 
> +{
> 
> +  UINT8                         PhysicalAddressBits;
> 
> +  UINT32                        RegEax;
> 
> +
> 
> +  AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
> 
> +  if (RegEax >= 0x80000008) {
> 
> +    AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
> 
> +    PhysicalAddressBits = (UINT8) RegEax;
> 
> +  } else {
> 
> +    PhysicalAddressBits = 36;
> 
> +  }
> 
> +
> 
> +  ///
> 
> +  /// Create a CPU hand-off information
> 
> +  ///
> 
> +  BuildCpuHob (PhysicalAddressBits, 16);
> 
> +}
> 
> diff --git
> a/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.in
> f
> b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.in
> f
> new file mode 100644
> index 0000000000..ae7871ad4e
> --- /dev/null
> +++
> b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.in
> f
> @@ -0,0 +1,27 @@
> +### @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
> 
> +  IntelSiliconPkg/IntelSiliconPkg.dec
> 
> +
> 
> +[Sources]
> 
> +  ReportCpuHobLib.c
> 
> --
> 2.27.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#74415): https://edk2.groups.io/g/devel/message/74415
Mute This Topic: https://groups.io/mt/82373413/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list