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
This commit is contained in:
klu2 2007-07-06 09:07:47 +00:00
parent 361064ffae
commit 911cad134a
5 changed files with 31 additions and 6 deletions

View File

@ -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

View File

@ -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) {
TempVariableStoreHeader = (UINT64) PcdGet32 (PcdFlashNvStorageVariableBase);
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);
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

View File

@ -82,7 +82,10 @@
DxeServicesTableLib
UefiDriverEntryPoint
PcdLib
HobLib
[Guids]
gEfiFlashMapHobGuid
################################################################################
#

View File

@ -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

View File

@ -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