public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Oram, Isaac W" <isaac.w.oram@intel.com>
To: devel@edk2.groups.io
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Chasel Chiu <chasel.chiu@intel.com>
Subject: [edk2-devel][edk2-platforms][PATCH V1 06/11] WhitleyOpenBoardPkg/ReportFvLib: Add board support for custom MM FV
Date: Fri, 15 Oct 2021 14:25:29 -0700	[thread overview]
Message-ID: <7ce8f0000930c73af87aaf34af21dc798f2f670a.1634331939.git.isaac.w.oram@intel.com> (raw)
In-Reply-To: <cover.1634331939.git.isaac.w.oram@intel.com>

ReportFvLib added a new fuction for boards to communicate MM required FV
The custom instance allows Whitley boards to publish an FV for WHEA use.
Also fixed duplicate GUID library name.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Signed-off-by: Isaac Oram <isaac.w.oram@intel.com>
---
 Platform/Intel/WhitleyOpenBoardPkg/Library/ReportFvLib/ReportFvLibMm.c                                           | 61 ++++++++++++++++++++
 Platform/Intel/WhitleyOpenBoardPkg/Library/ReportFvLib/ReportFvLibMm.inf                                         | 36 ++++++++++++
 Platform/Intel/WhitleyOpenBoardPkg/Library/{PeiReportFvLib/PeiReportFvLib.c => ReportFvLib/ReportFvLibPei.c}     |  4 +-
 Platform/Intel/WhitleyOpenBoardPkg/Library/{PeiReportFvLib/PeiReportFvLib.inf => ReportFvLib/ReportFvLibPei.inf} | 12 ++--
 Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc                                                               |  4 +-
 5 files changed, 110 insertions(+), 7 deletions(-)

diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Library/ReportFvLib/ReportFvLibMm.c b/Platform/Intel/WhitleyOpenBoardPkg/Library/ReportFvLib/ReportFvLibMm.c
new file mode 100644
index 0000000000..0cae9a7b25
--- /dev/null
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Library/ReportFvLib/ReportFvLibMm.c
@@ -0,0 +1,61 @@
+/** @file ReportFvLib.c
+  Source code file for Report Firmware Volume (FV) library management mode functionality
+
+  ReportPreMemFv (); is not supported by this libary instance
+  ReportPostMemFv (); is not supported by this libary instance
+
+  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <Base.h>
+#include <Library/DebugLib.h>
+#include <Library/ReportFvLib.h>
+#include <Guid/FirmwareFileSystem2.h>
+#include <Ppi/FirmwareVolumeInfo2.h>
+
+//
+// This platform driver knows there are multiple FVs on FD.
+//  Variable region and MicroCode region are required.
+//  WHEA region is optional.  If size is zero this will not be published.
+//
+FV_INFO mBoardFvInfoTable[] = {
+  {0, 0}, // {PcdGet32 (PcdFlashNvStorageVariableBase), PcdGet32 (PcdFlashNvStorageVariableSize)},
+  {0, 0}, // {PcdGet32 (PcdFlashFvMicrocodeBase), PcdGet32 (PcdFlashFvMicrocodeSize)},
+  {0, 0}, // {PcdGet32 (PcdFlashFvWheaBase), PcdGet32 (PcdFlashFvWheaSize)},
+  {0, 0}
+};
+
+/*
+  Return the firmware volumes that are needed for MM functionality.
+  NV storage and microcode FV are required.
+  WHEA FV is optional and only added if Base and Size are non-zero.
+
+  @param FvInfoTable    Pointer to table of FV to be published
+
+  @return VOID
+*/
+VOID
+ReportMmFv (
+  FV_INFO **FvInfoTable
+  )
+{
+  mBoardFvInfoTable[0].FvBase = PcdGet32 (PcdFlashNvStorageVariableBase);
+  mBoardFvInfoTable[0].FvSize = PcdGet32 (PcdFlashNvStorageVariableSize);
+  mBoardFvInfoTable[1].FvBase = PcdGet32 (PcdFlashFvMicrocodeBase);
+  mBoardFvInfoTable[1].FvSize = PcdGet32 (PcdFlashFvMicrocodeSize);
+
+  if ((PcdGet32 (PcdFlashFvWheaBase) != 0) && (PcdGet32 (PcdFlashFvWheaSize) != 0)) {
+    mBoardFvInfoTable[2].FvBase = PcdGet32 (PcdFlashFvWheaBase);
+    mBoardFvInfoTable[2].FvSize = PcdGet32 (PcdFlashFvWheaSize);
+  }
+
+  DEBUG ((DEBUG_INFO, "MM FvInfo Table:\nNvStorageVariableBase 0x%X\nMicrocodeBase 0x%X\nWheaBase 0x%X\n", mBoardFvInfoTable[0].FvBase, mBoardFvInfoTable[1].FvBase, mBoardFvInfoTable[2].FvBase));
+  ASSERT (mBoardFvInfoTable[0].FvBase != 0);
+  ASSERT (mBoardFvInfoTable[0].FvSize != 0);
+  ASSERT (mBoardFvInfoTable[1].FvBase != 0);
+  ASSERT (mBoardFvInfoTable[1].FvSize != 0);
+
+  *FvInfoTable = &mBoardFvInfoTable[0];
+}
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Library/ReportFvLib/ReportFvLibMm.inf b/Platform/Intel/WhitleyOpenBoardPkg/Library/ReportFvLib/ReportFvLibMm.inf
new file mode 100644
index 0000000000..b37da2ab4b
--- /dev/null
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Library/ReportFvLib/ReportFvLibMm.inf
@@ -0,0 +1,36 @@
+### @file
+# Component information file for the Report Firmware Volume (FV) library.
+#
+# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+  INF_VERSION                    = 0x00010017
+  BASE_NAME                      = ReportFvLibMm
+  FILE_GUID                      = 0fcf4819-09e4-43fb-b597-4db80df14d88
+  VERSION_STRING                 = 1.0
+  MODULE_TYPE                    = BASE
+  LIBRARY_CLASS                  = ReportFvLib | DXE_SMM_DRIVER MM_STANDALONE
+
+[LibraryClasses]
+  DebugLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MinPlatformPkg/MinPlatformPkg.dec
+  WhitleyOpenBoardPkg/PlatformPkg.dec
+
+[Sources]
+  ReportFvLibMm.c
+
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase    ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize    ## CONSUMES
+  gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeBase           ## CONSUMES
+  gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeSize           ## CONSUMES
+  gCpPlatFlashTokenSpaceGuid.PcdFlashFvWheaBase                   ## CONSUMES
+  gCpPlatFlashTokenSpaceGuid.PcdFlashFvWheaSize                   ## CONSUMES
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.c b/Platform/Intel/WhitleyOpenBoardPkg/Library/ReportFvLib/ReportFvLibPei.c
similarity index 96%
rename from Platform/Intel/WhitleyOpenBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.c
rename to Platform/Intel/WhitleyOpenBoardPkg/Library/ReportFvLib/ReportFvLibPei.c
index f0230642d2..f916b352e5 100644
--- a/Platform/Intel/WhitleyOpenBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.c
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Library/ReportFvLib/ReportFvLibPei.c
@@ -1,6 +1,8 @@
-/** @file PeiReportFvLib.c
+/** @file ReportFvLib.c
   Source code file for Report Firmware Volume (FV) library
 
+  ReportMmFv (); is not supported in this library instance
+
   Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.inf b/Platform/Intel/WhitleyOpenBoardPkg/Library/ReportFvLib/ReportFvLibPei.inf
similarity index 87%
rename from Platform/Intel/WhitleyOpenBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.inf
rename to Platform/Intel/WhitleyOpenBoardPkg/Library/ReportFvLib/ReportFvLibPei.inf
index b02fac49cf..ae77606a54 100644
--- a/Platform/Intel/WhitleyOpenBoardPkg/Library/PeiReportFvLib/PeiReportFvLib.inf
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Library/ReportFvLib/ReportFvLibPei.inf
@@ -9,11 +9,11 @@
 
 [Defines]
   INF_VERSION                    = 0x00010017
-  BASE_NAME                      = PeiReportFvLib
-  FILE_GUID                      = 44328FA5-E4DD-4A15-ABDF-C6584AC363D9
+  BASE_NAME                      = ReportFvLibPei
+  FILE_GUID                      = 8b176722-93a6-4b0a-a297-3d3b6c3c7034
   VERSION_STRING                 = 1.0
   MODULE_TYPE                    = PEIM
-  LIBRARY_CLASS                  = ReportFvLib
+  LIBRARY_CLASS                  = ReportFvLib | PEIM
 
 [LibraryClasses]
   BaseMemoryLib
@@ -28,7 +28,7 @@
   WhitleyOpenBoardPkg/PlatformPkg.dec
 
 [Sources]
-  PeiReportFvLib.c
+  ReportFvLibPei.c
 
 [Pcd]
   gMinPlatformPkgTokenSpaceGuid.PcdBootStage                      ## CONSUMES
@@ -62,4 +62,6 @@
   gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspPreMemoryOffset      ## CONSUMES
   gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspSize                 ## CONSUMES
   gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspBase                 ## CONSUMES
-  gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspOffset               ## CONSUMES
\ No newline at end of file
+  gMinPlatformPkgTokenSpaceGuid.PcdFlashFvBspOffset               ## CONSUMES
+  gCpPlatFlashTokenSpaceGuid.PcdFlashFvWheaBase                   ## CONSUMES
+  gCpPlatFlashTokenSpaceGuid.PcdFlashFvWheaSize                   ## CONSUMES
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc b/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
index b3e96ecf3f..7d5f9e6883 100644
--- a/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
+++ b/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
@@ -596,7 +596,7 @@
   TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
   TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf
 
-  ReportFvLib|$(RP_PKG)/Library/PeiReportFvLib/PeiReportFvLib.inf
+  ReportFvLib|$(RP_PKG)/Library/ReportFvLib/ReportFvLibPei.inf
 
 [LibraryClasses.Common.PEIM]
   #
@@ -632,6 +632,8 @@
   TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/SmmTestPointLib.inf
   MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
 
+  ReportFvLib|$(RP_PKG)/Library/ReportFvLib/ReportFvLibMm.inf
+
 [LibraryClasses.Common.SMM_CORE]
   S3BootScriptLib|MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf
 
-- 
2.27.0.windows.1


  parent reply	other threads:[~2021-10-15 21:25 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15 21:25 [edk2-devel][edk2-platforms][PATCH V1 00/11] Enable board customization of SMM FV reporting Oram, Isaac W
2021-10-15 21:25 ` [edk2-devel][edk2-platforms][PATCH V1 01/11] MinPlatformPkg/ReportFvLib: Add ReportMmFv to API Oram, Isaac W
2021-10-23  0:30   ` Nate DeSimone
2021-10-15 21:25 ` [edk2-devel][edk2-platforms][PATCH V1 02/11] CometlakeOpenBoardPkg/ReportFvLib: Switch to new library instances Oram, Isaac W
2021-10-23  0:31   ` Nate DeSimone
2021-10-23  1:32   ` Chaganty, Rangasai V
2021-10-25 19:32   ` Kathappan Esakkithevar
2021-10-15 21:25 ` [edk2-devel][edk2-platforms][PATCH V1 03/11] KabyOpenBoardPkg/ReportFvLib: " Oram, Isaac W
2021-10-23  0:31   ` Nate DeSimone
2021-10-15 21:25 ` [edk2-devel][edk2-platforms][PATCH V1 04/11] TigerLakeOpenBoardPkg/ReportFvLib: " Oram, Isaac W
2021-10-23  0:31   ` Nate DeSimone
2021-10-23  1:31   ` Chaganty, Rangasai V
2021-10-15 21:25 ` [edk2-devel][edk2-platforms][PATCH V1 05/11] WhiskeyLakeOpenBoardPkg/ReportFvLib: " Oram, Isaac W
2021-10-23  0:31   ` Nate DeSimone
2021-10-15 21:25 ` Oram, Isaac W [this message]
2021-10-23  0:31   ` [edk2-devel][edk2-platforms][PATCH V1 06/11] WhitleyOpenBoardPkg/ReportFvLib: Add board support for custom MM FV Nate DeSimone
2021-10-15 21:25 ` [edk2-devel][edk2-platforms][PATCH V1 07/11] PurleyOpenBoardPkg/ReportFvLib: Update ReportFvLib Oram, Isaac W
2021-10-23  0:31   ` Nate DeSimone
2021-10-15 21:25 ` [edk2-devel][edk2-platforms][PATCH V1 08/11] SimicsOpenBoardPkg/ReportFvLib: " Oram, Isaac W
2021-10-23  0:31   ` Nate DeSimone
2021-10-15 21:25 ` [edk2-devel][edk2-platforms][PATCH V1 09/11] MinPlatformPkg/SpifvbService: Publish FV based on board request Oram, Isaac W
2021-10-23  0:31   ` Nate DeSimone
2021-10-15 21:25 ` [edk2-devel][edk2-platforms][PATCH V1 10/11] MinPlatformPkg/SpiFvbService: Reduce duplicate code Oram, Isaac W
2021-10-23  0:32   ` Nate DeSimone
2021-10-15 21:25 ` [edk2-devel][edk2-platforms][PATCH V1 11/11] MinPlatformPkg/ReportFvLib: Remove obsolete PeiReportFvLib instance Oram, Isaac W
2021-10-23  0:32   ` Nate DeSimone
     [not found] ` <16AE5156F40A3986.24927@groups.io>
2021-10-23  1:34   ` [edk2-devel][edk2-platforms][PATCH V1 08/11] SimicsOpenBoardPkg/ReportFvLib: Update ReportFvLib Chaganty, Rangasai V
     [not found] ` <16AE515652C6739A.24927@groups.io>
2021-10-23  1:35   ` [edk2-devel][edk2-platforms][PATCH V1 05/11] WhiskeyLakeOpenBoardPkg/ReportFvLib: Switch to new library instances Chaganty, Rangasai V
     [not found] ` <16AE51563C375254.13161@groups.io>
2021-10-23  1:36   ` [edk2-devel][edk2-platforms][PATCH V1 03/11] KabyOpenBoardPkg/ReportFvLib: " Chaganty, Rangasai V
     [not found] ` <16AE5156E9B772C6.11150@groups.io>
2021-10-23  1:40   ` [edk2-devel][edk2-platforms][PATCH V1 11/11] MinPlatformPkg/ReportFvLib: Remove obsolete PeiReportFvLib instance Chaganty, Rangasai V

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=7ce8f0000930c73af87aaf34af21dc798f2f670a.1634331939.git.isaac.w.oram@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