[edk2-devel] [edk2-platforms: PATCH v2 7/9] WhiskeylakeOpenBoardPkg: Use same variable name for FspNvsHob.
Chiu, Chasel
chasel.chiu at intel.com
Fri Oct 8 05:15:00 UTC 2021
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3678
To simplify the implementation the variable Name/GUID has been
changed to "FspNvsBuffer" and gFspNvsBufferVariableGuid
regardless it stores the data from FSP_NON_VOLATILE_STORAGE_HOB2
or FSP_NON_VOLATILE_STORAGE_HOB.
Cc: Nate DeSimone <nathaniel.l.desimone at intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu at intel.com>
---
Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c | 63 ++++++++++++---------------------------------------------------
Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c | 63 ++++++++++++---------------------------------------------------
Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 5 ++---
Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 4 ++--
Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapInclude.fdf | 18 +++++++++---------
Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc | 3 +++
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc | 3 +++
7 files changed, 43 insertions(+), 116 deletions(-)
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
index a341a58930..ab35bc3f8f 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
@@ -2,7 +2,7 @@
Implementation of Fsp Misc UPD Initialization.
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -17,11 +17,9 @@
#include <FspmUpd.h>
#include <FspsUpd.h>
-#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <Library/DebugPrintErrorLevelLib.h>
#include <Library/PciLib.h>
-#include <Ppi/ReadOnlyVariable2.h>
#include <Guid/MemoryOverwriteControl.h>
#include <PchAccess.h>
@@ -44,55 +42,18 @@ PeiFspMiscUpdUpdatePreMem (
)
{
EFI_STATUS Status;
- EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariableServices;
- UINTN VariableSize;
- VOID *MemorySavedData;
-
- Status = PeiServicesLocatePpi (
- &gEfiPeiReadOnlyVariable2PpiGuid,
- 0,
- NULL,
- (VOID **) &VariableServices
- );
- if (EFI_ERROR (Status)) {
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
-
- VariableSize = 0;
- MemorySavedData = NULL;
- Status = VariableServices->GetVariable (
- VariableServices,
- L"MemoryConfig",
- &gFspNonVolatileStorageHobGuid,
- NULL,
- &VariableSize,
- MemorySavedData
- );
- if (Status == EFI_BUFFER_TOO_SMALL) {
- MemorySavedData = AllocatePool (VariableSize);
- if (MemorySavedData == NULL) {
- ASSERT (MemorySavedData != NULL);
- return EFI_OUT_OF_RESOURCES;
- }
-
- DEBUG ((DEBUG_INFO, "VariableSize is 0x%x\n", VariableSize));
- Status = VariableServices->GetVariable (
- VariableServices,
- L"MemoryConfig",
- &gFspNonVolatileStorageHobGuid,
- NULL,
- &VariableSize,
- MemorySavedData
- );
- if (Status == EFI_SUCCESS) {
- FspmUpd->FspmArchUpd.NvsBufferPtr = MemorySavedData;
- } else {
- DEBUG ((DEBUG_ERROR, "Fail to retrieve Variable:\"MemoryConfig\" gMemoryConfigVariableGuid, Status = %r\n", Status));
- ASSERT_EFI_ERROR (Status);
- }
+ UINTN FspNvsBufferSize;
+ VOID *FspNvsBufferPtr;
+
+ FspNvsBufferPtr = NULL;
+ FspNvsBufferSize = 0;
+ Status = PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferPtr, &FspNvsBufferSize);
+ if (Status == EFI_SUCCESS) {
+ FspmUpd->FspmArchUpd.NvsBufferPtr = FspNvsBufferPtr;
+ } else {
+ DEBUG ((DEBUG_INFO, "Cannot create FSP NVS Buffer, UEFI variable does not exist (this is likely a first boot)\n"));
+ FspmUpd->FspmArchUpd.NvsBufferPtr = NULL;
}
- FspmUpd->FspmArchUpd.NvsBufferPtr = MemorySavedData;
return EFI_SUCCESS;
}
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
index 145deb5de3..381ef232ea 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c
@@ -2,7 +2,7 @@
Implementation of Fsp Misc UPD Initialization.
- Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -18,11 +18,9 @@
#include <FspmUpd.h>
#include <FspsUpd.h>
-#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <Library/DebugPrintErrorLevelLib.h>
#include <Library/PciLib.h>
-#include <Ppi/ReadOnlyVariable2.h>
#include <Guid/MemoryOverwriteControl.h>
#include <PchAccess.h>
#include <Platform.h>
@@ -46,54 +44,17 @@ PeiFspMiscUpdUpdatePreMem (
)
{
EFI_STATUS Status;
- EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariableServices;
- UINTN VariableSize;
- VOID *MemorySavedData;
-
- Status = PeiServicesLocatePpi (
- &gEfiPeiReadOnlyVariable2PpiGuid,
- 0,
- NULL,
- (VOID **) &VariableServices
- );
- if (EFI_ERROR (Status)) {
- ASSERT_EFI_ERROR (Status);
- return Status;
- }
-
- VariableSize = 0;
- MemorySavedData = NULL;
- Status = VariableServices->GetVariable (
- VariableServices,
- L"MemoryConfig",
- &gFspNonVolatileStorageHobGuid,
- NULL,
- &VariableSize,
- MemorySavedData
- );
- if (Status == EFI_BUFFER_TOO_SMALL) {
- MemorySavedData = AllocatePool (VariableSize);
- if (MemorySavedData == NULL) {
- ASSERT (MemorySavedData != NULL);
- return EFI_OUT_OF_RESOURCES;
- }
-
- DEBUG ((DEBUG_INFO, "VariableSize is 0x%x\n", VariableSize));
- Status = VariableServices->GetVariable (
- VariableServices,
- L"MemoryConfig",
- &gFspNonVolatileStorageHobGuid,
- NULL,
- &VariableSize,
- MemorySavedData
- );
- if (Status == EFI_SUCCESS) {
- FspmUpd->FspmArchUpd.NvsBufferPtr = MemorySavedData;
- } else {
- FspmUpd->FspmArchUpd.NvsBufferPtr = NULL;
- DEBUG ((DEBUG_ERROR, "Fail to retrieve Variable:\"MemoryConfig\" gMemoryConfigVariableGuid, Status = %r\n", Status));
- ASSERT_EFI_ERROR (Status);
- }
+ UINTN FspNvsBufferSize;
+ VOID *FspNvsBufferPtr;
+
+ FspNvsBufferPtr = NULL;
+ FspNvsBufferSize = 0;
+ Status = PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferPtr, &FspNvsBufferSize);
+ if (Status == EFI_SUCCESS) {
+ FspmUpd->FspmArchUpd.NvsBufferPtr = FspNvsBufferPtr;
+ } else {
+ DEBUG ((DEBUG_INFO, "Cannot create FSP NVS Buffer, UEFI variable does not exist (this is likely a first boot)\n"));
+ FspmUpd->FspmArchUpd.NvsBufferPtr = NULL;
}
FspmUpd->FspmConfig.TsegSize = FixedPcdGet32 (PcdTsegSize);
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
index 2c90d0cb94..362dc2c995 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
@@ -2,7 +2,7 @@
# Provide FSP wrapper platform related function.
#
#
-# Copyright (c) 2019 - 2020 Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2019 - 2021 Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -82,7 +82,6 @@
PchInfoLib
PchHsioLib
PchPcieRpLib
- MemoryAllocationLib
DebugPrintErrorLevelLib
SiPolicyLib
PchGbeLib
@@ -132,7 +131,7 @@
gWhiskeylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable3
[Guids]
- gFspNonVolatileStorageHobGuid ## CONSUMES
+ gFspNvsBufferVariableGuid ## CONSUMES
gTianoLogoGuid ## CONSUMES
gEfiMemoryOverwriteControlDataGuid
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
index 529c2f1253..1a664b1327 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf
@@ -2,7 +2,7 @@
# FSP silicon policy updates for the Up Xtreme board.
#
#
-# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -136,7 +136,7 @@
gWhiskeylakeOpenBoardPkgTokenSpaceGuid.PcdBoardBomId
[Guids]
- gFspNonVolatileStorageHobGuid ## CONSUMES
+ gFspNvsBufferVariableGuid ## CONSUMES
gTianoLogoGuid ## CONSUMES
gEfiMemoryOverwriteControlDataGuid
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapInclude.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapInclude.fdf
index f7aa730ae7..698efce248 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapInclude.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/Include/Fdf/FlashMapInclude.fdf
@@ -2,7 +2,7 @@
# Flash map for the UpXtreme Board.
#
#
-# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -35,16 +35,16 @@ SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize = 0x00090000
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootOffset = 0x00190000 # Flash addr (0xFFAE0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize = 0x00190000 #
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryOffset = 0x00320000 # Flash addr (0xFFC70000)
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize = 0x00170000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00490000 # Flash addr (0xFFDE0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize = 0x00160000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSOffset = 0x00480000 # Flash addr (0xFFDD0000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize = 0x00070000 #
-SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x00500000 # Flash addr (0xFFE50000)
+SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvOffset = 0x004F0000 # Flash addr (0xFFE40000)
SET gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize = 0x00050000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x00550000 # Flash addr (0xFFEA0000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMOffset = 0x00540000 # Flash addr (0xFFE90000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize = 0x000EA000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x0063A000 # Flash addr (0xFFF8A000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTOffset = 0x0062A000 # Flash addr (0xFFF7A000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize = 0x00006000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset = 0x00640000 # Flash addr (0xFFF90000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemoryOffset = 0x00630000 # Flash addr (0xFFF80000)
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedPreMemorySize = 0x00010000 #
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset = 0x00650000 # Flash addr (0xFFFA0000)
-SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize = 0x00060000 #
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryOffset = 0x00640000 # Flash addr (0xFFF90000)
+SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize = 0x00070000 #
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
index ee2aedd978..9d08dc3fe4 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
@@ -142,6 +142,9 @@
#######################################
PlatformHookLib|$(PROJECT)/Library/BasePlatformHookLib/BasePlatformHookLib.inf
+[LibraryClasses.Common.SEC]
+ VariableReadLib|MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVariableReadLibNull.inf
+
[LibraryClasses.IA32.SEC]
#######################################
# Platform Package
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
index b69cc8deb0..8d25b818ee 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
@@ -142,6 +142,9 @@
#######################################
PlatformHookLib|$(PROJECT)/Library/BasePlatformHookLib/BasePlatformHookLib.inf
+[LibraryClasses.Common.SEC]
+ VariableReadLib|MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVariableReadLibNull.inf
+
[LibraryClasses.IA32.SEC]
#######################################
# Platform Package
--
2.28.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81646): https://edk2.groups.io/g/devel/message/81646
Mute This Topic: https://groups.io/mt/86163907/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list