From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web12.5242.1576632754054435816 for ; Tue, 17 Dec 2019 17:32:34 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: nathaniel.l.desimone@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Dec 2019 17:32:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,327,1571727600"; d="scan'208";a="417046205" Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by fmsmga006.fm.intel.com with ESMTP; 17 Dec 2019 17:32:33 -0800 Received: from orsmsx153.amr.corp.intel.com (10.22.226.247) by ORSMSX101.amr.corp.intel.com (10.22.225.128) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 17 Dec 2019 17:32:32 -0800 Received: from orsmsx114.amr.corp.intel.com ([169.254.8.106]) by ORSMSX153.amr.corp.intel.com ([169.254.12.176]) with mapi id 14.03.0439.000; Tue, 17 Dec 2019 17:32:32 -0800 From: "Nate DeSimone" To: "Agyeman, Prince" CC: "devel@edk2.groups.io" , "Kubacki, Michael A" , "Chiu, Chasel" Subject: Re: [edk2-platforms] [PATCH 03/11] BoardModulePkg: Add BDS Hook DXE Driver Thread-Topic: [edk2-platforms] [PATCH 03/11] BoardModulePkg: Add BDS Hook DXE Driver Thread-Index: AQHVsh5hbAxsWYK8RUOiB1pSrIpSZqe/p+gA Date: Wed, 18 Dec 2019 01:32:32 +0000 Message-ID: <20191218013232.GD1930@nate-virtualbox> References: <4917b65e194ea62af08d6a811bc9ae332be2b538.1576282834.git.prince.agyeman@intel.com> In-Reply-To: <4917b65e194ea62af08d6a811bc9ae332be2b538.1576282834.git.prince.agyeman@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.7.159.63] MIME-Version: 1.0 Return-Path: nathaniel.l.desimone@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: <4552953A117415408CC09F7321A5D2E4@intel.com> Content-Transfer-Encoding: quoted-printable Hi Prince, Reviewed-by: Nate DeSimone Thanks, Nate On Sat, Dec 14, 2019 at 01:32:29AM +0000, Agyeman, Prince wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2336 >=20 > This is a sample/generic DXE driver that registers > all the BDS hook points or callbacks as defined in > BoardBdsHookLib. >=20 > Cc: Michael Kubacki > Cc: Chasel Chiu > Cc: Nate DeSimone >=20 > Signed-off-by: Prince Agyeman > --- > .../BoardBdsHookDxe/BoardBdsHookDxe.c | 121 ++++++++++++++++++ > .../BoardBdsHookDxe/BoardBdsHookDxe.inf | 46 +++++++ > 2 files changed, 167 insertions(+) > create mode 100644 Platform/Intel/BoardModulePkg/BoardBdsHookDxe/BoardBd= sHookDxe.c > create mode 100644 Platform/Intel/BoardModulePkg/BoardBdsHookDxe/BoardBd= sHookDxe.inf >=20 > diff --git a/Platform/Intel/BoardModulePkg/BoardBdsHookDxe/BoardBdsHookDx= e.c b/Platform/Intel/BoardModulePkg/BoardBdsHookDxe/BoardBdsHookDxe.c > new file mode 100644 > index 0000000000..88eb7d70e9 > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/BoardBdsHookDxe/BoardBdsHookDxe.c > @@ -0,0 +1,121 @@ > +/** @file > + Bds Hook Point callbacks DXE driver > + > + Copyright (c) 2019, Intel Corporation. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +/** > + Initialize DXE Platform. > + > + @param[in] ImageHandle Image handle of this driver. > + @param[in] SystemTable Global system service table. > + > + @retval EFI_SUCCESS Initialization complete. > + @exception EFI_UNSUPPORTED The chipset is unsupported by this dr= iver. > + @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initiali= ze the driver. > + @retval EFI_DEVICE_ERROR Device error, driver exits abnormally. > +**/ > +EFI_STATUS > +EFIAPI > +BdsHookDxeEntryPoint ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_EVENT BeforeConsoleAfterTrustedConsoleEvent; > + EFI_EVENT BeforeConsoleBeforeEndOfDxeEvent; > + EFI_EVENT AfterConsoleReadyBeforeBootOptionEvent; > + EFI_EVENT ReadyToBootEvent; > + EFI_EVENT PciEnumCompleteEvent; > + EFI_EVENT SmmReadyToLockEvent; > + EFI_STATUS Status; > + VOID *Registration; > + > + DEBUG ((DEBUG_INFO, "%a starts\n", __FUNCTION__ )); > + > + // > + // Create event to set proper video resolution and text mode for inter= nal shell. > + // > + Status =3D EfiCreateEventReadyToBootEx ( > + TPL_CALLBACK, > + BdsReadyToBootCallback, > + NULL, > + &ReadyToBootEvent > + ); > + ASSERT_EFI_ERROR (Status); > + > + // > + // Create PCI Enumeration Completed callback for BDS > + // > + PciEnumCompleteEvent =3D EfiCreateProtocolNotifyEvent ( > + &gEfiPciEnumerationCompleteProtocolGuid, > + TPL_CALLBACK, > + BdsPciEnumCompleteCallback, > + NULL, > + &Registration > + ); > + ASSERT (PciEnumCompleteEvent !=3D NULL); > + > + // > + // Create PCI Enumeration Completed callback for BDS > + // > + SmmReadyToLockEvent =3D EfiCreateProtocolNotifyEvent ( > + &gEfiDxeSmmReadyToLockProtocolGuid, > + TPL_CALLBACK, > + BdsSmmReadyToLockCallback, > + NULL, > + &Registration > + ); > + ASSERT (SmmReadyToLockEvent !=3D NULL); > + > + // > + // Create BeforeConsoleAfterTrustedConsole event callback > + // > + Status =3D gBS->CreateEventEx ( > + EVT_NOTIFY_SIGNAL, > + TPL_CALLBACK, > + BdsBeforeConsoleAfterTrustedConsoleCallback, > + NULL, > + &gBdsEventBeforeConsoleAfterTrustedConsoleGuid, > + &BeforeConsoleAfterTrustedConsoleEvent > + ); > + ASSERT_EFI_ERROR (Status); > + > + // > + // Create BeforeConsoleBeforeEndOfDxeGuid event callback > + // > + Status =3D gBS->CreateEventEx ( > + EVT_NOTIFY_SIGNAL, > + TPL_CALLBACK, > + BdsBeforeConsoleBeforeEndOfDxeGuidCallback, > + NULL, > + &gBdsEventBeforeConsoleBeforeEndOfDxeGuid, > + &BeforeConsoleBeforeEndOfDxeEvent > + ); > + ASSERT_EFI_ERROR (Status); > + > + // > + // Create AfterConsoleReadyBeforeBootOption event callback > + // > + Status =3D gBS->CreateEventEx ( > + EVT_NOTIFY_SIGNAL, > + TPL_CALLBACK, > + BdsAfterConsoleReadyBeforeBootOptionCallback, > + NULL, > + &gBdsEventAfterConsoleReadyBeforeBootOptionGuid, > + &AfterConsoleReadyBeforeBootOptionEvent > + ); > + ASSERT_EFI_ERROR (Status); > + > + return Status; > +} > diff --git a/Platform/Intel/BoardModulePkg/BoardBdsHookDxe/BoardBdsHookDx= e.inf b/Platform/Intel/BoardModulePkg/BoardBdsHookDxe/BoardBdsHookDxe.inf > new file mode 100644 > index 0000000000..e3871d6dd4 > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/BoardBdsHookDxe/BoardBdsHookDxe.inf > @@ -0,0 +1,46 @@ > +### @file > +# Module Information file for the Bds Hook DXE driver. > +# > +# Copyright (c) 2019, Intel Corporation. All rights reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +### > + > +[Defines] > + INF_VERSION =3D 0x00010017 > + BASE_NAME =3D BoardBdsHookDxe > + FILE_GUID =3D EEA6491C-0DC5-48AB-B99D-CE77D14D43F= 2 > + VERSION_STRING =3D 1.0 > + MODULE_TYPE =3D DXE_DRIVER > + ENTRY_POINT =3D BdsHookDxeEntryPoint > + > +[LibraryClasses] > + BaseLib > + UefiBootServicesTableLib > + UefiDriverEntryPoint > + DebugLib > + UefiLib > + BoardBdsHookLib > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + SecurityPkg/SecurityPkg.dec > + MinPlatformPkg/MinPlatformPkg.dec > + BoardModulePkg/BoardModulePkg.dec > + > +[Sources] > + BoardBdsHookDxe.c > + > +[Protocols] > + gEfiPciEnumerationCompleteProtocolGuid > + gEfiDxeSmmReadyToLockProtocolGuid > + > +[Guids] > + gBdsEventBeforeConsoleAfterTrustedConsoleGuid > + gBdsEventBeforeConsoleBeforeEndOfDxeGuid > + gBdsEventAfterConsoleReadyBeforeBootOptionGuid > + > +[Depex] > + TRUE > --=20 > 2.19.1.windows.1 > =