]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Library/QemuFwCfgS3Lib/QemuFwCfgS3Base.c
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / Library / QemuFwCfgS3Lib / QemuFwCfgS3Base.c
1 /** @file
2 Base Null library instance of the QemuFwCfgS3Lib class.
3
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.
7
8 Copyright (C) 2017, Red Hat, Inc.
9
10 SPDX-License-Identifier: BSD-2-Clause-Patent
11 **/
12
13 #include <Library/DebugLib.h>
14 #include <Library/QemuFwCfgS3Lib.h>
15
16 /**
17 Determine if S3 support is explicitly enabled.
18
19 @retval TRUE If S3 support is explicitly enabled. Other functions in this
20 library may be called (subject to their individual
21 restrictions).
22
23 FALSE Otherwise. This includes unavailability of the firmware
24 configuration interface. No other function in this library
25 must be called.
26 **/
27 BOOLEAN
28 EFIAPI
29 QemuFwCfgS3Enabled (
30 VOID
31 )
32 {
33 return FALSE;
34 }
35
36 /**
37 Install the client module's FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION callback for
38 when the production of ACPI S3 Boot Script opcodes becomes possible.
39
40 Take ownership of the client-provided Context, and pass it to the callback
41 function, when the latter is invoked.
42
43 Allocate scratch space for those ACPI S3 Boot Script opcodes to work upon
44 that the client will produce in the callback function.
45
46 @param[in] Callback FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION to invoke
47 when the production of ACPI S3 Boot Script
48 opcodes becomes possible. Callback() may be
49 called immediately from
50 QemuFwCfgS3CallWhenBootScriptReady().
51
52 @param[in,out] Context Client-provided data structure for the
53 Callback() callback function to consume.
54
55 If Context points to dynamically allocated
56 memory, then Callback() must release it.
57
58 If Context points to dynamically allocated
59 memory, and
60 QemuFwCfgS3CallWhenBootScriptReady() returns
61 successfully, then the caller of
62 QemuFwCfgS3CallWhenBootScriptReady() must
63 neither dereference nor even evaluate Context
64 any longer, as ownership of the referenced area
65 has been transferred to Callback().
66
67 @param[in] ScratchBufferSize The size of the scratch buffer that will hold,
68 in reserved memory, all client data read,
69 written, and checked by the ACPI S3 Boot Script
70 opcodes produced by Callback().
71
72 @retval RETURN_UNSUPPORTED The library instance does not support this
73 function.
74
75 @retval RETURN_NOT_FOUND The fw_cfg DMA interface to QEMU is
76 unavailable.
77
78 @retval RETURN_BAD_BUFFER_SIZE ScratchBufferSize is too large.
79
80 @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.
81
82 @retval RETURN_SUCCESS Callback() has been installed, and the
83 ownership of Context has been transferred.
84 Reserved memory has been allocated for the
85 scratch buffer.
86
87 A successful invocation of
88 QemuFwCfgS3CallWhenBootScriptReady() cannot
89 be rolled back.
90
91 @return Error codes from underlying functions.
92 **/
93 RETURN_STATUS
94 EFIAPI
95 QemuFwCfgS3CallWhenBootScriptReady (
96 IN FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION *Callback,
97 IN OUT VOID *Context OPTIONAL,
98 IN UINTN ScratchBufferSize
99 )
100 {
101 ASSERT (FALSE);
102 return RETURN_UNSUPPORTED;
103 }