From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=15.233.44.26; helo=g2t2353.austin.hpe.com; envelope-from=sunnywang@hpe.com; receiver=edk2-devel@lists.01.org Received: from g2t2353.austin.hpe.com (g2t2353.austin.hpe.com [15.233.44.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 924CC211F8866 for ; Thu, 28 Jun 2018 23:43:21 -0700 (PDT) Received: from G9W8454.americas.hpqcorp.net (g9w8454.houston.hp.com [16.216.161.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2353.austin.hpe.com (Postfix) with ESMTPS id 3537077; Fri, 29 Jun 2018 06:43:20 +0000 (UTC) Received: from G4W9122.americas.hpqcorp.net (2002:10d2:1511::10d2:1511) by G9W8454.americas.hpqcorp.net (2002:10d8:a104::10d8:a104) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 29 Jun 2018 06:43:19 +0000 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (15.241.52.10) by G4W9122.americas.hpqcorp.net (16.210.21.17) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Fri, 29 Jun 2018 06:43:19 +0000 Received: from CS1PR8401MB0933.NAMPRD84.PROD.OUTLOOK.COM (10.169.24.135) by CS1PR8401MB0360.NAMPRD84.PROD.OUTLOOK.COM (10.169.12.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.20; Fri, 29 Jun 2018 06:43:17 +0000 Received: from CS1PR8401MB0933.NAMPRD84.PROD.OUTLOOK.COM ([fe80::c567:d0e5:c732:9a66]) by CS1PR8401MB0933.NAMPRD84.PROD.OUTLOOK.COM ([fe80::c567:d0e5:c732:9a66%12]) with mapi id 15.20.0906.023; Fri, 29 Jun 2018 06:43:16 +0000 From: "Wang, Sunny (HPS SW)" To: Ruiyu Ni , "edk2-devel@lists.01.org" CC: Sean Brogan , Michael Turner , Laszlo Ersek , "Wang, Sunny (HPS SW)" Thread-Topic: [PATCH v2 1/2] MdeModulePkg/UefiBootManagerLib: new APIs for ultimate boot failure Thread-Index: AQHUD27n0kFo7Dyay0StHdK0S8SpHqR2yPMA Date: Fri, 29 Jun 2018 06:43:16 +0000 Message-ID: References: <20180629060344.105716-1-ruiyu.ni@intel.com> <20180629060344.105716-2-ruiyu.ni@intel.com> In-Reply-To: <20180629060344.105716-2-ruiyu.ni@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sunnywang@hpe.com; x-originating-ip: [220.129.201.23] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CS1PR8401MB0360; 7:URZ2jG4Sogez++Rz3CLeZrUAF/6Q4OLOMtiL42hfo7Q1NJXatpN7Aexvc+txp1OlJKHUHoMd60HOSLJpJWxAWpq9l6kA/AZIzDfRknixhfEAzlHzZ+wjfay2a288Mb7IK32J59RmtKY1foyHOj+0jq0xuNR3s62qdk3u4iiu0h3+lUQk1lNEnA+LPIM7gg1e5m3yUHN8510+SvBlLo8I0wGp5EpB/wAXsv+KBbtFokkyV30O75bKplYMLTtllb9S x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10019020)(366004)(39860400002)(396003)(136003)(346002)(376002)(189003)(199004)(13464003)(110136005)(97736004)(81156014)(6246003)(8676002)(4326008)(7736002)(81166006)(8936002)(25786009)(14454004)(305945005)(6116002)(966005)(74316002)(478600001)(3846002)(5660300001)(33656002)(2906002)(53936002)(6306002)(55016002)(6436002)(76176011)(7696005)(53546011)(186003)(6506007)(11346002)(446003)(102836004)(26005)(68736007)(99286004)(2900100001)(476003)(5250100002)(2501003)(14444005)(256004)(229853002)(486006)(316002)(106356001)(54906003)(105586002)(66066001)(575784001)(86362001)(9686003); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR8401MB0360; H:CS1PR8401MB0933.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-ms-office365-filtering-correlation-id: e5c8dabe-bebb-4ce0-e6bd-08d5dd8b9845 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:(222181515654134); BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:CS1PR8401MB0360; x-ms-traffictypediagnostic: CS1PR8401MB0360: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(227479698468861)(278428928389397)(89211679590171)(162533806227266)(222181515654134)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231254)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:CS1PR8401MB0360; BCL:0; PCL:0; RULEID:; SRVR:CS1PR8401MB0360; x-forefront-prvs: 0718908305 received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: KC53jWTgiSOgQw8ph2x5zduOG/r3GP19VuxyhtgmK9eKNVNzJMwZyC49c844IyzTgEYW8CLqjncWic8f7WR5cSaPgoqBRePJY0vWHrvwN77u7b1d4ZVbNBRlFTNutuGzMiEdeRMkwfEH0AIy6ce7wSd7B4B8TBfLghaaIJBbdh3/zyEt5foYeI/Z3YuFDVElNrviuCwUxOKpNkJN3+EWRXLfGcIbdCT+NGVOdWZkup2JhLhPAHeMTn3oig89UUoihTWxm5/ILhGbAsPu4WM14lMm3Gg6Mb3NmZdbuUT08JATWMjpudyas36JM0b2F3y4A8tXRjg2Y5yTdOY95jlxmSty+51Wl8aiTdc1ovRi69k= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: e5c8dabe-bebb-4ce0-e6bd-08d5dd8b9845 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jun 2018 06:43:16.6953 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB0360 X-OriginatorOrg: hpe.com Subject: Re: [PATCH v2 1/2] MdeModulePkg/UefiBootManagerLib: new APIs for ultimate boot failure X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2018 06:43:21 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Looks good to me. Thanks for addressing my comment, Ray.=20 Reviewed-by: Sunny Wang -----Original Message----- From: Ruiyu Ni [mailto:ruiyu.ni@intel.com]=20 Sent: Friday, June 29, 2018 2:04 PM To: edk2-devel@lists.01.org Cc: Sean Brogan ; Michael Turner ; Laszlo Ersek ; Wang, Sunny (HPS SW) Subject: [PATCH v2 1/2] MdeModulePkg/UefiBootManagerLib: new APIs for ultim= ate boot failure REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D982 When no boot option could be launched including platform recovery options a= nd options pointing to applications built into firmware volumes, a platform= callback registered through EfiBootManagerRegisterUnableToBootHandler() is called. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Sean Brogan Cc: Michael Turner Cc: Laszlo Ersek Cc: Sunny Wang --- MdeModulePkg/Include/Library/UefiBootManagerLib.h | 48 +++++++++++++++++++= ++++ MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 41 ++++++++++++++= +++++ 2 files changed, 89 insertions(+) diff --git a/MdeModulePkg/Include/Library/UefiBootManagerLib.h b/MdeModuleP= kg/Include/Library/UefiBootManagerLib.h index bfc0cb86f8..453893e030 100644 --- a/MdeModulePkg/Include/Library/UefiBootManagerLib.h +++ b/MdeModulePkg/Include/Library/UefiBootManagerLib.h @@ -800,4 +800,52 @@ EFIAPI EfiBootManagerDispatchDeferredImages ( VOID ); + +/** + The function is called when no boot option could be launched, + including platform recovery options and options pointing to=20 +applications + built into firmware volumes. + + The platform may register this function to inform the user about the abo= ve fact. + If this function returns, BDS core attempts to enter an infinite loop=20 +of pulling + up the Boot Manager Menu (if the platform includes the Boot Manager Menu= ). + If the Boot Manager Menu is unavailable, BDS will hang. +**/ +typedef +VOID +(EFIAPI *EFI_BOOT_MANAGER_UNABLE_TO_BOOT) ( + VOID + ); + +/** + Register the callback function when no boot option could be launched, + including platform recovery options and options pointing to=20 +applications + built into firmware volumes. + + @param Handler The callback function. +**/ +VOID +EFIAPI +EfiBootManagerRegisterUnableToBootHandler ( + EFI_BOOT_MANAGER_UNABLE_TO_BOOT Handler + ); + +/** + The function is called when no boot option could be launched, + including platform recovery options and options pointing to=20 +applications + built into firmware volumes. + + If this function returns, BDS core attempts to enter an infinite loop=20 + of pulling up the Boot Manager Menu (if the platform includes the Boot M= anager Menu). + If the Boot Manager Menu is unavailable, BDS will hang. + + @retval EFI_SUCCESS The unable-to-boot callback is called successful= ly. + @retval EFI_UNSUPPORTED There is no unable-to-boot callback registered. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerUnableToBoot ( + VOID + ); + #endif diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePk= g/Library/UefiBootManagerLib/BmBoot.c index 6a23477eb8..e59d790122 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -19,6 +19,7 @@ EFI_RAM_DISK_PROTOCOL *mRamDisk = =3D NULL; =20 EFI_BOOT_MANAGER_REFRESH_LEGACY_BOOT_OPTION mBmRefreshLegacyBootOption = =3D NULL; EFI_BOOT_MANAGER_LEGACY_BOOT mBmLegacyBoot = =3D NULL; +EFI_BOOT_MANAGER_UNABLE_TO_BOOT mBmUnableToBoot = =3D NULL; =20 /// /// This GUID is used for an EFI Variable that stores the front device pat= hes @@ -2461,3 +2462,43 @@ EfiBootManagerGetBootManagerMenu ( } } =20 +/** + Register the callback function when no boot option could be launched, + including platform recovery options and options pointing to=20 +applications + built into firmware volumes. + + @param Handler The callback function. +**/ +VOID +EFIAPI +EfiBootManagerRegisterUnableToBootHandler ( + EFI_BOOT_MANAGER_UNABLE_TO_BOOT Handler + ) +{ + mBmUnableToBoot =3D Handler; +} + +/** + The function is called when no boot option could be launched, + including platform recovery options and options pointing to=20 +applications + built into firmware volumes. + + If this function returns, BDS core attempts to enter an infinite loop=20 + of pulling up the Boot Manager Menu (if the platform includes the Boot M= anager Menu). + If the Boot Manager Menu is unavailable, BDS will hang. + + @retval EFI_SUCCESS The unable-to-boot callback is called successful= ly. + @retval EFI_UNSUPPORTED There is no unable-to-boot callback registered. +**/ +EFI_STATUS +EFIAPI +EfiBootManagerUnableToBoot ( + VOID + ) +{ + if (mBmUnableToBoot !=3D NULL) { + mBmUnableToBoot (); + return EFI_SUCCESS; + } + return EFI_UNSUPPORTED; +} -- 2.16.1.windows.1