TianoCore EDK2 master
Loading...
Searching...
No Matches
ResetUtility.c File Reference
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/ResetSystemLib.h>

Go to the source code of this file.

Data Structures

struct  RESET_UTILITY_GUID_SPECIFIC_RESET_DATA
 

Functions

 STATIC_ASSERT (sizeof(RESET_UTILITY_GUID_SPECIFIC_RESET_DATA)==18, "sizeof (RESET_UTILITY_GUID_SPECIFIC_RESET_DATA) is expected to be 18 bytes")
 
VOID EFIAPI ResetSystemWithSubtype (IN EFI_RESET_TYPE ResetType, IN CONST GUID *ResetSubtype)
 
VOID EFIAPI ResetPlatformSpecificGuid (IN CONST GUID *ResetSubtype)
 
GUID *EFIAPI GetResetPlatformSpecificGuid (IN UINTN DataSize, IN CONST VOID *ResetData)
 
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)
 

Detailed Description

This contains the business logic for the module-specific Reset Helper functions.

Copyright (c) 2017 - 2019 Intel Corporation. All rights reserved.
Copyright (c) 2016 Microsoft Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file ResetUtility.c.

Function Documentation

◆ BuildResetData()

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 
)

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.

Parameters
[in,out]ResetDataSizeOn input, the size of the ResetData buffer. On output, either the total number of bytes copied, or the required buffer size.
[in,out]ResetDataA pointer to the buffer in which to place the final structure.
[in]ResetSubtypePointer to the GUID specific subtype. This parameter is optional and may be NULL.
[in]ResetStringPointer to a Null-terminated Unicode string that describes the reset. This parameter is optional and may be NULL.
[in]ExtraDataSizeThe size, in bytes, of ExtraData buffer.
[in]ExtraDataPointer to a buffer of extra data. This parameter is optional and may be NULL.
Return values
RETURN_SUCCESSResetDataSize and ResetData are updated.
RETURN_INVALID_PARAMETERResetDataSize is NULL.
RETURN_INVALID_PARAMETERResetData is NULL.
RETURN_INVALID_PARAMETERExtraData was provided without a ResetSubtype. This is not supported by the UEFI spec.
RETURN_BUFFER_TOO_SMALLAn insufficient buffer was provided. ResetDataSize is updated with minimum size required.

Definition at line 177 of file ResetUtility.c.

◆ GetResetPlatformSpecificGuid()

GUID *EFIAPI GetResetPlatformSpecificGuid ( IN UINTN  DataSize,
IN CONST VOID *  ResetData 
)

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.

Parameters
[in]DataSizeThe size, in bytes, of ResetData.
[in]ResetDataPointer to the data buffer passed into ResetSystem().
Return values
PointerPointer to the GUID value in ResetData.
NULLResetData is NULL.
NULLResetData does not start with a Null-terminated Unicode string.
NULLA Null-terminated Unicode string is present, but there are less than sizeof (GUID) bytes after the string.
NULLNo subtype is found.

Definition at line 108 of file ResetUtility.c.

◆ ResetPlatformSpecificGuid()

VOID EFIAPI ResetPlatformSpecificGuid ( 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.

Parameters
[in]ResetSubtypeGUID pointer for the reset subtype to be used.

Definition at line 81 of file ResetUtility.c.

◆ ResetSystemWithSubtype()

VOID EFIAPI ResetSystemWithSubtype ( IN EFI_RESET_TYPE  ResetType,
IN CONST GUID ResetSubtype 
)

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.

Parameters
[in]ResetTypeThe default EFI_RESET_TYPE of the reset.
[in]ResetSubtypeGUID pointer for the reset subtype to be used.

Definition at line 47 of file ResetUtility.c.