1 | /** @file
|
---|
2 | Limited functionality QemuFwCfgS3Lib instance, for PEI phase modules.
|
---|
3 |
|
---|
4 | QemuFwCfgS3Enabled() queries S3 enablement via fw_cfg. Other library APIs
|
---|
5 | will report lack of support.
|
---|
6 |
|
---|
7 | Copyright (C) 2017, Red Hat, Inc.
|
---|
8 |
|
---|
9 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
10 | **/
|
---|
11 |
|
---|
12 | #include <Library/QemuFwCfgS3Lib.h>
|
---|
13 |
|
---|
14 | /**
|
---|
15 | Install the client module's FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION callback for
|
---|
16 | when the production of ACPI S3 Boot Script opcodes becomes possible.
|
---|
17 |
|
---|
18 | Take ownership of the client-provided Context, and pass it to the callback
|
---|
19 | function, when the latter is invoked.
|
---|
20 |
|
---|
21 | Allocate scratch space for those ACPI S3 Boot Script opcodes to work upon
|
---|
22 | that the client will produce in the callback function.
|
---|
23 |
|
---|
24 | @param[in] Callback FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION to invoke
|
---|
25 | when the production of ACPI S3 Boot Script
|
---|
26 | opcodes becomes possible. Callback() may be
|
---|
27 | called immediately from
|
---|
28 | QemuFwCfgS3CallWhenBootScriptReady().
|
---|
29 |
|
---|
30 | @param[in,out] Context Client-provided data structure for the
|
---|
31 | Callback() callback function to consume.
|
---|
32 |
|
---|
33 | If Context points to dynamically allocated
|
---|
34 | memory, then Callback() must release it.
|
---|
35 |
|
---|
36 | If Context points to dynamically allocated
|
---|
37 | memory, and
|
---|
38 | QemuFwCfgS3CallWhenBootScriptReady() returns
|
---|
39 | successfully, then the caller of
|
---|
40 | QemuFwCfgS3CallWhenBootScriptReady() must
|
---|
41 | neither dereference nor even evaluate Context
|
---|
42 | any longer, as ownership of the referenced area
|
---|
43 | has been transferred to Callback().
|
---|
44 |
|
---|
45 | @param[in] ScratchBufferSize The size of the scratch buffer that will hold,
|
---|
46 | in reserved memory, all client data read,
|
---|
47 | written, and checked by the ACPI S3 Boot Script
|
---|
48 | opcodes produced by Callback().
|
---|
49 |
|
---|
50 | @retval RETURN_UNSUPPORTED The library instance does not support this
|
---|
51 | function.
|
---|
52 |
|
---|
53 | @retval RETURN_NOT_FOUND The fw_cfg DMA interface to QEMU is
|
---|
54 | unavailable.
|
---|
55 |
|
---|
56 | @retval RETURN_BAD_BUFFER_SIZE ScratchBufferSize is too large.
|
---|
57 |
|
---|
58 | @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.
|
---|
59 |
|
---|
60 | @retval RETURN_SUCCESS Callback() has been installed, and the
|
---|
61 | ownership of Context has been transferred.
|
---|
62 | Reserved memory has been allocated for the
|
---|
63 | scratch buffer.
|
---|
64 |
|
---|
65 | A successful invocation of
|
---|
66 | QemuFwCfgS3CallWhenBootScriptReady() cannot
|
---|
67 | be rolled back.
|
---|
68 |
|
---|
69 | @return Error codes from underlying functions.
|
---|
70 | **/
|
---|
71 | RETURN_STATUS
|
---|
72 | EFIAPI
|
---|
73 | QemuFwCfgS3CallWhenBootScriptReady (
|
---|
74 | IN FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION *Callback,
|
---|
75 | IN OUT VOID *Context, OPTIONAL
|
---|
76 | IN UINTN ScratchBufferSize
|
---|
77 | )
|
---|
78 | {
|
---|
79 | return RETURN_UNSUPPORTED;
|
---|
80 | }
|
---|