summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Universal/Variable
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-03-20 02:44:09 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-03-20 02:44:09 +0000
commit3aaddf9276ccf00b4b6349dfce058e3ae287dd3a (patch)
tree3fbec1e869f0667f2bcaea0a17850578d2a28978 /EdkModulePkg/Universal/Variable
parentb06af5d71ec9fc353b9433a26fc55d14077f7cde (diff)
downloadedk2-platforms-3aaddf9276ccf00b4b6349dfce058e3ae287dd3a.tar.xz
1. Removed #ifdef SNP_DEBUG and used debug lib to output information
2. Rename PcdPlatformNoCsmSupport to PcdPlatformCsmSupport. 3 Removed #ifdef EFI_NO_CSM and used PcdPlatformCsmSupport. 4. Removed #ifdef ALIGNMENT from C Variable.c and added 2 files Variable/Pei/Ipf/VariableWorker.c and Variable/Pei/VariableWorker.c git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2487 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg/Universal/Variable')
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/Ipf/VariableWorker.c44
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/Variable.c26
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/Variable.h32
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/Variable.msa4
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/VariableWorker.c44
5 files changed, 120 insertions, 30 deletions
diff --git a/EdkModulePkg/Universal/Variable/Pei/Ipf/VariableWorker.c b/EdkModulePkg/Universal/Variable/Pei/Ipf/VariableWorker.c
new file mode 100644
index 0000000000..302bc14689
--- /dev/null
+++ b/EdkModulePkg/Universal/Variable/Pei/Ipf/VariableWorker.c
@@ -0,0 +1,44 @@
+/*++
+
+Copyright (c) 2007, 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
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ VariableWorker.c
+
+Abstract:
+
+ Framework PEIM to provide the Variable functionality
+
+--*/
+
+#include <Variable.h>
+
+
+VARIABLE_HEADER *
+GetVariableByIndex (
+ IN VARIABLE_INDEX_TABLE *IndexTable,
+ IN UINT32 Count
+ )
+{
+ return (VARIABLE_HEADER *) (UINTN) ((((UINT32)IndexTable->Index[Count]) << 2) + ((UINT32)(UINTN)IndexTable->StartPtr & 0xFFFC0000) );
+}
+
+VOID
+VariableIndexTableUpdate (
+ IN OUT VARIABLE_INDEX_TABLE *IndexTable,
+ IN VARIABLE_HEADER *Variable
+ )
+{
+ IndexTable->Index[IndexTable->Length++] = (UINT16) (((UINT32)(UINTN) Variable) >> 2);
+
+ return;
+}
+
diff --git a/EdkModulePkg/Universal/Variable/Pei/Variable.c b/EdkModulePkg/Universal/Variable/Pei/Variable.c
index 33772f8513..0660419547 100644
--- a/EdkModulePkg/Universal/Variable/Pei/Variable.c
+++ b/EdkModulePkg/Universal/Variable/Pei/Variable.c
@@ -8,7 +8,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
Module Name:
Variable.c
@@ -50,7 +49,7 @@ Routine Description:
Provide the functionality of the variable services.
Arguments:
-
+
FfsHeadher - The FFS file header
PeiServices - General purpose services available to every PEIM.
@@ -192,7 +191,7 @@ Returns:
EFI_SUCCESS - Found match variable
EFI_NOT_FOUND - Variable not found
-
+
--*/
{
if (VariableName[0] == 0) {
@@ -265,7 +264,7 @@ Returns:
// No Variable Address equals zero, so 0 as initial value is safe.
//
MaxIndex = 0;
-
+
GuidHob = GetFirstGuidHob (&gEfiVariableIndexTableGuid);
if (GuidHob == NULL) {
IndexTable = BuildGuidHob (&gEfiVariableIndexTableGuid, sizeof (VARIABLE_INDEX_TABLE));
@@ -277,13 +276,8 @@ Returns:
IndexTable = GET_GUID_HOB_DATA (GuidHob);
for (Count = 0; Count < IndexTable->Length; Count++)
{
-#if ALIGNMENT <= 1
- MaxIndex = (VARIABLE_HEADER *) (UINTN) (IndexTable->Index[Count] + ((UINTN) IndexTable->StartPtr & 0xFFFF0000));
-#else
-#if ALIGNMENT >= 4
- MaxIndex = (VARIABLE_HEADER *) (UINTN) ((((UINT32)IndexTable->Index[Count]) << 2) + ((UINT32)(UINTN)IndexTable->StartPtr & 0xFFFC0000) );
-#endif
-#endif
+ MaxIndex = GetVariableByIndex (IndexTable, Count);
+
if (CompareWithValidVariable (MaxIndex, VariableName, VendorGuid, PtrTrack) == EFI_SUCCESS) {
PtrTrack->StartPtr = IndexTable->StartPtr;
PtrTrack->EndPtr = IndexTable->EndPtr;
@@ -308,7 +302,7 @@ Returns:
VariableBase = (UINT8 *) (UINTN) PcdGet32 (PcdFlashNvStorageVariableBase);
VariableStoreHeader = (VARIABLE_STORE_HEADER *) (VariableBase + \
((EFI_FIRMWARE_VOLUME_HEADER *) (VariableBase)) -> HeaderLength);
-
+
if (GetVariableStoreStatus (VariableStoreHeader) != EfiValid) {
return EFI_UNSUPPORTED;
}
@@ -342,13 +336,7 @@ Returns:
//
if (IndexTable->Length < VARIABLE_INDEX_TABLE_VOLUME)
{
-#if ALIGNMENT <= 1
- IndexTable->Index[IndexTable->Length++] = (UINT16) (UINTN) Variable;
-#else
-#if ALIGNMENT >= 4
- IndexTable->Index[IndexTable->Length++] = (UINT16) (((UINT32)(UINTN) Variable) >> 2);
-#endif
-#endif
+ VariableIndexTableUpdate (IndexTable, Variable);
}
if (CompareWithValidVariable (Variable, VariableName, VendorGuid, PtrTrack) == EFI_SUCCESS) {
diff --git a/EdkModulePkg/Universal/Variable/Pei/Variable.h b/EdkModulePkg/Universal/Variable/Pei/Variable.h
index ac7c579029..d400af4d14 100644
--- a/EdkModulePkg/Universal/Variable/Pei/Variable.h
+++ b/EdkModulePkg/Universal/Variable/Pei/Variable.h
@@ -1,18 +1,18 @@
/*++
-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
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+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
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Variable.h
-
+
Abstract:
Tiano PEIM to provide the variable functionality
@@ -24,7 +24,7 @@ Abstract:
//
// BugBug: We need relcate the head file.
-//
+//
#include <Common/Variable.h>
#include <VarMachine.h>
@@ -150,4 +150,16 @@ Returns:
--*/
;
+VARIABLE_HEADER *
+GetVariableByIndex (
+ IN VARIABLE_INDEX_TABLE *IndexTable,
+ IN UINT32 Count
+ );
+
+VOID
+VariableIndexTableUpdate (
+ IN OUT VARIABLE_INDEX_TABLE *IndexTable,
+ IN VARIABLE_HEADER *Variable
+ );
+
#endif // _PEI_VARIABLE_H
diff --git a/EdkModulePkg/Universal/Variable/Pei/Variable.msa b/EdkModulePkg/Universal/Variable/Pei/Variable.msa
index 0313c2e700..565ae31a13 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"?>
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MsaHeader>
<ModuleName>PeiVariable</ModuleName>
@@ -42,6 +42,8 @@
<Filename>Variable.h</Filename>
<Filename>Variable.c</Filename>
<Filename>Variable.dxs</Filename>
+ <Filename SupArchList="IA32 X64 EBC">VariableWorker.c</Filename>
+ <Filename SupArchList="IPF">Ipf/VariableWorker.c</Filename>
<Filename SupArchList="IA32">Ia32/VarMachine.h</Filename>
<Filename SupArchList="EBC">Ebc/VarMachine.h</Filename>
<Filename SupArchList="X64">x64/VarMachine.h</Filename>
diff --git a/EdkModulePkg/Universal/Variable/Pei/VariableWorker.c b/EdkModulePkg/Universal/Variable/Pei/VariableWorker.c
new file mode 100644
index 0000000000..ae64cb07ca
--- /dev/null
+++ b/EdkModulePkg/Universal/Variable/Pei/VariableWorker.c
@@ -0,0 +1,44 @@
+/*++
+
+Copyright (c) 2007, 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
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ VariableWorker.c
+
+Abstract:
+
+ Framework PEIM to provide the Variable functionality
+
+--*/
+
+#include <Variable.h>
+
+
+VARIABLE_HEADER *
+GetVariableByIndex (
+ IN VARIABLE_INDEX_TABLE *IndexTable,
+ IN UINT32 Count
+ )
+{
+ return (VARIABLE_HEADER *) (UINTN) (IndexTable->Index[Count] + ((UINTN) IndexTable->StartPtr & 0xFFFF0000));
+}
+
+VOID
+VariableIndexTableUpdate (
+ IN OUT VARIABLE_INDEX_TABLE *IndexTable,
+ IN VARIABLE_HEADER *Variable
+ )
+{
+ IndexTable->Index[IndexTable->Length++] = (UINT16) (UINTN) Variable;
+
+ return;
+}
+