\r
--*/\r
{\r
+ EFI_HANDLE Handle;\r
+ EFI_STATUS Status;\r
+\r
DEBUG ((EFI_D_INFO, "PlatformBdsInit\n"));\r
InstallDevicePathCallback ();\r
\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
+ // Save the boot script too. Note that this will require us to emit the\r
+ // DxeSmmReadyToLock event just below, which in turn locks down SMM.\r
//\r
SaveS3BootScript ();\r
}\r
+\r
+ //\r
+ // Prevent further changes to LockBoxes or SMRAM.\r
+ //\r
+ Handle = NULL;\r
+ Status = gBS->InstallProtocolInterface (&Handle,\r
+ &gEfiDxeSmmReadyToLockProtocolGuid, EFI_NATIVE_INTERFACE,\r
+ NULL);\r
+ ASSERT_EFI_ERROR (Status);\r
}\r
\r
\r
/**\r
Save the S3 boot script.\r
\r
- Note that we trigger DxeSmmReadyToLock here -- otherwise the script wouldn't\r
- be saved actually. Triggering this protocol installation event in turn locks\r
- down SMM, so no further changes to LockBoxes or SMRAM are possible\r
- afterwards.\r
+ Note that DxeSmmReadyToLock must be signaled after this function returns;\r
+ otherwise the script wouldn't be saved actually.\r
**/\r
STATIC\r
VOID\r
{\r
EFI_STATUS Status;\r
EFI_S3_SAVE_STATE_PROTOCOL *BootScript;\r
- EFI_HANDLE Handle;\r
STATIC CONST UINT8 Info[] = { 0xDE, 0xAD, 0xBE, 0xEF };\r
\r
Status = gBS->LocateProtocol (&gEfiS3SaveStateProtocolGuid, NULL,\r
(UINT32) sizeof Info,\r
(EFI_PHYSICAL_ADDRESS)(UINTN) &Info);\r
ASSERT_EFI_ERROR (Status);\r
-\r
- Handle = NULL;\r
- Status = gBS->InstallProtocolInterface (&Handle,\r
- &gEfiDxeSmmReadyToLockProtocolGuid, EFI_NATIVE_INTERFACE,\r
- NULL);\r
- ASSERT_EFI_ERROR (Status);\r
}\r
\r
\r