29 if ((Variable ==
NULL) || (Variable >= VariableStoreEnd) || (Variable->StartId !=
VARIABLE_DATA)) {
56 if ((
CompareGuid (&VarStoreHeader->Signature, &gEfiAuthenticatedVariableGuid) ||
57 CompareGuid (&VarStoreHeader->Signature, &gEfiVariableGuid)) &&
59 (VarStoreHeader->State == VARIABLE_STORE_HEALTHY)
63 }
else if ((((UINT32 *)(&VarStoreHeader->Signature))[0] == 0xffffffff) &&
64 (((UINT32 *)(&VarStoreHeader->Signature))[1] == 0xffffffff) &&
65 (((UINT32 *)(&VarStoreHeader->Signature))[2] == 0xffffffff) &&
66 (((UINT32 *)(&VarStoreHeader->Signature))[3] == 0xffffffff) &&
67 (VarStoreHeader->Size == 0xffffffff) &&
68 (VarStoreHeader->Format == 0xff) &&
69 (VarStoreHeader->State == 0xff)
117 IN BOOLEAN AuthFormat
124 if ((AuthVariable->
State == (UINT8)(-1)) ||
125 (AuthVariable->
DataSize == (UINT32)(-1)) ||
126 (AuthVariable->
NameSize == (UINT32)(-1)) ||
134 if ((Variable->State == (UINT8)(-1)) ||
135 (Variable->DataSize == (UINT32)(-1)) ||
136 (Variable->NameSize == (UINT32)(-1)) ||
137 (Variable->Attributes == (UINT32)(-1)))
142 return (
UINTN)Variable->NameSize;
159 IN BOOLEAN AuthFormat
166 AuthVariable->
NameSize = (UINT32)NameSize;
168 Variable->NameSize = (UINT32)NameSize;
186 IN BOOLEAN AuthFormat
193 if ((AuthVariable->
State == (UINT8)(-1)) ||
194 (AuthVariable->
DataSize == (UINT32)(-1)) ||
195 (AuthVariable->
NameSize == (UINT32)(-1)) ||
203 if ((Variable->State == (UINT8)(-1)) ||
204 (Variable->DataSize == (UINT32)(-1)) ||
205 (Variable->NameSize == (UINT32)(-1)) ||
206 (Variable->Attributes == (UINT32)(-1)))
211 return (
UINTN)Variable->DataSize;
228 IN BOOLEAN AuthFormat
235 AuthVariable->
DataSize = (UINT32)DataSize;
237 Variable->DataSize = (UINT32)DataSize;
255 IN BOOLEAN AuthFormat
274 IN BOOLEAN AuthFormat
283 return &Variable->VendorGuid;
301 IN BOOLEAN AuthFormat
313 return (UINT8 *)Value;
329 IN BOOLEAN AuthFormat
358 IN BOOLEAN AuthFormat
433 if (FirstTime->Year != SecondTime->Year) {
434 return (BOOLEAN)(FirstTime->Year < SecondTime->Year);
435 }
else if (FirstTime->Month != SecondTime->Month) {
436 return (BOOLEAN)(FirstTime->Month < SecondTime->Month);
437 }
else if (FirstTime->Day != SecondTime->Day) {
438 return (BOOLEAN)(FirstTime->Day < SecondTime->Day);
439 }
else if (FirstTime->Hour != SecondTime->Hour) {
440 return (BOOLEAN)(FirstTime->Hour < SecondTime->Hour);
441 }
else if (FirstTime->Minute != SecondTime->Minute) {
442 return (BOOLEAN)(FirstTime->Minute < SecondTime->Minute);
445 return (BOOLEAN)(FirstTime->Second <= SecondTime->Second);
464 IN CHAR16 *VariableName,
466 IN BOOLEAN IgnoreRtCheck,
468 IN BOOLEAN AuthFormat
474 PtrTrack->InDeletedTransitionPtr =
NULL;
479 InDeletedVariable =
NULL;
481 for ( PtrTrack->CurrPtr = PtrTrack->StartPtr
486 if ((PtrTrack->CurrPtr->State ==
VAR_ADDED) ||
490 if (IgnoreRtCheck || !
AtRuntime () || ((PtrTrack->CurrPtr->Attributes & EFI_VARIABLE_RUNTIME_ACCESS) != 0)) {
491 if (VariableName[0] == 0) {
493 InDeletedVariable = PtrTrack->CurrPtr;
495 PtrTrack->InDeletedTransitionPtr = InDeletedVariable;
505 InDeletedVariable = PtrTrack->CurrPtr;
507 PtrTrack->InDeletedTransitionPtr = InDeletedVariable;
517 PtrTrack->CurrPtr = InDeletedVariable;
545 IN CHAR16 *VariableName,
549 IN BOOLEAN AuthFormat
553 VARIABLE_STORE_TYPE StoreType;
558 Status = EFI_NOT_FOUND;
560 if (VariableStoreList ==
NULL) {
561 return EFI_INVALID_PARAMETER;
564 ZeroMem (&Variable,
sizeof (Variable));
567 for (StoreType = (VARIABLE_STORE_TYPE)0; StoreType < VariableStoreTypeMax; StoreType++) {
568 if (VariableStoreList[StoreType] ==
NULL) {
573 Variable.EndPtr =
GetEndPointer (VariableStoreList[StoreType]);
574 Variable.Volatile = (BOOLEAN)(StoreType == VariableStoreTypeVolatile);
577 if (!EFI_ERROR (Status)) {
582 if ((Variable.CurrPtr ==
NULL) || EFI_ERROR (Status)) {
588 if (VariableName[0] != 0) {
594 Status = EFI_INVALID_PARAMETER;
600 if (VariableName[0] != 0) {
615 for (StoreType = (VARIABLE_STORE_TYPE)0; StoreType < VariableStoreTypeMax; StoreType++) {
616 if ((VariableStoreList[StoreType] !=
NULL) && (Variable.StartPtr ==
GetStartPointer (VariableStoreList[StoreType]))) {
621 ASSERT (StoreType < VariableStoreTypeMax);
625 for (StoreType++; StoreType < VariableStoreTypeMax; StoreType++) {
626 if (VariableStoreList[StoreType] !=
NULL) {
636 if (StoreType == VariableStoreTypeMax) {
637 Status = EFI_NOT_FOUND;
642 Variable.EndPtr =
GetEndPointer (VariableStoreList[StoreType]);
643 Variable.CurrPtr = Variable.StartPtr;
650 if (!
AtRuntime () || ((Variable.CurrPtr->
Attributes & EFI_VARIABLE_RUNTIME_ACCESS) != 0)) {
657 VariablePtrTrack.StartPtr = Variable.StartPtr;
658 VariablePtrTrack.EndPtr = Variable.EndPtr;
666 if (!EFI_ERROR (Status) && (VariablePtrTrack.CurrPtr->
State ==
VAR_ADDED)) {
675 if ((VariableStoreList[VariableStoreTypeHob] !=
NULL) && (VariableStoreList[VariableStoreTypeNv] !=
NULL) &&
676 (Variable.StartPtr ==
GetStartPointer (VariableStoreList[VariableStoreTypeNv]))
679 VariableInHob.StartPtr =
GetStartPointer (VariableStoreList[VariableStoreTypeHob]);
680 VariableInHob.EndPtr =
GetEndPointer (VariableStoreList[VariableStoreTypeHob]);
688 if (!EFI_ERROR (Status)) {
694 *VariablePtr = Variable.CurrPtr;
730 IN CHAR16 *VariableName,
743 if ((VariableName ==
NULL) || (VendorGuid ==
NULL) || (VariableInfo ==
NULL)) {
752 if (*VariableInfo ==
NULL) {
758 ASSERT (*VariableInfo !=
NULL);
760 CopyGuid (&(*VariableInfo)->VendorGuid, VendorGuid);
762 ASSERT ((*VariableInfo)->Name !=
NULL);
763 StrCpyS ((*VariableInfo)->Name,
StrSize (VariableName)/
sizeof (CHAR16), VariableName);
764 (*VariableInfo)->Volatile = Volatile;
767 for (Entry = (*VariableInfo); Entry !=
NULL; Entry = Entry->Next) {
768 if (
CompareGuid (VendorGuid, &Entry->VendorGuid)) {
769 if (
StrCmp (VariableName, Entry->Name) == 0) {
779 Entry->DeleteCount++;
790 if (Entry->Next ==
NULL) {
796 ASSERT (Entry->Next !=
NULL);
798 CopyGuid (&Entry->Next->VendorGuid, VendorGuid);
800 ASSERT (Entry->Next->Name !=
NULL);
801 StrCpyS (Entry->Next->Name,
StrSize (VariableName)/
sizeof (CHAR16), VariableName);
802 Entry->Next->Volatile = Volatile;
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
#define FeaturePcdGet(TokenName)
EFI_GUID * GetVendorGuidPtr(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat)
VOID SetDataSizeOfVariable(IN VARIABLE_HEADER *Variable, IN UINTN DataSize, IN BOOLEAN AuthFormat)
VARIABLE_HEADER * GetNextVariablePtr(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat)
VARIABLE_HEADER * GetStartPointer(IN VARIABLE_STORE_HEADER *VarStoreHeader)
UINT8 * GetVariableDataPtr(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat)
EFI_STATUS EFIAPI VariableServiceGetNextVariableInternal(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN VARIABLE_STORE_HEADER **VariableStoreList, OUT VARIABLE_HEADER **VariablePtr, IN BOOLEAN AuthFormat)
VARIABLE_STORE_STATUS GetVariableStoreStatus(IN VARIABLE_STORE_HEADER *VarStoreHeader)
EFI_STATUS FindVariableEx(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN BOOLEAN IgnoreRtCheck, IN OUT VARIABLE_POINTER_TRACK *PtrTrack, IN BOOLEAN AuthFormat)
UINTN GetVariableDataOffset(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat)
BOOLEAN IsValidVariableHeader(IN VARIABLE_HEADER *Variable, IN VARIABLE_HEADER *VariableStoreEnd)
UINTN NameSizeOfVariable(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat)
VARIABLE_HEADER * GetEndPointer(IN VARIABLE_STORE_HEADER *VarStoreHeader)
VOID SetNameSizeOfVariable(IN VARIABLE_HEADER *Variable, IN UINTN NameSize, IN BOOLEAN AuthFormat)
VOID UpdateVariableInfo(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN BOOLEAN Volatile, IN BOOLEAN Read, IN BOOLEAN Write, IN BOOLEAN Delete, IN BOOLEAN Cache, IN OUT VARIABLE_INFO_ENTRY **VariableInfo)
BOOLEAN VariableCompareTimeStampInternal(IN EFI_TIME *FirstTime, IN EFI_TIME *SecondTime)
UINTN DataSizeOfVariable(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat)
CHAR16 * GetVariableNamePtr(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat)
UINTN GetVariableHeaderSize(IN BOOLEAN AuthFormat)