public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch V2] MinPlatformPkg/PlatformInitPei: Create Library Instance of ReportCpuHobLib.
@ 2020-04-14 14:49 Kumar, Chandana C
  2020-04-15  6:18 ` Chiu, Chasel
  0 siblings, 1 reply; 2+ messages in thread
From: Kumar, Chandana C @ 2020-04-14 14:49 UTC (permalink / raw)
  To: devel; +Cc: Sai Chaganty, Chasel Chiu, Nate DeSimone

Create an Library instance of ReportCpuHobLib from PlatformInitPei driver,

so that from platform side reporting Physical address bits can be overriden.

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

Signed-off-by: Chandana Kumar <chandana.c.kumar@intel.com>

Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>

Cc: Chasel Chiu <chasel.chiu@intel.com>

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
 0001-MinPlatformPkg-PlatformInitPei-Create-an-Library-Ins.patch                        | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h                        |  23 +++++++++++++++++++++++
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc                                       |   3 ++-
 Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c   |  32 ++++++++++++++++++++++++++++++++
 Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf |  27 +++++++++++++++++++++++++++
 Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c        |  25 ++-----------------------
 6 files changed, 253 insertions(+), 24 deletions(-)

diff --git a/0001-MinPlatformPkg-PlatformInitPei-Create-an-Library-Ins.patch b/0001-MinPlatformPkg-PlatformInitPei-Create-an-Library-Ins.patch
new file mode 100644
index 0000000000..6df277b8e7
--- /dev/null
+++ b/0001-MinPlatformPkg-PlatformInitPei-Create-an-Library-Ins.patch
@@ -0,0 +1,167 @@
+From 987a6ff35c4e415593e0441d86b6dab6cc5d4f5d Mon Sep 17 00:00:00 2001
+From: Chandana Kumar <chandana.c.kumar@intel.com>
+Date: Tue, 14 Apr 2020 16:57:23 +0530
+Subject: [Patch V1] MinPlatformPkg/PlatformInitPei: Create Library Instance of ReportCpuHobLib.
+
+REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2674
+
+Create an Library instance of ReportCpuHobLib from PlatformInitPei driver, 
+so that from platform side reporting Physical address bits can be overriden.
+
+Signed-off-by: Chandana Kumar <chandana.c.kumar@intel.com>
+Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
+Cc: Chasel Chiu <chasel.chiu@intel.com>
+Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
+---
+ Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc                                       |  3 ++-
+ Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c   | 32 ++++++++++++++++++++++++++++++++
+ Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf | 27 +++++++++++++++++++++++++++
+ Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c        | 25 ++-----------------------
+ 4 files changed, 63 insertions(+), 24 deletions(-)
+
+diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+index 13a0fda272..b62351dac6 100644
+--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
++++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+@@ -1,7 +1,7 @@
+ ## @file
+ #  Platform description.
+ #
+-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
++# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.<BR>
+ #
+ # SPDX-License-Identifier: BSD-2-Clause-Patent
+ #
+@@ -92,6 +92,7 @@
+   #
+   FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPlatformLib/PeiFspWrapperPlatformLib.inf
+   ReportFvLib|MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
++  ReportCpuHobLib|MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
+   TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
+   TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf
+   SetCacheMtrrLib|MinPlatformPkg/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
+diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
+new file mode 100644
+index 0000000000..b20b8c61a9
+--- /dev/null
++++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
+@@ -0,0 +1,32 @@
++/** @file
++  Source code file for Report CPU HOB library.
++
++Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
++SPDX-License-Identifier: BSD-2-Clause-Patent
++
++**/
++
++#include <Base.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);
++}
+\ No newline at end of file
+diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
+new file mode 100644
+index 0000000000..ae6ec901a1
+--- /dev/null
++++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
+@@ -0,0 +1,27 @@
++### @file
++# Component information file for the Report CPU HOB library.
++#
++# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
++#
++# SPDX-License-Identifier: BSD-2-Clause-Patent
++#
++###
++
++[Defines]
++  INF_VERSION                    = 0x00010005
++  BASE_NAME                      = ReportCpuHobLib
++  FILE_GUID                      = F19AA754-CE24-448D-B755-1F939B00C25D
++  VERSION_STRING                 = 1.0
++  MODULE_TYPE                    = BASE
++  LIBRARY_CLASS                  = ReportCpuHobLib
++
++[LibraryClasses]
++  BaseLib
++  HobLib
++
++[Packages]
++  MdePkg/MdePkg.dec
++  MinPlatformPkg/MinPlatformPkg.dec
++
++[Sources]
++  PeiReportFvLib.c
+diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
+index efdeb6a91c..48cbe0dfbe 100644
+--- a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
++++ b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
+@@ -1,7 +1,7 @@
+ /** @file
+   Source code file for Platform Init Pre-Memory PEI module
+ 
+-Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
++Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+ 
+ **/
+@@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
+ #include <Library/BoardInitLib.h>
+ #include <Library/TestPointCheckLib.h>
+ #include <Library/SetCacheMtrrLib.h>
++#include <Library/ReportCpuHobLib.h>
+ #include <Guid/MemoryTypeInformation.h>
+ #include <Ppi/PlatformMemorySize.h>
+ #include <Ppi/BaseMemoryTest.h>
+@@ -355,28 +356,6 @@ Done:
+   return EFI_SUCCESS;
+ }
+ 
+-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);
+-}
+-
+ /**
+   Install Firmware Volume Hob's once there is main memory
+ 
+-- 
+2.16.2.windows.1
+
diff --git a/Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h b/Platform/Intel/MinPlatformPkg/Include/Library/ReportCpuHobLib.h
new file mode 100644
index 0000000000..1b023007ca
--- /dev/null
+++ b/Platform/Intel/MinPlatformPkg/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) 2020, 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
\ No newline at end of file
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 13a0fda272..b62351dac6 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Platform description.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.<BR>
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -92,6 +92,7 @@
   #
   FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPlatformLib/PeiFspWrapperPlatformLib.inf
   ReportFvLib|MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  ReportCpuHobLib|MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
   TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf
   SetCacheMtrrLib|MinPlatformPkg/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
new file mode 100644
index 0000000000..b20b8c61a9
--- /dev/null
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
@@ -0,0 +1,32 @@
+/** @file
+  Source code file for Report CPU HOB library.
+
+Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.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);
+}
\ No newline at end of file
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
new file mode 100644
index 0000000000..ae6ec901a1
--- /dev/null
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
@@ -0,0 +1,27 @@
+### @file
+# Component information file for the Report CPU HOB library.
+#
+# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = ReportCpuHobLib
+  FILE_GUID                      = F19AA754-CE24-448D-B755-1F939B00C25D
+  VERSION_STRING                 = 1.0
+  MODULE_TYPE                    = BASE
+  LIBRARY_CLASS                  = ReportCpuHobLib
+
+[LibraryClasses]
+  BaseLib
+  HobLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MinPlatformPkg/MinPlatformPkg.dec
+
+[Sources]
+  PeiReportFvLib.c
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
index efdeb6a91c..48cbe0dfbe 100644
--- a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
@@ -1,7 +1,7 @@
 /** @file
   Source code file for Platform Init Pre-Memory PEI module
 
-Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/BoardInitLib.h>
 #include <Library/TestPointCheckLib.h>
 #include <Library/SetCacheMtrrLib.h>
+#include <Library/ReportCpuHobLib.h>
 #include <Guid/MemoryTypeInformation.h>
 #include <Ppi/PlatformMemorySize.h>
 #include <Ppi/BaseMemoryTest.h>
@@ -355,28 +356,6 @@ Done:
   return EFI_SUCCESS;
 }
 
-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);
-}
-
 /**
   Install Firmware Volume Hob's once there is main memory
 
-- 
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-15  6:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-14 14:49 [Patch V2] MinPlatformPkg/PlatformInitPei: Create Library Instance of ReportCpuHobLib Kumar, Chandana C
2020-04-15  6:18 ` Chiu, Chasel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox