TianoCore EDK2 master
|
#include "PlatVarCleanup.h"
Go to the source code of this file.
Variables | |
VAR_ERROR_FLAG | mLastVarErrorFlag = VAR_ERROR_FLAG_NO_ERROR |
EDKII_VAR_CHECK_PROTOCOL * | mVarCheck = NULL |
BOOLEAN | mEndOfDxe = FALSE |
EFI_EVENT | mPlatVarCleanupLibEndOfDxeEvent = NULL |
LIST_ENTRY | mUserVariableList = INITIALIZE_LIST_HEAD_VARIABLE (mUserVariableList) |
UINT16 | mUserVariableCount = 0 |
UINT16 | mMarkedUserVariableCount = 0 |
EFI_GUID | mVariableCleanupHiiGuid = VARIABLE_CLEANUP_HII_GUID |
CHAR16 | mVarStoreName [] = L"VariableCleanup" |
HII_VENDOR_DEVICE_PATH | mVarCleanupHiiVendorDevicePath |
Sample platform variable cleanup library implementation.
Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file PlatVarCleanupLib.c.
Create a counter based data payload by concatenating the EFI_VARIABLE_AUTHENTICATION descriptor with the input data. NO authentication is required in this function.
[in,out] | DataSize | On input, the size of Data buffer in bytes. On output, the size of data returned in Data buffer in bytes. |
[in,out] | Data | On input, Pointer to data buffer to be wrapped or pointer to NULL to wrap an empty payload. On output, Pointer to the new payload date buffer allocated from pool, it's caller's responsibility to free the memory after using it. |
EFI_SUCCESS | Create counter based payload successfully. |
EFI_OUT_OF_RESOURCES | There are not enough memory resourses to create time based payload. |
EFI_INVALID_PARAMETER | The parameter is invalid. |
Others | Unexpected error happens. |
Definition at line 430 of file PlatVarCleanupLib.c.
Create a time based data payload by concatenating the EFI_VARIABLE_AUTHENTICATION_2 descriptor with the input data. NO authentication is required in this function.
[in,out] | DataSize | On input, the size of Data buffer in bytes. On output, the size of data returned in Data buffer in bytes. |
[in,out] | Data | On input, Pointer to data buffer to be wrapped or pointer to NULL to wrap an empty payload. On output, Pointer to the new payload date buffer allocated from pool, it's caller's responsibility to free the memory after using it. |
EFI_SUCCESS | Create time based payload successfully. |
EFI_OUT_OF_RESOURCES | There are not enough memory resourses to create time based payload. |
EFI_INVALID_PARAMETER | The parameter is invalid. |
Others | Unexpected error happens. |
Definition at line 345 of file PlatVarCleanupLib.c.
VOID CreateUserVariableNode | ( | VOID | ) |
Create user variable node.
Definition at line 187 of file PlatVarCleanupLib.c.
VOID DeleteUserVariable | ( | IN BOOLEAN | DeleteAll, |
IN VARIABLE_CLEANUP_DATA *VariableCleanupData | OPTIONAL | ||
) |
Delete user variable.
[in] | DeleteAll | Delete all user variables. |
[in] | VariableCleanupData | Pointer to variable cleanup data. |
Definition at line 500 of file PlatVarCleanupLib.c.
VOID DestroyUserVariableNode | ( | VOID | ) |
Destroy user variable nodes.
Definition at line 294 of file PlatVarCleanupLib.c.
USER_VARIABLE_NODE * FindUserVariableNodeByGuid | ( | IN EFI_GUID * | Guid | ) |
Find user variable node by variable GUID.
[in] | Guid | Pointer to vendor guid. |
Definition at line 143 of file PlatVarCleanupLib.c.
VAR_ERROR_FLAG EFIAPI GetLastBootVarErrorFlag | ( | VOID | ) |
Get last boot variable error flag.
Definition at line 1203 of file PlatVarCleanupLib.c.
VAR_ERROR_FLAG InternalGetVarErrorFlag | ( | VOID | ) |
Internal get variable error flag.
Definition at line 57 of file PlatVarCleanupLib.c.
Is user variable?
[in] | Name | Pointer to variable name. |
[in] | Guid | Pointer to vendor guid. |
TRUE | User variable. |
FALSE | System variable. |
Definition at line 92 of file PlatVarCleanupLib.c.
EFI_STATUS EFIAPI PlatformVarCleanup | ( | IN VAR_ERROR_FLAG | Flag, |
IN VAR_CLEANUP_TYPE | Type | ||
) |
Platform variable cleanup.
[in] | Flag | Variable error flag. |
[in] | Type | Variable cleanup type. If it is VarCleanupManually, the interface must be called after console connected. |
EFI_SUCCESS | No error or error processed. |
EFI_UNSUPPORTED | The specified Flag or Type is not supported. For example, system error may be not supported to process and Platform should have mechanism to reset system to manufacture mode. Another, if system and user variables are wanted to be distinguished to process, the interface must be called after EndOfDxe. |
EFI_OUT_OF_RESOURCES | Not enough resource to process the error. |
EFI_INVALID_PARAMETER | The specified Flag or Type is an invalid value. |
Others | Other failure occurs. |
Definition at line 1039 of file PlatVarCleanupLib.c.
Notification function of END_OF_DXE.
This is a notification function registered on END_OF_DXE event.
[in] | Event | Event whose notification function is being invoked. |
[in] | Context | Pointer to the notification function's context. |
Definition at line 1221 of file PlatVarCleanupLib.c.
EFI_STATUS EFIAPI PlatformVarCleanupLibConstructor | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
The constructor function caches the pointer to VarCheck protocol and last boot variable error flag.
The constructor function locates VarCheck protocol from protocol database. It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
ImageHandle | The firmware allocated handle for the EFI image. |
SystemTable | A pointer to the EFI System Table. |
EFI_SUCCESS | The constructor always returns EFI_SUCCESS. |
Definition at line 1243 of file PlatVarCleanupLib.c.
EFI_STATUS EFIAPI PlatformVarCleanupLibDestructor | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
The destructor function closes the End of DXE event.
ImageHandle | The firmware allocated handle for the EFI image. |
SystemTable | A pointer to the EFI System Table. |
EFI_SUCCESS | The destructor completed successfully. |
Definition at line 1280 of file PlatVarCleanupLib.c.
VOID UpdateUserVariableForm | ( | IN VARIABLE_CLEANUP_HII_PRIVATE_DATA * | Private | ) |
Update user variable form.
[in] | Private | Points to the VARIABLE_CLEANUP_HII_PRIVATE_DATA. |
Definition at line 671 of file PlatVarCleanupLib.c.
EFI_STATUS EFIAPI VariableCleanupHiiCallback | ( | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL * | This, |
IN EFI_BROWSER_ACTION | Action, | ||
IN EFI_QUESTION_ID | QuestionId, | ||
IN UINT8 | Type, | ||
IN EFI_IFR_TYPE_VALUE * | Value, | ||
OUT EFI_BROWSER_ACTION_REQUEST * | ActionRequest | ||
) |
This function is called to provide results data to the driver. This data consists of a unique key that is used to identify which data is either being passed back or being asked for.
[in] | This | Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. |
[in] | Action | Specifies the type of action taken by the browser. |
[in] | QuestionId | A unique value which is sent to the original exporting driver so that it can identify the type of data to expect. The format of the data tends to vary based on the opcode that generated the callback. |
[in] | Type | The type of value for the question. |
[in] | Value | A pointer to the data being sent to the original exporting driver. |
[out] | ActionRequest | On return, points to the action requested by the callback function. |
EFI_SUCCESS | The callback successfully handled the action. |
EFI_OUT_OF_RESOURCES | Not enough storage is available to hold the variable and its data. |
EFI_DEVICE_ERROR | The variable could not be saved. |
EFI_UNSUPPORTED | The specified Action is not supported by the callback. |
Definition at line 920 of file PlatVarCleanupLib.c.
EFI_STATUS EFIAPI VariableCleanupHiiExtractConfig | ( | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL * | This, |
IN CONST EFI_STRING | Request, | ||
OUT EFI_STRING * | Progress, | ||
OUT EFI_STRING * | Results | ||
) |
This function allows a caller to extract the current configuration for one or more named elements from the target driver.
[in] | This | Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. |
[in] | Request | A null-terminated Unicode string in <ConfigRequest> format. |
[out] | Progress | On return, points to a character in the Request string. Points to the string's null terminator if request was successful. Points to the most recent '&' before the first failing name/value pair (or the beginning of the string if the failure is in the first name/value pair) if the request was not successful. |
[out] | Results | A null-terminated Unicode string in <ConfigAltResp> format which has all values filled in for the names in the Request string. String to be allocated by the called function. |
EFI_SUCCESS | The Results is filled with the requested values. |
EFI_OUT_OF_RESOURCES | Not enough memory to store the results. |
EFI_INVALID_PARAMETER | Request is illegal syntax, or unknown name. |
EFI_NOT_FOUND | Routing data doesn't match any storage in this driver. |
Definition at line 580 of file PlatVarCleanupLib.c.
EFI_STATUS EFIAPI VariableCleanupHiiRouteConfig | ( | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL * | This, |
IN CONST EFI_STRING | Configuration, | ||
OUT EFI_STRING * | Progress | ||
) |
This function applies changes in a driver's configuration. Input is a Configuration, which has the routing data for this driver followed by name / value configuration pairs. The driver must apply those pairs to its configurable storage. If the driver's configuration is stored in a linear block of data and the driver's name / value pairs are in <BlockConfig> format, it may use the ConfigToBlock helper function (above) to simplify the job. Currently not implemented.
[in] | This | Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. |
[in] | Configuration | A null-terminated Unicode string in <ConfigString> format. |
[out] | Progress | A pointer to a string filled in with the offset of the most recent '&' before the first failing name / value pair (or the beginn ing of the string if the failure is in the first name / value pair) or the terminating NULL if all was successful. |
EFI_SUCCESS | The results have been distributed or are awaiting distribution. |
EFI_OUT_OF_RESOURCES | Not enough memory to store the parts of the results that must be stored awaiting possible future protocols. |
EFI_INVALID_PARAMETERS | Passing in a NULL for the Results parameter would result in this type of error. |
EFI_NOT_FOUND | Target for the specified routing data was not found. |
Definition at line 840 of file PlatVarCleanupLib.c.
BOOLEAN mEndOfDxe = FALSE |
The flag to indicate whether the platform has left the DXE phase of execution.
Definition at line 17 of file PlatVarCleanupLib.c.
VAR_ERROR_FLAG mLastVarErrorFlag = VAR_ERROR_FLAG_NO_ERROR |
Definition at line 11 of file PlatVarCleanupLib.c.
UINT16 mMarkedUserVariableCount = 0 |
Definition at line 23 of file PlatVarCleanupLib.c.
Definition at line 19 of file PlatVarCleanupLib.c.
UINT16 mUserVariableCount = 0 |
Definition at line 22 of file PlatVarCleanupLib.c.
LIST_ENTRY mUserVariableList = INITIALIZE_LIST_HEAD_VARIABLE (mUserVariableList) |
Definition at line 21 of file PlatVarCleanupLib.c.
EDKII_VAR_CHECK_PROTOCOL* mVarCheck = NULL |
Definition at line 12 of file PlatVarCleanupLib.c.
HII_VENDOR_DEVICE_PATH mVarCleanupHiiVendorDevicePath |
Definition at line 28 of file PlatVarCleanupLib.c.
EFI_GUID mVariableCleanupHiiGuid = VARIABLE_CLEANUP_HII_GUID |
Definition at line 25 of file PlatVarCleanupLib.c.
CHAR16 mVarStoreName[] = L"VariableCleanup" |
Definition at line 26 of file PlatVarCleanupLib.c.