From: "Oram, Isaac W" <isaac.w.oram@intel.com>
To: devel@edk2.groups.io
Cc: Chasel Chiu <chasel.chiu@intel.com>,
Nate DeSimone <nathaniel.l.desimone@intel.com>,
Liming Gao <gaoliming@byosoft.com.cn>,
Eric Dong <eric.dong@intel.com>
Subject: [edk2-devel][edk2-platforms][PATCH V1 09/11] MinPlatformPkg/SpifvbService: Publish FV based on board request
Date: Fri, 15 Oct 2021 14:25:32 -0700 [thread overview]
Message-ID: <c890835cdadc3054384d8002591a1c6192ea4843.1634331939.git.isaac.w.oram@intel.com> (raw)
In-Reply-To: <cover.1634331939.git.isaac.w.oram@intel.com>
Change MM reporting to use ReportFvLib API ReportMmFv ();
This removed the hardcoded table of FV to publish.
Also removed the unused "default" table.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Isaac Oram <isaac.w.oram@intel.com>
---
Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.c | 16 --------
Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.h | 7 ----
Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.c | 41 ++++++++++++--------
Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf | 1 +
Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.inf | 1 +
5 files changed, 27 insertions(+), 39 deletions(-)
diff --git a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.c b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.c
index 113c749d04..b8a255dbf4 100644
--- a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.c
+++ b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.c
@@ -15,22 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
FVB_GLOBAL mFvbModuleGlobal;
-//
-// This platform driver knows there are multiple FVs on FD.
-// Now we only provide FVs on Variable region and MicorCode region for performance issue.
-//
-FV_INFO mPlatformFvBaseAddress[] = {
- {0, 0}, // {FixedPcdGet32(PcdFlashNvStorageVariableBase), FixedPcdGet32(PcdFlashNvStorageVariableSize)},
- {0, 0}, // {FixedPcdGet32(PcdFlashFvMicrocodeBase), FixedPcdGet32(PcdFlashFvMicrocodeSize)},
- {0, 0}
-};
-
-FV_INFO mPlatformDefaultBaseAddress[] = {
- {0, 0}, // {FixedPcdGet32(PcdFlashNvStorageVariableBase), FixedPcdGet32(PcdFlashNvStorageVariableSize)},
- {0, 0}, // {FixedPcdGet32(PcdFlashFvMicrocodeBase), FixedPcdGet32(PcdFlashFvMicrocodeSize)},
- {0, 0}
-};
-
FV_MEMMAP_DEVICE_PATH mFvMemmapDevicePathTemplate = {
{
{
diff --git a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.h b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.h
index e9d69e9858..d1d61b124f 100644
--- a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.h
+++ b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.h
@@ -71,11 +71,6 @@ typedef struct {
EFI_DEVICE_PATH_PROTOCOL EndDevPath;
} FV_MEMMAP_DEVICE_PATH;
-typedef struct {
- UINT32 FvBase;
- UINT32 FvSize;
-} FV_INFO;
-
//
// Protocol APIs
//
@@ -152,7 +147,5 @@ extern FVB_GLOBAL mFvbModuleGlobal;
extern FV_MEMMAP_DEVICE_PATH mFvMemmapDevicePathTemplate;
extern FV_PIWG_DEVICE_PATH mFvPIWGDevicePathTemplate;
extern EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL mFvbProtocolTemplate;
-extern FV_INFO mPlatformFvBaseAddress[];
-extern FV_INFO mPlatformDefaultBaseAddress[];
#endif
diff --git a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.c b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.c
index 016f19587c..1d8d55b8f2 100644
--- a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.c
+++ b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.c
@@ -11,6 +11,7 @@
#include "SpiFvbServiceCommon.h"
#include <Library/MmServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>
+#include <Library/ReportFvLib.h>
#include <Protocol/SmmFirmwareVolumeBlock.h>
/**
@@ -97,8 +98,12 @@ InstallFvbProtocol (
The function does the necessary initialization work for
Firmware Volume Block Driver.
+ @param VOID
+
+ @retval EFI_SUCCESS The driver initialized successfully.
+ @retval EFI_UNSUPPORTED The driver failed to initialize properly.
**/
-VOID
+EFI_STATUS
FvbInitialize (
VOID
)
@@ -113,15 +118,17 @@ FvbInitialize (
UINT32 MaxLbaSize;
UINT32 BytesWritten;
UINTN BytesErased;
+ FV_INFO *BoardFvInfoTablePtr;
- mPlatformFvBaseAddress[0].FvBase = PcdGet32(PcdFlashNvStorageVariableBase);
- mPlatformFvBaseAddress[0].FvSize = PcdGet32(PcdFlashNvStorageVariableSize);
- mPlatformFvBaseAddress[1].FvBase = PcdGet32(PcdFlashFvMicrocodeBase);
- mPlatformFvBaseAddress[1].FvSize = PcdGet32(PcdFlashFvMicrocodeSize);
- mPlatformDefaultBaseAddress[0].FvBase = PcdGet32(PcdFlashNvStorageVariableBase);
- mPlatformDefaultBaseAddress[0].FvSize = PcdGet32(PcdFlashNvStorageVariableSize);
- mPlatformDefaultBaseAddress[1].FvBase = PcdGet32(PcdFlashFvMicrocodeBase);
- mPlatformDefaultBaseAddress[1].FvSize = PcdGet32(PcdFlashFvMicrocodeSize);
+ //
+ // Retrieve the FV Info from the board library
+ //
+ BoardFvInfoTablePtr = NULL;
+ ReportMmFv (&BoardFvInfoTablePtr);
+ if (!BoardFvInfoTablePtr) {
+ ASSERT (BoardFvInfoTablePtr != NULL);
+ return EFI_UNSUPPORTED;
+ }
//
// We will only continue with FVB installation if the
@@ -132,11 +139,11 @@ FvbInitialize (
// Make sure all FVB are valid and/or fix if possible
//
for (Idx = 0;; Idx++) {
- if (mPlatformFvBaseAddress[Idx].FvSize == 0 && mPlatformFvBaseAddress[Idx].FvBase == 0) {
+ if (BoardFvInfoTablePtr[Idx].FvSize == 0 && BoardFvInfoTablePtr[Idx].FvBase == 0) {
break;
}
- BaseAddress = mPlatformFvBaseAddress[Idx].FvBase;
+ BaseAddress = BoardFvInfoTablePtr[Idx].FvBase;
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
if (!IsFvHeaderValid (BaseAddress, FvHeader)) {
@@ -192,10 +199,10 @@ FvbInitialize (
//
BufferSize = 0;
for (Idx = 0; ; Idx++) {
- if (mPlatformFvBaseAddress[Idx].FvSize == 0 && mPlatformFvBaseAddress[Idx].FvBase == 0) {
+ if (BoardFvInfoTablePtr[Idx].FvSize == 0 && BoardFvInfoTablePtr[Idx].FvBase == 0) {
break;
}
- BaseAddress = mPlatformFvBaseAddress[Idx].FvBase;
+ BaseAddress = BoardFvInfoTablePtr[Idx].FvBase;
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
if (!IsFvHeaderValid (BaseAddress, FvHeader)) {
@@ -212,7 +219,7 @@ FvbInitialize (
mFvbModuleGlobal.FvbInstance = (EFI_FVB_INSTANCE *) AllocateRuntimeZeroPool (BufferSize);
if (mFvbModuleGlobal.FvbInstance == NULL) {
ASSERT (FALSE);
- return;
+ return EFI_SUCCESS;
}
MaxLbaSize = 0;
@@ -220,10 +227,10 @@ FvbInitialize (
mFvbModuleGlobal.NumFv = 0;
for (Idx = 0; ; Idx++) {
- if (mPlatformFvBaseAddress[Idx].FvSize == 0 && mPlatformFvBaseAddress[Idx].FvBase == 0) {
+ if (BoardFvInfoTablePtr[Idx].FvSize == 0 && BoardFvInfoTablePtr[Idx].FvBase == 0) {
break;
}
- BaseAddress = mPlatformFvBaseAddress[Idx].FvBase;
+ BaseAddress = BoardFvInfoTablePtr[Idx].FvBase;
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
if (!IsFvHeaderValid (BaseAddress, FvHeader)) {
@@ -268,4 +275,6 @@ FvbInitialize (
}
}
+
+ return EFI_SUCCESS;
}
diff --git a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf
index 10e51e1175..7b69bedcdc 100644
--- a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf
+++ b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf
@@ -34,6 +34,7 @@
UefiDriverEntryPoint
SpiFlashCommonLib
MmServicesTableLib
+ ReportFvLib
[Packages]
MdePkg/MdePkg.dec
diff --git a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.inf b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.inf
index 9f08d3673f..1dfb2520e7 100644
--- a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.inf
+++ b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.inf
@@ -33,6 +33,7 @@
MmServicesTableLib
SpiFlashCommonLib
StandaloneMmDriverEntryPoint
+ ReportFvLib
[Packages]
MdePkg/MdePkg.dec
--
2.27.0.windows.1
next prev 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 ` [edk2-devel][edk2-platforms][PATCH V1 06/11] WhitleyOpenBoardPkg/ReportFvLib: Add board support for custom MM FV Oram, Isaac W
2021-10-23 0:31 ` 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 ` Oram, Isaac W [this message]
2021-10-23 0:31 ` [edk2-devel][edk2-platforms][PATCH V1 09/11] MinPlatformPkg/SpifvbService: Publish FV based on board request 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=c890835cdadc3054384d8002591a1c6192ea4843.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