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 This program and the accompanying materials are licensed and made available
11 under the terms and conditions of the BSD License which accompanies this
12 distribution. The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
16 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #include <Library/DebugLib.h>
20 #include <Library/QemuFwCfgS3Lib.h>
23 Determine if S3 support is explicitly enabled.
25 @retval TRUE If S3 support is explicitly enabled. Other functions in this
26 library may be called (subject to their individual
29 FALSE Otherwise. This includes unavailability of the firmware
30 configuration interface. No other function in this library
44 Install the client module's FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION callback for
45 when the production of ACPI S3 Boot Script opcodes becomes possible.
47 Take ownership of the client-provided Context, and pass it to the callback
48 function, when the latter is invoked.
50 Allocate scratch space for those ACPI S3 Boot Script opcodes to work upon
51 that the client will produce in the callback function.
53 @param[in] Callback FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION to invoke
54 when the production of ACPI S3 Boot Script
55 opcodes becomes possible. Callback() may be
56 called immediately from
57 QemuFwCfgS3CallWhenBootScriptReady().
59 @param[in,out] Context Client-provided data structure for the
60 Callback() callback function to consume.
62 If Context points to dynamically allocated
63 memory, then Callback() must release it.
65 If Context points to dynamically allocated
67 QemuFwCfgS3CallWhenBootScriptReady() returns
68 successfully, then the caller of
69 QemuFwCfgS3CallWhenBootScriptReady() must
70 neither dereference nor even evaluate Context
71 any longer, as ownership of the referenced area
72 has been transferred to Callback().
74 @param[in] ScratchBufferSize The size of the scratch buffer that will hold,
75 in reserved memory, all client data read,
76 written, and checked by the ACPI S3 Boot Script
77 opcodes produced by Callback().
79 @retval RETURN_UNSUPPORTED The library instance does not support this
82 @retval RETURN_NOT_FOUND The fw_cfg DMA interface to QEMU is
85 @retval RETURN_BAD_BUFFER_SIZE ScratchBufferSize is too large.
87 @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.
89 @retval RETURN_SUCCESS Callback() has been installed, and the
90 ownership of Context has been transferred.
91 Reserved memory has been allocated for the
94 A successful invocation of
95 QemuFwCfgS3CallWhenBootScriptReady() cannot
98 @return Error codes from underlying functions.
103 QemuFwCfgS3CallWhenBootScriptReady (
104 IN FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION
*Callback
,
105 IN OUT VOID
*Context
, OPTIONAL
106 IN UINTN ScratchBufferSize
110 return RETURN_UNSUPPORTED
;