]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Library/QemuFwCfgS3Lib/QemuFwCfgS3Pei.c
OvmfPkg/QemuFwCfgS3Lib: Fix VS tool chain build failure
[mirror_edk2.git] / OvmfPkg / Library / QemuFwCfgS3Lib / QemuFwCfgS3Pei.c
CommitLineData
da58d987
LE
1/** @file\r
2 Limited functionality QemuFwCfgS3Lib instance, for PEI phase modules.\r
3\r
4 QemuFwCfgS3Enabled() queries S3 enablement via fw_cfg. Other library APIs\r
5 will report lack of support.\r
6\r
7 Copyright (C) 2017, Red Hat, Inc.\r
8\r
9 This program and the accompanying materials are licensed and made available\r
10 under the terms and conditions of the BSD License which accompanies this\r
11 distribution. The full text of the license may be found at\r
12 http://opensource.org/licenses/bsd-license.php\r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
15 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16**/\r
17\r
18#include <Library/QemuFwCfgS3Lib.h>\r
19\r
20/**\r
21 Install the client module's FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION callback for\r
22 when the production of ACPI S3 Boot Script opcodes becomes possible.\r
23\r
24 Take ownership of the client-provided Context, and pass it to the callback\r
25 function, when the latter is invoked.\r
26\r
27 Allocate scratch space for those ACPI S3 Boot Script opcodes to work upon\r
28 that the client will produce in the callback function.\r
29\r
30 @param[in] Callback FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION to invoke\r
31 when the production of ACPI S3 Boot Script\r
32 opcodes becomes possible. Callback() may be\r
33 called immediately from\r
34 QemuFwCfgS3CallWhenBootScriptReady().\r
35\r
36 @param[in,out] Context Client-provided data structure for the\r
37 Callback() callback function to consume.\r
38\r
39 If Context points to dynamically allocated\r
40 memory, then Callback() must release it.\r
41\r
42 If Context points to dynamically allocated\r
43 memory, and\r
44 QemuFwCfgS3CallWhenBootScriptReady() returns\r
45 successfully, then the caller of\r
46 QemuFwCfgS3CallWhenBootScriptReady() must\r
47 neither dereference nor even evaluate Context\r
48 any longer, as ownership of the referenced area\r
49 has been transferred to Callback().\r
50\r
51 @param[in] ScratchBufferSize The size of the scratch buffer that will hold,\r
52 in reserved memory, all client data read,\r
53 written, and checked by the ACPI S3 Boot Script\r
54 opcodes produced by Callback().\r
55\r
56 @retval RETURN_UNSUPPORTED The library instance does not support this\r
57 function.\r
58\r
59 @retval RETURN_NOT_FOUND The fw_cfg DMA interface to QEMU is\r
60 unavailable.\r
61\r
62 @retval RETURN_BAD_BUFFER_SIZE ScratchBufferSize is too large.\r
63\r
64 @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.\r
65\r
66 @retval RETURN_SUCCESS Callback() has been installed, and the\r
67 ownership of Context has been transferred.\r
68 Reserved memory has been allocated for the\r
69 scratch buffer.\r
70\r
71 A successful invocation of\r
72 QemuFwCfgS3CallWhenBootScriptReady() cannot\r
73 be rolled back.\r
74\r
75 @return Error codes from underlying functions.\r
76**/\r
da58d987 77RETURN_STATUS\r
08bed3fb 78EFIAPI\r
da58d987
LE
79QemuFwCfgS3CallWhenBootScriptReady (\r
80 IN FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION *Callback,\r
81 IN OUT VOID *Context, OPTIONAL\r
82 IN UINTN ScratchBufferSize\r
83 )\r
84{\r
85 return RETURN_UNSUPPORTED;\r
86}\r