summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c
diff options
context:
space:
mode:
Diffstat (limited to 'OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c')
-rw-r--r--OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c b/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c
index 6c03e17a3a..f31646d734 100644
--- a/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c
+++ b/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c
@@ -36,6 +36,8 @@
#include <Protocol/S3SaveState.h>
#include <Protocol/SmmControl2.h>
+#include "SmiFeatures.h"
+
//
// Forward declaration.
//
@@ -56,6 +58,13 @@ OnS3SaveStateInstalled (
STATIC UINTN mSmiEnable;
//
+// Captures whether SMI feature negotiation is supported. The variable is only
+// used to carry this information from the entry point function to the
+// S3SaveState protocol installation callback.
+//
+STATIC BOOLEAN mSmiFeatureNegotiation;
+
+//
// Event signaled when an S3SaveState protocol interface is installed.
//
STATIC EFI_EVENT mS3SaveStateInstalled;
@@ -229,6 +238,11 @@ SmmControl2DxeEntryPoint (
goto FatalError;
}
+ //
+ // QEMU can inject SMIs in different ways, negotiate our preferences.
+ //
+ mSmiFeatureNegotiation = NegotiateSmiFeatures ();
+
if (QemuFwCfgS3Enabled ()) {
VOID *Registration;
@@ -363,6 +377,13 @@ OnS3SaveStateInstalled (
CpuDeadLoop ();
}
+ //
+ // Append a boot script fragment that re-selects the negotiated SMI features.
+ //
+ if (mSmiFeatureNegotiation) {
+ SaveSmiFeatures (S3SaveState);
+ }
+
DEBUG ((EFI_D_VERBOSE, "%a: boot script fragment saved\n", __FUNCTION__));
gBS->CloseEvent (Event);
mS3SaveStateInstalled = NULL;