@@ -122,12 +122,15 @@ Arguments:
Returns:
None.
--*/
{
+ EFI_HANDLE Handle;
+ EFI_STATUS Status;
+
DEBUG ((EFI_D_INFO, "PlatformBdsInit\n"));
InstallDevicePathCallback ();
VisitAllInstancesOfProtocol (&gEfiPciRootBridgeIoProtocolGuid,
ConnectRootBridge, NULL);
@@ -144,17 +147,26 @@ Returns:
// earlier, hence we can't signal End-of-Dxe earlier.
//
EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);
if (QemuFwCfgS3Enabled ()) {
//
- // Save the boot script too. Note that this requires/includes emitting the
- // DxeSmmReadyToLock event, which in turn locks down SMM.
+ // Save the boot script too. Note that this will require us to emit the
+ // DxeSmmReadyToLock event just below, which in turn locks down SMM.
//
SaveS3BootScript ();
}
+
+ //
+ // Prevent further changes to LockBoxes or SMRAM.
+ //
+ Handle = NULL;
+ Status = gBS->InstallProtocolInterface (&Handle,
+ &gEfiDxeSmmReadyToLockProtocolGuid, EFI_NATIVE_INTERFACE,
+ NULL);
+ ASSERT_EFI_ERROR (Status);
}
EFI_STATUS
EFIAPI
ConnectRootBridge (
@@ -1203,26 +1215,23 @@ Returns:
}
/**
Save the S3 boot script.
- Note that we trigger DxeSmmReadyToLock here -- otherwise the script wouldn't
- be saved actually. Triggering this protocol installation event in turn locks
- down SMM, so no further changes to LockBoxes or SMRAM are possible
- afterwards.
+ Note that DxeSmmReadyToLock must be signaled after this function returns;
+ otherwise the script wouldn't be saved actually.
**/
STATIC
VOID
SaveS3BootScript (
VOID
)
{
EFI_STATUS Status;
EFI_S3_SAVE_STATE_PROTOCOL *BootScript;
- EFI_HANDLE Handle;
STATIC CONST UINT8 Info[] = { 0xDE, 0xAD, 0xBE, 0xEF };
Status = gBS->LocateProtocol (&gEfiS3SaveStateProtocolGuid, NULL,
(VOID **) &BootScript);
ASSERT_EFI_ERROR (Status);
@@ -1232,18 +1241,12 @@ SaveS3BootScript (
// than storing just a pointer to runtime or NVS storage.
//
Status = BootScript->Write(BootScript, EFI_BOOT_SCRIPT_INFORMATION_OPCODE,
(UINT32) sizeof Info,
(EFI_PHYSICAL_ADDRESS)(UINTN) &Info);
ASSERT_EFI_ERROR (Status);
-
- Handle = NULL;
- Status = gBS->InstallProtocolInterface (&Handle,
- &gEfiDxeSmmReadyToLockProtocolGuid, EFI_NATIVE_INTERFACE,
- NULL);
- ASSERT_EFI_ERROR (Status);
}
VOID
EFIAPI
PlatformBdsPolicyBehavior (