You've already forked slimbootloader
mirror of
https://github.com/Dasharo/slimbootloader.git
synced 2026-03-06 15:26:20 -08:00
5e10bd1e07
To align with EDK2, update file license to use BSD+Patent license Signed-off-by: Guo Dong <guo.dong@intel.com>
128 lines
4.7 KiB
C
128 lines
4.7 KiB
C
/** @file
|
|
Lite variable service library
|
|
|
|
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
**/
|
|
|
|
#ifndef _VAIRABLE_LIB_H_
|
|
#define _VAIRABLE_LIB_H_
|
|
|
|
|
|
/**
|
|
|
|
This code finds variable in storage blocks (Volatile or Non-Volatile).
|
|
|
|
Caution: This function may receive untrusted input.
|
|
This function may be invoked in SMM mode, and datasize is external input.
|
|
This function will do basic validation, before parse the data.
|
|
|
|
@param VariableName Name of Variable to be found.
|
|
@param Attributes Attribute value of the variable found.
|
|
@param DataSize Size of Data found. If size is less than the
|
|
data, this value contains the required size.
|
|
@param Data The buffer to return the contents of the variable. May be NULL
|
|
with a zero DataSize in order to determine the size buffer needed.
|
|
|
|
@return EFI_INVALID_PARAMETER Invalid parameter.
|
|
@return EFI_SUCCESS Find the specified variable.
|
|
@return EFI_NOT_FOUND Not found.
|
|
@return EFI_BUFFER_TO_SMALL DataSize is too small for the result.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
GetVariable (
|
|
IN CHAR8 *VariableName,
|
|
OUT UINT8 *Attributes OPTIONAL,
|
|
IN OUT UINTN *DataSize,
|
|
OUT VOID *Data OPTIONAL
|
|
);
|
|
|
|
|
|
/**
|
|
|
|
This code Finds the Next available variable.
|
|
|
|
Caution: This function may receive untrusted input.
|
|
This function may be invoked in SMM mode. This function will do basic validation, before parse the data.
|
|
|
|
@param VariableNameSize The size of the VariableName buffer. The size must be large
|
|
enough to fit input string supplied in VariableName buffer.
|
|
@param VariableName Pointer to variable name.
|
|
@param VariableKey Pointer to variable key.
|
|
|
|
@retval EFI_SUCCESS The function completed successfully.
|
|
@retval EFI_NOT_FOUND The next variable was not found.
|
|
@retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result.
|
|
VariableNameSize has been updated with the size needed to complete the request.
|
|
@retval EFI_INVALID_PARAMETER VariableNameSize is NULL.
|
|
@retval EFI_INVALID_PARAMETER VariableName is NULL.
|
|
@retval EFI_INVALID_PARAMETER VendorGuid is NULL.
|
|
@retval EFI_INVALID_PARAMETER The input values of VariableName and VendorGuid are not a name and
|
|
GUID of an existing variable.
|
|
@retval EFI_INVALID_PARAMETER Null-terminator is not found in the first VariableNameSize bytes of
|
|
the input VariableName buffer.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
GetNextVariableName (
|
|
IN OUT UINTN *VariableNameSize,
|
|
IN OUT CHAR8 *VariableName,
|
|
IN OUT UINTN *VariableKey
|
|
);
|
|
|
|
|
|
/**
|
|
|
|
This code sets variable in storage blocks (Volatile or Non-Volatile).
|
|
|
|
Caution: This function may receive untrusted input.
|
|
This function may be invoked in SMM mode, and datasize and data are external input.
|
|
This function will do basic validation, before parse the data.
|
|
This function will parse the authentication carefully to avoid security issues, like
|
|
buffer overflow, integer overflow.
|
|
This function will check attribute carefully to avoid authentication bypass.
|
|
|
|
@param VariableName Name of Variable to be found.
|
|
@param Attributes Attribute value of the variable found
|
|
@param DataSize Size of Data found. If size is less than the
|
|
data, this value contains the required size.
|
|
@param Data Data pointer.
|
|
|
|
@return EFI_INVALID_PARAMETER Invalid parameter.
|
|
@return EFI_SUCCESS Set successfully.
|
|
@return EFI_OUT_OF_RESOURCES Resource not enough to set variable.
|
|
@return EFI_NOT_FOUND Not found.
|
|
@return EFI_WRITE_PROTECTED Variable is read-only.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
SetVariable (
|
|
IN CHAR8 *VariableName,
|
|
IN UINT8 Attributes,
|
|
IN UINTN DataSize,
|
|
IN VOID *Data
|
|
);
|
|
|
|
/**
|
|
Initialize an varaible instance.
|
|
Base needs to be 4KB aligned and Size needs to be 8KB aligned.
|
|
|
|
@param Base Variable storage region base
|
|
@param Size Variable storage region size
|
|
@retval EFI_SUCCESS The instance was properly initialized
|
|
@retval EFI_INVALID_PARAMETER Base or size is invalid
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
VariableConstructor (
|
|
IN UINT32 Base,
|
|
IN UINT32 Size
|
|
);
|
|
|
|
#endif
|