TianoCore EDK2 master
|
#include "VariablePolicy.h"
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/HiiLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PrintLib.h>
#include <Library/ShellLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiHiiServicesLib.h>
#include <Protocol/HiiPackageList.h>
#include <Protocol/VariablePolicy.h>
Go to the source code of this file.
Macros | |
#define | VAR_POLICY_FLAG_STATS_STR L"-s" |
#define | VAR_POLICY_FLAG_POLICY_STR L"-p" |
#define | VAR_POLICY_FLAG_VERBOSE_STR L"-v" |
#define | VAR_POLICY_CMD_MIN_ATTR_STR_LEN 64 |
Functions | |
EFI_STATUS | GetAttributesString (IN UINT32 Attributes, IN UINTN AttributesStrSize, OUT CHAR16 *AttributesStr) |
VOID | PrintStats (IN UINTN TotalVariables, IN UINTN TotalVariablesSize) |
CONST VAR_POLICY_CMD_VAR_NAMESPACE * | GetNameSpaceInfo (IN EFI_GUID *VariableGuid) |
EFI_STATUS | PrintNonVerboseVarInfo (IN CHAR16 *VariableName, IN EFI_GUID *VariableGuid, IN UINTN VariableSize, IN UINT32 VariableAttributes) |
EFI_STATUS | PrintVerboseVarInfo (IN VOID *Data, IN UINTN DataSize) |
BOOLEAN | PrintVariablePolicyInfo (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid) |
EFI_STATUS | GetNextVariableNameWithDynamicReallocation (IN OUT UINTN *VariableNameBufferSize, IN OUT CHAR16 **VariableName, IN OUT EFI_GUID *VariableGuid) |
EFI_STATUS | DumpVars (IN BOOLEAN Verbose, IN BOOLEAN Stats, IN BOOLEAN PolicyCheck) |
SHELL_STATUS EFIAPI | RunVarPolicy (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) |
EFI_HII_HANDLE | InitializeHiiPackage (IN EFI_HANDLE ImageHandle) |
Variables | |
EFI_HII_HANDLE | mVarPolicyShellCommandHiiHandle = NULL |
STATIC CONST SHELL_PARAM_ITEM | ParamList [] |
STATIC CONST VAR_POLICY_CMD_VAR_NAMESPACE | mVarNamespaces [] |
Main file for the "varpolicy" dynamic UEFI shell command and application.
This feature can provide detailed UEFI variable policy configuration information in the UEFI shell.
Copyright (c) Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file VariablePolicy.c.
#define VAR_POLICY_CMD_MIN_ATTR_STR_LEN 64 |
Definition at line 32 of file VariablePolicy.c.
#define VAR_POLICY_FLAG_POLICY_STR L"-p" |
Definition at line 29 of file VariablePolicy.c.
#define VAR_POLICY_FLAG_STATS_STR L"-s" |
Definition at line 28 of file VariablePolicy.c.
#define VAR_POLICY_FLAG_VERBOSE_STR L"-v" |
Definition at line 30 of file VariablePolicy.c.
EFI_STATUS DumpVars | ( | IN BOOLEAN | Verbose, |
IN BOOLEAN | Stats, | ||
IN BOOLEAN | PolicyCheck | ||
) |
Dumps UEFI variable information.
This is the main function that enumerates UEFI variables and prints the information selected by the user.
[in] | Verbose | Whether to print verbose information. |
[in] | Stats | Whether to print statistical information. |
[in] | PolicyCheck | Whether to print variable policy related information. |
EFI_SUCCESS | The UEFI variable information was dumped successfully. |
EFI_DEVICE_ERROR | An error occurred attempting to get UEFI variable information. |
EFI_OUT_OF_RESOURCES | Insufficient memory resources to allocate a required buffer. |
Definition at line 621 of file VariablePolicy.c.
EFI_STATUS GetAttributesString | ( | IN UINT32 | Attributes, |
IN UINTN | AttributesStrSize, | ||
OUT CHAR16 * | AttributesStr | ||
) |
Returns UEFI variable attribute information in a string.
AttributesStrSize must at least be VAR_POLICY_CMD_MIN_ATTR_STR_LEN in length or EFI_INVALID_PARAMETER will be returned.
[in] | Attributes | The UEFI variable attributes. |
[in] | AttributesStrSize | The size, in bytes, of AttributesStr. |
[out] | AttributesStr | The Unicode string for the given attributes. |
EFI_SUCCESS | The attributes were converted to a string successfully. |
EFI_INVALID_PARAMETER | The AttributesStr pointer is NULL. |
Definition at line 101 of file VariablePolicy.c.
CONST VAR_POLICY_CMD_VAR_NAMESPACE * GetNameSpaceInfo | ( | IN EFI_GUID * | VariableGuid | ) |
Returns information for the given variable namespace if available.
[in] | VariableGuid | The UEFI variable vendor (namespace) GUID. |
Definition at line 194 of file VariablePolicy.c.
EFI_STATUS GetNextVariableNameWithDynamicReallocation | ( | IN OUT UINTN * | VariableNameBufferSize, |
IN OUT CHAR16 ** | VariableName, | ||
IN OUT EFI_GUID * | VariableGuid | ||
) |
Gets the next UEFI variable name.
This buffer manages the UEFI variable name buffer, performing memory reallocations as necessary.
Note: The first time this function is called, VariableNameBufferSize must be 0 and the VariableName buffer pointer must point to NULL.
[in,out] | VariableNameBufferSize | On input, a pointer to a buffer that holds the current size of the VariableName buffer in bytes. On output, a pointer to a buffer that holds the updated size of the VariableName buffer in bytes. |
[in,out] | VariableName | On input, a pointer to a pointer to a buffer that holds the current UEFI variable name. On output, a pointer to a pointer to a buffer that holds the next UEFI variable name. |
[in,out] | VariableGuid | On input, a pointer to a buffer that holds the current UEFI variable GUID. On output, a pointer to a buffer that holds the next UEFI variable GUID. |
EFI_SUCCESS | The next UEFI variable name was found successfully. |
EFI_INVALID_PARAMETER | A pointer argument is NULL or initial input values are invalid. |
EFI_OUT_OF_RESOURCES | Insufficient memory resources to allocate a required buffer. |
Others | Return status codes from the UEFI spec define GetNextVariableName() interface. |
Definition at line 543 of file VariablePolicy.c.
EFI_HII_HANDLE InitializeHiiPackage | ( | IN EFI_HANDLE | ImageHandle | ) |
Retrieve HII package list from ImageHandle and publish to HII database.
[in] | ImageHandle | The image handle of the process. |
Definition at line 858 of file VariablePolicy.c.
EFI_STATUS PrintNonVerboseVarInfo | ( | IN CHAR16 * | VariableName, |
IN EFI_GUID * | VariableGuid, | ||
IN UINTN | VariableSize, | ||
IN UINT32 | VariableAttributes | ||
) |
Print non-verbose information about the variable.
[in] | VariableName | A pointer the Unicode variable name. |
[in] | VariableGuid | A pointer to the variable vendor GUID. |
[in] | VariableSize | The size of the UEFI variable in bytes. |
[in] | VariableAttributes | The UEFI variable attributes. |
EFI_SUCCESS | The non-verbose variable information was printed successfully. |
EFI_INVALID_PARAMETER | A pointer argument passed to the function was NULL. |
EFI_OUT_OF_RESOURCES | Insufficient memory resources to print the attributes. |
Definition at line 228 of file VariablePolicy.c.
Prints UEFI variable statistics information.
[in] | TotalVariables | Total number of UEFI variables discovered. |
[in] | TotalVariablesSize | Total size of UEFI variables discovered. |
Definition at line 171 of file VariablePolicy.c.
Prints variable policy information for the given variable.
[in] | VariableName | A pointer to the Unicode string of the UEFI variable name. |
[in] | VendorGuid | A pointer to the UEFI variable vendor GUID. |
Definition at line 336 of file VariablePolicy.c.
EFI_STATUS PrintVerboseVarInfo | ( | IN VOID * | Data, |
IN UINTN | DataSize | ||
) |
Print verbose information about the variable.
[in] | Data | A pointer to the variable data buffer. |
[in] | DataSize | The size of data, in bytes, in the variable data buffer. |
EFI_SUCCESS | The verbose variable information was printed successfully. |
EFI_INVALID_PARAMETER | A pointer argument passed to the function was NULL. |
Definition at line 310 of file VariablePolicy.c.
SHELL_STATUS EFIAPI RunVarPolicy | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Main entry function for the "varpolicy" command/app.
[in] | ImageHandle | Handle to the Image (NULL if Internal). |
[in] | SystemTable | Pointer to the System Table (NULL if Internal). |
SHELL_SUCCESS | The "varpolicy" shell command executed successfully. |
SHELL_ABORTED | Failed to initialize the shell library. |
SHELL_INVALID_PARAMETER | An argument passed to the shell command is invalid. |
Others | A different error occurred. |
Definition at line 790 of file VariablePolicy.c.
STATIC CONST VAR_POLICY_CMD_VAR_NAMESPACE mVarNamespaces[] |
Definition at line 43 of file VariablePolicy.c.
EFI_HII_HANDLE mVarPolicyShellCommandHiiHandle = NULL |
Definition at line 34 of file VariablePolicy.c.
STATIC CONST SHELL_PARAM_ITEM ParamList[] |