public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ma, Maurice" <maurice.ma@intel.com>
To: "Dong, Guo" <guo.dong@intel.com>
Cc: "Agyeman, Prince" <prince.agyeman@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH] CorebootPayloadPkg: Notify EndOfDxe and install ReadyToLock protocol.
Date: Wed, 26 Oct 2016 20:09:04 +0000	[thread overview]
Message-ID: <7AAC936950815649B5F88FAE785306C28417692E@ORSMSX113.amr.corp.intel.com> (raw)
In-Reply-To: <a6a7cadf325fe4c6ee9df23ea8983355e2ff4784.1476743924.git.guo.dong@intel.com>

This patch looks good to me.  

Reviewed-by: Maurice Ma <maurice.ma@intel.com>

-----Original Message-----
From: Dong, Guo 
Sent: Monday, October 17, 2016 3:39 PM
To: edk2-devel@lists.01.org
Cc: Ma, Maurice; Agyeman, Prince; Dong, Guo
Subject: [edk2] [PATCH] CorebootPayloadPkg: Notify EndOfDxe and install ReadyToLock protocol.

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>
---
 .../PlatformBootManagerLib/PlatformBootManager.c   | 65 +++++++++++++++++++++-
 .../PlatformBootManagerLib/PlatformBootManager.h   |  4 +-
 .../PlatformBootManagerLib.inf                     |  4 +-
 3 files changed, 69 insertions(+), 4 deletions(-)

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



           reply	other threads:[~2016-10-26 20:09 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <a6a7cadf325fe4c6ee9df23ea8983355e2ff4784.1476743924.git.guo.dong@intel.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7AAC936950815649B5F88FAE785306C28417692E@ORSMSX113.amr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox