]>
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 | |
10 | This program and the accompanying materials are licensed and made available\r | |
11 | under the terms and conditions of the BSD License which accompanies this\r | |
12 | distribution. The full text of the license may be found at\r | |
13 | http://opensource.org/licenses/bsd-license.php\r | |
14 | \r | |
15 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r | |
16 | WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
17 | **/\r | |
18 | \r | |
33ead2dd | 19 | #include <Library/DebugLib.h>\r |
ad223a1c LE |
20 | #include <Library/QemuFwCfgS3Lib.h>\r |
21 | \r | |
22 | /**\r | |
23 | Determine if S3 support is explicitly enabled.\r | |
24 | \r | |
25 | @retval TRUE If S3 support is explicitly enabled. Other functions in this\r | |
26 | library may be called (subject to their individual\r | |
27 | restrictions).\r | |
28 | \r | |
29 | FALSE Otherwise. This includes unavailability of the firmware\r | |
30 | configuration interface. No other function in this library\r | |
31 | must be called.\r | |
32 | **/\r | |
33 | BOOLEAN\r | |
34 | EFIAPI\r | |
35 | QemuFwCfgS3Enabled (\r | |
36 | VOID\r | |
37 | )\r | |
38 | {\r | |
39 | return FALSE;\r | |
40 | }\r | |
33ead2dd LE |
41 | \r |
42 | \r | |
43 | /**\r | |
44 | Install the client module's FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION callback for\r | |
45 | when the production of ACPI S3 Boot Script opcodes becomes possible.\r | |
46 | \r | |
47 | Take ownership of the client-provided Context, and pass it to the callback\r | |
48 | function, when the latter is invoked.\r | |
49 | \r | |
50 | Allocate scratch space for those ACPI S3 Boot Script opcodes to work upon\r | |
51 | that the client will produce in the callback function.\r | |
52 | \r | |
53 | @param[in] Callback FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION to invoke\r | |
54 | when the production of ACPI S3 Boot Script\r | |
55 | opcodes becomes possible. Callback() may be\r | |
56 | called immediately from\r | |
57 | QemuFwCfgS3CallWhenBootScriptReady().\r | |
58 | \r | |
59 | @param[in,out] Context Client-provided data structure for the\r | |
60 | Callback() callback function to consume.\r | |
61 | \r | |
62 | If Context points to dynamically allocated\r | |
63 | memory, then Callback() must release it.\r | |
64 | \r | |
65 | If Context points to dynamically allocated\r | |
66 | memory, and\r | |
67 | QemuFwCfgS3CallWhenBootScriptReady() returns\r | |
68 | successfully, then the caller of\r | |
69 | QemuFwCfgS3CallWhenBootScriptReady() must\r | |
70 | neither dereference nor even evaluate Context\r | |
71 | any longer, as ownership of the referenced area\r | |
72 | has been transferred to Callback().\r | |
73 | \r | |
74 | @param[in] ScratchBufferSize The size of the scratch buffer that will hold,\r | |
75 | in reserved memory, all client data read,\r | |
76 | written, and checked by the ACPI S3 Boot Script\r | |
77 | opcodes produced by Callback().\r | |
78 | \r | |
79 | @retval RETURN_UNSUPPORTED The library instance does not support this\r | |
80 | function.\r | |
81 | \r | |
82 | @retval RETURN_NOT_FOUND The fw_cfg DMA interface to QEMU is\r | |
83 | unavailable.\r | |
84 | \r | |
85 | @retval RETURN_BAD_BUFFER_SIZE ScratchBufferSize is too large.\r | |
86 | \r | |
87 | @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.\r | |
88 | \r | |
89 | @retval RETURN_SUCCESS Callback() has been installed, and the\r | |
90 | ownership of Context has been transferred.\r | |
91 | Reserved memory has been allocated for the\r | |
92 | scratch buffer.\r | |
93 | \r | |
94 | A successful invocation of\r | |
95 | QemuFwCfgS3CallWhenBootScriptReady() cannot\r | |
96 | be rolled back.\r | |
97 | \r | |
98 | @return Error codes from underlying functions.\r | |
99 | **/\r | |
08bed3fb | 100 | \r |
33ead2dd | 101 | RETURN_STATUS\r |
08bed3fb | 102 | EFIAPI\r |
33ead2dd LE |
103 | QemuFwCfgS3CallWhenBootScriptReady (\r |
104 | IN FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION *Callback,\r | |
105 | IN OUT VOID *Context, OPTIONAL\r | |
106 | IN UINTN ScratchBufferSize\r | |
107 | )\r | |
108 | {\r | |
109 | ASSERT (FALSE);\r | |
110 | return RETURN_UNSUPPORTED;\r | |
111 | }\r |