From 805762252733bb67bc5157f0137c64e010724c77 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Thu, 23 Feb 2017 00:22:17 +0100 Subject: OvmfPkg/AcpiPlatformDxe: save fw_cfg boot script with QemuFwCfgS3Lib Drop the explicit S3SaveState protocol and opcode management; instead, create ACPI S3 Boot Script opcodes for the WRITE_POINTER commands with QemuFwCfgS3Lib functions. In this case, we have a dynamically allocated Context structure, hence the patch demonstrates how the FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION takes ownership of Context. Cc: Jordan Justen Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=394 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen --- OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c') diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c index 76512534f5..7bb2e3f218 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c @@ -848,6 +848,13 @@ InstallQemuFwCfgTables ( // if (S3Context != NULL) { Status = TransferS3ContextToBootScript (S3Context); + if (EFI_ERROR (Status)) { + goto UninstallAcpiTables; + } + // + // Ownership of S3Context has been transfered. + // + S3Context = NULL; } UninstallAcpiTables: -- cgit v1.2.3