summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2007-10-09 05:42:37 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2007-10-09 05:42:37 +0000
commit36873a61950d71596206567e58a0319e0813d05d (patch)
tree4223cd454829d93715aba6f0136011fc3c55970b
parentf8580e260c206d9299aec8c15cf411c6ceb0c6d0 (diff)
downloadedk2-36873a61950d71596206567e58a0319e0813d05d.zip
edk2-36873a61950d71596206567e58a0319e0813d05d.tar.gz
edk2-36873a61950d71596206567e58a0319e0813d05d.tar.bz2
Fix a bug. FindVariable now search volatile variable first (previously NV variable first) for performance reason. Therefore, RuntimeServiceGetNextVariableName is updated based on this change.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4056 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index 11a36ba..34bc4a8 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -737,6 +737,8 @@ Returns:
//
// 0: Volatile, 1: Non-Volatile
+ // The index and attributes mapping must be kept in this order as RuntimeServiceGetNextVariableName
+ // make use of this mapping to implement search algorithme.
//
VariableStoreHeader[0] = (VARIABLE_STORE_HEADER *) ((UINTN) mVariableModuleGlobal->VariableGlobal.VolatileVariableBase);
VariableStoreHeader[1] = (VARIABLE_STORE_HEADER *) ((UINTN) mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase);
@@ -933,9 +935,9 @@ RuntimeServiceGetNextVariableName (
//
if (Variable.CurrPtr >= Variable.EndPtr || Variable.CurrPtr == NULL) {
Variable.Volatile = (BOOLEAN) (Variable.Volatile ^ ((BOOLEAN) 0x1));
- if (Variable.Volatile) {
- Variable.StartPtr = (VARIABLE_HEADER *) ((UINTN) (mVariableModuleGlobal->VariableGlobal.VolatileVariableBase + sizeof (VARIABLE_STORE_HEADER)));
- Variable.EndPtr = (VARIABLE_HEADER *) GetEndPointer ((VARIABLE_STORE_HEADER *) ((UINTN) mVariableModuleGlobal->VariableGlobal.VolatileVariableBase));
+ if (!Variable.Volatile) {
+ Variable.StartPtr = (VARIABLE_HEADER *) ((UINTN) (mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase + sizeof (VARIABLE_STORE_HEADER)));
+ Variable.EndPtr = (VARIABLE_HEADER *) GetEndPointer ((VARIABLE_STORE_HEADER *) ((UINTN) mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase));
} else {
Status = EFI_NOT_FOUND;
goto Done;