public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: sofiax.chuang@intel.com
To: devel@edk2.groups.io
Cc: SofiaX Chuang <sofiax.chuang@intel.com>,
	Ray Ni <ray.ni@intel.com>,
	Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Subject: [edk2-devel][PATCH v3 1/7] IntelSiliconPkg/ReportCpuHobLib: Add ReportCpuHobLib
Date: Tue, 27 Apr 2021 06:01:19 +0800	[thread overview]
Message-ID: <84de1b2ca444acef98975874f52e3ba2f355f923.1619474343.git.sofiax.chuang@intel.com> (raw)
In-Reply-To: <cover.1619474343.git.sofiax.chuang@intel.com>

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         | 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/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..46f502d616
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Include/Library/ReportCpuHobLib.h
@@ -0,0 +1,24 @@
+/** @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
+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/Library/ReportCpuHobLib/ReportCpuHobLib.c b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c
new file mode 100644
index 0000000000..97cacb7110
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.c
@@ -0,0 +1,35 @@
+/** @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>
+
+VOID
+EFIAPI
+ReportCpuHob (
+  VOID
+  )
+{
+  UINT8                         PhysicalAddressBits;
+  UINT32                        RegEax;
+
+  AsmCpuid (CPUID_EXTENDED_FUNCTION, &RegEax, NULL, NULL, NULL);
+  if (RegEax >= CPUID_VIR_PHY_ADDRESS_SIZE) {
+    AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, &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.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


  reply	other threads:[~2021-04-27  9:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 22:01 [edk2-devel][PATCH v3 0/7] Move ReportCpuHobLib from MinPlatformPkg to IntelSiliconPkg sofiax.chuang
2021-04-26 22:01 ` sofiax.chuang [this message]
2021-04-28  9:04   ` [edk2-devel][PATCH v3 1/7] IntelSiliconPkg/ReportCpuHobLib: Add ReportCpuHobLib Ni, Ray
2021-04-26 22:01 ` [edk2-devel][PATCH v3 2/7] CometlakeOpenBoard: Move ReportCpuHob library path sofiax.chuang
2021-04-26 22:01 ` [edk2-devel][PATCH v3 3/7] TigerlakeOpenBoard: " sofiax.chuang
2021-04-28  0:53   ` Heng Luo
2021-04-26 22:01 ` [edk2-devel][PATCH v3 4/7] SimicsOpenBoard: " sofiax.chuang
2021-04-26 22:01 ` [edk2-devel][PATCH v3 5/7] KabylakeOpenBoard: " sofiax.chuang
2021-04-26 22:01 ` [edk2-devel][PATCH v3 6/7] WhiskeylakeOpenBoard: Move " sofiax.chuang
2021-04-26 22:01 ` [edk2-devel][PATCH v3 7/7] MiniPlatformPkg: Move ReportCpuHob " sofiax.chuang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=84de1b2ca444acef98975874f52e3ba2f355f923.1619474343.git.sofiax.chuang@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox