From nobody Wed May 1 23:32:52 2024 Delivered-To: importer@patchew.org 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+41848+1787277+3901457@groups.io; helo=web01.groups.io; 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+41848+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1559610330; cv=none; d=zoho.com; s=zohoarc; b=S8H4OAO/LHPdEy+Qd7GlwzDM8u5RZ7qf1LiXs5wNJNnvRWh9HBSCqq4ZnJr4+jn11ktDk5hK/1XuEqAyFtSc4/mFZdVdyhUFflX17cOF+4izqA/BqVK8AWwHNbsuKY2xTIUzXp+FOzA3jlULlJkx8WdMxgqutHNRM22S7yiZ8PI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559610330; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=az5QzQDL5USRm6gTHTI7aQgxRItNZUCYqQ6yqq2u68U=; b=kwuPhamIiSLDC1QKHiFmSgI1EeMcWqs1s1o75T7iPB0av33151E3812AxtOl/l92bcLBnUT8XALMABGV+fa++tMqd/dAVYM41SdXsxbylggOw0UOGhtCedt13aPQDd+oqIHg/4JLtoGkhj7yvAL/gVLUufQSQWvF/WW1uin9eVM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41848+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1559610330470378.20286774814065; Mon, 3 Jun 2019 18:05:30 -0700 (PDT) Return-Path: X-Received: from mga18.intel.com (mga18.intel.com []) by groups.io with SMTP; Mon, 03 Jun 2019 18:05:28 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jun 2019 18:05:28 -0700 X-ExtLoop1: 1 X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by orsmga004.jf.intel.com with ESMTP; 03 Jun 2019 18:05:27 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Bret Barkelew , Jian J Wang , Hao Wu , Ray Ni , Star Zeng , Liming Gao , Sean Brogan , Michael Turner Subject: [edk2-devel] [PATCH V3 1/2] MdeModulePkg: Add a pcd to set the OS indications bit Date: Tue, 4 Jun 2019 09:05:14 +0800 Message-Id: <20190604010515.14352-2-zhichao.gao@intel.com> In-Reply-To: <20190604010515.14352-1-zhichao.gao@intel.com> References: <20190604010515.14352-1-zhichao.gao@intel.com> MIME-Version: 1.0 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,zhichao.gao@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1559610329; bh=s+OkeGPgTPYfBxsFEvBilDxe2ji+6uX+Px+pVZvCJ3g=; h=Cc:Date:From:Reply-To:Subject:To; b=q0SFlpQKEK1PVu1jCeUgTpBKUXKzn9niXrAxTvg61VCpo53gV3rrgmd+bukXj2+NGTl NHcoMnXR9dzzlZjAsVtQGjUdWBulXexaHuIhdEZkmCNEvbmiekUmc1MyjKZDHERAmSq06 fY/uLuYGbnSlchqZtyO0rkI+7pCOGnhjH0g= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Bret Barkelew REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1678 Add a pcd PcdPlatformRecoverySupport to conditionally set an OS indications bit and set the 'PlatformRecovery####' variable. This pcd would also control whether the BDS support platform recovery or not. 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 Reviewed-by: Ray Ni Reviewed-by: Hao A Wu --- MdeModulePkg/MdeModulePkg.dec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 0a9fcddecc..da2b85770c 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -1660,6 +1660,12 @@ # @Prompt Reset on memory type information change. gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|TRU= E|BOOLEAN|0x00010056 =20 + ## Indicates if the BDS supports Platform Recovery.

+ # TRUE - BDS supports Platform Recovery.
+ # FALSE - BDS does not support Platform Recovery.
+ # @Prompt Support Platform Recovery. + gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformRecoverySupport|TRUE|BOOLEAN|0= x00010078 + ## Specify the foreground color for Subtile text in HII Form Browser. Th= e default value is EFI_BLUE. # Only following values defined in UEFI specification are valid:

# 0x00 (EFI_BLACK)
--=20 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 (#41848): https://edk2.groups.io/g/devel/message/41848 Mute This Topic: https://groups.io/mt/31917431/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- From nobody Wed May 1 23:32:52 2024 Delivered-To: importer@patchew.org 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+41849+1787277+3901457@groups.io; helo=web01.groups.io; 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+41849+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1559610331; cv=none; d=zoho.com; s=zohoarc; b=Xwc8I8vS26EhHI6TzJJHNV5zDRqDc020Xd/WgB5iXHhTKeI48mwrzEpP4eTRHf09yq1rbuVs19dO1hQNnlIZRhsx84TlGNcDHU6M3pFIZYuCmtzqtYteuHYnvN/RSlEzTept00NXNOkw8RjCkVFXkpLoDvzdzHjY2FeqYh8js0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559610331; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=0OpeTu8l3uAyUndc1HJlbuMOREMTk6Jnw8kSaNXO75s=; b=VmVJi778P+fmfxpjTqAGiVYZ1e2tqVQS9yUez4Rpn7+F5XIVik86Y3QYqjOfeNAUyau1Q+4AHrXBvrDeMg1xnWguP1HiSMceIX6VxCqRj2Qno4fSVyDtAfIZhXqYPmhdnvx7qaYnwGIUQSFXlnabQq0pGx2lALLwLgv/D3C1Qrw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41849+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1559610331775486.5601831300903; Mon, 3 Jun 2019 18:05:31 -0700 (PDT) Return-Path: X-Received: from mga18.intel.com (mga18.intel.com []) by groups.io with SMTP; Mon, 03 Jun 2019 18:05:30 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jun 2019 18:05:30 -0700 X-ExtLoop1: 1 X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by orsmga004.jf.intel.com with ESMTP; 03 Jun 2019 18:05:28 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Jian J Wang , Hao Wu , Ray Ni , Star Zeng , Liming Gao , Sean Brogan , Michael Turner , Bret Barkelew Subject: [edk2-devel] [PATCH V3 2/2] MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery Date: Tue, 4 Jun 2019 09:05:15 +0800 Message-Id: <20190604010515.14352-3-zhichao.gao@intel.com> In-Reply-To: <20190604010515.14352-1-zhichao.gao@intel.com> References: <20190604010515.14352-1-zhichao.gao@intel.com> MIME-Version: 1.0 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,zhichao.gao@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1559610331; bh=yz7KAm3K6cC3y2xpEHdVVZ5qGszqhMu7b+Q3AqPVp8s=; h=Cc:Date:From:Reply-To:Subject:To; b=QX64hhpp2aJBjvTsxUdt/c29TJs66aHJbKpO+WIqp9aBm5PS8PFnqIPOUbYge4WSY8C +BuT0FThMSCWNJ7oxSLYzLnb73/JCll87HIlVKL0QAn/K6GaPmwRCuFq9Z28LYK05lMEF dP8ExmqJ7sgM75H+z3jQIKK9qy6x0aPHhnA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1678 Use the PcdPlatformRecoverySupport to control the function of platform recovery in BDS. First, set the variable's ("OsIndicationsSupported") EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY bit base on the pcd. It would affect the variable "OsIndications". While the platform does not support the platform recovery, it is inappropriate to set a PlatformRecovery#### variable. So skip setting the variable. But 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 spec. Add memory check before build platform default boot option. If fail to allocate memory for the defualt boot file path, put the system into dead loop to 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 Reviewed-by: Ray Ni --- MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 3 +- MdeModulePkg/Universal/BdsDxe/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 phase is entere= d. # -# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2019, Intel Corporation. All rights 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..8c8a0b5236 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 @@ BdsFormalizeOSIndicationVariable ( // 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 specifyi= ng + // a short-form File Path Media Device Path containing the platform defa= ult + // file path for removable media if the platform supports Platform Recov= ery. + // + if (PcdGetBool (PcdPlatformRecoverySupport)) { + LoadOptions =3D EfiBootManagerGetLoadOptions (&LoadOptionCount, LoadOp= tionTypePlatformRecovery); + if (EfiBootManagerFindLoadOption (&LoadOption, LoadOptions, LoadOption= Count) =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 @@ -1043,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 (); --=20 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 (#41849): https://edk2.groups.io/g/devel/message/41849 Mute This Topic: https://groups.io/mt/31917434/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-