summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Universal/Variable
diff options
context:
space:
mode:
Diffstat (limited to 'EdkModulePkg/Universal/Variable')
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/Variable.c44
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/Variable.msa15
2 files changed, 19 insertions, 40 deletions
diff --git a/EdkModulePkg/Universal/Variable/Pei/Variable.c b/EdkModulePkg/Universal/Variable/Pei/Variable.c
index 9561ad13d6..f10a96ba2d 100644
--- a/EdkModulePkg/Universal/Variable/Pei/Variable.c
+++ b/EdkModulePkg/Universal/Variable/Pei/Variable.c
@@ -245,18 +245,13 @@ Returns:
--*/
{
- PEI_FLASH_MAP_PPI *FlashMapPpi;
- EFI_FLASH_SUBAREA_ENTRY *VariableStoreEntry;
- UINT32 NumEntries;
EFI_HOB_GUID_TYPE *GuidHob;
VARIABLE_STORE_HEADER *VariableStoreHeader;
VARIABLE_HEADER *Variable;
-
- EFI_STATUS Status;
-
VARIABLE_HEADER *MaxIndex;
VARIABLE_INDEX_TABLE *IndexTable;
UINT32 Count;
+ UINT8 *VariableBase;
if (VariableName != 0 && VendorGuid == NULL) {
return EFI_INVALID_PARAMETER;
@@ -305,39 +300,10 @@ Returns:
if (IndexTable->StartPtr || IndexTable->EndPtr) {
Variable = IndexTable->StartPtr;
} else {
- //
- // Locate FlashMap PPI
- //
- Status = (**PeiServices).LocatePpi (
- PeiServices,
- &gPeiFlashMapPpiGuid,
- 0,
- NULL,
- (VOID **) &FlashMapPpi
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Get flash area info for variables
- //
- Status = FlashMapPpi->GetAreaInfo (
- PeiServices,
- FlashMapPpi,
- EFI_FLASH_AREA_EFI_VARIABLES,
- NULL,
- &NumEntries,
- &VariableStoreEntry
- );
-
- //
- // Currently only one non-volatile variable store is supported
- //
- if (NumEntries != 1) {
- return EFI_UNSUPPORTED;
- }
-
- VariableStoreHeader = (VARIABLE_STORE_HEADER *) (UINTN) (VariableStoreEntry->Base);
-
+ VariableBase = (UINT8 *) (UINTN) PcdGet32 (PcdFlashNvStorageVariableBase);
+ VariableStoreHeader = (VARIABLE_STORE_HEADER *) (VariableBase + \
+ ((EFI_FIRMWARE_VOLUME_HEADER *) (VariableBase)) -> HeaderLength);
+
if (GetVariableStoreStatus (VariableStoreHeader) != EfiValid) {
return EFI_UNSUPPORTED;
}
diff --git a/EdkModulePkg/Universal/Variable/Pei/Variable.msa b/EdkModulePkg/Universal/Variable/Pei/Variable.msa
index f8cf68b6cd..5fa1028d41 100644
--- a/EdkModulePkg/Universal/Variable/Pei/Variable.msa
+++ b/EdkModulePkg/Universal/Variable/Pei/Variable.msa
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -45,6 +45,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>HobLib</Keyword>
</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>PcdLib</Keyword>
+ </LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>Variable.h</Filename>
@@ -74,4 +77,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
<ModuleEntryPoint>PeimInitializeVariableServices</ModuleEntryPoint>
</Extern>
</Externs>
+ <PcdCoded>
+ <PcdEntry PcdItemType="FIXED_AT_BUILD">
+ <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>
+ </PcdCoded>
</ModuleSurfaceArea> \ No newline at end of file