summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2017-02-22 17:46:43 +0100
committerLaszlo Ersek <lersek@redhat.com>2017-03-14 21:49:34 +0100
commit7bb57805ba0e448bd5f5e5adf08735e0c8e77986 (patch)
tree2a7342f7d8baa47a31e62f36d9ce4762ade8729e /OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf
parentda58d987cc894b12fbe208bf66d3f129817f771b (diff)
downloadedk2-7bb57805ba0e448bd5f5e5adf08735e0c8e77986.tar.gz
edk2-7bb57805ba0e448bd5f5e5adf08735e0c8e77986.tar.bz2
edk2-7bb57805ba0e448bd5f5e5adf08735e0c8e77986.zip
OvmfPkg/QemuFwCfgS3Lib: implement opcode APIs for DXE fw_cfg instance
In the DXE fw_cfg instance: - QemuFwCfgS3Enabled() queries S3 enablement via fw_cfg. This behavior is shared with the PEI fw_cfg instance, and the DXE fw_cfg instance already pulls in the function from "QemuFwCfgS3PeiDxe.c". - If QemuFwCfgS3Enabled() returns TRUE, the client module is permitted to call QemuFwCfgS3CallWhenBootScriptReady(). We provide a fully functional implementation for QemuFwCfgS3CallWhenBootScriptReady(). A protocol notify is installed at TPL_CALLBACK for EFI_S3_SAVE_STATE_PROTOCOL. If / once the protocol is available, the client module's Callback() function is called, which is expected to produce ACPI S3 Boot Script opcodes using the helper functions listed below. In QemuFwCfgS3CallWhenBootScriptReady(), we also allocate a reserved memory buffer, sized & typed by the client module, for the opcodes and (internally) the fw_cfg DMA operations to work upon, during S3 resume. This behavior is unique to the DXE fw_cfg instance. Thus, add the function to "QemuFwCfgS3Dxe.c". - The QemuFwCfgS3ScriptWriteBytes(), QemuFwCfgS3ScriptReadBytes(), QemuFwCfgS3ScriptSkipBytes(), and QemuFwCfgS3ScriptCheckValue() functions are also implemented usefully, since the client module's Callback() function is expected to invoke them. Each of the first three functions produces MEM_WRITE, IO_WRITE, and MEM_POLL opcodes, to set up the DMA command in reserved memory, to start the DMA transfer, and to check the DMA result, respectively. The QemuFwCfgS3ScriptCheckValue() function produces a MEM_POLL opcode to validate an unsigned integer field in data that was read via QemuFwCfgS3ScriptReadBytes(). This behavior is again unique to the DXE fw_cfg instance, so add the functions to "QemuFwCfgS3Dxe.c". Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=394 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf')
-rw-r--r--OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf8
1 files changed, 8 insertions, 0 deletions
diff --git a/OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf b/OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf
index 7016575f3d..a0e4275cb8 100644
--- a/OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf
+++ b/OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf
@@ -28,6 +28,7 @@
#
[Sources]
+ QemuFwCfgS3Dxe.c
QemuFwCfgS3PeiDxe.c
[Packages]
@@ -35,4 +36,11 @@
OvmfPkg/OvmfPkg.dec
[LibraryClasses]
+ BaseLib
+ DebugLib
+ MemoryAllocationLib
QemuFwCfgLib
+ UefiBootServicesTableLib
+
+[Protocols]
+ gEfiS3SaveStateProtocolGuid ## SOMETIMES_CONSUMES