From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.60]) by mx.groups.io with SMTP id smtpd.web12.9422.1652803719748011384 for ; Tue, 17 May 2022 09:08:40 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=lfpkuitD; 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.95.60, mailfrom: ashishsingha@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bYvJAQnOf1PZMLqEtOreaRSHJ4v0UyR4oJLoKnTgeK6L5CNCJVVEpASDx1ya6iGvI5E7X4hd+Q23rd5PIVQrxHFPXqIs+/ptVb3efzTgXtUr7z1eqLeaa+7XXcFmVuPhsqUfAiaJSaryFAZMLTQDFFUzuLtqPTxsBBR2vyyTTD8exSE+zicFqgqLLH3d6kwRhniZOWQ/wz5IrPrMZ5Oc3A5mh2V6VFXSURBvvumfbHCJZgqGauO1ebwFzXMFZJ0LVYFkk87L8Yc/3UJ9hAl2oKcPrXeR05KQ0Ofa+i6AEGJSvhbH4eSafPI/H0Uc0ieWHwDFD2ARrfhA5pRo9FNq8g== 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=i8up1hIYJT2m0IKAhLJns/0ogyt3Zq61THijucm0Q28=; b=El0PL47vFW+y0Y+w1MHjgni2SyU0gTWqyq6nDMBRhEZ6Z88OJb6WZSj4F/oohkQyG8bl79nq853AOrBWu9LNvW+5Q8UsLFE7nKnDLipXUSPNpFHnY9E0pYDevrlOtV5+UtZVhhCIL8gx9L7bV4T0V9HC9JNPSJMyXkItw46c2cnWSUSyVYJNnkyjjnXrboU14yA8VW/BaodAs3zM2qAmaFw6yDDt8mgVOI2JSqPh9qLoQImYGdEfokqUrvDMVlk6PmbNJKK56QJWhfU2jp7b4ainWl3GKGYSKwXhhOQhQ7qAWkQ3n8jDPGNzvhudV9djEGTByy7uTgAB50zIEONHXg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; 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=i8up1hIYJT2m0IKAhLJns/0ogyt3Zq61THijucm0Q28=; b=lfpkuitDpqAeIvFrDvx+CmxIkG6MUJO0goxaEJ7DFZLD00LAkQj4cLTK8O4zfXdoTqjWiXxtYXVsiz7GLVUH4a9pjFS9bSnyJTD/6OmZ7/s0xvRYbAV5UwKZJuQGPtDGDhKPIoLI42Zw84lpChcZvU+wa0IPa8lX5/VGVQQ8L4GODkzZUFVH69FVqCkT20aG+DnVCWGawX1c9ZDhEHw5DNioE9u0Uc6CpTc8JAtdQHJb6G0doI75Af9DRGE/9oTL7WAF4EAEU3Lj1kauSMyZxbIquGc1/z/j9Q63pB7P1oV/j05I8Fcq1Z2JYd+dl51TduvUuo080RWuk/ZGcj5zzw== Received: from BY5PR12MB5544.namprd12.prod.outlook.com (2603:10b6:a03:1d9::22) by SN6PR12MB4735.namprd12.prod.outlook.com (2603:10b6:805:e5::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.15; Tue, 17 May 2022 16:08:37 +0000 Received: from BY5PR12MB5544.namprd12.prod.outlook.com ([fe80::a1ca:addf:80ba:e6c3]) by BY5PR12MB5544.namprd12.prod.outlook.com ([fe80::a1ca:addf:80ba:e6c3%6]) with mapi id 15.20.5250.018; Tue, 17 May 2022 16:08:37 +0000 From: "Ashish Singhal" To: "Ni, Ray" , "devel@edk2.groups.io" , "Wang, Jian J" , "Gao, Liming" , "Gao, Zhichao" Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: Configurable New Boot Options Thread-Topic: [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: Configurable New Boot Options Thread-Index: AQHYafgPpePrY4hUf0iD9fuE2dd8wa0jPGbt Date: Tue, 17 May 2022 16:08:37 +0000 Message-ID: References: <3fe4f5fff1141c3576ccf81b5993992c2bee81bb.1652741915.git.ashishsingha@nvidia.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 16574236-9486-4819-def3-08da381f8065 x-ms-traffictypediagnostic: SN6PR12MB4735: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: SzxGBx+b9ABCT2cF345Vt7ykwOyYiQPg8cjqgxc89IgXsBi5UfdthuOsFXrQ06aYH8R2uSzS4KTuKA+jhIkDp60qklDxmn0n6PdiAMrXfPSHOYnyU9rV6h+xZtrsZnodNAVhOn/TtSiMPPta3BaQTLH4X+dGMlpWSBFkWxhZddnXbVgxekqgUfaEiupxOCBxkXr/LYXlhlURlwrelYM07JTmIjYCuXaNnPDXCmNUEwczV+O3skIj4KVtD95O4MElvBcBoNEcMrmxz4NRYhDKk3AdDPDB9Po4+tXCHUnn/+B7DkExoFNuhmtAl6lGwD6z0Pdi800c+dyUfabd44ETiJfoyk/hq8rRSeUlRD3XjZvR/+lKl/2Zk7BZDRiZgCJSNw4BO+ni3BG3p71KHQV3nO6pJ+GiI1CUKwUG8zmHccHp3eDPOXes+gqe5AUOLI1qjDQfQ7JVmbeij/PSWtfXLVzCvd8rN0030IkWS25gcIaVUkbi7Uip0F0pCreg9TqiSIemNhlhBxtVJE9j2cP04L+J1DlSVullXPO2ZTkrgmbUyjOlPHftswu75GTCWxRA+fRHfyo6WYKh3HPbDBU7QhpFmojBQNZSMRjzvRyuE6GMHSG4Arv4cBnaxUMNUjOQ5gFVy+GyIyZg+BtO8J1iYyf+dRXxDWYIu6iv0nSu07uqZjNLYYI9xtJyBlva0DsMKUunTYf8Wx9pnZiQ7CR+HwCq/EDDp2W2wRWcWWnRtSYZZgBuBJXxevAtkm/m5rZ0svLPvdLCjwyp0ydUuzlpowFEMB02CXu7TP0Ua6MJgX0= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB5544.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66556008)(53546011)(6506007)(7696005)(66446008)(71200400001)(66476007)(83380400001)(86362001)(64756008)(33656002)(9686003)(8676002)(19627405001)(2906002)(76116006)(166002)(38070700005)(122000001)(38100700002)(55016003)(966005)(52536014)(5660300002)(66946007)(8936002)(26005)(186003)(316002)(110136005)(508600001)(91956017);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?hGAXvT8Yp7Wrh5w40m1kcSctsN9HmsDh2+8B6PmlPh0hKvMNxJgA5j/N4BV+?= =?us-ascii?Q?YXVescZpjSTwmjdisvNYgQDQZbGwJXqpw/Lsb8/vmKy76MH2e0Y3ICWvADsk?= =?us-ascii?Q?8fXoCJo8EUTpw35gT4SRhoaBWBcqkMRBBb878hoAK9JTxAV2lHPTr7qYTBaE?= =?us-ascii?Q?OGDJwjw+G8DYUL9oKtdHi+3SNGTy9n0lnxtloxEnk3OGG663A4hf49SmiuLp?= =?us-ascii?Q?T1MvXuNMqJiG6I/EYZN6FkEDmQXcmEQrXc0qmAXzUDNhHebKDgCblFVrsPpf?= =?us-ascii?Q?JnY1uCqXFO7jUgXxIDvKsL4DmBeimHsRT8tvB6fbsLMR1wyJw5I8vTQWmpDy?= =?us-ascii?Q?J1o9I95XKavvJwMvAvQ3Qe1OAaSa7h/jqt3vaocd4gzGHgPszlmZtqcy81l+?= =?us-ascii?Q?SQueW/zMla22Cr4kIGljoeYFHwe2Ak37HSzGTAhcRVd0pw+9Ci/ij4R62Pqw?= =?us-ascii?Q?/8yWnA/OqUi5PakQ4vor/5hsTAooHXWnmxgHsfXfXAsWgE6cM+KNjXSp5AuM?= =?us-ascii?Q?ebK63NRPjZ3DStPe4Y4x+wdja+U0auE4+eqxAeR9CBCAMr3AyRexyO4g3buw?= =?us-ascii?Q?YwWWi2eQLn5xptZpof+lPZzWRZVlJYbzqY/aeYHCjWLOMOK+HRyqLPE7Whtw?= =?us-ascii?Q?yB5KEh0Pds6REdp8MFXcesyiL59Lqxt5dUdVu8mYY1v875tQMV7ew1ByR1AJ?= =?us-ascii?Q?phsSTB15twSW4SlLLoZZxZnv20tuu8JoEfxd60Iplep1BsKQeFUYR0a3oJ+G?= =?us-ascii?Q?lhWeJhN3/nBrejP2UHcPZLUcEyqckOY9pCSXjuNrNcAlsMEkQBhn4Y4RFycY?= =?us-ascii?Q?5varc6IrJB2FxHmP0Zj5pL18v+0wjCpF/Y9kN+h9i7E0ACMw0JQIkBT/nVPP?= =?us-ascii?Q?vqIuFuIzTznsbZq1FwS8AqVQcW6V0ChB7Y0/ElX4xLQsaU9xwJf57G5dasUh?= =?us-ascii?Q?R59LWyjpmUusA8QUeQsl+iZqbv4QVw05ECwUWjmNtmg0fvO2mEICoGC/rgSY?= =?us-ascii?Q?R+3Sf+vxw2/nftEYHrmmhJgZuog/2l7XuH4zS8T7fJm1sYS200KNeHHkNoDr?= =?us-ascii?Q?E2ILrlPm0qqyBOBN2nY+RbgJjcIiC+ZKFGVcFG440f3mGncUSfWiqBfLmAK6?= =?us-ascii?Q?gaHJAwuweni8I3P+bcH4yEydjG55PFsUJjXC1xFmbyyR8zJXgSRLUk4T1l3o?= =?us-ascii?Q?UWiulwkLMH1IYzfYs0JXM6R4fu47RZYR3EM0NEZSemZtlVGJUyXvNiEr5sGX?= =?us-ascii?Q?hENJjQI3o5DIJHE2COk4qaIDl83ElQt4L9cAjPZFDjLlXYAw9uKkbkx7dbC8?= =?us-ascii?Q?zskDUO1OE1QgdYh6nuCAjMxJEdzNkVcEc7sqZKqQsEwsceHK4KYS0y0a5LQn?= =?us-ascii?Q?Vy5S0JkzH01zW3UNNkuL/TPJ7PV3HAuQUjhj3hYKjGCCYGzh8HRzldVUb4pW?= =?us-ascii?Q?aGoicXkSVjPxWo7XuUv/8HMM7Vnf/GzIed8Woi4xO0VAfqCw4qcgVa0OTPS9?= =?us-ascii?Q?gzH5grRtoETCzvrvbDqIPFavCud8W6U80eEQCeQR9sxSv5FbdEa4I3p0+A4q?= =?us-ascii?Q?8bnzYDgOiHtTYjh1Kksg+h/Wf3NHWmpQGafQWNc5riM3W96/mQ5eKYlpbOOB?= =?us-ascii?Q?QN0T8qUWgo/6LMVkaCC7Rk+XRog/sFYQmYYXm7eYV6GcQHs6fSl8uHJ0y1jv?= =?us-ascii?Q?5e1WEBBJcYaOCWBhEUct4SADBHiJX+hovMaUCggwudtVeFjbewJEPW8HZDxD?= =?us-ascii?Q?gEJCpf2g2882er4n0Yl+zQaNZLtv8Kw=3D?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB5544.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16574236-9486-4819-def3-08da381f8065 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 May 2022 16:08:37.5335 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lNSRWQdwbmI6B7fs9cb/LpduzkQsuafDChzHUL8U5+nfCZjgzaVddEupzpTdXbnw61zUPkdLK5hISDTarHe2sg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB4735 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BY5PR12MB5544BB031F975F0230FD2E5CBACE9BY5PR12MB5544namp_" --_000_BY5PR12MB5544BB031F975F0230FD2E5CBACE9BY5PR12MB5544namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ray, Won't that mean changing UEFI UI and boot maintenance manager applications = as well to make this call? If we do not do that, the applications would not= reflect the sorted boot order automatically. Considering this, the change I have is pretty small and takes care of all s= cenarios. Please let me know what you think. Thanks Ashish ________________________________ From: Ni, Ray Sent: Tuesday, May 17, 2022 8:11 AM To: devel@edk2.groups.io ; Ashish Singhal ; Wang, Jian J ; Gao, Liming ; Gao, Zhichao Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: Configur= able New Boot Options External email: Use caution opening links or attachments Please use the EfiBootManagerSortLoadOptionVariable() to sort the boot opti= ons from PlatformBootManagerLib. > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Ashish Sin= ghal via groups.io > Sent: Tuesday, May 17, 2022 7:02 AM > To: devel@edk2.groups.io; Wang, Jian J ; Gao, Limi= ng ; Gao, Zhichao > ; Ni, Ray > Cc: Ashish Singhal > Subject: [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: Configurab= le New Boot Options > > 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/MdeModule= Pkg/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 =3D 0; Index < BootOptionCount; Index++) { > if (EfiBootManagerFindLoadOption (&BootOptions[Index], NvBootOptions= , NvBootOptionCount) =3D=3D -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.i= nf > 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.de= c > 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 t= o 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|0= x00030009 > + > [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.un= i > 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_PROMP= T #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 > > > >=20 > --_000_BY5PR12MB5544BB031F975F0230FD2E5CBACE9BY5PR12MB5544namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Ray,

Won't that mean changing UEFI UI and boot maintenance manager applications = as well to make this call? If we do not do that, the applications would not= reflect the sorted boot order automatically.

Considering this, the change I have is pretty small and takes care of all s= cenarios. Please let me know what you think.

Thanks
Ashish

From: Ni, Ray <ray.ni@in= tel.com>
Sent: Tuesday, May 17, 2022 8:11 AM
To: devel@edk2.groups.io <devel@edk2.groups.io>; Ashish Singha= l <ashishsingha@nvidia.com>; Wang, Jian J <jian.j.wang@intel.com&g= t;; Gao, Liming <gaoliming@byosoft.com.cn>; Gao, Zhichao <zhichao.= gao@intel.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: C= onfigurable New Boot Options
 
External email: Use caution opening links or attac= hments


Please use the EfiBootManagerSortLoadOptionVariable() to sort the boot opti= ons from PlatformBootManagerLib.


> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of A= shish Singhal via groups.io
> Sent: Tuesday, May 17, 2022 7:02 AM
> To: devel@edk2.groups.io; Wang, Jian J <jian.j.wang@intel.com>; = Gao, Liming <gaoliming@byosoft.com.cn>; Gao, Zhichao
> <zhichao.gao@intel.com>; Ni, Ray <ray.ni@intel.com>
> Cc: Ashish Singhal <ashishsingha@nvidia.com>
> Subject: [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: Configu= rable New Boot Options
>
> Add a new PCD to be able to configure whether newly detected boot opti= ons
> are to be added at the beginning of the current boot options list or a= t
> the end.
>
> Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
> ---
>  MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c  &nbs= p;         | 6 +++++-
>  .../Library/UefiBootManagerLib/UefiBootManagerLib.inf  = ;     | 1 +
>  MdeModulePkg/MdeModulePkg.dec      = ;            &n= bsp;            | 5 = +++++
>  MdeModulePkg/MdeModulePkg.uni      = ;            &n= bsp;            | 4 = ++++
>  4 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeMod= ulePkg/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 =3D 0; Index < BootOptionCount; Index+= +) {
>      if (EfiBootManagerFindLoadOption (&B= ootOptions[Index], NvBootOptions, NvBootOptionCount) =3D=3D -1) {
> -      EfiBootManagerAddLoadOptionVariable (&= amp;BootOptions[Index], (UINTN)-1);
> +      if (PcdGetBool (PcdNewBootOptionAtStar= t)) {
> +        EfiBootManagerAddLoadOptio= nVariable (&BootOptions[Index], 0);
> +      } else {
> +        EfiBootManagerAddLoadOptio= nVariable (&BootOptions[Index], (UINTN)-1);
> +      }
>        //
>        // Try best to add the boot = options so continue upon failure.
>        //
> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLi= b.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.PcdBootManagerMenuFil= e            &n= bsp;        ## CONSUMES
>    gEfiMdeModulePkgTokenSpaceGuid.PcdDriverHealthConfig= ureForm           &n= bsp;   ## SOMETIMES_CONSUMES
>    gEfiMdeModulePkgTokenSpaceGuid.PcdMaxRepairCount&nbs= p;            &= nbsp;            ## = CONSUMES
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdNewBootOptionAtStart &n= bsp;            = ;      ## 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 w= hether 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|B= OOLEAN|0x00030009
> +
>  [PcdsDynamicEx]
>    ## This dynamic PCD enables the default variable set= ting.
>    #  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 #lan= guage en-US "Used with SEV-ES support to identify
> an address range that is not to be encrypted."
>
> +#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNewBootOptionAtStart_PR= OMPT #language en-US "Add new devices in
> boot options at start"
> +
> +#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNewBootOptionAtStart_HE= LP #language en-US "Used by UEFI boot
> manager to decide whether to place newly detcted devices at start of t= he list or end."
> +
>  #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdGhcbSize_PROMPT #l= anguage en-US "Guest-Hypervisor Communication
> Block (GHCB) Pool Base Size"
>
>  #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdGhcbSize_HELP #lan= guage en-US "Used with SEV-ES support to identify the
> size of the address range that is not to be encrypted."
> --
> 2.17.1
>
>
>
>
>

--_000_BY5PR12MB5544BB031F975F0230FD2E5CBACE9BY5PR12MB5544namp_--