From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.52]) by mx.groups.io with SMTP id smtpd.web12.2469.1592343621283560293 for ; Tue, 16 Jun 2020 14:40:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=w3ljYeti; spf=pass (domain: arm.com, ip: 40.107.1.52, 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=TlYOJCz1N0UsaUJlmbooRavpp+NR3ZQgOjGwrveZ/ls=; b=w3ljYetir0OA2s/cTpzIWTkpewbCMRarwd6yzhNYgxmbabYEo94UqF/2On2Ghr6d0U0HdDbm7i15UO2FXKGdD2gT5x0LZ+8TnFRPpgbu7Ga+1LVYpHGy/hbp6I+e0aKDlF55+c+n7TlmGr6lAL+8BDoCWz7LIcErgAsFTJirqug= Received: from AM6PR02CA0019.eurprd02.prod.outlook.com (2603:10a6:20b:6e::32) by VI1PR08MB5357.eurprd08.prod.outlook.com (2603:10a6:803:12e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.21; Tue, 16 Jun 2020 21:40:18 +0000 Received: from AM5EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:6e:cafe::8e) by AM6PR02CA0019.outlook.office365.com (2603:10a6:20b:6e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.21 via Frontend Transport; Tue, 16 Jun 2020 21:40:18 +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 AM5EUR03FT041.mail.protection.outlook.com (10.152.17.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Tue, 16 Jun 2020 21:40:18 +0000 Received: ("Tessian outbound 68e1a9769289:v59"); Tue, 16 Jun 2020 21:40:18 +0000 X-CR-MTA-TID: 64aa7808 Received: from 54e319163d11.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E3AC39A9-1A68-49C3-BCE3-6C13B4FC5018.1; Tue, 16 Jun 2020 21:40:13 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 54e319163d11.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 16 Jun 2020 21:40:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PHYbu0oOeuk64y+hQuDOQshUJmQK/xQQ5R8jXw/To6IV+Ro3qc7/aZtscltyVGd7xBIVvS8r8DyYKLsfIrjxkkjeqSYEmyYik8gdNV2GLFfS85Bo61hiDxpajUMhBjb2eE7dkvEYNUgYMeb1ZAKIHCm77Rul/1pdHfQDTMz5XgfJo9ovL226X97MOeckj6RmRLIEyJ0lfLuhYhdOcQPw/PnSPNiRwvanobSYtBLSgYKF5HiNkiGnpcH5SivVD7wGIXH8/xcSeo063pp7OM8lllj4Msv+gf8FW/m1VLP9u8PAuUxaFbaLk4IQmYdhKG3I1lIuQhYwEhuYQdO3PNWThg== 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=TlYOJCz1N0UsaUJlmbooRavpp+NR3ZQgOjGwrveZ/ls=; b=JED9hqUxqELmkrWpOt+xuzwF0uTX9qEGbhGGXLkOZGrf+2xZVdm5vflnI+z/+myg4gh7xRGmts4JvrvW5WOhDNc/8OI6GyoDIMxtXaj7i6UZdP53xwnCPeYD8Aipzx/qTHl/SaUH91IzyJ76VYb678+crpXO3CqjPpwLvHlmp/+K76MrJg7uozgMYOJhzNjGcetP6bGLLzRdmSIiiawGI+geTLTQQHFuco0DAz1jCWaxVukYweqO50sJHWMjvnYzSzJD45szuA6T7K/C7x3vV3EKrWvH8M+fmqZDv0kgAcGufMA/Gsihmk6IUWxLr6HVlL03C+nx92mj8ZXf0aLOwA== 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=TlYOJCz1N0UsaUJlmbooRavpp+NR3ZQgOjGwrveZ/ls=; b=w3ljYetir0OA2s/cTpzIWTkpewbCMRarwd6yzhNYgxmbabYEo94UqF/2On2Ghr6d0U0HdDbm7i15UO2FXKGdD2gT5x0LZ+8TnFRPpgbu7Ga+1LVYpHGy/hbp6I+e0aKDlF55+c+n7TlmGr6lAL+8BDoCWz7LIcErgAsFTJirqug= Received: from DB7PR08MB3260.eurprd08.prod.outlook.com (2603:10a6:5:21::23) by DB7PR08MB3497.eurprd08.prod.outlook.com (2603:10a6:10:48::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.21; Tue, 16 Jun 2020 21:40:11 +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; Tue, 16 Jun 2020 21:40:11 +0000 From: "Samer El-Haj-Mahmoud" To: Ard Biesheuvel , "devel@edk2.groups.io" CC: "leif@nuviainc.com" , Ard Biesheuvel , Pete Batard , "Andrei Warkentin (awarkentin@vmware.com)" Subject: Re: [PATCH] ArmPkg/PlatformBootManagerLib: regenerate boot options on boot failure Thread-Topic: [PATCH] ArmPkg/PlatformBootManagerLib: regenerate boot options on boot failure Thread-Index: AQHWRAZ6ASPv1WPuj0m6VUdvubv2C6jbxQlg Date: Tue, 16 Jun 2020 21:40:11 +0000 Message-ID: References: <20200616174834.1110310-1-ard.biesheuvel@arm.com> In-Reply-To: <20200616174834.1110310-1-ard.biesheuvel@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 69f0a730-b41d-42e8-b18b-d685eb31969e.1 x-checkrecipientchecked: true Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; 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: f49e605c-852c-473f-7965-08d8123ddd08 x-ms-traffictypediagnostic: DB7PR08MB3497:|VI1PR08MB5357: 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:9508;OLM:10000; x-forefront-prvs: 04362AC73B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Hnl0IkKWKYKUUnSzG9E4U9G4cV65IOntGIAr7ju+xsTmTC5v37Lmpb1epdRnQHHxEnmIvM3MpD3OTYDbZY38eHDnu3d9lM5ChDdeaIMwoZDEVJfVCKHmCJajtSuX+nzyg3zPLmvm1/Z+iOrZYCwkXCqkU2WWyD5duQm1n8FsKkVUHEBFC0oYOS46BmbiZk9WbMmziO6wPkuLWeRMNFe8CLN0gwA3MLYIhcbOOIDqOyfp54JXLFn+COm/lfRWGF55rsAzgrOjDbV85QoptkO5msWRtyh/x9gED5R/D4/CPTGOlJtbRx3W1U4kXDtmwpAJ 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:(4636009)(376002)(346002)(366004)(136003)(396003)(39860400002)(6506007)(64756008)(66446008)(33656002)(66946007)(76116006)(66556008)(66476007)(478600001)(7696005)(53546011)(9686003)(4326008)(86362001)(2906002)(55016002)(110136005)(5660300002)(71200400001)(8936002)(54906003)(83380400001)(26005)(8676002)(52536014)(316002)(186003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: qQjpFaz70mFxvpSVgDhWujdjxmpSNqBrOHn+x6lCey+L5059A/35ilyXzUHP0vpNAbZZAk1H0Oiw9vvMmviSGgM5EeIqVdrIeadge9ci+ZqBqfseZDx98iNJ7IO2m/1/AkrrspvxXZ9I2YPZSAcp60VOicgznBWo5bAtUVvF8Yux6qL8S9xjhX9q4Si2R8HovI4T0M4U+rqof9YVO2MZWNheqObun6Ag0uhxHKw2Y+u+s277ggVP/yyVvW7AhO9te7LgjNvz2fynem/n2QhLvpQFTyq6zRFvo+AFngJdKytBKq5DTqkV5CZCzeaH6HUrdhbMRyTyQltU+ojttL5ARMajfDPeviP7mJnFW8bX+JRhJ+fz16E5E6q+JHGRAjiHhKpa4DWVR1nOEzUg3bFuqspXYkdo7/VQqAc9P9soEsMqb828GYPqdnvD0CadhvslUy4J3xLyOmVNJZs6YEE35pCKuVKY8azwuTh+0Dvj799uOBCDbIuVZ60wfmJY5gGb MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3497 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Return-Path: Samer.El-Haj-Mahmoud@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT041.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:(4636009)(346002)(396003)(39830400003)(136003)(376002)(46966005)(52536014)(81166007)(8676002)(2906002)(356005)(4326008)(7696005)(55016002)(6506007)(86362001)(53546011)(478600001)(70586007)(9686003)(82310400002)(316002)(70206006)(36906005)(336012)(83380400001)(47076004)(26005)(107886003)(54906003)(186003)(8936002)(5660300002)(33656002)(110136005);DIR:OUT;SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 1ebc0165-1ba1-44df-415e-08d8123dd8e3 X-Forefront-PRVS: 04362AC73B X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gbZvhsaHoOhJNGdIHldt05QTW3R8zSRdJzZvjYwu+4u0VOY38+E9HTkuKZCJ0nfjet6EnPDKHEb+gcFgi9qsbbcwKDhN781pqot1JW0TZqZoMHEvpHSC0gLxLqnyd21Gnj1GJKSrlXLMTaXfAoVoiTB5iFqMGQPGGN7/0REk2IY87YcWp+FvqNGWoRI/4FiTuWh9T9+eke+1314X/VN4Xqo9zlmMsLX9dX4Vj7Ev56iY97iJQes0dPS5/i/IndavXNyfHEc9gS3ZPgkWbvVpbrLS6LKeh3lH2TfDPyyDHpYwEq9tlU0H3+mp37+Z23CNVhgal5jeB/NAARHhu96Mic0J2KcvVGcGBDHeBqdlASS57dBmblsFHpyl1ZUCfzWSABRIlz/WZU2w3TbkCZok3g== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2020 21:40:18.2890 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f49e605c-852c-473f-7965-08d8123ddd08 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: VI1PR08MB5357 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Samer El-Haj-Mahmoud > -----Original Message----- > From: Ard Biesheuvel > Sent: Tuesday, June 16, 2020 1:49 PM > To: devel@edk2.groups.io > Cc: leif@nuviainc.com; Ard Biesheuvel ; Pete > Batard ; Andrei Warkentin (awarkentin@vmware.com) > ; Samer El-Haj-Mahmoud Mahmoud@arm.com> > Subject: [PATCH] ArmPkg/PlatformBootManagerLib: regenerate boot > options on boot failure > > One of the side effects of the recent changes to PlatformBootManagerLib > changes to avoid connecting all devices on every boot is that we no longe= r > default to network boot on a virgin boot, but end up in the UiApp menu. A= t > this point, the autogenerated boot options that we used to rely on will b= e > instantiated too, but it does break the unattended boot case where device= s > are expected to attempt a network boot on the very first power on. > > Let's work around this by refreshing all boot options explicitly in the > UnableToBoot() handler, and rebooting the system if doing so resulted in = a > change to the total number of configured boot options. > This way, we ultimately end up in the UiApp as before if no boot options > could be started, but only after all the autogenerated ones have been > attempted as well. > Cc: Pete Batard Cc: Andrei Warkentin > (awarkentin@vmware.com) Cc: Samer El-Haj- > Mahmoud Signed-off-by: Ard > Biesheuvel > --- > ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 34 > ++++++++++++++++++++ > 1 file changed, 34 insertions(+) > > diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > index 15c5cac1bea0..9905cad22908 100644 > --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > @@ -820,6 +820,40 @@ PlatformBootManagerUnableToBoot ( > { EFI_STATUS Status; EFI_BOOT_MANAGER_LOAD_OPTION > BootManagerMenu;+ EFI_BOOT_MANAGER_LOAD_OPTION > *BootOptions;+ UINTN OldBootOptionCount;+ UINTN > NewBootOptionCount;++ //+ // Record the total number of boot > configured boot options+ //+ BootOptions =3D > EfiBootManagerGetLoadOptions (&OldBootOptionCount,+ > LoadOptionTypeBoot);+ EfiBootManagerFreeLoadOptions (BootOptions, > OldBootOptionCount);++ //+ // Connect all devices, and regenerate all b= oot > options+ //+ EfiBootManagerConnectAll ();+ > EfiBootManagerRefreshAllBootOption ();++ //+ // Record the updated > number of boot configured boot options+ //+ BootOptions =3D > EfiBootManagerGetLoadOptions (&NewBootOptionCount,+ > LoadOptionTypeBoot);+ EfiBootManagerFreeLoadOptions (BootOptions, > NewBootOptionCount);++ //+ // If the number of configured boot options > has changed, reboot+ // the system so the new boot options will be taken > into account+ // while executing the ordinary BDS bootflow sequence.+ /= /+ > if (NewBootOptionCount !=3D OldBootOptionCount) {+ DEBUG > ((DEBUG_WARN, "%a: rebooting after refreshing all boot options\n",+ > __FUNCTION__));+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, > NULL);+ } Status =3D EfiBootManagerGetBootManagerMenu > (&BootManagerMenu); if (EFI_ERROR (Status)) {-- > 2.27.0 IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.