From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on072a.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::72a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 56E1B81C53 for ; Wed, 9 Nov 2016 21:50:28 -0800 (PST) Received: from CS1PR84MB0295.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.26) by CS1PR84MB0294.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6; Thu, 10 Nov 2016 05:50:30 +0000 Received: from CS1PR84MB0295.NAMPRD84.PROD.OUTLOOK.COM ([10.162.190.26]) by CS1PR84MB0295.NAMPRD84.PROD.OUTLOOK.COM ([10.162.190.26]) with mapi id 15.01.0707.013; Thu, 10 Nov 2016 05:50:29 +0000 From: "Wang, Sunny (HPS SW)" To: Ruiyu Ni , "edk2-devel@lists.01.org" CC: Chao B Zhang , Liming Gao , "Wang, Sunny (HPS SW)" , "Haskell, Darrell" Thread-Topic: [edk2] [PATCH v2 3/9] MdeModulePkg/BdsDxe: Check deferred images before booting to OS Thread-Index: AQHSObvUBSWA3NeAbUek034wfc7oPKDRuECw Date: Thu, 10 Nov 2016 05:50:29 +0000 Message-ID: References: <20161108122928.53984-1-ruiyu.ni@intel.com> <20161108122928.53984-4-ruiyu.ni@intel.com> In-Reply-To: <20161108122928.53984-4-ruiyu.ni@intel.com> Accept-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sunnywang@hpe.com; x-originating-ip: [15.211.131.5] x-microsoft-exchange-diagnostics: 1; CS1PR84MB0294; 7:xlj61I1/ooTG+T2VKHrkte2qdEkMA7i8rVs3q80a4bS6ZJ1vZSwd+n2Udbh7z/hZrQ8enX9elNZYlotIU9eElNQqlrFZIr0i01gTOd6j7a4KxsLTaPWlyvfXEfsDJPBS7rD/RJs4DwVm0RHtHWG9XprV7ikj56TjfV/goJMUcsgSSZxuHPxdy/U69UOgjBhiwHUPlpRce942JPlQpvKpWpBPOUWcqLKUpwUPuCuQgyPR8SNzlKY8r9jjAAYqAGUViEgm27f5NuC/2Y3ZSxMHl5lm1I/lp/1pY9oBBBMSJsZNixpM2auFMCbFjHVbt44t0lzXiCXSCscchcCJqcZBnNJ5Wgs8dT1xdXcYiU4Hrbs= x-forefront-antispam-report: SFV:SKI; SCL:-1SFV:NSPM; SFS:(10019020)(6009001)(7916002)(377454003)(13464003)(199003)(189002)(33656002)(87936001)(586003)(3660700001)(3280700002)(7696004)(4326007)(5660300001)(74316002)(99936001)(8936002)(50986999)(2950100002)(76176999)(122556002)(9686002)(2501003)(68736007)(2906002)(6116002)(102836003)(3846002)(66066001)(189998001)(54356999)(105586002)(106116001)(101416001)(86362001)(77096005)(99286002)(8676002)(5001770100001)(305945005)(81166006)(81156014)(97736004)(92566002)(7846002)(7736002)(2900100001)(229853002)(106356001); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR84MB0294; H:CS1PR84MB0295.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; x-ms-office365-filtering-correlation-id: 826396de-8429-4c15-e8c8-08d4092d7a43 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CS1PR84MB0294; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(162533806227266)(21532816269658)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(102415321)(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:CS1PR84MB0294; BCL:0; PCL:0; RULEID:; SRVR:CS1PR84MB0294; x-forefront-prvs: 01221E3973 received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2016 05:50:29.2418 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR84MB0294 Subject: Re: [PATCH v2 3/9] MdeModulePkg/BdsDxe: Check deferred images before booting to OS 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: Thu, 10 Nov 2016 05:50:28 -0000 X-Groupsio-MsgNum: 4496 Content-Language: en-US Content-Type: multipart/mixed; boundary="_002_CS1PR84MB02956EF3E303C604FE7BF697A8B80CS1PR84MB0295NAMP_" --_002_CS1PR84MB02956EF3E303C604FE7BF697A8B80CS1PR84MB0295NAMP_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks for addressing my offline comments. This updated patch looks good to= me.=20 Reviewed-by: Sunny Wang -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ruiy= u Ni Sent: Tuesday, November 08, 2016 8:29 PM To: edk2-devel@lists.01.org Cc: Chao B Zhang ; Liming Gao Subject: [edk2] [PATCH v2 3/9] MdeModulePkg/BdsDxe: Check deferred images b= efore booting to OS The patch adds check of deferred images before booting to OS. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Liming Gao Cc: Chao B Zhang --- MdeModulePkg/Universal/BdsDxe/Bds.h | 4 +- MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 2 + MdeModulePkg/Universal/Bd= sDxe/BdsEntry.c | 90 ++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/BdsDxe/Bds.h b/MdeModulePkg/Universal/B= dsDxe/Bds.h index d243932..1f8a192 100644 --- a/MdeModulePkg/Universal/BdsDxe/Bds.h +++ b/MdeModulePkg/Universal/BdsDxe/Bds.h @@ -1,7 +1,7 @@ /** @file Head file for BDS Architectural Protocol implementation =20 -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 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 @@ -20,10 +20= ,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR= IMPLIED. #include #include #include +#include =20 #include #include #include +#include =20 #include #include d= iff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf b/MdeModulePkg/Univers= al/BdsDxe/BdsDxe.inf index e03cfde..a00b442 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf @@ -79,11 +79,13 @@ [Guids] gConnectConInEventGuid ## SOMETIMES_CONSUMES ## E= vent gEdkiiStatusCodeDataTypeVariableGuid ## SOMETIMES_CONSUMES ## G= UID gPerformanceProtocolGuid ## SOMETIMES_PRODUCES ## V= ariable:L"PerfDataMemAddr" (The ACPI address of performance data) + gEfiEventReadyToBootGuid ## CONSUMES ## E= vent =20 [Protocols] gEfiBdsArchProtocolGuid ## PRODUCES gEfiSimpleTextInputExProtocolGuid ## CONSUMES gEdkiiVariableLockProtocolGuid ## CONSUMES + gEfiDeferredImageLoadProtocolGuid ## CONSUMES =20 [FeaturePcd] gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate ## CONSU= MES diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c b/MdeModulePkg/Univer= sal/BdsDxe/BdsEntry.c index aacc4a6..72adc51 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c @@ -86,6 +86,81 @@ BdsDxeOnConnectConInCallBack ( DEBUG ((EFI_D_WARN, "[Bds] Connect ConIn failed - %r!!!\n", Status)); } } +/** + Notify function for event group EFI_EVENT_GROUP_READY_TO_BOOT. This=20 +is used to + check whether there is remaining deferred load images. + + @param[in] Event The Event that is being processed. + @param[in] Context The Event Context. + +**/ +VOID +EFIAPI +CheckDeferredLoadImageOnReadyToBoot ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + EFI_DEFERRED_IMAGE_LOAD_PROTOCOL *DeferredImage; + UINTN HandleCount; + EFI_HANDLE *Handles; + UINTN Index; + UINTN ImageIndex; + EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath; + VOID *Image; + UINTN ImageSize; + BOOLEAN BootOption; + CHAR16 *DevicePathStr; + + // + // Find all the deferred image load protocols. + // + HandleCount =3D 0; + Handles =3D NULL; + Status =3D gBS->LocateHandleBuffer ( + ByProtocol, + &gEfiDeferredImageLoadProtocolGuid, + NULL, + &HandleCount, + &Handles + ); + if (EFI_ERROR (Status)) { + return; + } + + for (Index =3D 0; Index < HandleCount; Index++) { + Status =3D gBS->HandleProtocol (Handles[Index], &gEfiDeferredImageLoad= ProtocolGuid, (VOID **) &DeferredImage); + if (EFI_ERROR (Status)) { + continue; + } + + for (ImageIndex =3D 0; ; ImageIndex++) { + // + // Load all the deferred images in this protocol instance. + // + Status =3D DeferredImage->GetImageInfo ( + DeferredImage, + ImageIndex, + &ImageDevicePath, + (VOID **) &Image, + &ImageSize, + &BootOption + ); + if (EFI_ERROR (Status)) { + break; + } + DevicePathStr =3D ConvertDevicePathToText (ImageDevicePath, FALSE, F= ALSE); + DEBUG ((DEBUG_LOAD, "[Bds] Image was deferred but not loaded: %s.\n"= , DevicePathStr)); + if (DevicePathStr !=3D NULL) { + FreePool (DevicePathStr); + } + } + } + if (Handles !=3D NULL) { + FreePool (Handles); + } +} =20 /** =20 @@ -119,6 +194,21 @@ BdsInitialize ( ); ASSERT_EFI_ERROR (Status); =20 + DEBUG_CODE ( + EFI_EVENT Event; + // + // Register notify function to check deferred images on ReadyToBoot Ev= ent. + // + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + CheckDeferredLoadImageOnReadyToBoot, + NULL, + &gEfiEventReadyToBootGuid, + &Event + ); + ASSERT_EFI_ERROR (Status); + ); return Status; } =20 -- 2.9.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel --_002_CS1PR84MB02956EF3E303C604FE7BF697A8B80CS1PR84MB0295NAMP_ Content-Type: message/rfc822 Content-Disposition: attachment; creation-date="Thu, 10 Nov 2016 05:50:24 GMT"; modification-date="Thu, 10 Nov 2016 05:50:24 GMT" Received: from AT5PR84MB0292.NAMPRD84.PROD.OUTLOOK.COM (10.162.138.26) by CS1PR84MB0295.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6 via Mailbox Transport; Mon, 7 Nov 2016 02:35:30 +0000 Received: from CS1PR84CA0009.NAMPRD84.PROD.OUTLOOK.COM (10.162.188.19) by AT5PR84MB0292.NAMPRD84.PROD.OUTLOOK.COM (10.162.138.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6; Mon, 7 Nov 2016 02:35:27 +0000 Received: from CO1NAM03FT047.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::207) by CS1PR84CA0009.outlook.office365.com (2a01:111:e400:740c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6 via Frontend Transport; Mon, 7 Nov 2016 02:35:27 +0000 Received: from G2W6309.americas.hpqcorp.net (15.219.163.14) by CO1NAM03FT047.mail.protection.outlook.com (10.152.81.48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.3 via Frontend Transport; Mon, 7 Nov 2016 02:35:27 +0000 Received: from G1W8108.americas.hpqcorp.net (16.193.72.60) by G2W6309.americas.hpqcorp.net (16.197.64.51) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Mon, 7 Nov 2016 02:35:14 +0000 Received: from g2t2357.austin.hpe.com (15.233.44.30) by G1W8108.americas.hpqcorp.net (16.193.72.60) with Microsoft SMTP Server (TLS) id 15.0.1076.9 via Frontend Transport; Mon, 7 Nov 2016 02:35:14 +0000 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by g2t2357.austin.hpe.com (Postfix) with ESMTPS id 6F67A5E; Mon, 7 Nov 2016 02:35:13 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP; 06 Nov 2016 18:35:12 -0800 Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 06 Nov 2016 18:35:12 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 6 Nov 2016 18:35:12 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.209]) by shsmsx102.ccr.corp.intel.com ([169.254.2.206]) with mapi id 14.03.0248.002; Mon, 7 Nov 2016 10:35:11 +0800 From: "Ni, Ruiyu" To: "Wang, Sunny (HPS SW)" CC: "Haskell, Darrell" Subject: RE: [edk2] [PATCH 3/4] MdeModulePkg/BdsDxe: Check deferred images before booting to OS Thread-Topic: [edk2] [PATCH 3/4] MdeModulePkg/BdsDxe: Check deferred images before booting to OS Thread-Index: AQHSNjbOeXsKfZWZrEitbQzFvOq7wKDIWJ5QgAR6E4A= Importance: high X-Priority: 1 Date: Mon, 7 Nov 2016 02:35:11 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D58E56773@SHSMSX104.ccr.corp.intel.com> References: <20161104005942.345832-1-ruiyu.ni@intel.com> <20161104005942.345832-4-ruiyu.ni@intel.com> In-Reply-To: Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Exchange-Organization-AuthMechanism: 10 X-MS-Exchange-Organization-AuthSource: G1W8108.americas.hpqcorp.net X-MS-Has-Attach: X-MS-Exchange-Organization-Network-Message-Id: 7b250d26-004d-417e-cb44-08d406b6bc28 X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] x-pmx-version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2016.11.7.22715 x-pmx-spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, IN_REP_TO 0, LEGITIMATE_NEGATE 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, REFERENCES 0, SINGLE_URI_IN_BODY 0, WEBMAIL_SOURCE 0, WEBMAIL_XOIP 0, WEBMAIL_X_IP_HDR 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CANPHARM_COPYRIGHT 0, __CC_NAME 0, __CC_NAME_DIFF_FROM_ACC 0, __CC_REAL_NAMES 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FORWARDED_MSG 0, __HAS_CC_HDR 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_XOIP 0, __HTTPS_URI 0, __IMS_MSGID 0, __IN_REP_TO 0, __LINES_OF_YELLING 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_VERSION 0, __REFERENCES 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __SUBJ_ALPHA_NEGATE 0, __TO_MALFORMED_2 0, __TO_NAME 0, __TO_NAME_DIFF_FROM_ACC 0, __TO_REAL_NAMES 0, __URI_IN_BODY 0, __URI_NO_WWW 0, __URI_NS , __URI_WITH_PATH 0' x-ironport-av: E=Sophos;i="5.31,604,1473145200"; d="scan'208";a="1081516778" received-spf: Fail (protection.outlook.com: domain of intel.com does not designate 15.219.163.14 as permitted sender) receiver=protection.outlook.com; client-ip=15.219.163.14; helo=G2W6309.americas.hpqcorp.net; X-Microsoft-Exchange-Diagnostics: 1;CS1PR84MB0295;9:Q5pWn3/VYux9yY09SDBxh/mKDNVjY+ZgOQkZAkToGgkfpz1Iv0bgpO1RTz9mNB3qTuY1QicNWEMRoDD3g4vvXdGTdVX4xFAvJj1lXhJq5nkJve+jIfpFAHPrykbUzUQG2Mus8O3UgGntnXxWDXpSFumQdt88b88iSmuMDuk8EveISPAoQlKt/T9F5kg+RDuY2N6VAOB7HxJ5vO8v1zqOnw== Content-Type: text/plain; charset="us-ascii" Content-ID: <8D0CFE640C718649BA4B598E1B877BD3@NAMPRD84.PROD.OUTLOOK.COM> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Thanks/Ray > -----Original Message----- > From: Wang, Sunny (HPS SW) [mailto:sunnywang@hpe.com] > Sent: Friday, November 4, 2016 7:34 PM > To: Ni, Ruiyu > Cc: Wang, Sunny (HPS SW) ; Haskell, Darrell > > Subject: RE: [edk2] [PATCH 3/4] MdeModulePkg/BdsDxe: Check deferred > images before booting to OS > > Hi Ray, > Remove others. Feel free to add some people back. > CheckDeferredLoadImageOnReadyToBoot() is almost the same as > CheckDeferredImage() in Intel Central park reference code, so It looks go= od > to me. > However, I have a question and a suggestion below: > Question: > - ReadyToBoot event is possibly signaled more than once during = a boot. > Why do we need to call CheckDeferredLoadImageOnReadyToBoot() more > than once during a boot? If it is related to use cases of deferred image,= could > you give more information? I'm not familiar with the use cases of the > deferred image, but I would like to know if it is worth for HPE sever to = take > little additional boot time to call CheckDeferredLoadImageOnReadyToBoot() > more than once during a boot. Thanks in advance. Yes I agree calling this more than once is unnecessary. I will change the p= atch to call it only once. > > Suggestions: > - It looks like CheckDeferredLoadImageOnReadyToBoot() is only fo= r > printing DEBUG messages. Is there anything which I overlook? If not, is = it a > good idea to add this CheckDeferredLoadImage() as a UefiBootManagerLib > API instead of adding this as a Notify function in BdsDxe? So that all t= he > companies can decide whether/when they want to call > CheckDeferredLoadImage() in BDS platform code instead of being forced > calling it with ReadyToBoot event signaled in BDS core code. I see your needs now. So how about I only register this callback in DEBUG build, surrounding the code with DEBUG_CODE() macro? Make this as an API requires platform manually register this callback, whic= h I think is not very convenient to platform. > > Regards, > Sunny Wang > > > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Ruiyu Ni > Sent: Friday, November 04, 2016 9:00 AM > To: edk2-devel@lists.01.org > Cc: Chao B Zhang ; Liming Gao > > Subject: [edk2] [PATCH 3/4] MdeModulePkg/BdsDxe: Check deferred > images before booting to OS > > The patch adds check of deferred images before booting to OS. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ruiyu Ni > Cc: Liming Gao > Cc: Chao B Zhang > --- > MdeModulePkg/Universal/BdsDxe/Bds.h | 4 +- > MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 2 + > MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 89 > ++++++++++++++++++++++++++++++++ > 3 files changed, 94 insertions(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Universal/BdsDxe/Bds.h > b/MdeModulePkg/Universal/BdsDxe/Bds.h > index d243932..1f8a192 100644 > --- a/MdeModulePkg/Universal/BdsDxe/Bds.h > +++ b/MdeModulePkg/Universal/BdsDxe/Bds.h > @@ -1,7 +1,7 @@ > /** @file > Head file for BDS Architectural Protocol implementation > > -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
> +Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
> 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 > @@ -20,10 +20,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF > ANY KIND, EITHER EXPRESS OR IMPLIED. > #include > #include > #include > +#include > > #include > #include > #include > +#include > > #include #include > diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > index e03cfde..a00b442 100644 > --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > @@ -79,11 +79,13 @@ [Guids] > gConnectConInEventGuid ## SOMETIMES_CONSUMES ##= Event > gEdkiiStatusCodeDataTypeVariableGuid ## SOMETIMES_CONSUMES > ## GUID > gPerformanceProtocolGuid ## SOMETIMES_PRODUCES ## > Variable:L"PerfDataMemAddr" (The ACPI address of performance data) > + gEfiEventReadyToBootGuid ## CONSUMES ##= Event > > [Protocols] > gEfiBdsArchProtocolGuid ## PRODUCES > gEfiSimpleTextInputExProtocolGuid ## CONSUMES > gEdkiiVariableLockProtocolGuid ## CONSUMES > + gEfiDeferredImageLoadProtocolGuid ## CONSUMES > > [FeaturePcd] > gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate ## > CONSUMES > diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > index aacc4a6..ffa884a 100644 > --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > @@ -86,7 +86,83 @@ BdsDxeOnConnectConInCallBack ( > DEBUG ((EFI_D_WARN, "[Bds] Connect ConIn failed - %r!!!\n", Status))= ; > } > } > +/** > + Notify function for event group EFI_EVENT_GROUP_READY_TO_BOOT. > This > +is used to > + check whether there is remaining deferred load images. > + > + @param[in] Event The Event that is being processed. > + @param[in] Context The Event Context. > + > +**/ > +VOID > +EFIAPI > +CheckDeferredLoadImageOnReadyToBoot ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + EFI_STATUS Status; > + EFI_DEFERRED_IMAGE_LOAD_PROTOCOL *DeferredImage; > + UINTN HandleCount; > + EFI_HANDLE *Handles; > + UINTN Index; > + UINTN ImageIndex; > + EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath; > + VOID *Image; > + UINTN ImageSize; > + BOOLEAN BootOption; > + > + // > + // Find all the deferred image load protocols. > + // > + HandleCount =3D 0; > + Handles =3D NULL; > + Status =3D gBS->LocateHandleBuffer ( > + ByProtocol, > + &gEfiDeferredImageLoadProtocolGuid, > + NULL, > + &HandleCount, > + &Handles > + ); > + if (EFI_ERROR (Status)) { > + return; > + } > + > + for (Index =3D 0; Index < HandleCount; Index++) { > + Status =3D gBS->HandleProtocol (Handles[Index], > &gEfiDeferredImageLoadProtocolGuid, (VOID **) &DeferredImage); > + if (EFI_ERROR (Status)) { > + continue; > + } > > + for (ImageIndex =3D 0; ; ImageIndex++) { > + // > + // Load all the deferred images in this protocol instance. > + // > + Status =3D DeferredImage->GetImageInfo ( > + DeferredImage, > + ImageIndex, > + &ImageDevicePath, > + (VOID **) &Image, > + &ImageSize, > + &BootOption > + ); > + if (EFI_ERROR (Status)) { > + break; > + } > + DEBUG_CODE ( > + CHAR16 *DevicePathStr; > + DevicePathStr =3D ConvertDevicePathToText (ImageDevicePath, FALS= E, > FALSE); > + DEBUG ((DEBUG_LOAD, "[Bds] Image was deferred but not > loaded: %s.\n", DevicePathStr)); > + if (DevicePathStr !=3D NULL) { > + FreePool (DevicePathStr); > + } > + ); > + } > + } > + if (Handles !=3D NULL) { > + FreePool (Handles); > + } > +} > /** > > Install Boot Device Selection Protocol @@ -108,6 +184,7 @@ BdsInitiali= ze ( { > EFI_STATUS Status; > EFI_HANDLE Handle; > + EFI_EVENT Event; > // > // Install protocol interface > // > @@ -119,6 +196,18 @@ BdsInitialize ( > ); > ASSERT_EFI_ERROR (Status); > > + // > + // Register notify function to check deferred images on ReadyToBoot > Event. > + // > + Status =3D gBS->CreateEventEx ( > + EVT_NOTIFY_SIGNAL, > + TPL_CALLBACK, > + CheckDeferredLoadImageOnReadyToBoot, > + NULL, > + &gEfiEventReadyToBootGuid, > + &Event > + ); > + ASSERT_EFI_ERROR (Status); > return Status; > } > > -- > 2.9.0.windows.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel --_002_CS1PR84MB02956EF3E303C604FE7BF697A8B80CS1PR84MB0295NAMP_--