2 Base Null library instance of the QemuFwCfgS3Lib class.
4 This library instance returns constant FALSE from QemuFwCfgS3Enabled(), and
5 all other library functions trigger assertion failures. It is suitable for
6 QEMU targets and machine types that never enable S3.
8 Copyright (C) 2017, Red Hat, Inc.
10 SPDX-License-Identifier: BSD-2-Clause-Patent
13 #include <Library/DebugLib.h>
14 #include <Library/QemuFwCfgS3Lib.h>
17 Determine if S3 support is explicitly enabled.
19 @retval TRUE If S3 support is explicitly enabled. Other functions in this
20 library may be called (subject to their individual
23 FALSE Otherwise. This includes unavailability of the firmware
24 configuration interface. No other function in this library
38 Install the client module's FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION callback for
39 when the production of ACPI S3 Boot Script opcodes becomes possible.
41 Take ownership of the client-provided Context, and pass it to the callback
42 function, when the latter is invoked.
44 Allocate scratch space for those ACPI S3 Boot Script opcodes to work upon
45 that the client will produce in the callback function.
47 @param[in] Callback FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION to invoke
48 when the production of ACPI S3 Boot Script
49 opcodes becomes possible. Callback() may be
50 called immediately from
51 QemuFwCfgS3CallWhenBootScriptReady().
53 @param[in,out] Context Client-provided data structure for the
54 Callback() callback function to consume.
56 If Context points to dynamically allocated
57 memory, then Callback() must release it.
59 If Context points to dynamically allocated
61 QemuFwCfgS3CallWhenBootScriptReady() returns
62 successfully, then the caller of
63 QemuFwCfgS3CallWhenBootScriptReady() must
64 neither dereference nor even evaluate Context
65 any longer, as ownership of the referenced area
66 has been transferred to Callback().
68 @param[in] ScratchBufferSize The size of the scratch buffer that will hold,
69 in reserved memory, all client data read,
70 written, and checked by the ACPI S3 Boot Script
71 opcodes produced by Callback().
73 @retval RETURN_UNSUPPORTED The library instance does not support this
76 @retval RETURN_NOT_FOUND The fw_cfg DMA interface to QEMU is
79 @retval RETURN_BAD_BUFFER_SIZE ScratchBufferSize is too large.
81 @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.
83 @retval RETURN_SUCCESS Callback() has been installed, and the
84 ownership of Context has been transferred.
85 Reserved memory has been allocated for the
88 A successful invocation of
89 QemuFwCfgS3CallWhenBootScriptReady() cannot
92 @return Error codes from underlying functions.
97 QemuFwCfgS3CallWhenBootScriptReady (
98 IN FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION
*Callback
,
99 IN OUT VOID
*Context OPTIONAL
,
100 IN UINTN ScratchBufferSize
104 return RETURN_UNSUPPORTED
;