diff options
Diffstat (limited to 'MdeModulePkg/Include/Library')
36 files changed, 6457 insertions, 6457 deletions
diff --git a/MdeModulePkg/Include/Library/AuthVariableLib.h b/MdeModulePkg/Include/Library/AuthVariableLib.h index 37aceba699..1f2c292902 100644 --- a/MdeModulePkg/Include/Library/AuthVariableLib.h +++ b/MdeModulePkg/Include/Library/AuthVariableLib.h @@ -1,254 +1,254 @@ -/** @file
- Provides services to initialize and process authenticated variables.
-
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _AUTH_VARIABLE_LIB_H_
-#define _AUTH_VARIABLE_LIB_H_
-
-#include <Protocol/VarCheck.h>
-
-///
-/// Size of AuthInfo prior to the data payload.
-///
-#define AUTHINFO_SIZE ((OFFSET_OF (EFI_VARIABLE_AUTHENTICATION, AuthInfo)) +\
- (OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData)) + \
- sizeof (EFI_CERT_BLOCK_RSA_2048_SHA256))
-
-#define AUTHINFO2_SIZE(VarAuth2) ((OFFSET_OF (EFI_VARIABLE_AUTHENTICATION_2, AuthInfo)) +\
- (UINTN) ((EFI_VARIABLE_AUTHENTICATION_2 *) (VarAuth2))->AuthInfo.Hdr.dwLength)
-
-#define OFFSET_OF_AUTHINFO2_CERT_DATA ((OFFSET_OF (EFI_VARIABLE_AUTHENTICATION_2, AuthInfo)) +\
- (OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData)))
-
-typedef struct {
- CHAR16 *VariableName;
- EFI_GUID *VendorGuid;
- UINT32 Attributes;
- UINTN DataSize;
- VOID *Data;
- UINT32 PubKeyIndex;
- UINT64 MonotonicCount;
- EFI_TIME *TimeStamp;
-} AUTH_VARIABLE_INFO;
-
-/**
- Finds variable in storage blocks of volatile and non-volatile storage areas.
-
- This code finds variable in storage blocks of volatile and non-volatile storage areas.
- If VariableName is an empty string, then we just return the first
- qualified variable without comparing VariableName and VendorGuid.
-
- @param[in] VariableName Name of the variable to be found.
- @param[in] VendorGuid Variable vendor GUID to be found.
- @param[out] AuthVariableInfo Pointer to AUTH_VARIABLE_INFO structure for
- output of the variable found.
-
- @retval EFI_INVALID_PARAMETER If VariableName is not an empty string,
- while VendorGuid is NULL.
- @retval EFI_SUCCESS Variable successfully found.
- @retval EFI_NOT_FOUND Variable not found
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *AUTH_VAR_LIB_FIND_VARIABLE)(
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- OUT AUTH_VARIABLE_INFO *AuthVariableInfo
- );
-
-/**
- Finds next variable in storage blocks of volatile and non-volatile storage areas.
-
- This code finds next variable in storage blocks of volatile and non-volatile storage areas.
- If VariableName is an empty string, then we just return the first
- qualified variable without comparing VariableName and VendorGuid.
-
- @param[in] VariableName Name of the variable to be found.
- @param[in] VendorGuid Variable vendor GUID to be found.
- @param[out] AuthVariableInfo Pointer to AUTH_VARIABLE_INFO structure for
- output of the next variable.
-
- @retval EFI_INVALID_PARAMETER If VariableName is not an empty string,
- while VendorGuid is NULL.
- @retval EFI_SUCCESS Variable successfully found.
- @retval EFI_NOT_FOUND Variable not found
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *AUTH_VAR_LIB_FIND_NEXT_VARIABLE)(
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- OUT AUTH_VARIABLE_INFO *AuthVariableInfo
- );
-
-/**
- Update the variable region with Variable information.
-
- @param[in] AuthVariableInfo Pointer AUTH_VARIABLE_INFO structure for
- input of the variable.
-
- @retval EFI_SUCCESS The update operation is success.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
- @retval EFI_WRITE_PROTECTED Variable is write-protected.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *AUTH_VAR_LIB_UPDATE_VARIABLE)(
- IN AUTH_VARIABLE_INFO *AuthVariableInfo
- );
-
-/**
- Get scratch buffer.
-
- @param[in, out] ScratchBufferSize Scratch buffer size. If input size is greater than
- the maximum supported buffer size, this value contains
- the maximum supported buffer size as output.
- @param[out] ScratchBuffer Pointer to scratch buffer address.
-
- @retval EFI_SUCCESS Get scratch buffer successfully.
- @retval EFI_UNSUPPORTED If input size is greater than the maximum supported buffer size.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *AUTH_VAR_LIB_GET_SCRATCH_BUFFER)(
- IN OUT UINTN *ScratchBufferSize,
- OUT VOID **ScratchBuffer
- );
-
-/**
- This function is to check if the remaining variable space is enough to set
- all Variables from argument list successfully. The purpose of the check
- is to keep the consistency of the Variables to be in variable storage.
-
- Note: Variables are assumed to be in same storage.
- The set sequence of Variables will be same with the sequence of VariableEntry from argument list,
- so follow the argument sequence to check the Variables.
-
- @param[in] Attributes Variable attributes for Variable entries.
- @param ... The variable argument list with type VARIABLE_ENTRY_CONSISTENCY *.
- A NULL terminates the list. The VariableSize of
- VARIABLE_ENTRY_CONSISTENCY is the variable data size as input.
- It will be changed to variable total size as output.
-
- @retval TRUE Have enough variable space to set the Variables successfully.
- @retval FALSE No enough variable space to set the Variables successfully.
-
-**/
-typedef
-BOOLEAN
-(EFIAPI *AUTH_VAR_LIB_CHECK_REMAINING_SPACE)(
- IN UINT32 Attributes,
- ...
- );
-
-/**
- Return TRUE if at OS runtime.
-
- @retval TRUE If at OS runtime.
- @retval FALSE If at boot time.
-
-**/
-typedef
-BOOLEAN
-(EFIAPI *AUTH_VAR_LIB_AT_RUNTIME)(
- VOID
- );
-
-#define AUTH_VAR_LIB_CONTEXT_IN_STRUCT_VERSION 0x01
-
-typedef struct {
- UINTN StructVersion;
- UINTN StructSize;
- //
- // Reflect the overhead associated with the saving
- // of a single EFI authenticated variable with the exception
- // of the overhead associated with the length
- // of the string name of the EFI variable.
- //
- UINTN MaxAuthVariableSize;
- AUTH_VAR_LIB_FIND_VARIABLE FindVariable;
- AUTH_VAR_LIB_FIND_NEXT_VARIABLE FindNextVariable;
- AUTH_VAR_LIB_UPDATE_VARIABLE UpdateVariable;
- AUTH_VAR_LIB_GET_SCRATCH_BUFFER GetScratchBuffer;
- AUTH_VAR_LIB_CHECK_REMAINING_SPACE CheckRemainingSpaceForConsistency;
- AUTH_VAR_LIB_AT_RUNTIME AtRuntime;
-} AUTH_VAR_LIB_CONTEXT_IN;
-
-#define AUTH_VAR_LIB_CONTEXT_OUT_STRUCT_VERSION 0x01
-
-typedef struct {
- UINTN StructVersion;
- UINTN StructSize;
- //
- // Caller needs to set variable property for the variables.
- //
- VARIABLE_ENTRY_PROPERTY *AuthVarEntry;
- UINTN AuthVarEntryCount;
- //
- // Caller needs to ConvertPointer() for the pointers.
- //
- VOID ***AddressPointer;
- UINTN AddressPointerCount;
-} AUTH_VAR_LIB_CONTEXT_OUT;
-
-/**
- Initialization for authenticated varibale services.
- If this initialization returns error status, other APIs will not work
- and expect to be not called then.
-
- @param[in] AuthVarLibContextIn Pointer to input auth variable lib context.
- @param[out] AuthVarLibContextOut Pointer to output auth variable lib context.
-
- @retval EFI_SUCCESS Function successfully executed.
- @retval EFI_INVALID_PARAMETER If AuthVarLibContextIn == NULL or AuthVarLibContextOut == NULL.
- @retval EFI_OUT_OF_RESOURCES Fail to allocate enough resource.
- @retval EFI_UNSUPPORTED Unsupported to process authenticated variable.
-
-**/
-EFI_STATUS
-EFIAPI
-AuthVariableLibInitialize (
- IN AUTH_VAR_LIB_CONTEXT_IN *AuthVarLibContextIn,
- OUT AUTH_VAR_LIB_CONTEXT_OUT *AuthVarLibContextOut
- );
-
-/**
- Process variable with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set.
-
- @param[in] VariableName Name of the variable.
- @param[in] VendorGuid Variable vendor GUID.
- @param[in] Data Data pointer.
- @param[in] DataSize Size of Data.
- @param[in] Attributes Attribute value of the variable.
-
- @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
- defined by the Attributes.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
- @retval EFI_WRITE_PROTECTED Variable is write-protected.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource.
- @retval EFI_SECURITY_VIOLATION The variable is with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS
- set, but the AuthInfo does NOT pass the validation
- check carried out by the firmware.
- @retval EFI_UNSUPPORTED Unsupported to process authenticated variable.
-
-**/
-EFI_STATUS
-EFIAPI
-AuthVariableLibProcessVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN VOID *Data,
- IN UINTN DataSize,
- IN UINT32 Attributes
- );
-
-#endif
+/** @file + Provides services to initialize and process authenticated variables. + +Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _AUTH_VARIABLE_LIB_H_ +#define _AUTH_VARIABLE_LIB_H_ + +#include <Protocol/VarCheck.h> + +/// +/// Size of AuthInfo prior to the data payload. +/// +#define AUTHINFO_SIZE ((OFFSET_OF (EFI_VARIABLE_AUTHENTICATION, AuthInfo)) +\ + (OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData)) + \ + sizeof (EFI_CERT_BLOCK_RSA_2048_SHA256)) + +#define AUTHINFO2_SIZE(VarAuth2) ((OFFSET_OF (EFI_VARIABLE_AUTHENTICATION_2, AuthInfo)) +\ + (UINTN) ((EFI_VARIABLE_AUTHENTICATION_2 *) (VarAuth2))->AuthInfo.Hdr.dwLength) + +#define OFFSET_OF_AUTHINFO2_CERT_DATA ((OFFSET_OF (EFI_VARIABLE_AUTHENTICATION_2, AuthInfo)) +\ + (OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData))) + +typedef struct { + CHAR16 *VariableName; + EFI_GUID *VendorGuid; + UINT32 Attributes; + UINTN DataSize; + VOID *Data; + UINT32 PubKeyIndex; + UINT64 MonotonicCount; + EFI_TIME *TimeStamp; +} AUTH_VARIABLE_INFO; + +/** + Finds variable in storage blocks of volatile and non-volatile storage areas. + + This code finds variable in storage blocks of volatile and non-volatile storage areas. + If VariableName is an empty string, then we just return the first + qualified variable without comparing VariableName and VendorGuid. + + @param[in] VariableName Name of the variable to be found. + @param[in] VendorGuid Variable vendor GUID to be found. + @param[out] AuthVariableInfo Pointer to AUTH_VARIABLE_INFO structure for + output of the variable found. + + @retval EFI_INVALID_PARAMETER If VariableName is not an empty string, + while VendorGuid is NULL. + @retval EFI_SUCCESS Variable successfully found. + @retval EFI_NOT_FOUND Variable not found + +**/ +typedef +EFI_STATUS +(EFIAPI *AUTH_VAR_LIB_FIND_VARIABLE)( + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + OUT AUTH_VARIABLE_INFO *AuthVariableInfo + ); + +/** + Finds next variable in storage blocks of volatile and non-volatile storage areas. + + This code finds next variable in storage blocks of volatile and non-volatile storage areas. + If VariableName is an empty string, then we just return the first + qualified variable without comparing VariableName and VendorGuid. + + @param[in] VariableName Name of the variable to be found. + @param[in] VendorGuid Variable vendor GUID to be found. + @param[out] AuthVariableInfo Pointer to AUTH_VARIABLE_INFO structure for + output of the next variable. + + @retval EFI_INVALID_PARAMETER If VariableName is not an empty string, + while VendorGuid is NULL. + @retval EFI_SUCCESS Variable successfully found. + @retval EFI_NOT_FOUND Variable not found + +**/ +typedef +EFI_STATUS +(EFIAPI *AUTH_VAR_LIB_FIND_NEXT_VARIABLE)( + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + OUT AUTH_VARIABLE_INFO *AuthVariableInfo + ); + +/** + Update the variable region with Variable information. + + @param[in] AuthVariableInfo Pointer AUTH_VARIABLE_INFO structure for + input of the variable. + + @retval EFI_SUCCESS The update operation is success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_WRITE_PROTECTED Variable is write-protected. + @retval EFI_OUT_OF_RESOURCES There is not enough resource. + +**/ +typedef +EFI_STATUS +(EFIAPI *AUTH_VAR_LIB_UPDATE_VARIABLE)( + IN AUTH_VARIABLE_INFO *AuthVariableInfo + ); + +/** + Get scratch buffer. + + @param[in, out] ScratchBufferSize Scratch buffer size. If input size is greater than + the maximum supported buffer size, this value contains + the maximum supported buffer size as output. + @param[out] ScratchBuffer Pointer to scratch buffer address. + + @retval EFI_SUCCESS Get scratch buffer successfully. + @retval EFI_UNSUPPORTED If input size is greater than the maximum supported buffer size. + +**/ +typedef +EFI_STATUS +(EFIAPI *AUTH_VAR_LIB_GET_SCRATCH_BUFFER)( + IN OUT UINTN *ScratchBufferSize, + OUT VOID **ScratchBuffer + ); + +/** + This function is to check if the remaining variable space is enough to set + all Variables from argument list successfully. The purpose of the check + is to keep the consistency of the Variables to be in variable storage. + + Note: Variables are assumed to be in same storage. + The set sequence of Variables will be same with the sequence of VariableEntry from argument list, + so follow the argument sequence to check the Variables. + + @param[in] Attributes Variable attributes for Variable entries. + @param ... The variable argument list with type VARIABLE_ENTRY_CONSISTENCY *. + A NULL terminates the list. The VariableSize of + VARIABLE_ENTRY_CONSISTENCY is the variable data size as input. + It will be changed to variable total size as output. + + @retval TRUE Have enough variable space to set the Variables successfully. + @retval FALSE No enough variable space to set the Variables successfully. + +**/ +typedef +BOOLEAN +(EFIAPI *AUTH_VAR_LIB_CHECK_REMAINING_SPACE)( + IN UINT32 Attributes, + ... + ); + +/** + Return TRUE if at OS runtime. + + @retval TRUE If at OS runtime. + @retval FALSE If at boot time. + +**/ +typedef +BOOLEAN +(EFIAPI *AUTH_VAR_LIB_AT_RUNTIME)( + VOID + ); + +#define AUTH_VAR_LIB_CONTEXT_IN_STRUCT_VERSION 0x01 + +typedef struct { + UINTN StructVersion; + UINTN StructSize; + // + // Reflect the overhead associated with the saving + // of a single EFI authenticated variable with the exception + // of the overhead associated with the length + // of the string name of the EFI variable. + // + UINTN MaxAuthVariableSize; + AUTH_VAR_LIB_FIND_VARIABLE FindVariable; + AUTH_VAR_LIB_FIND_NEXT_VARIABLE FindNextVariable; + AUTH_VAR_LIB_UPDATE_VARIABLE UpdateVariable; + AUTH_VAR_LIB_GET_SCRATCH_BUFFER GetScratchBuffer; + AUTH_VAR_LIB_CHECK_REMAINING_SPACE CheckRemainingSpaceForConsistency; + AUTH_VAR_LIB_AT_RUNTIME AtRuntime; +} AUTH_VAR_LIB_CONTEXT_IN; + +#define AUTH_VAR_LIB_CONTEXT_OUT_STRUCT_VERSION 0x01 + +typedef struct { + UINTN StructVersion; + UINTN StructSize; + // + // Caller needs to set variable property for the variables. + // + VARIABLE_ENTRY_PROPERTY *AuthVarEntry; + UINTN AuthVarEntryCount; + // + // Caller needs to ConvertPointer() for the pointers. + // + VOID ***AddressPointer; + UINTN AddressPointerCount; +} AUTH_VAR_LIB_CONTEXT_OUT; + +/** + Initialization for authenticated varibale services. + If this initialization returns error status, other APIs will not work + and expect to be not called then. + + @param[in] AuthVarLibContextIn Pointer to input auth variable lib context. + @param[out] AuthVarLibContextOut Pointer to output auth variable lib context. + + @retval EFI_SUCCESS Function successfully executed. + @retval EFI_INVALID_PARAMETER If AuthVarLibContextIn == NULL or AuthVarLibContextOut == NULL. + @retval EFI_OUT_OF_RESOURCES Fail to allocate enough resource. + @retval EFI_UNSUPPORTED Unsupported to process authenticated variable. + +**/ +EFI_STATUS +EFIAPI +AuthVariableLibInitialize ( + IN AUTH_VAR_LIB_CONTEXT_IN *AuthVarLibContextIn, + OUT AUTH_VAR_LIB_CONTEXT_OUT *AuthVarLibContextOut + ); + +/** + Process variable with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set. + + @param[in] VariableName Name of the variable. + @param[in] VendorGuid Variable vendor GUID. + @param[in] Data Data pointer. + @param[in] DataSize Size of Data. + @param[in] Attributes Attribute value of the variable. + + @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as + defined by the Attributes. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_WRITE_PROTECTED Variable is write-protected. + @retval EFI_OUT_OF_RESOURCES There is not enough resource. + @retval EFI_SECURITY_VIOLATION The variable is with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS + set, but the AuthInfo does NOT pass the validation + check carried out by the firmware. + @retval EFI_UNSUPPORTED Unsupported to process authenticated variable. + +**/ +EFI_STATUS +EFIAPI +AuthVariableLibProcessVariable ( + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + IN VOID *Data, + IN UINTN DataSize, + IN UINT32 Attributes + ); + +#endif diff --git a/MdeModulePkg/Include/Library/BmpSupportLib.h b/MdeModulePkg/Include/Library/BmpSupportLib.h index 3f1f4beaee..6361653d4e 100644 --- a/MdeModulePkg/Include/Library/BmpSupportLib.h +++ b/MdeModulePkg/Include/Library/BmpSupportLib.h @@ -1,89 +1,89 @@ -/** @file
-
-Provides services to convert a BMP graphics image to a GOP BLT buffer
-and to convert a GOP BLT buffer to a BMP graphics image.
-
-Copyright (c) 2016, Microsoft Corporation
-Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-
-All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __BMP_SUPPORT_LIB_H__
-#define __BMP_SUPPORT_LIB_H__
-
-#include <Protocol/GraphicsOutput.h>
-
-/**
- Translate a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
- is passed in a GopBlt buffer will be allocated by this routine using
- EFI_BOOT_SERVICES.AllocatePool(). If a GopBlt buffer is passed in it will be
- used if it is big enough.
-
- @param [in] BmpImage Pointer to BMP file.
- @param [in] BmpImageSize Number of bytes in BmpImage.
- @param [in, out] GopBlt Buffer containing GOP version of BmpImage.
- @param [in, out] GopBltSize Size of GopBlt in bytes.
- @param [out] PixelHeight Height of GopBlt/BmpImage in pixels.
- @param [out] PixelWidth Width of GopBlt/BmpImage in pixels.
-
- @retval RETURN_SUCCESS GopBlt and GopBltSize are returned.
- @retval RETURN_INVALID_PARAMETER BmpImage is NULL.
- @retval RETURN_INVALID_PARAMETER GopBlt is NULL.
- @retval RETURN_INVALID_PARAMETER GopBltSize is NULL.
- @retval RETURN_INVALID_PARAMETER PixelHeight is NULL.
- @retval RETURN_INVALID_PARAMETER PixelWidth is NULL.
- @retval RETURN_UNSUPPORTED BmpImage is not a valid *.BMP image.
- @retval RETURN_BUFFER_TOO_SMALL The passed in GopBlt buffer is not big
- enough. The required size is returned in
- GopBltSize.
- @retval RETURN_OUT_OF_RESOURCES The GopBlt buffer could not be allocated.
-
-**/
-RETURN_STATUS
-EFIAPI
-TranslateBmpToGopBlt (
- IN VOID *BmpImage,
- IN UINTN BmpImageSize,
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **GopBlt,
- IN OUT UINTN *GopBltSize,
- OUT UINTN *PixelHeight,
- OUT UINTN *PixelWidth
- );
-
-/**
- Translate a GOP blt buffer to an uncompressed 24-bit per pixel BMP graphics
- image. If a NULL BmpImage is passed in a BmpImage buffer will be allocated by
- this routine using EFI_BOOT_SERVICES.AllocatePool(). If a BmpImage buffer is
- passed in it will be used if it is big enough.
-
- @param [in] GopBlt Pointer to GOP blt buffer.
- @param [in] PixelHeight Height of GopBlt/BmpImage in pixels.
- @param [in] PixelWidth Width of GopBlt/BmpImage in pixels.
- @param [in, out] BmpImage Buffer containing BMP version of GopBlt.
- @param [in, out] BmpImageSize Size of BmpImage in bytes.
-
- @retval RETURN_SUCCESS BmpImage and BmpImageSize are returned.
- @retval RETURN_INVALID_PARAMETER GopBlt is NULL.
- @retval RETURN_INVALID_PARAMETER BmpImage is NULL.
- @retval RETURN_INVALID_PARAMETER BmpImageSize is NULL.
- @retval RETURN_UNSUPPORTED GopBlt cannot be converted to a *.BMP image.
- @retval RETURN_BUFFER_TOO_SMALL The passed in BmpImage buffer is not big
- enough. The required size is returned in
- BmpImageSize.
- @retval RETURN_OUT_OF_RESOURCES The BmpImage buffer could not be allocated.
-
-**/
-RETURN_STATUS
-EFIAPI
-TranslateGopBltToBmp (
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *GopBlt,
- IN UINT32 PixelHeight,
- IN UINT32 PixelWidth,
- IN OUT VOID **BmpImage,
- IN OUT UINT32 *BmpImageSize
- );
-
-#endif
+/** @file + +Provides services to convert a BMP graphics image to a GOP BLT buffer +and to convert a GOP BLT buffer to a BMP graphics image. + +Copyright (c) 2016, Microsoft Corporation +Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> + +All rights reserved. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __BMP_SUPPORT_LIB_H__ +#define __BMP_SUPPORT_LIB_H__ + +#include <Protocol/GraphicsOutput.h> + +/** + Translate a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer + is passed in a GopBlt buffer will be allocated by this routine using + EFI_BOOT_SERVICES.AllocatePool(). If a GopBlt buffer is passed in it will be + used if it is big enough. + + @param [in] BmpImage Pointer to BMP file. + @param [in] BmpImageSize Number of bytes in BmpImage. + @param [in, out] GopBlt Buffer containing GOP version of BmpImage. + @param [in, out] GopBltSize Size of GopBlt in bytes. + @param [out] PixelHeight Height of GopBlt/BmpImage in pixels. + @param [out] PixelWidth Width of GopBlt/BmpImage in pixels. + + @retval RETURN_SUCCESS GopBlt and GopBltSize are returned. + @retval RETURN_INVALID_PARAMETER BmpImage is NULL. + @retval RETURN_INVALID_PARAMETER GopBlt is NULL. + @retval RETURN_INVALID_PARAMETER GopBltSize is NULL. + @retval RETURN_INVALID_PARAMETER PixelHeight is NULL. + @retval RETURN_INVALID_PARAMETER PixelWidth is NULL. + @retval RETURN_UNSUPPORTED BmpImage is not a valid *.BMP image. + @retval RETURN_BUFFER_TOO_SMALL The passed in GopBlt buffer is not big + enough. The required size is returned in + GopBltSize. + @retval RETURN_OUT_OF_RESOURCES The GopBlt buffer could not be allocated. + +**/ +RETURN_STATUS +EFIAPI +TranslateBmpToGopBlt ( + IN VOID *BmpImage, + IN UINTN BmpImageSize, + IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **GopBlt, + IN OUT UINTN *GopBltSize, + OUT UINTN *PixelHeight, + OUT UINTN *PixelWidth + ); + +/** + Translate a GOP blt buffer to an uncompressed 24-bit per pixel BMP graphics + image. If a NULL BmpImage is passed in a BmpImage buffer will be allocated by + this routine using EFI_BOOT_SERVICES.AllocatePool(). If a BmpImage buffer is + passed in it will be used if it is big enough. + + @param [in] GopBlt Pointer to GOP blt buffer. + @param [in] PixelHeight Height of GopBlt/BmpImage in pixels. + @param [in] PixelWidth Width of GopBlt/BmpImage in pixels. + @param [in, out] BmpImage Buffer containing BMP version of GopBlt. + @param [in, out] BmpImageSize Size of BmpImage in bytes. + + @retval RETURN_SUCCESS BmpImage and BmpImageSize are returned. + @retval RETURN_INVALID_PARAMETER GopBlt is NULL. + @retval RETURN_INVALID_PARAMETER BmpImage is NULL. + @retval RETURN_INVALID_PARAMETER BmpImageSize is NULL. + @retval RETURN_UNSUPPORTED GopBlt cannot be converted to a *.BMP image. + @retval RETURN_BUFFER_TOO_SMALL The passed in BmpImage buffer is not big + enough. The required size is returned in + BmpImageSize. + @retval RETURN_OUT_OF_RESOURCES The BmpImage buffer could not be allocated. + +**/ +RETURN_STATUS +EFIAPI +TranslateGopBltToBmp ( + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *GopBlt, + IN UINT32 PixelHeight, + IN UINT32 PixelWidth, + IN OUT VOID **BmpImage, + IN OUT UINT32 *BmpImageSize + ); + +#endif diff --git a/MdeModulePkg/Include/Library/BootLogoLib.h b/MdeModulePkg/Include/Library/BootLogoLib.h index 2d6209a278..6e0017c14b 100644 --- a/MdeModulePkg/Include/Library/BootLogoLib.h +++ b/MdeModulePkg/Include/Library/BootLogoLib.h @@ -1,63 +1,63 @@ -/** @file
- This library is only intended to be used by PlatformBootManagerLib
- to show progress bar and LOGO.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _BOOT_LOGO_LIB_H_
-#define _BOOT_LOGO_LIB_H_
-
-#include <Protocol/PlatformLogo.h>
-#include <Protocol/GraphicsOutput.h>
-
-/**
- Show LOGO returned from Edkii Platform Logo protocol on all consoles.
-**/
-EFI_STATUS
-EFIAPI
-BootLogoEnableLogo (
- VOID
- );
-
-/**
- Use SystemTable ConOut to turn on video based Simple Text Out consoles. The
- Simple Text Out screens will now be synced up with all non-video output devices.
-
- @retval EFI_SUCCESS UGA devices are back in text mode and synced up.
-
-**/
-EFI_STATUS
-EFIAPI
-BootLogoDisableLogo (
- VOID
- );
-
-/**
-
- Update progress bar with title above it. It only works in Graphics mode.
-
- @param TitleForeground Foreground color for Title.
- @param TitleBackground Background color for Title.
- @param Title Title above progress bar.
- @param ProgressColor Progress bar color.
- @param Progress Progress (0-100)
- @param PreviousValue The previous value of the progress.
-
- @retval EFI_STATUS Successly update the progress bar
-
-**/
-EFI_STATUS
-EFIAPI
-BootLogoUpdateProgress (
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
- IN CHAR16 *Title,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
- IN UINTN Progress,
- IN UINTN PreviousValue
- );
-
-#endif
+/** @file + This library is only intended to be used by PlatformBootManagerLib + to show progress bar and LOGO. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _BOOT_LOGO_LIB_H_ +#define _BOOT_LOGO_LIB_H_ + +#include <Protocol/PlatformLogo.h> +#include <Protocol/GraphicsOutput.h> + +/** + Show LOGO returned from Edkii Platform Logo protocol on all consoles. +**/ +EFI_STATUS +EFIAPI +BootLogoEnableLogo ( + VOID + ); + +/** + Use SystemTable ConOut to turn on video based Simple Text Out consoles. The + Simple Text Out screens will now be synced up with all non-video output devices. + + @retval EFI_SUCCESS UGA devices are back in text mode and synced up. + +**/ +EFI_STATUS +EFIAPI +BootLogoDisableLogo ( + VOID + ); + +/** + + Update progress bar with title above it. It only works in Graphics mode. + + @param TitleForeground Foreground color for Title. + @param TitleBackground Background color for Title. + @param Title Title above progress bar. + @param ProgressColor Progress bar color. + @param Progress Progress (0-100) + @param PreviousValue The previous value of the progress. + + @retval EFI_STATUS Successly update the progress bar + +**/ +EFI_STATUS +EFIAPI +BootLogoUpdateProgress ( + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground, + IN CHAR16 *Title, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor, + IN UINTN Progress, + IN UINTN PreviousValue + ); + +#endif diff --git a/MdeModulePkg/Include/Library/CapsuleLib.h b/MdeModulePkg/Include/Library/CapsuleLib.h index 92904ebfb6..66f755ba8c 100644 --- a/MdeModulePkg/Include/Library/CapsuleLib.h +++ b/MdeModulePkg/Include/Library/CapsuleLib.h @@ -1,160 +1,160 @@ -/** @file
-
- This library class defines a set of interfaces for how to process capsule image updates.
-
-Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __CAPSULE_LIB_H__
-#define __CAPSULE_LIB_H__
-
-//
-// BOOLEAN Variable to indicate whether system is in the capsule on disk state.
-//
-#define COD_RELOCATION_INFO_VAR_NAME L"CodRelocationInfo"
-
-/**
- The firmware checks whether the capsule image is supported
- by the CapsuleGuid in CapsuleHeader or if there is other specific information in
- the capsule image.
-
- Caution: This function may receive untrusted input.
-
- @param CapsuleHeader Pointer to the UEFI capsule image to be checked.
-
- @retval EFI_SUCESS Input capsule is supported by firmware.
- @retval EFI_UNSUPPORTED Input capsule is not supported by the firmware.
-**/
-EFI_STATUS
-EFIAPI
-SupportCapsuleImage (
- IN EFI_CAPSULE_HEADER *CapsuleHeader
- );
-
-/**
- The firmware-specific implementation processes the capsule image
- if it recognized the format of this capsule image.
-
- Caution: This function may receive untrusted input.
-
- @param CapsuleHeader Pointer to the UEFI capsule image to be processed.
-
- @retval EFI_SUCESS Capsule Image processed successfully.
- @retval EFI_UNSUPPORTED Capsule image is not supported by the firmware.
-**/
-EFI_STATUS
-EFIAPI
-ProcessCapsuleImage (
- IN EFI_CAPSULE_HEADER *CapsuleHeader
- );
-
-/**
-
- This routine is called to process capsules.
-
- Caution: This function may receive untrusted input.
-
- The capsules reported in EFI_HOB_UEFI_CAPSULE are processed.
- If there is no EFI_HOB_UEFI_CAPSULE, this routine does nothing.
-
- This routine should be called twice in BDS.
- 1) The first call must be before EndOfDxe. The system capsules is processed.
- If device capsule FMP protocols are exposted at this time and device FMP
- capsule has zero EmbeddedDriverCount, the device capsules are processed.
- Each individual capsule result is recorded in capsule record variable.
- System may reset in this function, if reset is required by capsule and
- all capsules are processed.
- If not all capsules are processed, reset will be defered to second call.
-
- 2) The second call must be after EndOfDxe and after ConnectAll, so that all
- device capsule FMP protocols are exposed.
- The system capsules are skipped. If the device capsules are NOT processed
- in first call, they are processed here.
- Each individual capsule result is recorded in capsule record variable.
- System may reset in this function, if reset is required by capsule
- processed in first call and second call.
-
- @retval EFI_SUCCESS There is no error when processing capsules.
- @retval EFI_OUT_OF_RESOURCES No enough resource to process capsules.
-
-**/
-EFI_STATUS
-EFIAPI
-ProcessCapsules (
- VOID
- );
-
-/**
- This routine is called to check if CapsuleOnDisk flag in OsIndications Variable
- is enabled.
-
- @retval TRUE Flag is enabled
- @retval FALSE Flag is not enabled
-
-**/
-BOOLEAN
-EFIAPI
-CoDCheckCapsuleOnDiskFlag (
- VOID
- );
-
-/**
- This routine is called to clear CapsuleOnDisk flags including OsIndications and BootNext variable.
-
- @retval EFI_SUCCESS All Capsule On Disk flags are cleared
-
-**/
-EFI_STATUS
-EFIAPI
-CoDClearCapsuleOnDiskFlag (
- VOID
- );
-
-/**
- Relocate Capsule on Disk from EFI system partition.
-
- Two solution to deliver Capsule On Disk:
- Solution A: If PcdCapsuleInRamSupport is enabled, relocate Capsule On Disk to memory and call UpdateCapsule().
- Solution B: If PcdCapsuleInRamSupport is disabled, relocate Capsule On Disk to a platform-specific NV storage
- device with BlockIo protocol.
-
- Device enumeration like USB costs time, user can input MaxRetry to tell function to retry.
- Function will stall 100ms between each retry.
-
- Side Effects:
- Capsule Delivery Supported Flag in OsIndication variable and BootNext variable will be cleared.
- Solution B: Content corruption. Block IO write directly touches low level write. Orignal partitions, file
- systems of the relocation device will be corrupted.
-
- @param[in] MaxRetry Max Connection Retry. Stall 100ms between each connection try to ensure
- devices like USB can get enumerated. Input 0 means no retry.
-
- @retval EFI_SUCCESS Capsule on Disk images are successfully relocated.
-
-**/
-EFI_STATUS
-EFIAPI
-CoDRelocateCapsule (
- UINTN MaxRetry
- );
-
-/**
- Remove the temp file from the root of EFI System Partition.
- Device enumeration like USB costs time, user can input MaxRetry to tell function to retry.
- Function will stall 100ms between each retry.
-
- @param[in] MaxRetry Max Connection Retry. Stall 100ms between each connection try to ensure
- devices like USB can get enumerated. Input 0 means no retry.
-
- @retval EFI_SUCCESS Remove the temp file successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-CoDRemoveTempFile (
- UINTN MaxRetry
- );
-
-#endif
+/** @file + + This library class defines a set of interfaces for how to process capsule image updates. + +Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __CAPSULE_LIB_H__ +#define __CAPSULE_LIB_H__ + +// +// BOOLEAN Variable to indicate whether system is in the capsule on disk state. +// +#define COD_RELOCATION_INFO_VAR_NAME L"CodRelocationInfo" + +/** + The firmware checks whether the capsule image is supported + by the CapsuleGuid in CapsuleHeader or if there is other specific information in + the capsule image. + + Caution: This function may receive untrusted input. + + @param CapsuleHeader Pointer to the UEFI capsule image to be checked. + + @retval EFI_SUCESS Input capsule is supported by firmware. + @retval EFI_UNSUPPORTED Input capsule is not supported by the firmware. +**/ +EFI_STATUS +EFIAPI +SupportCapsuleImage ( + IN EFI_CAPSULE_HEADER *CapsuleHeader + ); + +/** + The firmware-specific implementation processes the capsule image + if it recognized the format of this capsule image. + + Caution: This function may receive untrusted input. + + @param CapsuleHeader Pointer to the UEFI capsule image to be processed. + + @retval EFI_SUCESS Capsule Image processed successfully. + @retval EFI_UNSUPPORTED Capsule image is not supported by the firmware. +**/ +EFI_STATUS +EFIAPI +ProcessCapsuleImage ( + IN EFI_CAPSULE_HEADER *CapsuleHeader + ); + +/** + + This routine is called to process capsules. + + Caution: This function may receive untrusted input. + + The capsules reported in EFI_HOB_UEFI_CAPSULE are processed. + If there is no EFI_HOB_UEFI_CAPSULE, this routine does nothing. + + This routine should be called twice in BDS. + 1) The first call must be before EndOfDxe. The system capsules is processed. + If device capsule FMP protocols are exposted at this time and device FMP + capsule has zero EmbeddedDriverCount, the device capsules are processed. + Each individual capsule result is recorded in capsule record variable. + System may reset in this function, if reset is required by capsule and + all capsules are processed. + If not all capsules are processed, reset will be defered to second call. + + 2) The second call must be after EndOfDxe and after ConnectAll, so that all + device capsule FMP protocols are exposed. + The system capsules are skipped. If the device capsules are NOT processed + in first call, they are processed here. + Each individual capsule result is recorded in capsule record variable. + System may reset in this function, if reset is required by capsule + processed in first call and second call. + + @retval EFI_SUCCESS There is no error when processing capsules. + @retval EFI_OUT_OF_RESOURCES No enough resource to process capsules. + +**/ +EFI_STATUS +EFIAPI +ProcessCapsules ( + VOID + ); + +/** + This routine is called to check if CapsuleOnDisk flag in OsIndications Variable + is enabled. + + @retval TRUE Flag is enabled + @retval FALSE Flag is not enabled + +**/ +BOOLEAN +EFIAPI +CoDCheckCapsuleOnDiskFlag ( + VOID + ); + +/** + This routine is called to clear CapsuleOnDisk flags including OsIndications and BootNext variable. + + @retval EFI_SUCCESS All Capsule On Disk flags are cleared + +**/ +EFI_STATUS +EFIAPI +CoDClearCapsuleOnDiskFlag ( + VOID + ); + +/** + Relocate Capsule on Disk from EFI system partition. + + Two solution to deliver Capsule On Disk: + Solution A: If PcdCapsuleInRamSupport is enabled, relocate Capsule On Disk to memory and call UpdateCapsule(). + Solution B: If PcdCapsuleInRamSupport is disabled, relocate Capsule On Disk to a platform-specific NV storage + device with BlockIo protocol. + + Device enumeration like USB costs time, user can input MaxRetry to tell function to retry. + Function will stall 100ms between each retry. + + Side Effects: + Capsule Delivery Supported Flag in OsIndication variable and BootNext variable will be cleared. + Solution B: Content corruption. Block IO write directly touches low level write. Orignal partitions, file + systems of the relocation device will be corrupted. + + @param[in] MaxRetry Max Connection Retry. Stall 100ms between each connection try to ensure + devices like USB can get enumerated. Input 0 means no retry. + + @retval EFI_SUCCESS Capsule on Disk images are successfully relocated. + +**/ +EFI_STATUS +EFIAPI +CoDRelocateCapsule ( + UINTN MaxRetry + ); + +/** + Remove the temp file from the root of EFI System Partition. + Device enumeration like USB costs time, user can input MaxRetry to tell function to retry. + Function will stall 100ms between each retry. + + @param[in] MaxRetry Max Connection Retry. Stall 100ms between each connection try to ensure + devices like USB can get enumerated. Input 0 means no retry. + + @retval EFI_SUCCESS Remove the temp file successfully. + +**/ +EFI_STATUS +EFIAPI +CoDRemoveTempFile ( + UINTN MaxRetry + ); + +#endif diff --git a/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h b/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h index 94e9b20ae1..e95fc9d424 100644 --- a/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h +++ b/MdeModulePkg/Include/Library/CpuExceptionHandlerLib.h @@ -1,102 +1,102 @@ -/** @file
- CPU Exception library provides the default CPU interrupt/exception handler.
- It also provides capability to register user interrupt/exception handler.
-
- Copyright (c) 2012 - 2022, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __CPU_EXCEPTION_HANDLER_LIB_H__
-#define __CPU_EXCEPTION_HANDLER_LIB_H__
-
-#include <Ppi/VectorHandoffInfo.h>
-#include <Protocol/Cpu.h>
-
-/**
- Initializes all CPU exceptions entries and provides the default exception handlers.
-
- Caller should try to get an array of interrupt and/or exception vectors that are in use and need to
- persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification.
- If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL.
- If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly.
-
- @param[in] VectorInfo Pointer to reserved vector list.
-
- @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized
- with default exception handlers.
- @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL.
- @retval EFI_UNSUPPORTED This function is not supported.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeCpuExceptionHandlers (
- IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL
- );
-
-/**
- Setup separate stacks for certain exception handlers.
- If the input Buffer and BufferSize are both NULL, use global variable if possible.
-
- @param[in] Buffer Point to buffer used to separate exception stack.
- @param[in, out] BufferSize On input, it indicates the byte size of Buffer.
- If the size is not enough, the return status will
- be EFI_BUFFER_TOO_SMALL, and output BufferSize
- will be the size it needs.
-
- @retval EFI_SUCCESS The stacks are assigned successfully.
- @retval EFI_UNSUPPORTED This function is not supported.
- @retval EFI_BUFFER_TOO_SMALL This BufferSize is too small.
-**/
-EFI_STATUS
-EFIAPI
-InitializeSeparateExceptionStacks (
- IN VOID *Buffer,
- IN OUT UINTN *BufferSize
- );
-
-/**
- Registers a function to be called from the processor interrupt handler.
-
- This function registers and enables the handler specified by InterruptHandler for a processor
- interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the
- handler for the processor interrupt or exception type specified by InterruptType is uninstalled.
- The installed handler is called once for each processor interrupt or exception.
- NOTE: This function should be invoked after InitializeCpuExceptionHandlers() is invoked,
- otherwise EFI_UNSUPPORTED returned.
-
- @param[in] InterruptType Defines which interrupt or exception to hook.
- @param[in] InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called
- when a processor interrupt occurs. If this parameter is NULL, then the handler
- will be uninstalled.
-
- @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.
- @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was
- previously installed.
- @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
- previously installed.
- @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported,
- or this function is not supported.
-**/
-EFI_STATUS
-EFIAPI
-RegisterCpuInterruptHandler (
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
- );
-
-/**
- Display processor context.
-
- @param[in] ExceptionType Exception type.
- @param[in] SystemContext Processor context to be display.
-**/
-VOID
-EFIAPI
-DumpCpuContext (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN EFI_SYSTEM_CONTEXT SystemContext
- );
-
-#endif
+/** @file + CPU Exception library provides the default CPU interrupt/exception handler. + It also provides capability to register user interrupt/exception handler. + + Copyright (c) 2012 - 2022, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __CPU_EXCEPTION_HANDLER_LIB_H__ +#define __CPU_EXCEPTION_HANDLER_LIB_H__ + +#include <Ppi/VectorHandoffInfo.h> +#include <Protocol/Cpu.h> + +/** + Initializes all CPU exceptions entries and provides the default exception handlers. + + Caller should try to get an array of interrupt and/or exception vectors that are in use and need to + persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification. + If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. + If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly. + + @param[in] VectorInfo Pointer to reserved vector list. + + @retval EFI_SUCCESS CPU Exception Entries have been successfully initialized + with default exception handlers. + @retval EFI_INVALID_PARAMETER VectorInfo includes the invalid content if VectorInfo is not NULL. + @retval EFI_UNSUPPORTED This function is not supported. + +**/ +EFI_STATUS +EFIAPI +InitializeCpuExceptionHandlers ( + IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL + ); + +/** + Setup separate stacks for certain exception handlers. + If the input Buffer and BufferSize are both NULL, use global variable if possible. + + @param[in] Buffer Point to buffer used to separate exception stack. + @param[in, out] BufferSize On input, it indicates the byte size of Buffer. + If the size is not enough, the return status will + be EFI_BUFFER_TOO_SMALL, and output BufferSize + will be the size it needs. + + @retval EFI_SUCCESS The stacks are assigned successfully. + @retval EFI_UNSUPPORTED This function is not supported. + @retval EFI_BUFFER_TOO_SMALL This BufferSize is too small. +**/ +EFI_STATUS +EFIAPI +InitializeSeparateExceptionStacks ( + IN VOID *Buffer, + IN OUT UINTN *BufferSize + ); + +/** + Registers a function to be called from the processor interrupt handler. + + This function registers and enables the handler specified by InterruptHandler for a processor + interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the + handler for the processor interrupt or exception type specified by InterruptType is uninstalled. + The installed handler is called once for each processor interrupt or exception. + NOTE: This function should be invoked after InitializeCpuExceptionHandlers() is invoked, + otherwise EFI_UNSUPPORTED returned. + + @param[in] InterruptType Defines which interrupt or exception to hook. + @param[in] InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called + when a processor interrupt occurs. If this parameter is NULL, then the handler + will be uninstalled. + + @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled. + @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was + previously installed. + @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not + previously installed. + @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported, + or this function is not supported. +**/ +EFI_STATUS +EFIAPI +RegisterCpuInterruptHandler ( + IN EFI_EXCEPTION_TYPE InterruptType, + IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler + ); + +/** + Display processor context. + + @param[in] ExceptionType Exception type. + @param[in] SystemContext Processor context to be display. +**/ +VOID +EFIAPI +DumpCpuContext ( + IN EFI_EXCEPTION_TYPE ExceptionType, + IN EFI_SYSTEM_CONTEXT SystemContext + ); + +#endif diff --git a/MdeModulePkg/Include/Library/CustomizedDisplayLib.h b/MdeModulePkg/Include/Library/CustomizedDisplayLib.h index 0607dd1a61..8139ae25b2 100644 --- a/MdeModulePkg/Include/Library/CustomizedDisplayLib.h +++ b/MdeModulePkg/Include/Library/CustomizedDisplayLib.h @@ -1,351 +1,351 @@ -/** @file
- This library class defines a set of interfaces to customize Display module
-
-Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __CUSTOMIZED_DISPLAY_LIB_H__
-#define __CUSTOMIZED_DISPLAY_LIB_H__
-
-#include <Protocol/DisplayProtocol.h>
-
-/**
-+------------------------------------------------------------------------------+
-| Setup Page |
-+------------------------------------------------------------------------------+
-
-Statement
-Statement
-Statement
-
-
-
-
-
-+------------------------------------------------------------------------------+
-| F9=Reset to Defaults F10=Save |
-| ^"=Move Highlight <Spacebar> Toggles Checkbox Esc=Exit |
-+------------------------------------------------------------------------------+
- StatusBar
-**/
-
-/**
- This funtion defines Page Frame and Backgroud.
-
- Based on the above layout, it will be responsible for HeaderHeight, FooterHeight,
- StatusBarHeight and Backgroud. And, it will reserve Screen for Statement.
-
- @param[in] FormData Form Data to be shown in Page.
- @param[out] ScreenForStatement Screen to be used for Statement. (Prompt, Value and Help)
-
- @return Status
-**/
-EFI_STATUS
-EFIAPI
-DisplayPageFrame (
- IN FORM_DISPLAY_ENGINE_FORM *FormData,
- OUT EFI_SCREEN_DESCRIPTOR *ScreenForStatement
- );
-
-/**
- Clear Screen to the initial state.
-**/
-VOID
-EFIAPI
-ClearDisplayPage (
- VOID
- );
-
-/**
- This function updates customized key panel's help information.
- The library will prepare those Strings for the basic key, ESC, Enter, Up/Down/Left/Right, +/-.
- and arrange them in Footer panel.
-
- @param[in] FormData Form Data to be shown in Page. FormData has the highlighted statement.
- @param[in] Statement The statement current selected.
- @param[in] Selected Whether or not a tag be selected. TRUE means Enter has hit this question.
-**/
-VOID
-EFIAPI
-RefreshKeyHelp (
- IN FORM_DISPLAY_ENGINE_FORM *FormData,
- IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,
- IN BOOLEAN Selected
- );
-
-/**
- Update status bar.
-
- This function updates the status bar on the bottom of menu screen. It just shows StatusBar.
- Original logic in this function should be splitted out.
-
- @param[in] MessageType The type of message to be shown. InputError or Configuration Changed.
- @param[in] State Show or Clear Message.
-**/
-VOID
-EFIAPI
-UpdateStatusBar (
- IN UINTN MessageType,
- IN BOOLEAN State
- );
-
-/**
- Create popup window.
-
- This function draws OEM/Vendor specific pop up windows.
-
- @param[out] Key User Input Key
- @param ... String to be shown in Popup. The variable argument list is terminated by a NULL.
-
-**/
-VOID
-EFIAPI
-CreateDialog (
- OUT EFI_INPUT_KEY *Key OPTIONAL,
- ...
- );
-
-/**
- Confirm how to handle the changed data.
-
- @return Action BROWSER_ACTION_SUBMIT, BROWSER_ACTION_DISCARD or other values.
-**/
-UINTN
-EFIAPI
-ConfirmDataChange (
- VOID
- );
-
-/**
- OEM specifies whether Setup exits Page by ESC key.
-
- This function customized the behavior that whether Setup exits Page so that
- system able to boot when configuration is not changed.
-
- @retval TRUE Exits FrontPage
- @retval FALSE Don't exit FrontPage.
-**/
-BOOLEAN
-EFIAPI
-FormExitPolicy (
- VOID
- );
-
-/**
- Set Timeout value for a ceratain Form to get user response.
-
- This function allows to set timeout value on a ceratain form if necessary.
- If timeout is not zero, the form will exit if user has no response in timeout.
-
- @param[in] FormData Form Data to be shown in Page
-
- @return 0 No timeout for this form.
- @return > 0 Timeout value in 100 ns units.
-**/
-UINT64
-EFIAPI
-FormExitTimeout (
- IN FORM_DISPLAY_ENGINE_FORM *FormData
- );
-
-//
-// Print Functions
-//
-
-/**
- Prints a unicode string to the default console, at
- the supplied cursor position, using L"%s" format.
-
- @param Column The cursor position to print the string at. When it is -1, use current Position.
- @param Row The cursor position to print the string at. When it is -1, use current Position.
- @param String String pointer.
-
- @return Length of string printed to the console
-
-**/
-UINTN
-EFIAPI
-PrintStringAt (
- IN UINTN Column,
- IN UINTN Row,
- IN CHAR16 *String
- );
-
-/**
- Prints a unicode string with the specified width to the default console, at
- the supplied cursor position, using L"%s" format.
-
- @param Column The cursor position to print the string at. When it is -1, use current Position.
- @param Row The cursor position to print the string at. When it is -1, use current Position.
- @param String String pointer.
- @param Width Width for String to be printed. If the print length of String < Width,
- Space char (L' ') will be used to append String.
-
- @return Length of string printed to the console
-
-**/
-UINTN
-EFIAPI
-PrintStringAtWithWidth (
- IN UINTN Column,
- IN UINTN Row,
- IN CHAR16 *String,
- IN UINTN Width
- );
-
-/**
- Prints a character to the default console, at
- the supplied cursor position, using L"%c" format.
-
- @param Column The cursor position to print the string at. When it is -1, use current Position.
- @param Row The cursor position to print the string at. When it is -1, use current Position.
- @param Character Character to print.
-
- @return Length of string printed to the console.
-
-**/
-UINTN
-EFIAPI
-PrintCharAt (
- IN UINTN Column,
- IN UINTN Row,
- CHAR16 Character
- );
-
-/**
- Clear retangle with specified text attribute.
-
- @param LeftColumn Left column of retangle.
- @param RightColumn Right column of retangle.
- @param TopRow Start row of retangle.
- @param BottomRow End row of retangle.
- @param TextAttribute The character foreground and background.
-
-**/
-VOID
-EFIAPI
-ClearLines (
- IN UINTN LeftColumn,
- IN UINTN RightColumn,
- IN UINTN TopRow,
- IN UINTN BottomRow,
- IN UINTN TextAttribute
- );
-
-//
-// Color Setting Functions
-//
-
-/**
- Get OEM/Vendor specific popup attribute colors.
-
- @retval Byte code color setting for popup color.
-**/
-UINT8
-EFIAPI
-GetPopupColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific popup attribute colors.
-
- @retval Byte code color setting for popup inverse color.
-**/
-UINT8
-EFIAPI
-GetPopupInverseColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific PickList color attribute.
-
- @retval Byte code color setting for pick list color.
-**/
-UINT8
-EFIAPI
-GetPickListColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific arrow color attribute.
-
- @retval Byte code color setting for arrow color.
-**/
-UINT8
-EFIAPI
-GetArrowColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific info text color attribute.
-
- @retval Byte code color setting for info text color.
-**/
-UINT8
-EFIAPI
-GetInfoTextColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific help text color attribute.
-
- @retval Byte code color setting for help text color.
-**/
-UINT8
-EFIAPI
-GetHelpTextColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific grayed out text color attribute.
-
- @retval Byte code color setting for grayed out text color.
-**/
-UINT8
-EFIAPI
-GetGrayedTextColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific highlighted text color attribute.
-
- @retval Byte code color setting for highlight text color.
-**/
-UINT8
-EFIAPI
-GetHighlightTextColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific field text color attribute.
-
- @retval Byte code color setting for field text color.
-**/
-UINT8
-EFIAPI
-GetFieldTextColor (
- VOID
- );
-
-/**
- Get OEM/Vendor specific subtitle text color attribute.
-
- @retval Byte code color setting for subtitle text color.
-**/
-UINT8
-EFIAPI
-GetSubTitleTextColor (
- VOID
- );
-
-#endif
+/** @file + This library class defines a set of interfaces to customize Display module + +Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __CUSTOMIZED_DISPLAY_LIB_H__ +#define __CUSTOMIZED_DISPLAY_LIB_H__ + +#include <Protocol/DisplayProtocol.h> + +/** ++------------------------------------------------------------------------------+ +| Setup Page | ++------------------------------------------------------------------------------+ + +Statement +Statement +Statement + + + + + ++------------------------------------------------------------------------------+ +| F9=Reset to Defaults F10=Save | +| ^"=Move Highlight <Spacebar> Toggles Checkbox Esc=Exit | ++------------------------------------------------------------------------------+ + StatusBar +**/ + +/** + This funtion defines Page Frame and Backgroud. + + Based on the above layout, it will be responsible for HeaderHeight, FooterHeight, + StatusBarHeight and Backgroud. And, it will reserve Screen for Statement. + + @param[in] FormData Form Data to be shown in Page. + @param[out] ScreenForStatement Screen to be used for Statement. (Prompt, Value and Help) + + @return Status +**/ +EFI_STATUS +EFIAPI +DisplayPageFrame ( + IN FORM_DISPLAY_ENGINE_FORM *FormData, + OUT EFI_SCREEN_DESCRIPTOR *ScreenForStatement + ); + +/** + Clear Screen to the initial state. +**/ +VOID +EFIAPI +ClearDisplayPage ( + VOID + ); + +/** + This function updates customized key panel's help information. + The library will prepare those Strings for the basic key, ESC, Enter, Up/Down/Left/Right, +/-. + and arrange them in Footer panel. + + @param[in] FormData Form Data to be shown in Page. FormData has the highlighted statement. + @param[in] Statement The statement current selected. + @param[in] Selected Whether or not a tag be selected. TRUE means Enter has hit this question. +**/ +VOID +EFIAPI +RefreshKeyHelp ( + IN FORM_DISPLAY_ENGINE_FORM *FormData, + IN FORM_DISPLAY_ENGINE_STATEMENT *Statement, + IN BOOLEAN Selected + ); + +/** + Update status bar. + + This function updates the status bar on the bottom of menu screen. It just shows StatusBar. + Original logic in this function should be splitted out. + + @param[in] MessageType The type of message to be shown. InputError or Configuration Changed. + @param[in] State Show or Clear Message. +**/ +VOID +EFIAPI +UpdateStatusBar ( + IN UINTN MessageType, + IN BOOLEAN State + ); + +/** + Create popup window. + + This function draws OEM/Vendor specific pop up windows. + + @param[out] Key User Input Key + @param ... String to be shown in Popup. The variable argument list is terminated by a NULL. + +**/ +VOID +EFIAPI +CreateDialog ( + OUT EFI_INPUT_KEY *Key OPTIONAL, + ... + ); + +/** + Confirm how to handle the changed data. + + @return Action BROWSER_ACTION_SUBMIT, BROWSER_ACTION_DISCARD or other values. +**/ +UINTN +EFIAPI +ConfirmDataChange ( + VOID + ); + +/** + OEM specifies whether Setup exits Page by ESC key. + + This function customized the behavior that whether Setup exits Page so that + system able to boot when configuration is not changed. + + @retval TRUE Exits FrontPage + @retval FALSE Don't exit FrontPage. +**/ +BOOLEAN +EFIAPI +FormExitPolicy ( + VOID + ); + +/** + Set Timeout value for a ceratain Form to get user response. + + This function allows to set timeout value on a ceratain form if necessary. + If timeout is not zero, the form will exit if user has no response in timeout. + + @param[in] FormData Form Data to be shown in Page + + @return 0 No timeout for this form. + @return > 0 Timeout value in 100 ns units. +**/ +UINT64 +EFIAPI +FormExitTimeout ( + IN FORM_DISPLAY_ENGINE_FORM *FormData + ); + +// +// Print Functions +// + +/** + Prints a unicode string to the default console, at + the supplied cursor position, using L"%s" format. + + @param Column The cursor position to print the string at. When it is -1, use current Position. + @param Row The cursor position to print the string at. When it is -1, use current Position. + @param String String pointer. + + @return Length of string printed to the console + +**/ +UINTN +EFIAPI +PrintStringAt ( + IN UINTN Column, + IN UINTN Row, + IN CHAR16 *String + ); + +/** + Prints a unicode string with the specified width to the default console, at + the supplied cursor position, using L"%s" format. + + @param Column The cursor position to print the string at. When it is -1, use current Position. + @param Row The cursor position to print the string at. When it is -1, use current Position. + @param String String pointer. + @param Width Width for String to be printed. If the print length of String < Width, + Space char (L' ') will be used to append String. + + @return Length of string printed to the console + +**/ +UINTN +EFIAPI +PrintStringAtWithWidth ( + IN UINTN Column, + IN UINTN Row, + IN CHAR16 *String, + IN UINTN Width + ); + +/** + Prints a character to the default console, at + the supplied cursor position, using L"%c" format. + + @param Column The cursor position to print the string at. When it is -1, use current Position. + @param Row The cursor position to print the string at. When it is -1, use current Position. + @param Character Character to print. + + @return Length of string printed to the console. + +**/ +UINTN +EFIAPI +PrintCharAt ( + IN UINTN Column, + IN UINTN Row, + CHAR16 Character + ); + +/** + Clear retangle with specified text attribute. + + @param LeftColumn Left column of retangle. + @param RightColumn Right column of retangle. + @param TopRow Start row of retangle. + @param BottomRow End row of retangle. + @param TextAttribute The character foreground and background. + +**/ +VOID +EFIAPI +ClearLines ( + IN UINTN LeftColumn, + IN UINTN RightColumn, + IN UINTN TopRow, + IN UINTN BottomRow, + IN UINTN TextAttribute + ); + +// +// Color Setting Functions +// + +/** + Get OEM/Vendor specific popup attribute colors. + + @retval Byte code color setting for popup color. +**/ +UINT8 +EFIAPI +GetPopupColor ( + VOID + ); + +/** + Get OEM/Vendor specific popup attribute colors. + + @retval Byte code color setting for popup inverse color. +**/ +UINT8 +EFIAPI +GetPopupInverseColor ( + VOID + ); + +/** + Get OEM/Vendor specific PickList color attribute. + + @retval Byte code color setting for pick list color. +**/ +UINT8 +EFIAPI +GetPickListColor ( + VOID + ); + +/** + Get OEM/Vendor specific arrow color attribute. + + @retval Byte code color setting for arrow color. +**/ +UINT8 +EFIAPI +GetArrowColor ( + VOID + ); + +/** + Get OEM/Vendor specific info text color attribute. + + @retval Byte code color setting for info text color. +**/ +UINT8 +EFIAPI +GetInfoTextColor ( + VOID + ); + +/** + Get OEM/Vendor specific help text color attribute. + + @retval Byte code color setting for help text color. +**/ +UINT8 +EFIAPI +GetHelpTextColor ( + VOID + ); + +/** + Get OEM/Vendor specific grayed out text color attribute. + + @retval Byte code color setting for grayed out text color. +**/ +UINT8 +EFIAPI +GetGrayedTextColor ( + VOID + ); + +/** + Get OEM/Vendor specific highlighted text color attribute. + + @retval Byte code color setting for highlight text color. +**/ +UINT8 +EFIAPI +GetHighlightTextColor ( + VOID + ); + +/** + Get OEM/Vendor specific field text color attribute. + + @retval Byte code color setting for field text color. +**/ +UINT8 +EFIAPI +GetFieldTextColor ( + VOID + ); + +/** + Get OEM/Vendor specific subtitle text color attribute. + + @retval Byte code color setting for subtitle text color. +**/ +UINT8 +EFIAPI +GetSubTitleTextColor ( + VOID + ); + +#endif diff --git a/MdeModulePkg/Include/Library/DebugAgentLib.h b/MdeModulePkg/Include/Library/DebugAgentLib.h index f44bc5c563..b5fa079c9a 100644 --- a/MdeModulePkg/Include/Library/DebugAgentLib.h +++ b/MdeModulePkg/Include/Library/DebugAgentLib.h @@ -1,96 +1,96 @@ -/** @file
- Debug Agent Library provide source-level debug capability.
-
-Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __DEBUG_AGENT_LIB_H__
-#define __DEBUG_AGENT_LIB_H__
-
-#define DEBUG_AGENT_INIT_PREMEM_SEC 1
-#define DEBUG_AGENT_INIT_POSTMEM_SEC 2
-#define DEBUG_AGENT_INIT_DXE_CORE 3
-#define DEBUG_AGENT_INIT_SMM 4
-#define DEBUG_AGENT_INIT_ENTER_SMI 5
-#define DEBUG_AGENT_INIT_EXIT_SMI 6
-#define DEBUG_AGENT_INIT_S3 7
-#define DEBUG_AGENT_INIT_DXE_AP 8
-#define DEBUG_AGENT_INIT_PEI 9
-#define DEBUG_AGENT_INIT_DXE_LOAD 10
-#define DEBUG_AGENT_INIT_DXE_UNLOAD 11
-#define DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64 12
-
-//
-// Context for DEBUG_AGENT_INIT_POSTMEM_SEC
-//
-typedef struct {
- UINTN HeapMigrateOffset;
- UINTN StackMigrateOffset;
-} DEBUG_AGENT_CONTEXT_POSTMEM_SEC;
-
-/**
- Caller provided function to be invoked at the end of InitializeDebugAgent().
-
- Refer to the description for InitializeDebugAgent() for more details.
-
- @param[in] Context The first input parameter of InitializeDebugAgent().
-
-**/
-typedef
-VOID
-(EFIAPI *DEBUG_AGENT_CONTINUE)(
- IN VOID *Context
- );
-
-/**
- Initialize debug agent.
-
- This function is used to set up debug environment to support source level debugging.
- If certain Debug Agent Library instance has to save some private data in the stack,
- this function must work on the mode that doesn't return to the caller, then
- the caller needs to wrap up all rest of logic after InitializeDebugAgent() into one
- function and pass it into InitializeDebugAgent(). InitializeDebugAgent() is
- responsible to invoke the passing-in function at the end of InitializeDebugAgent().
-
- If the parameter Function is not NULL, Debug Agent Library instance will invoke it by
- passing in the Context to be its parameter.
-
- If Function() is NULL, Debug Agent Library instance will return after setup debug
- environment.
-
- @param[in] InitFlag Init flag is used to decide the initialize process.
- @param[in] Context Context needed according to InitFlag; it was optional.
- @param[in] Function Continue function called by debug agent library; it was
- optional.
-
-**/
-VOID
-EFIAPI
-InitializeDebugAgent (
- IN UINT32 InitFlag,
- IN VOID *Context OPTIONAL,
- IN DEBUG_AGENT_CONTINUE Function OPTIONAL
- );
-
-/**
- Enable/Disable the interrupt of debug timer and return the interrupt state
- prior to the operation.
-
- If EnableStatus is TRUE, enable the interrupt of debug timer.
- If EnableStatus is FALSE, disable the interrupt of debug timer.
-
- @param[in] EnableStatus Enable/Disable.
-
- @retval TRUE Debug timer interrupt were enabled on entry to this call.
- @retval FALSE Debug timer interrupt were disabled on entry to this call.
-
-**/
-BOOLEAN
-EFIAPI
-SaveAndSetDebugTimerInterrupt (
- IN BOOLEAN EnableStatus
- );
-
-#endif
+/** @file + Debug Agent Library provide source-level debug capability. + +Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __DEBUG_AGENT_LIB_H__ +#define __DEBUG_AGENT_LIB_H__ + +#define DEBUG_AGENT_INIT_PREMEM_SEC 1 +#define DEBUG_AGENT_INIT_POSTMEM_SEC 2 +#define DEBUG_AGENT_INIT_DXE_CORE 3 +#define DEBUG_AGENT_INIT_SMM 4 +#define DEBUG_AGENT_INIT_ENTER_SMI 5 +#define DEBUG_AGENT_INIT_EXIT_SMI 6 +#define DEBUG_AGENT_INIT_S3 7 +#define DEBUG_AGENT_INIT_DXE_AP 8 +#define DEBUG_AGENT_INIT_PEI 9 +#define DEBUG_AGENT_INIT_DXE_LOAD 10 +#define DEBUG_AGENT_INIT_DXE_UNLOAD 11 +#define DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64 12 + +// +// Context for DEBUG_AGENT_INIT_POSTMEM_SEC +// +typedef struct { + UINTN HeapMigrateOffset; + UINTN StackMigrateOffset; +} DEBUG_AGENT_CONTEXT_POSTMEM_SEC; + +/** + Caller provided function to be invoked at the end of InitializeDebugAgent(). + + Refer to the description for InitializeDebugAgent() for more details. + + @param[in] Context The first input parameter of InitializeDebugAgent(). + +**/ +typedef +VOID +(EFIAPI *DEBUG_AGENT_CONTINUE)( + IN VOID *Context + ); + +/** + Initialize debug agent. + + This function is used to set up debug environment to support source level debugging. + If certain Debug Agent Library instance has to save some private data in the stack, + this function must work on the mode that doesn't return to the caller, then + the caller needs to wrap up all rest of logic after InitializeDebugAgent() into one + function and pass it into InitializeDebugAgent(). InitializeDebugAgent() is + responsible to invoke the passing-in function at the end of InitializeDebugAgent(). + + If the parameter Function is not NULL, Debug Agent Library instance will invoke it by + passing in the Context to be its parameter. + + If Function() is NULL, Debug Agent Library instance will return after setup debug + environment. + + @param[in] InitFlag Init flag is used to decide the initialize process. + @param[in] Context Context needed according to InitFlag; it was optional. + @param[in] Function Continue function called by debug agent library; it was + optional. + +**/ +VOID +EFIAPI +InitializeDebugAgent ( + IN UINT32 InitFlag, + IN VOID *Context OPTIONAL, + IN DEBUG_AGENT_CONTINUE Function OPTIONAL + ); + +/** + Enable/Disable the interrupt of debug timer and return the interrupt state + prior to the operation. + + If EnableStatus is TRUE, enable the interrupt of debug timer. + If EnableStatus is FALSE, disable the interrupt of debug timer. + + @param[in] EnableStatus Enable/Disable. + + @retval TRUE Debug timer interrupt were enabled on entry to this call. + @retval FALSE Debug timer interrupt were disabled on entry to this call. + +**/ +BOOLEAN +EFIAPI +SaveAndSetDebugTimerInterrupt ( + IN BOOLEAN EnableStatus + ); + +#endif diff --git a/MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h b/MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h index bb26241380..3fcdc0b62c 100644 --- a/MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h +++ b/MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h @@ -1,48 +1,48 @@ -/** @file
- Provides services to display completion progress when processing a
- firmware update that updates the firmware image in a firmware device.
- A platform may provide its own instance of this library class to custoimize
- how a user is informed of completion progress.
-
- Copyright (c) 2016, Microsoft Corporation
- Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-
- All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __DISPLAY_PROGRESS_LIB__
-#define __DISPLAY_PROGRESS_LIB__
-
-#include <Protocol/GraphicsOutput.h>
-
-/**
- Indicates the current completion progress of a firmware update.
-
- @param[in] Completion A value between 0 and 100 indicating the current
- completion progress of a firmware update. This
- value must the the same or higher than previous
- calls to this service. The first call of 0 or a
- value of 0 after reaching a value of 100 resets
- the progress indicator to 0.
- @param[in] Color Color of the progress indicator. Only used when
- Completion is 0 to set the color of the progress
- indicator. If Color is NULL, then the default color
- is used.
-
- @retval EFI_SUCCESS Progress displayed successfully.
- @retval EFI_INVALID_PARAMETER Completion is not in range 0..100.
- @retval EFI_INVALID_PARAMETER Completion is less than Completion value from
- a previous call to this service.
- @retval EFI_NOT_READY The device used to indicate progress is not
- available.
-**/
-EFI_STATUS
-EFIAPI
-DisplayUpdateProgress (
- IN UINTN Completion,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *Color OPTIONAL
- );
-
-#endif
+/** @file + Provides services to display completion progress when processing a + firmware update that updates the firmware image in a firmware device. + A platform may provide its own instance of this library class to custoimize + how a user is informed of completion progress. + + Copyright (c) 2016, Microsoft Corporation + Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> + + All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __DISPLAY_PROGRESS_LIB__ +#define __DISPLAY_PROGRESS_LIB__ + +#include <Protocol/GraphicsOutput.h> + +/** + Indicates the current completion progress of a firmware update. + + @param[in] Completion A value between 0 and 100 indicating the current + completion progress of a firmware update. This + value must the the same or higher than previous + calls to this service. The first call of 0 or a + value of 0 after reaching a value of 100 resets + the progress indicator to 0. + @param[in] Color Color of the progress indicator. Only used when + Completion is 0 to set the color of the progress + indicator. If Color is NULL, then the default color + is used. + + @retval EFI_SUCCESS Progress displayed successfully. + @retval EFI_INVALID_PARAMETER Completion is not in range 0..100. + @retval EFI_INVALID_PARAMETER Completion is less than Completion value from + a previous call to this service. + @retval EFI_NOT_READY The device used to indicate progress is not + available. +**/ +EFI_STATUS +EFIAPI +DisplayUpdateProgress ( + IN UINTN Completion, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *Color OPTIONAL + ); + +#endif diff --git a/MdeModulePkg/Include/Library/FileExplorerLib.h b/MdeModulePkg/Include/Library/FileExplorerLib.h index 528a3cabb6..5b6a5afab3 100644 --- a/MdeModulePkg/Include/Library/FileExplorerLib.h +++ b/MdeModulePkg/Include/Library/FileExplorerLib.h @@ -1,41 +1,41 @@ -/** @file
-
- This library class defines a set of interfaces for how to do file explorer.
-
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __FILE_EXPLORER_LIB_H__
-#define __FILE_EXPLORER_LIB_H__
-
-#include <Protocol/FileExplorer.h>
-
-/**
- Choose a file in the specified directory.
-
- If user input NULL for the RootDirectory, will choose file in the system.
-
- If user input *File != NULL, function will return the allocate device path
- info for the choosed file, caller has to free the memory after use it.
-
- @param RootDirectory Pointer to the root directory.
- @param FileType The file type need to choose.
- @param ChooseHandler Function pointer to the extra task need to do
- after choose one file.
- @param File Return the device path for the last time chosed file.
-
- @retval EFI_SUCESS Choose the file success.
- @retval Other errors Choose the file failed.
-**/
-EFI_STATUS
-EFIAPI
-ChooseFile (
- IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory,
- IN CHAR16 *FileType OPTIONAL,
- IN CHOOSE_HANDLER ChooseHandler OPTIONAL,
- OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL
- );
-
-#endif
+/** @file + + This library class defines a set of interfaces for how to do file explorer. + +Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __FILE_EXPLORER_LIB_H__ +#define __FILE_EXPLORER_LIB_H__ + +#include <Protocol/FileExplorer.h> + +/** + Choose a file in the specified directory. + + If user input NULL for the RootDirectory, will choose file in the system. + + If user input *File != NULL, function will return the allocate device path + info for the choosed file, caller has to free the memory after use it. + + @param RootDirectory Pointer to the root directory. + @param FileType The file type need to choose. + @param ChooseHandler Function pointer to the extra task need to do + after choose one file. + @param File Return the device path for the last time chosed file. + + @retval EFI_SUCESS Choose the file success. + @retval Other errors Choose the file failed. +**/ +EFI_STATUS +EFIAPI +ChooseFile ( + IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory, + IN CHAR16 *FileType OPTIONAL, + IN CHOOSE_HANDLER ChooseHandler OPTIONAL, + OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL + ); + +#endif diff --git a/MdeModulePkg/Include/Library/FmpAuthenticationLib.h b/MdeModulePkg/Include/Library/FmpAuthenticationLib.h index 7b07b13984..b4ff0f49f9 100644 --- a/MdeModulePkg/Include/Library/FmpAuthenticationLib.h +++ b/MdeModulePkg/Include/Library/FmpAuthenticationLib.h @@ -1,58 +1,58 @@ -/** @file
- FMP capsule authenitcation Library.
-
-Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __FMP_AUTHENTICATION_LIB_H__
-#define __FMP_AUTHENTICATION_LIB_H__
-
-#include <Protocol/FirmwareManagement.h>
-
-/**
- The function is used to do the authentication for FMP capsule based upon
- EFI_FIRMWARE_IMAGE_AUTHENTICATION.
-
- The FMP capsule image should start with EFI_FIRMWARE_IMAGE_AUTHENTICATION,
- followed by the payload.
-
- If the return status is RETURN_SUCCESS, the caller may continue the rest
- FMP update process.
- If the return status is NOT RETURN_SUCCESS, the caller should stop the FMP
- update process and convert the return status to LastAttemptStatus
- to indicate that FMP update fails.
- The LastAttemptStatus can be got from ESRT table or via
- EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImageInfo().
-
- Caution: This function may receive untrusted input.
-
- @param[in] Image Points to an FMP authentication image, started from EFI_FIRMWARE_IMAGE_AUTHENTICATION.
- @param[in] ImageSize Size of the authentication image in bytes.
- @param[in] PublicKeyData The public key data used to validate the signature.
- @param[in] PublicKeyDataLength The length of the public key data.
-
- @retval RETURN_SUCCESS Authentication pass.
- The LastAttemptStatus should be LAST_ATTEMPT_STATUS_SUCCESS.
- @retval RETURN_SECURITY_VIOLATION Authentication fail.
- The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_AUTH_ERROR.
- @retval RETURN_INVALID_PARAMETER The image is in an invalid format.
- The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.
- @retval RETURN_UNSUPPORTED No Authentication handler associated with CertType.
- The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.
- @retval RETURN_UNSUPPORTED Image or ImageSize is invalid.
- The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.
- @retval RETURN_OUT_OF_RESOURCES No Authentication handler associated with CertType.
- The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INSUFFICIENT_RESOURCES.
-**/
-RETURN_STATUS
-EFIAPI
-AuthenticateFmpImage (
- IN EFI_FIRMWARE_IMAGE_AUTHENTICATION *Image,
- IN UINTN ImageSize,
- IN CONST UINT8 *PublicKeyData,
- IN UINTN PublicKeyDataLength
- );
-
-#endif
+/** @file + FMP capsule authenitcation Library. + +Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __FMP_AUTHENTICATION_LIB_H__ +#define __FMP_AUTHENTICATION_LIB_H__ + +#include <Protocol/FirmwareManagement.h> + +/** + The function is used to do the authentication for FMP capsule based upon + EFI_FIRMWARE_IMAGE_AUTHENTICATION. + + The FMP capsule image should start with EFI_FIRMWARE_IMAGE_AUTHENTICATION, + followed by the payload. + + If the return status is RETURN_SUCCESS, the caller may continue the rest + FMP update process. + If the return status is NOT RETURN_SUCCESS, the caller should stop the FMP + update process and convert the return status to LastAttemptStatus + to indicate that FMP update fails. + The LastAttemptStatus can be got from ESRT table or via + EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImageInfo(). + + Caution: This function may receive untrusted input. + + @param[in] Image Points to an FMP authentication image, started from EFI_FIRMWARE_IMAGE_AUTHENTICATION. + @param[in] ImageSize Size of the authentication image in bytes. + @param[in] PublicKeyData The public key data used to validate the signature. + @param[in] PublicKeyDataLength The length of the public key data. + + @retval RETURN_SUCCESS Authentication pass. + The LastAttemptStatus should be LAST_ATTEMPT_STATUS_SUCCESS. + @retval RETURN_SECURITY_VIOLATION Authentication fail. + The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_AUTH_ERROR. + @retval RETURN_INVALID_PARAMETER The image is in an invalid format. + The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT. + @retval RETURN_UNSUPPORTED No Authentication handler associated with CertType. + The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT. + @retval RETURN_UNSUPPORTED Image or ImageSize is invalid. + The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT. + @retval RETURN_OUT_OF_RESOURCES No Authentication handler associated with CertType. + The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INSUFFICIENT_RESOURCES. +**/ +RETURN_STATUS +EFIAPI +AuthenticateFmpImage ( + IN EFI_FIRMWARE_IMAGE_AUTHENTICATION *Image, + IN UINTN ImageSize, + IN CONST UINT8 *PublicKeyData, + IN UINTN PublicKeyDataLength + ); + +#endif diff --git a/MdeModulePkg/Include/Library/FrameBufferBltLib.h b/MdeModulePkg/Include/Library/FrameBufferBltLib.h index 326cdf0473..b6940f89a9 100644 --- a/MdeModulePkg/Include/Library/FrameBufferBltLib.h +++ b/MdeModulePkg/Include/Library/FrameBufferBltLib.h @@ -1,87 +1,87 @@ -/** @file
- Library for performing UEFI GOP Blt operations on a framebuffer
-
- Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __FRAMEBUFFER_BLT_LIB__
-#define __FRAMEBUFFER_BLT_LIB__
-
-#include <Protocol/GraphicsOutput.h>
-
-//
-// Opaque structure for the frame buffer configure.
-//
-typedef struct FRAME_BUFFER_CONFIGURE FRAME_BUFFER_CONFIGURE;
-
-/**
- Create the configuration for a video frame buffer.
-
- The configuration is returned in the caller provided buffer.
-
- @param[in] FrameBuffer Pointer to the start of the frame buffer.
- @param[in] FrameBufferInfo Describes the frame buffer characteristics.
- @param[in,out] Configure The created configuration information.
- @param[in,out] ConfigureSize Size of the configuration information.
-
- @retval RETURN_SUCCESS The configuration was successful created.
- @retval RETURN_BUFFER_TOO_SMALL The Configure is to too small. The required
- size is returned in ConfigureSize.
- @retval RETURN_UNSUPPORTED The requested mode is not supported by
- this implementaion.
-**/
-RETURN_STATUS
-EFIAPI
-FrameBufferBltConfigure (
- IN VOID *FrameBuffer,
- IN EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *FrameBufferInfo,
- IN OUT FRAME_BUFFER_CONFIGURE *Configure,
- IN OUT UINTN *ConfigureSize
- );
-
-/**
- Performs a UEFI Graphics Output Protocol Blt operation.
-
- @param[in] Configure Pointer to a configuration which was successfully
- created by FrameBufferBltConfigure ().
- @param[in,out] BltBuffer The data to transfer to screen.
- @param[in] BltOperation The operation to perform.
- @param[in] SourceX The X coordinate of the source for BltOperation.
- @param[in] SourceY The Y coordinate of the source for BltOperation.
- @param[in] DestinationX The X coordinate of the destination for
- BltOperation.
- @param[in] DestinationY The Y coordinate of the destination for
- BltOperation.
- @param[in] Width The width of a rectangle in the blt rectangle
- in pixels.
- @param[in] Height The height of a rectangle in the blt rectangle
- in pixels.
- @param[in] Delta Not used for EfiBltVideoFill and
- EfiBltVideoToVideo operation. If a Delta of 0
- is used, the entire BltBuffer will be operated
- on. If a subrectangle of the BltBuffer is
- used, then Delta represents the number of
- bytes in a row of the BltBuffer.
-
- @retval RETURN_INVALID_PARAMETER Invalid parameter were passed in.
- @retval RETURN_SUCCESS The Blt operation was performed successfully.
-**/
-RETURN_STATUS
-EFIAPI
-FrameBufferBlt (
- IN FRAME_BUFFER_CONFIGURE *Configure,
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
- IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta
- );
-
-#endif
+/** @file + Library for performing UEFI GOP Blt operations on a framebuffer + + Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __FRAMEBUFFER_BLT_LIB__ +#define __FRAMEBUFFER_BLT_LIB__ + +#include <Protocol/GraphicsOutput.h> + +// +// Opaque structure for the frame buffer configure. +// +typedef struct FRAME_BUFFER_CONFIGURE FRAME_BUFFER_CONFIGURE; + +/** + Create the configuration for a video frame buffer. + + The configuration is returned in the caller provided buffer. + + @param[in] FrameBuffer Pointer to the start of the frame buffer. + @param[in] FrameBufferInfo Describes the frame buffer characteristics. + @param[in,out] Configure The created configuration information. + @param[in,out] ConfigureSize Size of the configuration information. + + @retval RETURN_SUCCESS The configuration was successful created. + @retval RETURN_BUFFER_TOO_SMALL The Configure is to too small. The required + size is returned in ConfigureSize. + @retval RETURN_UNSUPPORTED The requested mode is not supported by + this implementaion. +**/ +RETURN_STATUS +EFIAPI +FrameBufferBltConfigure ( + IN VOID *FrameBuffer, + IN EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *FrameBufferInfo, + IN OUT FRAME_BUFFER_CONFIGURE *Configure, + IN OUT UINTN *ConfigureSize + ); + +/** + Performs a UEFI Graphics Output Protocol Blt operation. + + @param[in] Configure Pointer to a configuration which was successfully + created by FrameBufferBltConfigure (). + @param[in,out] BltBuffer The data to transfer to screen. + @param[in] BltOperation The operation to perform. + @param[in] SourceX The X coordinate of the source for BltOperation. + @param[in] SourceY The Y coordinate of the source for BltOperation. + @param[in] DestinationX The X coordinate of the destination for + BltOperation. + @param[in] DestinationY The Y coordinate of the destination for + BltOperation. + @param[in] Width The width of a rectangle in the blt rectangle + in pixels. + @param[in] Height The height of a rectangle in the blt rectangle + in pixels. + @param[in] Delta Not used for EfiBltVideoFill and + EfiBltVideoToVideo operation. If a Delta of 0 + is used, the entire BltBuffer will be operated + on. If a subrectangle of the BltBuffer is + used, then Delta represents the number of + bytes in a row of the BltBuffer. + + @retval RETURN_INVALID_PARAMETER Invalid parameter were passed in. + @retval RETURN_SUCCESS The Blt operation was performed successfully. +**/ +RETURN_STATUS +EFIAPI +FrameBufferBlt ( + IN FRAME_BUFFER_CONFIGURE *Configure, + IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL, + IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation, + IN UINTN SourceX, + IN UINTN SourceY, + IN UINTN DestinationX, + IN UINTN DestinationY, + IN UINTN Width, + IN UINTN Height, + IN UINTN Delta + ); + +#endif diff --git a/MdeModulePkg/Include/Library/HiiLib.h b/MdeModulePkg/Include/Library/HiiLib.h index 2439cd0472..f521a8c9eb 100644 --- a/MdeModulePkg/Include/Library/HiiLib.h +++ b/MdeModulePkg/Include/Library/HiiLib.h @@ -1,1147 +1,1147 @@ -/** @file
- Public include file for the HII Library
-
-Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>
-(C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __HII_LIB_H__
-#define __HII_LIB_H__
-
-////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////
-// HiiLib Functions
-////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////
-
-/**
- Registers a list of packages in the HII Database and returns the HII Handle
- associated with that registration. If an HII Handle has already been registered
- with the same PackageListGuid and DeviceHandle, then NULL is returned. If there
- are not enough resources to perform the registration, then NULL is returned.
- If an empty list of packages is passed in, then NULL is returned. If the size of
- the list of package is 0, then NULL is returned.
-
- The variable arguments are pointers that point to package headers defined
- by UEFI VFR compiler and StringGather tool.
-
- #pragma pack (push, 1)
- typedef struct {
- UINT32 BinaryLength;
- EFI_HII_PACKAGE_HEADER PackageHeader;
- } EDKII_AUTOGEN_PACKAGES_HEADER;
- #pragma pack (pop)
-
- @param[in] PackageListGuid The GUID of the package list.
- @param[in] DeviceHandle If not NULL, the Device Handle on which
- an instance of DEVICE_PATH_PROTOCOL is installed.
- This Device Handle uniquely defines the device that
- the added packages are associated with.
- @param[in] ... The variable argument list that contains pointers
- to packages terminated by a NULL.
-
- @retval NULL An HII Handle has already been registered in the HII Database with
- the same PackageListGuid and DeviceHandle.
- @retval NULL The HII Handle could not be created.
- @retval NULL An empty list of packages was passed in.
- @retval NULL All packages are empty.
- @retval Other The HII Handle associated with the newly registered package list.
-
-**/
-EFI_HII_HANDLE
-EFIAPI
-HiiAddPackages (
- IN CONST EFI_GUID *PackageListGuid,
- IN EFI_HANDLE DeviceHandle OPTIONAL,
- ...
- )
-;
-
-/**
- Removes a package list from the HII database.
-
- If HiiHandle is NULL, then ASSERT().
- If HiiHandle is not a valid EFI_HII_HANDLE in the HII database, then ASSERT().
-
- @param[in] HiiHandle The handle that was previously registered in the HII database
-
-**/
-VOID
-EFIAPI
-HiiRemovePackages (
- IN EFI_HII_HANDLE HiiHandle
- )
-;
-
-/**
- This function creates a new string in String Package or updates an existing
- string in a String Package. If StringId is 0, then a new string is added to
- a String Package. If StringId is not zero, then a string in String Package is
- updated. If SupportedLanguages is NULL, then the string is added or updated
- for all the languages that the String Package supports. If SupportedLanguages
- is not NULL, then the string is added or updated for the set of languages
- specified by SupportedLanguages.
-
- If HiiHandle is NULL, then ASSERT().
- If String is NULL, then ASSERT().
-
- @param[in] HiiHandle A handle that was previously registered in the
- HII Database.
- @param[in] StringId If zero, then a new string is created in the
- String Package associated with HiiHandle. If
- non-zero, then the string specified by StringId
- is updated in the String Package associated
- with HiiHandle.
- @param[in] String A pointer to the Null-terminated Unicode string
- to add or update in the String Package associated
- with HiiHandle.
- @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string of
- language codes. If this parameter is NULL, then
- String is added or updated in the String Package
- associated with HiiHandle for all the languages
- that the String Package supports. If this
- parameter is not NULL, then String is added
- or updated in the String Package associated with
- HiiHandle for the set of languages specified by
- SupportedLanguages. The format of
- SupportedLanguages must follow the language
- format assumed in the HII Database.
-
- @retval 0 The string could not be added or updated in the String Package.
- @retval Other The EFI_STRING_ID of the newly added or updated string.
-
-**/
-EFI_STRING_ID
-EFIAPI
-HiiSetString (
- IN EFI_HII_HANDLE HiiHandle,
- IN EFI_STRING_ID StringId OPTIONAL,
- IN CONST EFI_STRING String,
- IN CONST CHAR8 *SupportedLanguages OPTIONAL
- )
-;
-
-/**
- Retrieves a string from a string package in a specific language specified in Language
- or in the best lanaguage. See HiiGetStringEx () for the details.
-
- @param[in] HiiHandle A handle that was previously registered in the HII Database.
- @param[in] StringId The identifier of the string to retrieved from the string
- package associated with HiiHandle.
- @param[in] Language The language of the string to retrieve. If this parameter
- is NULL, then the current platform language is used. The
- format of Language must follow the language format assumed in
- the HII Database.
-
- @retval NULL The string specified by StringId is not present in the string package.
- @retval Other The string was returned.
-
-**/
-EFI_STRING
-EFIAPI
-HiiGetString (
- IN EFI_HII_HANDLE HiiHandle,
- IN EFI_STRING_ID StringId,
- IN CONST CHAR8 *Language OPTIONAL
- );
-
-/**
- Retrieves a string from a string package in a specific language or in the best
- language at discretion of this function according to the priority of languages.
- TryBestLanguage is used to get the string in the best language or in the language
- specified in Language parameter. The behavior is,
- If TryBestLanguage is TRUE, this function looks for the best language for the string.
- - If the string can not be retrieved using the specified language or the current
- platform language, then the string is retrieved from the string package in the
- first language the string package supports.
- If TryBestLanguage is FALSE, Language must be specified for retrieving the string.
-
- The returned string is allocated using AllocatePool(). The caller is responsible
- for freeing the allocated buffer using FreePool().
-
- If HiiHandle is NULL, then ASSERT().
- If StringId is 0, then ASSET.
- If TryBestLanguage is FALE and Language is NULL, then ASSERT().
-
- @param[in] HiiHandle A handle that was previously registered in the HII Database.
- @param[in] StringId The identifier of the string to retrieved from the string
- package associated with HiiHandle.
- @param[in] Language The language of the string to retrieve. If this parameter
- is NULL, then the current platform language is used. The
- format of Language must follow the language format assumed
- the HII Database.
- @param[in] TryBestLanguage If TRUE, try to get the best matching language from all
- supported languages.If FALSE, the Language must be assigned
- for the StringID.
-
- @retval NULL The string specified by StringId is not present in the string package.
- @retval Other The string was returned.
-
-**/
-EFI_STRING
-EFIAPI
-HiiGetStringEx (
- IN EFI_HII_HANDLE HiiHandle,
- IN EFI_STRING_ID StringId,
- IN CONST CHAR8 *Language OPTIONAL,
- IN BOOLEAN TryBestLanguage
- );
-
-/**
- Retrieves a string from a string package named by GUID, in the specified language.
- If the language is not specified, then a string from a string package in the
- current platform language is retrieved. If the string cannot be retrieved
- using the specified language or the current platform language, then the string
- is retrieved from the string package in the first language the string package
- supports. The returned string is allocated using AllocatePool(). The caller
- is responsible for freeing the allocated buffer using FreePool().
-
- If PackageListGuid is NULL, then ASSERT().
- If StringId is 0, then ASSERT().
-
- @param[in] PackageListGuid The GUID of a package list that was previously
- registered in the HII Database.
- @param[in] StringId The identifier of the string to retrieved from the
- string package associated with PackageListGuid.
- @param[in] Language The language of the string to retrieve. If this
- parameter is NULL, then the current platform
- language is used. The format of Language must
- follow the language format assumed in the HII Database.
-
- @retval NULL The package list specified by PackageListGuid is not present in the
- HII Database.
- @retval NULL The string specified by StringId is not present in the string package.
- @retval Other The string was returned.
-
-**/
-EFI_STRING
-EFIAPI
-HiiGetPackageString (
- IN CONST EFI_GUID *PackageListGuid,
- IN EFI_STRING_ID StringId,
- IN CONST CHAR8 *Language OPTIONAL
- )
-;
-
-/**
- Retrieves the array of all the HII Handles or the HII handles of a specific
- package list GUID in the HII Database.
- This array is terminated with a NULL HII Handle.
- This function allocates the returned array using AllocatePool().
- The caller is responsible for freeing the array with FreePool().
-
- @param[in] PackageListGuid An optional parameter that is used to request
- HII Handles associated with a specific
- Package List GUID. If this parameter is NULL,
- then all the HII Handles in the HII Database
- are returned. If this parameter is not NULL,
- then zero or more HII Handles associated with
- PackageListGuid are returned.
-
- @retval NULL No HII handles were found in the HII database
- @retval NULL The array of HII Handles could not be retrieved
- @retval Other A pointer to the NULL terminated array of HII Handles
-
-**/
-EFI_HII_HANDLE *
-EFIAPI
-HiiGetHiiHandles (
- IN CONST EFI_GUID *PackageListGuid OPTIONAL
- )
-;
-
-/**
- This function allows a caller to extract the form set opcode form the Hii Handle.
- The returned buffer is allocated using AllocatePool().The caller is responsible
- for freeing the allocated buffer using FreePool().
-
- @param Handle The HII handle.
- @param Buffer On return, points to a pointer which point to the buffer that contain the formset opcode.
- @param BufferSize On return, points to the length of the buffer.
-
- @retval EFI_OUT_OF_RESOURCES No enough memory resource is allocated.
- @retval EFI_NOT_FOUND Can't find the package data for the input Handle.
- @retval EFI_INVALID_PARAMETER The input parameters are not correct.
- @retval EFI_SUCCESS Get the formset opcode from the hii handle successfully.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiGetFormSetFromHiiHandle (
- IN EFI_HII_HANDLE Handle,
- OUT EFI_IFR_FORM_SET **Buffer,
- OUT UINTN *BufferSize
- );
-
-/**
- Retrieves a pointer to a Null-terminated ASCII string containing the list
- of languages that an HII handle in the HII Database supports. The returned
- string is allocated using AllocatePool(). The caller is responsible for freeing
- the returned string using FreePool(). The format of the returned string follows
- the language format assumed in the HII Database.
-
- If HiiHandle is NULL, then ASSERT().
-
- @param[in] HiiHandle A handle that was previously registered in the HII Database.
-
- @retval NULL HiiHandle is not registered in the HII database
- @retval NULL There are not enough resources available to retrieve the supported
- languages.
- @retval NULL The list of supported languages could not be retrieved.
- @retval Other A pointer to the Null-terminated ASCII string of supported languages.
-
-**/
-CHAR8 *
-EFIAPI
-HiiGetSupportedLanguages (
- IN EFI_HII_HANDLE HiiHandle
- )
-;
-
-/**
- Allocates and returns a Null-terminated Unicode <ConfigHdr> string using routing
- information that includes a GUID, an optional Unicode string name, and a device
- path. The string returned is allocated with AllocatePool(). The caller is
- responsible for freeing the allocated string with FreePool().
-
- The format of a <ConfigHdr> is as follows:
-
- GUID=<HexCh>32&NAME=<Char>NameLength&PATH=<HexChar>DevicePathSize<Null>
-
- @param[in] Guid The pointer to an EFI_GUID that is the routing information
- GUID. Each of the 16 bytes in Guid is converted to
- a 2 Unicode character hexadecimal string. This is
- an optional parameter that may be NULL.
- @param[in] Name The pointer to a Null-terminated Unicode string that is
- the routing information NAME. This is an optional
- parameter that may be NULL. Each 16-bit Unicode
- character in Name is converted to a 4 character Unicode
- hexadecimal string.
- @param[in] DriverHandle The driver handle that supports a Device Path Protocol
- that is the routing information PATH. Each byte of
- the Device Path associated with DriverHandle is converted
- to a two (Unicode) character hexadecimal string.
-
- @retval NULL DriverHandle does not support the Device Path Protocol.
- @retval NULL DriverHandle does not support the Device Path Protocol.
- @retval Other A pointer to the Null-terminate Unicode <ConfigHdr> string
-
-**/
-EFI_STRING
-EFIAPI
-HiiConstructConfigHdr (
- IN CONST EFI_GUID *Guid OPTIONAL,
- IN CONST CHAR16 *Name OPTIONAL,
- IN EFI_HANDLE DriverHandle
- );
-
-/**
- Reset the default value specified by DefaultId to the driver
- configuration specified by the Request string.
-
- NULL request string support depends on the ExportConfig interface of
- HiiConfigRouting protocol in UEFI specification.
-
- @param Request A null-terminated Unicode string in
- <MultiConfigRequest> format. It can be NULL.
- If it is NULL, all configurations for the
- entirety of the current HII database will be reset.
- @param DefaultId Specifies the type of defaults to retrieve.
-
- @retval TRUE The default value was set successfully.
- @retval FALSE The default value was not found.
-**/
-BOOLEAN
-EFIAPI
-HiiSetToDefaults (
- IN CONST EFI_STRING Request OPTIONAL,
- IN UINT16 DefaultId
- );
-
-/**
- Validate the current configuration by parsing the IFR opcode in HII form.
-
- NULL request string support depends on the ExportConfig interface of
- HiiConfigRouting protocol in the UEFI specification.
-
- @param Request A null-terminated Unicode string in
- <MultiConfigRequest> format. It can be NULL.
- If it is NULL, all current configurations for the
- entirety of the current HII database will be validated.
-
- @retval TRUE The current configuration is valid.
- @retval FALSE The current configuration is invalid.
-**/
-BOOLEAN
-EFIAPI
-HiiValidateSettings (
- IN CONST EFI_STRING Request OPTIONAL
- );
-
-/**
- Determines if the routing data specified by GUID and NAME match a <ConfigHdr>.
-
- If ConfigHdr is NULL, then ASSERT().
-
- @param[in] ConfigHdr Either <ConfigRequest> or <ConfigResp>.
- @param[in] Guid The GUID of the storage.
- @param[in] Name The NAME of the storage.
-
- @retval TRUE Routing information matches <ConfigHdr>.
- @retval FALSE Routing information does not match <ConfigHdr>.
-
-**/
-BOOLEAN
-EFIAPI
-HiiIsConfigHdrMatch (
- IN CONST EFI_STRING ConfigHdr,
- IN CONST EFI_GUID *Guid OPTIONAL,
- IN CONST CHAR16 *Name OPTIONAL
- );
-
-/**
- Retrieves uncommitted data from the Form Browser and converts it to a binary
- buffer.
-
- @param[in] VariableGuid The pointer to an EFI_GUID structure. This is an optional
- parameter that may be NULL.
- @param[in] VariableName The pointer to a Null-terminated Unicode string. This
- is an optional parameter that may be NULL.
- @param[in] BufferSize The length in bytes of buffer to hold retrieved data.
- @param[out] Buffer The buffer of data to be updated.
-
- @retval FALSE The uncommitted data could not be retrieved.
- @retval TRUE The uncommitted data was retrieved.
-
-**/
-BOOLEAN
-EFIAPI
-HiiGetBrowserData (
- IN CONST EFI_GUID *VariableGuid OPTIONAL,
- IN CONST CHAR16 *VariableName OPTIONAL,
- IN UINTN BufferSize,
- OUT UINT8 *Buffer
- );
-
-/**
- Updates uncommitted data in the Form Browser.
-
- If Buffer is NULL, then ASSERT().
-
- @param[in] VariableGuid The pointer to an EFI_GUID structure. This is an optional
- parameter that may be NULL.
- @param[in] VariableName The pointer to a Null-terminated Unicode string. This
- is an optional parameter that may be NULL.
- @param[in] BufferSize The length, in bytes, of Buffer.
- @param[in] Buffer The buffer of data to commit.
- @param[in] RequestElement An optional field to specify which part of the
- buffer data will be send back to Browser. If NULL,
- the whole buffer of data will be committed to
- Browser.
- <RequestElement> ::= &OFFSET=<Number>&WIDTH=<Number>*
-
- @retval FALSE The uncommitted data could not be updated.
- @retval TRUE The uncommitted data was updated.
-
-**/
-BOOLEAN
-EFIAPI
-HiiSetBrowserData (
- IN CONST EFI_GUID *VariableGuid OPTIONAL,
- IN CONST CHAR16 *VariableName OPTIONAL,
- IN UINTN BufferSize,
- IN CONST UINT8 *Buffer,
- IN CONST CHAR16 *RequestElement OPTIONAL
- );
-
-/////////////////////////////////////////
-/////////////////////////////////////////
-/// IFR Functions
-/////////////////////////////////////////
-/////////////////////////////////////////
-
-/**
- Returns a UINT64 value that contains bitfields for Hour, Minute, and Second.
- The lower 8-bits of Hour are placed in bits 0..7. The lower 8-bits of Minute
- are placed in bits 8..15, and the lower 8-bits of Second are placed in bits
- 16..23. This format was selected because it can be easily translated to
- an EFI_HII_TIME structure in an EFI_IFR_TYPE_VALUE union.
-
- @param Hour The hour value to be encoded.
- @param Minute The minute value to be encoded.
- @param Second The second value to be encoded.
-
- @return A 64-bit containing Hour, Minute, and Second.
-**/
-#define EFI_HII_TIME_UINT64(Hour, Minute, Second) \
- (UINT64)((Hour & 0xff) | ((Minute & 0xff) << 8) | ((Second & 0xff) << 16))
-
-/**
- Returns a UINT64 value that contains bit fields for Year, Month, and Day.
- The lower 16-bits of Year are placed in bits 0..15. The lower 8-bits of Month
- are placed in bits 16..23, and the lower 8-bits of Day are placed in bits
- 24..31. This format was selected because it can be easily translated to
- an EFI_HII_DATE structure in an EFI_IFR_TYPE_VALUE union.
-
- @param Year The year value to be encoded.
- @param Month The month value to be encoded.
- @param Day The day value to be encoded.
-
- @return A 64-bit containing Year, Month, and Day.
-**/
-#define EFI_HII_DATE_UINT64(Year, Month, Day) \
- (UINT64)((Year & 0xffff) | ((Month & 0xff) << 16) | ((Day & 0xff) << 24))
-
-/**
- Allocates and returns a new OpCode Handle. OpCode Handles must be freed with
- HiiFreeOpCodeHandle().
-
- @retval NULL There are not enough resources to allocate a new OpCode Handle.
- @retval Other A new OpCode handle.
-
-**/
-VOID *
-EFIAPI
-HiiAllocateOpCodeHandle (
- VOID
- );
-
-/**
- Frees an OpCode Handle that was previously allocated with HiiAllocateOpCodeHandle().
- When an OpCode Handle is freed, all of the opcodes associated with the OpCode
- Handle are also freed.
-
- If OpCodeHandle is NULL, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
-
-**/
-VOID
-EFIAPI
-HiiFreeOpCodeHandle (
- VOID *OpCodeHandle
- );
-
-/**
- Append raw opcodes to an OpCodeHandle.
-
- If OpCodeHandle is NULL, then ASSERT().
- If RawBuffer is NULL, then ASSERT();
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] RawBuffer The buffer of opcodes to append.
- @param[in] RawBufferSize The size, in bytes, of Buffer.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the appended opcodes.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateRawOpCodes (
- IN VOID *OpCodeHandle,
- IN UINT8 *RawBuffer,
- IN UINTN RawBufferSize
- );
-
-/**
- Create EFI_IFR_END_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
-
- @param[in] OpCodeHandle Handle to the buffer of opcodes.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateEndOpCode (
- IN VOID *OpCodeHandle
- );
-
-/**
- Create EFI_IFR_ONE_OF_OPTION_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If Type is invalid, then ASSERT().
- If Flags is invalid, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] StringId StringId for the option.
- @param[in] Flags The flags for the option.
- @param[in] Type The type for the option.
- @param[in] Value The value for the option.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateOneOfOptionOpCode (
- IN VOID *OpCodeHandle,
- IN UINT16 StringId,
- IN UINT8 Flags,
- IN UINT8 Type,
- IN UINT64 Value
- );
-
-/**
- Create EFI_IFR_DEFAULT_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If Type is invalid, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] DefaultId The DefaultId for the default.
- @param[in] Type The type for the default.
- @param[in] Value The value for the default.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateDefaultOpCode (
- IN VOID *OpCodeHandle,
- IN UINT16 DefaultId,
- IN UINT8 Type,
- IN UINT64 Value
- );
-
-/**
- Create EFI_IFR_GUID opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If Guid is NULL, then ASSERT().
- If OpCodeSize < sizeof (EFI_IFR_GUID), then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] Guid The pointer to EFI_GUID of this guided opcode.
- @param[in] GuidOpCode The pointer to an EFI_IFR_GUID opcode. This is an
- optional parameter that may be NULL. If this
- parameter is NULL, then the GUID extension
- region of the created opcode is filled with zeros.
- If this parameter is not NULL, then the GUID
- extension region of GuidData will be copied to
- the GUID extension region of the created opcode.
- @param[in] OpCodeSize The size, in bytes, of created opcode. This value
- must be >= sizeof(EFI_IFR_GUID).
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateGuidOpCode (
- IN VOID *OpCodeHandle,
- IN CONST EFI_GUID *Guid,
- IN CONST VOID *GuidOpCode OPTIONAL,
- IN UINTN OpCodeSize
- );
-
-/**
- Create EFI_IFR_ACTION_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] QuestionId The Question ID.
- @param[in] Prompt The String ID for Prompt.
- @param[in] Help The String ID for Help.
- @param[in] QuestionFlags The flags in the Question Header.
- @param[in] QuestionConfig The String ID for the configuration.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateActionOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN EFI_STRING_ID QuestionConfig
- );
-
-/**
- Create EFI_IFR_SUBTITLE_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in Flags, then ASSERT().
- If Scope > 1, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] Flags The subtitle opcode flags.
- @param[in] Scope 1 if this opcode is the beginning of a new scope.
- 0 if this opcode is within the current scope.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateSubTitleOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 Flags,
- IN UINT8 Scope
- );
-
-/**
- Create EFI_IFR_REF_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] FormId The Destination Form ID.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] QuestionFlags The flags in Question Header
- @param[in] QuestionId Question ID.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateGotoOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_FORM_ID FormId,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN EFI_QUESTION_ID QuestionId
- );
-
-/**
- Create EFI_IFR_REF_OP, EFI_IFR_REF2_OP, EFI_IFR_REF3_OP and EFI_IFR_REF4_OP opcode.
-
- When RefDevicePath is not zero, EFI_IFR_REF4 opcode will be created.
- When RefDevicePath is zero and RefFormSetId is not NULL, EFI_IFR_REF3 opcode will be created.
- When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is not zero, EFI_IFR_REF2 opcode will be created.
- When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is zero, EFI_IFR_REF opcode will be created.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] RefFormId The Destination Form ID.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] QuestionFlags The flags in Question Header
- @param[in] QuestionId Question ID.
- @param[in] RefQuestionId The question on the form to which this link is referring.
- If its value is zero, then the link refers to the top of the form.
- @param[in] RefFormSetId The form set to which this link is referring. If its value is NULL, and RefDevicePath is
- zero, then the link is to the current form set.
- @param[in] RefDevicePath The string identifier that specifies the string containing the text representation of
- the device path to which the form set containing the form specified by FormId.
- If its value is zero, then the link refers to the current page.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateGotoExOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_FORM_ID RefFormId,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_QUESTION_ID RefQuestionId,
- IN EFI_GUID *RefFormSetId OPTIONAL,
- IN EFI_STRING_ID RefDevicePath
- );
-
-/**
- Create EFI_IFR_CHECKBOX_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
- If any reserved bits are set in CheckBoxFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] QuestionId The question ID.
- @param[in] VarStoreId The storage ID.
- @param[in] VarOffset Offset in Storage or String ID of the name (VarName)
- for this name/value pair.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] QuestionFlags The flags in Question Header.
- @param[in] CheckBoxFlags The flags for checkbox opcode.
- @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This
- is an optional parameter that may be NULL.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateCheckBoxOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_VARSTORE_ID VarStoreId,
- IN UINT16 VarOffset,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN UINT8 CheckBoxFlags,
- IN VOID *DefaultsOpCodeHandle OPTIONAL
- );
-
-/**
- Create EFI_IFR_NUMERIC_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
- If any reserved bits are set in NumericFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] QuestionId The question ID.
- @param[in] VarStoreId The storage ID.
- @param[in] VarOffset Offset in Storage or String ID of the name (VarName)
- for this name/value pair.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] QuestionFlags The flags in Question Header.
- @param[in] NumericFlags The flags for a numeric opcode.
- @param[in] Minimum The numeric minimum value.
- @param[in] Maximum The numeric maximum value.
- @param[in] Step The numeric step for edit.
- @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This
- is an optional parameter that may be NULL.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateNumericOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_VARSTORE_ID VarStoreId,
- IN UINT16 VarOffset,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN UINT8 NumericFlags,
- IN UINT64 Minimum,
- IN UINT64 Maximum,
- IN UINT64 Step,
- IN VOID *DefaultsOpCodeHandle OPTIONAL
- );
-
-/**
- Create EFI_IFR_STRING_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
- If any reserved bits are set in StringFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] QuestionId The question ID.
- @param[in] VarStoreId The storage ID.
- @param[in] VarOffset Offset in Storage or String ID of the name (VarName)
- for this name/value pair.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] QuestionFlags The flags in Question Header.
- @param[in] StringFlags The flags for a string opcode.
- @param[in] MinSize The string minimum length.
- @param[in] MaxSize The string maximum length.
- @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This
- is an optional parameter that may be NULL.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateStringOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_VARSTORE_ID VarStoreId,
- IN UINT16 VarOffset,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN UINT8 StringFlags,
- IN UINT8 MinSize,
- IN UINT8 MaxSize,
- IN VOID *DefaultsOpCodeHandle OPTIONAL
- );
-
-/**
- Create EFI_IFR_ONE_OF_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
- If any reserved bits are set in OneOfFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] QuestionId The question ID.
- @param[in] VarStoreId The storage ID.
- @param[in] VarOffset Offset in Storage or String ID of the name (VarName)
- for this name/value pair.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] QuestionFlags The flags in Question Header.
- @param[in] OneOfFlags The flags for a oneof opcode.
- @param[in] OptionsOpCodeHandle The handle for a buffer of ONE_OF_OPTION opcodes.
- @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This
- is an optional parameter that may be NULL.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateOneOfOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_VARSTORE_ID VarStoreId,
- IN UINT16 VarOffset,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN UINT8 OneOfFlags,
- IN VOID *OptionsOpCodeHandle,
- IN VOID *DefaultsOpCodeHandle OPTIONAL
- );
-
-/**
- Create EFI_IFR_ORDERED_LIST_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
- If any reserved bits are set in OrderedListFlags, then ASSERT().
-
- @param[in] OpCodeHandle The handle to the buffer of opcodes.
- @param[in] QuestionId The question ID.
- @param[in] VarStoreId The storage ID.
- @param[in] VarOffset Offset in Storage or String ID of the name (VarName)
- for this name/value pair.
- @param[in] Prompt The string ID for Prompt.
- @param[in] Help The string ID for Help.
- @param[in] QuestionFlags The flags in Question Header.
- @param[in] OrderedListFlags The flags for an ordered list opcode.
- @param[in] DataType The type for option value.
- @param[in] MaxContainers Maximum count for options in this ordered list
- @param[in] OptionsOpCodeHandle The handle for a buffer of ONE_OF_OPTION opcodes.
- @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This
- is an optional parameter that may be NULL.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateOrderedListOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_VARSTORE_ID VarStoreId,
- IN UINT16 VarOffset,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN UINT8 OrderedListFlags,
- IN UINT8 DataType,
- IN UINT8 MaxContainers,
- IN VOID *OptionsOpCodeHandle,
- IN VOID *DefaultsOpCodeHandle OPTIONAL
- );
-
-/**
- Create EFI_IFR_TEXT_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
-
- @param[in] OpCodeHandle Handle to the buffer of opcodes.
- @param[in] Prompt String ID for Prompt.
- @param[in] Help String ID for Help.
- @param[in] TextTwo String ID for TextTwo.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateTextOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN EFI_STRING_ID TextTwo
- );
-
-/**
- Create EFI_IFR_DATE_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
- If any reserved bits are set in DateFlags, then ASSERT().
-
- @param[in] OpCodeHandle Handle to the buffer of opcodes.
- @param[in] QuestionId Question ID
- @param[in] VarStoreId Storage ID, optional. If DateFlags is not
- QF_DATE_STORAGE_NORMAL, this parameter is ignored.
- @param[in] VarOffset Offset in Storage or String ID of the name (VarName)
- for this name/value pair, optional. If DateFlags is not
- QF_DATE_STORAGE_NORMAL, this parameter is ignored.
- @param[in] Prompt String ID for Prompt
- @param[in] Help String ID for Help
- @param[in] QuestionFlags Flags in Question Header
- @param[in] DateFlags Flags for date opcode
- @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This
- is an optional parameter that may be NULL.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateDateOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_VARSTORE_ID VarStoreId OPTIONAL,
- IN UINT16 VarOffset OPTIONAL,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN UINT8 DateFlags,
- IN VOID *DefaultsOpCodeHandle OPTIONAL
- );
-
-/**
- Create EFI_IFR_TIME_OP opcode.
-
- If OpCodeHandle is NULL, then ASSERT().
- If any reserved bits are set in QuestionFlags, then ASSERT().
- If any reserved bits are set in TimeFlags, then ASSERT().
-
- @param[in] OpCodeHandle Handle to the buffer of opcodes.
- @param[in] QuestionId Question ID
- @param[in] VarStoreId Storage ID, optional. If TimeFlags is not
- QF_TIME_STORAGE_NORMAL, this parameter is ignored.
- @param[in] VarOffset Offset in Storage or String ID of the name (VarName)
- for this name/value pair, optional. If TimeFlags is not
- QF_TIME_STORAGE_NORMAL, this parameter is ignored.
- @param[in] Prompt String ID for Prompt
- @param[in] Help String ID for Help
- @param[in] QuestionFlags Flags in Question Header
- @param[in] TimeFlags Flags for time opcode
- @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This
- is an optional parameter that may be NULL.
-
- @retval NULL There is not enough space left in Buffer to add the opcode.
- @retval Other A pointer to the created opcode.
-
-**/
-UINT8 *
-EFIAPI
-HiiCreateTimeOpCode (
- IN VOID *OpCodeHandle,
- IN EFI_QUESTION_ID QuestionId,
- IN EFI_VARSTORE_ID VarStoreId OPTIONAL,
- IN UINT16 VarOffset OPTIONAL,
- IN EFI_STRING_ID Prompt,
- IN EFI_STRING_ID Help,
- IN UINT8 QuestionFlags,
- IN UINT8 TimeFlags,
- IN VOID *DefaultsOpCodeHandle OPTIONAL
- );
-
-/**
- This function updates a form that has previously been registered with the HII
- Database. This function will perform at most one update operation.
-
- The form to update is specified by Handle, FormSetGuid, and FormId. Binary
- comparisons of IFR opcodes are performed from the beginning of the form being
- updated until an IFR opcode is found that exactly matches the first IFR opcode
- specified by StartOpCodeHandle. The following rules are used to determine if
- an insert, replace, or delete operation is performed:
-
- 1) If no matches are found, then NULL is returned.
- 2) If a match is found, and EndOpCodeHandle is NULL, then all of the IFR opcodes
- from StartOpCodeHandle except the first opcode are inserted immediately after
- the matching IFR opcode in the form to be updated.
- 3) If a match is found, and EndOpCodeHandle is not NULL, then a search is made
- from the matching IFR opcode until an IFR opcode exactly matches the first
- IFR opcode specified by EndOpCodeHandle. If no match is found for the first
- IFR opcode specified by EndOpCodeHandle, then NULL is returned. If a match
- is found, then all of the IFR opcodes between the start match and the end
- match are deleted from the form being updated and all of the IFR opcodes
- from StartOpCodeHandle except the first opcode are inserted immediately after
- the matching start IFR opcode. If StartOpCcodeHandle only contains one
- IFR instruction, then the result of this operation will delete all of the IFR
- opcodes between the start end matches.
-
- If HiiHandle is NULL, then ASSERT().
- If StartOpCodeHandle is NULL, then ASSERT().
-
- @param[in] HiiHandle The HII Handle of the form to update.
- @param[in] FormSetGuid The Formset GUID of the form to update. This
- is an optional parameter that may be NULL.
- If it is NULL, all FormSet will be updated.
- @param[in] FormId The ID of the form to update.
- @param[in] StartOpCodeHandle An OpCode Handle that contains the set of IFR
- opcodes to be inserted or replaced in the form.
- The first IFR instruction in StartOpCodeHandle
- is used to find matching IFR opcode in the
- form.
- @param[in] EndOpCodeHandle An OpCcode Handle that contains the IFR opcode
- that marks the end of a replace operation in
- the form. This is an optional parameter that
- may be NULL. If it is NULL, then the IFR
- opcodes specified by StartOpCodeHandle are
- inserted into the form.
-
- @retval EFI_OUT_OF_RESOURCES Not enough memory resources are allocated.
- @retval EFI_NOT_FOUND The following cases will return EFI_NOT_FOUND:
- 1) The form specified by HiiHandle, FormSetGuid,
- and FormId could not be found in the HII Database.
- 2) No IFR opcodes in the target form match the first
- IFR opcode in StartOpCodeHandle.
- 3) EndOpCOde is not NULL, and no IFR opcodes in the
- target form following a matching start opcode match
- the first IFR opcode in EndOpCodeHandle.
- @retval EFI_SUCCESS The matched form is updated by StartOpcode.
-
-**/
-EFI_STATUS
-EFIAPI
-HiiUpdateForm (
- IN EFI_HII_HANDLE HiiHandle,
- IN EFI_GUID *FormSetGuid OPTIONAL,
- IN EFI_FORM_ID FormId,
- IN VOID *StartOpCodeHandle,
- IN VOID *EndOpCodeHandle OPTIONAL
- );
-
-#endif
+/** @file + Public include file for the HII Library + +Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR> +(C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __HII_LIB_H__ +#define __HII_LIB_H__ + +//////////////////////////////////////////////////////// +//////////////////////////////////////////////////////// +// HiiLib Functions +//////////////////////////////////////////////////////// +//////////////////////////////////////////////////////// + +/** + Registers a list of packages in the HII Database and returns the HII Handle + associated with that registration. If an HII Handle has already been registered + with the same PackageListGuid and DeviceHandle, then NULL is returned. If there + are not enough resources to perform the registration, then NULL is returned. + If an empty list of packages is passed in, then NULL is returned. If the size of + the list of package is 0, then NULL is returned. + + The variable arguments are pointers that point to package headers defined + by UEFI VFR compiler and StringGather tool. + + #pragma pack (push, 1) + typedef struct { + UINT32 BinaryLength; + EFI_HII_PACKAGE_HEADER PackageHeader; + } EDKII_AUTOGEN_PACKAGES_HEADER; + #pragma pack (pop) + + @param[in] PackageListGuid The GUID of the package list. + @param[in] DeviceHandle If not NULL, the Device Handle on which + an instance of DEVICE_PATH_PROTOCOL is installed. + This Device Handle uniquely defines the device that + the added packages are associated with. + @param[in] ... The variable argument list that contains pointers + to packages terminated by a NULL. + + @retval NULL An HII Handle has already been registered in the HII Database with + the same PackageListGuid and DeviceHandle. + @retval NULL The HII Handle could not be created. + @retval NULL An empty list of packages was passed in. + @retval NULL All packages are empty. + @retval Other The HII Handle associated with the newly registered package list. + +**/ +EFI_HII_HANDLE +EFIAPI +HiiAddPackages ( + IN CONST EFI_GUID *PackageListGuid, + IN EFI_HANDLE DeviceHandle OPTIONAL, + ... + ) +; + +/** + Removes a package list from the HII database. + + If HiiHandle is NULL, then ASSERT(). + If HiiHandle is not a valid EFI_HII_HANDLE in the HII database, then ASSERT(). + + @param[in] HiiHandle The handle that was previously registered in the HII database + +**/ +VOID +EFIAPI +HiiRemovePackages ( + IN EFI_HII_HANDLE HiiHandle + ) +; + +/** + This function creates a new string in String Package or updates an existing + string in a String Package. If StringId is 0, then a new string is added to + a String Package. If StringId is not zero, then a string in String Package is + updated. If SupportedLanguages is NULL, then the string is added or updated + for all the languages that the String Package supports. If SupportedLanguages + is not NULL, then the string is added or updated for the set of languages + specified by SupportedLanguages. + + If HiiHandle is NULL, then ASSERT(). + If String is NULL, then ASSERT(). + + @param[in] HiiHandle A handle that was previously registered in the + HII Database. + @param[in] StringId If zero, then a new string is created in the + String Package associated with HiiHandle. If + non-zero, then the string specified by StringId + is updated in the String Package associated + with HiiHandle. + @param[in] String A pointer to the Null-terminated Unicode string + to add or update in the String Package associated + with HiiHandle. + @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string of + language codes. If this parameter is NULL, then + String is added or updated in the String Package + associated with HiiHandle for all the languages + that the String Package supports. If this + parameter is not NULL, then String is added + or updated in the String Package associated with + HiiHandle for the set of languages specified by + SupportedLanguages. The format of + SupportedLanguages must follow the language + format assumed in the HII Database. + + @retval 0 The string could not be added or updated in the String Package. + @retval Other The EFI_STRING_ID of the newly added or updated string. + +**/ +EFI_STRING_ID +EFIAPI +HiiSetString ( + IN EFI_HII_HANDLE HiiHandle, + IN EFI_STRING_ID StringId OPTIONAL, + IN CONST EFI_STRING String, + IN CONST CHAR8 *SupportedLanguages OPTIONAL + ) +; + +/** + Retrieves a string from a string package in a specific language specified in Language + or in the best lanaguage. See HiiGetStringEx () for the details. + + @param[in] HiiHandle A handle that was previously registered in the HII Database. + @param[in] StringId The identifier of the string to retrieved from the string + package associated with HiiHandle. + @param[in] Language The language of the string to retrieve. If this parameter + is NULL, then the current platform language is used. The + format of Language must follow the language format assumed in + the HII Database. + + @retval NULL The string specified by StringId is not present in the string package. + @retval Other The string was returned. + +**/ +EFI_STRING +EFIAPI +HiiGetString ( + IN EFI_HII_HANDLE HiiHandle, + IN EFI_STRING_ID StringId, + IN CONST CHAR8 *Language OPTIONAL + ); + +/** + Retrieves a string from a string package in a specific language or in the best + language at discretion of this function according to the priority of languages. + TryBestLanguage is used to get the string in the best language or in the language + specified in Language parameter. The behavior is, + If TryBestLanguage is TRUE, this function looks for the best language for the string. + - If the string can not be retrieved using the specified language or the current + platform language, then the string is retrieved from the string package in the + first language the string package supports. + If TryBestLanguage is FALSE, Language must be specified for retrieving the string. + + The returned string is allocated using AllocatePool(). The caller is responsible + for freeing the allocated buffer using FreePool(). + + If HiiHandle is NULL, then ASSERT(). + If StringId is 0, then ASSET. + If TryBestLanguage is FALE and Language is NULL, then ASSERT(). + + @param[in] HiiHandle A handle that was previously registered in the HII Database. + @param[in] StringId The identifier of the string to retrieved from the string + package associated with HiiHandle. + @param[in] Language The language of the string to retrieve. If this parameter + is NULL, then the current platform language is used. The + format of Language must follow the language format assumed + the HII Database. + @param[in] TryBestLanguage If TRUE, try to get the best matching language from all + supported languages.If FALSE, the Language must be assigned + for the StringID. + + @retval NULL The string specified by StringId is not present in the string package. + @retval Other The string was returned. + +**/ +EFI_STRING +EFIAPI +HiiGetStringEx ( + IN EFI_HII_HANDLE HiiHandle, + IN EFI_STRING_ID StringId, + IN CONST CHAR8 *Language OPTIONAL, + IN BOOLEAN TryBestLanguage + ); + +/** + Retrieves a string from a string package named by GUID, in the specified language. + If the language is not specified, then a string from a string package in the + current platform language is retrieved. If the string cannot be retrieved + using the specified language or the current platform language, then the string + is retrieved from the string package in the first language the string package + supports. The returned string is allocated using AllocatePool(). The caller + is responsible for freeing the allocated buffer using FreePool(). + + If PackageListGuid is NULL, then ASSERT(). + If StringId is 0, then ASSERT(). + + @param[in] PackageListGuid The GUID of a package list that was previously + registered in the HII Database. + @param[in] StringId The identifier of the string to retrieved from the + string package associated with PackageListGuid. + @param[in] Language The language of the string to retrieve. If this + parameter is NULL, then the current platform + language is used. The format of Language must + follow the language format assumed in the HII Database. + + @retval NULL The package list specified by PackageListGuid is not present in the + HII Database. + @retval NULL The string specified by StringId is not present in the string package. + @retval Other The string was returned. + +**/ +EFI_STRING +EFIAPI +HiiGetPackageString ( + IN CONST EFI_GUID *PackageListGuid, + IN EFI_STRING_ID StringId, + IN CONST CHAR8 *Language OPTIONAL + ) +; + +/** + Retrieves the array of all the HII Handles or the HII handles of a specific + package list GUID in the HII Database. + This array is terminated with a NULL HII Handle. + This function allocates the returned array using AllocatePool(). + The caller is responsible for freeing the array with FreePool(). + + @param[in] PackageListGuid An optional parameter that is used to request + HII Handles associated with a specific + Package List GUID. If this parameter is NULL, + then all the HII Handles in the HII Database + are returned. If this parameter is not NULL, + then zero or more HII Handles associated with + PackageListGuid are returned. + + @retval NULL No HII handles were found in the HII database + @retval NULL The array of HII Handles could not be retrieved + @retval Other A pointer to the NULL terminated array of HII Handles + +**/ +EFI_HII_HANDLE * +EFIAPI +HiiGetHiiHandles ( + IN CONST EFI_GUID *PackageListGuid OPTIONAL + ) +; + +/** + This function allows a caller to extract the form set opcode form the Hii Handle. + The returned buffer is allocated using AllocatePool().The caller is responsible + for freeing the allocated buffer using FreePool(). + + @param Handle The HII handle. + @param Buffer On return, points to a pointer which point to the buffer that contain the formset opcode. + @param BufferSize On return, points to the length of the buffer. + + @retval EFI_OUT_OF_RESOURCES No enough memory resource is allocated. + @retval EFI_NOT_FOUND Can't find the package data for the input Handle. + @retval EFI_INVALID_PARAMETER The input parameters are not correct. + @retval EFI_SUCCESS Get the formset opcode from the hii handle successfully. + +**/ +EFI_STATUS +EFIAPI +HiiGetFormSetFromHiiHandle ( + IN EFI_HII_HANDLE Handle, + OUT EFI_IFR_FORM_SET **Buffer, + OUT UINTN *BufferSize + ); + +/** + Retrieves a pointer to a Null-terminated ASCII string containing the list + of languages that an HII handle in the HII Database supports. The returned + string is allocated using AllocatePool(). The caller is responsible for freeing + the returned string using FreePool(). The format of the returned string follows + the language format assumed in the HII Database. + + If HiiHandle is NULL, then ASSERT(). + + @param[in] HiiHandle A handle that was previously registered in the HII Database. + + @retval NULL HiiHandle is not registered in the HII database + @retval NULL There are not enough resources available to retrieve the supported + languages. + @retval NULL The list of supported languages could not be retrieved. + @retval Other A pointer to the Null-terminated ASCII string of supported languages. + +**/ +CHAR8 * +EFIAPI +HiiGetSupportedLanguages ( + IN EFI_HII_HANDLE HiiHandle + ) +; + +/** + Allocates and returns a Null-terminated Unicode <ConfigHdr> string using routing + information that includes a GUID, an optional Unicode string name, and a device + path. The string returned is allocated with AllocatePool(). The caller is + responsible for freeing the allocated string with FreePool(). + + The format of a <ConfigHdr> is as follows: + + GUID=<HexCh>32&NAME=<Char>NameLength&PATH=<HexChar>DevicePathSize<Null> + + @param[in] Guid The pointer to an EFI_GUID that is the routing information + GUID. Each of the 16 bytes in Guid is converted to + a 2 Unicode character hexadecimal string. This is + an optional parameter that may be NULL. + @param[in] Name The pointer to a Null-terminated Unicode string that is + the routing information NAME. This is an optional + parameter that may be NULL. Each 16-bit Unicode + character in Name is converted to a 4 character Unicode + hexadecimal string. + @param[in] DriverHandle The driver handle that supports a Device Path Protocol + that is the routing information PATH. Each byte of + the Device Path associated with DriverHandle is converted + to a two (Unicode) character hexadecimal string. + + @retval NULL DriverHandle does not support the Device Path Protocol. + @retval NULL DriverHandle does not support the Device Path Protocol. + @retval Other A pointer to the Null-terminate Unicode <ConfigHdr> string + +**/ +EFI_STRING +EFIAPI +HiiConstructConfigHdr ( + IN CONST EFI_GUID *Guid OPTIONAL, + IN CONST CHAR16 *Name OPTIONAL, + IN EFI_HANDLE DriverHandle + ); + +/** + Reset the default value specified by DefaultId to the driver + configuration specified by the Request string. + + NULL request string support depends on the ExportConfig interface of + HiiConfigRouting protocol in UEFI specification. + + @param Request A null-terminated Unicode string in + <MultiConfigRequest> format. It can be NULL. + If it is NULL, all configurations for the + entirety of the current HII database will be reset. + @param DefaultId Specifies the type of defaults to retrieve. + + @retval TRUE The default value was set successfully. + @retval FALSE The default value was not found. +**/ +BOOLEAN +EFIAPI +HiiSetToDefaults ( + IN CONST EFI_STRING Request OPTIONAL, + IN UINT16 DefaultId + ); + +/** + Validate the current configuration by parsing the IFR opcode in HII form. + + NULL request string support depends on the ExportConfig interface of + HiiConfigRouting protocol in the UEFI specification. + + @param Request A null-terminated Unicode string in + <MultiConfigRequest> format. It can be NULL. + If it is NULL, all current configurations for the + entirety of the current HII database will be validated. + + @retval TRUE The current configuration is valid. + @retval FALSE The current configuration is invalid. +**/ +BOOLEAN +EFIAPI +HiiValidateSettings ( + IN CONST EFI_STRING Request OPTIONAL + ); + +/** + Determines if the routing data specified by GUID and NAME match a <ConfigHdr>. + + If ConfigHdr is NULL, then ASSERT(). + + @param[in] ConfigHdr Either <ConfigRequest> or <ConfigResp>. + @param[in] Guid The GUID of the storage. + @param[in] Name The NAME of the storage. + + @retval TRUE Routing information matches <ConfigHdr>. + @retval FALSE Routing information does not match <ConfigHdr>. + +**/ +BOOLEAN +EFIAPI +HiiIsConfigHdrMatch ( + IN CONST EFI_STRING ConfigHdr, + IN CONST EFI_GUID *Guid OPTIONAL, + IN CONST CHAR16 *Name OPTIONAL + ); + +/** + Retrieves uncommitted data from the Form Browser and converts it to a binary + buffer. + + @param[in] VariableGuid The pointer to an EFI_GUID structure. This is an optional + parameter that may be NULL. + @param[in] VariableName The pointer to a Null-terminated Unicode string. This + is an optional parameter that may be NULL. + @param[in] BufferSize The length in bytes of buffer to hold retrieved data. + @param[out] Buffer The buffer of data to be updated. + + @retval FALSE The uncommitted data could not be retrieved. + @retval TRUE The uncommitted data was retrieved. + +**/ +BOOLEAN +EFIAPI +HiiGetBrowserData ( + IN CONST EFI_GUID *VariableGuid OPTIONAL, + IN CONST CHAR16 *VariableName OPTIONAL, + IN UINTN BufferSize, + OUT UINT8 *Buffer + ); + +/** + Updates uncommitted data in the Form Browser. + + If Buffer is NULL, then ASSERT(). + + @param[in] VariableGuid The pointer to an EFI_GUID structure. This is an optional + parameter that may be NULL. + @param[in] VariableName The pointer to a Null-terminated Unicode string. This + is an optional parameter that may be NULL. + @param[in] BufferSize The length, in bytes, of Buffer. + @param[in] Buffer The buffer of data to commit. + @param[in] RequestElement An optional field to specify which part of the + buffer data will be send back to Browser. If NULL, + the whole buffer of data will be committed to + Browser. + <RequestElement> ::= &OFFSET=<Number>&WIDTH=<Number>* + + @retval FALSE The uncommitted data could not be updated. + @retval TRUE The uncommitted data was updated. + +**/ +BOOLEAN +EFIAPI +HiiSetBrowserData ( + IN CONST EFI_GUID *VariableGuid OPTIONAL, + IN CONST CHAR16 *VariableName OPTIONAL, + IN UINTN BufferSize, + IN CONST UINT8 *Buffer, + IN CONST CHAR16 *RequestElement OPTIONAL + ); + +///////////////////////////////////////// +///////////////////////////////////////// +/// IFR Functions +///////////////////////////////////////// +///////////////////////////////////////// + +/** + Returns a UINT64 value that contains bitfields for Hour, Minute, and Second. + The lower 8-bits of Hour are placed in bits 0..7. The lower 8-bits of Minute + are placed in bits 8..15, and the lower 8-bits of Second are placed in bits + 16..23. This format was selected because it can be easily translated to + an EFI_HII_TIME structure in an EFI_IFR_TYPE_VALUE union. + + @param Hour The hour value to be encoded. + @param Minute The minute value to be encoded. + @param Second The second value to be encoded. + + @return A 64-bit containing Hour, Minute, and Second. +**/ +#define EFI_HII_TIME_UINT64(Hour, Minute, Second) \ + (UINT64)((Hour & 0xff) | ((Minute & 0xff) << 8) | ((Second & 0xff) << 16)) + +/** + Returns a UINT64 value that contains bit fields for Year, Month, and Day. + The lower 16-bits of Year are placed in bits 0..15. The lower 8-bits of Month + are placed in bits 16..23, and the lower 8-bits of Day are placed in bits + 24..31. This format was selected because it can be easily translated to + an EFI_HII_DATE structure in an EFI_IFR_TYPE_VALUE union. + + @param Year The year value to be encoded. + @param Month The month value to be encoded. + @param Day The day value to be encoded. + + @return A 64-bit containing Year, Month, and Day. +**/ +#define EFI_HII_DATE_UINT64(Year, Month, Day) \ + (UINT64)((Year & 0xffff) | ((Month & 0xff) << 16) | ((Day & 0xff) << 24)) + +/** + Allocates and returns a new OpCode Handle. OpCode Handles must be freed with + HiiFreeOpCodeHandle(). + + @retval NULL There are not enough resources to allocate a new OpCode Handle. + @retval Other A new OpCode handle. + +**/ +VOID * +EFIAPI +HiiAllocateOpCodeHandle ( + VOID + ); + +/** + Frees an OpCode Handle that was previously allocated with HiiAllocateOpCodeHandle(). + When an OpCode Handle is freed, all of the opcodes associated with the OpCode + Handle are also freed. + + If OpCodeHandle is NULL, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + +**/ +VOID +EFIAPI +HiiFreeOpCodeHandle ( + VOID *OpCodeHandle + ); + +/** + Append raw opcodes to an OpCodeHandle. + + If OpCodeHandle is NULL, then ASSERT(). + If RawBuffer is NULL, then ASSERT(); + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] RawBuffer The buffer of opcodes to append. + @param[in] RawBufferSize The size, in bytes, of Buffer. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the appended opcodes. + +**/ +UINT8 * +EFIAPI +HiiCreateRawOpCodes ( + IN VOID *OpCodeHandle, + IN UINT8 *RawBuffer, + IN UINTN RawBufferSize + ); + +/** + Create EFI_IFR_END_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + + @param[in] OpCodeHandle Handle to the buffer of opcodes. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateEndOpCode ( + IN VOID *OpCodeHandle + ); + +/** + Create EFI_IFR_ONE_OF_OPTION_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If Type is invalid, then ASSERT(). + If Flags is invalid, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] StringId StringId for the option. + @param[in] Flags The flags for the option. + @param[in] Type The type for the option. + @param[in] Value The value for the option. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateOneOfOptionOpCode ( + IN VOID *OpCodeHandle, + IN UINT16 StringId, + IN UINT8 Flags, + IN UINT8 Type, + IN UINT64 Value + ); + +/** + Create EFI_IFR_DEFAULT_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If Type is invalid, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] DefaultId The DefaultId for the default. + @param[in] Type The type for the default. + @param[in] Value The value for the default. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateDefaultOpCode ( + IN VOID *OpCodeHandle, + IN UINT16 DefaultId, + IN UINT8 Type, + IN UINT64 Value + ); + +/** + Create EFI_IFR_GUID opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If Guid is NULL, then ASSERT(). + If OpCodeSize < sizeof (EFI_IFR_GUID), then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] Guid The pointer to EFI_GUID of this guided opcode. + @param[in] GuidOpCode The pointer to an EFI_IFR_GUID opcode. This is an + optional parameter that may be NULL. If this + parameter is NULL, then the GUID extension + region of the created opcode is filled with zeros. + If this parameter is not NULL, then the GUID + extension region of GuidData will be copied to + the GUID extension region of the created opcode. + @param[in] OpCodeSize The size, in bytes, of created opcode. This value + must be >= sizeof(EFI_IFR_GUID). + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateGuidOpCode ( + IN VOID *OpCodeHandle, + IN CONST EFI_GUID *Guid, + IN CONST VOID *GuidOpCode OPTIONAL, + IN UINTN OpCodeSize + ); + +/** + Create EFI_IFR_ACTION_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] QuestionId The Question ID. + @param[in] Prompt The String ID for Prompt. + @param[in] Help The String ID for Help. + @param[in] QuestionFlags The flags in the Question Header. + @param[in] QuestionConfig The String ID for the configuration. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateActionOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN EFI_STRING_ID QuestionConfig + ); + +/** + Create EFI_IFR_SUBTITLE_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in Flags, then ASSERT(). + If Scope > 1, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] Flags The subtitle opcode flags. + @param[in] Scope 1 if this opcode is the beginning of a new scope. + 0 if this opcode is within the current scope. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateSubTitleOpCode ( + IN VOID *OpCodeHandle, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 Flags, + IN UINT8 Scope + ); + +/** + Create EFI_IFR_REF_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] FormId The Destination Form ID. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] QuestionFlags The flags in Question Header + @param[in] QuestionId Question ID. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateGotoOpCode ( + IN VOID *OpCodeHandle, + IN EFI_FORM_ID FormId, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN EFI_QUESTION_ID QuestionId + ); + +/** + Create EFI_IFR_REF_OP, EFI_IFR_REF2_OP, EFI_IFR_REF3_OP and EFI_IFR_REF4_OP opcode. + + When RefDevicePath is not zero, EFI_IFR_REF4 opcode will be created. + When RefDevicePath is zero and RefFormSetId is not NULL, EFI_IFR_REF3 opcode will be created. + When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is not zero, EFI_IFR_REF2 opcode will be created. + When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is zero, EFI_IFR_REF opcode will be created. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] RefFormId The Destination Form ID. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] QuestionFlags The flags in Question Header + @param[in] QuestionId Question ID. + @param[in] RefQuestionId The question on the form to which this link is referring. + If its value is zero, then the link refers to the top of the form. + @param[in] RefFormSetId The form set to which this link is referring. If its value is NULL, and RefDevicePath is + zero, then the link is to the current form set. + @param[in] RefDevicePath The string identifier that specifies the string containing the text representation of + the device path to which the form set containing the form specified by FormId. + If its value is zero, then the link refers to the current page. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateGotoExOpCode ( + IN VOID *OpCodeHandle, + IN EFI_FORM_ID RefFormId, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN EFI_QUESTION_ID QuestionId, + IN EFI_QUESTION_ID RefQuestionId, + IN EFI_GUID *RefFormSetId OPTIONAL, + IN EFI_STRING_ID RefDevicePath + ); + +/** + Create EFI_IFR_CHECKBOX_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + If any reserved bits are set in CheckBoxFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] QuestionId The question ID. + @param[in] VarStoreId The storage ID. + @param[in] VarOffset Offset in Storage or String ID of the name (VarName) + for this name/value pair. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] QuestionFlags The flags in Question Header. + @param[in] CheckBoxFlags The flags for checkbox opcode. + @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This + is an optional parameter that may be NULL. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateCheckBoxOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_VARSTORE_ID VarStoreId, + IN UINT16 VarOffset, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN UINT8 CheckBoxFlags, + IN VOID *DefaultsOpCodeHandle OPTIONAL + ); + +/** + Create EFI_IFR_NUMERIC_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + If any reserved bits are set in NumericFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] QuestionId The question ID. + @param[in] VarStoreId The storage ID. + @param[in] VarOffset Offset in Storage or String ID of the name (VarName) + for this name/value pair. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] QuestionFlags The flags in Question Header. + @param[in] NumericFlags The flags for a numeric opcode. + @param[in] Minimum The numeric minimum value. + @param[in] Maximum The numeric maximum value. + @param[in] Step The numeric step for edit. + @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This + is an optional parameter that may be NULL. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateNumericOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_VARSTORE_ID VarStoreId, + IN UINT16 VarOffset, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN UINT8 NumericFlags, + IN UINT64 Minimum, + IN UINT64 Maximum, + IN UINT64 Step, + IN VOID *DefaultsOpCodeHandle OPTIONAL + ); + +/** + Create EFI_IFR_STRING_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + If any reserved bits are set in StringFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] QuestionId The question ID. + @param[in] VarStoreId The storage ID. + @param[in] VarOffset Offset in Storage or String ID of the name (VarName) + for this name/value pair. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] QuestionFlags The flags in Question Header. + @param[in] StringFlags The flags for a string opcode. + @param[in] MinSize The string minimum length. + @param[in] MaxSize The string maximum length. + @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This + is an optional parameter that may be NULL. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateStringOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_VARSTORE_ID VarStoreId, + IN UINT16 VarOffset, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN UINT8 StringFlags, + IN UINT8 MinSize, + IN UINT8 MaxSize, + IN VOID *DefaultsOpCodeHandle OPTIONAL + ); + +/** + Create EFI_IFR_ONE_OF_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + If any reserved bits are set in OneOfFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] QuestionId The question ID. + @param[in] VarStoreId The storage ID. + @param[in] VarOffset Offset in Storage or String ID of the name (VarName) + for this name/value pair. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] QuestionFlags The flags in Question Header. + @param[in] OneOfFlags The flags for a oneof opcode. + @param[in] OptionsOpCodeHandle The handle for a buffer of ONE_OF_OPTION opcodes. + @param[in] DefaultsOpCodeHandle The handle for a buffer of DEFAULT opcodes. This + is an optional parameter that may be NULL. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateOneOfOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_VARSTORE_ID VarStoreId, + IN UINT16 VarOffset, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN UINT8 OneOfFlags, + IN VOID *OptionsOpCodeHandle, + IN VOID *DefaultsOpCodeHandle OPTIONAL + ); + +/** + Create EFI_IFR_ORDERED_LIST_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + If any reserved bits are set in OrderedListFlags, then ASSERT(). + + @param[in] OpCodeHandle The handle to the buffer of opcodes. + @param[in] QuestionId The question ID. + @param[in] VarStoreId The storage ID. + @param[in] VarOffset Offset in Storage or String ID of the name (VarName) + for this name/value pair. + @param[in] Prompt The string ID for Prompt. + @param[in] Help The string ID for Help. + @param[in] QuestionFlags The flags in Question Header. + @param[in] OrderedListFlags The flags for an ordered list opcode. + @param[in] DataType The type for option value. + @param[in] MaxContainers Maximum count for options in this ordered list + @param[in] OptionsOpCodeHandle The handle for a buffer of ONE_OF_OPTION opcodes. + @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This + is an optional parameter that may be NULL. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateOrderedListOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_VARSTORE_ID VarStoreId, + IN UINT16 VarOffset, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN UINT8 OrderedListFlags, + IN UINT8 DataType, + IN UINT8 MaxContainers, + IN VOID *OptionsOpCodeHandle, + IN VOID *DefaultsOpCodeHandle OPTIONAL + ); + +/** + Create EFI_IFR_TEXT_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + + @param[in] OpCodeHandle Handle to the buffer of opcodes. + @param[in] Prompt String ID for Prompt. + @param[in] Help String ID for Help. + @param[in] TextTwo String ID for TextTwo. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateTextOpCode ( + IN VOID *OpCodeHandle, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN EFI_STRING_ID TextTwo + ); + +/** + Create EFI_IFR_DATE_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + If any reserved bits are set in DateFlags, then ASSERT(). + + @param[in] OpCodeHandle Handle to the buffer of opcodes. + @param[in] QuestionId Question ID + @param[in] VarStoreId Storage ID, optional. If DateFlags is not + QF_DATE_STORAGE_NORMAL, this parameter is ignored. + @param[in] VarOffset Offset in Storage or String ID of the name (VarName) + for this name/value pair, optional. If DateFlags is not + QF_DATE_STORAGE_NORMAL, this parameter is ignored. + @param[in] Prompt String ID for Prompt + @param[in] Help String ID for Help + @param[in] QuestionFlags Flags in Question Header + @param[in] DateFlags Flags for date opcode + @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This + is an optional parameter that may be NULL. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateDateOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_VARSTORE_ID VarStoreId OPTIONAL, + IN UINT16 VarOffset OPTIONAL, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN UINT8 DateFlags, + IN VOID *DefaultsOpCodeHandle OPTIONAL + ); + +/** + Create EFI_IFR_TIME_OP opcode. + + If OpCodeHandle is NULL, then ASSERT(). + If any reserved bits are set in QuestionFlags, then ASSERT(). + If any reserved bits are set in TimeFlags, then ASSERT(). + + @param[in] OpCodeHandle Handle to the buffer of opcodes. + @param[in] QuestionId Question ID + @param[in] VarStoreId Storage ID, optional. If TimeFlags is not + QF_TIME_STORAGE_NORMAL, this parameter is ignored. + @param[in] VarOffset Offset in Storage or String ID of the name (VarName) + for this name/value pair, optional. If TimeFlags is not + QF_TIME_STORAGE_NORMAL, this parameter is ignored. + @param[in] Prompt String ID for Prompt + @param[in] Help String ID for Help + @param[in] QuestionFlags Flags in Question Header + @param[in] TimeFlags Flags for time opcode + @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This + is an optional parameter that may be NULL. + + @retval NULL There is not enough space left in Buffer to add the opcode. + @retval Other A pointer to the created opcode. + +**/ +UINT8 * +EFIAPI +HiiCreateTimeOpCode ( + IN VOID *OpCodeHandle, + IN EFI_QUESTION_ID QuestionId, + IN EFI_VARSTORE_ID VarStoreId OPTIONAL, + IN UINT16 VarOffset OPTIONAL, + IN EFI_STRING_ID Prompt, + IN EFI_STRING_ID Help, + IN UINT8 QuestionFlags, + IN UINT8 TimeFlags, + IN VOID *DefaultsOpCodeHandle OPTIONAL + ); + +/** + This function updates a form that has previously been registered with the HII + Database. This function will perform at most one update operation. + + The form to update is specified by Handle, FormSetGuid, and FormId. Binary + comparisons of IFR opcodes are performed from the beginning of the form being + updated until an IFR opcode is found that exactly matches the first IFR opcode + specified by StartOpCodeHandle. The following rules are used to determine if + an insert, replace, or delete operation is performed: + + 1) If no matches are found, then NULL is returned. + 2) If a match is found, and EndOpCodeHandle is NULL, then all of the IFR opcodes + from StartOpCodeHandle except the first opcode are inserted immediately after + the matching IFR opcode in the form to be updated. + 3) If a match is found, and EndOpCodeHandle is not NULL, then a search is made + from the matching IFR opcode until an IFR opcode exactly matches the first + IFR opcode specified by EndOpCodeHandle. If no match is found for the first + IFR opcode specified by EndOpCodeHandle, then NULL is returned. If a match + is found, then all of the IFR opcodes between the start match and the end + match are deleted from the form being updated and all of the IFR opcodes + from StartOpCodeHandle except the first opcode are inserted immediately after + the matching start IFR opcode. If StartOpCcodeHandle only contains one + IFR instruction, then the result of this operation will delete all of the IFR + opcodes between the start end matches. + + If HiiHandle is NULL, then ASSERT(). + If StartOpCodeHandle is NULL, then ASSERT(). + + @param[in] HiiHandle The HII Handle of the form to update. + @param[in] FormSetGuid The Formset GUID of the form to update. This + is an optional parameter that may be NULL. + If it is NULL, all FormSet will be updated. + @param[in] FormId The ID of the form to update. + @param[in] StartOpCodeHandle An OpCode Handle that contains the set of IFR + opcodes to be inserted or replaced in the form. + The first IFR instruction in StartOpCodeHandle + is used to find matching IFR opcode in the + form. + @param[in] EndOpCodeHandle An OpCcode Handle that contains the IFR opcode + that marks the end of a replace operation in + the form. This is an optional parameter that + may be NULL. If it is NULL, then the IFR + opcodes specified by StartOpCodeHandle are + inserted into the form. + + @retval EFI_OUT_OF_RESOURCES Not enough memory resources are allocated. + @retval EFI_NOT_FOUND The following cases will return EFI_NOT_FOUND: + 1) The form specified by HiiHandle, FormSetGuid, + and FormId could not be found in the HII Database. + 2) No IFR opcodes in the target form match the first + IFR opcode in StartOpCodeHandle. + 3) EndOpCOde is not NULL, and no IFR opcodes in the + target form following a matching start opcode match + the first IFR opcode in EndOpCodeHandle. + @retval EFI_SUCCESS The matched form is updated by StartOpcode. + +**/ +EFI_STATUS +EFIAPI +HiiUpdateForm ( + IN EFI_HII_HANDLE HiiHandle, + IN EFI_GUID *FormSetGuid OPTIONAL, + IN EFI_FORM_ID FormId, + IN VOID *StartOpCodeHandle, + IN VOID *EndOpCodeHandle OPTIONAL + ); + +#endif diff --git a/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h b/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h index 87c94c7237..fb0472116b 100644 --- a/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h +++ b/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h @@ -1,234 +1,234 @@ -/** @file
-
- Provides definitions and functionality for manipulating IMAGE_PROPERTIES_RECORD.
-
- Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
- Copyright (c) Microsoft Corporation.
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef IMAGE_PROPERTIES_RECORD_SUPPORT_LIB_H_
-#define IMAGE_PROPERTIES_RECORD_SUPPORT_LIB_H_
-
-#define IMAGE_PROPERTIES_RECORD_CODE_SECTION_SIGNATURE SIGNATURE_32 ('I','P','R','C')
-
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
- EFI_PHYSICAL_ADDRESS CodeSegmentBase;
- UINT64 CodeSegmentSize;
-} IMAGE_PROPERTIES_RECORD_CODE_SECTION;
-
-#define IMAGE_PROPERTIES_RECORD_SIGNATURE SIGNATURE_32 ('I','P','R','D')
-
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
- EFI_PHYSICAL_ADDRESS ImageBase;
- UINT64 ImageSize;
- UINTN CodeSegmentCount;
- LIST_ENTRY CodeSegmentList;
-} IMAGE_PROPERTIES_RECORD;
-
-/**
- Split the original memory map and add more entries to describe PE code
- and data sections for each image in the input ImageRecordList.
-
- NOTE: This function assumes PE code/data section are page aligned.
- NOTE: This function assumes there are enough entries for the new memory map.
-
- | | | | | | | |
- | 4K PAGE | DATA | CODE | DATA | CODE | DATA | 4K PAGE |
- | | | | | | | |
- Assume the above memory region is the result of one split memory map descriptor. It's unlikely
- that a linker will orient an image this way, but the caller must assume the worst case scenario.
- This image layout example contains code sections oriented in a way that maximizes the number of
- descriptors which would be required to describe each section. To ensure we have enough space
- for every descriptor of the broken up memory map, the caller must assume that every image will
- have the maximum number of code sections oriented in a way which maximizes the number of data
- sections with unrelated memory regions flanking each image within a single descriptor.
-
- Given an image record list, the caller should use the following formula when allocating extra descriptors:
- NumberOfAdditionalDescriptors = (MemoryMapSize / DescriptorSize) +
- ((2 * <Most Code Segments in a Single Image> + 3) * <Number of Images>)
-
- @param[in, out] MemoryMapSize IN: The size, in bytes, of the old memory map before the split.
- OUT: The size, in bytes, of the used descriptors of the split
- memory map
- @param[in, out] MemoryMap IN: A pointer to the buffer containing the current memory map.
- This buffer must have enough space to accomodate the "worst case"
- scenario where every image in ImageRecordList needs a new descriptor
- to describe its code and data sections.
- OUT: A pointer to the updated memory map with separated image section
- descriptors.
- @param[in] DescriptorSize The size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR.
- @param[in] ImageRecordList A list of IMAGE_PROPERTIES_RECORD entries used when searching
- for an image record contained by the memory range described in
- EFI memory map descriptors.
- @param[in] NumberOfAdditionalDescriptors The number of unused descriptors at the end of the input MemoryMap.
- The formula in the description should be used to calculate this value.
-
- @retval EFI_SUCCESS The memory map was successfully split.
- @retval EFI_INVALID_PARAMETER MemoryMapSize, MemoryMap, or ImageRecordList was NULL.
-**/
-EFI_STATUS
-EFIAPI
-SplitTable (
- IN OUT UINTN *MemoryMapSize,
- IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,
- IN UINTN DescriptorSize,
- IN LIST_ENTRY *ImageRecordList,
- IN UINTN NumberOfAdditionalDescriptors
- );
-
-/**
- Sort the code sections in the input ImageRecord based upon CodeSegmentBase from low to high.
-
- @param[in] ImageRecord IMAGE_PROPERTIES_RECORD to be sorted
-
- @retval EFI_SUCCESS The code sections in the input ImageRecord were sorted successfully
- @retval EFI_ABORTED An error occurred while sorting the code sections in the input ImageRecord
- @retval EFI_INVALID_PARAMETER ImageRecord is NULL
-**/
-EFI_STATUS
-EFIAPI
-SortImageRecordCodeSection (
- IN IMAGE_PROPERTIES_RECORD *ImageRecord
- );
-
-/**
- Check if the code sections in the input ImageRecord are valid.
- The code sections are valid if they don't overlap, are contained
- within the the ImageRecord's ImageBase and ImageSize, and are
- contained within the MAX_ADDRESS.
-
- @param[in] ImageRecord IMAGE_PROPERTIES_RECORD to be checked
-
- @retval TRUE The code sections in the input ImageRecord are valid
- @retval FALSE The code sections in the input ImageRecord are invalid
-**/
-BOOLEAN
-EFIAPI
-IsImageRecordCodeSectionValid (
- IN IMAGE_PROPERTIES_RECORD *ImageRecord
- );
-
-/**
- Sort the input ImageRecordList based upon the ImageBase from low to high.
-
- @param[in] ImageRecordList Image record list to be sorted
-
- @retval EFI_SUCCESS The image record list was sorted successfully
- @retval EFI_ABORTED An error occurred while sorting the image record list
- @retval EFI_INVALID_PARAMETER ImageRecordList is NULL
-**/
-EFI_STATUS
-EFIAPI
-SortImageRecord (
- IN LIST_ENTRY *ImageRecordList
- );
-
-/**
- Swap two image records.
-
- @param[in] FirstImageRecord The first image record.
- @param[in] SecondImageRecord The second image record.
-
- @retval EFI_SUCCESS The image records were swapped successfully
- @retval EFI_INVALID_PARAMETER FirstImageRecord or SecondImageRecord is NULL
-**/
-EFI_STATUS
-EFIAPI
-SwapImageRecord (
- IN IMAGE_PROPERTIES_RECORD *FirstImageRecord,
- IN IMAGE_PROPERTIES_RECORD *SecondImageRecord
- );
-
-/**
- Swap two code sections in a single IMAGE_PROPERTIES_RECORD.
-
- @param[in] FirstImageRecordCodeSection The first code section
- @param[in] SecondImageRecordCodeSection The second code section
-
- @retval EFI_SUCCESS The code sections were swapped successfully
- @retval EFI_INVALID_PARAMETER FirstImageRecordCodeSection or SecondImageRecordCodeSection is NULL
-**/
-EFI_STATUS
-EFIAPI
-SwapImageRecordCodeSection (
- IN IMAGE_PROPERTIES_RECORD_CODE_SECTION *FirstImageRecordCodeSection,
- IN IMAGE_PROPERTIES_RECORD_CODE_SECTION *SecondImageRecordCodeSection
- );
-
-/**
- Find image properties record according to image base and size in the
- input ImageRecordList.
-
- @param[in] ImageBase Base of PE image
- @param[in] ImageSize Size of PE image
- @param[in] ImageRecordList Image record list to be searched
-
- @retval NULL No IMAGE_PROPERTIES_RECORD matches ImageBase
- and ImageSize in the input ImageRecordList
- @retval Other The found IMAGE_PROPERTIES_RECORD
-**/
-IMAGE_PROPERTIES_RECORD *
-EFIAPI
-FindImageRecord (
- IN EFI_PHYSICAL_ADDRESS ImageBase,
- IN UINT64 ImageSize,
- IN LIST_ENTRY *ImageRecordList
- );
-
-/**
- Debug dumps the input list of IMAGE_PROPERTIES_RECORD structs.
-
- @param[in] ImageRecordList Head of the IMAGE_PROPERTIES_RECORD list
-**/
-VOID
-EFIAPI
-DumpImageRecords (
- IN LIST_ENTRY *ImageRecordList
- );
-
-/**
- Creates an IMAGE_PROPERTIES_RECORD from a loaded PE image. The PE/COFF header will be found
- and parsed to determine the number of code segments and their base addresses and sizes.
-
- @param[in] ImageBase Base of the PE image
- @param[in] ImageSize Size of the PE image
- @param[in] RequiredAlignment If non-NULL, the alignment specified in the PE/COFF header
- will be compared against this value.
- @param[out] ImageRecord On out, a populated image properties record
-
- @retval EFI_INVALID_PARAMETER This function ImageBase or ImageRecord was NULL, or the
- image located at ImageBase was not a valid PE/COFF image
- @retval EFI_OUT_OF_RESOURCES Failure to Allocate()
- @retval EFI_ABORTED The input Alignment was non-NULL and did not match the
- alignment specified in the PE/COFF header
- @retval EFI_SUCCESS The image properties record was successfully created
-**/
-EFI_STATUS
-EFIAPI
-CreateImagePropertiesRecord (
- IN CONST VOID *ImageBase,
- IN CONST UINT64 ImageSize,
- IN CONST UINT32 *Alignment OPTIONAL,
- OUT IMAGE_PROPERTIES_RECORD *ImageRecord
- );
-
-/**
- Deleted an image properties record. The function will also call
- RemoveEntryList() on each code segment and the input ImageRecord before
- freeing each pool.
-
- @param[in] ImageRecord The IMAGE_PROPERTIES_RECORD to delete
-**/
-VOID
-EFIAPI
-DeleteImagePropertiesRecord (
- IN IMAGE_PROPERTIES_RECORD *ImageRecord
- );
-
-#endif
+/** @file + + Provides definitions and functionality for manipulating IMAGE_PROPERTIES_RECORD. + + Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR> + Copyright (c) Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef IMAGE_PROPERTIES_RECORD_SUPPORT_LIB_H_ +#define IMAGE_PROPERTIES_RECORD_SUPPORT_LIB_H_ + +#define IMAGE_PROPERTIES_RECORD_CODE_SECTION_SIGNATURE SIGNATURE_32 ('I','P','R','C') + +typedef struct { + UINT32 Signature; + LIST_ENTRY Link; + EFI_PHYSICAL_ADDRESS CodeSegmentBase; + UINT64 CodeSegmentSize; +} IMAGE_PROPERTIES_RECORD_CODE_SECTION; + +#define IMAGE_PROPERTIES_RECORD_SIGNATURE SIGNATURE_32 ('I','P','R','D') + +typedef struct { + UINT32 Signature; + LIST_ENTRY Link; + EFI_PHYSICAL_ADDRESS ImageBase; + UINT64 ImageSize; + UINTN CodeSegmentCount; + LIST_ENTRY CodeSegmentList; +} IMAGE_PROPERTIES_RECORD; + +/** + Split the original memory map and add more entries to describe PE code + and data sections for each image in the input ImageRecordList. + + NOTE: This function assumes PE code/data section are page aligned. + NOTE: This function assumes there are enough entries for the new memory map. + + | | | | | | | | + | 4K PAGE | DATA | CODE | DATA | CODE | DATA | 4K PAGE | + | | | | | | | | + Assume the above memory region is the result of one split memory map descriptor. It's unlikely + that a linker will orient an image this way, but the caller must assume the worst case scenario. + This image layout example contains code sections oriented in a way that maximizes the number of + descriptors which would be required to describe each section. To ensure we have enough space + for every descriptor of the broken up memory map, the caller must assume that every image will + have the maximum number of code sections oriented in a way which maximizes the number of data + sections with unrelated memory regions flanking each image within a single descriptor. + + Given an image record list, the caller should use the following formula when allocating extra descriptors: + NumberOfAdditionalDescriptors = (MemoryMapSize / DescriptorSize) + + ((2 * <Most Code Segments in a Single Image> + 3) * <Number of Images>) + + @param[in, out] MemoryMapSize IN: The size, in bytes, of the old memory map before the split. + OUT: The size, in bytes, of the used descriptors of the split + memory map + @param[in, out] MemoryMap IN: A pointer to the buffer containing the current memory map. + This buffer must have enough space to accomodate the "worst case" + scenario where every image in ImageRecordList needs a new descriptor + to describe its code and data sections. + OUT: A pointer to the updated memory map with separated image section + descriptors. + @param[in] DescriptorSize The size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR. + @param[in] ImageRecordList A list of IMAGE_PROPERTIES_RECORD entries used when searching + for an image record contained by the memory range described in + EFI memory map descriptors. + @param[in] NumberOfAdditionalDescriptors The number of unused descriptors at the end of the input MemoryMap. + The formula in the description should be used to calculate this value. + + @retval EFI_SUCCESS The memory map was successfully split. + @retval EFI_INVALID_PARAMETER MemoryMapSize, MemoryMap, or ImageRecordList was NULL. +**/ +EFI_STATUS +EFIAPI +SplitTable ( + IN OUT UINTN *MemoryMapSize, + IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, + IN UINTN DescriptorSize, + IN LIST_ENTRY *ImageRecordList, + IN UINTN NumberOfAdditionalDescriptors + ); + +/** + Sort the code sections in the input ImageRecord based upon CodeSegmentBase from low to high. + + @param[in] ImageRecord IMAGE_PROPERTIES_RECORD to be sorted + + @retval EFI_SUCCESS The code sections in the input ImageRecord were sorted successfully + @retval EFI_ABORTED An error occurred while sorting the code sections in the input ImageRecord + @retval EFI_INVALID_PARAMETER ImageRecord is NULL +**/ +EFI_STATUS +EFIAPI +SortImageRecordCodeSection ( + IN IMAGE_PROPERTIES_RECORD *ImageRecord + ); + +/** + Check if the code sections in the input ImageRecord are valid. + The code sections are valid if they don't overlap, are contained + within the the ImageRecord's ImageBase and ImageSize, and are + contained within the MAX_ADDRESS. + + @param[in] ImageRecord IMAGE_PROPERTIES_RECORD to be checked + + @retval TRUE The code sections in the input ImageRecord are valid + @retval FALSE The code sections in the input ImageRecord are invalid +**/ +BOOLEAN +EFIAPI +IsImageRecordCodeSectionValid ( + IN IMAGE_PROPERTIES_RECORD *ImageRecord + ); + +/** + Sort the input ImageRecordList based upon the ImageBase from low to high. + + @param[in] ImageRecordList Image record list to be sorted + + @retval EFI_SUCCESS The image record list was sorted successfully + @retval EFI_ABORTED An error occurred while sorting the image record list + @retval EFI_INVALID_PARAMETER ImageRecordList is NULL +**/ +EFI_STATUS +EFIAPI +SortImageRecord ( + IN LIST_ENTRY *ImageRecordList + ); + +/** + Swap two image records. + + @param[in] FirstImageRecord The first image record. + @param[in] SecondImageRecord The second image record. + + @retval EFI_SUCCESS The image records were swapped successfully + @retval EFI_INVALID_PARAMETER FirstImageRecord or SecondImageRecord is NULL +**/ +EFI_STATUS +EFIAPI +SwapImageRecord ( + IN IMAGE_PROPERTIES_RECORD *FirstImageRecord, + IN IMAGE_PROPERTIES_RECORD *SecondImageRecord + ); + +/** + Swap two code sections in a single IMAGE_PROPERTIES_RECORD. + + @param[in] FirstImageRecordCodeSection The first code section + @param[in] SecondImageRecordCodeSection The second code section + + @retval EFI_SUCCESS The code sections were swapped successfully + @retval EFI_INVALID_PARAMETER FirstImageRecordCodeSection or SecondImageRecordCodeSection is NULL +**/ +EFI_STATUS +EFIAPI +SwapImageRecordCodeSection ( + IN IMAGE_PROPERTIES_RECORD_CODE_SECTION *FirstImageRecordCodeSection, + IN IMAGE_PROPERTIES_RECORD_CODE_SECTION *SecondImageRecordCodeSection + ); + +/** + Find image properties record according to image base and size in the + input ImageRecordList. + + @param[in] ImageBase Base of PE image + @param[in] ImageSize Size of PE image + @param[in] ImageRecordList Image record list to be searched + + @retval NULL No IMAGE_PROPERTIES_RECORD matches ImageBase + and ImageSize in the input ImageRecordList + @retval Other The found IMAGE_PROPERTIES_RECORD +**/ +IMAGE_PROPERTIES_RECORD * +EFIAPI +FindImageRecord ( + IN EFI_PHYSICAL_ADDRESS ImageBase, + IN UINT64 ImageSize, + IN LIST_ENTRY *ImageRecordList + ); + +/** + Debug dumps the input list of IMAGE_PROPERTIES_RECORD structs. + + @param[in] ImageRecordList Head of the IMAGE_PROPERTIES_RECORD list +**/ +VOID +EFIAPI +DumpImageRecords ( + IN LIST_ENTRY *ImageRecordList + ); + +/** + Creates an IMAGE_PROPERTIES_RECORD from a loaded PE image. The PE/COFF header will be found + and parsed to determine the number of code segments and their base addresses and sizes. + + @param[in] ImageBase Base of the PE image + @param[in] ImageSize Size of the PE image + @param[in] RequiredAlignment If non-NULL, the alignment specified in the PE/COFF header + will be compared against this value. + @param[out] ImageRecord On out, a populated image properties record + + @retval EFI_INVALID_PARAMETER This function ImageBase or ImageRecord was NULL, or the + image located at ImageBase was not a valid PE/COFF image + @retval EFI_OUT_OF_RESOURCES Failure to Allocate() + @retval EFI_ABORTED The input Alignment was non-NULL and did not match the + alignment specified in the PE/COFF header + @retval EFI_SUCCESS The image properties record was successfully created +**/ +EFI_STATUS +EFIAPI +CreateImagePropertiesRecord ( + IN CONST VOID *ImageBase, + IN CONST UINT64 ImageSize, + IN CONST UINT32 *Alignment OPTIONAL, + OUT IMAGE_PROPERTIES_RECORD *ImageRecord + ); + +/** + Deleted an image properties record. The function will also call + RemoveEntryList() on each code segment and the input ImageRecord before + freeing each pool. + + @param[in] ImageRecord The IMAGE_PROPERTIES_RECORD to delete +**/ +VOID +EFIAPI +DeleteImagePropertiesRecord ( + IN IMAGE_PROPERTIES_RECORD *ImageRecord + ); + +#endif diff --git a/MdeModulePkg/Include/Library/IpmiCommandLib.h b/MdeModulePkg/Include/Library/IpmiCommandLib.h index 06bea6131a..a872005a6a 100644 --- a/MdeModulePkg/Include/Library/IpmiCommandLib.h +++ b/MdeModulePkg/Include/Library/IpmiCommandLib.h @@ -1,700 +1,700 @@ -/** @file
- This library abstract how to send/receive IPMI command.
-
-Copyright (c) 2018-2021, Intel Corporation. All rights reserved.<BR>
-Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef IPMI_COMMAND_LIB_H_
-#define IPMI_COMMAND_LIB_H_
-
-#include <Uefi.h>
-#include <IndustryStandard/Ipmi.h>
-
-//
-// IPMI NetFnApp
-//
-
-/**
- This function gets the IPMI Device ID.
-
- @param[out] DeviceId Get device ID response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetDeviceId (
- OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId
- );
-
-/**
- This function gets the self-test result.
-
- @param[out] SelfTestResult Self test command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSelfTestResult (
- OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult
- );
-
-/**
- This function resets watchdog timer.
-
- @param[out] CompletionCode The command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiResetWatchdogTimer (
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function sets watchdog timer.
-
- @param[in] SetWatchdogTimer Set watchdog timer request.
- @param[out] CompletionCode The command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSetWatchdogTimer (
- IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer,
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function gets watchdog timer.
-
- @param[out] GetWatchdogTimer Get watchdog timer response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetWatchdogTimer (
- OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer
- );
-
-/**
- This function sets BMC global enables.
-
- @param[in] SetBmcGlobalEnables Set BMC global enables command request.
- @param[out] CompletionCode The command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSetBmcGlobalEnables (
- IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables,
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function gets BMC global enables.
-
- @param[out] GetBmcGlobalEnables Get BMC global enables command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetBmcGlobalEnables (
- OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables
- );
-
-/**
- This function clears message flag.
-
- @param[in] ClearMessageFlagsRequest Clear message flags command request.
- @param[out] CompletionCode The command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiClearMessageFlags (
- IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest,
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function gets message flag.
-
- @param[out] GetMessageFlagsResponse Get message flags response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetMessageFlags (
- OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse
- );
-
-/**
- This function gets message.
-
- @param[out] GetMessageResponse Get message command response.
- @param[in,out] GetMessageResponseSize The size of get message response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetMessage (
- OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse,
- IN OUT UINT32 *GetMessageResponseSize
- );
-
-/**
- This function sends message.
-
- @param[in] SendMessageRequest The send message command request.
- @param[in] SendMessageRequestSize The size of the send message command request.
- @param[out] SendMessageResponse The send message command response.
- @param[in,out] SendMessageResponseSize The size of the send message command response.
- When input, the expected size of response.
- When output, the actual size of response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSendMessage (
- IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest,
- IN UINT32 SendMessageRequestSize,
- OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse,
- IN OUT UINT32 *SendMessageResponseSize
- );
-
-/**
- This function gets the system UUID.
-
- @param[out] SystemGuid The pointer to retrieve system UUID.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Others Other errors.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSystemUuid (
- OUT EFI_GUID *SystemGuid
- );
-
-/**
- This function gets the channel information.
-
- @param[in] GetChannelInfoRequest The get channel information request.
- @param[in] GetChannelInfoResponse The get channel information response.
- @param[in,out] GetChannelInfoResponseSize When input, the expected size of response.
- When output, the exact size of the returned
- response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetChannelInfo (
- IN IPMI_GET_CHANNEL_INFO_REQUEST *GetChannelInfoRequest,
- OUT IPMI_GET_CHANNEL_INFO_RESPONSE *GetChannelInfoResponse,
- OUT UINT32 *GetChannelInfoResponseSize
- );
-
-/**
- This function gets system interface capability
-
- @param[in] InterfaceCapabilityRequest Get system interface capability request.
- @param[out] InterfaceCapabilityResponse The response of system interface capability.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSystemInterfaceCapability (
- IN IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_REQUEST *InterfaceCapabilityRequest,
- OUT IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_RESPONSE *InterfaceCapabilityResponse
- );
-
-//
-// IPMI NetFnTransport
-//
-
-/**
- This function activates SOL
-
- @param[in] SolActivatingRequest SOL activating request.
- @param[out] CompletionCode The command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSolActivating (
- IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest,
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function sets SOL configuration parameters.
-
- @param[in] SetConfigurationParametersRequest Set SOL configuration parameters
- command request.
- @param[in] SetConfigurationParametersRequestSize Size of the set SOL configuration
- parameters command request.
- @param[out] CompletionCode The command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSetSolConfigurationParameters (
- IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationParametersRequest,
- IN UINT32 SetConfigurationParametersRequestSize,
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function gets SOL configuration parameters.
-
- @param[in] GetConfigurationParametersRequest Get SOL configuration parameters
- command request.
- @param[out] GetConfigurationParametersResponse Get SOL configuration parameters
- response.
- @param[in,out] GetConfigurationParametersResponseSize When input, the size of the expected
- response.
- When output, the exact size of
- expect response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSolConfigurationParameters (
- IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationParametersRequest,
- OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationParametersResponse,
- IN OUT UINT32 *GetConfigurationParametersResponseSize
- );
-
-/**
- This function gets the LAN configuration parameter.
-
- @param[in] GetLanConfigurationParametersRequest Get LAN configuration parameters command request.
- @param[in] GetLanConfigurationParametersResponse The response of the get LAN configuration parameters.
- @param[in,out] GetLanConfigurationParametersSize When input, the expected size of response data.
- When out, the exact size of response data.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-
-EFI_STATUS
-EFIAPI
-IpmiGetLanConfigurationParameters (
- IN IPMI_GET_LAN_CONFIGURATION_PARAMETERS_REQUEST *GetLanConfigurationParametersRequest,
- OUT IPMI_GET_LAN_CONFIGURATION_PARAMETERS_RESPONSE *GetLanConfigurationParametersResponse,
- IN OUT UINT32 *GetLanConfigurationParametersSize
- );
-
-//
-// IPMI NetFnChassis
-//
-
-/**
- This function gets chassis capability.
-
- @param[out] GetChassisCapabilitiesResponse Gets chassis capability command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetChassisCapabilities (
- OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesResponse
- );
-
-/**
- This function gets chassis status.
-
- @param[out] GetChassisCapabilitiesResponse The get chassis status command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetChassisStatus (
- OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse
- );
-
-/**
- This function sends chassis control request.
-
- @param[in] ChassisControlRequest The chassis control request.
- @param[out] CompletionCode The command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiChassisControl (
- IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest,
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function sets power restore policy.
-
- @param[in] SetPowerRestireRequest The set power restore policy control
- command request.
- @param[out] SetPowerRestireResponse The response of power restore policy.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSetPowerRestorePolicy (
- IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *SetPowerRestireRequest,
- OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *SetPowerRestireResponse
- );
-
-//
-// IPMI NetFnStorage
-//
-
-/**
- This function sets system boot option.
-
- @param[in] BootOptionsRequest Set system boot option request.
- @param[out] BootOptionsResponse The response of set system boot
- option request.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSetSystemBootOptions (
- IN IPMI_SET_BOOT_OPTIONS_REQUEST *BootOptionsRequest,
- OUT IPMI_SET_BOOT_OPTIONS_RESPONSE *BootOptionsResponse
- );
-
-/**
- This function gets system boot option.
-
- @param[in] BootOptionsRequest Get system boot option request.
- @param[out] BootOptionsResponse The response of get system boot
- option request.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSystemBootOptions (
- IN IPMI_GET_BOOT_OPTIONS_REQUEST *BootOptionsRequest,
- OUT IPMI_GET_BOOT_OPTIONS_RESPONSE *BootOptionsResponse
- );
-
-/**
- This function gets FRU inventory area info.
-
- @param[in] GetFruInventoryAreaInfoRequest Get FRU inventory area command request.
- @param[out] GetFruInventoryAreaInfoResponse get FRU inventory area command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetFruInventoryAreaInfo (
- IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoRequest,
- OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInfoResponse
- );
-
-/**
- This function reads FRU data.
-
- @param[in] ReadFruDataRequest Read FRU data command request.
- @param[out] ReadFruDataResponse Read FRU data command response.
- @param[in,out] ReadFruDataResponseSize Size of the read FRU data response.
- When input, the expected size of response data.
- When out, the exact size of response data.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiReadFruData (
- IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest,
- OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse,
- IN OUT UINT32 *ReadFruDataResponseSize
- );
-
-/**
- This function gets chassis capability.
-
- @param[in] WriteFruDataRequest Write FRU data command request.
- @param[in] WriteFruDataRequestSize Size of the write FRU data command request.
- @param[out] WriteFruDataResponse Write FRU data response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiWriteFruData (
- IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest,
- IN UINT32 WriteFruDataRequestSize,
- OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse
- );
-
-/**
- This function gets SEL information.
-
- @param[out] GetSelInfoResponse Get SEL information command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSelInfo (
- OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse
- );
-
-/**
- This function gets SEL entry.
-
- @param[in] GetSelEntryRequest Get SEL entry command request.
- @param[out] GetSelEntryResponse Get SEL entry command response.
- @param[in,out] GetSelEntryResponseSize Size of Get SEL entry request.
- When input, the expected size of response data.
- When out, the exact size of response data.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSelEntry (
- IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest,
- OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse,
- IN OUT UINT32 *GetSelEntryResponseSize
- );
-
-/**
- This function adds SEL entry.
-
- @param[in] AddSelEntryRequest Add SEL entry command request.
- @param[out] AddSelEntryResponse Add SEL entry command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiAddSelEntry (
- IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest,
- OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse
- );
-
-/**
- This function partially adds SEL entry.
-
- @param[in] PartialAddSelEntryRequest Partial add SEL entry command request.
- @param[in] PartialAddSelEntryRequestSize Size of partial add SEL entry command request.
- @param[out] PartialAddSelEntryResponse Partial add SEL entry command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiPartialAddSelEntry (
- IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest,
- IN UINT32 PartialAddSelEntryRequestSize,
- OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse
- );
-
-/**
- This function clears SEL entry.
-
- @param[in] ClearSelRequest Clear SEL command request.
- @param[out] ClearSelResponse Clear SEL command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiClearSel (
- IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest,
- OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse
- );
-
-/**
- This function gets SEL time.
-
- @param[out] GetSelTimeResponse Get SEL time command response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSelTime (
- OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse
- );
-
-/**
- This function sets SEL time.
-
- @param[in] SetSelTimeRequest Set SEL time command request.
- @param[out] CompletionCode Command completion code.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiSetSelTime (
- IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest,
- OUT UINT8 *CompletionCode
- );
-
-/**
- This function gets SDR repository information.
-
- @param[out] GetSdrRepositoryInfoResp Get SDR repository response.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSdrRepositoryInfo (
- OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp
- );
-
-/**
- This function gets SDR
-
- @param[in] GetSdrRequest Get SDR resquest.
- @param[out] GetSdrResponse Get SDR response.
- @param[in,out] GetSdrResponseSize The size of get SDR response.
- When input, the expected size of response data.
- When out, the exact size of response data.
-
- @retval EFI_SUCCESS Command is sent successfully.
- @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet.
- @retval Other Failure.
-
-**/
-EFI_STATUS
-EFIAPI
-IpmiGetSdr (
- IN IPMI_GET_SDR_REQUEST *GetSdrRequest,
- OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse,
- IN OUT UINT32 *GetSdrResponseSize
- );
-
-#endif
+/** @file + This library abstract how to send/receive IPMI command. + +Copyright (c) 2018-2021, Intel Corporation. All rights reserved.<BR> +Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef IPMI_COMMAND_LIB_H_ +#define IPMI_COMMAND_LIB_H_ + +#include <Uefi.h> +#include <IndustryStandard/Ipmi.h> + +// +// IPMI NetFnApp +// + +/** + This function gets the IPMI Device ID. + + @param[out] DeviceId Get device ID response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetDeviceId ( + OUT IPMI_GET_DEVICE_ID_RESPONSE *DeviceId + ); + +/** + This function gets the self-test result. + + @param[out] SelfTestResult Self test command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelfTestResult ( + OUT IPMI_SELF_TEST_RESULT_RESPONSE *SelfTestResult + ); + +/** + This function resets watchdog timer. + + @param[out] CompletionCode The command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiResetWatchdogTimer ( + OUT UINT8 *CompletionCode + ); + +/** + This function sets watchdog timer. + + @param[in] SetWatchdogTimer Set watchdog timer request. + @param[out] CompletionCode The command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + + +**/ +EFI_STATUS +EFIAPI +IpmiSetWatchdogTimer ( + IN IPMI_SET_WATCHDOG_TIMER_REQUEST *SetWatchdogTimer, + OUT UINT8 *CompletionCode + ); + +/** + This function gets watchdog timer. + + @param[out] GetWatchdogTimer Get watchdog timer response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetWatchdogTimer ( + OUT IPMI_GET_WATCHDOG_TIMER_RESPONSE *GetWatchdogTimer + ); + +/** + This function sets BMC global enables. + + @param[in] SetBmcGlobalEnables Set BMC global enables command request. + @param[out] CompletionCode The command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiSetBmcGlobalEnables ( + IN IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST *SetBmcGlobalEnables, + OUT UINT8 *CompletionCode + ); + +/** + This function gets BMC global enables. + + @param[out] GetBmcGlobalEnables Get BMC global enables command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetBmcGlobalEnables ( + OUT IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE *GetBmcGlobalEnables + ); + +/** + This function clears message flag. + + @param[in] ClearMessageFlagsRequest Clear message flags command request. + @param[out] CompletionCode The command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiClearMessageFlags ( + IN IPMI_CLEAR_MESSAGE_FLAGS_REQUEST *ClearMessageFlagsRequest, + OUT UINT8 *CompletionCode + ); + +/** + This function gets message flag. + + @param[out] GetMessageFlagsResponse Get message flags response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetMessageFlags ( + OUT IPMI_GET_MESSAGE_FLAGS_RESPONSE *GetMessageFlagsResponse + ); + +/** + This function gets message. + + @param[out] GetMessageResponse Get message command response. + @param[in,out] GetMessageResponseSize The size of get message response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetMessage ( + OUT IPMI_GET_MESSAGE_RESPONSE *GetMessageResponse, + IN OUT UINT32 *GetMessageResponseSize + ); + +/** + This function sends message. + + @param[in] SendMessageRequest The send message command request. + @param[in] SendMessageRequestSize The size of the send message command request. + @param[out] SendMessageResponse The send message command response. + @param[in,out] SendMessageResponseSize The size of the send message command response. + When input, the expected size of response. + When output, the actual size of response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiSendMessage ( + IN IPMI_SEND_MESSAGE_REQUEST *SendMessageRequest, + IN UINT32 SendMessageRequestSize, + OUT IPMI_SEND_MESSAGE_RESPONSE *SendMessageResponse, + IN OUT UINT32 *SendMessageResponseSize + ); + +/** + This function gets the system UUID. + + @param[out] SystemGuid The pointer to retrieve system UUID. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Others Other errors. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSystemUuid ( + OUT EFI_GUID *SystemGuid + ); + +/** + This function gets the channel information. + + @param[in] GetChannelInfoRequest The get channel information request. + @param[in] GetChannelInfoResponse The get channel information response. + @param[in,out] GetChannelInfoResponseSize When input, the expected size of response. + When output, the exact size of the returned + response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetChannelInfo ( + IN IPMI_GET_CHANNEL_INFO_REQUEST *GetChannelInfoRequest, + OUT IPMI_GET_CHANNEL_INFO_RESPONSE *GetChannelInfoResponse, + OUT UINT32 *GetChannelInfoResponseSize + ); + +/** + This function gets system interface capability + + @param[in] InterfaceCapabilityRequest Get system interface capability request. + @param[out] InterfaceCapabilityResponse The response of system interface capability. + + @retval EFI_SUCCESS Command is sent successfully. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSystemInterfaceCapability ( + IN IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_REQUEST *InterfaceCapabilityRequest, + OUT IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_RESPONSE *InterfaceCapabilityResponse + ); + +// +// IPMI NetFnTransport +// + +/** + This function activates SOL + + @param[in] SolActivatingRequest SOL activating request. + @param[out] CompletionCode The command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiSolActivating ( + IN IPMI_SOL_ACTIVATING_REQUEST *SolActivatingRequest, + OUT UINT8 *CompletionCode + ); + +/** + This function sets SOL configuration parameters. + + @param[in] SetConfigurationParametersRequest Set SOL configuration parameters + command request. + @param[in] SetConfigurationParametersRequestSize Size of the set SOL configuration + parameters command request. + @param[out] CompletionCode The command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiSetSolConfigurationParameters ( + IN IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST *SetConfigurationParametersRequest, + IN UINT32 SetConfigurationParametersRequestSize, + OUT UINT8 *CompletionCode + ); + +/** + This function gets SOL configuration parameters. + + @param[in] GetConfigurationParametersRequest Get SOL configuration parameters + command request. + @param[out] GetConfigurationParametersResponse Get SOL configuration parameters + response. + @param[in,out] GetConfigurationParametersResponseSize When input, the size of the expected + response. + When output, the exact size of + expect response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSolConfigurationParameters ( + IN IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST *GetConfigurationParametersRequest, + OUT IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationParametersResponse, + IN OUT UINT32 *GetConfigurationParametersResponseSize + ); + +/** + This function gets the LAN configuration parameter. + + @param[in] GetLanConfigurationParametersRequest Get LAN configuration parameters command request. + @param[in] GetLanConfigurationParametersResponse The response of the get LAN configuration parameters. + @param[in,out] GetLanConfigurationParametersSize When input, the expected size of response data. + When out, the exact size of response data. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ + +EFI_STATUS +EFIAPI +IpmiGetLanConfigurationParameters ( + IN IPMI_GET_LAN_CONFIGURATION_PARAMETERS_REQUEST *GetLanConfigurationParametersRequest, + OUT IPMI_GET_LAN_CONFIGURATION_PARAMETERS_RESPONSE *GetLanConfigurationParametersResponse, + IN OUT UINT32 *GetLanConfigurationParametersSize + ); + +// +// IPMI NetFnChassis +// + +/** + This function gets chassis capability. + + @param[out] GetChassisCapabilitiesResponse Gets chassis capability command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetChassisCapabilities ( + OUT IPMI_GET_CHASSIS_CAPABILITIES_RESPONSE *GetChassisCapabilitiesResponse + ); + +/** + This function gets chassis status. + + @param[out] GetChassisCapabilitiesResponse The get chassis status command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetChassisStatus ( + OUT IPMI_GET_CHASSIS_STATUS_RESPONSE *GetChassisStatusResponse + ); + +/** + This function sends chassis control request. + + @param[in] ChassisControlRequest The chassis control request. + @param[out] CompletionCode The command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiChassisControl ( + IN IPMI_CHASSIS_CONTROL_REQUEST *ChassisControlRequest, + OUT UINT8 *CompletionCode + ); + +/** + This function sets power restore policy. + + @param[in] SetPowerRestireRequest The set power restore policy control + command request. + @param[out] SetPowerRestireResponse The response of power restore policy. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiSetPowerRestorePolicy ( + IN IPMI_SET_POWER_RESTORE_POLICY_REQUEST *SetPowerRestireRequest, + OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE *SetPowerRestireResponse + ); + +// +// IPMI NetFnStorage +// + +/** + This function sets system boot option. + + @param[in] BootOptionsRequest Set system boot option request. + @param[out] BootOptionsResponse The response of set system boot + option request. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiSetSystemBootOptions ( + IN IPMI_SET_BOOT_OPTIONS_REQUEST *BootOptionsRequest, + OUT IPMI_SET_BOOT_OPTIONS_RESPONSE *BootOptionsResponse + ); + +/** + This function gets system boot option. + + @param[in] BootOptionsRequest Get system boot option request. + @param[out] BootOptionsResponse The response of get system boot + option request. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSystemBootOptions ( + IN IPMI_GET_BOOT_OPTIONS_REQUEST *BootOptionsRequest, + OUT IPMI_GET_BOOT_OPTIONS_RESPONSE *BootOptionsResponse + ); + +/** + This function gets FRU inventory area info. + + @param[in] GetFruInventoryAreaInfoRequest Get FRU inventory area command request. + @param[out] GetFruInventoryAreaInfoResponse get FRU inventory area command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetFruInventoryAreaInfo ( + IN IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST *GetFruInventoryAreaInfoRequest, + OUT IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE *GetFruInventoryAreaInfoResponse + ); + +/** + This function reads FRU data. + + @param[in] ReadFruDataRequest Read FRU data command request. + @param[out] ReadFruDataResponse Read FRU data command response. + @param[in,out] ReadFruDataResponseSize Size of the read FRU data response. + When input, the expected size of response data. + When out, the exact size of response data. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiReadFruData ( + IN IPMI_READ_FRU_DATA_REQUEST *ReadFruDataRequest, + OUT IPMI_READ_FRU_DATA_RESPONSE *ReadFruDataResponse, + IN OUT UINT32 *ReadFruDataResponseSize + ); + +/** + This function gets chassis capability. + + @param[in] WriteFruDataRequest Write FRU data command request. + @param[in] WriteFruDataRequestSize Size of the write FRU data command request. + @param[out] WriteFruDataResponse Write FRU data response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiWriteFruData ( + IN IPMI_WRITE_FRU_DATA_REQUEST *WriteFruDataRequest, + IN UINT32 WriteFruDataRequestSize, + OUT IPMI_WRITE_FRU_DATA_RESPONSE *WriteFruDataResponse + ); + +/** + This function gets SEL information. + + @param[out] GetSelInfoResponse Get SEL information command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelInfo ( + OUT IPMI_GET_SEL_INFO_RESPONSE *GetSelInfoResponse + ); + +/** + This function gets SEL entry. + + @param[in] GetSelEntryRequest Get SEL entry command request. + @param[out] GetSelEntryResponse Get SEL entry command response. + @param[in,out] GetSelEntryResponseSize Size of Get SEL entry request. + When input, the expected size of response data. + When out, the exact size of response data. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelEntry ( + IN IPMI_GET_SEL_ENTRY_REQUEST *GetSelEntryRequest, + OUT IPMI_GET_SEL_ENTRY_RESPONSE *GetSelEntryResponse, + IN OUT UINT32 *GetSelEntryResponseSize + ); + +/** + This function adds SEL entry. + + @param[in] AddSelEntryRequest Add SEL entry command request. + @param[out] AddSelEntryResponse Add SEL entry command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiAddSelEntry ( + IN IPMI_ADD_SEL_ENTRY_REQUEST *AddSelEntryRequest, + OUT IPMI_ADD_SEL_ENTRY_RESPONSE *AddSelEntryResponse + ); + +/** + This function partially adds SEL entry. + + @param[in] PartialAddSelEntryRequest Partial add SEL entry command request. + @param[in] PartialAddSelEntryRequestSize Size of partial add SEL entry command request. + @param[out] PartialAddSelEntryResponse Partial add SEL entry command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiPartialAddSelEntry ( + IN IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST *PartialAddSelEntryRequest, + IN UINT32 PartialAddSelEntryRequestSize, + OUT IPMI_PARTIAL_ADD_SEL_ENTRY_RESPONSE *PartialAddSelEntryResponse + ); + +/** + This function clears SEL entry. + + @param[in] ClearSelRequest Clear SEL command request. + @param[out] ClearSelResponse Clear SEL command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiClearSel ( + IN IPMI_CLEAR_SEL_REQUEST *ClearSelRequest, + OUT IPMI_CLEAR_SEL_RESPONSE *ClearSelResponse + ); + +/** + This function gets SEL time. + + @param[out] GetSelTimeResponse Get SEL time command response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSelTime ( + OUT IPMI_GET_SEL_TIME_RESPONSE *GetSelTimeResponse + ); + +/** + This function sets SEL time. + + @param[in] SetSelTimeRequest Set SEL time command request. + @param[out] CompletionCode Command completion code. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiSetSelTime ( + IN IPMI_SET_SEL_TIME_REQUEST *SetSelTimeRequest, + OUT UINT8 *CompletionCode + ); + +/** + This function gets SDR repository information. + + @param[out] GetSdrRepositoryInfoResp Get SDR repository response. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. +**/ +EFI_STATUS +EFIAPI +IpmiGetSdrRepositoryInfo ( + OUT IPMI_GET_SDR_REPOSITORY_INFO_RESPONSE *GetSdrRepositoryInfoResp + ); + +/** + This function gets SDR + + @param[in] GetSdrRequest Get SDR resquest. + @param[out] GetSdrResponse Get SDR response. + @param[in,out] GetSdrResponseSize The size of get SDR response. + When input, the expected size of response data. + When out, the exact size of response data. + + @retval EFI_SUCCESS Command is sent successfully. + @retval EFI_NOT_AVAILABLE_YET Transport interface is not ready yet. + @retval Other Failure. + +**/ +EFI_STATUS +EFIAPI +IpmiGetSdr ( + IN IPMI_GET_SDR_REQUEST *GetSdrRequest, + OUT IPMI_GET_SDR_RESPONSE *GetSdrResponse, + IN OUT UINT32 *GetSdrResponseSize + ); + +#endif diff --git a/MdeModulePkg/Include/Library/IpmiLib.h b/MdeModulePkg/Include/Library/IpmiLib.h index d3129d230b..776ba60bb0 100644 --- a/MdeModulePkg/Include/Library/IpmiLib.h +++ b/MdeModulePkg/Include/Library/IpmiLib.h @@ -1,44 +1,44 @@ -/** @file
- This library abstract how to access IPMI device via IPMI command.
-
-Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved. <BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _IPMI_LIB_H_
-#define _IPMI_LIB_H_
-
-#include <Uefi.h>
-#include <IndustryStandard/Ipmi.h>
-
-/**
- This service enables submitting commands via Ipmi.
-
- @param[in] NetFunction Net function of the command.
- @param[in] Command IPMI Command.
- @param[in] RequestData Command Request Data.
- @param[in] RequestDataSize Size of Command Request Data.
- @param[out] ResponseData Command Response Data. The completion code is the first byte of response data.
- @param[in, out] ResponseDataSize Size of Command Response Data.
-
- @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received.
- @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device.
- @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access.
- @retval EFI_DEVICE_ERROR Ipmi Device hardware error.
- @retval EFI_TIMEOUT The command time out.
- @retval EFI_UNSUPPORTED The command was not successfully sent to the device.
- @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resource or data size error.
-**/
-EFI_STATUS
-EFIAPI
-IpmiSubmitCommand (
- IN UINT8 NetFunction,
- IN UINT8 Command,
- IN UINT8 *RequestData,
- IN UINT32 RequestDataSize,
- OUT UINT8 *ResponseData,
- IN OUT UINT32 *ResponseDataSize
- );
-
-#endif
+/** @file + This library abstract how to access IPMI device via IPMI command. + +Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved. <BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _IPMI_LIB_H_ +#define _IPMI_LIB_H_ + +#include <Uefi.h> +#include <IndustryStandard/Ipmi.h> + +/** + This service enables submitting commands via Ipmi. + + @param[in] NetFunction Net function of the command. + @param[in] Command IPMI Command. + @param[in] RequestData Command Request Data. + @param[in] RequestDataSize Size of Command Request Data. + @param[out] ResponseData Command Response Data. The completion code is the first byte of response data. + @param[in, out] ResponseDataSize Size of Command Response Data. + + @retval EFI_SUCCESS The command byte stream was successfully submit to the device and a response was successfully received. + @retval EFI_NOT_FOUND The command was not successfully sent to the device or a response was not successfully received from the device. + @retval EFI_NOT_READY Ipmi Device is not ready for Ipmi command access. + @retval EFI_DEVICE_ERROR Ipmi Device hardware error. + @retval EFI_TIMEOUT The command time out. + @retval EFI_UNSUPPORTED The command was not successfully sent to the device. + @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resource or data size error. +**/ +EFI_STATUS +EFIAPI +IpmiSubmitCommand ( + IN UINT8 NetFunction, + IN UINT8 Command, + IN UINT8 *RequestData, + IN UINT32 RequestDataSize, + OUT UINT8 *ResponseData, + IN OUT UINT32 *ResponseDataSize + ); + +#endif diff --git a/MdeModulePkg/Include/Library/LockBoxLib.h b/MdeModulePkg/Include/Library/LockBoxLib.h index ab0eb942d3..87a44d8b5f 100644 --- a/MdeModulePkg/Include/Library/LockBoxLib.h +++ b/MdeModulePkg/Include/Library/LockBoxLib.h @@ -1,137 +1,137 @@ -/** @file
- This library is only intended to be used by DXE modules that need save
- confidential information to LockBox and get it by PEI modules in S3 phase.
-
-Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _LOCK_BOX_LIB_H_
-#define _LOCK_BOX_LIB_H_
-
-/**
- This function will save confidential information to lockbox.
-
- @param Guid the guid to identify the confidential information
- @param Buffer the address of the confidential information
- @param Length the length of the confidential information
-
- @retval RETURN_SUCCESS the information is saved successfully.
- @retval RETURN_INVALID_PARAMETER the Guid is NULL, or Buffer is NULL, or Length is 0
- @retval RETURN_ALREADY_STARTED the requested GUID already exist.
- @retval RETURN_OUT_OF_RESOURCES no enough resource to save the information.
- @retval RETURN_ACCESS_DENIED it is too late to invoke this interface
- @retval RETURN_NOT_STARTED it is too early to invoke this interface
- @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
-**/
-RETURN_STATUS
-EFIAPI
-SaveLockBox (
- IN GUID *Guid,
- IN VOID *Buffer,
- IN UINTN Length
- );
-
-/**
- This function will set lockbox attributes.
-
- @param Guid the guid to identify the confidential information
- @param Attributes the attributes of the lockbox
-
- @retval RETURN_SUCCESS the information is saved successfully.
- @retval RETURN_INVALID_PARAMETER attributes is invalid.
- @retval RETURN_NOT_FOUND the requested GUID not found.
- @retval RETURN_ACCESS_DENIED it is too late to invoke this interface
- @retval RETURN_NOT_STARTED it is too early to invoke this interface
- @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
-**/
-RETURN_STATUS
-EFIAPI
-SetLockBoxAttributes (
- IN GUID *Guid,
- IN UINT64 Attributes
- );
-
-//
-// With this flag, this LockBox can be restored to this Buffer
-// with RestoreAllLockBoxInPlace()
-//
-#define LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE BIT0
-//
-// With this flag, this LockBox can be restored in S3 resume only.
-// This LockBox can not be restored after SmmReadyToLock in normal boot
-// and after EndOfS3Resume in S3 resume.
-// It can not be set together with LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE.
-//
-#define LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY BIT1
-
-/**
- This function will update confidential information to lockbox.
-
- @param Guid the guid to identify the original confidential information
- @param Offset the offset of the original confidential information
- @param Buffer the address of the updated confidential information
- @param Length the length of the updated confidential information
-
- @retval RETURN_SUCCESS the information is saved successfully.
- @retval RETURN_INVALID_PARAMETER the Guid is NULL, or Buffer is NULL, or Length is 0.
- @retval RETURN_NOT_FOUND the requested GUID not found.
- @retval RETURN_BUFFER_TOO_SMALL for lockbox without attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY,
- the original buffer to too small to hold new information.
- @retval RETURN_OUT_OF_RESOURCES for lockbox with attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY,
- no enough resource to save the information.
- @retval RETURN_ACCESS_DENIED it is too late to invoke this interface
- @retval RETURN_NOT_STARTED it is too early to invoke this interface
- @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
-**/
-RETURN_STATUS
-EFIAPI
-UpdateLockBox (
- IN GUID *Guid,
- IN UINTN Offset,
- IN VOID *Buffer,
- IN UINTN Length
- );
-
-/**
- This function will restore confidential information from lockbox.
-
- @param Guid the guid to identify the confidential information
- @param Buffer the address of the restored confidential information
- NULL means restored to original address, Length MUST be NULL at same time.
- @param Length the length of the restored confidential information
-
- @retval RETURN_SUCCESS the information is restored successfully.
- @retval RETURN_INVALID_PARAMETER the Guid is NULL, or one of Buffer and Length is NULL.
- @retval RETURN_WRITE_PROTECTED Buffer and Length are NULL, but the LockBox has no
- LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE attribute.
- @retval RETURN_BUFFER_TOO_SMALL the Length is too small to hold the confidential information.
- @retval RETURN_NOT_FOUND the requested GUID not found.
- @retval RETURN_NOT_STARTED it is too early to invoke this interface
- @retval RETURN_ACCESS_DENIED not allow to restore to the address
- @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
-**/
-RETURN_STATUS
-EFIAPI
-RestoreLockBox (
- IN GUID *Guid,
- IN VOID *Buffer OPTIONAL,
- IN OUT UINTN *Length OPTIONAL
- );
-
-/**
- This function will restore confidential information from all lockbox which have RestoreInPlace attribute.
-
- @retval RETURN_SUCCESS the information is restored successfully.
- @retval RETURN_NOT_STARTED it is too early to invoke this interface
- @retval RETURN_UNSUPPORTED the service is not supported by implementaion.
-**/
-RETURN_STATUS
-EFIAPI
-RestoreAllLockBoxInPlace (
- VOID
- );
-
-#endif
+/** @file + This library is only intended to be used by DXE modules that need save + confidential information to LockBox and get it by PEI modules in S3 phase. + +Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _LOCK_BOX_LIB_H_ +#define _LOCK_BOX_LIB_H_ + +/** + This function will save confidential information to lockbox. + + @param Guid the guid to identify the confidential information + @param Buffer the address of the confidential information + @param Length the length of the confidential information + + @retval RETURN_SUCCESS the information is saved successfully. + @retval RETURN_INVALID_PARAMETER the Guid is NULL, or Buffer is NULL, or Length is 0 + @retval RETURN_ALREADY_STARTED the requested GUID already exist. + @retval RETURN_OUT_OF_RESOURCES no enough resource to save the information. + @retval RETURN_ACCESS_DENIED it is too late to invoke this interface + @retval RETURN_NOT_STARTED it is too early to invoke this interface + @retval RETURN_UNSUPPORTED the service is not supported by implementaion. +**/ +RETURN_STATUS +EFIAPI +SaveLockBox ( + IN GUID *Guid, + IN VOID *Buffer, + IN UINTN Length + ); + +/** + This function will set lockbox attributes. + + @param Guid the guid to identify the confidential information + @param Attributes the attributes of the lockbox + + @retval RETURN_SUCCESS the information is saved successfully. + @retval RETURN_INVALID_PARAMETER attributes is invalid. + @retval RETURN_NOT_FOUND the requested GUID not found. + @retval RETURN_ACCESS_DENIED it is too late to invoke this interface + @retval RETURN_NOT_STARTED it is too early to invoke this interface + @retval RETURN_UNSUPPORTED the service is not supported by implementaion. +**/ +RETURN_STATUS +EFIAPI +SetLockBoxAttributes ( + IN GUID *Guid, + IN UINT64 Attributes + ); + +// +// With this flag, this LockBox can be restored to this Buffer +// with RestoreAllLockBoxInPlace() +// +#define LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE BIT0 +// +// With this flag, this LockBox can be restored in S3 resume only. +// This LockBox can not be restored after SmmReadyToLock in normal boot +// and after EndOfS3Resume in S3 resume. +// It can not be set together with LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE. +// +#define LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY BIT1 + +/** + This function will update confidential information to lockbox. + + @param Guid the guid to identify the original confidential information + @param Offset the offset of the original confidential information + @param Buffer the address of the updated confidential information + @param Length the length of the updated confidential information + + @retval RETURN_SUCCESS the information is saved successfully. + @retval RETURN_INVALID_PARAMETER the Guid is NULL, or Buffer is NULL, or Length is 0. + @retval RETURN_NOT_FOUND the requested GUID not found. + @retval RETURN_BUFFER_TOO_SMALL for lockbox without attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY, + the original buffer to too small to hold new information. + @retval RETURN_OUT_OF_RESOURCES for lockbox with attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY, + no enough resource to save the information. + @retval RETURN_ACCESS_DENIED it is too late to invoke this interface + @retval RETURN_NOT_STARTED it is too early to invoke this interface + @retval RETURN_UNSUPPORTED the service is not supported by implementaion. +**/ +RETURN_STATUS +EFIAPI +UpdateLockBox ( + IN GUID *Guid, + IN UINTN Offset, + IN VOID *Buffer, + IN UINTN Length + ); + +/** + This function will restore confidential information from lockbox. + + @param Guid the guid to identify the confidential information + @param Buffer the address of the restored confidential information + NULL means restored to original address, Length MUST be NULL at same time. + @param Length the length of the restored confidential information + + @retval RETURN_SUCCESS the information is restored successfully. + @retval RETURN_INVALID_PARAMETER the Guid is NULL, or one of Buffer and Length is NULL. + @retval RETURN_WRITE_PROTECTED Buffer and Length are NULL, but the LockBox has no + LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE attribute. + @retval RETURN_BUFFER_TOO_SMALL the Length is too small to hold the confidential information. + @retval RETURN_NOT_FOUND the requested GUID not found. + @retval RETURN_NOT_STARTED it is too early to invoke this interface + @retval RETURN_ACCESS_DENIED not allow to restore to the address + @retval RETURN_UNSUPPORTED the service is not supported by implementaion. +**/ +RETURN_STATUS +EFIAPI +RestoreLockBox ( + IN GUID *Guid, + IN VOID *Buffer OPTIONAL, + IN OUT UINTN *Length OPTIONAL + ); + +/** + This function will restore confidential information from all lockbox which have RestoreInPlace attribute. + + @retval RETURN_SUCCESS the information is restored successfully. + @retval RETURN_NOT_STARTED it is too early to invoke this interface + @retval RETURN_UNSUPPORTED the service is not supported by implementaion. +**/ +RETURN_STATUS +EFIAPI +RestoreAllLockBoxInPlace ( + VOID + ); + +#endif diff --git a/MdeModulePkg/Include/Library/MemoryProfileLib.h b/MdeModulePkg/Include/Library/MemoryProfileLib.h index f87f245158..4a2b59ff92 100644 --- a/MdeModulePkg/Include/Library/MemoryProfileLib.h +++ b/MdeModulePkg/Include/Library/MemoryProfileLib.h @@ -1,47 +1,47 @@ -/** @file
- Provides services to record memory profile of multilevel caller.
-
- Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _MEMORY_PROFILE_LIB_H_
-#define _MEMORY_PROFILE_LIB_H_
-
-#include <Guid/MemoryProfile.h>
-
-/**
- Record memory profile of multilevel caller.
-
- @param[in] CallerAddress Address of caller.
- @param[in] Action Memory profile action.
- @param[in] MemoryType Memory type.
- EfiMaxMemoryType means the MemoryType is unknown.
- @param[in] Buffer Buffer address.
- @param[in] Size Buffer size.
- @param[in] ActionString String for memory profile action.
- Only needed for user defined allocate action.
-
- @return EFI_SUCCESS Memory profile is updated.
- @return EFI_UNSUPPORTED Memory profile is unsupported,
- or memory profile for the image is not required,
- or memory profile for the memory type is not required.
- @return EFI_ACCESS_DENIED It is during memory profile data getting.
- @return EFI_ABORTED Memory profile recording is not enabled.
- @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
- @return EFI_NOT_FOUND No matched allocate info found for free action.
-
-**/
-EFI_STATUS
-EFIAPI
-MemoryProfileLibRecord (
- IN PHYSICAL_ADDRESS CallerAddress,
- IN MEMORY_PROFILE_ACTION Action,
- IN EFI_MEMORY_TYPE MemoryType,
- IN VOID *Buffer,
- IN UINTN Size,
- IN CHAR8 *ActionString OPTIONAL
- );
-
-#endif
+/** @file + Provides services to record memory profile of multilevel caller. + + Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _MEMORY_PROFILE_LIB_H_ +#define _MEMORY_PROFILE_LIB_H_ + +#include <Guid/MemoryProfile.h> + +/** + Record memory profile of multilevel caller. + + @param[in] CallerAddress Address of caller. + @param[in] Action Memory profile action. + @param[in] MemoryType Memory type. + EfiMaxMemoryType means the MemoryType is unknown. + @param[in] Buffer Buffer address. + @param[in] Size Buffer size. + @param[in] ActionString String for memory profile action. + Only needed for user defined allocate action. + + @return EFI_SUCCESS Memory profile is updated. + @return EFI_UNSUPPORTED Memory profile is unsupported, + or memory profile for the image is not required, + or memory profile for the memory type is not required. + @return EFI_ACCESS_DENIED It is during memory profile data getting. + @return EFI_ABORTED Memory profile recording is not enabled. + @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action. + @return EFI_NOT_FOUND No matched allocate info found for free action. + +**/ +EFI_STATUS +EFIAPI +MemoryProfileLibRecord ( + IN PHYSICAL_ADDRESS CallerAddress, + IN MEMORY_PROFILE_ACTION Action, + IN EFI_MEMORY_TYPE MemoryType, + IN VOID *Buffer, + IN UINTN Size, + IN CHAR8 *ActionString OPTIONAL + ); + +#endif diff --git a/MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h b/MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h index b2300c9647..8149fceafc 100644 --- a/MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h +++ b/MdeModulePkg/Include/Library/NonDiscoverableDeviceRegistrationLib.h @@ -1,58 +1,58 @@ -/** @file
- Copyright (c) 2016, Linaro, Ltd. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __NON_DISCOVERABLE_DEVICE_REGISTRATION_LIB_H__
-#define __NON_DISCOVERABLE_DEVICE_REGISTRATION_LIB_H__
-
-#include <Protocol/NonDiscoverableDevice.h>
-
-typedef enum {
- NonDiscoverableDeviceTypeAhci,
- NonDiscoverableDeviceTypeAmba,
- NonDiscoverableDeviceTypeEhci,
- NonDiscoverableDeviceTypeNvme,
- NonDiscoverableDeviceTypeOhci,
- NonDiscoverableDeviceTypeSdhci,
- NonDiscoverableDeviceTypeUfs,
- NonDiscoverableDeviceTypeUhci,
- NonDiscoverableDeviceTypeXhci,
- NonDiscoverableDeviceTypeMax,
-} NON_DISCOVERABLE_DEVICE_TYPE;
-
-/**
- Register a non-discoverable MMIO device
-
- @param[in] Type The type of non-discoverable device
- @param[in] DmaType Whether the device is DMA coherent
- @param[in] InitFunc Initialization routine to be invoked when
- the device is enabled
- @param[in,out] Handle The handle onto which to install the
- non-discoverable device protocol.
- If Handle is NULL or *Handle is NULL, a
- new handle will be allocated.
- @param[in] NumMmioResources The number of UINTN base/size pairs that
- follow, each describing an MMIO region
- owned by the device
- @param[in] ... The variable argument list which contains the
- info about MmioResources.
-
- @retval EFI_SUCCESS The registration succeeded.
- @retval Other The registration failed.
-
-**/
-EFI_STATUS
-EFIAPI
-RegisterNonDiscoverableMmioDevice (
- IN NON_DISCOVERABLE_DEVICE_TYPE Type,
- IN NON_DISCOVERABLE_DEVICE_DMA_TYPE DmaType,
- IN NON_DISCOVERABLE_DEVICE_INIT InitFunc,
- IN OUT EFI_HANDLE *Handle OPTIONAL,
- IN UINTN NumMmioResources,
- ...
- );
-
-#endif
+/** @file + Copyright (c) 2016, Linaro, Ltd. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __NON_DISCOVERABLE_DEVICE_REGISTRATION_LIB_H__ +#define __NON_DISCOVERABLE_DEVICE_REGISTRATION_LIB_H__ + +#include <Protocol/NonDiscoverableDevice.h> + +typedef enum { + NonDiscoverableDeviceTypeAhci, + NonDiscoverableDeviceTypeAmba, + NonDiscoverableDeviceTypeEhci, + NonDiscoverableDeviceTypeNvme, + NonDiscoverableDeviceTypeOhci, + NonDiscoverableDeviceTypeSdhci, + NonDiscoverableDeviceTypeUfs, + NonDiscoverableDeviceTypeUhci, + NonDiscoverableDeviceTypeXhci, + NonDiscoverableDeviceTypeMax, +} NON_DISCOVERABLE_DEVICE_TYPE; + +/** + Register a non-discoverable MMIO device + + @param[in] Type The type of non-discoverable device + @param[in] DmaType Whether the device is DMA coherent + @param[in] InitFunc Initialization routine to be invoked when + the device is enabled + @param[in,out] Handle The handle onto which to install the + non-discoverable device protocol. + If Handle is NULL or *Handle is NULL, a + new handle will be allocated. + @param[in] NumMmioResources The number of UINTN base/size pairs that + follow, each describing an MMIO region + owned by the device + @param[in] ... The variable argument list which contains the + info about MmioResources. + + @retval EFI_SUCCESS The registration succeeded. + @retval Other The registration failed. + +**/ +EFI_STATUS +EFIAPI +RegisterNonDiscoverableMmioDevice ( + IN NON_DISCOVERABLE_DEVICE_TYPE Type, + IN NON_DISCOVERABLE_DEVICE_DMA_TYPE DmaType, + IN NON_DISCOVERABLE_DEVICE_INIT InitFunc, + IN OUT EFI_HANDLE *Handle OPTIONAL, + IN UINTN NumMmioResources, + ... + ); + +#endif diff --git a/MdeModulePkg/Include/Library/OemHookStatusCodeLib.h b/MdeModulePkg/Include/Library/OemHookStatusCodeLib.h index c12f61f4f9..154d10adb3 100644 --- a/MdeModulePkg/Include/Library/OemHookStatusCodeLib.h +++ b/MdeModulePkg/Include/Library/OemHookStatusCodeLib.h @@ -1,72 +1,72 @@ -/** @file
- OEM hook status code library. Platform can implement an instance to
- initialize the OEM devices to report status code information.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __OEM_HOOK_STATUSCODE_LIB__
-#define __OEM_HOOK_STATUSCODE_LIB__
-
-/**
-
- Initialize OEM status code device.
-
-
- @return Status of initialization of OEM status code device.
-
-**/
-EFI_STATUS
-EFIAPI
-OemHookStatusCodeInitialize (
- VOID
- );
-
-/**
- Report status code to OEM device.
-
- @param CodeType Indicates the type of status code being reported.
-
- @param Value Describes the current status of a hardware or software entity.
- This includes both an operation and classification information
- about the class and subclass.
- For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes,
- it is not defined at this time.
- Specific values are discussed in the Intel Platform Innovation
- Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass
- pairing.
- The instance differentiates between them. An instance of 0
- indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers
- start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply
- different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface()
- in the UEFI 2.0 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data.
-
- @return The function always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-OemHookStatusCodeReport (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId OPTIONAL,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-#endif // __OEM_HOOK_STATUSCODE_LIB__
+/** @file + OEM hook status code library. Platform can implement an instance to + initialize the OEM devices to report status code information. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __OEM_HOOK_STATUSCODE_LIB__ +#define __OEM_HOOK_STATUSCODE_LIB__ + +/** + + Initialize OEM status code device. + + + @return Status of initialization of OEM status code device. + +**/ +EFI_STATUS +EFIAPI +OemHookStatusCodeInitialize ( + VOID + ); + +/** + Report status code to OEM device. + + @param CodeType Indicates the type of status code being reported. + + @param Value Describes the current status of a hardware or software entity. + This includes both an operation and classification information + about the class and subclass. + For progress codes, the operation is the current activity. + For error codes, it is the exception. For debug codes, + it is not defined at this time. + Specific values are discussed in the Intel Platform Innovation + Framework for EFI Status Code Specification. + + @param Instance The enumeration of a hardware or software entity within the system. + A system may contain multiple entities that match a class/subclass + pairing. + The instance differentiates between them. An instance of 0 + indicates that instance information is unavailable, + not meaningful, or not relevant. Valid instance numbers + start with 1. + + + @param CallerId This optional parameter may be used to identify the caller. + This parameter allows the status code driver to apply + different rules to different callers. + Type EFI_GUID is defined in InstallProtocolInterface() + in the UEFI 2.0 Specification. + + + @param Data This optional parameter may be used to pass additional data. + + @return The function always returns EFI_SUCCESS. + +**/ +EFI_STATUS +EFIAPI +OemHookStatusCodeReport ( + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN EFI_GUID *CallerId OPTIONAL, + IN EFI_STATUS_CODE_DATA *Data OPTIONAL + ); + +#endif // __OEM_HOOK_STATUSCODE_LIB__ diff --git a/MdeModulePkg/Include/Library/PciHostBridgeLib.h b/MdeModulePkg/Include/Library/PciHostBridgeLib.h index 54b5a14243..46e421ad1e 100644 --- a/MdeModulePkg/Include/Library/PciHostBridgeLib.h +++ b/MdeModulePkg/Include/Library/PciHostBridgeLib.h @@ -1,116 +1,116 @@ -/** @file
- PCI Host Bridge Library consumed by PciHostBridgeDxe driver returning
- the platform specific information about the PCI Host Bridge.
-
- Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PCI_HOST_BRIDGE_LIB_H__
-#define __PCI_HOST_BRIDGE_LIB_H__
-
-//
-// (Base > Limit) indicates an aperture is not available.
-//
-typedef struct {
- //
- // Base and Limit are the device address instead of host address when
- // Translation is not zero
- //
- UINT64 Base;
- UINT64 Limit;
- //
- // According to UEFI 2.7, Device Address = Host Address + Translation,
- // so Translation = Device Address - Host Address.
- // On platforms where Translation is not zero, the subtraction is probably to
- // be performed with UINT64 wrap-around semantics, for we may translate an
- // above-4G host address into a below-4G device address for legacy PCIe device
- // compatibility.
- //
- // NOTE: The alignment of Translation is required to be larger than any BAR
- // alignment in the same root bridge, so that the same alignment can be
- // applied to both device address and host address, which simplifies the
- // situation and makes the current resource allocation code in generic PCI
- // host bridge driver still work.
- //
- UINT64 Translation;
-} PCI_ROOT_BRIDGE_APERTURE;
-
-typedef struct {
- UINT32 Segment; ///< Segment number.
- UINT64 Supports; ///< Supported attributes.
- ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes()
- ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- UINT64 Attributes; ///< Initial attributes.
- ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes()
- ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- BOOLEAN DmaAbove4G; ///< DMA above 4GB memory.
- ///< Set to TRUE when root bridge supports DMA above 4GB memory.
- BOOLEAN NoExtendedConfigSpace; ///< When FALSE, the root bridge supports
- ///< Extended (4096-byte) Configuration Space.
- ///< When TRUE, the root bridge supports
- ///< 256-byte Configuration Space only.
- BOOLEAN ResourceAssigned; ///< Resource assignment status of the root bridge.
- ///< Set to TRUE if Bus/IO/MMIO resources for root bridge have been assigned.
- UINT64 AllocationAttributes; ///< Allocation attributes.
- ///< Refer to EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM and
- ///< EFI_PCI_HOST_BRIDGE_MEM64_DECODE used by GetAllocAttributes()
- ///< in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
- PCI_ROOT_BRIDGE_APERTURE Bus; ///< Bus aperture which can be used by the root bridge.
- PCI_ROOT_BRIDGE_APERTURE Io; ///< IO aperture which can be used by the root bridge.
- PCI_ROOT_BRIDGE_APERTURE Mem; ///< MMIO aperture below 4GB which can be used by the root bridge.
- PCI_ROOT_BRIDGE_APERTURE MemAbove4G; ///< MMIO aperture above 4GB which can be used by the root bridge.
- PCI_ROOT_BRIDGE_APERTURE PMem; ///< Prefetchable MMIO aperture below 4GB which can be used by the root bridge.
- PCI_ROOT_BRIDGE_APERTURE PMemAbove4G; ///< Prefetchable MMIO aperture above 4GB which can be used by the root bridge.
- EFI_DEVICE_PATH_PROTOCOL *DevicePath; ///< Device path.
-} PCI_ROOT_BRIDGE;
-
-/**
- Return all the root bridge instances in an array.
-
- @param Count Return the count of root bridge instances.
-
- @return All the root bridge instances in an array.
- The array should be passed into PciHostBridgeFreeRootBridges()
- when it's not used.
-**/
-PCI_ROOT_BRIDGE *
-EFIAPI
-PciHostBridgeGetRootBridges (
- UINTN *Count
- );
-
-/**
- Free the root bridge instances array returned from PciHostBridgeGetRootBridges().
-
- @param Bridges The root bridge instances array.
- @param Count The count of the array.
-**/
-VOID
-EFIAPI
-PciHostBridgeFreeRootBridges (
- PCI_ROOT_BRIDGE *Bridges,
- UINTN Count
- );
-
-/**
- Inform the platform that the resource conflict happens.
-
- @param HostBridgeHandle Handle of the Host Bridge.
- @param Configuration Pointer to PCI I/O and PCI memory resource descriptors.
- The Configuration contains the resources for all the
- root bridges. The resource for each root bridge is
- terminated with END descriptor and an additional END
- is appended indicating the end of the entire resources.
- The resource descriptor field values follow the description
- in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.SubmitResources().
-**/
-VOID
-EFIAPI
-PciHostBridgeResourceConflict (
- EFI_HANDLE HostBridgeHandle,
- VOID *Configuration
- );
-
-#endif
+/** @file + PCI Host Bridge Library consumed by PciHostBridgeDxe driver returning + the platform specific information about the PCI Host Bridge. + + Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PCI_HOST_BRIDGE_LIB_H__ +#define __PCI_HOST_BRIDGE_LIB_H__ + +// +// (Base > Limit) indicates an aperture is not available. +// +typedef struct { + // + // Base and Limit are the device address instead of host address when + // Translation is not zero + // + UINT64 Base; + UINT64 Limit; + // + // According to UEFI 2.7, Device Address = Host Address + Translation, + // so Translation = Device Address - Host Address. + // On platforms where Translation is not zero, the subtraction is probably to + // be performed with UINT64 wrap-around semantics, for we may translate an + // above-4G host address into a below-4G device address for legacy PCIe device + // compatibility. + // + // NOTE: The alignment of Translation is required to be larger than any BAR + // alignment in the same root bridge, so that the same alignment can be + // applied to both device address and host address, which simplifies the + // situation and makes the current resource allocation code in generic PCI + // host bridge driver still work. + // + UINT64 Translation; +} PCI_ROOT_BRIDGE_APERTURE; + +typedef struct { + UINT32 Segment; ///< Segment number. + UINT64 Supports; ///< Supported attributes. + ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes() + ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + UINT64 Attributes; ///< Initial attributes. + ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes() + ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + BOOLEAN DmaAbove4G; ///< DMA above 4GB memory. + ///< Set to TRUE when root bridge supports DMA above 4GB memory. + BOOLEAN NoExtendedConfigSpace; ///< When FALSE, the root bridge supports + ///< Extended (4096-byte) Configuration Space. + ///< When TRUE, the root bridge supports + ///< 256-byte Configuration Space only. + BOOLEAN ResourceAssigned; ///< Resource assignment status of the root bridge. + ///< Set to TRUE if Bus/IO/MMIO resources for root bridge have been assigned. + UINT64 AllocationAttributes; ///< Allocation attributes. + ///< Refer to EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM and + ///< EFI_PCI_HOST_BRIDGE_MEM64_DECODE used by GetAllocAttributes() + ///< in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL. + PCI_ROOT_BRIDGE_APERTURE Bus; ///< Bus aperture which can be used by the root bridge. + PCI_ROOT_BRIDGE_APERTURE Io; ///< IO aperture which can be used by the root bridge. + PCI_ROOT_BRIDGE_APERTURE Mem; ///< MMIO aperture below 4GB which can be used by the root bridge. + PCI_ROOT_BRIDGE_APERTURE MemAbove4G; ///< MMIO aperture above 4GB which can be used by the root bridge. + PCI_ROOT_BRIDGE_APERTURE PMem; ///< Prefetchable MMIO aperture below 4GB which can be used by the root bridge. + PCI_ROOT_BRIDGE_APERTURE PMemAbove4G; ///< Prefetchable MMIO aperture above 4GB which can be used by the root bridge. + EFI_DEVICE_PATH_PROTOCOL *DevicePath; ///< Device path. +} PCI_ROOT_BRIDGE; + +/** + Return all the root bridge instances in an array. + + @param Count Return the count of root bridge instances. + + @return All the root bridge instances in an array. + The array should be passed into PciHostBridgeFreeRootBridges() + when it's not used. +**/ +PCI_ROOT_BRIDGE * +EFIAPI +PciHostBridgeGetRootBridges ( + UINTN *Count + ); + +/** + Free the root bridge instances array returned from PciHostBridgeGetRootBridges(). + + @param Bridges The root bridge instances array. + @param Count The count of the array. +**/ +VOID +EFIAPI +PciHostBridgeFreeRootBridges ( + PCI_ROOT_BRIDGE *Bridges, + UINTN Count + ); + +/** + Inform the platform that the resource conflict happens. + + @param HostBridgeHandle Handle of the Host Bridge. + @param Configuration Pointer to PCI I/O and PCI memory resource descriptors. + The Configuration contains the resources for all the + root bridges. The resource for each root bridge is + terminated with END descriptor and an additional END + is appended indicating the end of the entire resources. + The resource descriptor field values follow the description + in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.SubmitResources(). +**/ +VOID +EFIAPI +PciHostBridgeResourceConflict ( + EFI_HANDLE HostBridgeHandle, + VOID *Configuration + ); + +#endif diff --git a/MdeModulePkg/Include/Library/PlatformBootManagerLib.h b/MdeModulePkg/Include/Library/PlatformBootManagerLib.h index 9dd590c9e0..3b8238d52e 100644 --- a/MdeModulePkg/Include/Library/PlatformBootManagerLib.h +++ b/MdeModulePkg/Include/Library/PlatformBootManagerLib.h @@ -1,68 +1,68 @@ -/** @file
- Platform Boot Manager library definition. A platform can implement
- instances to support platform-specific behavior.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PLATFORM_BOOT_MANAGER_LIB_H_
-#define __PLATFORM_BOOT_MANAGER_LIB_H_
-#include <Library/UefiBootManagerLib.h>
-
-/**
- Do the platform specific action before the console is connected.
-
- Such as:
- Update console variable;
- Register new Driver#### or Boot####;
- Signal ReadyToLock event.
-**/
-VOID
-EFIAPI
-PlatformBootManagerBeforeConsole (
- VOID
- );
-
-/**
- Do the platform specific action after the console is connected.
-
- Such as:
- Dynamically switch output mode;
- Signal console ready platform customized event;
- Run diagnostics like memory testing;
- Connect certain devices;
- Dispatch aditional option roms.
-**/
-VOID
-EFIAPI
-PlatformBootManagerAfterConsole (
- VOID
- );
-
-/**
- This function is called each second during the boot manager waits the timeout.
-
- @param TimeoutRemain The remaining timeout.
-**/
-VOID
-EFIAPI
-PlatformBootManagerWaitCallback (
- UINT16 TimeoutRemain
- );
-
-/**
- The function is called when no boot option could be launched,
- including platform recovery options and options pointing to applications
- built into firmware volumes.
-
- If this function returns, BDS attempts to enter an infinite loop.
-**/
-VOID
-EFIAPI
-PlatformBootManagerUnableToBoot (
- VOID
- );
-
-#endif
+/** @file + Platform Boot Manager library definition. A platform can implement + instances to support platform-specific behavior. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PLATFORM_BOOT_MANAGER_LIB_H_ +#define __PLATFORM_BOOT_MANAGER_LIB_H_ +#include <Library/UefiBootManagerLib.h> + +/** + Do the platform specific action before the console is connected. + + Such as: + Update console variable; + Register new Driver#### or Boot####; + Signal ReadyToLock event. +**/ +VOID +EFIAPI +PlatformBootManagerBeforeConsole ( + VOID + ); + +/** + Do the platform specific action after the console is connected. + + Such as: + Dynamically switch output mode; + Signal console ready platform customized event; + Run diagnostics like memory testing; + Connect certain devices; + Dispatch aditional option roms. +**/ +VOID +EFIAPI +PlatformBootManagerAfterConsole ( + VOID + ); + +/** + This function is called each second during the boot manager waits the timeout. + + @param TimeoutRemain The remaining timeout. +**/ +VOID +EFIAPI +PlatformBootManagerWaitCallback ( + UINT16 TimeoutRemain + ); + +/** + The function is called when no boot option could be launched, + including platform recovery options and options pointing to applications + built into firmware volumes. + + If this function returns, BDS attempts to enter an infinite loop. +**/ +VOID +EFIAPI +PlatformBootManagerUnableToBoot ( + VOID + ); + +#endif diff --git a/MdeModulePkg/Include/Library/PlatformHookLib.h b/MdeModulePkg/Include/Library/PlatformHookLib.h index 04cccd9bba..e866df3256 100644 --- a/MdeModulePkg/Include/Library/PlatformHookLib.h +++ b/MdeModulePkg/Include/Library/PlatformHookLib.h @@ -1,31 +1,31 @@ -/** @file
- Platform hook library. Platform can provide an implementation of this
- library class to provide hooks that may be required for some type of
- platform initialization.
-
-Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __PLATFORM_HOOK_LIB__
-#define __PLATFORM_HOOK_LIB__
-
-/**
- Performs platform specific initialization required for the CPU to access
- the hardware associated with a SerialPortLib instance. This function does
- not intiailzie the serial port hardware itself. Instead, it initializes
- hardware devices that are required for the CPU to access the serial port
- hardware. This function may be called more than once.
-
- @retval RETURN_SUCCESS The platform specific initialization succeeded.
- @retval RETURN_DEVICE_ERROR The platform specific initialization could not be completed.
-
-**/
-RETURN_STATUS
-EFIAPI
-PlatformHookSerialPortInitialize (
- VOID
- );
-
-#endif // __PLATFORM_HOOK_LIB__
+/** @file + Platform hook library. Platform can provide an implementation of this + library class to provide hooks that may be required for some type of + platform initialization. + +Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PLATFORM_HOOK_LIB__ +#define __PLATFORM_HOOK_LIB__ + +/** + Performs platform specific initialization required for the CPU to access + the hardware associated with a SerialPortLib instance. This function does + not intiailzie the serial port hardware itself. Instead, it initializes + hardware devices that are required for the CPU to access the serial port + hardware. This function may be called more than once. + + @retval RETURN_SUCCESS The platform specific initialization succeeded. + @retval RETURN_DEVICE_ERROR The platform specific initialization could not be completed. + +**/ +RETURN_STATUS +EFIAPI +PlatformHookSerialPortInitialize ( + VOID + ); + +#endif // __PLATFORM_HOOK_LIB__ diff --git a/MdeModulePkg/Include/Library/PlatformVarCleanupLib.h b/MdeModulePkg/Include/Library/PlatformVarCleanupLib.h index ac530ff867..24bf54b36f 100644 --- a/MdeModulePkg/Include/Library/PlatformVarCleanupLib.h +++ b/MdeModulePkg/Include/Library/PlatformVarCleanupLib.h @@ -1,55 +1,55 @@ -/** @file
- The library class provides platform variable cleanup services.
-
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _PLATFORM_VARIABLE_CLEANUP_LIB_
-#define _PLATFORM_VARIABLE_CLEANUP_LIB_
-
-#include <Guid/VarErrorFlag.h>
-
-typedef enum {
- VarCleanupAll,
- VarCleanupManually,
- VarCleanupMax,
-} VAR_CLEANUP_TYPE;
-
-/**
- Get last boot variable error flag.
-
- @return Last boot variable error flag.
-
-**/
-VAR_ERROR_FLAG
-EFIAPI
-GetLastBootVarErrorFlag (
- VOID
- );
-
-/**
- Platform variable cleanup.
-
- @param[in] Flag Variable error flag.
- @param[in] Type Variable cleanup type.
- If it is VarCleanupManually, the interface must be called after console connected.
-
- @retval EFI_SUCCESS No error or error processed.
- @retval 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.
- @retval EFI_OUT_OF_RESOURCES Not enough resource to process the error.
- @retval EFI_INVALID_PARAMETER The specified Flag or Type is an invalid value.
- @retval Others Other failure occurs.
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformVarCleanup (
- IN VAR_ERROR_FLAG Flag,
- IN VAR_CLEANUP_TYPE Type
- );
-
-#endif
+/** @file + The library class provides platform variable cleanup services. + +Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PLATFORM_VARIABLE_CLEANUP_LIB_ +#define _PLATFORM_VARIABLE_CLEANUP_LIB_ + +#include <Guid/VarErrorFlag.h> + +typedef enum { + VarCleanupAll, + VarCleanupManually, + VarCleanupMax, +} VAR_CLEANUP_TYPE; + +/** + Get last boot variable error flag. + + @return Last boot variable error flag. + +**/ +VAR_ERROR_FLAG +EFIAPI +GetLastBootVarErrorFlag ( + VOID + ); + +/** + Platform variable cleanup. + + @param[in] Flag Variable error flag. + @param[in] Type Variable cleanup type. + If it is VarCleanupManually, the interface must be called after console connected. + + @retval EFI_SUCCESS No error or error processed. + @retval 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. + @retval EFI_OUT_OF_RESOURCES Not enough resource to process the error. + @retval EFI_INVALID_PARAMETER The specified Flag or Type is an invalid value. + @retval Others Other failure occurs. + +**/ +EFI_STATUS +EFIAPI +PlatformVarCleanup ( + IN VAR_ERROR_FLAG Flag, + IN VAR_CLEANUP_TYPE Type + ); + +#endif diff --git a/MdeModulePkg/Include/Library/ResetSystemLib.h b/MdeModulePkg/Include/Library/ResetSystemLib.h index 472a9355ea..5c340c9aaa 100644 --- a/MdeModulePkg/Include/Library/ResetSystemLib.h +++ b/MdeModulePkg/Include/Library/ResetSystemLib.h @@ -1,93 +1,93 @@ -/** @file
- System reset Library Services. This library class defines a set of
- methods that reset the whole system.
-
-Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __RESET_SYSTEM_LIB_H__
-#define __RESET_SYSTEM_LIB_H__
-
-#include <Uefi/UefiBaseType.h>
-#include <Uefi/UefiMultiPhase.h>
-
-/**
- This function causes a system-wide reset (cold reset), in which
- all circuitry within the system returns to its initial state. This type of reset
- is asynchronous to system operation and operates without regard to
- cycle boundaries.
-
- If this function returns, it means that the system does not support cold reset.
-**/
-VOID
-EFIAPI
-ResetCold (
- VOID
- );
-
-/**
- This function causes a system-wide initialization (warm reset), in which all processors
- are set to their initial state. Pending cycles are not corrupted.
-
- If this function returns, it means that the system does not support warm reset.
-**/
-VOID
-EFIAPI
-ResetWarm (
- VOID
- );
-
-/**
- This function causes the system to enter a power state equivalent
- to the ACPI G2/S5 or G3 states.
-
- If this function returns, it means that the system does not support shutdown reset.
-**/
-VOID
-EFIAPI
-ResetShutdown (
- VOID
- );
-
-/**
- This function causes a systemwide reset. The exact type of the reset is
- defined by the EFI_GUID that follows the Null-terminated Unicode string passed
- into ResetData. If the platform does not recognize the EFI_GUID in ResetData
- the platform must pick a supported reset type to perform.The platform may
- optionally log the parameters from any non-normal reset that occurs.
-
- @param[in] DataSize The size, in bytes, of ResetData.
- @param[in] ResetData The data buffer starts with a Null-terminated string,
- followed by the EFI_GUID.
-**/
-VOID
-EFIAPI
-ResetPlatformSpecific (
- IN UINTN DataSize,
- IN VOID *ResetData
- );
-
-/**
- The ResetSystem function resets the entire platform.
-
- @param[in] ResetType The type of reset to perform.
- @param[in] ResetStatus The status code for the reset.
- @param[in] DataSize The size, in bytes, of ResetData.
- @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
- the data buffer starts with a Null-terminated string, optionally
- followed by additional binary data. The string is a description
- that the caller may use to further indicate the reason for the
- system reset.
-**/
-VOID
-EFIAPI
-ResetSystem (
- IN EFI_RESET_TYPE ResetType,
- IN EFI_STATUS ResetStatus,
- IN UINTN DataSize,
- IN VOID *ResetData OPTIONAL
- );
-
-#endif
+/** @file + System reset Library Services. This library class defines a set of + methods that reset the whole system. + +Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __RESET_SYSTEM_LIB_H__ +#define __RESET_SYSTEM_LIB_H__ + +#include <Uefi/UefiBaseType.h> +#include <Uefi/UefiMultiPhase.h> + +/** + This function causes a system-wide reset (cold reset), in which + all circuitry within the system returns to its initial state. This type of reset + is asynchronous to system operation and operates without regard to + cycle boundaries. + + If this function returns, it means that the system does not support cold reset. +**/ +VOID +EFIAPI +ResetCold ( + VOID + ); + +/** + This function causes a system-wide initialization (warm reset), in which all processors + are set to their initial state. Pending cycles are not corrupted. + + If this function returns, it means that the system does not support warm reset. +**/ +VOID +EFIAPI +ResetWarm ( + VOID + ); + +/** + This function causes the system to enter a power state equivalent + to the ACPI G2/S5 or G3 states. + + If this function returns, it means that the system does not support shutdown reset. +**/ +VOID +EFIAPI +ResetShutdown ( + VOID + ); + +/** + This function causes a systemwide reset. The exact type of the reset is + defined by the EFI_GUID that follows the Null-terminated Unicode string passed + into ResetData. If the platform does not recognize the EFI_GUID in ResetData + the platform must pick a supported reset type to perform.The platform may + optionally log the parameters from any non-normal reset that occurs. + + @param[in] DataSize The size, in bytes, of ResetData. + @param[in] ResetData The data buffer starts with a Null-terminated string, + followed by the EFI_GUID. +**/ +VOID +EFIAPI +ResetPlatformSpecific ( + IN UINTN DataSize, + IN VOID *ResetData + ); + +/** + The ResetSystem function resets the entire platform. + + @param[in] ResetType The type of reset to perform. + @param[in] ResetStatus The status code for the reset. + @param[in] DataSize The size, in bytes, of ResetData. + @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown + the data buffer starts with a Null-terminated string, optionally + followed by additional binary data. The string is a description + that the caller may use to further indicate the reason for the + system reset. +**/ +VOID +EFIAPI +ResetSystem ( + IN EFI_RESET_TYPE ResetType, + IN EFI_STATUS ResetStatus, + IN UINTN DataSize, + IN VOID *ResetData OPTIONAL + ); + +#endif diff --git a/MdeModulePkg/Include/Library/ResetUtilityLib.h b/MdeModulePkg/Include/Library/ResetUtilityLib.h index 27aca52490..dae5ecd81a 100644 --- a/MdeModulePkg/Include/Library/ResetUtilityLib.h +++ b/MdeModulePkg/Include/Library/ResetUtilityLib.h @@ -1,131 +1,131 @@ -/** @file
- This header describes various helper functions for resetting the system.
-
- Copyright (c) 2017 - 2019 Intel Corporation. All rights reserved.<BR>
- Copyright (c) 2016 Microsoft Corporation. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _RESET_UTILITY_LIB_H_
-#define _RESET_UTILITY_LIB_H_
-
-#include <Uefi/UefiMultiPhase.h>
-
-/**
- This is a shorthand helper function to reset with reset type and a subtype
- so that the caller doesn't have to bother with a function that has half
- a dozen parameters.
-
- This will generate a reset with status EFI_SUCCESS, a NULL string, and
- no custom data. The subtype will be formatted in such a way that it can be
- picked up by notification registrations and custom handlers.
-
- NOTE: This call will fail if the architectural ResetSystem underpinnings
- are not initialized. For DXE, you can add gEfiResetArchProtocolGuid
- to your DEPEX.
-
- @param[in] ResetType The default EFI_RESET_TYPE of the reset.
- @param[in] ResetSubtype GUID pointer for the reset subtype to be used.
-
-**/
-VOID
-EFIAPI
-ResetSystemWithSubtype (
- IN EFI_RESET_TYPE ResetType,
- IN CONST GUID *ResetSubtype
- );
-
-/**
- This is a shorthand helper function to reset with the reset type
- 'EfiResetPlatformSpecific' and a subtype so that the caller doesn't
- have to bother with a function that has half a dozen parameters.
-
- This will generate a reset with status EFI_SUCCESS, a NULL string, and
- no custom data. The subtype will be formatted in such a way that it can be
- picked up by notification registrations and custom handlers.
-
- NOTE: This call will fail if the architectural ResetSystem underpinnings
- are not initialized. For DXE, you can add gEfiResetArchProtocolGuid
- to your DEPEX.
-
- @param[in] ResetSubtype GUID pointer for the reset subtype to be used.
-
-**/
-VOID
-EFIAPI
-ResetPlatformSpecificGuid (
- IN CONST GUID *ResetSubtype
- );
-
-/**
- This function examines the DataSize and ResetData parameters passed to
- to ResetSystem() and detemrines if the ResetData contains a Null-terminated
- Unicode string followed by a GUID specific subtype. If the GUID specific
- subtype is present, then a pointer to the GUID value in ResetData is returned.
-
- @param[in] DataSize The size, in bytes, of ResetData.
- @param[in] ResetData Pointer to the data buffer passed into ResetSystem().
-
- @retval Pointer Pointer to the GUID value in ResetData.
- @retval NULL ResetData is NULL.
- @retval NULL ResetData does not start with a Null-terminated
- Unicode string.
- @retval NULL A Null-terminated Unicode string is present, but there
- are less than sizeof (GUID) bytes after the string.
- @retval NULL No subtype is found.
-
-**/
-GUID *
-EFIAPI
-GetResetPlatformSpecificGuid (
- IN UINTN DataSize,
- IN CONST VOID *ResetData
- );
-
-/**
- This is a helper function that creates the reset data buffer that can be
- passed into ResetSystem().
-
- The reset data buffer is returned in ResetData and contains ResetString
- followed by the ResetSubtype GUID followed by the ExtraData.
-
- NOTE: Strings are internally limited by MAX_UINT16.
-
- @param[in, out] ResetDataSize On input, the size of the ResetData buffer. On
- output, either the total number of bytes
- copied, or the required buffer size.
- @param[in, out] ResetData A pointer to the buffer in which to place the
- final structure.
- @param[in] ResetSubtype Pointer to the GUID specific subtype. This
- parameter is optional and may be NULL.
- @param[in] ResetString Pointer to a Null-terminated Unicode string
- that describes the reset. This parameter is
- optional and may be NULL.
- @param[in] ExtraDataSize The size, in bytes, of ExtraData buffer.
- @param[in] ExtraData Pointer to a buffer of extra data. This
- parameter is optional and may be NULL.
-
- @retval RETURN_SUCCESS ResetDataSize and ResetData are updated.
- @retval RETURN_INVALID_PARAMETER ResetDataSize is NULL.
- @retval RETURN_INVALID_PARAMETER ResetData is NULL.
- @retval RETURN_INVALID_PARAMETER ExtraData was provided without a
- ResetSubtype. This is not supported by the
- UEFI spec.
- @retval RETURN_BUFFER_TOO_SMALL An insufficient buffer was provided.
- ResetDataSize is updated with minimum size
- required.
-**/
-RETURN_STATUS
-EFIAPI
-BuildResetData (
- IN OUT UINTN *ResetDataSize,
- IN OUT VOID *ResetData,
- IN CONST GUID *ResetSubtype OPTIONAL,
- IN CONST CHAR16 *ResetString OPTIONAL,
- IN UINTN ExtraDataSize OPTIONAL,
- IN CONST VOID *ExtraData OPTIONAL
- );
-
-#endif // _RESET_UTILITY_LIB_H_
+/** @file + This header describes various helper functions for resetting the system. + + Copyright (c) 2017 - 2019 Intel Corporation. All rights reserved.<BR> + Copyright (c) 2016 Microsoft Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _RESET_UTILITY_LIB_H_ +#define _RESET_UTILITY_LIB_H_ + +#include <Uefi/UefiMultiPhase.h> + +/** + This is a shorthand helper function to reset with reset type and a subtype + so that the caller doesn't have to bother with a function that has half + a dozen parameters. + + This will generate a reset with status EFI_SUCCESS, a NULL string, and + no custom data. The subtype will be formatted in such a way that it can be + picked up by notification registrations and custom handlers. + + NOTE: This call will fail if the architectural ResetSystem underpinnings + are not initialized. For DXE, you can add gEfiResetArchProtocolGuid + to your DEPEX. + + @param[in] ResetType The default EFI_RESET_TYPE of the reset. + @param[in] ResetSubtype GUID pointer for the reset subtype to be used. + +**/ +VOID +EFIAPI +ResetSystemWithSubtype ( + IN EFI_RESET_TYPE ResetType, + IN CONST GUID *ResetSubtype + ); + +/** + This is a shorthand helper function to reset with the reset type + 'EfiResetPlatformSpecific' and a subtype so that the caller doesn't + have to bother with a function that has half a dozen parameters. + + This will generate a reset with status EFI_SUCCESS, a NULL string, and + no custom data. The subtype will be formatted in such a way that it can be + picked up by notification registrations and custom handlers. + + NOTE: This call will fail if the architectural ResetSystem underpinnings + are not initialized. For DXE, you can add gEfiResetArchProtocolGuid + to your DEPEX. + + @param[in] ResetSubtype GUID pointer for the reset subtype to be used. + +**/ +VOID +EFIAPI +ResetPlatformSpecificGuid ( + IN CONST GUID *ResetSubtype + ); + +/** + This function examines the DataSize and ResetData parameters passed to + to ResetSystem() and detemrines if the ResetData contains a Null-terminated + Unicode string followed by a GUID specific subtype. If the GUID specific + subtype is present, then a pointer to the GUID value in ResetData is returned. + + @param[in] DataSize The size, in bytes, of ResetData. + @param[in] ResetData Pointer to the data buffer passed into ResetSystem(). + + @retval Pointer Pointer to the GUID value in ResetData. + @retval NULL ResetData is NULL. + @retval NULL ResetData does not start with a Null-terminated + Unicode string. + @retval NULL A Null-terminated Unicode string is present, but there + are less than sizeof (GUID) bytes after the string. + @retval NULL No subtype is found. + +**/ +GUID * +EFIAPI +GetResetPlatformSpecificGuid ( + IN UINTN DataSize, + IN CONST VOID *ResetData + ); + +/** + This is a helper function that creates the reset data buffer that can be + passed into ResetSystem(). + + The reset data buffer is returned in ResetData and contains ResetString + followed by the ResetSubtype GUID followed by the ExtraData. + + NOTE: Strings are internally limited by MAX_UINT16. + + @param[in, out] ResetDataSize On input, the size of the ResetData buffer. On + output, either the total number of bytes + copied, or the required buffer size. + @param[in, out] ResetData A pointer to the buffer in which to place the + final structure. + @param[in] ResetSubtype Pointer to the GUID specific subtype. This + parameter is optional and may be NULL. + @param[in] ResetString Pointer to a Null-terminated Unicode string + that describes the reset. This parameter is + optional and may be NULL. + @param[in] ExtraDataSize The size, in bytes, of ExtraData buffer. + @param[in] ExtraData Pointer to a buffer of extra data. This + parameter is optional and may be NULL. + + @retval RETURN_SUCCESS ResetDataSize and ResetData are updated. + @retval RETURN_INVALID_PARAMETER ResetDataSize is NULL. + @retval RETURN_INVALID_PARAMETER ResetData is NULL. + @retval RETURN_INVALID_PARAMETER ExtraData was provided without a + ResetSubtype. This is not supported by the + UEFI spec. + @retval RETURN_BUFFER_TOO_SMALL An insufficient buffer was provided. + ResetDataSize is updated with minimum size + required. +**/ +RETURN_STATUS +EFIAPI +BuildResetData ( + IN OUT UINTN *ResetDataSize, + IN OUT VOID *ResetData, + IN CONST GUID *ResetSubtype OPTIONAL, + IN CONST CHAR16 *ResetString OPTIONAL, + IN UINTN ExtraDataSize OPTIONAL, + IN CONST VOID *ExtraData OPTIONAL + ); + +#endif // _RESET_UTILITY_LIB_H_ diff --git a/MdeModulePkg/Include/Library/SecurityManagementLib.h b/MdeModulePkg/Include/Library/SecurityManagementLib.h index e10a4cdd02..a8dd707b98 100644 --- a/MdeModulePkg/Include/Library/SecurityManagementLib.h +++ b/MdeModulePkg/Include/Library/SecurityManagementLib.h @@ -1,270 +1,270 @@ -/** @file
- This library class defines a set of interfaces to abstract the policy of
- security measurement by managing the different security measurement services.
- The library instances can be implemented according to the different security policy.
-
-Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SECURITY_MANAGEMENT_LIB_H__
-#define __SECURITY_MANAGEMENT_LIB_H__
-
-//
-// Authentication Operation defintions for User Identity (UID), Measured and Secure boot.
-//
-#define EFI_AUTH_OPERATION_NONE 0x00
-#define EFI_AUTH_OPERATION_VERIFY_IMAGE 0x01
-#define EFI_AUTH_OPERATION_DEFER_IMAGE_LOAD 0x02
-#define EFI_AUTH_OPERATION_MEASURE_IMAGE 0x04
-#define EFI_AUTH_OPERATION_CONNECT_POLICY 0x08
-//
-// Authentication State Operation will check the authentication status of a file.
-//
-#define EFI_AUTH_OPERATION_AUTHENTICATION_STATE 0x10
-
-///
-/// Image buffer is required by the security handler.
-///
-#define EFI_AUTH_OPERATION_IMAGE_REQUIRED 0x80000000
-
-/**
- The security handler is used to abstract platform-specific policy
- from the DXE core response to an attempt to use a file that returns a
- given status for the authentication check from the section extraction protocol.
-
- The possible responses in a given SAP implementation may include locking
- flash upon failure to authenticate, attestation logging for all signed drivers,
- and other exception operations. The File parameter allows for possible logging
- within the SAP of the driver.
-
- If File is NULL, then EFI_INVALID_PARAMETER is returned.
-
- If the file specified by File with an authentication status specified by
- AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned.
-
- If the file specified by File with an authentication status specified by
- AuthenticationStatus is not safe for the DXE Core to use under any circumstances,
- then EFI_ACCESS_DENIED is returned.
-
- If the file specified by File with an authentication status specified by
- AuthenticationStatus is not safe for the DXE Core to use at the time, but it
- might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is
- returned.
-
- FileBuffer will be NULL and FileSize will be 0 if the handler being called
- did not set EFI_AUTH_OPERATION_IMAGE_REQUIRED when it was registered.
-
- @param[in] AuthenticationStatus
- The authentication status returned from the security
- measurement services for the input file.
- @param[in] File The pointer to the device path of the file that is
- being dispatched. This will optionally be used for logging.
- @param[in] FileBuffer The file buffer matches the input file device path.
- @param[in] FileSize The size of File buffer matches the input file device path.
-
- @retval EFI_SUCCESS The file specified by File did authenticate, and the
- platform policy dictates that the DXE Core may use File.
- @retval EFI_INVALID_PARAMETER The file is NULL.
- @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and
- the platform policy dictates that File should be placed
- in the untrusted state. A file may be promoted from
- the untrusted to the trusted state at a future time
- with a call to the Trust() DXE Service.
- @retval EFI_ACCESS_DENIED The file specified by File did not authenticate, and
- the platform policy dictates that File should not be
- used for any purpose.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *SECURITY_FILE_AUTHENTICATION_STATE_HANDLER)(
- IN OUT UINT32 AuthenticationStatus,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *File,
- IN VOID *FileBuffer,
- IN UINTN FileSize
- );
-
-/**
- Register security measurement handler with its operation type. Different
- handlers with the same operation can all be registered.
-
- If SecurityHandler is NULL, then ASSERT().
- If no enough resources available to register new handler, then ASSERT().
- If AuthenticationOperation is not recongnized, then ASSERT().
- If the previous register handler can't be executed before the later register handler, then ASSERT().
-
- @param[in] SecurityHandler The security measurement service handler to be registered.
- @param[in] AuthenticationOperation Theoperation type is specified for the registered handler.
-
- @retval EFI_SUCCESS The handlers were registered successfully.
-**/
-EFI_STATUS
-EFIAPI
-RegisterSecurityHandler (
- IN SECURITY_FILE_AUTHENTICATION_STATE_HANDLER SecurityHandler,
- IN UINT32 AuthenticationOperation
- );
-
-/**
- Execute registered handlers until one returns an error and that error is returned.
- If none of the handlers return an error, then EFI_SUCCESS is returned.
-
- Before exectue handler, get the image buffer by file device path if a handler
- requires the image file. And return the image buffer to each handler when exectue handler.
-
- The handlers are executed in same order to their registered order.
-
- @param[in] AuthenticationStatus
- This is the authentication type returned from the Section
- Extraction protocol. See the Section Extraction Protocol
- Specification for details on this type.
- @param[in] FilePath This is a pointer to the device path of the file that is
- being dispatched. This will optionally be used for logging.
-
- @retval EFI_SUCCESS The file specified by File authenticated when more
- than one security handler services were registered,
- or the file did not authenticate when no security
- handler service was registered. And the platform policy
- dictates that the DXE Core may use File.
- @retval EFI_INVALID_PARAMETER File is NULL.
- @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and
- the platform policy dictates that File should be placed
- in the untrusted state. A file may be promoted from
- the untrusted to the trusted state at a future time
- with a call to the Trust() DXE Service.
- @retval EFI_ACCESS_DENIED The file specified by File did not authenticate, and
- the platform policy dictates that File should not be
- used for any purpose.
-**/
-EFI_STATUS
-EFIAPI
-ExecuteSecurityHandlers (
- IN UINT32 AuthenticationStatus,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *FilePath
- );
-
-/**
- The security handler is used to abstracts security-specific functions from the DXE
- Foundation of UEFI Image Verification, Trusted Computing Group (TCG) measured boot,
- User Identity policy for image loading and consoles, and for purposes of
- handling GUIDed section encapsulations.
-
- @param[in] AuthenticationStatus
- The authentication status for the input file.
- @param[in] File The pointer to the device path of the file that is
- being dispatched. This will optionally be used for logging.
- @param[in] FileBuffer A pointer to the buffer with the UEFI file image
- @param[in] FileSize The size of File buffer.
- @param[in] BootPolicy A boot policy that was used to call LoadImage() UEFI service.
-
- @retval EFI_SUCCESS The file specified by DevicePath and non-NULL
- FileBuffer did authenticate, and the platform policy dictates
- that the DXE Foundation may use the file.
- @retval EFI_SUCCESS The device path specified by NULL device path DevicePath
- and non-NULL FileBuffer did authenticate, and the platform
- policy dictates that the DXE Foundation may execute the image in
- FileBuffer.
- @retval EFI_SUCCESS FileBuffer is NULL and current user has permission to start
- UEFI device drivers on the device path specified by DevicePath.
- @retval EFI_SECURITY_VIOLATION The file specified by DevicePath and FileBuffer did not
- authenticate, and the platform policy dictates that the file should be
- placed in the untrusted state. The image has been added to the file
- execution table.
- @retval EFI_ACCESS_DENIED The file specified by File and FileBuffer did not
- authenticate, and the platform policy dictates that the DXE
- Foundation may not use File.
- @retval EFI_SECURITY_VIOLATION FileBuffer is NULL and the user has no
- permission to start UEFI device drivers on the device path specified
- by DevicePath.
- @retval EFI_SECURITY_VIOLATION FileBuffer is not NULL and the user has no permission to load
- drivers from the device path specified by DevicePath. The
- image has been added into the list of the deferred images.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *SECURITY2_FILE_AUTHENTICATION_HANDLER)(
- IN UINT32 AuthenticationStatus,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *File,
- IN VOID *FileBuffer,
- IN UINTN FileSize,
- IN BOOLEAN BootPolicy
- );
-
-/**
- Register security measurement handler with its operation type. Different
- handlers with the same operation can all be registered.
-
- If SecurityHandler is NULL, then ASSERT().
- If no enough resources available to register new handler, then ASSERT().
- If AuthenticationOperation is not recongnized, then ASSERT().
- If AuthenticationOperation is EFI_AUTH_OPERATION_NONE, then ASSERT().
- If the previous register handler can't be executed before the later register handler, then ASSERT().
-
- @param[in] Security2Handler The security measurement service handler to be registered.
- @param[in] AuthenticationOperation The operation type is specified for the registered handler.
-
- @retval EFI_SUCCESS The handlers were registered successfully.
-**/
-EFI_STATUS
-EFIAPI
-RegisterSecurity2Handler (
- IN SECURITY2_FILE_AUTHENTICATION_HANDLER Security2Handler,
- IN UINT32 AuthenticationOperation
- );
-
-/**
- Execute registered handlers based on input AuthenticationOperation until
- one returns an error and that error is returned.
-
- If none of the handlers return an error, then EFI_SUCCESS is returned.
- The handlers those satisfy AuthenticationOperation will only be executed.
- The handlers are executed in same order to their registered order.
-
- @param[in] AuthenticationOperation
- The operation type specifies which handlers will be executed.
- @param[in] AuthenticationStatus
- The authentication status for the input file.
- @param[in] File This is a pointer to the device path of the file that is
- being dispatched. This will optionally be used for logging.
- @param[in] FileBuffer A pointer to the buffer with the UEFI file image
- @param[in] FileSize The size of File buffer.
- @param[in] BootPolicy A boot policy that was used to call LoadImage() UEFI service.
-
- @retval EFI_SUCCESS The file specified by DevicePath and non-NULL
- FileBuffer did authenticate, and the platform policy dictates
- that the DXE Foundation may use the file.
- @retval EFI_SUCCESS The device path specified by NULL device path DevicePath
- and non-NULL FileBuffer did authenticate, and the platform
- policy dictates that the DXE Foundation may execute the image in
- FileBuffer.
- @retval EFI_SUCCESS FileBuffer is NULL and current user has permission to start
- UEFI device drivers on the device path specified by DevicePath.
- @retval EFI_SECURITY_VIOLATION The file specified by DevicePath and FileBuffer did not
- authenticate, and the platform policy dictates that the file should be
- placed in the untrusted state. The image has been added to the file
- execution table.
- @retval EFI_ACCESS_DENIED The file specified by File and FileBuffer did not
- authenticate, and the platform policy dictates that the DXE
- Foundation may not use File.
- @retval EFI_SECURITY_VIOLATION FileBuffer is NULL and the user has no
- permission to start UEFI device drivers on the device path specified
- by DevicePath.
- @retval EFI_SECURITY_VIOLATION FileBuffer is not NULL and the user has no permission to load
- drivers from the device path specified by DevicePath. The
- image has been added into the list of the deferred images.
- @retval EFI_INVALID_PARAMETER File and FileBuffer are both NULL.
-**/
-EFI_STATUS
-EFIAPI
-ExecuteSecurity2Handlers (
- IN UINT32 AuthenticationOperation,
- IN UINT32 AuthenticationStatus,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *File OPTIONAL,
- IN VOID *FileBuffer,
- IN UINTN FileSize,
- IN BOOLEAN BootPolicy
- );
-
-#endif
+/** @file + This library class defines a set of interfaces to abstract the policy of + security measurement by managing the different security measurement services. + The library instances can be implemented according to the different security policy. + +Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SECURITY_MANAGEMENT_LIB_H__ +#define __SECURITY_MANAGEMENT_LIB_H__ + +// +// Authentication Operation defintions for User Identity (UID), Measured and Secure boot. +// +#define EFI_AUTH_OPERATION_NONE 0x00 +#define EFI_AUTH_OPERATION_VERIFY_IMAGE 0x01 +#define EFI_AUTH_OPERATION_DEFER_IMAGE_LOAD 0x02 +#define EFI_AUTH_OPERATION_MEASURE_IMAGE 0x04 +#define EFI_AUTH_OPERATION_CONNECT_POLICY 0x08 +// +// Authentication State Operation will check the authentication status of a file. +// +#define EFI_AUTH_OPERATION_AUTHENTICATION_STATE 0x10 + +/// +/// Image buffer is required by the security handler. +/// +#define EFI_AUTH_OPERATION_IMAGE_REQUIRED 0x80000000 + +/** + The security handler is used to abstract platform-specific policy + from the DXE core response to an attempt to use a file that returns a + given status for the authentication check from the section extraction protocol. + + The possible responses in a given SAP implementation may include locking + flash upon failure to authenticate, attestation logging for all signed drivers, + and other exception operations. The File parameter allows for possible logging + within the SAP of the driver. + + If File is NULL, then EFI_INVALID_PARAMETER is returned. + + If the file specified by File with an authentication status specified by + AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned. + + If the file specified by File with an authentication status specified by + AuthenticationStatus is not safe for the DXE Core to use under any circumstances, + then EFI_ACCESS_DENIED is returned. + + If the file specified by File with an authentication status specified by + AuthenticationStatus is not safe for the DXE Core to use at the time, but it + might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is + returned. + + FileBuffer will be NULL and FileSize will be 0 if the handler being called + did not set EFI_AUTH_OPERATION_IMAGE_REQUIRED when it was registered. + + @param[in] AuthenticationStatus + The authentication status returned from the security + measurement services for the input file. + @param[in] File The pointer to the device path of the file that is + being dispatched. This will optionally be used for logging. + @param[in] FileBuffer The file buffer matches the input file device path. + @param[in] FileSize The size of File buffer matches the input file device path. + + @retval EFI_SUCCESS The file specified by File did authenticate, and the + platform policy dictates that the DXE Core may use File. + @retval EFI_INVALID_PARAMETER The file is NULL. + @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and + the platform policy dictates that File should be placed + in the untrusted state. A file may be promoted from + the untrusted to the trusted state at a future time + with a call to the Trust() DXE Service. + @retval EFI_ACCESS_DENIED The file specified by File did not authenticate, and + the platform policy dictates that File should not be + used for any purpose. + +**/ +typedef +EFI_STATUS +(EFIAPI *SECURITY_FILE_AUTHENTICATION_STATE_HANDLER)( + IN OUT UINT32 AuthenticationStatus, + IN CONST EFI_DEVICE_PATH_PROTOCOL *File, + IN VOID *FileBuffer, + IN UINTN FileSize + ); + +/** + Register security measurement handler with its operation type. Different + handlers with the same operation can all be registered. + + If SecurityHandler is NULL, then ASSERT(). + If no enough resources available to register new handler, then ASSERT(). + If AuthenticationOperation is not recongnized, then ASSERT(). + If the previous register handler can't be executed before the later register handler, then ASSERT(). + + @param[in] SecurityHandler The security measurement service handler to be registered. + @param[in] AuthenticationOperation Theoperation type is specified for the registered handler. + + @retval EFI_SUCCESS The handlers were registered successfully. +**/ +EFI_STATUS +EFIAPI +RegisterSecurityHandler ( + IN SECURITY_FILE_AUTHENTICATION_STATE_HANDLER SecurityHandler, + IN UINT32 AuthenticationOperation + ); + +/** + Execute registered handlers until one returns an error and that error is returned. + If none of the handlers return an error, then EFI_SUCCESS is returned. + + Before exectue handler, get the image buffer by file device path if a handler + requires the image file. And return the image buffer to each handler when exectue handler. + + The handlers are executed in same order to their registered order. + + @param[in] AuthenticationStatus + This is the authentication type returned from the Section + Extraction protocol. See the Section Extraction Protocol + Specification for details on this type. + @param[in] FilePath This is a pointer to the device path of the file that is + being dispatched. This will optionally be used for logging. + + @retval EFI_SUCCESS The file specified by File authenticated when more + than one security handler services were registered, + or the file did not authenticate when no security + handler service was registered. And the platform policy + dictates that the DXE Core may use File. + @retval EFI_INVALID_PARAMETER File is NULL. + @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and + the platform policy dictates that File should be placed + in the untrusted state. A file may be promoted from + the untrusted to the trusted state at a future time + with a call to the Trust() DXE Service. + @retval EFI_ACCESS_DENIED The file specified by File did not authenticate, and + the platform policy dictates that File should not be + used for any purpose. +**/ +EFI_STATUS +EFIAPI +ExecuteSecurityHandlers ( + IN UINT32 AuthenticationStatus, + IN CONST EFI_DEVICE_PATH_PROTOCOL *FilePath + ); + +/** + The security handler is used to abstracts security-specific functions from the DXE + Foundation of UEFI Image Verification, Trusted Computing Group (TCG) measured boot, + User Identity policy for image loading and consoles, and for purposes of + handling GUIDed section encapsulations. + + @param[in] AuthenticationStatus + The authentication status for the input file. + @param[in] File The pointer to the device path of the file that is + being dispatched. This will optionally be used for logging. + @param[in] FileBuffer A pointer to the buffer with the UEFI file image + @param[in] FileSize The size of File buffer. + @param[in] BootPolicy A boot policy that was used to call LoadImage() UEFI service. + + @retval EFI_SUCCESS The file specified by DevicePath and non-NULL + FileBuffer did authenticate, and the platform policy dictates + that the DXE Foundation may use the file. + @retval EFI_SUCCESS The device path specified by NULL device path DevicePath + and non-NULL FileBuffer did authenticate, and the platform + policy dictates that the DXE Foundation may execute the image in + FileBuffer. + @retval EFI_SUCCESS FileBuffer is NULL and current user has permission to start + UEFI device drivers on the device path specified by DevicePath. + @retval EFI_SECURITY_VIOLATION The file specified by DevicePath and FileBuffer did not + authenticate, and the platform policy dictates that the file should be + placed in the untrusted state. The image has been added to the file + execution table. + @retval EFI_ACCESS_DENIED The file specified by File and FileBuffer did not + authenticate, and the platform policy dictates that the DXE + Foundation may not use File. + @retval EFI_SECURITY_VIOLATION FileBuffer is NULL and the user has no + permission to start UEFI device drivers on the device path specified + by DevicePath. + @retval EFI_SECURITY_VIOLATION FileBuffer is not NULL and the user has no permission to load + drivers from the device path specified by DevicePath. The + image has been added into the list of the deferred images. +**/ +typedef +EFI_STATUS +(EFIAPI *SECURITY2_FILE_AUTHENTICATION_HANDLER)( + IN UINT32 AuthenticationStatus, + IN CONST EFI_DEVICE_PATH_PROTOCOL *File, + IN VOID *FileBuffer, + IN UINTN FileSize, + IN BOOLEAN BootPolicy + ); + +/** + Register security measurement handler with its operation type. Different + handlers with the same operation can all be registered. + + If SecurityHandler is NULL, then ASSERT(). + If no enough resources available to register new handler, then ASSERT(). + If AuthenticationOperation is not recongnized, then ASSERT(). + If AuthenticationOperation is EFI_AUTH_OPERATION_NONE, then ASSERT(). + If the previous register handler can't be executed before the later register handler, then ASSERT(). + + @param[in] Security2Handler The security measurement service handler to be registered. + @param[in] AuthenticationOperation The operation type is specified for the registered handler. + + @retval EFI_SUCCESS The handlers were registered successfully. +**/ +EFI_STATUS +EFIAPI +RegisterSecurity2Handler ( + IN SECURITY2_FILE_AUTHENTICATION_HANDLER Security2Handler, + IN UINT32 AuthenticationOperation + ); + +/** + Execute registered handlers based on input AuthenticationOperation until + one returns an error and that error is returned. + + If none of the handlers return an error, then EFI_SUCCESS is returned. + The handlers those satisfy AuthenticationOperation will only be executed. + The handlers are executed in same order to their registered order. + + @param[in] AuthenticationOperation + The operation type specifies which handlers will be executed. + @param[in] AuthenticationStatus + The authentication status for the input file. + @param[in] File This is a pointer to the device path of the file that is + being dispatched. This will optionally be used for logging. + @param[in] FileBuffer A pointer to the buffer with the UEFI file image + @param[in] FileSize The size of File buffer. + @param[in] BootPolicy A boot policy that was used to call LoadImage() UEFI service. + + @retval EFI_SUCCESS The file specified by DevicePath and non-NULL + FileBuffer did authenticate, and the platform policy dictates + that the DXE Foundation may use the file. + @retval EFI_SUCCESS The device path specified by NULL device path DevicePath + and non-NULL FileBuffer did authenticate, and the platform + policy dictates that the DXE Foundation may execute the image in + FileBuffer. + @retval EFI_SUCCESS FileBuffer is NULL and current user has permission to start + UEFI device drivers on the device path specified by DevicePath. + @retval EFI_SECURITY_VIOLATION The file specified by DevicePath and FileBuffer did not + authenticate, and the platform policy dictates that the file should be + placed in the untrusted state. The image has been added to the file + execution table. + @retval EFI_ACCESS_DENIED The file specified by File and FileBuffer did not + authenticate, and the platform policy dictates that the DXE + Foundation may not use File. + @retval EFI_SECURITY_VIOLATION FileBuffer is NULL and the user has no + permission to start UEFI device drivers on the device path specified + by DevicePath. + @retval EFI_SECURITY_VIOLATION FileBuffer is not NULL and the user has no permission to load + drivers from the device path specified by DevicePath. The + image has been added into the list of the deferred images. + @retval EFI_INVALID_PARAMETER File and FileBuffer are both NULL. +**/ +EFI_STATUS +EFIAPI +ExecuteSecurity2Handlers ( + IN UINT32 AuthenticationOperation, + IN UINT32 AuthenticationStatus, + IN CONST EFI_DEVICE_PATH_PROTOCOL *File OPTIONAL, + IN VOID *FileBuffer, + IN UINTN FileSize, + IN BOOLEAN BootPolicy + ); + +#endif diff --git a/MdeModulePkg/Include/Library/SmmCorePlatformHookLib.h b/MdeModulePkg/Include/Library/SmmCorePlatformHookLib.h index 6a76c1de39..369e2d3f10 100644 --- a/MdeModulePkg/Include/Library/SmmCorePlatformHookLib.h +++ b/MdeModulePkg/Include/Library/SmmCorePlatformHookLib.h @@ -1,43 +1,43 @@ -/** @file
- Smm Core Platform Hook Library. This library class defines a set of platform
- hooks called by the SMM Core.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SMM_CORE_PLATFORM_HOOK_LIB__
-#define __SMM_CORE_PLATFORM_HOOK_LIB__
-
-/**
- Performs platform specific tasks before invoking registered SMI handlers.
-
- This function performs platform specific tasks before invoking registered SMI handlers.
-
- @retval EFI_SUCCESS The platform hook completes successfully.
- @retval Other values The paltform hook cannot complete due to some error.
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformHookBeforeSmmDispatch (
- VOID
- );
-
-/**
- Performs platform specific tasks after invoking registered SMI handlers.
-
- This function performs platform specific tasks after invoking registered SMI handlers.
-
- @retval EFI_SUCCESS The platform hook completes successfully.
- @retval Other values The paltform hook cannot complete due to some error.
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformHookAfterSmmDispatch (
- VOID
- );
-
-#endif
+/** @file + Smm Core Platform Hook Library. This library class defines a set of platform + hooks called by the SMM Core. + +Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SMM_CORE_PLATFORM_HOOK_LIB__ +#define __SMM_CORE_PLATFORM_HOOK_LIB__ + +/** + Performs platform specific tasks before invoking registered SMI handlers. + + This function performs platform specific tasks before invoking registered SMI handlers. + + @retval EFI_SUCCESS The platform hook completes successfully. + @retval Other values The paltform hook cannot complete due to some error. + +**/ +EFI_STATUS +EFIAPI +PlatformHookBeforeSmmDispatch ( + VOID + ); + +/** + Performs platform specific tasks after invoking registered SMI handlers. + + This function performs platform specific tasks after invoking registered SMI handlers. + + @retval EFI_SUCCESS The platform hook completes successfully. + @retval Other values The paltform hook cannot complete due to some error. + +**/ +EFI_STATUS +EFIAPI +PlatformHookAfterSmmDispatch ( + VOID + ); + +#endif diff --git a/MdeModulePkg/Include/Library/SortLib.h b/MdeModulePkg/Include/Library/SortLib.h index 8d5045fc7f..c5bb516b4e 100644 --- a/MdeModulePkg/Include/Library/SortLib.h +++ b/MdeModulePkg/Include/Library/SortLib.h @@ -1,107 +1,107 @@ -/** @file
- Library used for sorting and comparison routines.
-
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __SORT_LIB_H__
-#define __SORT_LIB_H__
-
-/**
- Prototype for comparison function for any two element types.
-
- @param[in] Buffer1 The pointer to first buffer.
- @param[in] Buffer2 The pointer to second buffer.
-
- @retval 0 Buffer1 equal to Buffer2.
- @return <0 Buffer1 is less than Buffer2.
- @return >0 Buffer1 is greater than Buffer2.
-**/
-typedef
-INTN
-(EFIAPI *SORT_COMPARE)(
- IN CONST VOID *Buffer1,
- IN CONST VOID *Buffer2
- );
-
-/**
- Function to perform a Quick Sort on a buffer of comparable elements.
-
- Each element must be equally sized.
-
- If BufferToSort is NULL, then ASSERT.
- If CompareFunction is NULL, then ASSERT.
-
- If Count is < 2 , then perform no action.
- If Size is < 1 , then perform no action.
-
- @param[in, out] BufferToSort On call, a Buffer of (possibly sorted) elements;
- on return, a buffer of sorted elements.
- @param[in] Count The number of elements in the buffer to sort.
- @param[in] ElementSize The size of an element in bytes.
- @param[in] CompareFunction The function to call to perform the comparison
- of any two elements.
-**/
-VOID
-EFIAPI
-PerformQuickSort (
- IN OUT VOID *BufferToSort,
- IN CONST UINTN Count,
- IN CONST UINTN ElementSize,
- IN SORT_COMPARE CompareFunction
- );
-
-/**
- Function to compare 2 device paths for use as CompareFunction.
-
- @param[in] Buffer1 The pointer to Device Path to compare.
- @param[in] Buffer2 The pointer to second DevicePath to compare.
-
- @retval 0 Buffer1 equal to Buffer2.
- @return < 0 Buffer1 is less than Buffer2.
- @return > 0 Buffer1 is greater than Buffer2.
-**/
-INTN
-EFIAPI
-DevicePathCompare (
- IN CONST VOID *Buffer1,
- IN CONST VOID *Buffer2
- );
-
-/**
- Function to compare 2 strings without regard to case of the characters.
-
- @param[in] Buffer1 The pointer to String to compare (CHAR16**).
- @param[in] Buffer2 The pointer to second String to compare (CHAR16**).
-
- @retval 0 Buffer1 equal to Buffer2.
- @return < 0 Buffer1 is less than Buffer2.
- @return > 0 Buffer1 is greater than Buffer2.
-**/
-INTN
-EFIAPI
-StringNoCaseCompare (
- IN CONST VOID *Buffer1,
- IN CONST VOID *Buffer2
- );
-
-/**
- Function to compare 2 strings.
-
- @param[in] Buffer1 The pointer to String to compare (CHAR16**).
- @param[in] Buffer2 The pointer to second String to compare (CHAR16**).
-
- @retval 0 Buffer1 equal to Buffer2.
- @return < 0 Buffer1 is less than Buffer2.
- @return > 0 Buffer1 is greater than Buffer2.
-**/
-INTN
-EFIAPI
-StringCompare (
- IN CONST VOID *Buffer1,
- IN CONST VOID *Buffer2
- );
-
-#endif //__SORT_LIB_H__
+/** @file + Library used for sorting and comparison routines. + + Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR> + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __SORT_LIB_H__ +#define __SORT_LIB_H__ + +/** + Prototype for comparison function for any two element types. + + @param[in] Buffer1 The pointer to first buffer. + @param[in] Buffer2 The pointer to second buffer. + + @retval 0 Buffer1 equal to Buffer2. + @return <0 Buffer1 is less than Buffer2. + @return >0 Buffer1 is greater than Buffer2. +**/ +typedef +INTN +(EFIAPI *SORT_COMPARE)( + IN CONST VOID *Buffer1, + IN CONST VOID *Buffer2 + ); + +/** + Function to perform a Quick Sort on a buffer of comparable elements. + + Each element must be equally sized. + + If BufferToSort is NULL, then ASSERT. + If CompareFunction is NULL, then ASSERT. + + If Count is < 2 , then perform no action. + If Size is < 1 , then perform no action. + + @param[in, out] BufferToSort On call, a Buffer of (possibly sorted) elements; + on return, a buffer of sorted elements. + @param[in] Count The number of elements in the buffer to sort. + @param[in] ElementSize The size of an element in bytes. + @param[in] CompareFunction The function to call to perform the comparison + of any two elements. +**/ +VOID +EFIAPI +PerformQuickSort ( + IN OUT VOID *BufferToSort, + IN CONST UINTN Count, + IN CONST UINTN ElementSize, + IN SORT_COMPARE CompareFunction + ); + +/** + Function to compare 2 device paths for use as CompareFunction. + + @param[in] Buffer1 The pointer to Device Path to compare. + @param[in] Buffer2 The pointer to second DevicePath to compare. + + @retval 0 Buffer1 equal to Buffer2. + @return < 0 Buffer1 is less than Buffer2. + @return > 0 Buffer1 is greater than Buffer2. +**/ +INTN +EFIAPI +DevicePathCompare ( + IN CONST VOID *Buffer1, + IN CONST VOID *Buffer2 + ); + +/** + Function to compare 2 strings without regard to case of the characters. + + @param[in] Buffer1 The pointer to String to compare (CHAR16**). + @param[in] Buffer2 The pointer to second String to compare (CHAR16**). + + @retval 0 Buffer1 equal to Buffer2. + @return < 0 Buffer1 is less than Buffer2. + @return > 0 Buffer1 is greater than Buffer2. +**/ +INTN +EFIAPI +StringNoCaseCompare ( + IN CONST VOID *Buffer1, + IN CONST VOID *Buffer2 + ); + +/** + Function to compare 2 strings. + + @param[in] Buffer1 The pointer to String to compare (CHAR16**). + @param[in] Buffer2 The pointer to second String to compare (CHAR16**). + + @retval 0 Buffer1 equal to Buffer2. + @return < 0 Buffer1 is less than Buffer2. + @return > 0 Buffer1 is greater than Buffer2. +**/ +INTN +EFIAPI +StringCompare ( + IN CONST VOID *Buffer1, + IN CONST VOID *Buffer2 + ); + +#endif //__SORT_LIB_H__ diff --git a/MdeModulePkg/Include/Library/SpiHcPlatformLib.h b/MdeModulePkg/Include/Library/SpiHcPlatformLib.h index c68f745537..33c9f26d40 100644 --- a/MdeModulePkg/Include/Library/SpiHcPlatformLib.h +++ b/MdeModulePkg/Include/Library/SpiHcPlatformLib.h @@ -1,148 +1,148 @@ -/** @file
-
- Function declarations for SpiHcPlatformLib
-
- Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#ifndef PLATFORM_SPI_HC_H_
-#define PLATFORM_SPI_HC_H_
-
-#include <Uefi/UefiBaseType.h>
-#include <Protocol/SpiHc.h>
-#include <Protocol/SpiConfiguration.h>
-#include <Protocol/DevicePath.h>
-#include <Library/DevicePathLib.h>
-
-/**
- This function reports the details of the SPI Host Controller to the SpiHc driver.
-
- @param[out] Attributes The suported attributes of the SPI host controller
- @param[out] FrameSizeSupportMask The suported FrameSizeSupportMask of the SPI host controller
- @param[out] MaximumTransferBytes The suported MaximumTransferBytes of the SPI host controller
-
- @retval EFI_SUCCESS SPI_HOST_CONTROLLER_INSTANCE was allocated properly
- @retval EFI_OUT_OF_RESOURCES The SPI_HOST_CONTROLLER_INSTANCE could not be allocated
-*/
-EFI_STATUS
-EFIAPI
-GetPlatformSpiHcDetails (
- OUT UINT32 *Attributes,
- OUT UINT32 *FrameSizeSupportMask,
- OUT UINT32 *MaximumTransferBytes
- );
-
-/**
- This function reports the device path of SPI host controller. This is needed in order for the SpiBus
- to match the correct SPI_BUS to the SPI host controller
-
- @param[out] DevicePath The device path for this SPI HC is returned in this variable
-
- @retval EFI_SUCCESS
-*/
-EFI_STATUS
-EFIAPI
-GetSpiHcDevicePath (
- OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
- );
-
-/**
- This is the platform specific Spi Chip select function.
- Assert or deassert the SPI chip select.
-
- This routine is called at TPL_NOTIFY.
- Update the value of the chip select line for a SPI peripheral. The SPI bus
- layer calls this routine either in the board layer or in the SPI controller
- to manipulate the chip select pin at the start and end of a SPI transaction.
-
- @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure.
- @param[in] SpiPeripheral The address of an EFI_SPI_PERIPHERAL data structure
- describing the SPI peripheral whose chip select pin
- is to be manipulated. The routine may access the
- ChipSelectParameter field to gain sufficient
- context to complete the operati on.
- @param[in] PinValue The value to be applied to the chip select line of
- the SPI peripheral.
-
- @retval EFI_SUCCESS The chip select was set as requested
- @retval EFI_NOT_READY Support for the chip select is not properly
- initialized
- @retval EFI_INVALID_PARAMETER The ChipSeLect value or its contents are
- invalid
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformSpiHcChipSelect (
- IN CONST EFI_SPI_HC_PROTOCOL *This,
- IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral,
- IN BOOLEAN PinValue
- );
-
-/**
- This function is the platform specific SPI clock function.
- Set up the clock generator to produce the correct clock frequency, phase and
- polarity for a SPI chip.
-
- This routine is called at TPL_NOTIFY.
- This routine updates the clock generator to generate the correct frequency
- and polarity for the SPI clock.
-
- @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure.
- @param[in] SpiPeripheral Pointer to a EFI_SPI_PERIPHERAL data structure from
- which the routine can access the ClockParameter,
- ClockPhase and ClockPolarity fields. The routine
- also has access to the names for the SPI bus and
- chip which can be used during debugging.
- @param[in] ClockHz Pointer to the requested clock frequency. The SPI
- host controller will choose a supported clock
- frequency which is less then or equal to this
- value. Specify zero to turn the clock generator
- off. The actual clock frequency supported by the
- SPI host controller will be returned.
-
- @retval EFI_SUCCESS The clock was set up successfully
- @retval EFI_UNSUPPORTED The SPI controller was not able to support the
- frequency requested by ClockHz
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformSpiHcClock (
- IN CONST EFI_SPI_HC_PROTOCOL *This,
- IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral,
- IN UINT32 *ClockHz
- );
-
-/**
- This function is the platform specific SPI transaction function
- Perform the SPI transaction on the SPI peripheral using the SPI host
- controller.
-
- This routine is called at TPL_NOTIFY.
- This routine synchronously returns EFI_SUCCESS indicating that the
- asynchronous SPI transaction was started. The routine then waits for
- completion of the SPI transaction prior to returning the final transaction
- status.
-
- @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure.
- @param[in] BusTransaction Pointer to a EFI_SPI_BUS_ TRANSACTION containing
- the description of the SPI transaction to perform.
-
- @retval EFI_SUCCESS The transaction completed successfully
- @retval EFI_BAD_BUFFER_SIZE The BusTransaction->WriteBytes value is invalid,
- or the BusTransaction->ReadinBytes value is
- invalid
- @retval EFI_UNSUPPORTED The BusTransaction-> Transaction Type is
- unsupported
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformSpiHcTransaction (
- IN CONST EFI_SPI_HC_PROTOCOL *This,
- IN EFI_SPI_BUS_TRANSACTION *BusTransaction
- );
-
-#endif // PLATFORM_SPI_HC_SMM_PROTOCOL_H_
+/** @file + + Function declarations for SpiHcPlatformLib + + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR> + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef PLATFORM_SPI_HC_H_ +#define PLATFORM_SPI_HC_H_ + +#include <Uefi/UefiBaseType.h> +#include <Protocol/SpiHc.h> +#include <Protocol/SpiConfiguration.h> +#include <Protocol/DevicePath.h> +#include <Library/DevicePathLib.h> + +/** + This function reports the details of the SPI Host Controller to the SpiHc driver. + + @param[out] Attributes The suported attributes of the SPI host controller + @param[out] FrameSizeSupportMask The suported FrameSizeSupportMask of the SPI host controller + @param[out] MaximumTransferBytes The suported MaximumTransferBytes of the SPI host controller + + @retval EFI_SUCCESS SPI_HOST_CONTROLLER_INSTANCE was allocated properly + @retval EFI_OUT_OF_RESOURCES The SPI_HOST_CONTROLLER_INSTANCE could not be allocated +*/ +EFI_STATUS +EFIAPI +GetPlatformSpiHcDetails ( + OUT UINT32 *Attributes, + OUT UINT32 *FrameSizeSupportMask, + OUT UINT32 *MaximumTransferBytes + ); + +/** + This function reports the device path of SPI host controller. This is needed in order for the SpiBus + to match the correct SPI_BUS to the SPI host controller + + @param[out] DevicePath The device path for this SPI HC is returned in this variable + + @retval EFI_SUCCESS +*/ +EFI_STATUS +EFIAPI +GetSpiHcDevicePath ( + OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath + ); + +/** + This is the platform specific Spi Chip select function. + Assert or deassert the SPI chip select. + + This routine is called at TPL_NOTIFY. + Update the value of the chip select line for a SPI peripheral. The SPI bus + layer calls this routine either in the board layer or in the SPI controller + to manipulate the chip select pin at the start and end of a SPI transaction. + + @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure. + @param[in] SpiPeripheral The address of an EFI_SPI_PERIPHERAL data structure + describing the SPI peripheral whose chip select pin + is to be manipulated. The routine may access the + ChipSelectParameter field to gain sufficient + context to complete the operati on. + @param[in] PinValue The value to be applied to the chip select line of + the SPI peripheral. + + @retval EFI_SUCCESS The chip select was set as requested + @retval EFI_NOT_READY Support for the chip select is not properly + initialized + @retval EFI_INVALID_PARAMETER The ChipSeLect value or its contents are + invalid + +**/ +EFI_STATUS +EFIAPI +PlatformSpiHcChipSelect ( + IN CONST EFI_SPI_HC_PROTOCOL *This, + IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, + IN BOOLEAN PinValue + ); + +/** + This function is the platform specific SPI clock function. + Set up the clock generator to produce the correct clock frequency, phase and + polarity for a SPI chip. + + This routine is called at TPL_NOTIFY. + This routine updates the clock generator to generate the correct frequency + and polarity for the SPI clock. + + @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure. + @param[in] SpiPeripheral Pointer to a EFI_SPI_PERIPHERAL data structure from + which the routine can access the ClockParameter, + ClockPhase and ClockPolarity fields. The routine + also has access to the names for the SPI bus and + chip which can be used during debugging. + @param[in] ClockHz Pointer to the requested clock frequency. The SPI + host controller will choose a supported clock + frequency which is less then or equal to this + value. Specify zero to turn the clock generator + off. The actual clock frequency supported by the + SPI host controller will be returned. + + @retval EFI_SUCCESS The clock was set up successfully + @retval EFI_UNSUPPORTED The SPI controller was not able to support the + frequency requested by ClockHz + +**/ +EFI_STATUS +EFIAPI +PlatformSpiHcClock ( + IN CONST EFI_SPI_HC_PROTOCOL *This, + IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, + IN UINT32 *ClockHz + ); + +/** + This function is the platform specific SPI transaction function + Perform the SPI transaction on the SPI peripheral using the SPI host + controller. + + This routine is called at TPL_NOTIFY. + This routine synchronously returns EFI_SUCCESS indicating that the + asynchronous SPI transaction was started. The routine then waits for + completion of the SPI transaction prior to returning the final transaction + status. + + @param[in] This Pointer to an EFI_SPI_HC_PROTOCOL structure. + @param[in] BusTransaction Pointer to a EFI_SPI_BUS_ TRANSACTION containing + the description of the SPI transaction to perform. + + @retval EFI_SUCCESS The transaction completed successfully + @retval EFI_BAD_BUFFER_SIZE The BusTransaction->WriteBytes value is invalid, + or the BusTransaction->ReadinBytes value is + invalid + @retval EFI_UNSUPPORTED The BusTransaction-> Transaction Type is + unsupported + +**/ +EFI_STATUS +EFIAPI +PlatformSpiHcTransaction ( + IN CONST EFI_SPI_HC_PROTOCOL *This, + IN EFI_SPI_BUS_TRANSACTION *BusTransaction + ); + +#endif // PLATFORM_SPI_HC_SMM_PROTOCOL_H_ diff --git a/MdeModulePkg/Include/Library/TpmMeasurementLib.h b/MdeModulePkg/Include/Library/TpmMeasurementLib.h index a38072b5bd..eda86d01a2 100644 --- a/MdeModulePkg/Include/Library/TpmMeasurementLib.h +++ b/MdeModulePkg/Include/Library/TpmMeasurementLib.h @@ -1,38 +1,38 @@ -/** @file
- This library is used by other modules to measure data to TPM.
-
-Copyright (c) 2012, Intel Corporation. All rights reserved. <BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _TPM_MEASUREMENT_LIB_H_
-#define _TPM_MEASUREMENT_LIB_H_
-
-/**
- Tpm measure and log data, and extend the measurement result into a specific PCR.
-
- @param[in] PcrIndex PCR Index.
- @param[in] EventType Event type.
- @param[in] EventLog Measurement event log.
- @param[in] LogLen Event log length in bytes.
- @param[in] HashData The start of the data buffer to be hashed, extended.
- @param[in] HashDataLen The length, in bytes, of the buffer referenced by HashData
-
- @retval EFI_SUCCESS Operation completed successfully.
- @retval EFI_UNSUPPORTED TPM device not available.
- @retval EFI_OUT_OF_RESOURCES Out of memory.
- @retval EFI_DEVICE_ERROR The operation was unsuccessful.
-**/
-EFI_STATUS
-EFIAPI
-TpmMeasureAndLogData (
- IN UINT32 PcrIndex,
- IN UINT32 EventType,
- IN VOID *EventLog,
- IN UINT32 LogLen,
- IN VOID *HashData,
- IN UINT64 HashDataLen
- );
-
-#endif
+/** @file + This library is used by other modules to measure data to TPM. + +Copyright (c) 2012, Intel Corporation. All rights reserved. <BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _TPM_MEASUREMENT_LIB_H_ +#define _TPM_MEASUREMENT_LIB_H_ + +/** + Tpm measure and log data, and extend the measurement result into a specific PCR. + + @param[in] PcrIndex PCR Index. + @param[in] EventType Event type. + @param[in] EventLog Measurement event log. + @param[in] LogLen Event log length in bytes. + @param[in] HashData The start of the data buffer to be hashed, extended. + @param[in] HashDataLen The length, in bytes, of the buffer referenced by HashData + + @retval EFI_SUCCESS Operation completed successfully. + @retval EFI_UNSUPPORTED TPM device not available. + @retval EFI_OUT_OF_RESOURCES Out of memory. + @retval EFI_DEVICE_ERROR The operation was unsuccessful. +**/ +EFI_STATUS +EFIAPI +TpmMeasureAndLogData ( + IN UINT32 PcrIndex, + IN UINT32 EventType, + IN VOID *EventLog, + IN UINT32 LogLen, + IN VOID *HashData, + IN UINT64 HashDataLen + ); + +#endif diff --git a/MdeModulePkg/Include/Library/UefiBootManagerLib.h b/MdeModulePkg/Include/Library/UefiBootManagerLib.h index 34e217707e..61b9a83abe 100644 --- a/MdeModulePkg/Include/Library/UefiBootManagerLib.h +++ b/MdeModulePkg/Include/Library/UefiBootManagerLib.h @@ -1,816 +1,816 @@ -/** @file
- Provide Boot Manager related library APIs.
-
-Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>
-(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _UEFI_BOOT_MANAGER_LIB_H_
-#define _UEFI_BOOT_MANAGER_LIB_H_
-
-#include <Protocol/DriverHealth.h>
-#include <Library/SortLib.h>
-
-//
-// Boot Manager load option library functions.
-//
-
-//
-// Load Option Type
-//
-typedef enum {
- LoadOptionTypeDriver,
- LoadOptionTypeSysPrep,
- LoadOptionTypeBoot,
- LoadOptionTypePlatformRecovery,
- LoadOptionTypeMax
-} EFI_BOOT_MANAGER_LOAD_OPTION_TYPE;
-
-typedef enum {
- LoadOptionNumberMax = 0x10000,
- LoadOptionNumberUnassigned = LoadOptionNumberMax
-} EFI_BOOT_MANAGER_LOAD_OPTION_NUMBER;
-
-//
-// Common structure definition for DriverOption and BootOption
-//
-typedef struct {
- //
- // Data read from UEFI NV variables
- //
- UINTN OptionNumber; // #### numerical value, could be LoadOptionNumberUnassigned
- EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType; // LoadOptionTypeBoot or LoadOptionTypeDriver
- UINT32 Attributes; // Load Option Attributes
- CHAR16 *Description; // Load Option Description
- EFI_DEVICE_PATH_PROTOCOL *FilePath; // Load Option Device Path
- UINT8 *OptionalData; // Load Option optional data to pass into image
- UINT32 OptionalDataSize; // Load Option size of OptionalData
- EFI_GUID VendorGuid;
-
- //
- // Used at runtime
- //
- EFI_STATUS Status; // Status returned from boot attempt gBS->StartImage ()
- CHAR16 *ExitData; // Exit data returned from gBS->StartImage ()
- UINTN ExitDataSize; // Size of ExitData
-} EFI_BOOT_MANAGER_LOAD_OPTION;
-
-/**
- Returns an array of load options based on the EFI variable
- L"BootOrder"/L"DriverOrder" and the L"Boot####"/L"Driver####" variables impled by it.
- #### is the hex value of the UINT16 in each BootOrder/DriverOrder entry.
-
- @param LoadOptionCount Returns number of entries in the array.
- @param LoadOptionType The type of the load option.
-
- @retval NULL No load options exist.
- @retval !NULL Array of load option entries.
-
-**/
-EFI_BOOT_MANAGER_LOAD_OPTION *
-EFIAPI
-EfiBootManagerGetLoadOptions (
- OUT UINTN *LoadOptionCount,
- IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType
- );
-
-/**
- Free an array of load options returned from EfiBootManagerGetLoadOptions().
-
- @param LoadOptions Pointer to the array of load options to free.
- @param LoadOptionCount Number of array entries in LoadOptions.
-
- @return EFI_SUCCESS LoadOptions was freed.
- @return EFI_INVALID_PARAMETER LoadOptions is NULL.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerFreeLoadOptions (
- IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOptions,
- IN UINTN LoadOptionCount
- );
-
-/**
- Initialize a load option.
-
- @param Option Pointer to the load option to be initialized.
- @param OptionNumber Option number of the load option.
- @param OptionType Type of the load option.
- @param Attributes Attributes of the load option.
- @param Description Description of the load option.
- @param FilePath Device path of the load option.
- @param OptionalData Optional data of the load option.
- @param OptionalDataSize Size of the optional data of the load option.
-
- @retval EFI_SUCCESS The load option was initialized successfully.
- @retval EFI_INVALID_PARAMETER Option, Description or FilePath is NULL.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerInitializeLoadOption (
- IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option,
- IN UINTN OptionNumber,
- IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType,
- IN UINT32 Attributes,
- IN CHAR16 *Description,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN UINT8 *OptionalData,
- IN UINT32 OptionalDataSize
- );
-
-/**
- Free a load option created by EfiBootManagerInitializeLoadOption()
- or EfiBootManagerVariableToLoadOption().
-
- @param LoadOption Pointer to the load option to free.
- CONCERN: Check Boot#### instead of BootOrder, optimize, spec clarify
- @return EFI_SUCCESS LoadOption was freed.
- @return EFI_INVALID_PARAMETER LoadOption is NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerFreeLoadOption (
- IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption
- );
-
-/**
- Initialize the load option from the VariableName.
-
- @param VariableName EFI Variable name which could be Boot#### or
- Driver####
- @param LoadOption Pointer to the load option to be initialized
-
- @retval EFI_SUCCESS The option was created
- @retval EFI_INVALID_PARAMETER VariableName or LoadOption is NULL.
- @retval EFI_NOT_FOUND The variable specified by VariableName cannot be found.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerVariableToLoadOption (
- IN CHAR16 *VariableName,
- IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption
- );
-
-/**
- Create the Boot#### or Driver#### variable from the load option.
-
- @param LoadOption Pointer to the load option.
-
- @retval EFI_SUCCESS The variable was created.
- @retval Others Error status returned by RT->SetVariable.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerLoadOptionToVariable (
- IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption
- );
-
-/**
- This function will register the new Boot####, Driver#### or SysPrep#### option.
- After the *#### is updated, the *Order will also be updated.
-
- @param Option Pointer to load option to add. If on input
- Option->OptionNumber is LoadOptionNumberUnassigned,
- then on output Option->OptionNumber is updated to
- the number of the new Boot####,
- Driver#### or SysPrep#### option.
- @param Position Position of the new load option to put in the ****Order variable.
-
- @retval EFI_SUCCESS The *#### have been successfully registered.
- @retval EFI_INVALID_PARAMETER The option number exceeds 0xFFFF.
- @retval EFI_ALREADY_STARTED The option number of Option is being used already.
- Note: this API only adds new load option, no replacement support.
- @retval EFI_OUT_OF_RESOURCES There is no free option number that can be used when the
- option number specified in the Option is LoadOptionNumberUnassigned.
- @return Status codes of gRT->SetVariable ().
-
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerAddLoadOptionVariable (
- IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option,
- IN UINTN Position
- );
-
-/**
- Delete the load option according to the OptionNumber and OptionType.
-
- Only the BootOrder/DriverOrder is updated to remove the reference of the OptionNumber.
-
- @param OptionNumber Option number of the load option.
- @param OptionType Type of the load option.
-
- @retval EFI_NOT_FOUND The load option cannot be found.
- @retval EFI_SUCCESS The load option was deleted.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerDeleteLoadOptionVariable (
- IN UINTN OptionNumber,
- IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType
- );
-
-/**
- Sort the load options. The DriverOrder/BootOrder variables will be re-created to
- reflect the new order.
-
- @param OptionType The type of the load option.
- @param CompareFunction The comparator function pointer.
-**/
-VOID
-EFIAPI
-EfiBootManagerSortLoadOptionVariable (
- IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType,
- IN SORT_COMPARE CompareFunction
- );
-
-/**
- Return the index of the load option in the load option array.
-
- The function consider two load options are equal when the
- OptionType, Attributes, Description, FilePath and OptionalData are equal.
-
- @param Key Pointer to the load option to be found.
- @param Array Pointer to the array of load options to be found.
- @param Count Number of entries in the Array.
-
- @retval -1 Key wasn't found in the Array.
- @retval 0 ~ Count-1 The index of the Key in the Array.
-**/
-INTN
-EFIAPI
-EfiBootManagerFindLoadOption (
- IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key,
- IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array,
- IN UINTN Count
- );
-
-//
-// Boot Manager hot key library functions.
-//
-
-#pragma pack(1)
-///
-/// EFI Key Option.
-///
-typedef struct {
- ///
- /// Specifies options about how the key will be processed.
- ///
- EFI_BOOT_KEY_DATA KeyData;
- ///
- /// The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to
- /// which BootOption refers. If the CRC-32s do not match this value, then this key
- /// option is ignored.
- ///
- UINT32 BootOptionCrc;
- ///
- /// The Boot#### option which will be invoked if this key is pressed and the boot option
- /// is active (LOAD_OPTION_ACTIVE is set).
- ///
- UINT16 BootOption;
- ///
- /// The key codes to compare against those returned by the
- /// EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols.
- /// The number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT field in KeyOptions.
- ///
- EFI_INPUT_KEY Keys[3];
- UINT16 OptionNumber;
-} EFI_BOOT_MANAGER_KEY_OPTION;
-#pragma pack()
-
-/**
- Start the hot key service so that the key press can trigger the boot option.
-
- @param HotkeyTriggered Return the waitable event and it will be signaled
- when a valid hot key is pressed.
-
- @retval EFI_SUCCESS The hot key service is started.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerStartHotkeyService (
- IN EFI_EVENT *HotkeyTriggered
- );
-
-//
-// Modifier for EfiBootManagerAddKeyOptionVariable and EfiBootManagerDeleteKeyOptionVariable
-//
-#define EFI_BOOT_MANAGER_SHIFT_PRESSED 0x00000001
-#define EFI_BOOT_MANAGER_CONTROL_PRESSED 0x00000002
-#define EFI_BOOT_MANAGER_ALT_PRESSED 0x00000004
-#define EFI_BOOT_MANAGER_LOGO_PRESSED 0x00000008
-#define EFI_BOOT_MANAGER_MENU_KEY_PRESSED 0x00000010
-#define EFI_BOOT_MANAGER_SYS_REQ_PRESSED 0x00000020
-
-/**
- Add the key option.
- It adds the key option variable and the key option takes affect immediately.
-
- @param AddedOption Return the added key option.
- @param BootOptionNumber The boot option number for the key option.
- @param Modifier Key shift state.
- @param ... Parameter list of pointer of EFI_INPUT_KEY.
-
- @retval EFI_SUCCESS The key option is added.
- @retval EFI_ALREADY_STARTED The hot key is already used by certain key option.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerAddKeyOptionVariable (
- OUT EFI_BOOT_MANAGER_KEY_OPTION *AddedOption OPTIONAL,
- IN UINT16 BootOptionNumber,
- IN UINT32 Modifier,
- ...
- );
-
-/**
- Delete the Key Option variable and unregister the hot key
-
- @param DeletedOption Return the deleted key options.
- @param Modifier Key shift state.
- @param ... Parameter list of pointer of EFI_INPUT_KEY.
-
- @retval EFI_SUCCESS The key option is deleted.
- @retval EFI_NOT_FOUND The key option cannot be found.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerDeleteKeyOptionVariable (
- IN EFI_BOOT_MANAGER_KEY_OPTION *DeletedOption OPTIONAL,
- IN UINT32 Modifier,
- ...
- );
-
-/**
- Register the key option to exit the waiting of the Boot Manager timeout.
- Platform should ensure that the continue key option isn't conflict with
- other boot key options.
-
- @param Modifier Key shift state.
- @param ... Parameter list of pointer of EFI_INPUT_KEY.
-
- @retval EFI_SUCCESS Successfully register the continue key option.
- @retval EFI_ALREADY_STARTED The continue key option is already registered.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerRegisterContinueKeyOption (
- IN UINT32 Modifier,
- ...
- );
-
-/**
- Try to boot the boot option triggered by hot key.
-**/
-VOID
-EFIAPI
-EfiBootManagerHotkeyBoot (
- VOID
- );
-
-//
-// Boot Manager boot library functions.
-//
-
-/**
- The function creates boot options for all possible bootable medias in the following order:
- 1. Removable BlockIo - The boot option only points to the removable media
- device, like USB key, DVD, Floppy etc.
- 2. Fixed BlockIo - The boot option only points to a Fixed blockIo device,
- like HardDisk.
- 3. Non-BlockIo SimpleFileSystem - The boot option points to a device supporting
- SimpleFileSystem Protocol, but not supporting BlockIo
- protocol.
- 4. LoadFile - The boot option points to the media supporting
- LoadFile protocol.
- Reference: UEFI Spec chapter 3.3 Boot Option Variables Default Boot Behavior
-
- The function won't delete the boot option not added by itself.
-**/
-VOID
-EFIAPI
-EfiBootManagerRefreshAllBootOption (
- VOID
- );
-
-/**
- Attempt to boot the EFI boot option. This routine sets L"BootCurent" and
- signals the EFI ready to boot event. If the device path for the option starts
- with a BBS device path a legacy boot is attempted. Short form device paths are
- also supported via this rountine. A device path starting with
- MEDIA_HARDDRIVE_DP, MSG_USB_WWID_DP, MSG_USB_CLASS_DP gets expaned out
- to find the first device that matches. If the BootOption Device Path
- fails the removable media boot algorithm is attempted (\EFI\BOOTIA32.EFI,
- \EFI\BOOTX64.EFI,... only one file type is tried per processor type)
-
- @param BootOption Boot Option to try and boot.
- On return, BootOption->Status contains the boot status:
- EFI_SUCCESS BootOption was booted
- EFI_UNSUPPORTED BootOption isn't supported.
- EFI_NOT_FOUND The BootOption was not found on the system
- Others BootOption failed with this error status
-
-**/
-VOID
-EFIAPI
-EfiBootManagerBoot (
- IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
- );
-
-/**
- Return the boot option corresponding to the Boot Manager Menu.
- It may automatically create one if the boot option hasn't been created yet.
-
- @param BootOption Return the Boot Manager Menu.
-
- @retval EFI_SUCCESS The Boot Manager Menu is successfully returned.
- @retval EFI_NOT_FOUND The Boot Manager Menu cannot be found.
- @retval others Return status of gRT->SetVariable (). BootOption still points
- to the Boot Manager Menu even the Status is not EFI_SUCCESS
- and EFI_NOT_FOUND.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerGetBootManagerMenu (
- EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
- );
-
-/**
- Get the next possible full path pointing to the load option.
- The routine doesn't guarantee the returned full path points to an existing
- file, and it also doesn't guarantee the existing file is a valid load option.
- BmGetNextLoadOptionBuffer() guarantees.
-
- @param FilePath The device path pointing to a load option.
- It could be a short-form device path.
- @param FullPath The full path returned by the routine in last call.
- Set to NULL in first call.
-
- @return The next possible full path pointing to the load option.
- Caller is responsible to free the memory.
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-EFIAPI
-EfiBootManagerGetNextLoadOptionDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN EFI_DEVICE_PATH_PROTOCOL *FullPath
- );
-
-/**
- Get the load option by its device path.
-
- @param FilePath The device path pointing to a load option.
- It could be a short-form device path.
- @param FullPath Return the full device path of the load option after
- short-form device path expanding.
- Caller is responsible to free it.
- @param FileSize Return the load option size.
-
- @return The load option buffer. Caller is responsible to free the memory.
-**/
-VOID *
-EFIAPI
-EfiBootManagerGetLoadOptionBuffer (
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- OUT EFI_DEVICE_PATH_PROTOCOL **FullPath,
- OUT UINTN *FileSize
- );
-
-/**
- The function enumerates all the legacy boot options, creates them and
- registers them in the BootOrder variable.
-**/
-typedef
-VOID
-(EFIAPI *EFI_BOOT_MANAGER_REFRESH_LEGACY_BOOT_OPTION)(
- VOID
- );
-
-/**
- The function boots a legacy boot option.
-**/
-typedef
-VOID
-(EFIAPI *EFI_BOOT_MANAGER_LEGACY_BOOT)(
- IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
- );
-
-/**
- The function registers the legacy boot support capabilities.
-
- @param RefreshLegacyBootOption The function pointer to create all the legacy boot options.
- @param LegacyBoot The function pointer to boot the legacy boot option.
-**/
-VOID
-EFIAPI
-EfiBootManagerRegisterLegacyBootSupport (
- EFI_BOOT_MANAGER_REFRESH_LEGACY_BOOT_OPTION RefreshLegacyBootOption,
- EFI_BOOT_MANAGER_LEGACY_BOOT LegacyBoot
- );
-
-/**
- Return the platform provided boot option description for the controller.
-
- @param Handle Controller handle.
- @param DefaultDescription Default boot description provided by core.
-
- @return The callee allocated description string
- or NULL if the handler wants to use DefaultDescription.
-**/
-typedef
-CHAR16 *
-(EFIAPI *EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER)(
- IN EFI_HANDLE Handle,
- IN CONST CHAR16 *DefaultDescription
- );
-
-/**
- Register the platform provided boot description handler.
-
- @param Handler The platform provided boot description handler
-
- @retval EFI_SUCCESS The handler was registered successfully.
- @retval EFI_ALREADY_STARTED The handler was already registered.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource to perform the registration.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerRegisterBootDescriptionHandler (
- IN EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER Handler
- );
-
-//
-// Boot Manager connect and disconnect library functions
-//
-
-/**
- This function will connect all the system driver to controller
- first, and then special connect the default console, this make
- sure all the system controller available and the platform default
- console connected.
-**/
-VOID
-EFIAPI
-EfiBootManagerConnectAll (
- VOID
- );
-
-/**
- This function will create all handles associate with every device
- path node. If the handle associate with one device path node can not
- be created successfully, then still give chance to do the dispatch,
- which load the missing drivers if possible.
-
- @param DevicePathToConnect The device path which will be connected, it can be
- a multi-instance device path
- @param MatchingHandle Return the controller handle closest to the DevicePathToConnect
-
- @retval EFI_SUCCESS All handles associate with every device path node
- have been created.
- @retval EFI_OUT_OF_RESOURCES There is no resource to create new handles.
- @retval EFI_NOT_FOUND Create the handle associate with one device path
- node failed.
- @retval EFI_SECURITY_VIOLATION The user has no permission to start UEFI device
- drivers on the DevicePath.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerConnectDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect,
- OUT EFI_HANDLE *MatchingHandle OPTIONAL
- );
-
-/**
- This function will disconnect all current system handles.
-
- gBS->DisconnectController() is invoked for each handle exists in system handle buffer.
- If handle is a bus type handle, all childrens also are disconnected recursively by
- gBS->DisconnectController().
-**/
-VOID
-EFIAPI
-EfiBootManagerDisconnectAll (
- VOID
- );
-
-//
-// Boot Manager console library functions
-//
-
-typedef enum {
- ConIn,
- ConOut,
- ErrOut,
- ConInDev,
- ConOutDev,
- ErrOutDev,
- ConsoleTypeMax
-} CONSOLE_TYPE;
-
-/**
- This function will connect all the console devices base on the console
- device variable ConIn, ConOut and ErrOut.
-
- @retval EFI_DEVICE_ERROR All the consoles were not connected due to an error.
- @retval EFI_SUCCESS Success connect any one instance of the console
- device path base on the variable ConVarName.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerConnectAllDefaultConsoles (
- VOID
- );
-
-/**
- This function updates the console variable based on ConVarName. It can
- add or remove one specific console device path from the variable
-
- @param ConsoleType ConIn, ConOut, ErrOut, ConInDev, ConOutDev or ErrOutDev.
- @param CustomizedConDevicePath The console device path to be added to
- the console variable. Cannot be multi-instance.
- @param ExclusiveDevicePath The console device path to be removed
- from the console variable. Cannot be multi-instance.
-
- @retval EFI_UNSUPPORTED The added device path is the same as a removed one.
- @retval EFI_SUCCESS Successfully added or removed the device path from the
- console variable.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerUpdateConsoleVariable (
- IN CONSOLE_TYPE ConsoleType,
- IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,
- IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath
- );
-
-/**
- Connect the console device base on the variable ConVarName, if
- device path of the ConVarName is multi-instance device path, if
- anyone of the instances is connected success, then this function
- will return success.
-
- @param ConsoleType ConIn, ConOut or ErrOut.
-
- @retval EFI_NOT_FOUND There is not any console devices connected
- success
- @retval EFI_SUCCESS Success connect any one instance of the console
- device path base on the variable ConVarName.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerConnectConsoleVariable (
- IN CONSOLE_TYPE ConsoleType
- );
-
-/**
- Query all the children of VideoController and return the device paths of all the
- children that support GraphicsOutput protocol.
-
- @param VideoController PCI handle of video controller.
-
- @return Device paths of all the children that support GraphicsOutput protocol.
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-EFIAPI
-EfiBootManagerGetGopDevicePath (
- IN EFI_HANDLE VideoController
- );
-
-/**
- Connect the platform active active video controller.
-
- @param VideoController PCI handle of video controller.
-
- @retval EFI_NOT_FOUND There is no active video controller.
- @retval EFI_SUCCESS The video controller is connected.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerConnectVideoController (
- EFI_HANDLE VideoController OPTIONAL
- );
-
-//
-// Boot Manager driver health library functions.
-//
-
-typedef struct {
- EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth;
-
- ///
- /// Driver relative handles
- ///
- EFI_HANDLE DriverHealthHandle;
- EFI_HANDLE ControllerHandle;
- EFI_HANDLE ChildHandle;
-
- ///
- /// Driver health messages of the specify Driver
- ///
- EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList;
-
- ///
- /// HII relative handles
- ///
- EFI_HII_HANDLE HiiHandle;
-
- ///
- /// Driver Health status
- ///
- EFI_DRIVER_HEALTH_STATUS HealthStatus;
-} EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO;
-
-/**
- Return all the Driver Health information.
-
- When the cumulative health status of all the controllers managed by the
- driver who produces the EFI_DRIVER_HEALTH_PROTOCOL is healthy, only one
- EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO entry is created for such
- EFI_DRIVER_HEALTH_PROTOCOL instance.
- Otherwise, every controller creates one EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO
- entry. Additionally every child controller creates one
- EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO entry if the driver is a bus driver.
-
- @param Count Return the count of the Driver Health information.
-
- @retval NULL No Driver Health information is returned.
- @retval !NULL Pointer to the Driver Health information array.
-**/
-EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *
-EFIAPI
-EfiBootManagerGetDriverHealthInfo (
- UINTN *Count
- );
-
-/**
- Free the Driver Health information array.
-
- @param DriverHealthInfo Pointer to array of the Driver Health information.
- @param Count Count of the array.
-
- @retval EFI_SUCCESS The array is freed.
- @retval EFI_INVALID_PARAMETER The array is NULL.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerFreeDriverHealthInfo (
- EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *DriverHealthInfo,
- UINTN Count
- );
-
-/**
- Process (load and execute) the load option.
-
- @param LoadOption Pointer to the load option.
-
- @retval EFI_INVALID_PARAMETER The load option type is invalid,
- or the load option file path doesn't point to a valid file.
- @retval EFI_UNSUPPORTED The load option type is of LoadOptionTypeBoot.
- @retval EFI_SUCCESS The load option is inactive, or successfully loaded and executed.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerProcessLoadOption (
- EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption
- );
-
-/**
- Check whether the VariableName is a valid load option variable name
- and return the load option type and option number.
-
- @param VariableName The name of the load option variable.
- @param OptionType Return the load option type.
- @param OptionNumber Return the load option number.
-
- @retval TRUE The variable name is valid; The load option type and
- load option number are returned.
- @retval FALSE The variable name is NOT valid.
-**/
-BOOLEAN
-EFIAPI
-EfiBootManagerIsValidLoadOptionVariableName (
- IN CHAR16 *VariableName,
- OUT EFI_BOOT_MANAGER_LOAD_OPTION_TYPE *OptionType OPTIONAL,
- OUT UINT16 *OptionNumber OPTIONAL
- );
-
-/**
- Dispatch the deferred images that are returned from all DeferredImageLoad instances.
-
- @retval EFI_SUCCESS At least one deferred image is loaded successfully and started.
- @retval EFI_NOT_FOUND There is no deferred image.
- @retval EFI_ACCESS_DENIED There are deferred images but all of them are failed to load.
-**/
-EFI_STATUS
-EFIAPI
-EfiBootManagerDispatchDeferredImages (
- VOID
- );
-
-#endif
+/** @file + Provide Boot Manager related library APIs. + +Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR> +(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _UEFI_BOOT_MANAGER_LIB_H_ +#define _UEFI_BOOT_MANAGER_LIB_H_ + +#include <Protocol/DriverHealth.h> +#include <Library/SortLib.h> + +// +// Boot Manager load option library functions. +// + +// +// Load Option Type +// +typedef enum { + LoadOptionTypeDriver, + LoadOptionTypeSysPrep, + LoadOptionTypeBoot, + LoadOptionTypePlatformRecovery, + LoadOptionTypeMax +} EFI_BOOT_MANAGER_LOAD_OPTION_TYPE; + +typedef enum { + LoadOptionNumberMax = 0x10000, + LoadOptionNumberUnassigned = LoadOptionNumberMax +} EFI_BOOT_MANAGER_LOAD_OPTION_NUMBER; + +// +// Common structure definition for DriverOption and BootOption +// +typedef struct { + // + // Data read from UEFI NV variables + // + UINTN OptionNumber; // #### numerical value, could be LoadOptionNumberUnassigned + EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType; // LoadOptionTypeBoot or LoadOptionTypeDriver + UINT32 Attributes; // Load Option Attributes + CHAR16 *Description; // Load Option Description + EFI_DEVICE_PATH_PROTOCOL *FilePath; // Load Option Device Path + UINT8 *OptionalData; // Load Option optional data to pass into image + UINT32 OptionalDataSize; // Load Option size of OptionalData + EFI_GUID VendorGuid; + + // + // Used at runtime + // + EFI_STATUS Status; // Status returned from boot attempt gBS->StartImage () + CHAR16 *ExitData; // Exit data returned from gBS->StartImage () + UINTN ExitDataSize; // Size of ExitData +} EFI_BOOT_MANAGER_LOAD_OPTION; + +/** + Returns an array of load options based on the EFI variable + L"BootOrder"/L"DriverOrder" and the L"Boot####"/L"Driver####" variables impled by it. + #### is the hex value of the UINT16 in each BootOrder/DriverOrder entry. + + @param LoadOptionCount Returns number of entries in the array. + @param LoadOptionType The type of the load option. + + @retval NULL No load options exist. + @retval !NULL Array of load option entries. + +**/ +EFI_BOOT_MANAGER_LOAD_OPTION * +EFIAPI +EfiBootManagerGetLoadOptions ( + OUT UINTN *LoadOptionCount, + IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType + ); + +/** + Free an array of load options returned from EfiBootManagerGetLoadOptions(). + + @param LoadOptions Pointer to the array of load options to free. + @param LoadOptionCount Number of array entries in LoadOptions. + + @return EFI_SUCCESS LoadOptions was freed. + @return EFI_INVALID_PARAMETER LoadOptions is NULL. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerFreeLoadOptions ( + IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOptions, + IN UINTN LoadOptionCount + ); + +/** + Initialize a load option. + + @param Option Pointer to the load option to be initialized. + @param OptionNumber Option number of the load option. + @param OptionType Type of the load option. + @param Attributes Attributes of the load option. + @param Description Description of the load option. + @param FilePath Device path of the load option. + @param OptionalData Optional data of the load option. + @param OptionalDataSize Size of the optional data of the load option. + + @retval EFI_SUCCESS The load option was initialized successfully. + @retval EFI_INVALID_PARAMETER Option, Description or FilePath is NULL. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerInitializeLoadOption ( + IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option, + IN UINTN OptionNumber, + IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType, + IN UINT32 Attributes, + IN CHAR16 *Description, + IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + IN UINT8 *OptionalData, + IN UINT32 OptionalDataSize + ); + +/** + Free a load option created by EfiBootManagerInitializeLoadOption() + or EfiBootManagerVariableToLoadOption(). + + @param LoadOption Pointer to the load option to free. + CONCERN: Check Boot#### instead of BootOrder, optimize, spec clarify + @return EFI_SUCCESS LoadOption was freed. + @return EFI_INVALID_PARAMETER LoadOption is NULL. + +**/ +EFI_STATUS +EFIAPI +EfiBootManagerFreeLoadOption ( + IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption + ); + +/** + Initialize the load option from the VariableName. + + @param VariableName EFI Variable name which could be Boot#### or + Driver#### + @param LoadOption Pointer to the load option to be initialized + + @retval EFI_SUCCESS The option was created + @retval EFI_INVALID_PARAMETER VariableName or LoadOption is NULL. + @retval EFI_NOT_FOUND The variable specified by VariableName cannot be found. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerVariableToLoadOption ( + IN CHAR16 *VariableName, + IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption + ); + +/** + Create the Boot#### or Driver#### variable from the load option. + + @param LoadOption Pointer to the load option. + + @retval EFI_SUCCESS The variable was created. + @retval Others Error status returned by RT->SetVariable. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerLoadOptionToVariable ( + IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption + ); + +/** + This function will register the new Boot####, Driver#### or SysPrep#### option. + After the *#### is updated, the *Order will also be updated. + + @param Option Pointer to load option to add. If on input + Option->OptionNumber is LoadOptionNumberUnassigned, + then on output Option->OptionNumber is updated to + the number of the new Boot####, + Driver#### or SysPrep#### option. + @param Position Position of the new load option to put in the ****Order variable. + + @retval EFI_SUCCESS The *#### have been successfully registered. + @retval EFI_INVALID_PARAMETER The option number exceeds 0xFFFF. + @retval EFI_ALREADY_STARTED The option number of Option is being used already. + Note: this API only adds new load option, no replacement support. + @retval EFI_OUT_OF_RESOURCES There is no free option number that can be used when the + option number specified in the Option is LoadOptionNumberUnassigned. + @return Status codes of gRT->SetVariable (). + +**/ +EFI_STATUS +EFIAPI +EfiBootManagerAddLoadOptionVariable ( + IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option, + IN UINTN Position + ); + +/** + Delete the load option according to the OptionNumber and OptionType. + + Only the BootOrder/DriverOrder is updated to remove the reference of the OptionNumber. + + @param OptionNumber Option number of the load option. + @param OptionType Type of the load option. + + @retval EFI_NOT_FOUND The load option cannot be found. + @retval EFI_SUCCESS The load option was deleted. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerDeleteLoadOptionVariable ( + IN UINTN OptionNumber, + IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType + ); + +/** + Sort the load options. The DriverOrder/BootOrder variables will be re-created to + reflect the new order. + + @param OptionType The type of the load option. + @param CompareFunction The comparator function pointer. +**/ +VOID +EFIAPI +EfiBootManagerSortLoadOptionVariable ( + IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType, + IN SORT_COMPARE CompareFunction + ); + +/** + Return the index of the load option in the load option array. + + The function consider two load options are equal when the + OptionType, Attributes, Description, FilePath and OptionalData are equal. + + @param Key Pointer to the load option to be found. + @param Array Pointer to the array of load options to be found. + @param Count Number of entries in the Array. + + @retval -1 Key wasn't found in the Array. + @retval 0 ~ Count-1 The index of the Key in the Array. +**/ +INTN +EFIAPI +EfiBootManagerFindLoadOption ( + IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key, + IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array, + IN UINTN Count + ); + +// +// Boot Manager hot key library functions. +// + +#pragma pack(1) +/// +/// EFI Key Option. +/// +typedef struct { + /// + /// Specifies options about how the key will be processed. + /// + EFI_BOOT_KEY_DATA KeyData; + /// + /// The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to + /// which BootOption refers. If the CRC-32s do not match this value, then this key + /// option is ignored. + /// + UINT32 BootOptionCrc; + /// + /// The Boot#### option which will be invoked if this key is pressed and the boot option + /// is active (LOAD_OPTION_ACTIVE is set). + /// + UINT16 BootOption; + /// + /// The key codes to compare against those returned by the + /// EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols. + /// The number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT field in KeyOptions. + /// + EFI_INPUT_KEY Keys[3]; + UINT16 OptionNumber; +} EFI_BOOT_MANAGER_KEY_OPTION; +#pragma pack() + +/** + Start the hot key service so that the key press can trigger the boot option. + + @param HotkeyTriggered Return the waitable event and it will be signaled + when a valid hot key is pressed. + + @retval EFI_SUCCESS The hot key service is started. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerStartHotkeyService ( + IN EFI_EVENT *HotkeyTriggered + ); + +// +// Modifier for EfiBootManagerAddKeyOptionVariable and EfiBootManagerDeleteKeyOptionVariable +// +#define EFI_BOOT_MANAGER_SHIFT_PRESSED 0x00000001 +#define EFI_BOOT_MANAGER_CONTROL_PRESSED 0x00000002 +#define EFI_BOOT_MANAGER_ALT_PRESSED 0x00000004 +#define EFI_BOOT_MANAGER_LOGO_PRESSED 0x00000008 +#define EFI_BOOT_MANAGER_MENU_KEY_PRESSED 0x00000010 +#define EFI_BOOT_MANAGER_SYS_REQ_PRESSED 0x00000020 + +/** + Add the key option. + It adds the key option variable and the key option takes affect immediately. + + @param AddedOption Return the added key option. + @param BootOptionNumber The boot option number for the key option. + @param Modifier Key shift state. + @param ... Parameter list of pointer of EFI_INPUT_KEY. + + @retval EFI_SUCCESS The key option is added. + @retval EFI_ALREADY_STARTED The hot key is already used by certain key option. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerAddKeyOptionVariable ( + OUT EFI_BOOT_MANAGER_KEY_OPTION *AddedOption OPTIONAL, + IN UINT16 BootOptionNumber, + IN UINT32 Modifier, + ... + ); + +/** + Delete the Key Option variable and unregister the hot key + + @param DeletedOption Return the deleted key options. + @param Modifier Key shift state. + @param ... Parameter list of pointer of EFI_INPUT_KEY. + + @retval EFI_SUCCESS The key option is deleted. + @retval EFI_NOT_FOUND The key option cannot be found. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerDeleteKeyOptionVariable ( + IN EFI_BOOT_MANAGER_KEY_OPTION *DeletedOption OPTIONAL, + IN UINT32 Modifier, + ... + ); + +/** + Register the key option to exit the waiting of the Boot Manager timeout. + Platform should ensure that the continue key option isn't conflict with + other boot key options. + + @param Modifier Key shift state. + @param ... Parameter list of pointer of EFI_INPUT_KEY. + + @retval EFI_SUCCESS Successfully register the continue key option. + @retval EFI_ALREADY_STARTED The continue key option is already registered. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerRegisterContinueKeyOption ( + IN UINT32 Modifier, + ... + ); + +/** + Try to boot the boot option triggered by hot key. +**/ +VOID +EFIAPI +EfiBootManagerHotkeyBoot ( + VOID + ); + +// +// Boot Manager boot library functions. +// + +/** + The function creates boot options for all possible bootable medias in the following order: + 1. Removable BlockIo - The boot option only points to the removable media + device, like USB key, DVD, Floppy etc. + 2. Fixed BlockIo - The boot option only points to a Fixed blockIo device, + like HardDisk. + 3. Non-BlockIo SimpleFileSystem - The boot option points to a device supporting + SimpleFileSystem Protocol, but not supporting BlockIo + protocol. + 4. LoadFile - The boot option points to the media supporting + LoadFile protocol. + Reference: UEFI Spec chapter 3.3 Boot Option Variables Default Boot Behavior + + The function won't delete the boot option not added by itself. +**/ +VOID +EFIAPI +EfiBootManagerRefreshAllBootOption ( + VOID + ); + +/** + Attempt to boot the EFI boot option. This routine sets L"BootCurent" and + signals the EFI ready to boot event. If the device path for the option starts + with a BBS device path a legacy boot is attempted. Short form device paths are + also supported via this rountine. A device path starting with + MEDIA_HARDDRIVE_DP, MSG_USB_WWID_DP, MSG_USB_CLASS_DP gets expaned out + to find the first device that matches. If the BootOption Device Path + fails the removable media boot algorithm is attempted (\EFI\BOOTIA32.EFI, + \EFI\BOOTX64.EFI,... only one file type is tried per processor type) + + @param BootOption Boot Option to try and boot. + On return, BootOption->Status contains the boot status: + EFI_SUCCESS BootOption was booted + EFI_UNSUPPORTED BootOption isn't supported. + EFI_NOT_FOUND The BootOption was not found on the system + Others BootOption failed with this error status + +**/ +VOID +EFIAPI +EfiBootManagerBoot ( + IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption + ); + +/** + Return the boot option corresponding to the Boot Manager Menu. + It may automatically create one if the boot option hasn't been created yet. + + @param BootOption Return the Boot Manager Menu. + + @retval EFI_SUCCESS The Boot Manager Menu is successfully returned. + @retval EFI_NOT_FOUND The Boot Manager Menu cannot be found. + @retval others Return status of gRT->SetVariable (). BootOption still points + to the Boot Manager Menu even the Status is not EFI_SUCCESS + and EFI_NOT_FOUND. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerGetBootManagerMenu ( + EFI_BOOT_MANAGER_LOAD_OPTION *BootOption + ); + +/** + Get the next possible full path pointing to the load option. + The routine doesn't guarantee the returned full path points to an existing + file, and it also doesn't guarantee the existing file is a valid load option. + BmGetNextLoadOptionBuffer() guarantees. + + @param FilePath The device path pointing to a load option. + It could be a short-form device path. + @param FullPath The full path returned by the routine in last call. + Set to NULL in first call. + + @return The next possible full path pointing to the load option. + Caller is responsible to free the memory. +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +EfiBootManagerGetNextLoadOptionDevicePath ( + IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + IN EFI_DEVICE_PATH_PROTOCOL *FullPath + ); + +/** + Get the load option by its device path. + + @param FilePath The device path pointing to a load option. + It could be a short-form device path. + @param FullPath Return the full device path of the load option after + short-form device path expanding. + Caller is responsible to free it. + @param FileSize Return the load option size. + + @return The load option buffer. Caller is responsible to free the memory. +**/ +VOID * +EFIAPI +EfiBootManagerGetLoadOptionBuffer ( + IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + OUT EFI_DEVICE_PATH_PROTOCOL **FullPath, + OUT UINTN *FileSize + ); + +/** + The function enumerates all the legacy boot options, creates them and + registers them in the BootOrder variable. +**/ +typedef +VOID +(EFIAPI *EFI_BOOT_MANAGER_REFRESH_LEGACY_BOOT_OPTION)( + VOID + ); + +/** + The function boots a legacy boot option. +**/ +typedef +VOID +(EFIAPI *EFI_BOOT_MANAGER_LEGACY_BOOT)( + IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption + ); + +/** + The function registers the legacy boot support capabilities. + + @param RefreshLegacyBootOption The function pointer to create all the legacy boot options. + @param LegacyBoot The function pointer to boot the legacy boot option. +**/ +VOID +EFIAPI +EfiBootManagerRegisterLegacyBootSupport ( + EFI_BOOT_MANAGER_REFRESH_LEGACY_BOOT_OPTION RefreshLegacyBootOption, + EFI_BOOT_MANAGER_LEGACY_BOOT LegacyBoot + ); + +/** + Return the platform provided boot option description for the controller. + + @param Handle Controller handle. + @param DefaultDescription Default boot description provided by core. + + @return The callee allocated description string + or NULL if the handler wants to use DefaultDescription. +**/ +typedef +CHAR16 * +(EFIAPI *EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER)( + IN EFI_HANDLE Handle, + IN CONST CHAR16 *DefaultDescription + ); + +/** + Register the platform provided boot description handler. + + @param Handler The platform provided boot description handler + + @retval EFI_SUCCESS The handler was registered successfully. + @retval EFI_ALREADY_STARTED The handler was already registered. + @retval EFI_OUT_OF_RESOURCES There is not enough resource to perform the registration. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerRegisterBootDescriptionHandler ( + IN EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER Handler + ); + +// +// Boot Manager connect and disconnect library functions +// + +/** + This function will connect all the system driver to controller + first, and then special connect the default console, this make + sure all the system controller available and the platform default + console connected. +**/ +VOID +EFIAPI +EfiBootManagerConnectAll ( + VOID + ); + +/** + This function will create all handles associate with every device + path node. If the handle associate with one device path node can not + be created successfully, then still give chance to do the dispatch, + which load the missing drivers if possible. + + @param DevicePathToConnect The device path which will be connected, it can be + a multi-instance device path + @param MatchingHandle Return the controller handle closest to the DevicePathToConnect + + @retval EFI_SUCCESS All handles associate with every device path node + have been created. + @retval EFI_OUT_OF_RESOURCES There is no resource to create new handles. + @retval EFI_NOT_FOUND Create the handle associate with one device path + node failed. + @retval EFI_SECURITY_VIOLATION The user has no permission to start UEFI device + drivers on the DevicePath. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerConnectDevicePath ( + IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect, + OUT EFI_HANDLE *MatchingHandle OPTIONAL + ); + +/** + This function will disconnect all current system handles. + + gBS->DisconnectController() is invoked for each handle exists in system handle buffer. + If handle is a bus type handle, all childrens also are disconnected recursively by + gBS->DisconnectController(). +**/ +VOID +EFIAPI +EfiBootManagerDisconnectAll ( + VOID + ); + +// +// Boot Manager console library functions +// + +typedef enum { + ConIn, + ConOut, + ErrOut, + ConInDev, + ConOutDev, + ErrOutDev, + ConsoleTypeMax +} CONSOLE_TYPE; + +/** + This function will connect all the console devices base on the console + device variable ConIn, ConOut and ErrOut. + + @retval EFI_DEVICE_ERROR All the consoles were not connected due to an error. + @retval EFI_SUCCESS Success connect any one instance of the console + device path base on the variable ConVarName. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerConnectAllDefaultConsoles ( + VOID + ); + +/** + This function updates the console variable based on ConVarName. It can + add or remove one specific console device path from the variable + + @param ConsoleType ConIn, ConOut, ErrOut, ConInDev, ConOutDev or ErrOutDev. + @param CustomizedConDevicePath The console device path to be added to + the console variable. Cannot be multi-instance. + @param ExclusiveDevicePath The console device path to be removed + from the console variable. Cannot be multi-instance. + + @retval EFI_UNSUPPORTED The added device path is the same as a removed one. + @retval EFI_SUCCESS Successfully added or removed the device path from the + console variable. + +**/ +EFI_STATUS +EFIAPI +EfiBootManagerUpdateConsoleVariable ( + IN CONSOLE_TYPE ConsoleType, + IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath, + IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath + ); + +/** + Connect the console device base on the variable ConVarName, if + device path of the ConVarName is multi-instance device path, if + anyone of the instances is connected success, then this function + will return success. + + @param ConsoleType ConIn, ConOut or ErrOut. + + @retval EFI_NOT_FOUND There is not any console devices connected + success + @retval EFI_SUCCESS Success connect any one instance of the console + device path base on the variable ConVarName. + +**/ +EFI_STATUS +EFIAPI +EfiBootManagerConnectConsoleVariable ( + IN CONSOLE_TYPE ConsoleType + ); + +/** + Query all the children of VideoController and return the device paths of all the + children that support GraphicsOutput protocol. + + @param VideoController PCI handle of video controller. + + @return Device paths of all the children that support GraphicsOutput protocol. +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +EfiBootManagerGetGopDevicePath ( + IN EFI_HANDLE VideoController + ); + +/** + Connect the platform active active video controller. + + @param VideoController PCI handle of video controller. + + @retval EFI_NOT_FOUND There is no active video controller. + @retval EFI_SUCCESS The video controller is connected. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerConnectVideoController ( + EFI_HANDLE VideoController OPTIONAL + ); + +// +// Boot Manager driver health library functions. +// + +typedef struct { + EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth; + + /// + /// Driver relative handles + /// + EFI_HANDLE DriverHealthHandle; + EFI_HANDLE ControllerHandle; + EFI_HANDLE ChildHandle; + + /// + /// Driver health messages of the specify Driver + /// + EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList; + + /// + /// HII relative handles + /// + EFI_HII_HANDLE HiiHandle; + + /// + /// Driver Health status + /// + EFI_DRIVER_HEALTH_STATUS HealthStatus; +} EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO; + +/** + Return all the Driver Health information. + + When the cumulative health status of all the controllers managed by the + driver who produces the EFI_DRIVER_HEALTH_PROTOCOL is healthy, only one + EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO entry is created for such + EFI_DRIVER_HEALTH_PROTOCOL instance. + Otherwise, every controller creates one EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO + entry. Additionally every child controller creates one + EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO entry if the driver is a bus driver. + + @param Count Return the count of the Driver Health information. + + @retval NULL No Driver Health information is returned. + @retval !NULL Pointer to the Driver Health information array. +**/ +EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO * +EFIAPI +EfiBootManagerGetDriverHealthInfo ( + UINTN *Count + ); + +/** + Free the Driver Health information array. + + @param DriverHealthInfo Pointer to array of the Driver Health information. + @param Count Count of the array. + + @retval EFI_SUCCESS The array is freed. + @retval EFI_INVALID_PARAMETER The array is NULL. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerFreeDriverHealthInfo ( + EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *DriverHealthInfo, + UINTN Count + ); + +/** + Process (load and execute) the load option. + + @param LoadOption Pointer to the load option. + + @retval EFI_INVALID_PARAMETER The load option type is invalid, + or the load option file path doesn't point to a valid file. + @retval EFI_UNSUPPORTED The load option type is of LoadOptionTypeBoot. + @retval EFI_SUCCESS The load option is inactive, or successfully loaded and executed. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerProcessLoadOption ( + EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption + ); + +/** + Check whether the VariableName is a valid load option variable name + and return the load option type and option number. + + @param VariableName The name of the load option variable. + @param OptionType Return the load option type. + @param OptionNumber Return the load option number. + + @retval TRUE The variable name is valid; The load option type and + load option number are returned. + @retval FALSE The variable name is NOT valid. +**/ +BOOLEAN +EFIAPI +EfiBootManagerIsValidLoadOptionVariableName ( + IN CHAR16 *VariableName, + OUT EFI_BOOT_MANAGER_LOAD_OPTION_TYPE *OptionType OPTIONAL, + OUT UINT16 *OptionNumber OPTIONAL + ); + +/** + Dispatch the deferred images that are returned from all DeferredImageLoad instances. + + @retval EFI_SUCCESS At least one deferred image is loaded successfully and started. + @retval EFI_NOT_FOUND There is no deferred image. + @retval EFI_ACCESS_DENIED There are deferred images but all of them are failed to load. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerDispatchDeferredImages ( + VOID + ); + +#endif diff --git a/MdeModulePkg/Include/Library/UefiHiiServicesLib.h b/MdeModulePkg/Include/Library/UefiHiiServicesLib.h index 36bbd45bff..5addd34120 100644 --- a/MdeModulePkg/Include/Library/UefiHiiServicesLib.h +++ b/MdeModulePkg/Include/Library/UefiHiiServicesLib.h @@ -1,46 +1,46 @@ -/** @file
- Provides global variables that are pointers to the UEFI HII related protocols.
- All of the UEFI HII related protocols are optional, so the consumers of this
- library class must verify that the global variable pointers are not NULL before
- use.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __UEFI_HII_SERVICES_LIB_H__
-#define __UEFI_HII_SERVICES_LIB_H__
-
-#include <Protocol/HiiFont.h>
-#include <Protocol/HiiString.h>
-#include <Protocol/HiiImage.h>
-#include <Protocol/HiiDatabase.h>
-#include <Protocol/HiiConfigRouting.h>
-
-///
-/// The pointer to the UEFI HII Font Protocol.
-///
-extern EFI_HII_FONT_PROTOCOL *gHiiFont;
-
-///
-/// The pointer to the UEFI HII String Protocol.
-///
-extern EFI_HII_STRING_PROTOCOL *gHiiString;
-
-///
-/// The pointer to the UEFI HII Image Protocol.
-///
-extern EFI_HII_IMAGE_PROTOCOL *gHiiImage;
-
-///
-/// The pointer to the UEFI HII Database Protocol.
-///
-extern EFI_HII_DATABASE_PROTOCOL *gHiiDatabase;
-
-///
-/// The pointer to the UEFI HII Config Rounting Protocol.
-///
-extern EFI_HII_CONFIG_ROUTING_PROTOCOL *gHiiConfigRouting;
-
-#endif
+/** @file + Provides global variables that are pointers to the UEFI HII related protocols. + All of the UEFI HII related protocols are optional, so the consumers of this + library class must verify that the global variable pointers are not NULL before + use. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __UEFI_HII_SERVICES_LIB_H__ +#define __UEFI_HII_SERVICES_LIB_H__ + +#include <Protocol/HiiFont.h> +#include <Protocol/HiiString.h> +#include <Protocol/HiiImage.h> +#include <Protocol/HiiDatabase.h> +#include <Protocol/HiiConfigRouting.h> + +/// +/// The pointer to the UEFI HII Font Protocol. +/// +extern EFI_HII_FONT_PROTOCOL *gHiiFont; + +/// +/// The pointer to the UEFI HII String Protocol. +/// +extern EFI_HII_STRING_PROTOCOL *gHiiString; + +/// +/// The pointer to the UEFI HII Image Protocol. +/// +extern EFI_HII_IMAGE_PROTOCOL *gHiiImage; + +/// +/// The pointer to the UEFI HII Database Protocol. +/// +extern EFI_HII_DATABASE_PROTOCOL *gHiiDatabase; + +/// +/// The pointer to the UEFI HII Config Rounting Protocol. +/// +extern EFI_HII_CONFIG_ROUTING_PROTOCOL *gHiiConfigRouting; + +#endif diff --git a/MdeModulePkg/Include/Library/VarCheckLib.h b/MdeModulePkg/Include/Library/VarCheckLib.h index 155fcd0223..f49143b23d 100644 --- a/MdeModulePkg/Include/Library/VarCheckLib.h +++ b/MdeModulePkg/Include/Library/VarCheckLib.h @@ -1,174 +1,174 @@ -/** @file
- Provides variable check services and database management.
-
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _VARIABLE_CHECK_LIB_H_
-#define _VARIABLE_CHECK_LIB_H_
-
-#include <Protocol/VarCheck.h>
-
-typedef enum {
- VarCheckRequestReserved0 = 0,
- VarCheckRequestReserved1 = 1,
- VarCheckFromTrusted = 2,
- VarCheckFromUntrusted = 3,
-} VAR_CHECK_REQUEST_SOURCE;
-
-typedef
-VOID
-(EFIAPI *VAR_CHECK_END_OF_DXE_CALLBACK)(
- VOID
- );
-
-/**
- Register END_OF_DXE callback.
- The callback will be invoked by VarCheckLibInitializeAtEndOfDxe().
-
- @param[in] Callback END_OF_DXE callback.
-
- @retval EFI_SUCCESS The callback was registered successfully.
- @retval EFI_INVALID_PARAMETER Callback is NULL.
- @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
- already been signaled.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource for the callback register request.
-
-**/
-EFI_STATUS
-EFIAPI
-VarCheckLibRegisterEndOfDxeCallback (
- IN VAR_CHECK_END_OF_DXE_CALLBACK Callback
- );
-
-/**
- Var check initialize at END_OF_DXE.
-
- This function needs to be called at END_OF_DXE.
- Address pointers may be returned,
- and caller needs to ConvertPointer() for the pointers.
-
- @param[in, out] AddressPointerCount Output pointer to address pointer count.
-
- @return Address pointer buffer, NULL if input AddressPointerCount is NULL.
-
-**/
-VOID ***
-EFIAPI
-VarCheckLibInitializeAtEndOfDxe (
- IN OUT UINTN *AddressPointerCount OPTIONAL
- );
-
-/**
- Register address pointer.
- The AddressPointer may be returned by VarCheckLibInitializeAtEndOfDxe().
-
- @param[in] AddressPointer Address pointer.
-
- @retval EFI_SUCCESS The address pointer was registered successfully.
- @retval EFI_INVALID_PARAMETER AddressPointer is NULL.
- @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
- already been signaled.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource for the address pointer register request.
-
-**/
-EFI_STATUS
-EFIAPI
-VarCheckLibRegisterAddressPointer (
- IN VOID **AddressPointer
- );
-
-/**
- Register SetVariable check handler.
-
- @param[in] Handler Pointer to check handler.
-
- @retval EFI_SUCCESS The SetVariable check handler was registered successfully.
- @retval EFI_INVALID_PARAMETER Handler is NULL.
- @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
- already been signaled.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource for the SetVariable check handler register request.
- @retval EFI_UNSUPPORTED This interface is not implemented.
- For example, it is unsupported in VarCheck protocol if both VarCheck and SmmVarCheck protocols are present.
-
-**/
-EFI_STATUS
-EFIAPI
-VarCheckLibRegisterSetVariableCheckHandler (
- IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler
- );
-
-/**
- Variable property set.
-
- @param[in] Name Pointer to the variable name.
- @param[in] Guid Pointer to the vendor GUID.
- @param[in] VariableProperty Pointer to the input variable property.
-
- @retval EFI_SUCCESS The property of variable specified by the Name and Guid was set successfully.
- @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string,
- or the fields of VariableProperty are not valid.
- @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
- already been signaled.
- @retval EFI_OUT_OF_RESOURCES There is not enough resource for the variable property set request.
-
-**/
-EFI_STATUS
-EFIAPI
-VarCheckLibVariablePropertySet (
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- IN VAR_CHECK_VARIABLE_PROPERTY *VariableProperty
- );
-
-/**
- Variable property get.
-
- @param[in] Name Pointer to the variable name.
- @param[in] Guid Pointer to the vendor GUID.
- @param[out] VariableProperty Pointer to the output variable property.
-
- @retval EFI_SUCCESS The property of variable specified by the Name and Guid was got successfully.
- @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string.
- @retval EFI_NOT_FOUND The property of variable specified by the Name and Guid was not found.
-
-**/
-EFI_STATUS
-EFIAPI
-VarCheckLibVariablePropertyGet (
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty
- );
-
-/**
- SetVariable check.
-
- @param[in] VariableName Name of Variable to set.
- @param[in] VendorGuid Variable vendor GUID.
- @param[in] Attributes Attribute value of the variable.
- @param[in] DataSize Size of Data to set.
- @param[in] Data Data pointer.
- @param[in] RequestSource Request source.
-
- @retval EFI_SUCCESS The SetVariable check result was success.
- @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, GUID,
- DataSize and Data value was supplied.
- @retval EFI_WRITE_PROTECTED The variable in question is read-only.
- @retval Others The other return status from check handler.
-
-**/
-EFI_STATUS
-EFIAPI
-VarCheckLibSetVariableCheck (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data,
- IN VAR_CHECK_REQUEST_SOURCE RequestSource
- );
-
-#endif
+/** @file + Provides variable check services and database management. + +Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _VARIABLE_CHECK_LIB_H_ +#define _VARIABLE_CHECK_LIB_H_ + +#include <Protocol/VarCheck.h> + +typedef enum { + VarCheckRequestReserved0 = 0, + VarCheckRequestReserved1 = 1, + VarCheckFromTrusted = 2, + VarCheckFromUntrusted = 3, +} VAR_CHECK_REQUEST_SOURCE; + +typedef +VOID +(EFIAPI *VAR_CHECK_END_OF_DXE_CALLBACK)( + VOID + ); + +/** + Register END_OF_DXE callback. + The callback will be invoked by VarCheckLibInitializeAtEndOfDxe(). + + @param[in] Callback END_OF_DXE callback. + + @retval EFI_SUCCESS The callback was registered successfully. + @retval EFI_INVALID_PARAMETER Callback is NULL. + @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has + already been signaled. + @retval EFI_OUT_OF_RESOURCES There is not enough resource for the callback register request. + +**/ +EFI_STATUS +EFIAPI +VarCheckLibRegisterEndOfDxeCallback ( + IN VAR_CHECK_END_OF_DXE_CALLBACK Callback + ); + +/** + Var check initialize at END_OF_DXE. + + This function needs to be called at END_OF_DXE. + Address pointers may be returned, + and caller needs to ConvertPointer() for the pointers. + + @param[in, out] AddressPointerCount Output pointer to address pointer count. + + @return Address pointer buffer, NULL if input AddressPointerCount is NULL. + +**/ +VOID *** +EFIAPI +VarCheckLibInitializeAtEndOfDxe ( + IN OUT UINTN *AddressPointerCount OPTIONAL + ); + +/** + Register address pointer. + The AddressPointer may be returned by VarCheckLibInitializeAtEndOfDxe(). + + @param[in] AddressPointer Address pointer. + + @retval EFI_SUCCESS The address pointer was registered successfully. + @retval EFI_INVALID_PARAMETER AddressPointer is NULL. + @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has + already been signaled. + @retval EFI_OUT_OF_RESOURCES There is not enough resource for the address pointer register request. + +**/ +EFI_STATUS +EFIAPI +VarCheckLibRegisterAddressPointer ( + IN VOID **AddressPointer + ); + +/** + Register SetVariable check handler. + + @param[in] Handler Pointer to check handler. + + @retval EFI_SUCCESS The SetVariable check handler was registered successfully. + @retval EFI_INVALID_PARAMETER Handler is NULL. + @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has + already been signaled. + @retval EFI_OUT_OF_RESOURCES There is not enough resource for the SetVariable check handler register request. + @retval EFI_UNSUPPORTED This interface is not implemented. + For example, it is unsupported in VarCheck protocol if both VarCheck and SmmVarCheck protocols are present. + +**/ +EFI_STATUS +EFIAPI +VarCheckLibRegisterSetVariableCheckHandler ( + IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler + ); + +/** + Variable property set. + + @param[in] Name Pointer to the variable name. + @param[in] Guid Pointer to the vendor GUID. + @param[in] VariableProperty Pointer to the input variable property. + + @retval EFI_SUCCESS The property of variable specified by the Name and Guid was set successfully. + @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string, + or the fields of VariableProperty are not valid. + @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has + already been signaled. + @retval EFI_OUT_OF_RESOURCES There is not enough resource for the variable property set request. + +**/ +EFI_STATUS +EFIAPI +VarCheckLibVariablePropertySet ( + IN CHAR16 *Name, + IN EFI_GUID *Guid, + IN VAR_CHECK_VARIABLE_PROPERTY *VariableProperty + ); + +/** + Variable property get. + + @param[in] Name Pointer to the variable name. + @param[in] Guid Pointer to the vendor GUID. + @param[out] VariableProperty Pointer to the output variable property. + + @retval EFI_SUCCESS The property of variable specified by the Name and Guid was got successfully. + @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string. + @retval EFI_NOT_FOUND The property of variable specified by the Name and Guid was not found. + +**/ +EFI_STATUS +EFIAPI +VarCheckLibVariablePropertyGet ( + IN CHAR16 *Name, + IN EFI_GUID *Guid, + OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty + ); + +/** + SetVariable check. + + @param[in] VariableName Name of Variable to set. + @param[in] VendorGuid Variable vendor GUID. + @param[in] Attributes Attribute value of the variable. + @param[in] DataSize Size of Data to set. + @param[in] Data Data pointer. + @param[in] RequestSource Request source. + + @retval EFI_SUCCESS The SetVariable check result was success. + @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, GUID, + DataSize and Data value was supplied. + @retval EFI_WRITE_PROTECTED The variable in question is read-only. + @retval Others The other return status from check handler. + +**/ +EFI_STATUS +EFIAPI +VarCheckLibSetVariableCheck ( + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + IN UINT32 Attributes, + IN UINTN DataSize, + IN VOID *Data, + IN VAR_CHECK_REQUEST_SOURCE RequestSource + ); + +#endif diff --git a/MdeModulePkg/Include/Library/VariableFlashInfoLib.h b/MdeModulePkg/Include/Library/VariableFlashInfoLib.h index 1367be9376..727368752f 100644 --- a/MdeModulePkg/Include/Library/VariableFlashInfoLib.h +++ b/MdeModulePkg/Include/Library/VariableFlashInfoLib.h @@ -1,68 +1,68 @@ -/** @file
- Variable Flash Information Library
-
-Copyright (c) Microsoft Corporation<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef VARIABLE_FLASH_INFO_LIB_H_
-#define VARIABLE_FLASH_INFO_LIB_H_
-
-/**
- Get the base address and size for the NV storage area used for UEFI variable storage.
-
- @param[out] BaseAddress The NV storage base address.
- @param[out] Length The NV storage length in bytes.
-
- @retval EFI_SUCCESS NV storage information was found successfully.
- @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL.
- @retval EFI_NOT_FOUND NV storage information could not be found.
-
-**/
-EFI_STATUS
-EFIAPI
-GetVariableFlashNvStorageInfo (
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- OUT UINT64 *Length
- );
-
-/**
- Get the base address and size for the fault tolerant write (FTW) spare
- area used for UEFI variable storage.
-
- @param[out] BaseAddress The FTW spare base address.
- @param[out] Length The FTW spare length in bytes.
-
- @retval EFI_SUCCESS FTW spare information was found successfully.
- @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL.
- @retval EFI_NOT_FOUND FTW spare information could not be found.
-
-**/
-EFI_STATUS
-EFIAPI
-GetVariableFlashFtwSpareInfo (
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- OUT UINT64 *Length
- );
-
-/**
- Get the base address and size for the fault tolerant write (FTW) working
- area used for UEFI variable storage.
-
- @param[out] BaseAddress The FTW working area base address.
- @param[out] Length The FTW working area length in bytes.
-
- @retval EFI_SUCCESS FTW working information was found successfully.
- @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL.
- @retval EFI_NOT_FOUND FTW working information could not be found.
-
-**/
-EFI_STATUS
-EFIAPI
-GetVariableFlashFtwWorkingInfo (
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- OUT UINT64 *Length
- );
-
-#endif
+/** @file + Variable Flash Information Library + +Copyright (c) Microsoft Corporation<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef VARIABLE_FLASH_INFO_LIB_H_ +#define VARIABLE_FLASH_INFO_LIB_H_ + +/** + Get the base address and size for the NV storage area used for UEFI variable storage. + + @param[out] BaseAddress The NV storage base address. + @param[out] Length The NV storage length in bytes. + + @retval EFI_SUCCESS NV storage information was found successfully. + @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL. + @retval EFI_NOT_FOUND NV storage information could not be found. + +**/ +EFI_STATUS +EFIAPI +GetVariableFlashNvStorageInfo ( + OUT EFI_PHYSICAL_ADDRESS *BaseAddress, + OUT UINT64 *Length + ); + +/** + Get the base address and size for the fault tolerant write (FTW) spare + area used for UEFI variable storage. + + @param[out] BaseAddress The FTW spare base address. + @param[out] Length The FTW spare length in bytes. + + @retval EFI_SUCCESS FTW spare information was found successfully. + @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL. + @retval EFI_NOT_FOUND FTW spare information could not be found. + +**/ +EFI_STATUS +EFIAPI +GetVariableFlashFtwSpareInfo ( + OUT EFI_PHYSICAL_ADDRESS *BaseAddress, + OUT UINT64 *Length + ); + +/** + Get the base address and size for the fault tolerant write (FTW) working + area used for UEFI variable storage. + + @param[out] BaseAddress The FTW working area base address. + @param[out] Length The FTW working area length in bytes. + + @retval EFI_SUCCESS FTW working information was found successfully. + @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL. + @retval EFI_NOT_FOUND FTW working information could not be found. + +**/ +EFI_STATUS +EFIAPI +GetVariableFlashFtwWorkingInfo ( + OUT EFI_PHYSICAL_ADDRESS *BaseAddress, + OUT UINT64 *Length + ); + +#endif diff --git a/MdeModulePkg/Include/Library/VariablePolicyHelperLib.h b/MdeModulePkg/Include/Library/VariablePolicyHelperLib.h index e471ed78f3..ff47d5aefb 100644 --- a/MdeModulePkg/Include/Library/VariablePolicyHelperLib.h +++ b/MdeModulePkg/Include/Library/VariablePolicyHelperLib.h @@ -1,161 +1,161 @@ -/** @file -- VariablePolicyHelperLib.h
-This library contains helper functions for marshalling and registering
-new policies with the VariablePolicy infrastructure.
-
-Copyright (c) Microsoft Corporation.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EDKII_VARIABLE_POLICY_HELPER_LIB_H_
-#define _EDKII_VARIABLE_POLICY_HELPER_LIB_H_
-
-#include <Protocol/VariablePolicy.h>
-
-/**
- This helper function will allocate and populate a new VariablePolicy
- structure for a policy that does not contain any sub-structures (such as
- VARIABLE_LOCK_ON_VAR_STATE_POLICY).
-
- NOTE: Caller will need to free structure once finished.
-
- @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect.
- @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name.
- Otherwise, will create a policy that targets an entire namespace.
- @param[in] MinSize MinSize for the VariablePolicy.
- @param[in] MaxSize MaxSize for the VariablePolicy.
- @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy.
- @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy.
- @param[in] LockPolicyType LockPolicyType for the VariablePolicy.
- @param[out] NewEntry If successful, will be set to a pointer to the allocated buffer containing the
- new policy.
-
- @retval EFI_SUCCESS Operation completed successfully and structure is populated.
- @retval EFI_INVALID_PARAMETER Namespace is NULL.
- @retval EFI_INVALID_PARAMETER LockPolicyType is invalid for a basic structure.
- @retval EFI_BUFFER_TOO_SMALL Finished structure would not fit in UINT16 size.
- @retval EFI_OUT_OF_RESOURCES Could not allocate sufficient space for structure.
-
-**/
-EFI_STATUS
-EFIAPI
-CreateBasicVariablePolicy (
- IN CONST EFI_GUID *Namespace,
- IN CONST CHAR16 *Name OPTIONAL,
- IN UINT32 MinSize,
- IN UINT32 MaxSize,
- IN UINT32 AttributesMustHave,
- IN UINT32 AttributesCantHave,
- IN UINT8 LockPolicyType,
- OUT VARIABLE_POLICY_ENTRY **NewEntry
- );
-
-/**
- This helper function will allocate and populate a new VariablePolicy
- structure for a policy with a lock type of VARIABLE_POLICY_TYPE_LOCK_ON_VAR_STATE.
-
- NOTE: Caller will need to free structure once finished.
-
- @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect.
- @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name.
- Otherwise, will create a policy that targets an entire namespace.
- @param[in] MinSize MinSize for the VariablePolicy.
- @param[in] MaxSize MaxSize for the VariablePolicy.
- @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy.
- @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy.
- @param[in] VarStateNamespace Pointer to the EFI_GUID for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Namespace.
- @param[in] VarStateValue Value for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Value.
- @param[in] VarStateName Pointer to the CHAR16 array for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Name.
- @param[out] NewEntry If successful, will be set to a pointer to the allocated buffer containing the
- new policy.
-
- @retval EFI_SUCCESS Operation completed successfully and structure is populated.
- @retval EFI_INVALID_PARAMETER Namespace, VarStateNamespace, VarStateName is NULL.
- @retval EFI_BUFFER_TOO_SMALL Finished structure would not fit in UINT16 size.
- @retval EFI_OUT_OF_RESOURCES Could not allocate sufficient space for structure.
-
-**/
-EFI_STATUS
-EFIAPI
-CreateVarStateVariablePolicy (
- IN CONST EFI_GUID *Namespace,
- IN CONST CHAR16 *Name OPTIONAL,
- IN UINT32 MinSize,
- IN UINT32 MaxSize,
- IN UINT32 AttributesMustHave,
- IN UINT32 AttributesCantHave,
- IN CONST EFI_GUID *VarStateNamespace,
- IN UINT8 VarStateValue,
- IN CONST CHAR16 *VarStateName,
- OUT VARIABLE_POLICY_ENTRY **NewEntry
- );
-
-/**
- This helper function does everything that CreateBasicVariablePolicy() does, but also
- uses the passed in protocol to register the policy with the infrastructure.
- Does not return a buffer, does not require the caller to free anything.
-
- @param[in] VariablePolicy Pointer to a valid instance of the VariablePolicy protocol.
- @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect.
- @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name.
- Otherwise, will create a policy that targets an entire namespace.
- @param[in] MinSize MinSize for the VariablePolicy.
- @param[in] MaxSize MaxSize for the VariablePolicy.
- @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy.
- @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy.
- @param[in] LockPolicyType LockPolicyType for the VariablePolicy.
-
- @retval EFI_INVALID_PARAMETER VariablePolicy pointer is NULL.
- @retval EFI_STATUS Status returned by CreateBasicVariablePolicy() or RegisterVariablePolicy().
-
-**/
-EFI_STATUS
-EFIAPI
-RegisterBasicVariablePolicy (
- IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy,
- IN CONST EFI_GUID *Namespace,
- IN CONST CHAR16 *Name OPTIONAL,
- IN UINT32 MinSize,
- IN UINT32 MaxSize,
- IN UINT32 AttributesMustHave,
- IN UINT32 AttributesCantHave,
- IN UINT8 LockPolicyType
- );
-
-/**
- This helper function does everything that CreateBasicVariablePolicy() does, but also
- uses the passed in protocol to register the policy with the infrastructure.
- Does not return a buffer, does not require the caller to free anything.
-
- @param[in] VariablePolicy Pointer to a valid instance of the VariablePolicy protocol.
- @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect.
- @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name.
- Otherwise, will create a policy that targets an entire namespace.
- @param[in] MinSize MinSize for the VariablePolicy.
- @param[in] MaxSize MaxSize for the VariablePolicy.
- @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy.
- @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy.
- @param[in] VarStateNamespace Pointer to the EFI_GUID for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Namespace.
- @param[in] VarStateName Pointer to the CHAR16 array for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Name.
- @param[in] VarStateValue Value for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Value.
-
- @retval EFI_INVALID_PARAMETER VariablePolicy pointer is NULL.
- @retval EFI_STATUS Status returned by CreateBasicVariablePolicy() or RegisterVariablePolicy().
-
-**/
-EFI_STATUS
-EFIAPI
-RegisterVarStateVariablePolicy (
- IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy,
- IN CONST EFI_GUID *Namespace,
- IN CONST CHAR16 *Name OPTIONAL,
- IN UINT32 MinSize,
- IN UINT32 MaxSize,
- IN UINT32 AttributesMustHave,
- IN UINT32 AttributesCantHave,
- IN CONST EFI_GUID *VarStateNamespace,
- IN CONST CHAR16 *VarStateName,
- IN UINT8 VarStateValue
- );
-
-#endif // _EDKII_VARIABLE_POLICY_HELPER_LIB_H_
+/** @file -- VariablePolicyHelperLib.h +This library contains helper functions for marshalling and registering +new policies with the VariablePolicy infrastructure. + +Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _EDKII_VARIABLE_POLICY_HELPER_LIB_H_ +#define _EDKII_VARIABLE_POLICY_HELPER_LIB_H_ + +#include <Protocol/VariablePolicy.h> + +/** + This helper function will allocate and populate a new VariablePolicy + structure for a policy that does not contain any sub-structures (such as + VARIABLE_LOCK_ON_VAR_STATE_POLICY). + + NOTE: Caller will need to free structure once finished. + + @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect. + @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name. + Otherwise, will create a policy that targets an entire namespace. + @param[in] MinSize MinSize for the VariablePolicy. + @param[in] MaxSize MaxSize for the VariablePolicy. + @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy. + @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy. + @param[in] LockPolicyType LockPolicyType for the VariablePolicy. + @param[out] NewEntry If successful, will be set to a pointer to the allocated buffer containing the + new policy. + + @retval EFI_SUCCESS Operation completed successfully and structure is populated. + @retval EFI_INVALID_PARAMETER Namespace is NULL. + @retval EFI_INVALID_PARAMETER LockPolicyType is invalid for a basic structure. + @retval EFI_BUFFER_TOO_SMALL Finished structure would not fit in UINT16 size. + @retval EFI_OUT_OF_RESOURCES Could not allocate sufficient space for structure. + +**/ +EFI_STATUS +EFIAPI +CreateBasicVariablePolicy ( + IN CONST EFI_GUID *Namespace, + IN CONST CHAR16 *Name OPTIONAL, + IN UINT32 MinSize, + IN UINT32 MaxSize, + IN UINT32 AttributesMustHave, + IN UINT32 AttributesCantHave, + IN UINT8 LockPolicyType, + OUT VARIABLE_POLICY_ENTRY **NewEntry + ); + +/** + This helper function will allocate and populate a new VariablePolicy + structure for a policy with a lock type of VARIABLE_POLICY_TYPE_LOCK_ON_VAR_STATE. + + NOTE: Caller will need to free structure once finished. + + @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect. + @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name. + Otherwise, will create a policy that targets an entire namespace. + @param[in] MinSize MinSize for the VariablePolicy. + @param[in] MaxSize MaxSize for the VariablePolicy. + @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy. + @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy. + @param[in] VarStateNamespace Pointer to the EFI_GUID for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Namespace. + @param[in] VarStateValue Value for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Value. + @param[in] VarStateName Pointer to the CHAR16 array for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Name. + @param[out] NewEntry If successful, will be set to a pointer to the allocated buffer containing the + new policy. + + @retval EFI_SUCCESS Operation completed successfully and structure is populated. + @retval EFI_INVALID_PARAMETER Namespace, VarStateNamespace, VarStateName is NULL. + @retval EFI_BUFFER_TOO_SMALL Finished structure would not fit in UINT16 size. + @retval EFI_OUT_OF_RESOURCES Could not allocate sufficient space for structure. + +**/ +EFI_STATUS +EFIAPI +CreateVarStateVariablePolicy ( + IN CONST EFI_GUID *Namespace, + IN CONST CHAR16 *Name OPTIONAL, + IN UINT32 MinSize, + IN UINT32 MaxSize, + IN UINT32 AttributesMustHave, + IN UINT32 AttributesCantHave, + IN CONST EFI_GUID *VarStateNamespace, + IN UINT8 VarStateValue, + IN CONST CHAR16 *VarStateName, + OUT VARIABLE_POLICY_ENTRY **NewEntry + ); + +/** + This helper function does everything that CreateBasicVariablePolicy() does, but also + uses the passed in protocol to register the policy with the infrastructure. + Does not return a buffer, does not require the caller to free anything. + + @param[in] VariablePolicy Pointer to a valid instance of the VariablePolicy protocol. + @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect. + @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name. + Otherwise, will create a policy that targets an entire namespace. + @param[in] MinSize MinSize for the VariablePolicy. + @param[in] MaxSize MaxSize for the VariablePolicy. + @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy. + @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy. + @param[in] LockPolicyType LockPolicyType for the VariablePolicy. + + @retval EFI_INVALID_PARAMETER VariablePolicy pointer is NULL. + @retval EFI_STATUS Status returned by CreateBasicVariablePolicy() or RegisterVariablePolicy(). + +**/ +EFI_STATUS +EFIAPI +RegisterBasicVariablePolicy ( + IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy, + IN CONST EFI_GUID *Namespace, + IN CONST CHAR16 *Name OPTIONAL, + IN UINT32 MinSize, + IN UINT32 MaxSize, + IN UINT32 AttributesMustHave, + IN UINT32 AttributesCantHave, + IN UINT8 LockPolicyType + ); + +/** + This helper function does everything that CreateBasicVariablePolicy() does, but also + uses the passed in protocol to register the policy with the infrastructure. + Does not return a buffer, does not require the caller to free anything. + + @param[in] VariablePolicy Pointer to a valid instance of the VariablePolicy protocol. + @param[in] Namespace Pointer to an EFI_GUID for the target variable namespace that this policy will protect. + @param[in] Name [Optional] If provided, a pointer to the CHAR16 array for the target variable name. + Otherwise, will create a policy that targets an entire namespace. + @param[in] MinSize MinSize for the VariablePolicy. + @param[in] MaxSize MaxSize for the VariablePolicy. + @param[in] AttributesMustHave AttributesMustHave for the VariablePolicy. + @param[in] AttributesCantHave AttributesCantHave for the VariablePolicy. + @param[in] VarStateNamespace Pointer to the EFI_GUID for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Namespace. + @param[in] VarStateName Pointer to the CHAR16 array for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Name. + @param[in] VarStateValue Value for the VARIABLE_LOCK_ON_VAR_STATE_POLICY.Value. + + @retval EFI_INVALID_PARAMETER VariablePolicy pointer is NULL. + @retval EFI_STATUS Status returned by CreateBasicVariablePolicy() or RegisterVariablePolicy(). + +**/ +EFI_STATUS +EFIAPI +RegisterVarStateVariablePolicy ( + IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy, + IN CONST EFI_GUID *Namespace, + IN CONST CHAR16 *Name OPTIONAL, + IN UINT32 MinSize, + IN UINT32 MaxSize, + IN UINT32 AttributesMustHave, + IN UINT32 AttributesCantHave, + IN CONST EFI_GUID *VarStateNamespace, + IN CONST CHAR16 *VarStateName, + IN UINT8 VarStateValue + ); + +#endif // _EDKII_VARIABLE_POLICY_HELPER_LIB_H_ diff --git a/MdeModulePkg/Include/Library/VariablePolicyLib.h b/MdeModulePkg/Include/Library/VariablePolicyLib.h index bc4e26b2d4..39cbda4084 100644 --- a/MdeModulePkg/Include/Library/VariablePolicyLib.h +++ b/MdeModulePkg/Include/Library/VariablePolicyLib.h @@ -1,304 +1,304 @@ -/** @file -- VariablePolicyLib.h
-Business logic for Variable Policy enforcement.
-
-Copyright (c) Microsoft Corporation.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _VARIABLE_POLICY_LIB_H_
-#define _VARIABLE_POLICY_LIB_H_
-
-#include <Protocol/VariablePolicy.h>
-
-/**
- This API function validates and registers a new policy with
- the policy enforcement engine.
-
- @param[in] NewPolicy Pointer to the incoming policy structure.
-
- @retval EFI_SUCCESS
- @retval EFI_INVALID_PARAMETER NewPolicy is NULL or is internally inconsistent.
- @retval EFI_ALREADY_STARTED An identical matching policy already exists.
- @retval EFI_WRITE_PROTECTED The interface has been locked until the next reboot.
- @retval EFI_UNSUPPORTED Policy enforcement has been disabled. No reason to add more policies.
- @retval EFI_ABORTED A calculation error has prevented this function from completing.
- @retval EFI_OUT_OF_RESOURCES Cannot grow the table to hold any more policies.
- @retval EFI_NOT_READY Library has not yet been initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-RegisterVariablePolicy (
- IN CONST VARIABLE_POLICY_ENTRY *NewPolicy
- );
-
-/**
- This API function checks to see whether the parameters to SetVariable would
- be allowed according to the current variable policies.
-
- @param[in] VariableName Same as EFI_SET_VARIABLE.
- @param[in] VendorGuid Same as EFI_SET_VARIABLE.
- @param[in] Attributes Same as EFI_SET_VARIABLE.
- @param[in] DataSize Same as EFI_SET_VARIABLE.
- @param[in] Data Same as EFI_SET_VARIABLE.
-
- @retval EFI_SUCCESS A matching policy allows this update.
- @retval EFI_SUCCESS There are currently no policies that restrict this update.
- @retval EFI_SUCCESS The protections have been disable until the next reboot.
- @retval EFI_WRITE_PROTECTED Variable is currently locked.
- @retval EFI_INVALID_PARAMETER Attributes or size are invalid.
- @retval EFI_ABORTED A lock policy exists, but an error prevented evaluation.
- @retval EFI_NOT_READY Library has not been initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-ValidateSetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data
- );
-
-/**
- This API function disables the variable policy enforcement. If it's
- already been called once, will return EFI_ALREADY_STARTED.
-
- @retval EFI_SUCCESS
- @retval EFI_ALREADY_STARTED Has already been called once this boot.
- @retval EFI_WRITE_PROTECTED Interface has been locked until reboot.
- @retval EFI_WRITE_PROTECTED Interface option is disabled by platform PCD.
- @retval EFI_NOT_READY Library has not yet been initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-DisableVariablePolicy (
- VOID
- );
-
-/**
- This API function will dump the entire contents of the variable policy table.
-
- Similar to GetVariable, the first call can be made with a 0 size and it will return
- the size of the buffer required to hold the entire table.
-
- @param[out] Policy Pointer to the policy buffer. Can be NULL if Size is 0.
- @param[in,out] Size On input, the size of the output buffer. On output, the size
- of the data returned.
-
- @retval EFI_SUCCESS Policy data is in the output buffer and Size has been updated.
- @retval EFI_INVALID_PARAMETER Size is NULL, or Size is non-zero and Policy is NULL.
- @retval EFI_BUFFER_TOO_SMALL Size is insufficient to hold policy. Size updated with required size.
- @retval EFI_NOT_READY Library has not yet been initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-DumpVariablePolicy (
- OUT UINT8 *Policy,
- IN OUT UINT32 *Size
- );
-
-/**
- This function will return variable policy information for a UEFI variable with a
- registered variable policy.
-
- @param[in] VariableName The name of the variable to use for the policy search.
- @param[in] VendorGuid The vendor GUID of the variable to use for the policy search.
- @param[in,out] VariablePolicyVariableNameBufferSize On input, the size, in bytes, of the VariablePolicyVariableName
- buffer.
-
- On output, the size, in bytes, needed to store the variable
- policy variable name.
-
- If testing for the VariablePolicyVariableName buffer size
- needed, set this value to zero so EFI_BUFFER_TOO_SMALL is
- guaranteed to be returned if the variable policy variable name
- is found.
- @param[out] VariablePolicy Pointer to a buffer where the policy entry will be written
- if found.
- @param[out] VariablePolicyVariableName Pointer to a buffer where the variable name used for the
- variable policy will be written if a variable name is
- registered.
-
- If the variable policy is not associated with a variable name
- (e.g. applied to variable vendor namespace) and this parameter
- is given, this parameter will not be modified and
- VariablePolicyVariableNameBufferSize will be set to zero to
- indicate a name was not present.
-
- If the pointer given is not NULL,
- VariablePolicyVariableNameBufferSize must be non-NULL.
-
- @retval EFI_SUCCESS A variable policy entry was found and returned successfully.
- @retval EFI_BAD_BUFFER_SIZE An internal buffer size caused a calculation error.
- @retval EFI_BUFFER_TOO_SMALL The VariablePolicyVariableName buffer value is too small for the size needed.
- The buffer should now point to the size needed.
- @retval EFI_NOT_READY Variable policy has not yet been initialized.
- @retval EFI_INVALID_PARAMETER A required pointer argument passed is NULL. This will be returned if
- VariablePolicyVariableName is non-NULL and VariablePolicyVariableNameBufferSize
- is NULL.
- @retval EFI_NOT_FOUND A variable policy was not found for the given UEFI variable name and vendor GUID.
-
-**/
-EFI_STATUS
-EFIAPI
-GetVariablePolicyInfo (
- IN CONST CHAR16 *VariableName,
- IN CONST EFI_GUID *VendorGuid,
- IN OUT UINTN *VariablePolicyVariableNameBufferSize OPTIONAL,
- OUT VARIABLE_POLICY_ENTRY *VariablePolicy,
- OUT CHAR16 *VariablePolicyVariableName OPTIONAL
- );
-
-/**
- This function will return the Lock on Variable State policy information for the policy
- associated with the given UEFI variable.
-
- @param[in] VariableName The name of the variable to use for the policy search.
- @param[in] VendorGuid The vendor GUID of the variable to use for the policy
- search.
- @param[in,out] VariableLockPolicyVariableNameBufferSize On input, the size, in bytes, of the
- VariableLockPolicyVariableName buffer.
-
- On output, the size, in bytes, needed to store the variable
- policy variable name.
-
- If testing for the VariableLockPolicyVariableName buffer
- size needed, set this value to zero so EFI_BUFFER_TOO_SMALL
- is guaranteed to be returned if the variable policy variable
- name is found.
- @param[out] VariablePolicy Pointer to a buffer where the policy entry will be written
- if found.
- @param[out] VariableLockPolicyVariableName Pointer to a buffer where the variable name used for the
- variable lock on variable state policy will be written if
- a variable name is registered.
-
- If the lock on variable policy is not associated with a
- variable name (e.g. applied to variable vendor namespace)
- and this parameter is given, this parameter will not be
- modified and VariableLockPolicyVariableNameBufferSize will
- be set to zero to indicate a name was not present.
-
- If the pointer given is not NULL,
- VariableLockPolicyVariableNameBufferSize must be non-NULL.
-
- @retval EFI_SUCCESS A Lock on Variable State variable policy entry was found and returned
- successfully.
- @retval EFI_BAD_BUFFER_SIZE An internal buffer size caused a calculation error.
- @retval EFI_BUFFER_TOO_SMALL The VariableLockPolicyVariableName buffer is too small for the size needed.
- The buffer should now point to the size needed.
- @retval EFI_NOT_READY Variable policy has not yet been initialized.
- @retval EFI_INVALID_PARAMETER A required pointer argument passed is NULL. This will be returned if
- VariableLockPolicyVariableName is non-NULL and
- VariableLockPolicyVariableNameBufferSize is NULL.
- @retval EFI_NOT_FOUND A Lock on Variable State variable policy was not found for the given UEFI
- variable name and vendor GUID.
-
-**/
-EFI_STATUS
-EFIAPI
-GetLockOnVariableStateVariablePolicyInfo (
- IN CONST CHAR16 *VariableName,
- IN CONST EFI_GUID *VendorGuid,
- IN OUT UINTN *VariableLockPolicyVariableNameBufferSize OPTIONAL,
- OUT VARIABLE_LOCK_ON_VAR_STATE_POLICY *VariablePolicy,
- OUT CHAR16 *VariableLockPolicyVariableName OPTIONAL
- );
-
-/**
- This API function returns whether or not the policy engine is
- currently being enforced.
-
- @retval TRUE
- @retval FALSE
- @retval FALSE Library has not yet been initialized.
-
-**/
-BOOLEAN
-EFIAPI
-IsVariablePolicyEnabled (
- VOID
- );
-
-/**
- This API function locks the interface so that no more policy updates
- can be performed or changes made to the enforcement until the next boot.
-
- @retval EFI_SUCCESS
- @retval EFI_NOT_READY Library has not yet been initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-LockVariablePolicy (
- VOID
- );
-
-/**
- This API function returns whether or not the policy interface is locked
- for the remainder of the boot.
-
- @retval TRUE
- @retval FALSE
- @retval FALSE Library has not yet been initialized.
-
-**/
-BOOLEAN
-EFIAPI
-IsVariablePolicyInterfaceLocked (
- VOID
- );
-
-/**
- This helper function initializes the library and sets
- up any required internal structures or handlers.
-
- Also registers the internal pointer for the GetVariable helper.
-
- @param[in] GetVariableHelper A function pointer matching the EFI_GET_VARIABLE prototype that will be used to
- check policy criteria that involve the existence of other variables.
-
- @retval EFI_SUCCESS
- @retval EFI_ALREADY_STARTED The initialize function has been called more than once without a call to
- deinitialize.
-
-**/
-EFI_STATUS
-EFIAPI
-InitVariablePolicyLib (
- IN EFI_GET_VARIABLE GetVariableHelper
- );
-
-/**
- This helper function returns whether or not the library is currently initialized.
-
- @retval TRUE
- @retval FALSE
-
-**/
-BOOLEAN
-EFIAPI
-IsVariablePolicyLibInitialized (
- VOID
- );
-
-/**
- This helper function tears down the library.
-
- Should generally only be used for test harnesses.
-
- @retval EFI_SUCCESS
- @retval EFI_NOT_READY Deinitialize was called without first calling initialize.
-
-**/
-EFI_STATUS
-EFIAPI
-DeinitVariablePolicyLib (
- VOID
- );
-
-#endif // _VARIABLE_POLICY_LIB_H_
+/** @file -- VariablePolicyLib.h +Business logic for Variable Policy enforcement. + +Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _VARIABLE_POLICY_LIB_H_ +#define _VARIABLE_POLICY_LIB_H_ + +#include <Protocol/VariablePolicy.h> + +/** + This API function validates and registers a new policy with + the policy enforcement engine. + + @param[in] NewPolicy Pointer to the incoming policy structure. + + @retval EFI_SUCCESS + @retval EFI_INVALID_PARAMETER NewPolicy is NULL or is internally inconsistent. + @retval EFI_ALREADY_STARTED An identical matching policy already exists. + @retval EFI_WRITE_PROTECTED The interface has been locked until the next reboot. + @retval EFI_UNSUPPORTED Policy enforcement has been disabled. No reason to add more policies. + @retval EFI_ABORTED A calculation error has prevented this function from completing. + @retval EFI_OUT_OF_RESOURCES Cannot grow the table to hold any more policies. + @retval EFI_NOT_READY Library has not yet been initialized. + +**/ +EFI_STATUS +EFIAPI +RegisterVariablePolicy ( + IN CONST VARIABLE_POLICY_ENTRY *NewPolicy + ); + +/** + This API function checks to see whether the parameters to SetVariable would + be allowed according to the current variable policies. + + @param[in] VariableName Same as EFI_SET_VARIABLE. + @param[in] VendorGuid Same as EFI_SET_VARIABLE. + @param[in] Attributes Same as EFI_SET_VARIABLE. + @param[in] DataSize Same as EFI_SET_VARIABLE. + @param[in] Data Same as EFI_SET_VARIABLE. + + @retval EFI_SUCCESS A matching policy allows this update. + @retval EFI_SUCCESS There are currently no policies that restrict this update. + @retval EFI_SUCCESS The protections have been disable until the next reboot. + @retval EFI_WRITE_PROTECTED Variable is currently locked. + @retval EFI_INVALID_PARAMETER Attributes or size are invalid. + @retval EFI_ABORTED A lock policy exists, but an error prevented evaluation. + @retval EFI_NOT_READY Library has not been initialized. + +**/ +EFI_STATUS +EFIAPI +ValidateSetVariable ( + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + IN UINT32 Attributes, + IN UINTN DataSize, + IN VOID *Data + ); + +/** + This API function disables the variable policy enforcement. If it's + already been called once, will return EFI_ALREADY_STARTED. + + @retval EFI_SUCCESS + @retval EFI_ALREADY_STARTED Has already been called once this boot. + @retval EFI_WRITE_PROTECTED Interface has been locked until reboot. + @retval EFI_WRITE_PROTECTED Interface option is disabled by platform PCD. + @retval EFI_NOT_READY Library has not yet been initialized. + +**/ +EFI_STATUS +EFIAPI +DisableVariablePolicy ( + VOID + ); + +/** + This API function will dump the entire contents of the variable policy table. + + Similar to GetVariable, the first call can be made with a 0 size and it will return + the size of the buffer required to hold the entire table. + + @param[out] Policy Pointer to the policy buffer. Can be NULL if Size is 0. + @param[in,out] Size On input, the size of the output buffer. On output, the size + of the data returned. + + @retval EFI_SUCCESS Policy data is in the output buffer and Size has been updated. + @retval EFI_INVALID_PARAMETER Size is NULL, or Size is non-zero and Policy is NULL. + @retval EFI_BUFFER_TOO_SMALL Size is insufficient to hold policy. Size updated with required size. + @retval EFI_NOT_READY Library has not yet been initialized. + +**/ +EFI_STATUS +EFIAPI +DumpVariablePolicy ( + OUT UINT8 *Policy, + IN OUT UINT32 *Size + ); + +/** + This function will return variable policy information for a UEFI variable with a + registered variable policy. + + @param[in] VariableName The name of the variable to use for the policy search. + @param[in] VendorGuid The vendor GUID of the variable to use for the policy search. + @param[in,out] VariablePolicyVariableNameBufferSize On input, the size, in bytes, of the VariablePolicyVariableName + buffer. + + On output, the size, in bytes, needed to store the variable + policy variable name. + + If testing for the VariablePolicyVariableName buffer size + needed, set this value to zero so EFI_BUFFER_TOO_SMALL is + guaranteed to be returned if the variable policy variable name + is found. + @param[out] VariablePolicy Pointer to a buffer where the policy entry will be written + if found. + @param[out] VariablePolicyVariableName Pointer to a buffer where the variable name used for the + variable policy will be written if a variable name is + registered. + + If the variable policy is not associated with a variable name + (e.g. applied to variable vendor namespace) and this parameter + is given, this parameter will not be modified and + VariablePolicyVariableNameBufferSize will be set to zero to + indicate a name was not present. + + If the pointer given is not NULL, + VariablePolicyVariableNameBufferSize must be non-NULL. + + @retval EFI_SUCCESS A variable policy entry was found and returned successfully. + @retval EFI_BAD_BUFFER_SIZE An internal buffer size caused a calculation error. + @retval EFI_BUFFER_TOO_SMALL The VariablePolicyVariableName buffer value is too small for the size needed. + The buffer should now point to the size needed. + @retval EFI_NOT_READY Variable policy has not yet been initialized. + @retval EFI_INVALID_PARAMETER A required pointer argument passed is NULL. This will be returned if + VariablePolicyVariableName is non-NULL and VariablePolicyVariableNameBufferSize + is NULL. + @retval EFI_NOT_FOUND A variable policy was not found for the given UEFI variable name and vendor GUID. + +**/ +EFI_STATUS +EFIAPI +GetVariablePolicyInfo ( + IN CONST CHAR16 *VariableName, + IN CONST EFI_GUID *VendorGuid, + IN OUT UINTN *VariablePolicyVariableNameBufferSize OPTIONAL, + OUT VARIABLE_POLICY_ENTRY *VariablePolicy, + OUT CHAR16 *VariablePolicyVariableName OPTIONAL + ); + +/** + This function will return the Lock on Variable State policy information for the policy + associated with the given UEFI variable. + + @param[in] VariableName The name of the variable to use for the policy search. + @param[in] VendorGuid The vendor GUID of the variable to use for the policy + search. + @param[in,out] VariableLockPolicyVariableNameBufferSize On input, the size, in bytes, of the + VariableLockPolicyVariableName buffer. + + On output, the size, in bytes, needed to store the variable + policy variable name. + + If testing for the VariableLockPolicyVariableName buffer + size needed, set this value to zero so EFI_BUFFER_TOO_SMALL + is guaranteed to be returned if the variable policy variable + name is found. + @param[out] VariablePolicy Pointer to a buffer where the policy entry will be written + if found. + @param[out] VariableLockPolicyVariableName Pointer to a buffer where the variable name used for the + variable lock on variable state policy will be written if + a variable name is registered. + + If the lock on variable policy is not associated with a + variable name (e.g. applied to variable vendor namespace) + and this parameter is given, this parameter will not be + modified and VariableLockPolicyVariableNameBufferSize will + be set to zero to indicate a name was not present. + + If the pointer given is not NULL, + VariableLockPolicyVariableNameBufferSize must be non-NULL. + + @retval EFI_SUCCESS A Lock on Variable State variable policy entry was found and returned + successfully. + @retval EFI_BAD_BUFFER_SIZE An internal buffer size caused a calculation error. + @retval EFI_BUFFER_TOO_SMALL The VariableLockPolicyVariableName buffer is too small for the size needed. + The buffer should now point to the size needed. + @retval EFI_NOT_READY Variable policy has not yet been initialized. + @retval EFI_INVALID_PARAMETER A required pointer argument passed is NULL. This will be returned if + VariableLockPolicyVariableName is non-NULL and + VariableLockPolicyVariableNameBufferSize is NULL. + @retval EFI_NOT_FOUND A Lock on Variable State variable policy was not found for the given UEFI + variable name and vendor GUID. + +**/ +EFI_STATUS +EFIAPI +GetLockOnVariableStateVariablePolicyInfo ( + IN CONST CHAR16 *VariableName, + IN CONST EFI_GUID *VendorGuid, + IN OUT UINTN *VariableLockPolicyVariableNameBufferSize OPTIONAL, + OUT VARIABLE_LOCK_ON_VAR_STATE_POLICY *VariablePolicy, + OUT CHAR16 *VariableLockPolicyVariableName OPTIONAL + ); + +/** + This API function returns whether or not the policy engine is + currently being enforced. + + @retval TRUE + @retval FALSE + @retval FALSE Library has not yet been initialized. + +**/ +BOOLEAN +EFIAPI +IsVariablePolicyEnabled ( + VOID + ); + +/** + This API function locks the interface so that no more policy updates + can be performed or changes made to the enforcement until the next boot. + + @retval EFI_SUCCESS + @retval EFI_NOT_READY Library has not yet been initialized. + +**/ +EFI_STATUS +EFIAPI +LockVariablePolicy ( + VOID + ); + +/** + This API function returns whether or not the policy interface is locked + for the remainder of the boot. + + @retval TRUE + @retval FALSE + @retval FALSE Library has not yet been initialized. + +**/ +BOOLEAN +EFIAPI +IsVariablePolicyInterfaceLocked ( + VOID + ); + +/** + This helper function initializes the library and sets + up any required internal structures or handlers. + + Also registers the internal pointer for the GetVariable helper. + + @param[in] GetVariableHelper A function pointer matching the EFI_GET_VARIABLE prototype that will be used to + check policy criteria that involve the existence of other variables. + + @retval EFI_SUCCESS + @retval EFI_ALREADY_STARTED The initialize function has been called more than once without a call to + deinitialize. + +**/ +EFI_STATUS +EFIAPI +InitVariablePolicyLib ( + IN EFI_GET_VARIABLE GetVariableHelper + ); + +/** + This helper function returns whether or not the library is currently initialized. + + @retval TRUE + @retval FALSE + +**/ +BOOLEAN +EFIAPI +IsVariablePolicyLibInitialized ( + VOID + ); + +/** + This helper function tears down the library. + + Should generally only be used for test harnesses. + + @retval EFI_SUCCESS + @retval EFI_NOT_READY Deinitialize was called without first calling initialize. + +**/ +EFI_STATUS +EFIAPI +DeinitVariablePolicyLib ( + VOID + ); + +#endif // _VARIABLE_POLICY_LIB_H_ |
