diff options
author | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-07-06 09:07:47 +0000 |
---|---|---|
committer | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-07-06 09:07:47 +0000 |
commit | 911cad134a5072018dc14a1d92714ae22389ba71 (patch) | |
tree | bbc00a54e2b015701edac58b6ef9bfccd094320c /MdeModulePkg/Universal | |
parent | 361064ffaed4d2e4f3c962dba01a25a877e5a146 (diff) | |
download | edk2-platforms-911cad134a5072018dc14a1d92714ae22389ba71.tar.xz |
Use Hob to get the variable base address in NV storage, but this need to be changed as use PCD when build tool is ready
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3111 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r-- | MdeModulePkg/Universal/VariableRuntimeDxe/CommonHeader.h | 4 | ||||
-rw-r--r-- | MdeModulePkg/Universal/VariableRuntimeDxe/Variable.c | 26 | ||||
-rw-r--r-- | MdeModulePkg/Universal/VariableRuntimeDxe/Variable.inf | 3 |
3 files changed, 29 insertions, 4 deletions
diff --git a/MdeModulePkg/Universal/VariableRuntimeDxe/CommonHeader.h b/MdeModulePkg/Universal/VariableRuntimeDxe/CommonHeader.h index 7148577aab..2cb78e7d63 100644 --- a/MdeModulePkg/Universal/VariableRuntimeDxe/CommonHeader.h +++ b/MdeModulePkg/Universal/VariableRuntimeDxe/CommonHeader.h @@ -43,6 +43,8 @@ #include <Library/UefiLib.h>
#include <Library/BaseLib.h>
#include <Library/MemoryAllocationLib.h>
-
+#include <Library/HobLib.h>
+#include <Common/FlashMap.h>
+#include <Guid/FlashMapHob.h>
#endif
diff --git a/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.c b/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.c index 4322961630..6f663d4fe1 100644 --- a/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.c @@ -1299,13 +1299,15 @@ Returns: EFI_PHYSICAL_ADDRESS FvVolHdr;
UINT64 TempVariableStoreHeader;
-
+ UINT64 TempVariableStoreLen;
EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor;
EFI_FLASH_SUBAREA_ENTRY VariableStoreEntry;
UINT64 BaseAddress;
UINT64 Length;
UINTN Index;
UINT8 Data;
+ EFI_PEI_HOB_POINTERS FvHob;
+ EFI_FLASH_MAP_ENTRY_DATA *FlashMapEntry;
mVariableModuleGlobal = AllocateRuntimePool (sizeof (ESAL_VARIABLE_GLOBAL));
if (mVariableModuleGlobal == NULL) {
@@ -1341,11 +1343,29 @@ Returns: //
// Get non volatile varaible store
//
+ // BUGBUG: Here should use dynamic PCD to get NvStorageVariableBase when build tools is ready.
+ TempVariableStoreHeader = 0;
+ TempVariableStoreLen = 0;
+ FvHob.Raw = GetHobList ();
+ while ((FvHob.Raw = GetNextGuidHob (&gEfiFlashMapHobGuid, FvHob.Raw)) != NULL) {
+
+ FlashMapEntry = (EFI_FLASH_MAP_ENTRY_DATA *) GET_GUID_HOB_DATA (FvHob.Guid);
+
+ //
+ // Get the FTW work space Flash Map SUB area
+ //
+ if ((FlashMapEntry->AreaType == EFI_FLASH_AREA_EFI_VARIABLES) && (FlashMapEntry->NumEntries == 1)) {
+ TempVariableStoreHeader = FlashMapEntry->Entries[0].Base;
+ TempVariableStoreLen = FlashMapEntry->Entries[0].Length;
+ }
+ FvHob.Raw = GET_NEXT_HOB (FvHob);
+ }
+ ASSERT ((TempVariableStoreHeader != 0) && (TempVariableStoreLen != 0));
- TempVariableStoreHeader = (UINT64) PcdGet32 (PcdFlashNvStorageVariableBase);
+ //TempVariableStoreHeader = (UINT64) PcdGet32 (PcdFlashNvStorageVariableBase);
VariableStoreEntry.Base = TempVariableStoreHeader + \
(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (TempVariableStoreHeader)) -> HeaderLength);
- VariableStoreEntry.Length = (UINT64) PcdGet32 (PcdFlashNvStorageVariableSize) - \
+ VariableStoreEntry.Length = TempVariableStoreLen - \
(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (TempVariableStoreHeader)) -> HeaderLength);
//
// Mark the variable storage region of the FLASH as RUNTIME
diff --git a/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.inf b/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.inf index 8236cd9cd8..5765c26f21 100644 --- a/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.inf +++ b/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.inf @@ -82,7 +82,10 @@ DxeServicesTableLib
UefiDriverEntryPoint
PcdLib
+ HobLib
+[Guids]
+ gEfiFlashMapHobGuid
################################################################################
#
|