X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EdkModulePkg%2FUniversal%2FVariable%2FPei%2FVariable.c;h=06604195478b1ad29480d0b9754117815f6cccd9;hp=e2f3c4bdddf6d00bd310e90aea7a17bb5a80877d;hb=3aaddf9276ccf00b4b6349dfce058e3ae287dd3a;hpb=1cc8ee7861a59532700a6fd1255689576eda0f52 diff --git a/EdkModulePkg/Universal/Variable/Pei/Variable.c b/EdkModulePkg/Universal/Variable/Pei/Variable.c index e2f3c4bddd..0660419547 100644 --- a/EdkModulePkg/Universal/Variable/Pei/Variable.c +++ b/EdkModulePkg/Universal/Variable/Pei/Variable.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006, Intel Corporation +Copyright (c) 2006 - 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 @@ -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) { @@ -209,7 +208,7 @@ Returns: (((INT32 *) VendorGuid)[2] == ((INT32 *) &Variable->VendorGuid)[2]) && (((INT32 *) VendorGuid)[3] == ((INT32 *) &Variable->VendorGuid)[3]) ) { - if (!StrCmp (VariableName, GET_VARIABLE_NAME_PTR (Variable))) { + if (!CompareMem (VariableName, GET_VARIABLE_NAME_PTR (Variable), Variable->NameSize)) { PtrTrack->CurrPtr = Variable; return EFI_SUCCESS; } @@ -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) {