From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.3341.1634333146761283299 for ; Fri, 15 Oct 2021 14:25:46 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: isaac.w.oram@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10138"; a="314187520" X-IronPort-AV: E=Sophos;i="5.85,376,1624345200"; d="scan'208";a="314187520" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2021 14:25:45 -0700 X-IronPort-AV: E=Sophos;i="5.85,376,1624345200"; d="scan'208";a="492709798" Received: from iworam-desk.amr.corp.intel.com ([10.7.150.79]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2021 14:25:44 -0700 From: "Oram, Isaac W" To: devel@edk2.groups.io Cc: Nate DeSimone , Chasel Chiu 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 Message-Id: <7ce8f0000930c73af87aaf34af21dc798f2f670a.1634331939.git.isaac.w.oram@intel.com> X-Mailer: git-send-email 2.27.0.windows.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Cc: Chasel Chiu Signed-off-by: Isaac Oram --- 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.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include + +// +// 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.
+# +# 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.
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