]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Library/QemuFwCfgS3Lib/QemuFwCfgS3Base.c
OvmfPkg/VirtioMmioDeviceLib: list "VirtioMmioDevice.h" in the INF file
[mirror_edk2.git] / OvmfPkg / Library / QemuFwCfgS3Lib / QemuFwCfgS3Base.c
index bed9bf3dfb57dbe5f94d12a7c44b0df30f5d8f43..7fa1200ee3eabeeba81b1ac1aff690f44b95a27e 100644 (file)
@@ -16,6 +16,7 @@
   WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 **/\r
 \r
+#include <Library/DebugLib.h>\r
 #include <Library/QemuFwCfgS3Lib.h>\r
 \r
 /**\r
@@ -37,3 +38,74 @@ QemuFwCfgS3Enabled (
 {\r
   return FALSE;\r
 }\r
+\r
+\r
+/**\r
+  Install the client module's FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION callback for\r
+  when the production of ACPI S3 Boot Script opcodes becomes possible.\r
+\r
+  Take ownership of the client-provided Context, and pass it to the callback\r
+  function, when the latter is invoked.\r
+\r
+  Allocate scratch space for those ACPI S3 Boot Script opcodes to work upon\r
+  that the client will produce in the callback function.\r
+\r
+  @param[in] Callback           FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION to invoke\r
+                                when the production of ACPI S3 Boot Script\r
+                                opcodes becomes possible. Callback() may be\r
+                                called immediately from\r
+                                QemuFwCfgS3CallWhenBootScriptReady().\r
+\r
+  @param[in,out] Context        Client-provided data structure for the\r
+                                Callback() callback function to consume.\r
+\r
+                                If Context points to dynamically allocated\r
+                                memory, then Callback() must release it.\r
+\r
+                                If Context points to dynamically allocated\r
+                                memory, and\r
+                                QemuFwCfgS3CallWhenBootScriptReady() returns\r
+                                successfully, then the caller of\r
+                                QemuFwCfgS3CallWhenBootScriptReady() must\r
+                                neither dereference nor even evaluate Context\r
+                                any longer, as ownership of the referenced area\r
+                                has been transferred to Callback().\r
+\r
+  @param[in] ScratchBufferSize  The size of the scratch buffer that will hold,\r
+                                in reserved memory, all client data read,\r
+                                written, and checked by the ACPI S3 Boot Script\r
+                                opcodes produced by Callback().\r
+\r
+  @retval RETURN_UNSUPPORTED       The library instance does not support this\r
+                                   function.\r
+\r
+  @retval RETURN_NOT_FOUND         The fw_cfg DMA interface to QEMU is\r
+                                   unavailable.\r
+\r
+  @retval RETURN_BAD_BUFFER_SIZE   ScratchBufferSize is too large.\r
+\r
+  @retval RETURN_OUT_OF_RESOURCES  Memory allocation failed.\r
+\r
+  @retval RETURN_SUCCESS           Callback() has been installed, and the\r
+                                   ownership of Context has been transferred.\r
+                                   Reserved memory has been allocated for the\r
+                                   scratch buffer.\r
+\r
+                                   A successful invocation of\r
+                                   QemuFwCfgS3CallWhenBootScriptReady() cannot\r
+                                   be rolled back.\r
+\r
+  @return                          Error codes from underlying functions.\r
+**/\r
+\r
+RETURN_STATUS\r
+EFIAPI\r
+QemuFwCfgS3CallWhenBootScriptReady (\r
+  IN     FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION *Callback,\r
+  IN OUT VOID                                 *Context,          OPTIONAL\r
+  IN     UINTN                                ScratchBufferSize\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return RETURN_UNSUPPORTED;\r
+}\r