From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.83]) by mx.groups.io with SMTP id smtpd.web11.960.1592412115196486313 for ; Wed, 17 Jun 2020 09:41:56 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=cYG95Lbe; spf=pass (domain: arm.com, ip: 40.107.22.83, mailfrom: samer.el-haj-mahmoud@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ekl6VZqMfeH4gIJuRGci958DRhRBZw4YYsKFYzkGXQA=; b=cYG95Lbem3JJ51M2ZRLdr7lpQtNq9JpTyg56BNoQ40B8ao4sqwhn3YC43KxZyYWEh2G9QpvmB8BIySwNe1cyVm7nOQl6IRqKhy/YXcPgkJD/BAWmOvp+HmgSWiKpAfW+8/7Fzplgh/YDriB55Uf0nouufE/rJhhMLwmDDBwQl9w= Received: from AM0PR10CA0005.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::15) by HE1PR0801MB1628.eurprd08.prod.outlook.com (2603:10a6:3:7d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.21; Wed, 17 Jun 2020 16:41:51 +0000 Received: from AM5EUR03FT007.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:17c:cafe::9c) by AM0PR10CA0005.outlook.office365.com (2603:10a6:208:17c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.21 via Frontend Transport; Wed, 17 Jun 2020 16:41:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT007.mail.protection.outlook.com (10.152.16.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22 via Frontend Transport; Wed, 17 Jun 2020 16:41:50 +0000 Received: ("Tessian outbound 13f833fb3c6d:v59"); Wed, 17 Jun 2020 16:41:50 +0000 X-CR-MTA-TID: 64aa7808 Received: from 438a5ad73ccd.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F5F25C78-71F5-4039-B209-2085CEFAE05C.1; Wed, 17 Jun 2020 16:41:45 +0000 Received: from EUR03-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 438a5ad73ccd.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 17 Jun 2020 16:41:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VlLNIIGg71xLDl+bp4ENUt7v74lsIlqOHwGcfQAAzW4kucyO88mJlAlyl5/ugoyGLb0fypzrw8Yf6sg9hLqvPzhaNE/mk1+k91Chag2P4pfLoiH2YZZNSaX7ARuGEVO2dwOEU6E92zKoYGSci7S9yCtbXlc1egEZx32I/SfwZIaNv7r1f0KMu4vZagJo+3tttJNX8jDmWu9zGmKh8owiDZ8u0uP+gSsLyzdWom96CzLWppYrQ8wr8aRp1BpHlG+x888lGGkQg1of3VWZ1KlrtPKMvuFmmZFmcuQ9RyGZstPMx6sjBo+l+M5zWF624aJaH5MtuYY6U6V8qKgprSGIFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ekl6VZqMfeH4gIJuRGci958DRhRBZw4YYsKFYzkGXQA=; b=nYgauuulGQ9yratzcQULhDRhWckQVfAekzq5KIuC2dN1s0qGczjC7cVotOK9gFw4nnRbJq3RsXPMQjCG4i1ictJVHXcYrxRgqVJ07HbAAMxfCmPq/C6dbKH4pzVVHGe0TsNtkNd0y5qHZPoP8+ET6+1R7W9OPOfMZjM+WkiiHADI+nxNqsbRD2kunqaomSbjc6tTH3MlfpNOeNGwKIBdED/elCr8Xb5DTKs41ZsK+YnRwnLU7SWBZd4QKSS12xdIO77Yhcn9Ri6jH6a9JNUcJdVjVraRIDYrGLU+0PP816N6REdMmraFo0vlI4A6gxVy7dcLl3nsQyF1csZe9uo6dg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ekl6VZqMfeH4gIJuRGci958DRhRBZw4YYsKFYzkGXQA=; b=cYG95Lbem3JJ51M2ZRLdr7lpQtNq9JpTyg56BNoQ40B8ao4sqwhn3YC43KxZyYWEh2G9QpvmB8BIySwNe1cyVm7nOQl6IRqKhy/YXcPgkJD/BAWmOvp+HmgSWiKpAfW+8/7Fzplgh/YDriB55Uf0nouufE/rJhhMLwmDDBwQl9w= Received: from DB7PR08MB3260.eurprd08.prod.outlook.com (2603:10a6:5:21::23) by DB7PR08MB3819.eurprd08.prod.outlook.com (2603:10a6:10:30::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.23; Wed, 17 Jun 2020 16:41:43 +0000 Received: from DB7PR08MB3260.eurprd08.prod.outlook.com ([fe80::88ec:d703:3e32:4c6b]) by DB7PR08MB3260.eurprd08.prod.outlook.com ([fe80::88ec:d703:3e32:4c6b%5]) with mapi id 15.20.3109.021; Wed, 17 Jun 2020 16:41:43 +0000 From: "Samer El-Haj-Mahmoud" To: "devel@edk2.groups.io" , "Andrei Warkentin (awarkentin@vmware.com)" , "Wang, Sunny (HPS SW)" , "pete@akeo.ie" CC: "zhichao.gao@intel.com" , "ray.ni@intel.com" , Ard Biesheuvel , "leif@nuviainc.com" , Samer El-Haj-Mahmoud Subject: Re: [edk2-devel] [edk2][PATCH 1/1] MdeModulePkg/UefiBootManagerLib: Signal ReadyToBoot on platform recovery Thread-Topic: [edk2-devel] [edk2][PATCH 1/1] MdeModulePkg/UefiBootManagerLib: Signal ReadyToBoot on platform recovery Thread-Index: AQHWQ8SQFLvwmBvsZES/t57IY1DSLKjcd5EAgAAtnACAACLVAIAAOroAgAAAxYCAAABtYA== Date: Wed, 17 Jun 2020 16:41:43 +0000 Message-ID: References: <20200616095622.2820-1-pete@akeo.ie> <20200616095622.2820-2-pete@akeo.ie> <99904809-1e07-6bd8-f7ba-25e87b1fe543@akeo.ie> , In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 67e2c77e-581e-4a9a-9f0b-d08b502ff6d3.1 x-checkrecipientchecked: true Authentication-Results-Original: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=arm.com; x-originating-ip: [99.132.126.10] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 78a7664d-9e7c-4a20-69d8-08d812dd55da x-ms-traffictypediagnostic: DB7PR08MB3819:|HE1PR0801MB1628: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:10000;OLM:10000; x-forefront-prvs: 04371797A5 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: IBl3d+AbESAsNlyyFEuCEuUrXe4cH6OCjSxRYevO9QeQWYD1GII2xOlP40WMket7BkUlTVJVWmYjxLxXCd1vVKYWeCwrt0nmYBHF5BDgGSIXoQOG7iAcX9OTkQTP/zltNBi99kTnO6XcWcSnxuE1iespXiypivtEtPXqvyTzh90ykcruplhCGMS5cnFP6rtVnLlfZDO7OndaVidoblKpQ0IPvnzhjWwvKjR0y3unlwV1iyKhLDUmWJ4Xx0EG+O5fUvydx4+EKnR154EYrFOlVO4by5CdiBiCVy38EnCN1ilGWs1Kmn7y+uFe3i55NyEpf7iP/133fCD+Bb6p1flAIRp24Veb08MNF588fiuw8HtuhCDsaBWsb/ik1qBrhOKDwT2HMLax+DlFzi3AVamZ2w== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR08MB3260.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(6029001)(4636009)(396003)(376002)(136003)(39860400002)(346002)(366004)(83380400001)(186003)(4326008)(53546011)(66476007)(6506007)(86362001)(66556008)(2906002)(8936002)(30864003)(5660300002)(64756008)(478600001)(9686003)(52536014)(66446008)(166002)(45080400002)(76116006)(33656002)(55016002)(8676002)(26005)(316002)(54906003)(110136005)(66946007)(76236003)(7696005)(71200400001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: Rf6yvJYCkx7Km1gg8Q4MrVZCIj/2eVD6MmnQtIzwM9pc7WBo6mOIn06bYw4Oz5pJjP3pHuHRrI/tfbHvttk66wTSIUMthZanrgwBeAO7X8MNG9hl9Vm1ResenMv6zfNkXJFZnYHRIpaRLaHGWSbF4K3mL12d3IjPUmXkXUqodUwEV3Sbzn8p2Z5axTfAv50Bg/buKyRY7DcZNL6Kj+e+XgC/zrK0VN0w0PssGrArdC23+UOnD5ph/RgKS4vtbuLtrbvsdlnVqN77jO9vT378OYIC/pptxF/8pch7f1V0RbSEiWkCwIuiKN/FaurQBm7SWEpH4VZsUJSM+HHDEJVwbwOq6vYl8eqH230f158ZSHpYzhP8tmaLyGN8s8pmKzQD+3BUw5CO3HrBIANKbfYu0J08NXVyai2uDBQrJkwbQBcyqVNRLHkjVw2Z3ZGYGunjsCxLHfgSlNEiHCBj4FfTllLZ/QOQ5XL7TOX10t9PJXWJ7PmiJ6CMjwxrdNN5jTBL MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3819 Original-Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=arm.com; Return-Path: Samer.El-Haj-Mahmoud@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT007.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFTY:;SFS:(6029001)(4636009)(346002)(136003)(376002)(39860400002)(396003)(46966005)(52536014)(26005)(186003)(5660300002)(36906005)(2906002)(55016002)(316002)(6506007)(82740400003)(9686003)(82310400002)(336012)(81166007)(70206006)(356005)(70586007)(53546011)(47076004)(8676002)(33656002)(8936002)(7696005)(83380400001)(478600001)(4326008)(54906003)(45080400002)(110136005)(86362001)(30864003)(166002)(76236003)(579004);DIR:OUT;SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 91369085-3ede-4da3-0d3c-08d812dd5138 X-Forefront-PRVS: 04371797A5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XFCWNQjhUw5PywRMaGEcBq8jCXEH6A+q/ZBd36qAHPZUOgCpbrAjWg+G0aG+yI3Hsc5suKL+TXAL/sT5RjNCDuNHxuiekfgtFZmZKwtYL/XD0gqncI8BO5Iwv/R6bu1thqUZCLrb8aJPLEzTGSyroVUAUrkxB4YlNTNBgzEYpW9TFbJLeoI3jW98Ia/0CTaSECrbX+hMz2QgLnrAH1A5u90e/5gEsJMX0bqBY179CTid75GXDq4gWFVCAB4C8tAPH1LjvjW8PRZF6dkO1ttipgA6UTnqy5ijiwKx3q7Yk++Ni4gQDsCnFHL2Z/xkfClVPeArg4WFRTzliGkGaFa4ix8fMlK0Ay1k0XQf2mSqCWhAzrByf+0IZ5BZlavrXgXhN7OjMkl4BB1lpGHJZ3hdeEOe9vOicpepmKwfbXPo7PvIbyx1MxLs9Jn7Fl4OnP0N7E2bc7BG9gYzIvkV5J5viOuxwZY9xKJmKDdSomt4wq0= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2020 16:41:50.9465 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 78a7664d-9e7c-4a20-69d8-08d812dd55da X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1628 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_DB7PR08MB326053566876136864980777909A0DB7PR08MB3260eurp_" --_000_DB7PR08MB326053566876136864980777909A0DB7PR08MB3260eurp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable The UEFI spec (3.1.7) says: "After all SysPrep#### variables have been launched and exited, the platfo= rm shall notify EFI_EVENT_GROUP_READY_TO_BOOT event group and begin to eval= uate Boot#### variables with Attributes set to LOAD_OPTION_CATEGORY_BOOT ac= cording to the order defined by BootOrder. The FilePathList of variables ma= rked LOAD_OPTION_CATEGORY_BOOT shall not be evaluated prior to the completi= on of EFI_EVENT_GROUP_READY_TO_BOOT event group processing." The way I read this, I expect ReadyToBoot to be signaled after SysPrep####= (if any) are processed, but before Boot#### are processed. Is my understan= ding correct that this language implies ReadyToBoot need to be signaled eve= n if BootOrder does not contain any Boot#### options marked as LOAD_OPTION_= CATEGORY_BOOT? And if so, is EDK2 not doing this, which leads us to this pa= tch (signaling it in PlatformRecovery?) From: devel@edk2.groups.io On Behalf Of Andrei Wark= entin via groups.io Sent: Wednesday, June 17, 2020 12:37 PM To: Wang, Sunny (HPS SW) ; devel@edk2.groups.io; pete@a= keo.ie Cc: zhichao.gao@intel.com; ray.ni@intel.com; Ard Biesheuvel ; leif@nuviainc.com Subject: Re: [edk2-devel] [edk2][PATCH 1/1] MdeModulePkg/UefiBootManagerLi= b: Signal ReadyToBoot on platform recovery Thanks Pete. I think the question I have, that I hope Tiano veterans can chime in, is w= hether we are doing the right thing, or if we should be overriding the boot= mode? I.e. is it normal that we boot up in recovery until options are save= d? A ________________________________ From: devel@edk2.groups.io > on behalf of Pete Batard via groups.io > Sent: Wednesday, June 17, 2020 11:34 AM To: Wang, Sunny (HPS SW) >; de= vel@edk2.groups.io > Cc: zhichao.gao@intel.com >; ray.ni@intel.com >; ard.biesheuvel@arm.com >; leif@nuviainc.com > Subject: Re: [edk2-devel] [edk2][PATCH 1/1] MdeModulePkg/UefiBootManagerLi= b: Signal ReadyToBoot on platform recovery On 2020.06.17 14:04, Wang, Sunny (HPS SW) wrote: > Thanks for checking my comments, Pete. > >> Or is the "one more" the issue, meaning that it would get signaled more= than once? > [Sunny] Yeah, it would get signaled more than once if the PlatformRecove= ry option (a UEFI application) calls EfiBootManagerBoot() to launch the rec= overed boot option inside of the application. Okay. One element that I'm going to point out is that, with the current EDK2 code (i.e. without this proposal applied), and after a user goes into the setup to save their boot options in order for regular boot options to get executed instead of PlaformRecovery, the OnReadyToBoot event is actually called twice. So my understanding is that, while we of course want to avoid this and any patch proposal should actively try to prevent it, it seems we already have behaviour in EDK2 that can lead to OnReadyToBoot being signalled more than once. At least the current Pi 4 platform does demonstrate this behaviour. For instance, if you run DEBUG, you will see two instances of: RemoveDtStdoutPath: could not retrieve DT blob - Not Found which is a one-instance message generated from the ConsolePrefDxe's OnReadyToBoot() call. I've also confirmed more specifically that OnReadyToBoot() is indeed called twice. I don't recall us doing much of any special with regards to boot options for the Pi platform, so my guess is that it's probably not the only platform where OnReadyToBoot might be signalled more than once, and that this might be tied to a default EDK2 behaviour. Therefore I don't see having a repeated event as a major deal breaker (though, again, if we can avoid that, we of course will want to). >> I don't mind trying an alternative approach, but I don't understand how= what you describe would help. Can you please be more specific about what y= ou have in mind? > [Sunny] Sure. I added more information below. If it is still not clear e= nough, feel free to let me know. > 1. Create a UEFI application with the code to signal ReadyToBoot a= nd pick /efi/boot/bootaa64.efi from either SD or USB and run it. So that would basically be adding code that duplicates, in part, what Platform Recovery already does. I have to be honest: Even outside of the extra work this would require, I don't really like the idea of having to write our own application, as it will introduce new possible points of failures and require extra maintenance (especially as we will want to be able to handle network boot and other options, and before long, I fear that we're going to have to write our own Pi specific boot manager). Doing so simply because the current Platform Recovery, which does suit our needs otherwise, is not designed to call ReadyToBoot does not seem like the best course of action in my book. Instead, I still logically believe that any option that calls a boot loader should signal ReadyToBoot, regardless of whether it was launched from Boot Manager or Platform Recovery, and that it shouldn't be left to each platform to work around that. Of course, I understand that this would require a specs change, and that it also may have ramifications for existing platforms that interpret the current specs pedantically. But to me, regardless of what the specs appear to be limiting it to right now, the logic of a "ReadyToBoot" event is that it should be signalled whenever a bootloader is about to be executed, rather than only when a bootloader happened to be launched through a formal Boot Manager option. I would therefore appreciate if other people could weigh in on this matter, to see if I'm the only one who believes that we could ultimately have more to gain from signalling ReadyToBoot with PlatformRecovery options than leaving things as they stand right now... > 2. Then, call EfiBootManagerInitializeLoadOption like the followin= g in a DXE driver or other places before "Default PlatformRecovery" registr= ation: > Status =3D EfiBootManagerInitializeLoadOption ( > &LoadOption, > 0, = -> 0 is the OptionNumber to let application be load be= fore " Default PlatformRecovery" option > LoadOptionTypePlatformRecovery, > LOAD_OPTION_ACTIVE, > L"Application for recovering boot options", > FilePath, = -> FilePath is the Application's device path, > NULL, > 0 > ); > > >> My reasoning is that, if PlatformRecovery#### can execute a regular boo= tloader like /efi/boot/boot####.efi from installation media, then it should= go through the same kind of initialization that happens for a regular boot= option, and that should include signaling the ReadyToBoot event. > [Sunny] Thanks for clarifying this, and Sorry about that I missed your c= over letter for this patch. I was just thinking that we may not really nee= d to make this behavior change in both EDK II code and UEFI specification f= or solving the problem specific to the case that OS is loaded by "Default P= latformRecovery" option, The way I see it is that the Pi platform is unlikely to be the only one where PlatformRecovery is seen as a means to install an OS. Granted, this may seem like abusing the option, but since UEFI doesn't provide an "Initial OS Install" mode, I would assert that it as good a use of this option as any. In other words, I don't think this improvement would only benefit the Pi platform. > and I'm also not sure if it is worth making this change to affect some o= f the system or BIOS vendors who have implemented their PlatformRecovery op= tion. That's a legitimate concern, and I would agree the one major potential pitfall of this proposal, if there happens to exist a system where an OnReadyToBoot even before running the recovery option can have adverse effects. I don't really believe that such a system exists, because I expect most recovery boot loaders to also work (or at least have been designed to work) as regular boot options. But I don't have enough experience with platform recovery to know if that's a correct assertion to make... > If the alternative approach I mentioned works for you, I think that woul= d be an easier solution. Right now, even as the patch proposal has multiple issues that require it to be amended (Don't signal ReadyToBoot except for PlatformRecovery + Prevent situations where ReadyToBoot could be signalled multiple times) I still see it as both an easier solution than the alternative, as well as one that *should* benefit people who design Platform Recovery UEFI applications in the long run. So that is why I am still trying to advocate for it. But I very much hear your concerns, and I agree that specs changes are better avoided when possible. Thus, at this stage, even as I don't want to drag this discussion much further, I don't feel like I want to commit to one solution or the other before we have had a chance to hear other people, who may have their own opinion on the matter, express their views. Regards, /Pete > > Regards, > Sunny Wang > > -----Original Message----- > From: Pete Batard [mailto:pete@akeo.ie] > Sent: Wednesday, June 17, 2020 6:59 PM > To: Wang, Sunny (HPS SW) >; = devel@edk2.groups.io > Cc: zhichao.gao@intel.com; ray.ni@intel.co= m; ard.biesheuvel@arm.com; leif@nuviainc.com > Subject: Re: [edk2-devel] [edk2][PATCH 1/1] MdeModulePkg/UefiBootManager= Lib: Signal ReadyToBoot on platform recovery > > Hi Sunny, thanks for looking into this. > > On 2020.06.17 09:16, Wang, Sunny (HPS SW) wrote: >> Hi Pete. >> >> Since the EfiBootManagerProcessLoadOption is called by ProcessLoadOptio= ns as well, your change would also cause some unexpected behavior like: >> 1. Signal one more ReadyToBoot for the PlatformRecovery option which is= an application that calls EfiBootManagerBoot() to launch its recovered boo= t option. > > I'm not sure I understand how this part is unwanted. > > The point of this patch is to ensure that ReadyToBoot is signalled for t= he PlatformRecovery option, so isn't what you describe above exactly what w= e want? > > Or is the "one more" the issue, meaning that it would get signalled more= than once? > > >> 2. Signal ReadyToBoot for SysPrep#### or Driver#### that is not really = a "boot" option. > > Yes, I've been wondering about that, because BdsEntry.c's ProcessLoadOpt= ions(), which calls EfiBootManagerProcessLoadOption(), > mentions that it will load will load and start every Driver####, SysPrep= #### or PlatformRecovery####. But the comment about the while() loop in Efi= BootManagerProcessLoadOption() only mentions PlatformRecovery####. > > If needed, I guess we could amend the patch to detect the type of option= and only signal ReadyToBoot for PlatformRecovery####. > >> To solve your problem, creating a PlatformRecovery option with the smal= lest option number and using it instead of default one (with short-form Fil= e Path Media Device Path) looks like a simpler solution. > > I don't mind trying an alternative approach, but I don't understand how = what you describe would help. Can you please be more specific about what yo= u have in mind? > > Our main issue here is that we must have ReadyToBoot signalled so that t= he ReadyToBoot() function callback from EmbeddedPkg/Drivers/ConsolePrefDxe = gets executed in order for the boot loader invoked from PlatformRecovery###= # to use a properly initialized graphical console. So I'm not sure I quite= get how switching from one PlatformRecovery#### option to another would im= prove things. > > If it helps, here is what we currently default to, in terms of boot opti= ons, on a Raspberry Pi 4 platform with a newly build firmware: > > [Bds]=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DBegin Load Options Dumping .= ..=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Driver Options: > SysPrep Options: > Boot Options: > Boot0000: UiApp 0x0109 > Boot0001: UEFI Shell 0x0000 > PlatformRecovery Options: > PlatformRecovery0000: Default PlatformRecovery 0x000= 1 > [Bds]=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DEnd Load Options Dumping=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > With this, PlatformRecovery0000 gets executed by default, which is what = we want, since it will pick /efi/boot/bootaa64.efi from either SD or USB an= d run it, the only issue being that, because ReadyToBoot has not been execu= ted, the graphical console is not operative so users can't interact with th= e OS installer. > > So I'm really not sure how adding an extra PlatformRecovery#### would he= lp. And I'm also not too familiar with how one would go around to add such = an entry... > >> By the way, I also checked the UEFI specification. It looks making sens= e to only signal ReadyToBoot for boot option (Boot####). > > That's something I considered too, but I disagree with this conclusion. > > My reasoning is that, if PlatformRecovery#### can execute a regular boot= loader like /efi/boot/boot####.efi from installation media, then it should = go through the same kind of initialization that happens for a regular boot = option, and that should include signalling the ReadyToBoot event. > > If there was a special bootloader for PlatformRecovery#### (e.g. > /efi/boot/recovery####.efi) then I would agree with only signalling Read= yToBoot for a formal Boot#### option. But that isn't the case, so I think i= t is reasonable to want to have ReadyToBoot also occur when a /efi/boot/boo= t####.efi bootloader is executed from PlatformRecovery####., especially whe= n we know it can be crucial to ensuring that the end user can actually use = the graphical console. > >> Therefore, your change may also require specification change. > > Yes, I mentioned that in the cover letter for this patch (https://nam04.= safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fedk2.groups.io%2Fg%2F= devel%2Fmessage%2F61327&data=3D02%7C01%7Cawarkentin%40vmware.com%7C5f90= d077bc7949c1122f08d812dc48d3%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C6= 37280084611749324&sdata=3D2%2B%2FcvMkrmZGTRRLDGSuMsKbiyDOGtwYwZ7qSqMyMi= cc%3D&reserved=3D0 ), which also describes the issue we are trying to s= olve in greater details. This is what I wrote: > > ------------------------------------------------------------------------ > Note however that this may require a specs update, as the current UEFI s= pecs for EFI_BOOT_SERVICES.CreateEventEx() have: > > > EFI_EVENT_GROUP_READY_TO_BOOT > > This event group is notified by the system when the Boot Manager > > is about to load and execute a boot option. > > and, once this patch has been applied, we may want to update this sectio= n to mention that it applies to both Boot Manager and Platform Recovery. > ------------------------------------------------------------------------ > > > Again, I don't have an issue with trying to use an alternate approach to= solve our problem (though I ultimately believe that, if PlatformRecovery##= ## can launch a /efi/boot/boot####.efi bootloader then we must update the s= pecs and the code to have ReadyToBoot also signalled then, because that's t= he logical thing to do). But right now, I'm not seeing how to achieve that = when PlatformRecovery#### is the option that is used to launch the OS insta= llation the bootloader. So if you can provide mode details on how exactly y= ou think creating an alternate PlatformRecovery option would help, I would = appreciate it. > > Regards, > > /Pete > >> >> Regards, >> Sunny Wang >> >> -----Original Message----- >> From: devel@edk2.groups.io [mailto:devel@e= dk2.groups.io] On Behalf Of >> Pete Batard >> Sent: Tuesday, June 16, 2020 5:56 PM >> To: devel@edk2.groups.io >> Cc: zhichao.gao@intel.com; ray.ni@intel.c= om; ard.biesheuvel@arm.com; >> leif@nuviainc.com >> Subject: [edk2-devel] [edk2][PATCH 1/1] >> MdeModulePkg/UefiBootManagerLib: Signal ReadyToBoot on platform >> recovery >> >> Currently, the ReadyToBoot event is only signaled when a formal Boot Ma= nager option is executed (in BmBoot.c -> EfiBootManagerBoot ()). >> >> However, with the introduction of Platform Recovery in UEFI 2.5, which = may lead to the execution of a boot loader that has similar requirements to= a regular one, yet is not launched as a Boot Manager option, it also becom= es necessary to signal ReadyToBoot when a Platform Recovery boot loader run= s. >> >> Especially, this can be critical to ensuring that the graphical console= is actually usable during platform recovery, as some platforms do rely on = the ConsolePrefDxe driver, which only performs console initialization after= ReadyToBoot is triggered. >> >> This patch fixes that behaviour by calling EfiSignalEventReadyToBoot ()= in EfiBootManagerProcessLoadOption (), which is the function that sets up = the platform recovery boot process. >> >> Signed-off-by: Pete Batard > >> --- >> MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c >> b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c >> index 89372b3b97b8..117f1f5b124c 100644 >> --- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c >> +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c >> @@ -1376,6 +1376,15 @@ EfiBootManagerProcessLoadOption ( >> return EFI_SUCCESS; >> } >> >> + // >> + // Signal the EVT_SIGNAL_READY_TO_BOOT event when we are about to lo= ad and execute the boot option. >> + // >> + EfiSignalEventReadyToBoot (); >> + // >> + // Report Status Code to indicate ReadyToBoot was signalled // >> + REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_DXE_BS_DRIVER | >> + EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT)); >> + >> // >> // Load and start the load option. >> // >> -- >> 2.21.0.windows.1 >> >> >> >> > IMPORTANT NOTICE: The contents of this email and any attachments are confi= dential and may also be privileged. If you are not the intended recipient, = please notify the sender immediately and do not disclose the contents to an= y other person, use it for any purpose, or store or copy the information in= any medium. Thank you. --_000_DB7PR08MB326053566876136864980777909A0DB7PR08MB3260eurp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

The UEFI spec (3.1.7) says:

 

“After all Sy= sPrep#### variables have been launched and exited, the platform shall notif= y EFI_EVENT_GROUP_READY_TO_BOOT event group and begin to evaluate Boot#### = variables with Attributes set to LOAD_OPTION_CATEGORY_BOOT according to the order defined by BootOrder. The FilePathList of variable= s marked LOAD_OPTION_CATEGORY_BOOT shall not be evaluated prior to the comp= letion of EFI_EVENT_GROUP_READY_TO_BOOT event group processing."<= /o:p>

 

The way I read this, I expect ReadyToBoot to be sig= naled after SysPrep#### (if any) are processed, but before Boot#### are pro= cessed. Is my understanding correct that this language implies ReadyToBoot = need to be signaled even if BootOrder does not contain any Boot#### options marked as LOAD_OPTION_CATEGORY_BOOT= ? And if so, is EDK2 not doing this, which leads us to this patch (signalin= g it in PlatformRecovery?)

 <= /span>

 

 

From: devel@edk2.groups.io <devel@edk2.gr= oups.io> On Behalf Of Andrei Warkentin via groups.io
Sent: Wednesday, June 17, 2020 12:37 PM
To: Wang, Sunny (HPS SW) <sunnywang@hpe.com>; devel@edk2.grou= ps.io; pete@akeo.ie
Cc: zhichao.gao@intel.com; ray.ni@intel.com; Ard Biesheuvel <Ard= .Biesheuvel@arm.com>; leif@nuviainc.com
Subject: Re: [edk2-devel] [edk2][PATCH 1/1] MdeModulePkg/UefiBootMa= nagerLib: Signal ReadyToBoot on platform recovery

 

Thanks Pete.

 

I think the question I have, that I hope Tiano veterans can = chime in, is whether we are doing the right thing, or if we should be overr= iding the boot mode? I.e. is it normal that we boot up in recovery until options are saved?

 

 

A

 

 


From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf o= f Pete Batard via groups.io <pete=3Dakeo.ie@groups.io>
Sent: Wednesday, June 17, 2020 11:34 AM
To: Wang, Sunny (HPS SW) <s= unnywang@hpe.com>; devel@edk2.groups.io <devel@edk2.groups.io>
Cc: zhichao.gao@intel.com<= /a> <zhichao.gao@intel.com&= gt;; ray.ni@intel.com <ray.ni@intel.com>; ard.biesheuvel@arm.com <<= a href=3D"mailto:ard.biesheuvel@arm.com">ard.biesheuvel@arm.com>; leif@nuviainc.com <leif@nuviainc.com>
Subject: Re: [edk2-devel] [edk2][PATCH 1/1] MdeModulePkg/UefiBootMa= nagerLib: Signal ReadyToBoot on platform recovery

 

On 2020.06.17 14:04,= Wang, Sunny (HPS SW) wrote:
> Thanks for checking my comments, Pete.
>
>> Or is the "one more" the issue, meaning that it would g= et signaled more than once?
> [Sunny] Yeah, it would get signaled more than once if the PlatformRec= overy option (a UEFI application) calls EfiBootManagerBoot() to launch the = recovered boot option inside of the application.

Okay.

One element that I'm going to point out is that, with the current EDK2 code (i.e. without this proposal applied), and after a user goes into
the setup to save their boot options in order for regular boot options to get executed instead of PlaformRecovery, the OnReadyToBoot event is actually called twice.

So my understanding is that, while we of course want to avoid this and any patch proposal should actively try to prevent it, it seems we
already have behaviour in EDK2 that can lead to OnReadyToBoot being
signalled more than once.

At least the current Pi 4 platform does demonstrate this behaviour. For instance, if you run DEBUG, you will see two instances of:

   RemoveDtStdoutPath: could not retrieve DT blob - Not Found
which is a one-instance message generated from the ConsolePrefDxe's
OnReadyToBoot() call. I've also confirmed more specifically that
OnReadyToBoot() is indeed called twice.

I don't recall us doing much of any special with regards to boot options <= br> for the Pi platform, so my guess is that it's probably not the only
platform where OnReadyToBoot might be signalled more than once, and that <= br> this might be tied to a default EDK2 behaviour. Therefore I don't see
having a repeated event as a major deal breaker (though, again, if we
can avoid that, we of course will want to).

>> I don't mind trying an alternative approach, but I don't understa= nd how what you describe would help. Can you please be more specific about = what you have in mind?
> [Sunny] Sure. I added more information below. If it is still not clea= r enough, feel free to let me know.
>       1. Create a UEFI application with= the code to signal ReadyToBoot and pick /efi/boot/bootaa64.efi from either= SD or USB and run it.

So that would basically be adding code that duplicates, in part, what
Platform Recovery already does.

I have to be honest: Even outside of the extra work this would require, I don't really like the idea of having to write our own application, as it will introduce new possible points of failures and require extra
maintenance (especially as we will want to be able to handle network
boot and other options, and before long, I fear that we're going to have <= br> to write our own Pi specific boot manager). Doing so simply because the current Platform Recovery, which does suit our needs otherwise, is not designed to call ReadyToBoot does not seem like the best course of
action in my book.

Instead, I still logically believe that any option that calls a boot
loader should signal ReadyToBoot, regardless of whether it was launched from Boot Manager or Platform Recovery, and that it shouldn't be left to <= br> each platform to work around that.

Of course, I understand that this would require a specs change, and that <= br> it also may have ramifications for existing platforms that interpret the <= br> current specs pedantically. But to me, regardless of what the specs
appear to be limiting it to right now, the logic of a "ReadyToBoot&qu= ot;
event is that it should be signalled whenever a bootloader is about to be executed, rather than only when a bootloader happened to be launched through a formal Boot Manager option.

I would therefore appreciate if other people could weigh in on this
matter, to see if I'm the only one who believes that we could ultimately <= br> have more to gain from signalling ReadyToBoot with PlatformRecovery
options than leaving things as they stand right now...

>       2. Then, call EfiBootManagerIniti= alizeLoadOption like the following in a DXE driver or other places before &= quot;Default PlatformRecovery" registration:
>    Status =3D EfiBootManagerInitializeLoadOption (
>           &nbs= p;   &LoadOption,
>           &nbs= p;   0,         &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;    -> 0 is the OptionNumber to let application be l= oad before " Default PlatformRecovery" option
>           &nbs= p;   LoadOptionTypePlatformRecovery,
>           &nbs= p;   LOAD_OPTION_ACTIVE,
>           &nbs= p;   L"Application for recovering boot options",
>           &nbs= p;   FilePath,        &nb= sp;            =             &nb= sp;            =             &nb= sp;     -> FilePath is the Application's device path= ,
>           &nbs= p;   NULL,
>           &nbs= p;   0
>           &nbs= p;   );
>
>
>> My reasoning is that, if PlatformRecovery#### can execute a regul= ar bootloader like /efi/boot/boot####.efi from installation media, then it = should go through the same kind of initialization that happens for a regula= r boot option, and that should include signaling the ReadyToBoot event.
> [Sunny] Thanks for clarifying this, and Sorry about that I missed you= r cover letter for this patch.  I was just thinking that we may not re= ally need to make this behavior change in both EDK II code and UEFI specifi= cation for solving the problem specific to the case that OS is loaded by "Default PlatformRecovery" option= ,

The way I see it is that the Pi platform is unlikely to be the only one where PlatformRecovery is seen as a means to install an OS. Granted,
this may seem like abusing the option, but since UEFI doesn't provide an <= br> "Initial OS Install" mode, I would assert that it as good a use = of this
option as any.

In other words, I don't think this improvement would only benefit the Pi <= br> platform.

> and I'm also not sure if it is worth making this change to affect som= e of the system or BIOS vendors who have implemented their PlatformRecovery= option.

That's a legitimate concern, and I would agree the one major potential pitfall of this proposal, if there happens to exist a system where an
OnReadyToBoot even before running the recovery option can have adverse effects.

I don't really believe that such a system exists, because I expect most recovery boot loaders to also work (or at least have been designed to
work) as regular boot options. But I don't have enough experience with platform recovery to know if that's a correct assertion to make...

> If the alternative approach I mentioned works for you, I think that w= ould be an easier solution.

Right now, even as the patch proposal has multiple issues that require it to be amended (Don't signal ReadyToBoot except for PlatformRecovery + Prevent situations where ReadyToBoot could be signalled multiple times) I still see it as both an easier solution than the alternative, as well as one that *should* benefit people who design Platform Recovery <= br> UEFI applications in the long run. So that is why I am still trying to advocate for it.

But I very much hear your concerns, and I agree that specs changes are better avoided when possible.

Thus, at this stage, even as I don't want to drag this discussion much further, I don't feel like I want to commit to one solution or the other <= br> before we have had a chance to hear other people, who may have their own <= br> opinion on the matter, express their views.

Regards,

/Pete


>
> Regards,
> Sunny Wang
>
> -----Original Message-----
> From: Pete Batard [mailto:pete@akeo.i= e]
> Sent: Wednesday, June 17, 2020 6:59 PM
> To: Wang, Sunny (HPS SW) <sun= nywang@hpe.com>; devel@edk2.groups.io
> Cc: zhichao.gao@intel.com; ray.ni@intel.com; ard.bieshe= uvel@arm.com; leif@nuviainc.com
> Subject: Re: [edk2-devel] [edk2][PATCH 1/1] MdeModulePkg/UefiBootMana= gerLib: Signal ReadyToBoot on platform recovery
>
> Hi Sunny, thanks for looking into this.
>
> On 2020.06.17 09:16, Wang, Sunny (HPS SW) wrote:
>> Hi Pete.
>>
>> Since the EfiBootManagerProcessLoadOption is called by ProcessLoa= dOptions as well, your change would also cause some unexpected behavior lik= e:
>> 1. Signal one more ReadyToBoot for the PlatformRecovery option wh= ich is an application that calls EfiBootManagerBoot() to launch its recover= ed boot option.
>
> I'm not sure I understand how this part is unwanted.
>
> The point of this patch is to ensure that ReadyToBoot is signalled fo= r the PlatformRecovery option, so isn't what you describe above exactly wha= t we want?
>
> Or is the "one more" the issue, meaning that it would get s= ignalled more than once?
>
>
>> 2. Signal ReadyToBoot for SysPrep#### or Driver#### that is not r= eally a "boot" option.
>
> Yes, I've been wondering about that, because BdsEntry.c's ProcessLoad= Options(), which calls EfiBootManagerProcessLoadOption(),
> mentions that it will load will load and start every Driver####, SysP= rep#### or PlatformRecovery####. But the comment about the while() loop in = EfiBootManagerProcessLoadOption() only mentions PlatformRecovery####.
>
> If needed, I guess we could amend the patch to detect the type of opt= ion and only signal ReadyToBoot for PlatformRecovery####.
>
>> To solve your problem, creating a PlatformRecovery option with th= e smallest option number and using it instead of default one (with short-fo= rm File Path Media Device Path) looks like a simpler solution.
>
> I don't mind trying an alternative approach, but I don't understand h= ow what you describe would help. Can you please be more specific about what= you have in mind?
>
> Our main issue here is that we must have ReadyToBoot signalled so tha= t the ReadyToBoot() function callback from EmbeddedPkg/Drivers/ConsolePrefD= xe gets executed in order for the boot loader invoked from PlatformRecovery= ####  to use a properly initialized graphical console. So I'm not sure I quite get how switching from one Pla= tformRecovery#### option to another would improve things.
>
> If it helps, here is what we currently default to, in terms of boot o= ptions, on a Raspberry Pi 4 platform with a newly build firmware:
>
> [Bds]=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DBegin Load Options Dumpin= g ...=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>     Driver Options:
>     SysPrep Options:
>     Boot Options:
>       Boot0000: UiApp   =            0x0109
>       Boot0001: UEFI Shell  &= nbsp;           &nbs= p;  0x0000
>     PlatformRecovery Options:
>       PlatformRecovery0000: Default Pla= tformRecovery          &n= bsp;    0x0001
> [Bds]=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DEnd Load Options Dumping= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> With this, PlatformRecovery0000 gets executed by default, which is wh= at we want, since it will pick /efi/boot/bootaa64.efi from either SD or USB= and run it, the only issue being that, because ReadyToBoot has not been ex= ecuted, the graphical console is not operative so users can't interact with the OS installer.
>
> So I'm really not sure how adding an extra PlatformRecovery#### would= help. And I'm also not too familiar with how one would go around to add su= ch an entry...
>
>> By the way, I also checked the UEFI specification. It looks makin= g sense to only signal ReadyToBoot for boot option (Boot####).
>
> That's something I considered too, but I disagree with this conclusio= n.
>
> My reasoning is that, if PlatformRecovery#### can execute a regular b= ootloader like /efi/boot/boot####.efi from installation media, then it shou= ld go through the same kind of initialization that happens for a regular bo= ot option, and that should include signalling the ReadyToBoot event.
>
> If there was a special bootloader for PlatformRecovery#### (e.g.
> /efi/boot/recovery####.efi) then I would agree with only signalling R= eadyToBoot for a formal Boot#### option. But that isn't the case, so I thin= k it is reasonable to want to have ReadyToBoot also occur when a /efi/boot/= boot####.efi bootloader is executed from PlatformRecovery####., especially when we know it can be crucial to = ensuring that the end user can actually use the graphical console.
>
>> Therefore, your change may also require specification change.
>
> Yes, I mentioned that in the cover letter for this patch (https://nam04.safelinks.p= rotection.outlook.com/?url=3Dhttps%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Fmes= sage%2F61327&amp;data=3D02%7C01%7Cawarkentin%40vmware.com%7C5f90d077bc7= 949c1122f08d812dc48d3%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C63728008= 4611749324&amp;sdata=3D2%2B%2FcvMkrmZGTRRLDGSuMsKbiyDOGtwYwZ7qSqMyMicc%= 3D&amp;reserved=3D0 ), which also describes the issue we are trying to solve in greater detai= ls. This is what I wrote:
>
> ---------------------------------------------------------------------= ---
> Note however that this may require a specs update, as the current UEF= I specs for EFI_BOOT_SERVICES.CreateEventEx() have:
>
>   >  EFI_EVENT_GROUP_READY_TO_BOOT
>   >    This event group is notified by th= e system when the Boot Manager
>   >    is about to load and execute a boo= t option.
>
> and, once this patch has been applied, we may want to update this sec= tion to mention that it applies to both Boot Manager and Platform Recovery.=
> ---------------------------------------------------------------------= ---
>
>
> Again, I don't have an issue with trying to use an alternate approach= to solve our problem (though I ultimately believe that, if PlatformRecover= y#### can launch a /efi/boot/boot####.efi bootloader then we must update th= e specs and the code to have ReadyToBoot also signalled then, because that's the logical thing to do). But right n= ow, I'm not seeing how to achieve that when PlatformRecovery#### is the opt= ion that is used to launch the OS installation the bootloader. So if you ca= n provide mode details on how exactly you think creating an alternate PlatformRecovery option would help, I wou= ld appreciate it.
>
> Regards,
>
> /Pete
>
>>
>> Regards,
>> Sunny Wang
>>
>> -----Original Message-----
>> From: devel@edk2.groups.i= o [mailto:devel@edk2.groups.io<= /a>] On Behalf Of
>> Pete Batard
>> Sent: Tuesday, June 16, 2020 5:56 PM
>> To:
devel@edk2.groups.io<= /a>
>> Cc:
zhichao.gao@intel.co= m; ray.ni@intel.com; ard.bieshe= uvel@arm.com;
>> leif@nuviainc.com
>> Subject: [edk2-devel] [edk2][PATCH 1/1]
>> MdeModulePkg/UefiBootManagerLib: Signal ReadyToBoot on platform >> recovery
>>
>> Currently, the ReadyToBoot event is only signaled when a formal B= oot Manager option is executed (in BmBoot.c -> EfiBootManagerBoot ()). >>
>> However, with the introduction of Platform Recovery in UEFI 2.5, = which may lead to the execution of a boot loader that has similar requireme= nts to a regular one, yet is not launched as a Boot Manager option, it also= becomes necessary to signal ReadyToBoot when a Platform Recovery boot loader runs.
>>
>> Especially, this can be critical to ensuring that the graphical c= onsole is actually usable during platform recovery, as some platforms do re= ly on the ConsolePrefDxe driver, which only performs console initialization= after ReadyToBoot is triggered.
>>
>> This patch fixes that behaviour by calling EfiSignalEventReadyToB= oot () in EfiBootManagerProcessLoadOption (), which is the function that se= ts up the platform recovery boot process.
>>
>> Signed-off-by: Pete Batard <pe= te@akeo.ie>
>> ---
>>    MdeModulePkg/Library/UefiBootManagerLib/BmLoadO= ption.c | 9 +++++++++
>>    1 file changed, 9 insertions(+)
>>
>> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption= .c
>> b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
>> index 89372b3b97b8..117f1f5b124c 100644
>> --- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
>> +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadO= ption.c
>> @@ -1376,6 +1376,15 @@ EfiBootManagerProcessLoadOption (
>>        return EFI_SUCCESS;
>>      }
>>   
>> +  //
>> +  // Signal the EVT_SIGNAL_READY_TO_BOOT event when we = are about to load and execute the boot option.
>> +  //
>> +  EfiSignalEventReadyToBoot ();
>> +  //
>> +  // Report Status Code to indicate ReadyToBoot was sig= nalled  //
>> + REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_SOFTWARE_DXE_BS= _DRIVER |
>> + EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT));
>> +
>>      //
>>      // Load and start the load option.<= br> >>      //
>> --
>> 2.21.0.windows.1
>>
>>
>>
>>
>



IMPORTANT NOTICE: The contents of this email and any attachments are confi= dential and may also be privileged. If you are not the intended recipient, = please notify the sender immediately and do not disclose the contents to an= y other person, use it for any purpose, or store or copy the information in any medium. Thank you. --_000_DB7PR08MB326053566876136864980777909A0DB7PR08MB3260eurp_--