TianoCore EDK2 master
Loading...
Searching...
No Matches
QemuFwCfgS3Base.c File Reference

Go to the source code of this file.

Functions

BOOLEAN EFIAPI QemuFwCfgS3Enabled (VOID)
 
RETURN_STATUS EFIAPI QemuFwCfgS3CallWhenBootScriptReady (IN FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION *Callback, IN OUT VOID *Context OPTIONAL, IN UINTN ScratchBufferSize)
 

Detailed Description

Base Null library instance of the QemuFwCfgS3Lib class.

This library instance returns constant FALSE from QemuFwCfgS3Enabled(), and all other library functions trigger assertion failures. It is suitable for QEMU targets and machine types that never enable S3.

Copyright (C) 2017, Red Hat, Inc.

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

Definition in file QemuFwCfgS3Base.c.

Function Documentation

◆ QemuFwCfgS3CallWhenBootScriptReady()

RETURN_STATUS EFIAPI QemuFwCfgS3CallWhenBootScriptReady ( IN FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION *  Callback,
IN OUT VOID *Context  OPTIONAL,
IN UINTN  ScratchBufferSize 
)

Install the client module's FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION callback for when the production of ACPI S3 Boot Script opcodes becomes possible.

Take ownership of the client-provided Context, and pass it to the callback function, when the latter is invoked.

Allocate scratch space for those ACPI S3 Boot Script opcodes to work upon that the client will produce in the callback function.

Parameters
[in]CallbackFW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION to invoke when the production of ACPI S3 Boot Script opcodes becomes possible. Callback() may be called immediately from QemuFwCfgS3CallWhenBootScriptReady().
[in,out]ContextClient-provided data structure for the Callback() callback function to consume.

If Context points to dynamically allocated memory, then Callback() must release it.

If Context points to dynamically allocated memory, and QemuFwCfgS3CallWhenBootScriptReady() returns successfully, then the caller of QemuFwCfgS3CallWhenBootScriptReady() must neither dereference nor even evaluate Context any longer, as ownership of the referenced area has been transferred to Callback().

Parameters
[in]ScratchBufferSizeThe size of the scratch buffer that will hold, in reserved memory, all client data read, written, and checked by the ACPI S3 Boot Script opcodes produced by Callback().
Return values
RETURN_UNSUPPORTEDThe library instance does not support this function.
RETURN_NOT_FOUNDThe fw_cfg DMA interface to QEMU is unavailable.
RETURN_BAD_BUFFER_SIZEScratchBufferSize is too large.
RETURN_OUT_OF_RESOURCESMemory allocation failed.
RETURN_SUCCESSCallback() has been installed, and the ownership of Context has been transferred. Reserved memory has been allocated for the scratch buffer.

A successful invocation of QemuFwCfgS3CallWhenBootScriptReady() cannot be rolled back.

Returns
Error codes from underlying functions.

Definition at line 95 of file QemuFwCfgS3Base.c.

◆ QemuFwCfgS3Enabled()

BOOLEAN EFIAPI QemuFwCfgS3Enabled ( VOID  )

Determine if S3 support is explicitly enabled.

Return values
TRUEIf S3 support is explicitly enabled. Other functions in this library may be called (subject to their individual restrictions).

FALSE Otherwise. This includes unavailability of the firmware configuration interface. No other function in this library must be called.

Definition at line 29 of file QemuFwCfgS3Base.c.