]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
OvmfPkg: PlatformBdsLib: lock down SMM in PlatformBdsInit()
[mirror_edk2.git] / OvmfPkg / Library / PlatformBdsLib / BdsPlatform.c
index 0bc02baf0371818528c656645fc03b71173768af..b22f2a74a9d8a3ff9c6a0a2da266cf748e7d8f3b 100644 (file)
@@ -88,6 +88,20 @@ InstallDevicePathCallback (
   VOID\r
   );\r
 \r
+EFI_STATUS\r
+EFIAPI\r
+ConnectRootBridge (\r
+  IN EFI_HANDLE  RootBridgeHandle,\r
+  IN VOID        *Instance,\r
+  IN VOID        *Context\r
+  );\r
+\r
+STATIC\r
+VOID\r
+SaveS3BootScript (\r
+  VOID\r
+  );\r
+\r
 //\r
 // BDS Platform Functions\r
 //\r
@@ -113,6 +127,31 @@ Returns:
 {\r
   DEBUG ((EFI_D_INFO, "PlatformBdsInit\n"));\r
   InstallDevicePathCallback ();\r
+\r
+  VisitAllInstancesOfProtocol (&gEfiPciRootBridgeIoProtocolGuid,\r
+    ConnectRootBridge, NULL);\r
+\r
+  //\r
+  // Signal the ACPI platform driver that it can download QEMU ACPI tables.\r
+  //\r
+  EfiEventGroupSignal (&gRootBridgesConnectedEventGroupGuid);\r
+\r
+  //\r
+  // We can't signal End-of-Dxe earlier than this. Namely, End-of-Dxe triggers\r
+  // the preparation of S3 system information. That logic has a hard dependency\r
+  // on the presence of the FACS ACPI table. Since our ACPI tables are only\r
+  // installed after PCI enumeration completes, we must not trigger the S3 save\r
+  // earlier, hence we can't signal End-of-Dxe earlier.\r
+  //\r
+  EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);\r
+\r
+  if (QemuFwCfgS3Enabled ()) {\r
+    //\r
+    // Save the boot script too. Note that this requires/includes emitting the\r
+    // DxeSmmReadyToLock event, which in turn locks down SMM.\r
+    //\r
+    SaveS3BootScript ();\r
+  }\r
 }\r
 \r
 \r
@@ -1242,31 +1281,6 @@ Returns:
 \r
   DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior\n"));\r
 \r
-  VisitAllInstancesOfProtocol (&gEfiPciRootBridgeIoProtocolGuid,\r
-    ConnectRootBridge, NULL);\r
-\r
-  //\r
-  // Signal the ACPI platform driver that it can download QEMU ACPI tables.\r
-  //\r
-  EfiEventGroupSignal (&gRootBridgesConnectedEventGroupGuid);\r
-\r
-  //\r
-  // We can't signal End-of-Dxe earlier than this. Namely, End-of-Dxe triggers\r
-  // the preparation of S3 system information. That logic has a hard dependency\r
-  // on the presence of the FACS ACPI table. Since our ACPI tables are only\r
-  // installed after PCI enumeration completes, we must not trigger the S3 save\r
-  // earlier, hence we can't signal End-of-Dxe earlier.\r
-  //\r
-  EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);\r
-\r
-  if (QemuFwCfgS3Enabled ()) {\r
-    //\r
-    // Save the boot script too. Note that this requires/includes emitting the\r
-    // DxeSmmReadyToLock event, which in turn locks down SMM.\r
-    //\r
-    SaveS3BootScript ();\r
-  }\r
-\r
   if (PcdGetBool (PcdOvmfFlashVariablesEnable)) {\r
     DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior: not restoring NvVars "\r
       "from disk since flash variables appear to be supported.\n"));\r