From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0714.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe46::714]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8397F81D78 for ; Wed, 9 Nov 2016 21:52:09 -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:52:11 +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:52:10 +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 2/9] MdeModulePkg/UefiBootManager: Add EfiBootManagerDispatchDeferredImages Thread-Index: AQHSObvWxWeYdXWQMkKn1Qy7hTQz6aDRuVqA Date: Thu, 10 Nov 2016 05:52:10 +0000 Message-ID: References: <20161108122928.53984-1-ruiyu.ni@intel.com> <20161108122928.53984-3-ruiyu.ni@intel.com> In-Reply-To: <20161108122928.53984-3-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:8B6GUEvHgVE7lyTmcDEJHe53l080i+Xr483kXWcr6R6shy2FY6StskgPXkS+cd2k0mqyDpaiD7zZAhhIGUfByBl74uLWHqj7FBNnGUftKz9YP6wkF8XU3yRnvXrF2t0AmHnF+4U6ym85LcA4vyWyFeUQuBGKEjjiyvv1mWklROi0QG38U8Hr20Kwpnl/LMvpumG5O97reNQBjSqYC2rO/p3IA3piro2s8qzLUx/YPvWyTtk/NT6vnKm2wShLZ6L7I333/0VFZbvzWgksimJMTYyjbeiRTJxEhryGZgUF6cqTK4uDAwjixRJFyP8jytNClLApzUp8W6mCGJoV9+sNjPg/k0pEIcw7dDkB3ZVtKco= 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)(213903007)(19627235001); 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: 09846cde-630a-4a3a-e09c-08d4092db6a7 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CS1PR84MB0294; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(162533806227266)(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:52:10.5683 (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 2/9] MdeModulePkg/UefiBootManager: Add EfiBootManagerDispatchDeferredImages 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:52:10 -0000 X-Groupsio-MsgNum: 4497 Content-Language: en-US Content-Type: multipart/mixed; boundary="_002_CS1PR84MB0295ACCBDB02DDC836A87379A8B80CS1PR84MB0295NAMP_" --_002_CS1PR84MB0295ACCBDB02DDC836A87379A8B80CS1PR84MB0295NAMP_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks for addressing my offline comments. This patch looks good to me.=20 Reviewed-by: Sunny Wang Regards, 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 2/9] MdeModulePkg/UefiBootManager: Add EfiBootMan= agerDispatchDeferredImages The API dispatches the deferred images that are returned from all DeferredI= mageLoad instances. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Liming Gao Cc: Chao B Zhang --- MdeModulePkg/Include/Library/UefiBootManagerLib.h | 13 +++ MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c | 113 +++++++++++++++++= ++++ .../Library/UefiBootManagerLib/InternalBm.h | 1 + .../UefiBootManagerLib/UefiBootManagerLib.inf | 1 + 4 files changed, 128 insertions(+) diff --git a/MdeModulePkg/Include/Library/UefiBootManagerLib.h b/MdeModuleP= kg/Include/Library/UefiBootManagerLib.h index e333ffd..97ac1f2 100644 --- a/MdeModulePkg/Include/Library/UefiBootManagerLib.h +++ b/MdeModulePkg/Include/Library/UefiBootManagerLib.h @@ -777,4 +777,17 @@ EfiBootManagerIsValidLoadOptionVariableName ( OUT UINT16 *OptionNumber OPTIONAL ); =20 + +/** + Dispatch the deferred images that are returned from all DeferredImageLoa= d instances. + + @retval EFI_SUCCESS At least one deferred image is loaded successf= ully and started. + @retval EFI_NOT_FOUND There is no deferred image. + @retval EFI_ACCESS_DENIED There are deferred images but all of them are = failed to load. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerDispatchDeferredImages ( + VOID + ); #endif diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c b/MdeModulePk= g/Library/UefiBootManagerLib/BmMisc.c index 2a60f06..09e4211 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c @@ -417,3 +417,116 @@ BmCharToUint ( return (UINTN) -1; } =20 +/** + Dispatch the deferred images that are returned from all DeferredImageLoa= d instances. + + @retval EFI_SUCCESS At least one deferred image is loaded successf= ully and started. + @retval EFI_NOT_FOUND There is no deferred image. + @retval EFI_ACCESS_DENIED There are deferred images but all of them are = failed to load. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerDispatchDeferredImages ( + VOID + ) +{ + 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; + EFI_HANDLE ImageHandle; + UINTN ExitDataSize; + CHAR16 *ExitData; + UINTN ImageCount; + UINTN LoadCount; + + // + // 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 EFI_NOT_FOUND; + } + + ImageCount =3D 0; + LoadCount =3D 0; + 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; + } + ImageCount++; + // + // Load and start the image. + // + Status =3D gBS->LoadImage ( + BootOption, + gImageHandle, + ImageDevicePath, + NULL, + 0, + &ImageHandle + ); + if (!EFI_ERROR (Status)) { + LoadCount++; + // + // Before calling the image, enable the Watchdog Timer for + // a 5 Minute period + // + gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL); + Status =3D gBS->StartImage (ImageHandle, &ExitDataSize, &ExitData)= ; + if (ExitData !=3D NULL) { + FreePool (ExitData); + } + + // + // Clear the Watchdog Timer after the image returns. + // + gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL); + } + } + } + if (Handles !=3D NULL) { + FreePool (Handles); + } + + if (ImageCount =3D=3D 0) { + return EFI_NOT_FOUND; + } else { + if (LoadCount =3D=3D 0) { + return EFI_ACCESS_DENIED; + } else { + return EFI_SUCCESS; + } + } +} diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h b/MdeModu= lePkg/Library/UefiBootManagerLib/InternalBm.h index cb719e9..444d4a5 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h @@ -44,6 +44,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER= EXPRESS OR IMPLIED. #include #include #include +#include =20 #include #include diff -= -git a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf b/Mde= ModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf index 8c3fd7f..bb7c00d 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf +++ b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf @@ -109,6 +109,7 @@ [Protocols] gEfiDriverHealthProtocolGuid ## SOMETIMES_CONSUMES gEfiFormBrowser2ProtocolGuid ## SOMETIMES_CONSUMES gEfiRamDiskProtocolGuid ## SOMETIMES_CONSUMES + gEfiDeferredImageLoadProtocolGuid ## CONSUMES =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange = ## SOMETIMES_CONSUMES -- 2.9.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel --_002_CS1PR84MB0295ACCBDB02DDC836A87379A8B80CS1PR84MB0295NAMP_ Content-Type: message/rfc822 Content-Disposition: attachment; creation-date="Thu, 10 Nov 2016 05:52:07 GMT"; modification-date="Thu, 10 Nov 2016 05:52:07 GMT" Received: from DF4PR84MB0297.NAMPRD84.PROD.OUTLOOK.COM (10.162.193.23) 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:38:19 +0000 Received: from CS1PR84CA0023.NAMPRD84.PROD.OUTLOOK.COM (10.162.188.33) by DF4PR84MB0297.NAMPRD84.PROD.OUTLOOK.COM (10.162.193.23) 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:38:19 +0000 Received: from BY2NAM03FT063.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::207) by CS1PR84CA0023.outlook.office365.com (2a01:111:e400:740c::33) 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:38:19 +0000 Received: from G2W6310.americas.hpqcorp.net (15.219.163.15) by BY2NAM03FT063.mail.protection.outlook.com (10.152.85.182) 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:38:18 +0000 Received: from G2W6309.americas.hpqcorp.net (2002:10ef:406b::10ef:406b) by G2W6310.americas.hpqcorp.net (2002:10ef:4076::10ef:4076) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Mon, 7 Nov 2016 02:38:04 +0000 Received: from g2t2357.austin.hpe.com (15.233.44.30) by G2W6309.americas.hpqcorp.net (16.197.64.51) with Microsoft SMTP Server (TLS) id 15.0.1076.9 via Frontend Transport; Mon, 7 Nov 2016 02:38:04 +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 800AF57; Mon, 7 Nov 2016 02:38:03 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 06 Nov 2016 18:38:02 -0800 Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga001.jf.intel.com with ESMTP; 06 Nov 2016 18:38:02 -0800 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 6 Nov 2016 18:38:02 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 6 Nov 2016 18:38:01 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.209]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.2]) with mapi id 14.03.0248.002; Mon, 7 Nov 2016 10:37:59 +0800 From: "Ni, Ruiyu" To: "Wang, Sunny (HPS SW)" CC: "Haskell, Darrell" Subject: RE: [edk2] [PATCH 2/4] MdeModulePkg/UefiBootManager: Add EfiBootManagerDispatchDeferredImages Thread-Topic: [edk2] [PATCH 2/4] MdeModulePkg/UefiBootManager: Add EfiBootManagerDispatchDeferredImages Thread-Index: AQHSNjbOk2218bbADUmFNOTLyP6iqaDIYDwggARzPoA= Importance: high X-Priority: 1 Date: Mon, 7 Nov 2016 02:37:59 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D58E5679E@SHSMSX104.ccr.corp.intel.com> References: <20161104005942.345832-1-ruiyu.ni@intel.com> <20161104005942.345832-3-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: G2W6309.americas.hpqcorp.net X-MS-Has-Attach: X-MS-Exchange-Organization-Network-Message-Id: c4a235cf-d527-401b-6b6b-08d406b72226 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, __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="1056139191" received-spf: Fail (protection.outlook.com: domain of intel.com does not designate 15.219.163.15 as permitted sender) receiver=protection.outlook.com; client-ip=15.219.163.15; helo=G2W6310.americas.hpqcorp.net; X-Microsoft-Exchange-Diagnostics: 1;CS1PR84MB0295;9:/BnyplEFu5ZmRGET0sEC91ddyISCOGgHf5dAkfijkrntmsEAM643EEsEmKBKHauH+IX+E/kSFzdf/jvXu2Xp5ZObM4gpEZbg8hUHuv9OEt0bw+UYvSLx6YxUqC2Y3vmXzOKsoouCWrIhtAhf39M/nLQI7Inh+nlTbagG5RAu5WslLGIRQQYDTUkViYimYu3QmGRLTwYuuZXYG1/tyegx/A== Content-Type: text/plain; charset="us-ascii" Content-ID: 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:42 PM > To: Ni, Ruiyu > Cc: Wang, Sunny (HPS SW) ; Haskell, Darrell > > Subject: RE: [edk2] [PATCH 2/4] MdeModulePkg/UefiBootManager: Add > EfiBootManagerDispatchDeferredImages > > Hi Ray, > Remove others. Feel free to add some people back. > EfiBootManagerDispatchDeferredImages () is almost the same as > LoadDeferredImage () in UserIdentifyManagerDxe\LoadDeferredImage.c, so > It looks good to me. > However, I still have a question from my curiosity. Why don't you just si= mply > call USER_MANAGER_PROTOCOL->Identify to trigger LoadDeferredImage() > right after signaling EndOfDxe in platform BDS code instead of this patch > series? UID (User Identification) is a standalone feature and I don't think it is actively used by the industry. I don't want to combine this feature with the UID. > > By the way, besides the question above, I still have two minor questions > below, but I think I will see the answer when you send your platform patc= h. > 1. Will EfiBootManagerDispatchDeferredImages() only be consumed/called > by BDS platform code? In other words, we will not call > EfiBootManagerDispatchDeferredImages() in BdsDxe module, right? Yes It has to be called from PlatformBDS because it should be called after platform signals the EndOfDxe event (and Install ReadyToLock protocol). > 2. Since EfiBootManagerDispatchDeferredImages() is almost the same as > LoadDeferredImage(), will you remove LoadDeferredImage() from > UserIdentifyManagerDxe module and call this new API right after calling > USER_MANAGER_PROTOCOL->Identify in BDS platform code instead? Sounds like a good idea. I will do it after this patches are committed. > > 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 2/4] MdeModulePkg/UefiBootManager: Add > EfiBootManagerDispatchDeferredImages > > The API dispatches the deferred images that are returned from all > DeferredImageLoad instances. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ruiyu Ni > Cc: Liming Gao > Cc: Chao B Zhang > --- > MdeModulePkg/Include/Library/UefiBootManagerLib.h | 13 +++ > MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c | 113 > +++++++++++++++++++++ > .../Library/UefiBootManagerLib/InternalBm.h | 1 + > .../UefiBootManagerLib/UefiBootManagerLib.inf | 1 + > 4 files changed, 128 insertions(+) > > diff --git a/MdeModulePkg/Include/Library/UefiBootManagerLib.h > b/MdeModulePkg/Include/Library/UefiBootManagerLib.h > index e333ffd..97ac1f2 100644 > --- a/MdeModulePkg/Include/Library/UefiBootManagerLib.h > +++ b/MdeModulePkg/Include/Library/UefiBootManagerLib.h > @@ -777,4 +777,17 @@ EfiBootManagerIsValidLoadOptionVariableName ( > OUT UINT16 *OptionNumber OPTIONAL > ); > > + > +/** > + Dispatch the deferred images that are returned from all > DeferredImageLoad instances. > + > + @retval EFI_SUCCESS At least one deferred image is loaded succes= sfully > and started. > + @retval EFI_NOT_FOUND There is no deferred image. > + @retval EFI_ACCESS_DENIED There are deferred images but all of them > are failed to load. > +**/ > +EFI_STATUS > +EFIAPI > +EfiBootManagerDispatchDeferredImages ( > + VOID > + ); > #endif > diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c > b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c > index 2a60f06..09e4211 100644 > --- a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c > +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c > @@ -417,3 +417,116 @@ BmCharToUint ( > return (UINTN) -1; > } > > +/** > + Dispatch the deferred images that are returned from all > DeferredImageLoad instances. > + > + @retval EFI_SUCCESS At least one deferred image is loaded succes= sfully > and started. > + @retval EFI_NOT_FOUND There is no deferred image. > + @retval EFI_ACCESS_DENIED There are deferred images but all of them > are failed to load. > +**/ > +EFI_STATUS > +EFIAPI > +EfiBootManagerDispatchDeferredImages ( > + VOID > + ) > +{ > + 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; > + EFI_HANDLE ImageHandle; > + UINTN ExitDataSize; > + CHAR16 *ExitData; > + UINTN ImageCount; > + UINTN LoadCount; > + > + // > + // 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 EFI_NOT_FOUND; > + } > + > + ImageCount =3D 0; > + LoadCount =3D 0; > + 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; > + } > + ImageCount++; > + // > + // Load and start the image. > + // > + Status =3D gBS->LoadImage ( > + BootOption, > + gImageHandle, > + ImageDevicePath, > + NULL, > + 0, > + &ImageHandle > + ); > + if (!EFI_ERROR (Status)) { > + LoadCount++; > + // > + // Before calling the image, enable the Watchdog Timer for > + // a 5 Minute period > + // > + gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL); > + Status =3D gBS->StartImage (ImageHandle, &ExitDataSize, &ExitDat= a); > + if (ExitData !=3D NULL) { > + FreePool (ExitData); > + } > + > + // > + // Clear the Watchdog Timer after the image returns. > + // > + gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL); > + } > + } > + } > + if (Handles !=3D NULL) { > + FreePool (Handles); > + } > + > + if (ImageCount =3D=3D 0) { > + return EFI_NOT_FOUND; > + } else { > + if (LoadCount =3D=3D 0) { > + return EFI_ACCESS_DENIED; > + } else { > + return EFI_SUCCESS; > + } > + } > +} > diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h > b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h > index cb719e9..444d4a5 100644 > --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h > +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h > @@ -44,6 +44,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY > KIND, EITHER EXPRESS OR IMPLIED. > #include > #include > #include > +#include > > #include #include > diff --git > a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf > b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf > index 8c3fd7f..bb7c00d 100644 > --- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf > +++ > b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf > @@ -109,6 +109,7 @@ [Protocols] > gEfiDriverHealthProtocolGuid ## SOMETIMES_CONSUMES > gEfiFormBrowser2ProtocolGuid ## SOMETIMES_CONSUMES > gEfiRamDiskProtocolGuid ## SOMETIMES_CONSUMES > + gEfiDeferredImageLoadProtocolGuid ## CONSUMES > > [Pcd] > > gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationC > hange ## SOMETIMES_CONSUMES > -- > 2.9.0.windows.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel --_002_CS1PR84MB0295ACCBDB02DDC836A87379A8B80CS1PR84MB0295NAMP_--