summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Universal
diff options
context:
space:
mode:
authorxgu3 <xgu3@6f19259b-4bc3-4df7-8a09-765794883524>2006-08-10 12:28:02 +0000
committerxgu3 <xgu3@6f19259b-4bc3-4df7-8a09-765794883524>2006-08-10 12:28:02 +0000
commit202c5d55e5a5a1f065038cda8316ad36293aa6bb (patch)
treebb5348825b30ebfd14566d2d87fc639a9e928c49 /EdkModulePkg/Universal
parent382aab1c37276a1274e62469301ee27374cbd047 (diff)
downloadedk2-platforms-202c5d55e5a5a1f065038cda8316ad36293aa6bb.tar.xz
Modify FtwLite and Variable DXE driver to use PCD instead of FlashMap HOB
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1236 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg/Universal')
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c28
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.msa25
-rw-r--r--EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c38
-rw-r--r--EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.msa21
4 files changed, 58 insertions, 54 deletions
diff --git a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c b/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c
index 0d20e88058..f4c7e9199c 100644
--- a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c
+++ b/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c
@@ -632,10 +632,8 @@ InitializeFtwLite (
UINTN Length;
EFI_STATUS Status;
UINTN Offset;
- EFI_FLASH_MAP_ENTRY_DATA *FlashMapEntry;
EFI_FV_BLOCK_MAP_ENTRY *FvbMapEntry;
UINT32 LbaIndex;
- EFI_PEI_HOB_POINTERS GuidHob;
//
// Allocate Private data of this driver,
@@ -668,29 +666,11 @@ InitializeFtwLite (
FtwLiteDevice->FtwLastRecord = NULL;
- FtwLiteDevice->SpareAreaLength = 0;
- FtwLiteDevice->WorkSpaceLength = 0;
+ FtwLiteDevice->WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageFtwWorkingBase);
+ FtwLiteDevice->WorkSpaceLength = (UINTN) PcdGet32 (PcdFlashNvStorageFtwWorkingSize);
- GuidHob.Raw = GetHobList ();
- while (NULL != (GuidHob.Raw = GetNextGuidHob (&gEfiFlashMapHobGuid, GuidHob.Raw))) {
- FlashMapEntry = (EFI_FLASH_MAP_ENTRY_DATA *) GET_GUID_HOB_DATA (GuidHob.Guid);
- //
- // Get the FTW work space Flash Map SUB area
- //
- if ((FlashMapEntry->AreaType == EFI_FLASH_AREA_FTW_STATE) && (FlashMapEntry->NumEntries == 1)) {
- FtwLiteDevice->WorkSpaceAddress = FlashMapEntry->Entries[0].Base;
- FtwLiteDevice->WorkSpaceLength = (UINTN) FlashMapEntry->Entries[0].Length;
- }
- //
- // Get the FTW backup SUB area
- //
- if ((FlashMapEntry->AreaType == EFI_FLASH_AREA_FTW_BACKUP) && (FlashMapEntry->NumEntries == 1)) {
- FtwLiteDevice->SpareAreaAddress = FlashMapEntry->Entries[0].Base;
- FtwLiteDevice->SpareAreaLength = (UINTN) FlashMapEntry->Entries[0].Length;
- }
-
- GuidHob.Raw = GET_NEXT_HOB (GuidHob);
- }
+ FtwLiteDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageFtwSpareBase);
+ FtwLiteDevice->SpareAreaLength = (UINTN) PcdGet32 (PcdFlashNvStorageFtwSpareSize);
ASSERT ((FtwLiteDevice->WorkSpaceLength != 0) && (FtwLiteDevice->SpareAreaLength != 0));
diff --git a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.msa b/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.msa
index 90f6ad8482..3505b5eef3 100644
--- a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.msa
+++ b/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.msa
@@ -31,6 +31,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
</ModuleDefinitions>
<LibraryClassDefinitions>
<LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>PcdLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DebugLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
@@ -96,4 +99,26 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
<ModuleEntryPoint>InitializeFtwLite</ModuleEntryPoint>
</Extern>
</Externs>
+ <PcdCoded>
+ <PcdEntry PcdItemType="FIXED_AT_BUILD" Usage="ALWAYS_CONSUMED">
+ <C_Name>PcdFlashNvStorageFtwSpareBase</C_Name>
+ <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>To get base address of the FTW spare block section in NV firmware volume.</HelpText>
+ </PcdEntry>
+ <PcdEntry PcdItemType="FIXED_AT_BUILD" Usage="ALWAYS_CONSUMED">
+ <C_Name>PcdFlashNvStorageFtwSpareSize</C_Name>
+ <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>To get size of the FTW spare block section in NV firmware volume.</HelpText>
+ </PcdEntry>
+ <PcdEntry PcdItemType="FIXED_AT_BUILD" Usage="ALWAYS_CONSUMED">
+ <C_Name>PcdFlashNvStorageFtwWorkingBase</C_Name>
+ <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>To get base address of the FTW working block section in NV firmware volume.</HelpText>
+ </PcdEntry>
+ <PcdEntry PcdItemType="FIXED_AT_BUILD" Usage="ALWAYS_CONSUMED">
+ <C_Name>PcdFlashNvStorageFtwWorkingSize</C_Name>
+ <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>To get size of the FTW working block section in NV firmware volume.</HelpText>
+ </PcdEntry>
+ </PcdCoded>
</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index cfd3183f09..3fa16172cc 100644
--- a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -1254,14 +1254,14 @@ Returns:
UINT32 Instance;
EFI_PHYSICAL_ADDRESS FvVolHdr;
- EFI_FLASH_MAP_ENTRY_DATA *FlashMapEntryData;
+ UINT64 TempVariableStoreHeader;
+
EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor;
EFI_FLASH_SUBAREA_ENTRY VariableStoreEntry;
UINT64 BaseAddress;
UINT64 Length;
UINTN Index;
UINT8 Data;
- EFI_PEI_HOB_POINTERS GuidHob;
Status = gBS->AllocatePool (
EfiRuntimeServicesData,
@@ -1305,35 +1305,13 @@ Returns:
// Get non volatile varaible store
//
- FlashMapEntryData = NULL;
-
- GuidHob.Raw = GetHobList ();
- while (NULL != (GuidHob.Raw = GetNextGuidHob (&gEfiFlashMapHobGuid, GuidHob.Raw))) {
- FlashMapEntryData = (EFI_FLASH_MAP_ENTRY_DATA *) GET_GUID_HOB_DATA (GuidHob.Guid);
-
- if (FlashMapEntryData->AreaType == EFI_FLASH_AREA_EFI_VARIABLES) {
- break;
- }
- GuidHob.Raw = GET_NEXT_HOB (GuidHob);
- }
-
- if (NULL == GuidHob.Raw || FlashMapEntryData == NULL) {
- gBS->FreePool (mVariableModuleGlobal);
- gBS->FreePool (VolatileVariableStore);
- return EFI_NOT_FOUND;
- }
-
- //
- // Currently only one non-volatile variable store is supported
- //
- if (FlashMapEntryData->NumEntries != 1) {
- gBS->FreePool (mVariableModuleGlobal);
- gBS->FreePool (VolatileVariableStore);
- return EFI_UNSUPPORTED;
- }
-
- CopyMem (&VariableStoreEntry, &FlashMapEntryData->Entries[0], sizeof (VariableStoreEntry));
+ TempVariableStoreHeader = (UINT64) PcdGet32 (PcdFlashNvStorageVariableBase);
+ VariableStoreEntry.Base = TempVariableStoreHeader + \
+ (((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (TempVariableStoreHeader)) -> HeaderLength);
+ VariableStoreEntry.Length = (UINT64) PcdGet32 (PcdFlashNvStorageVariableSize) - \
+ (((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (TempVariableStoreHeader)) -> HeaderLength);
+ VariableStoreEntry.Length = (UINT64) PcdGet32 (PcdFlashNvStorageVariableSize);
//
// Mark the variable storage region of the FLASH as RUNTIME
//
diff --git a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.msa b/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.msa
index c3f538abe6..049ee3731d 100644
--- a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.msa
+++ b/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.msa
@@ -31,6 +31,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
</ModuleDefinitions>
<LibraryClassDefinitions>
<LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>PcdLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
@@ -150,4 +153,22 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
<SetVirtualAddressMapCallBack>VariableClassAddressChangeEvent</SetVirtualAddressMapCallBack>
</Extern>
</Externs>
+ <PcdCoded>
+ <PcdEntry PcdItemType="DYNAMIC">
+ <C_Name>PcdFlashNvStorageVariableBase</C_Name>
+ <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>
+ The driver gets the Variable store base address from this PCD. This base address point to
+ an EFI_FIRMWARE_VOLUMN_HEADER struct.
+ </HelpText>
+ </PcdEntry>
+ <PcdEntry PcdItemType="DYNAMIC">
+ <C_Name>PcdFlashNvStorageVariableSize</C_Name>
+ <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText>
+ The driver gets the Variable store base address from this PCD. This base address point to
+ an EFI_FIRMWARE_VOLUMN_HEADER struct.
+ </HelpText>
+ </PcdEntry>
+ </PcdCoded>
</ModuleSurfaceArea> \ No newline at end of file