OvmfPkg/QemuFwCfgS3Lib: implement opcode APIs for Base Null instance
In the Base Null instance: - QemuFwCfgS3Enabled() returns constant FALSE. This is unique to the Base Null instance, and the function is already present in "QemuFwCfgS3Base.c". - The QemuFwCfgS3CallWhenBootScriptReady() function must never be called (according to the documentation, given the above). This is also unique to the Base Null instance, so implement the function in "QemuFwCfgS3Base.c". - Consequently, the QemuFwCfgS3ScriptWriteBytes(), QemuFwCfgS3ScriptReadBytes(), QemuFwCfgS3ScriptSkipBytes(), and QemuFwCfgS3ScriptCheckValue() functions must never be called either. This behavior is not unique to the Base Null instance (it will be shared with the PEI fw_cfg instance), so add these functions to "QemuFwCfgS3BasePei.c". Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=394 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
**/
|
||||
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/QemuFwCfgS3Lib.h>
|
||||
|
||||
/**
|
||||
@@ -37,3 +38,73 @@ QemuFwCfgS3Enabled (
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@param[in] Callback FW_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().
|
||||
|
||||
@param[in,out] Context Client-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().
|
||||
|
||||
@param[in] ScratchBufferSize The 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().
|
||||
|
||||
@retval RETURN_UNSUPPORTED The library instance does not support this
|
||||
function.
|
||||
|
||||
@retval RETURN_NOT_FOUND The fw_cfg DMA interface to QEMU is
|
||||
unavailable.
|
||||
|
||||
@retval RETURN_BAD_BUFFER_SIZE ScratchBufferSize is too large.
|
||||
|
||||
@retval RETURN_OUT_OF_RESOURCES Memory allocation failed.
|
||||
|
||||
@retval RETURN_SUCCESS Callback() 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.
|
||||
|
||||
@return Error codes from underlying functions.
|
||||
**/
|
||||
EFIAPI
|
||||
RETURN_STATUS
|
||||
QemuFwCfgS3CallWhenBootScriptReady (
|
||||
IN FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION *Callback,
|
||||
IN OUT VOID *Context, OPTIONAL
|
||||
IN UINTN ScratchBufferSize
|
||||
)
|
||||
{
|
||||
ASSERT (FALSE);
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
Reference in New Issue
Block a user