Home | History | Annotate | Download | only in FSVariable

Lines Matching refs:Variable

4 All variable code, variable metadata, and variable data used by Duet platform are on 

6 Duet trusts all meta data from disk. If variable code, variable metadata and variable
24 Provide support functions for variable services.
45 Update the variable region with Variable information. These are the same
46 arguments as the EFI Variable services.
48 @param[in] VariableName Name of variable
50 @param[in] VendorGuid Guid of variable
52 @param[in] Data Variable data
56 @param[in] Attributes Attribues of the variable
58 @param[in] Variable The variable information which is used to keep track of variable usage.
62 @retval EFI_OUT_OF_RESOURCES Variable region is full, can not write other data into this region.
73 IN VARIABLE_POINTER_TRACK *Variable
92 IN VARIABLE_HEADER *Variable
98 This code checks if variable header is valid or not.
101 Variable Pointer to the Variable Header.
104 TRUE Variable header is valid.
105 FALSE Variable header is not valid.
109 if (Variable == NULL || Variable->StartId != VARIABLE_DATA) {
124 This code gets the current status of Variable Store.
128 VarStoreHeader Pointer to the Variable Store Header.
132 EfiRaw Variable store status is raw
133 EfiValid Variable store status is valid
134 EfiInvalid Variable store status is invalid
160 IN VARIABLE_HEADER *Variable
166 This code gets the pointer to the variable data.
170 Variable Pointer to the Variable Header.
174 UINT8* Pointer to Variable Data
181 return (UINT8 *) ((UINTN) GET_VARIABLE_NAME_PTR (Variable) + Variable->NameSize + GET_PAD_SIZE (Variable->NameSize));
186 IN VARIABLE_HEADER *Variable
192 This code gets the pointer to the next variable header.
196 Variable Pointer to the Variable Header.
200 VARIABLE_HEADER* Pointer to next variable header.
204 if (!IsValidVariableHeader (Variable)) {
210 return (VARIABLE_HEADER *) ((UINTN) GetVariableDataPtr (Variable) + Variable->DataSize + GET_PAD_SIZE (Variable->DataSize));
221 This code gets the pointer to the last variable memory pointer byte
225 VarStoreHeader Pointer to the Variable Store Header.
229 VARIABLE_HEADER* Pointer to last unavailable Variable Header
234 // The end of variable store
241 IN VARIABLE_HEADER *Variable
247 Check if exist newer variable when doing reclaim
251 Variable Pointer to start position
255 TRUE - Exists another variable, which is newer than the current one
264 VendorGuid = &Variable->VendorGuid;
265 VariableName = GET_VARIABLE_NAME_PTR(Variable);
267 NextVariable = GetNextVariablePtr (Variable);
293 Variable store garbage collection and reclaim operation
297 IsVolatile The variable store is volatile or not,
300 current variable for Reclaim.
308 VARIABLE_HEADER *Variable;
320 // Start Pointers for the variable.
322 Variable = (VARIABLE_HEADER *) (VariableStoreHeader + 1);
348 // Copy variable store header
354 // Start Pointers for the variable.
356 Variable = (VARIABLE_HEADER *) (VariableStoreHeader + 1);
360 while (IsValidVariableHeader (Variable)) {
361 NextVariable = GetNextVariablePtr (Variable);
366 if (Variable->State == VAR_ADDED) {
367 VariableSize = (UINTN) NextVariable - (UINTN) Variable;
368 CopyMem (CurrPtr, (UINT8 *) Variable, VariableSize);
371 if ((!StorageType) && ((Variable->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD)) {
373 } else if ((!StorageType) && ((Variable->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != EFI_VARIABLE_HARDWARE_ERROR_RECORD)) {
376 } else if (Variable->State == (VAR_ADDED & VAR_IN_DELETED_TRANSITION)) {
381 if (!ExistNewerVariable(Variable)) {
382 VariableSize = (UINTN) NextVariable - (UINTN) Variable;
383 CopyMem (CurrPtr, (UINT8 *) Variable, VariableSize);
385 // If CurrentVariable == Variable, mark as VAR_IN_DELETED_TRANSITION
387 if (Variable != CurrentVariable){
392 if ((!StorageType) && ((Variable->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD)) {
394 } else if ((!StorageType) && ((Variable->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != EFI_VARIABLE_HARDWARE_ERROR_RECORD)) {
399 Variable = NextVariable;
419 // If error, then reset the last variable offset to zero.
439 This code finds variable in storage blocks (Volatile or Non-Volatile)
443 VariableName Name of the variable to be found
445 PtrTrack Variable Track Pointer structure that contains
446 Variable Information.
447 Contains the pointer of Variable header.
452 EFI_SUCCESS - Find the specified variable
457 VARIABLE_HEADER *Variable;
481 // Start Pointers for the variable.
484 Variable = (VARIABLE_HEADER *) (VariableStoreHeader + 1);
487 // Find the variable by walk through non-volatile and volatile variable store
489 PtrTrack->StartPtr = Variable;
492 while ((Variable < PtrTrack->EndPtr) && IsValidVariableHeader (Variable)) {
493 if (Variable->State == VAR_ADDED) {
494 if (!EfiAtRuntime () || (Variable->Attributes & EFI_VARIABLE_RUNTIME_ACCESS)) {
496 PtrTrack->CurrPtr = Variable;
500 if (CompareGuid (VendorGuid, &Variable->VendorGuid)) {
501 if (!CompareMem (VariableName, GET_VARIABLE_NAME_PTR (Variable), StrSize (VariableName))) {
502 PtrTrack->CurrPtr = Variable;
509 } else if (Variable->State == (VAR_ADDED & VAR_IN_DELETED_TRANSITION)) {
513 if (!EfiAtRuntime () || (Variable->Attributes & EFI_VARIABLE_RUNTIME_ACCESS)) {
515 InDeleteVariable = Variable;
520 if (CompareGuid (VendorGuid, &Variable->VendorGuid)) {
521 if (!CompareMem (VariableName, GET_VARIABLE_NAME_PTR (Variable), StrSize (VariableName))) {
522 InDeleteVariable = Variable;
532 Variable = GetNextVariablePtr (Variable);
728 supports a variable argument list that allows the caller to pass in a prioritized
739 @param[in] ... A variable argument list that contains pointers to
750 no matches are found, then the next variable argument
751 parameter is evaluated. The variable argument list
859 and are read-only. Therefore, in variable driver, only store the original value for other use.
861 @param[in] VariableName Name of variable
863 @param[in] Data Variable data
880 VARIABLE_POINTER_TRACK Variable;
894 // PlatformLangCodes is a volatile variable, so it can not be updated at runtime.
904 // Therefore, in variable driver, only store the original value for other use.
924 // LangCodes is a volatile variable, so it can not be updated at runtime.
934 // Therefore, in variable driver, only store the original value for other use.
950 Status = FindVariable (L"PlatformLang", &gEfiGlobalVariableGuid, &Variable);
956 Data = GetVariableDataPtr (Variable.CurrPtr);
957 DataSize = Variable.CurrPtr->DataSize;
959 Status = FindVariable (L"Lang", &gEfiGlobalVariableGuid, &Variable);
965 Data = GetVariableDataPtr (Variable.CurrPtr);
966 DataSize = Variable.CurrPtr->DataSize;
1002 // Successfully convert PlatformLang to Lang, and set the BestLang value into Lang variable simultaneously.
1004 FindVariable(L"Lang", &gEfiGlobalVariableGuid, &Variable);
1006 Status = UpdateVariable (L"Lang", &gEfiGlobalVariableGuid, BestLang, ISO_639_2_ENTRY_SIZE + 1, Attributes, &Variable);
1008 DEBUG ((EFI_D_INFO, "Variable Driver Auto Update PlatformLang, PlatformLang:%a, Lang:%a\n", BestPlatformLang, BestLang));
1035 // Successfully convert Lang to PlatformLang, and set the BestPlatformLang value into PlatformLang variable simultaneously.
1037 FindVariable(L"PlatformLang", &gEfiGlobalVariableGuid, &Variable);
1040 AsciiStrSize (BestPlatformLang), Attributes, &Variable);
1042 DEBUG ((EFI_D_INFO, "Variable Driver Auto Update Lang, Lang:%a, PlatformLang:%a\n", BestLang, BestPlatformLang));
1050 Update the variable region with Variable information. These are the same
1051 arguments as the EFI Variable services.
1053 @param[in] VariableName Name of variable
1055 @param[in] VendorGuid Guid of variable
1057 @param[in] Data Variable data
1061 @param[in] Attributes Attribues of the variable
1063 @param[in] Variable The variable information which is used to keep track of variable usage.
1067 @retval EFI_OUT_OF_RESOURCES Variable region is full, can not write other data into this region.
1078 IN VARIABLE_POINTER_TRACK *Variable
1093 if (Variable->CurrPtr != NULL) {
1095 // Update/Delete existing variable
1100 // If EfiAtRuntime and the variable is Volatile and Runtime Access,
1104 if (Variable->Type == Volatile) {
1108 // Only variable have NV attribute can be updated/deleted in Runtime
1110 if (!(Variable->CurrPtr->Attributes & EFI_VARIABLE_NON_VOLATILE)) {
1116 // Setting a data variable with no access, or zero DataSize attributes
1121 // Found this variable in storage
1123 State = Variable->CurrPtr->State;
1126 Status = mGlobal->VariableStore[Variable->Type]->Write (
1127 mGlobal->VariableStore[Variable->Type],
1128 VARIABLE_MEMBER_OFFSET (State, (UINTN) Variable->CurrPtr - (UINTN) Variable->StartPtr),
1129 sizeof (Variable->CurrPtr->State),
1140 // Found this variable in storage
1141 // If the variable is marked valid and the same data has been passed in
1144 if ((Variable->CurrPtr->DataSize == DataSize) &&
1145 (CompareMem (Data, GetVariableDataPtr (Variable->CurrPtr), DataSize) == 0)
1148 } else if ((Variable->CurrPtr->State == VAR_ADDED) ||
1149 (Variable->CurrPtr->State == (VAR_ADDED & VAR_IN_DELETED_TRANSITION))) {
1151 // Mark the old variable as in delete transition
1153 State = Variable->CurrPtr->State;
1156 Status = mGlobal->VariableStore[Variable->Type]->Write (
1157 mGlobal->VariableStore[Variable->Type],
1158 VARIABLE_MEMBER_OFFSET (State, (UINTN) Variable->CurrPtr - (UINTN) Variable->StartPtr),
1159 sizeof (Variable->CurrPtr->State),
1169 // Create a new variable
1173 // Make sure we are trying to create a new variable.
1174 // Setting a data variable with no access, or zero DataSize attributes means to delete it.
1180 // Only variable have NV|RT attribute can be created in Runtime
1190 // Function part - create a new variable and copy the data.
1191 // Both update a variable and create a variable will come here.
1218 // NextVariable->DataSize should not include pad size so that variable
1225 // The actual size of the variable that stores in storage should
1227 // VarDataOffset: offset from begin of current variable header
1242 Status = Reclaim (StorageType, Variable->CurrPtr);
1281 // Mark the old variable as deleted
1283 if (!Reclaimed && !EFI_ERROR (Status) && Variable->CurrPtr != NULL) {
1284 State = Variable->CurrPtr->State;
1289 VARIABLE_MEMBER_OFFSET (State, (UINTN) Variable->CurrPtr - (UINTN) Variable->StartPtr),
1290 sizeof (Variable->CurrPtr->State),
1314 This code finds variable in storage blocks (Volatile or Non-Volatile)
1318 VariableName Name of Variable to be found
1319 VendorGuid Variable vendor GUID
1320 Attributes OPTIONAL Attribute value of the variable found
1323 Data The buffer to return the contents of the variable. May be NULL
1332 VARIABLE_POINTER_TRACK Variable;
1345 // Find existing variable
1347 Status = FindVariable (VariableName, VendorGuid, &Variable);
1349 if (Variable.CurrPtr == NULL || EFI_ERROR (Status)) {
1355 VarDataSize = Variable.CurrPtr->DataSize;
1360 CopyMem (Data, GetVariableDataPtr (Variable.CurrPtr), VarDataSize);
1363 *Attributes = Variable.CurrPtr->Attributes;
1386 This code Finds the Next available variable
1390 VariableNameSize Size of the variable
1391 VariableName Pointer to variable name
1392 VendorGuid Variable Vendor Guid
1400 VARIABLE_POINTER_TRACK Variable;
1408 Status = FindVariable (VariableName, VendorGuid, &Variable);
1410 if (Variable.CurrPtr == NULL || EFI_ERROR (Status)) {
1416 // If variable name is not NULL, get next variable
1418 Variable.CurrPtr = GetNextVariablePtr (Variable.CurrPtr);
1423 // The order we find variable is: 1). NonVolatile; 2). Volatile
1424 // If both volatile and non-volatile variable store are parsed,
1427 if (Variable.CurrPtr >= Variable.EndPtr || Variable.CurrPtr == NULL) {
1428 if (Variable.Type == Volatile) {
1438 Variable.Type = Volatile;
1439 Variable.StartPtr = (VARIABLE_HEADER *) ((VARIABLE_STORE_HEADER *) mGlobal->VariableBase[Volatile] + 1);
1440 Variable.EndPtr = (VARIABLE_HEADER *) GetEndPointer ((VARIABLE_STORE_HEADER *) mGlobal->VariableBase[Volatile]);
1442 Variable.CurrPtr = Variable.StartPtr;
1443 if (!IsValidVariableHeader (Variable.CurrPtr)) {
1448 // Variable is found
1450 if (IsValidVariableHeader (Variable.CurrPtr) &&
1451 ((Variable.CurrPtr->State == VAR_ADDED) ||
1452 (Variable.CurrPtr->State == (VAR_ADDED & VAR_IN_DELETED_TRANSITION)))) {
1453 if (!EfiAtRuntime () || (Variable.CurrPtr->Attributes & EFI_VARIABLE_RUNTIME_ACCESS)) {
1454 VarNameSize = Variable.CurrPtr->NameSize;
1458 GET_VARIABLE_NAME_PTR (Variable.CurrPtr),
1463 &Variable.CurrPtr->VendorGuid,
1476 Variable.CurrPtr = GetNextVariablePtr (Variable.CurrPtr);
1493 This code sets variable in storage blocks (Volatile or Non-Volatile)
1497 VariableName Name of Variable to be found
1498 VendorGuid Variable vendor GUID
1499 Attributes Attribute value of the variable found
1508 EFI_OUT_OF_RESOURCES - Resource not enough to set variable
1510 EFI_DEVICE_ERROR - Variable can not be saved due to hardware failure
1511 EFI_WRITE_PROTECTED - Variable is read-only
1515 VARIABLE_POINTER_TRACK Variable;
1530 // Not support authenticated variable write yet.
1554 // According to UEFI spec, HARDWARE_ERROR_RECORD variable name convention should be L"HwErrRecXXXX"
1567 // Check whether the input variable is already existed
1569 Status = FindVariable (VariableName, VendorGuid, &Variable);
1576 Status = UpdateVariable (VariableName, VendorGuid, Data, DataSize, Attributes, &Variable);
1615 VARIABLE_HEADER *Variable;
1651 // Not support authentiated variable write yet.
1666 // Harware error record variable needs larger size.
1678 // Let *MaximumVariableSize be PcdGet32(PcdMaxVariableSize) with the exception of the variable header size.
1686 Variable = (VARIABLE_HEADER *) (VariableStoreHeader + 1);
1689 // Now walk through the related variable store.
1691 while ((Variable < GetEndPointer (VariableStoreHeader)) && IsValidVariableHeader (Variable)) {
1692 NextVariable = GetNextVariablePtr (Variable);
1693 VariableSize = (UINT64) (UINTN) NextVariable - (UINT64) (UINTN) Variable;
1702 if ((Variable->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {
1712 if ((Variable->State == VAR_ADDED) || (Variable->State == (VAR_ADDED & VAR_IN_DELETED_TRANSITION))) {
1713 if ((Variable->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {
1724 Variable = NextVariable;
1745 This function does initialization for variable services
1756 EFI_NOT_FOUND - Variable store area not found.
1757 EFI_SUCCESS - Variable services successfully initialized.
1765 VARIABLE_HEADER *Variable;
1796 DEBUG ((EFI_D_ERROR, "FSVariable: Could not find flash area for variable!\n"));
1808 // Mark the variable storage region of the FLASH as RUNTIME
1871 Variable = (VARIABLE_HEADER *) (VariableStoreHeader + 1);
1872 while (IsValidVariableHeader (Variable)) {
1874 NextVariable = GetNextVariablePtr (Variable);
1875 VariableSize = NextVariable - Variable;
1881 Variable = NextVariable;
1884 mGlobal->LastVariableOffset[NonVolatile] = (UINTN) Variable - (UINTN) VariableStoreHeader;
1928 // Now install the Variable Runtime Architectural Protocol on a new handle