From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.53]) by mx.groups.io with SMTP id smtpd.web09.600.1652742132596301000 for ; Mon, 16 May 2022 16:02:12 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=YygZwXxV; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.243.53, mailfrom: ashishsingha@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MkAy3cfEsVBDTlNeFMUyDwcsDOUO8fF0Dt4ZIOg4HLUo//e+h2kjGj8NmDdomaL+NirtetZL4bHT5MQs1LddPlgKwra9w0tGQEgKaGGwEOJHeSgiGA8W8ybD/hw12OJabMxvd4xuJC0Jqp7MLe4a/65Phe/H/9t/3sahvpwNGvWctV1qI3CrZLsChEXMWV+1re49Z0oMQVi+FgGlR9mMLpaggj9Dp6yhOg5C1at4TcQdC3dvP4Qh0HyTwp/tcdQTpFxwhTXvaF7AozkQcgj83HvgZb+pmee186BvjUnoyjBOFs5eLY3HDLQiKHgpiIVuYws1EfZokDZK9C8J9pITfA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5pLu832FBDjk1dN6bSVynnW0Y2acn7f4Gshb0FUeJEU=; b=CZ3gjMz9oMz3KFwzt9JGcXXLs30XmMDQfWw1pC9+g+7VXb2o/GkMn3ksh5XK/tlsqatVZmwhDHATzG5bR7H56MPoQZOMw6o1gXqTpMxYwBwKWPS0ZBWhXJ9JxComMVpb/EExpXget56pq1McA0b/EKZ0GOWyMbcQbEFvLBkVugnPcPs+pRcNxN4jQ+xB3ZtlfyBgs4crXEHrKlwsVScYLeL04QPnapiMf66isPx0SdX3OQgljBR9aounqj9Zcp6TGQRclBSVyudvPTjGuJdEEA+TL2Gmad6uwzlxPt4FRiTtFwFMw/G3bXkUSDvcRtuArZGzoL3ATuZx21iUfgn/Wg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5pLu832FBDjk1dN6bSVynnW0Y2acn7f4Gshb0FUeJEU=; b=YygZwXxVkcgA6Zp9O31ss64Wl0eOnRwYrI5B6gsU5yog/CQoC7yLkavb9GMHweD9ty2zzT9b+s4S2+1wwT856VIng3KuVXZMDb30ofZQHdyG5dTQ7KzZmfmnHMA5ZdAxAuEXKmNuLa1juCzUYRXmRBcGxYdGq4PGzH3GlDiYLZe750XRsEePoVzVq0SBAPzFnxpfbNDqwlhCyxzs4Qq+8JZaK6jTUxvxQEJFVUjzcObLVfhmXITx8m/64OXYGth+b6Jh49OUyNgNP3oxGmofmnB+zv5rSG9l+dKe0kH8KBy5Ts6drP24WepPnqA4ha7zyzgkk/K6sMZpFu5tJviPVw== Received: from BN9PR03CA0758.namprd03.prod.outlook.com (2603:10b6:408:13a::13) by BYAPR12MB3045.namprd12.prod.outlook.com (2603:10b6:a03:ac::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Mon, 16 May 2022 23:02:09 +0000 Received: from BN8NAM11FT008.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13a:cafe::3b) by BN9PR03CA0758.outlook.office365.com (2603:10b6:408:13a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Mon, 16 May 2022 23:02:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by BN8NAM11FT008.mail.protection.outlook.com (10.13.177.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5250.13 via Frontend Transport; Mon, 16 May 2022 23:02:08 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Mon, 16 May 2022 23:02:04 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 16 May 2022 16:02:03 -0700 Received: from ashishsingha-lnx.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.22 via Frontend Transport; Mon, 16 May 2022 16:02:02 -0700 From: "Ashish Singhal" To: , , , , CC: Ashish Singhal Subject: [PATCH] MdeModulePkg/UefiBootManagerLib: Configurable New Boot Options Date: Mon, 16 May 2022 17:01:59 -0600 Message-ID: <3fe4f5fff1141c3576ccf81b5993992c2bee81bb.1652741915.git.ashishsingha@nvidia.com> X-Mailer: git-send-email 2.17.1 X-NVConfidentiality: public Return-Path: ashishsingha@nvidia.com MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a0d9a8e7-ae8d-4de8-a155-08da37901aaf X-MS-TrafficTypeDiagnostic: BYAPR12MB3045:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ddh53F2IjJRV1srtQZ4V6Ie4SFXuIBynPR20761qskO57dW+EHJmg29nR07odCx6Y4y4qKMKwCFnv+t1WXK55c6faASJgOQ3DZpvBQSPsiFMIuvqITTCs0ajqtJqqRllRszBqVV0sg+R+03vtuB8eTeBgVBd00U+IRqomFpEoqsb0kSNGYE9iMSeQyeTZ9dqj5AlJJG5EHktyoPwnsDMWSADMPUuZoZZznDcrSH65NDe+BGBhwCM+Ju+ck5XudvmJ7JGx+o8OVyPT63lQKk+Fx9IJ2ho+Pyw1GbhTShJJahBWT8mVsh/tLVMJaM062LV+QorA9CRiaK3AarKgwMdjKAEdrUEAJA3ThOHlXiC/eNCn632FxOxtEKOqlHKawbU+vmhTADnbFlt4RbdN46XkK4mkCK9sUm9z4TxiQZTYNErCUTkqUYqx+NAHuTg0iz6tdECCcVnGxaQFJfX2HGGW2AcSqYMnJUJuzCDXozZB194QGIN7+eoeIEbIv+1vPlkWe8eIYwMJV2cV9PXSeJf5tPiuHFbhtEfnCBgXqrd7HCmf1Bl9AznahqogRa4qD940csQGo9CA+hx4+IVJd4sd6BwbPr8PAAkzOm8wCTvKgfhob++a4xHX7YxHqa1KlRbpTiO2j2Sqzh0KpGDN2ryBC4lnfEjqO1Rw7fsY7eSLzSa2UB6ZaUiLVIGQ9AZJ5BBoU5DaasKWiztAN1++fp/tQ== X-Forefront-Antispam-Report: CIP:12.22.5.234;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(70206006)(70586007)(36860700001)(82310400005)(26005)(4326008)(8676002)(81166007)(2616005)(36756003)(316002)(110136005)(83380400001)(47076005)(356005)(426003)(86362001)(5660300002)(8936002)(508600001)(107886003)(40460700003)(2906002)(336012)(6666004)(186003)(7696005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2022 23:02:08.7163 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a0d9a8e7-ae8d-4de8-a155-08da37901aaf X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.234];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT008.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3045 Content-Type: text/plain Add a new PCD to be able to configure whether newly detected boot options are to be added at the beginning of the current boot options list or at the end. Signed-off-by: Ashish Singhal --- MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 6 +++++- .../Library/UefiBootManagerLib/UefiBootManagerLib.inf | 1 + MdeModulePkg/MdeModulePkg.dec | 5 +++++ MdeModulePkg/MdeModulePkg.uni | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c index 962892d38f..8a46100c2a 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -2435,7 +2435,11 @@ EfiBootManagerRefreshAllBootOption ( // for (Index = 0; Index < BootOptionCount; Index++) { if (EfiBootManagerFindLoadOption (&BootOptions[Index], NvBootOptions, NvBootOptionCount) == -1) { - EfiBootManagerAddLoadOptionVariable (&BootOptions[Index], (UINTN)-1); + if (PcdGetBool (PcdNewBootOptionAtStart)) { + EfiBootManagerAddLoadOptionVariable (&BootOptions[Index], 0); + } else { + EfiBootManagerAddLoadOptionVariable (&BootOptions[Index], (UINTN)-1); + } // // Try best to add the boot options so continue upon failure. // diff --git a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf index fe05d5f1cc..46f41a7c63 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf +++ b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf @@ -119,3 +119,4 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdDriverHealthConfigureForm ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMaxRepairCount ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdNewBootOptionAtStart ## CONSUMES diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index cf79292ec8..9d696f117b 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -2146,6 +2146,11 @@ # @Prompt GHCB Pool Size gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbSize|0|UINT64|0x00030008 + ## This dynamic PCD holds the flag to tell UEFI boot manager whether to add newly detected devices at + # the end, or at the start of the boot option. + # @Prompt Add new devices in boot options at start + gEfiMdeModulePkgTokenSpaceGuid.PcdNewBootOptionAtStart|FALSE|BOOLEAN|0x00030009 + [PcdsDynamicEx] ## This dynamic PCD enables the default variable setting. # Its value is the default store ID value. The default value is zero as Standard default. diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni index b070f15ff2..8e68db1c25 100644 --- a/MdeModulePkg/MdeModulePkg.uni +++ b/MdeModulePkg/MdeModulePkg.uni @@ -1325,6 +1325,10 @@ #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdGhcbBase_HELP #language en-US "Used with SEV-ES support to identify an address range that is not to be encrypted." +#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNewBootOptionAtStart_PROMPT #language en-US "Add new devices in boot options at start" + +#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNewBootOptionAtStart_HELP #language en-US "Used by UEFI boot manager to decide whether to place newly detcted devices at start of the list or end." + #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdGhcbSize_PROMPT #language en-US "Guest-Hypervisor Communication Block (GHCB) Pool Base Size" #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdGhcbSize_HELP #language en-US "Used with SEV-ES support to identify the size of the address range that is not to be encrypted." -- 2.17.1