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.desim...@intel.com> Cc: Chasel Chiu <chasel.c...@intel.com> Signed-off-by: Isaac Oram <isaac.w.o...@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 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#82162): https://edk2.groups.io/g/devel/message/82162 Mute This Topic: https://groups.io/mt/86360114/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-