]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CorebootPayloadPkg: Notify EndOfDxe and install ReadyToLock protocol.
authorgdong1 <guo.dong@intel.com>
Mon, 17 Oct 2016 19:39:23 +0000 (12:39 -0700)
committerMaurice Ma <maurice.ma@intel.com>
Wed, 26 Oct 2016 22:38:33 +0000 (15:38 -0700)
Update PlatformBootManagerLib to notify EndOfDxe event and install
SmmReadyToLock protocol since other modules depend on them.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: gdong1 <guo.dong@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.h
CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf

index 200ea9580877a41648a4f4ebe4e28930491b05d2..a31384af00e4a95fcfac125b9828e88224d94648 100644 (file)
@@ -2,7 +2,7 @@
   This file include all platform action which can be customized\r
   by IBV/OEM.\r
 \r
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -16,6 +16,63 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "PlatformBootManager.h"\r
 #include "PlatformConsole.h"\r
 \r
+VOID\r
+EFIAPI\r
+InternalBdsEmptyCallbackFuntion (\r
+  IN EFI_EVENT                Event,\r
+  IN VOID                     *Context\r
+  )\r
+{\r
+  return;\r
+}\r
+\r
+VOID\r
+InstallReadyToLock (\r
+  VOID\r
+  )\r
+{\r
+  EFI_STATUS                            Status;\r
+  EFI_HANDLE                            Handle;\r
+  EFI_SMM_ACCESS2_PROTOCOL              *SmmAccess;\r
+  EFI_EVENT                             EndOfDxeEvent;\r
+\r
+  DEBUG((DEBUG_INFO,"InstallReadyToLock  entering......\n"));\r
+  //\r
+  // Inform the SMM infrastructure that we're entering BDS and may run 3rd party code hereafter\r
+  // Since PI1.2.1, we need signal EndOfDxe as ExitPmAuth\r
+  //\r
+  Status = gBS->CreateEventEx (\r
+                  EVT_NOTIFY_SIGNAL,\r
+                  TPL_CALLBACK,\r
+                  InternalBdsEmptyCallbackFuntion,\r
+                  NULL,\r
+                  &gEfiEndOfDxeEventGroupGuid,\r
+                  &EndOfDxeEvent\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+  gBS->SignalEvent (EndOfDxeEvent);\r
+  gBS->CloseEvent (EndOfDxeEvent);\r
+  DEBUG((DEBUG_INFO,"All EndOfDxe callbacks have returned successfully\n"));\r
+\r
+  //\r
+  // Install DxeSmmReadyToLock protocol in order to lock SMM\r
+  //\r
+  Status = gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VOID **) &SmmAccess);\r
+  if (!EFI_ERROR (Status)) {\r
+    Handle = NULL;\r
+    Status = gBS->InstallProtocolInterface (\r
+                    &Handle,\r
+                    &gEfiDxeSmmReadyToLockProtocolGuid,\r
+                    EFI_NATIVE_INTERFACE,\r
+                    NULL\r
+                    );\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
+\r
+  DEBUG((DEBUG_INFO,"InstallReadyToLock  end\n"));\r
+  return;\r
+}\r
+\r
 /**\r
   Return the index of the load option in the load option array.\r
 \r
@@ -147,6 +204,12 @@ PlatformBootManagerBeforeConsole (
   // Register UEFI Shell\r
   //\r
   PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", LOAD_OPTION_ACTIVE);\r
+\r
+  //\r
+  // Install ready to lock.\r
+  // This needs to be done before option rom dispatched.\r
+  //\r
+  InstallReadyToLock ();\r
 }\r
 \r
 /**\r
index 36f53fd3668bf809e52acb68df5d575065d5c9ee..90811ff53a7cc5bc6b8f4b535008d46df1d496de 100644 (file)
@@ -1,7 +1,7 @@
 /**@file\r
    Head file for BDS Platform specific code\r
 \r
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -32,7 +32,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/PrintLib.h>\r
 #include <Library/DxeServicesLib.h>\r
 #include <Library/BootLogoLib.h>\r
-\r
+#include <Protocol/SmmAccess2.h>\r
 \r
 typedef struct {\r
   EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
index 475c65d8a16f440d88aa54a4f9e116011489227e..9e8ae9b36a0e27bb232fbd2422be525e99a4fd63 100644 (file)
   PlatformHookLib\r
 \r
 [Guids]\r
-\r
+  gEfiEndOfDxeEventGroupGuid\r
 \r
 [Protocols]\r
   gEfiGenericMemTestProtocolGuid  ## CONSUMES\r
   gEfiGraphicsOutputProtocolGuid  ## CONSUMES\r
   gEfiUgaDrawProtocolGuid         ## CONSUMES\r
   gEfiBootLogoProtocolGuid        ## CONSUMES\r
+  gEfiDxeSmmReadyToLockProtocolGuid\r
+  gEfiSmmAccess2ProtocolGuid\r
 \r
 [Pcd]\r
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut\r