From nobody Fri May 3 04:16:01 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+41793+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+41793+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1559544250; cv=none; d=zoho.com; s=zohoarc; b=NRIJqA1LCjyx4oH1M32HuxWN6UCjlw0I7JM0qBbeUk102qLevfBTW+szvR/X3kIbRSHFOZ/AYF2bg6Kv7/nXiD0KNlfYwkoPuc/DbfMu5/eiWyXxF+Mn49N5Ox4yy6ZD9OKoXL6ILQoqM2wRtOAyKHXIBhL3DHD7ue+8zbySZTk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559544250; 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=NjiFitpph9XLnpHrFdzvl+MTOUG/3UuRzu0EG71cAFU=; b=EbPzslISKCP24OoTs3wlNYmtq8AbXIxn8rRMr9r2PaucHFlFY2xtQgAdN3GEcqcVZSveL4s4U5rb6rJ8wiBR5zUTVCm7uNjklLGnYkZm0LsdU73d7adOk4dEwMDiWvT1SS0tAt2btIDHj2r2QvwDxKNmF0VnNt/fiRIU9hUStP0= 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+41793+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 1559544250823934.851778135476; Sun, 2 Jun 2019 23:44:10 -0700 (PDT) Return-Path: X-Received: from mga01.intel.com (mga01.intel.com []) by groups.io with SMTP; Sun, 02 Jun 2019 23:44:05 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jun 2019 23:44:05 -0700 X-ExtLoop1: 1 X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by orsmga005.jf.intel.com with ESMTP; 02 Jun 2019 23:44:03 -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 1/2] MdeModulePkg: Add a pcd to set the OS indications bit Date: Mon, 3 Jun 2019 14:43:57 +0800 Message-Id: <20190603064358.13296-2-zhichao.gao@intel.com> In-Reply-To: <20190603064358.13296-1-zhichao.gao@intel.com> References: <20190603064358.13296-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=1559544249; bh=tBjUAloXnsCOydwjD3dgsvlkEtU/AW/e++el+wPFfX8=; h=Cc:Date:From:Reply-To:Subject:To; b=v5edzSi3unPtlbE1AwVFSmPLpMlU4qWJ35RRdbfZEX3CFMyEDCwnujupWeMzQ5M6Tbb fpGfT/YZV7t5i7Lc1qciie9/jqjicJQzm4qc/RKDijMr19nq52dMzmqWwcVFA9rKWKmnW KG5gDCLzMjiM/AaUXOsJKjn68jPfe4JLFuA= 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 supports 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 --- 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 (#41793): https://edk2.groups.io/g/devel/message/41793 Mute This Topic: https://groups.io/mt/31907729/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 Fri May 3 04:16:01 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+41794+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+41794+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1559544248; cv=none; d=zoho.com; s=zohoarc; b=TGIcKDs811qyS+FIXGYqI22QOv5Q0qXMKEP+mCgCxwMV9e5DGuhdlWecp1NBYQkW1ufZ/L3GcFR6d402FTitKgZUV9cnpi4cfFl3Zq4xr0Pqgq65GVXyLVTnE8Y3mDsMIuzdO1iexzdFTtcu+usi6jBap7WR/QQ48P/hSTQQuQU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559544248; 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=eEWsFwnYG0jRAuCI6HlHp/p98ntXk6jsulP1Au4RyEc=; b=MRuPwzSflb4VV0e4FUjXBf+KlLMIwZ0MKyZfDYX97O7z7w1kR0tB6nirZAQmslqpInNMwcgeIRIe8XgarNMTbhqlUPiE41J3CdJWrofFaKlL5KC5w0We/0+BslBri8goXaQDPvQl/+mFdjqQ2fSGyUW3R0ctqCtM6UB6jl1JGF4= 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+41794+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 1559544248758650.1055397415253; Sun, 2 Jun 2019 23:44:08 -0700 (PDT) Return-Path: X-Received: from mga01.intel.com (mga01.intel.com []) by groups.io with SMTP; Sun, 02 Jun 2019 23:44:07 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jun 2019 23:44:07 -0700 X-ExtLoop1: 1 X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by orsmga005.jf.intel.com with ESMTP; 02 Jun 2019 23:44:05 -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 2/2] MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery Date: Mon, 3 Jun 2019 14:43:58 +0800 Message-Id: <20190603064358.13296-3-zhichao.gao@intel.com> In-Reply-To: <20190603064358.13296-1-zhichao.gao@intel.com> References: <20190603064358.13296-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=1559544247; bh=sxUmP6AFkbD88TTWIGF3MBSJqG2BNw/UPrR2QDfILpM=; h=Cc:Date:From:Reply-To:Subject:To; b=W20RcTkmPfceyDVH5Lsjy4l9U5LxQyK2Oa14l3kFqvlqIMvB7N4VA4eQaS1Pom0SjCB 6ZHtJUevEYI79JLaaqwVl3AmfaB4C0aDEA3M0FSEXB0jgVfxafPZTpTmvmpPbZdamR6Xj s69xlqKFKCJk2Y/cbvYEEsY4uNZY8uKnu5c= 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. 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/BdsDxe/BdsEntry.c | 89 ++++++++++++++---------- 2 files changed, 55 insertions(+), 37 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..3d84d5a8aa 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c @@ -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,41 +768,45 @@ 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); - Status =3D EfiBootManagerInitializeLoadOption ( - &LoadOption, - LoadOptionNumberUnassigned, - LoadOptionTypePlatformRecovery, - LOAD_OPTION_ACTIVE, - L"Default PlatformRecovery", - FilePath, - NULL, - 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; + if (FilePath !=3D NULL) { + Status =3D EfiBootManagerInitializeLoadOption ( + &PlatformDefaultBootOption, + LoadOptionNumberUnassigned, + LoadOptionTypePlatformRecovery, + LOAD_OPTION_ACTIVE, + L"Default PlatformRecovery", + FilePath, + NULL, + 0 + ); + ASSERT_EFI_ERROR (Status); + + // + // System firmware must include a PlatformRecovery#### variable specif= ying + // a short-form File Path Media Device Path containing the platform de= fault + // file path for removable media if the platform supports Platform Rec= overy. + // + if (PcdGetBool (PcdPlatformRecoverySupport)) { + LoadOptions =3D EfiBootManagerGetLoadOptions (&LoadOptionCount, Load= OptionTypePlatformRecovery); + if (EfiBootManagerFindLoadOption (&LoadOption, LoadOptions, LoadOpti= onCount) =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 (&PlatformDefaultBoo= tOption); + ASSERT_EFI_ERROR (Status); } + EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount); } - LoadOption.OptionNumber =3D Index; - Status =3D EfiBootManagerLoadOptionToVariable (&LoadOption); - ASSERT_EFI_ERROR (Status); + FreePool (FilePath); } - EfiBootManagerFreeLoadOption (&LoadOption); - FreePool (FilePath); - EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount); =20 // // Report Status Code to indicate connecting drivers will happen @@ -1043,10 +1052,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 (#41794): https://edk2.groups.io/g/devel/message/41794 Mute This Topic: https://groups.io/mt/31907730/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-