/*++\r
\r
-Copyright (c) 2006, Intel Corporation \r
+Copyright (c) 2006 - 2007 Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
Module Name:\r
\r
Variable.c\r
Provide the functionality of the variable services.\r
\r
Arguments:\r
- \r
+\r
FfsHeadher - The FFS file header\r
PeiServices - General purpose services available to every PEIM.\r
\r
\r
EFI_SUCCESS - Found match variable\r
EFI_NOT_FOUND - Variable not found\r
- \r
+\r
--*/\r
{\r
if (VariableName[0] == 0) {\r
(((INT32 *) VendorGuid)[2] == ((INT32 *) &Variable->VendorGuid)[2]) &&\r
(((INT32 *) VendorGuid)[3] == ((INT32 *) &Variable->VendorGuid)[3])\r
) {\r
- if (!StrCmp (VariableName, GET_VARIABLE_NAME_PTR (Variable))) {\r
+ if (!CompareMem (VariableName, GET_VARIABLE_NAME_PTR (Variable), Variable->NameSize)) {\r
PtrTrack->CurrPtr = Variable;\r
return EFI_SUCCESS;\r
}\r
// No Variable Address equals zero, so 0 as initial value is safe.\r
//\r
MaxIndex = 0;\r
- \r
+\r
GuidHob = GetFirstGuidHob (&gEfiVariableIndexTableGuid);\r
if (GuidHob == NULL) {\r
IndexTable = BuildGuidHob (&gEfiVariableIndexTableGuid, sizeof (VARIABLE_INDEX_TABLE));\r
IndexTable = GET_GUID_HOB_DATA (GuidHob);\r
for (Count = 0; Count < IndexTable->Length; Count++)\r
{\r
-#if ALIGNMENT <= 1\r
- MaxIndex = (VARIABLE_HEADER *) (UINTN) (IndexTable->Index[Count] + ((UINTN) IndexTable->StartPtr & 0xFFFF0000));\r
-#else\r
-#if ALIGNMENT >= 4\r
- MaxIndex = (VARIABLE_HEADER *) (UINTN) ((((UINT32)IndexTable->Index[Count]) << 2) + ((UINT32)(UINTN)IndexTable->StartPtr & 0xFFFC0000) ); \r
-#endif\r
-#endif\r
+ MaxIndex = GetVariableByIndex (IndexTable, Count);\r
+\r
if (CompareWithValidVariable (MaxIndex, VariableName, VendorGuid, PtrTrack) == EFI_SUCCESS) {\r
PtrTrack->StartPtr = IndexTable->StartPtr;\r
PtrTrack->EndPtr = IndexTable->EndPtr;\r
VariableBase = (UINT8 *) (UINTN) PcdGet32 (PcdFlashNvStorageVariableBase);\r
VariableStoreHeader = (VARIABLE_STORE_HEADER *) (VariableBase + \\r
((EFI_FIRMWARE_VOLUME_HEADER *) (VariableBase)) -> HeaderLength);\r
- \r
+\r
if (GetVariableStoreStatus (VariableStoreHeader) != EfiValid) {\r
return EFI_UNSUPPORTED;\r
}\r
//\r
if (IndexTable->Length < VARIABLE_INDEX_TABLE_VOLUME)\r
{\r
-#if ALIGNMENT <= 1\r
- IndexTable->Index[IndexTable->Length++] = (UINT16) (UINTN) Variable;\r
-#else\r
-#if ALIGNMENT >= 4\r
- IndexTable->Index[IndexTable->Length++] = (UINT16) (((UINT32)(UINTN) Variable) >> 2);\r
-#endif\r
-#endif\r
+ VariableIndexTableUpdate (IndexTable, Variable);\r
}\r
\r
if (CompareWithValidVariable (Variable, VariableName, VendorGuid, PtrTrack) == EFI_SUCCESS) {\r