From nobody Mon Apr 29 02:28:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48988+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=hpe.com Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1571129608189482.8284237367991; Tue, 15 Oct 2019 01:53:28 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id V8PRYY1788612xGfPWsQYnro; Tue, 15 Oct 2019 01:53:27 -0700 X-Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web11.1353.1571129606997129310 for ; Tue, 15 Oct 2019 01:53:27 -0700 X-Received: from pps.filterd (m0134423.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x9F8pMYN008824 for ; Tue, 15 Oct 2019 08:53:26 GMT X-Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) by mx0b-002e3701.pphosted.com with ESMTP id 2vmmtw2hkx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 15 Oct 2019 08:53:26 +0000 X-Received: from G1W8106.americas.hpqcorp.net (g1w8106.austin.hp.com [16.193.72.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g9t5009.houston.hpe.com (Postfix) with ESMTPS id 674F26B for ; Tue, 15 Oct 2019 08:53:25 +0000 (UTC) X-Received: from G4W9335.americas.hpqcorp.net (16.208.33.85) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 15 Oct 2019 08:53:18 +0000 X-Received: from G1W8106.americas.hpqcorp.net (16.193.72.61) by G4W9335.americas.hpqcorp.net (16.208.33.85) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 15 Oct 2019 08:53:17 +0000 X-Received: from NAM02-BL2-obe.outbound.protection.outlook.com (15.241.52.12) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Tue, 15 Oct 2019 08:53:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jZqAAcj7pl72KG5IJWtvCj2VrIc/zslgDV5ag8FJFQX/b11XYXWW+kBJVVYDodCfxW87BmcaBRX3zjr4rkXpRaaesVDL7gdLMF8CVDa0aebLvic7HYDPZ+uZmgDvo3sHgJvSfYUBrGXrBgyi9xmSb4EK7iKjUfdRSp8mHmfP91r5RFdXkEf4wzn96AOm0gHXntQ63ykCQO5xVq4Wgkmaj7nAH93dfrqRz8hRsRmC/LjF6DK6c46JbG0o0EIVlTawFQaadFa5P8MiMiY2f/4yJvWpbXyzXAc5TP8GRULei4UfxFxeoa046KqLiy20mObOE4aM/5CgW39R4ETHTj0bVQ== 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=a/BZMclVuoh1inykU5z0wYq46foDpJi68l4o0xE3C4E=; b=NfSXEJjKu3CH/WjlF3ox9vt6FAeWGAdPTzQil8Y8tiDNm+wv+AGWW4h3pmGaMFBlMhEmNCXNz/gs3hLKZc9TFuctJ62alpq/aPRh4uOUng4K57oXzMsKnB34L4ruu0J6PNVVTumHfNhs51K5u8C3d8uwaYqnvu9M0kbWZMB6thq37B61ESOt9+IaObnKVsz+M5ncgBcwFk32hv+rGdKRB7v/3nzuicY+U49+ygli5thKfceqszZi9ZChl5mhptQGoGctWbpcn1A+uJkps+4lHFRHmm9MkUtqy9uxfunwCJc9M2ih2dibWPskn+UjwOwmWjOcdzIKx6izv8yWEmIj7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hpe.com; dmarc=pass action=none header.from=hpe.com; dkim=pass header.d=hpe.com; arc=none X-Received: from DF4PR8401MB0969.NAMPRD84.PROD.OUTLOOK.COM (10.169.87.143) by DF4PR8401MB0764.NAMPRD84.PROD.OUTLOOK.COM (10.169.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.18; Tue, 15 Oct 2019 08:53:15 +0000 X-Received: from DF4PR8401MB0969.NAMPRD84.PROD.OUTLOOK.COM ([fe80::d1ca:f8fb:45e:4c30]) by DF4PR8401MB0969.NAMPRD84.PROD.OUTLOOK.COM ([fe80::d1ca:f8fb:45e:4c30%12]) with mapi id 15.20.2347.023; Tue, 15 Oct 2019 08:53:15 +0000 From: "Wang, Sunny (HPS SW)" To: "devel@edk2.groups.io" , "zhichao.gao@intel.com" , Ray Ni CC: Jian J Wang , Hao Wu , "Star Zeng" , Liming Gao , Sean Brogan , Michael Turner , Bret Barkelew , "Li, Walon" , "Wei, Kent (HPS SW)" , "Wang, Sunny (HPS SW)" Subject: [edk2-devel] Use a pcd to control PlatformRecovery Thread-Topic: Use a pcd to control PlatformRecovery Thread-Index: AdWDK94yxgzpZjqYRC+1b6PvmRyefQ== Date: Tue, 15 Oct 2019 08:53:15 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [16.242.247.139] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8b07cc08-b0c1-44eb-1290-08d7514d1e08 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: DF4PR8401MB0764: x-ms-exchange-purlcount: 4 x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:37; Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+48988+1787277+3901457@groups.io; helo=web01.groups.io; received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 2e+00U2GJLnTZQd7u2kf9di5cXGJ0i0tT/dDXYXcuMuFkLwYEvWTndFnpC1hvusH3qFouOOL4hgailV1P9zD3P7jVo/Lf0vJiEHia0wlEJsjUV77b1op3C/GkFe81RP3WfrY2OVq2poL5iyvhwWhC700XvYwVGyxUAhYa91rTlr1tHWgHNoGM/9OujgvADeOgMAXZlFT6i0yvAABIV4laVKR3KRNVQJSn8L9cfce5eBIwYgcoxcqoQ6lwEltqTAqbD23esNRZfGicrAXCsSKdCIFJWURm5XiRicPbTCZPF9DGn/BP7hBKt5OKbrojj/jQiXQohQAx88rwUs2mnt8O2NR3fAnEWdBisvDjTEbEMEQrPKb7uSAjsPQBQeEr0uutkj0oEcvIn9/2XQqFDk85v0XItbKyFF9l3DLTFGGxSDNAxBRQgaeA3ECCnzkqSg17i1zg3QX7WfwANo+nPyy8w== X-MS-Exchange-CrossTenant-Network-Message-Id: 8b07cc08-b0c1-44eb-1290-08d7514d1e08 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Oct 2019 08:53:15.3751 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0qWKaJ3ewZ9hjvrNr5jk+cNOVm9HYnfR9aQMu0BsfVipjK4VXMtEAgAYTj/RXP+eNrHr2eK8A1dS2jXdfYTAMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB0764 X-OriginatorOrg: hpe.com X-Proofpoint-UnRewURL: 4 URL's were un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sunnywang@hpe.com X-Gm-Message-State: tIYFc03QpAbnEQC0rcEYCUfPx1787277AA= Content-Language: en-US Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1571129607; bh=rbK1pwJisGZNNmSxwaR2ZFbiAKjs/9Lsjkw3lJx9ruM=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=gBtPfxrDXHJC7B8Bmp1SJ97X1UIjgdPyDx7T7FOBYf253cyAkyUVqybTzMZKzBzr+dY PKtUIiKTtT8NpHGGoW5i9oXTHTjw0f0fxJAZjt4DlCt4RBQEz6pIeRczIh+4JvOmKK3me yntsLL/fF29KaYlshQ/1pOqSfX1QmgQP354= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Hi Zhichao and Ray,=20 I have some questions about this code change. Sorry for being late to bring= my questions here. For now, the code block for iterating the PlatformRecovery#### variables is= controlled by OsIndications variable. However, it looks to me like that th= e PlatformRecovery#### should still be attempted for the case of that proce= ssing of BootOrder does NOT result in success (according to section 3.4 in = UEFI 2.8). In other words, I think we should check PCD "PcdPlatformRecovery= Support" instead of Local variable "PlatformRecovery" (from OsIndications v= ariable) like the code below. What do you guys think? If you need a meeting= or short talk to discuss this, feel free to let me know.=20 if (!BootSuccess) { - if (PlatformRecovery) { + if (PcdGetBool (PcdPlatformRecoverySupport)) { LoadOptions =3D EfiBootManagerGetLoadOptions (&LoadOptionCount, LoadO= ptionTypePlatformRecovery); ProcessLoadOptions (LoadOptions, LoadOptionCount); EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount); } else { // // When platform recovery is not enabled, still boot to platform defa= ult file path. // EfiBootManagerProcessLoadOption (&PlatformDefaultBootOption); } =20 In addition, it looks like EDK2 don't have code to process OsRecovery#### v= ariables. Do we need to create a Bug on TianoCore Bugzilla system?=20 Moreover, I saw that both of you had a discussion about "Default PlatformRe= covery", but I can't figure out the connection between the discussion and t= he final code change. Isn't the "Default PlatformRecovery" part of the Plat= form Recovery feature? At this moment, we don't have OS recovery support, s= o I think that NO platform recovery support can be identified as NO boot op= tion recovery support. For this case, shouldn't we use PCD "PcdPlatformReco= verySupport" to control "Default PlatformRecovery" as well? For the next st= ep, I think we need to get further clarification from USWG to either not ti= e "Default Boot Behavior" with PlatformRecovery or update the description t= o the following:=20 - If system firmware supports Platform recovery as described in Section= 3.4.2, system firmware must include a PlatformRecovery#### variable specif= ying a short-form File Path Media Device Path.... Regards, Sunny Wang -----Original Message----- From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Gao, = Zhichao Sent: Thursday, June 20, 2019 11:44 AM To: devel@edk2.groups.io Cc: Jian J Wang ; Hao Wu ; Ray N= i ; Star Zeng ; Liming Gao ; Sean Brogan ; Michael Turner ; Bret Barkelew Subject: [edk2-devel] [PATCH v5 2/2] MdeModulePkg/BdsDxe: Use a pcd to cont= rol PlatformRecovery REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1678=20 Use the PcdPlatformRecoverySupport to control the function of platform reco= very in BDS. First, set the variable's ("OsIndicationsSupported") EFI_OS_INDICATIONS_STA= RT_PLATFORM_RECOVERY bit base on the pcd. It would affect the variable "OsIndications". While the platform does not support the platform recovery, it is inappropri= ate to set a PlatformRecovery#### variable. So skip setting the variable. B= ut it should remain the behavior of booting from a default file path (such = as \EFI\BOOT\BOOTX64.EFI) to be compatible with the previous version UEFI s= pec. Add memory check before build platform default boot option. If fail to allo= cate memory for the defualt boot file path, put the system into dead loop t= o indicate it is unable to boot. Cc: Jian J Wang Cc: Hao Wu Cc: Ray Ni Cc: Star Zeng Cc: Liming Gao Cc: Sean Brogan Cc: Michael Turner Cc: Bret Barkelew Signed-off-by: Zhichao Gao --- MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 3 +- MdeModulePkg/Universal/B= dsDxe/BdsEntry.c | 71 +++++++++++++++--------- 2 files changed, 47 insertions(+), 27 deletions(-) diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf b/MdeModulePkg/Univer= sal/BdsDxe/BdsDxe.inf index 6913389d34..7f94ca17df 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf @@ -5,7 +5,7 @@ # gEfiBdsArchProtocolGuid. After DxeCore finish dispatching, DxeCore will= invoke Entry # interface of protocol gEfiBdsArchProtocolGuid, then BDS p= hase is entered. # -# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2019, Intel Corporation. All rights=20 +reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -95,6 +95,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand ## C= ONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable ## S= OMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed ## C= ONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformRecoverySupport ## C= ONSUMES =20 [Depex] TRUE diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c b/MdeModulePkg/Univer= sal/BdsDxe/BdsEntry.c index 9d312bd982..4f3168b62a 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c @@ -5,7 +5,7 @@ After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will b= e invoked to enter BDS phase. =20 -Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -546,10 +546,14 @@ BdsForm= alizeOSIndicationVariable ( // Status =3D EfiBootManagerGetBootManagerMenu (&BootManagerMenu); if (Status !=3D EFI_NOT_FOUND) { - OsIndicationSupport =3D EFI_OS_INDICATIONS_BOOT_TO_FW_UI | EFI_OS_INDI= CATIONS_START_PLATFORM_RECOVERY; + OsIndicationSupport =3D EFI_OS_INDICATIONS_BOOT_TO_FW_UI; EfiBootManagerFreeLoadOption (&BootManagerMenu); } else { - OsIndicationSupport =3D EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY; + OsIndicationSupport =3D 0; + } + + if (PcdGetBool (PcdPlatformRecoverySupport)) { + OsIndicationSupport |=3D EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY; } =20 Status =3D gRT->SetVariable ( @@ -662,6 +666,7 @@ BdsEntry ( BOOLEAN BootSuccess; EFI_DEVICE_PATH_PROTOCOL *FilePath; EFI_STATUS BootManagerMenuStatus; + EFI_BOOT_MANAGER_LOAD_OPTION PlatformDefaultBootOption; =20 HotkeyTriggered =3D NULL; Status =3D EFI_SUCCESS; @@ -763,14 +768,13 @@ BdsEntry ( // InitializeLanguage (TRUE); =20 - // - // System firmware must include a PlatformRecovery#### variable specifyi= ng - // a short-form File Path Media Device Path containing the platform defa= ult - // file path for removable media - // FilePath =3D FileDevicePath (NULL, EFI_REMOVABLE_MEDIA_FILE_NAME); + if (FilePath =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "Fail to allocate memory for defualt boot file pa= th. Unable to boot.\n")); + CpuDeadLoop (); + } Status =3D EfiBootManagerInitializeLoadOption ( - &LoadOption, + &PlatformDefaultBootOption, LoadOptionNumberUnassigned, LoadOptionTypePlatformRecovery, LOAD_OPTION_ACTIVE, @@ -780,24 +784,31 @@ BdsEntry ( 0 ); ASSERT_EFI_ERROR (Status); - LoadOptions =3D EfiBootManagerGetLoadOptions (&LoadOptionCount, LoadOpti= onTypePlatformRecovery); - if (EfiBootManagerFindLoadOption (&LoadOption, LoadOptions, LoadOptionCo= unt) =3D=3D -1) { - for (Index =3D 0; Index < LoadOptionCount; Index++) { - // - // The PlatformRecovery#### options are sorted by OptionNumber. - // Find the the smallest unused number as the new OptionNumber. - // - if (LoadOptions[Index].OptionNumber !=3D Index) { - break; + + // + // System firmware must include a PlatformRecovery#### variable=20 + specifying // a short-form File Path Media Device Path containing the=20 + platform default // file path for removable media if the platform suppor= ts Platform Recovery. + // + if (PcdGetBool (PcdPlatformRecoverySupport)) { + LoadOptions =3D EfiBootManagerGetLoadOptions (&LoadOptionCount, LoadOp= tionTypePlatformRecovery); + if (EfiBootManagerFindLoadOption (&PlatformDefaultBootOption, LoadOpti= ons, LoadOptionCount) =3D=3D -1) { + for (Index =3D 0; Index < LoadOptionCount; Index++) { + // + // The PlatformRecovery#### options are sorted by OptionNumber. + // Find the the smallest unused number as the new OptionNumber. + // + if (LoadOptions[Index].OptionNumber !=3D Index) { + break; + } } + PlatformDefaultBootOption.OptionNumber =3D Index; + Status =3D EfiBootManagerLoadOptionToVariable (&PlatformDefaultBootO= ption); + ASSERT_EFI_ERROR (Status); } - LoadOption.OptionNumber =3D Index; - Status =3D EfiBootManagerLoadOptionToVariable (&LoadOption); - ASSERT_EFI_ERROR (Status); + EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount); } - EfiBootManagerFreeLoadOption (&LoadOption); FreePool (FilePath); - EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount); =20 // // Report Status Code to indicate connecting drivers will happen @@ -104= 3,10 +1054,18 @@ BdsEntry ( } =20 if (!BootSuccess) { - LoadOptions =3D EfiBootManagerGetLoadOptions (&LoadOptionCount, LoadOp= tionTypePlatformRecovery); - ProcessLoadOptions (LoadOptions, LoadOptionCount); - EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount); + if (PlatformRecovery) { + LoadOptions =3D EfiBootManagerGetLoadOptions (&LoadOptionCount, Load= OptionTypePlatformRecovery); + ProcessLoadOptions (LoadOptions, LoadOptionCount); + EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount); + } else { + // + // When platform recovery is not enabled, still boot to platform def= ault file path. + // + EfiBootManagerProcessLoadOption (&PlatformDefaultBootOption); + } } + EfiBootManagerFreeLoadOption (&PlatformDefaultBootOption); =20 DEBUG ((EFI_D_ERROR, "[Bds] Unable to boot!\n")); PlatformBootManagerUnableToBoot (); -- 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#48988): https://edk2.groups.io/g/devel/message/48988 Mute This Topic: https://groups.io/mt/34543609/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-