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