From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9AB1B1A1E77 for ; Wed, 26 Oct 2016 13:09:24 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP; 26 Oct 2016 13:09:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,551,1473145200"; d="scan'208";a="778146202" Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by FMSMGA003.fm.intel.com with ESMTP; 26 Oct 2016 13:09:21 -0700 Received: from orsmsx159.amr.corp.intel.com (10.22.240.24) by ORSMSX101.amr.corp.intel.com (10.22.225.128) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 26 Oct 2016 13:09:05 -0700 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.50]) by ORSMSX159.amr.corp.intel.com ([10.22.240.24]) with mapi id 14.03.0248.002; Wed, 26 Oct 2016 13:09:05 -0700 From: "Ma, Maurice" To: "Dong, Guo" CC: "Agyeman, Prince" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] CorebootPayloadPkg: Notify EndOfDxe and install ReadyToLock protocol. Thread-Index: AQHSKMdZQfn3Di21/0+aIb2egq8wjaC7N/Wg Date: Wed, 26 Oct 2016 20:09:04 +0000 Message-ID: <7AAC936950815649B5F88FAE785306C28417692E@ORSMSX113.amr.corp.intel.com> References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTE2MzU1ZDItZGI4MS00Y2M3LWJmYTQtMTU5NGQyYjNiYzdhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlY4UmZUdGkxUXI0VDlWWWlzVXZZUWJINlZlaFU5WUZENklHZ3V2ZTdlZXM9In0= x-originating-ip: [10.22.254.139] MIME-Version: 1.0 Subject: Re: [PATCH] CorebootPayloadPkg: Notify EndOfDxe and install ReadyToLock protocol. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Oct 2016 20:09:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This patch looks good to me. =20 Reviewed-by: Maurice Ma -----Original Message----- From: Dong, Guo=20 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 Rea= dyToLock protocol. Update PlatformBootManagerLib to notify EndOfDxe event and install SmmReady= ToLock protocol since other modules depend on them. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: gdong1 --- .../PlatformBootManagerLib/PlatformBootManager.c | 65 ++++++++++++++++++= +++- .../PlatformBootManagerLib/PlatformBootManager.h | 4 +- .../PlatformBootManagerLib.inf | 4 +- 3 files changed, 69 insertions(+), 4 deletions(-) diff --git a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBoot= Manager.c b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootM= anager.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. =20 -Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s 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" =20 +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")); // //=20 + Inform the SMM infrastructure that we're entering BDS and may run 3rd=20 + party code hereafter // Since PI1.2.1, we need signal EndOfDxe as=20 + ExitPmAuth // Status =3D 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=20 + successfully\n")); + + // + // Install DxeSmmReadyToLock protocol in order to lock SMM // =20 + Status =3D gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VOID= =20 + **) &SmmAccess); if (!EFI_ERROR (Status)) { + Handle =3D NULL; + Status =3D 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. =20 @@ -147,6 +204,12 @@ PlatformBootManagerBeforeConsole ( // Register UEFI Shell // PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", L= OAD_OPTION_ACTIVE); + + // + // Install ready to lock. + // This needs to be done before option rom dispatched. + // + InstallReadyToLock (); } =20 /** diff --git a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBoot= Manager.h b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootM= anager.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 =20 -Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s 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 I= MPLIED. #include #include #include - +#include =20 typedef struct { EFI_DEVICE_PATH_PROTOCOL *DevicePath; diff --git a/CorebootPayloadPkg/L= ibrary/PlatformBootManagerLib/PlatformBootManagerLib.inf b/CorebootPayloadP= kg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index 475c65d..9e8ae9b 100644 --- a/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager= Lib.inf +++ b/CorebootPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana +++ gerLib.inf @@ -55,13 +55,15 @@ PlatformHookLib =20 [Guids] - + gEfiEndOfDxeEventGroupGuid =20 [Protocols] gEfiGenericMemTestProtocolGuid ## CONSUMES gEfiGraphicsOutputProtocolGuid ## CONSUMES gEfiUgaDrawProtocolGuid ## CONSUMES gEfiBootLogoProtocolGuid ## CONSUMES + gEfiDxeSmmReadyToLockProtocolGuid + gEfiSmmAccess2ProtocolGuid =20 [Pcd] gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut -- 2.7.0.windows.1