]>
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 LE |
35 | \r |
36 | \r | |
37 | /**\r | |
38 | Install the client module's FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION callback for\r | |
39 | when the production of ACPI S3 Boot Script opcodes becomes possible.\r | |
40 | \r | |
41 | Take ownership of the client-provided Context, and pass it to the callback\r | |
42 | function, when the latter is invoked.\r | |
43 | \r | |
44 | Allocate scratch space for those ACPI S3 Boot Script opcodes to work upon\r | |
45 | that the client will produce in the callback function.\r | |
46 | \r | |
47 | @param[in] Callback FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION to invoke\r | |
48 | when the production of ACPI S3 Boot Script\r | |
49 | opcodes becomes possible. Callback() may be\r | |
50 | called immediately from\r | |
51 | QemuFwCfgS3CallWhenBootScriptReady().\r | |
52 | \r | |
53 | @param[in,out] Context Client-provided data structure for the\r | |
54 | Callback() callback function to consume.\r | |
55 | \r | |
56 | If Context points to dynamically allocated\r | |
57 | memory, then Callback() must release it.\r | |
58 | \r | |
59 | If Context points to dynamically allocated\r | |
60 | memory, and\r | |
61 | QemuFwCfgS3CallWhenBootScriptReady() returns\r | |
62 | successfully, then the caller of\r | |
63 | QemuFwCfgS3CallWhenBootScriptReady() must\r | |
64 | neither dereference nor even evaluate Context\r | |
65 | any longer, as ownership of the referenced area\r | |
66 | has been transferred to Callback().\r | |
67 | \r | |
68 | @param[in] ScratchBufferSize The size of the scratch buffer that will hold,\r | |
69 | in reserved memory, all client data read,\r | |
70 | written, and checked by the ACPI S3 Boot Script\r | |
71 | opcodes produced by Callback().\r | |
72 | \r | |
73 | @retval RETURN_UNSUPPORTED The library instance does not support this\r | |
74 | function.\r | |
75 | \r | |
76 | @retval RETURN_NOT_FOUND The fw_cfg DMA interface to QEMU is\r | |
77 | unavailable.\r | |
78 | \r | |
79 | @retval RETURN_BAD_BUFFER_SIZE ScratchBufferSize is too large.\r | |
80 | \r | |
81 | @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.\r | |
82 | \r | |
83 | @retval RETURN_SUCCESS Callback() has been installed, and the\r | |
84 | ownership of Context has been transferred.\r | |
85 | Reserved memory has been allocated for the\r | |
86 | scratch buffer.\r | |
87 | \r | |
88 | A successful invocation of\r | |
89 | QemuFwCfgS3CallWhenBootScriptReady() cannot\r | |
90 | be rolled back.\r | |
91 | \r | |
92 | @return Error codes from underlying functions.\r | |
93 | **/\r | |
08bed3fb | 94 | \r |
33ead2dd | 95 | RETURN_STATUS\r |
08bed3fb | 96 | EFIAPI\r |
33ead2dd LE |
97 | QemuFwCfgS3CallWhenBootScriptReady (\r |
98 | IN FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION *Callback,\r | |
79d49e16 | 99 | IN OUT VOID *Context OPTIONAL,\r |
33ead2dd LE |
100 | IN UINTN ScratchBufferSize\r |
101 | )\r | |
102 | {\r | |
103 | ASSERT (FALSE);\r | |
104 | return RETURN_UNSUPPORTED;\r | |
105 | }\r |