diff options
-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 | ||||
-rw-r--r-- | Nt32Pkg/Nt32Pkg.dsc | 2 | ||||
-rw-r--r-- | Nt32Pkg/Nt32Pkg.fdf | 2 |
5 files changed, 31 insertions, 6 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
################################################################################
#
diff --git a/Nt32Pkg/Nt32Pkg.dsc b/Nt32Pkg/Nt32Pkg.dsc index 716a80e158..5943ba47a8 100644 --- a/Nt32Pkg/Nt32Pkg.dsc +++ b/Nt32Pkg/Nt32Pkg.dsc @@ -349,6 +349,7 @@ [Components.IA32]
$(WORKSPACE)/Nt32Pkg/BootModePei/BootMode.inf
$(WORKSPACE)/Nt32Pkg/WinNtThunkDxe/WinNtThunk.inf
+ $(WORKSPACE)/MdeModulePkg/Universal/RuntimeDxe/Runtime.inf
$(WORKSPACE)/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriver.inf
$(WORKSPACE)/Nt32Pkg/WinNtThunkPPIToProtocolPei/WinNtThunkPPIToProtocol.inf
$(WORKSPACE)/Nt32Pkg/WinNtAutoScanPei/WinNtAutoScan.inf
@@ -373,7 +374,6 @@ $(WORKSPACE)/MdeModulePkg/Universal/Capsule/RuntimeDxe/CapsuleRuntime.inf
$(WORKSPACE)/MdeModulePkg/Universal/Ebc/Dxe/Ebc.inf
$(WORKSPACE)/MdeModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.inf
- $(WORKSPACE)/MdeModulePkg/Universal/RuntimeDxe/Runtime.inf
$(WORKSPACE)/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.inf
$(WORKSPACE)/MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.inf
$(WORKSPACE)/MdeModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.inf
diff --git a/Nt32Pkg/Nt32Pkg.fdf b/Nt32Pkg/Nt32Pkg.fdf index 09e9ce845b..ec0469990f 100644 --- a/Nt32Pkg/Nt32Pkg.fdf +++ b/Nt32Pkg/Nt32Pkg.fdf @@ -111,6 +111,7 @@ READ_LOCK_STATUS = TRUE ################################################################################
INF $(WORKSPACE)/MdeModulePkg/Core/Pei/PeiMain.inf
INF $(WORKSPACE)/MdeModulePkg/Core/Dxe/DxeMain.inf
+INF $(WORKSPACE)/MdeModulePkg/Universal/RuntimeDxe/Runtime.inf
INF $(WORKSPACE)/Nt32Pkg/BootModePei/BootMode.inf
INF $(WORKSPACE)/Nt32Pkg/WinNtThunkDxe/WinNtThunk.inf
#INF $(WORKSPACE)/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriver.inf
@@ -137,7 +138,6 @@ INF $(WORKSPACE)/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.inf INF $(WORKSPACE)/MdeModulePkg/Universal/Capsule/RuntimeDxe/CapsuleRuntime.inf
INF $(WORKSPACE)/MdeModulePkg/Universal/Ebc/Dxe/Ebc.inf
INF $(WORKSPACE)/MdeModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.inf
-INF $(WORKSPACE)/MdeModulePkg/Universal/RuntimeDxe/Runtime.inf
INF $(WORKSPACE)/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.inf
INF $(WORKSPACE)/MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.inf
INF $(WORKSPACE)/MdeModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.inf
|