From: "Chiu, Chasel" <chasel.chiu@intel.com>
To: devel@edk2.groups.io
Cc: Chasel Chiu <chasel.chiu@intel.com>,
Isaac Oram <isaac.w.oram@intel.com>,
Nate DeSimone <nathaniel.l.desimone@intel.com>
Subject: [edk2-platforms: PATCH 8/9] WhitleyOpenBoardPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
Date: Fri, 8 Oct 2021 10:39:01 +0800 [thread overview]
Message-ID: <20211008023902.1066-9-chasel.chiu@intel.com> (raw)
In-Reply-To: <20211008023902.1066-1-chasel.chiu@intel.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3678
Implementation should search FSP_NON_VOLATILE_STORAGE_HOB2 firstly
and only search FSP_NON_VOLATILE_STORAGE_HOB when former one is not found.
Also added PeiGetLargeVariable () to support the scenarios where the
variable data size is bigger than a single variable size limit.
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
---
Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.c | 29 +++++++++++++++++++++++------
Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.inf | 4 +++-
Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc | 1 +
3 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.c b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.c
index 709c7ad479..ddca492a5a 100644
--- a/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.c
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.c
@@ -7,6 +7,7 @@
**/
#include "S3NvramSave.h"
+#include <Guid/FspNonVolatileStorageHob2.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/LargeVariableReadLib.h>
#include <Library/LargeVariableWriteLib.h>
@@ -80,21 +81,37 @@ SaveFspNonVolatileStorageHob (
Status = EFI_SUCCESS;
DEBUG ((DEBUG_INFO, "Saving FSP / MRC Training Data\n"));
- GuidHob = GetFirstGuidHob (&gFspNonVolatileStorageHobGuid);
+ //
+ // Firstly check version2 FspNvsHob.
+ //
+ GuidHob = GetFirstGuidHob (&gFspNonVolatileStorageHob2Guid);
if (GuidHob != NULL) {
- HobData = GET_GUID_HOB_DATA (GuidHob);
- DataSize = GET_GUID_HOB_DATA_SIZE (GuidHob);
+ HobData = (VOID *) ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN) GuidHob)->NvsDataPtr;
+ DataSize = ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN) GuidHob)->NvsDataLength;
+ } else {
+ //
+ // Fall back to version1 FspNvsHob
+ //
+ GuidHob = GetFirstGuidHob (&gFspNonVolatileStorageHobGuid);
+ if (GuidHob != NULL) {
+ HobData = GET_GUID_HOB_DATA (GuidHob);
+ DataSize = GET_GUID_HOB_DATA_SIZE (GuidHob);
+ }
+ }
+ if (HobData != NULL) {
+ DEBUG ((DEBUG_INFO, "FspNvsHob.Size: %d\n", DataSize));
+ DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataPtr: 0x%x\n", HobData));
if (DataSize > 0) {
//
// Check if the presently saved data is identical to the data given by MRC/FSP
//
- Status = GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageHobGuid, &FspNvsBufferSize, NULL);
+ Status = GetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferSize, NULL);
if (Status == EFI_BUFFER_TOO_SMALL) {
if (FspNvsBufferSize == DataSize) {
VariableData = AllocatePool (FspNvsBufferSize);
if (VariableData != NULL) {
- Status = GetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageHobGuid, &FspNvsBufferSize, VariableData);
+ Status = GetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferSize, VariableData);
if (!EFI_ERROR (Status) && (FspNvsBufferSize == DataSize) && (0 == CompareMem (HobData, VariableData, DataSize))) {
DataIsIdentical = TRUE;
}
@@ -105,7 +122,7 @@ SaveFspNonVolatileStorageHob (
Status = EFI_SUCCESS;
if (!DataIsIdentical) {
- Status = SetLargeVariable (L"FspNvsBuffer", &gFspNonVolatileStorageHobGuid, TRUE, DataSize, HobData);
+ Status = SetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, TRUE, DataSize, HobData);
ASSERT_EFI_ERROR (Status);
DEBUG ((DEBUG_INFO, "Saved size of FSP / MRC Training Data: 0x%x\n", DataSize));
} else {
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.inf b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.inf
index e62baa24c4..a77125cf44 100644
--- a/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.inf
+++ b/Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.inf
@@ -43,7 +43,9 @@
LargeVariableWriteLib
[Guids]
- gFspNonVolatileStorageHobGuid # CONSUMES
+ gFspNonVolatileStorageHobGuid # CONSUMES
+ gFspNonVolatileStorageHob2Guid # CONSUMES
+ gFspNvsBufferVariableGuid # PRODUCES
[Pcd]
gEfiCpRcPkgTokenSpaceGuid.PcdPeiSyshostMemorySize
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc b/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
index dc3dd0e026..87165103bf 100644
--- a/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
+++ b/Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc
@@ -637,6 +637,7 @@
[LibraryClasses.Common]
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+ PeiLib|MinPlatformPkg/Library/PeiLib/PeiLib.inf
[Components.IA32]
UefiCpuPkg/SecCore/SecCore.inf
--
2.28.0.windows.1
next prev parent reply other threads:[~2021-10-08 2:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-08 2:38 [edk2-platforms: PATCH 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2 Chiu, Chasel
2021-10-08 2:38 ` [edk2-platforms: PATCH 1/9] " Chiu, Chasel
2021-10-08 2:38 ` [edk2-platforms: PATCH 2/9] CometlakeOpenBoardPkg: Use same variable name for FspNvsHob Chiu, Chasel
2021-10-08 2:38 ` [edk2-platforms: PATCH 3/9] KabylakeOpenBoardPkg/AspireVn7Dash572G:Use " Chiu, Chasel
2021-10-08 2:38 ` [edk2-platforms: PATCH 4/9] KabylakeOpenBoardPkg/GalagoPro3: Use " Chiu, Chasel
2021-10-08 2:38 ` [edk2-platforms: PATCH 5/9] KabylakeOpenBoardPkg/KabylakeRvp3: " Chiu, Chasel
2021-10-08 2:38 ` [edk2-platforms: PATCH 6/9] TigerlakeOpenBoardPkg: " Chiu, Chasel
2021-10-08 2:39 ` [edk2-platforms: PATCH 7/9] WhiskeylakeOpenBoardPkg: " Chiu, Chasel
2021-10-08 2:39 ` Chiu, Chasel [this message]
2021-10-08 2:39 ` [edk2-platforms: PATCH 9/9] WhitleySiliconPkg: " Chiu, Chasel
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=20211008023902.1066-9-chasel.chiu@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