From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.60]) by mx.groups.io with SMTP id smtpd.web09.19913.1653572250529477188 for ; Thu, 26 May 2022 06:37:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=TDJSdFdR; 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.92.60, mailfrom: ashishsingha@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HMJEuj6bQjCe7a0CAj7vpqjmKNmBOzIcBmxSruaT0I/MJyg+Ew8Q7nvmlHOFJmyeI5/ZB0Ei3JwImSDvdRSErxUHO/Cq/swRDS7j1UA6+YLdlHgBfu8BR/A0Xip9iab7nBeN0Kwrrscd4gJgd/LaWgX9fPp4/XXFaS7qgA/Ekb+9psxzKdfR7L1Jspyi7foSPu4/H36WK3Zj/c3UrYw9XZTQzyGgo2VDC7omYZyn1vTwAOiViAvOAkqQV6PXtfiXjMLuVCQb4ReEHmMcRVx+5/Q+uL6W2zvcxeSDr/BC0i3AxKoChxzlCVQdIebecFTu52G8w6IxZXcKvzULzADfzA== 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=XJsiPl7NADPv3KKhtU7cwldW4u9tVB78/JKMt7H9NYo=; b=gRX/3Wv/R/OGbD2OB6RJEhTYyrFvuHfgUcJYrDLQ4fM8tzjP7sPnZS1AK24cMeDEJ5Bea9YvvJnosJxgWBdJ1dJshSNdBbUs8H+dzde/87h2HSbXEpNECUUtWPAYRW3Eq35D8MtbDfbgwqNOYBOZrid+o71rSDjI031wZEuFBy0nd+BQIcHrMS5hpB7GG0XK1G8Vty/BjeGPDJ+GPild8297pxPvobqmOg0ixLRimQwhu3SkkyEQXvE2IMKaYRcQ51xw2jh3/ANkHI17/fhaxbELBXdxTvx9QaBi6aCtFuLWjLpseYRau9okNpxWrZkebmtlJNXP/DbwWW8eqZSqbQ== 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=XJsiPl7NADPv3KKhtU7cwldW4u9tVB78/JKMt7H9NYo=; b=TDJSdFdRTC34Ri0Yc69Oqgtr5ZUPgmdk7kDGzRxD/Q9EFSxz2PsxEtMgtx+QU9n+PMwzLcM38I00uxWMJBkA1ZQgmLs/R57ttYognDEnQwfJaaNXaLwebEJfF+BQSkH35XqMa9/kPqs+zJxQUEbDX/1GE3plMQV+T5ntcjmcoSZ2E4jKmBs8wepGLDrffkWcj/QNoD60OLB5e1cU2xkMVBsnM+ofXIuqsx9CtytWBziUwu3jqJ17ur+kyhSeSnGq/7QSzffHDonlZTicaUFUkh84KJFuTV2IRflaYiD1SnJUkVfYJPIV0ZU57i6Bu1HhDIWZA8uEeu1C+6gIjqZO3g== Received: from BY5PR12MB5544.namprd12.prod.outlook.com (2603:10b6:a03:1d9::22) by BN6PR12MB1425.namprd12.prod.outlook.com (2603:10b6:404:1f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.19; Thu, 26 May 2022 13:37:28 +0000 Received: from BY5PR12MB5544.namprd12.prod.outlook.com ([fe80::922:fa59:c7e3:128c]) by BY5PR12MB5544.namprd12.prod.outlook.com ([fe80::922:fa59:c7e3:128c%6]) with mapi id 15.20.5293.013; Thu, 26 May 2022 13:37:28 +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: AQHYafgPpePrY4hUf0iD9fuE2dd8wa0jPGbtgA305oCAAABDIYAAA7OAgAABlU4= Date: Thu, 26 May 2022 13:37:27 +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: bb287e37-493c-4564-aad4-08da3f1ce040 x-ms-traffictypediagnostic: BN6PR12MB1425: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: Ha95Qv1UgYicBkT7w+OHDA6mYibsjAJd9HAlj+SwZOG+d01eLV7I5dQ7EV2YxCdQyEyChJQfqwhRKyM8A7v7BUTrXQb9LG8yP2YBSFYsicCv3/iV3GlbX9YXFKn6Fb0RtdlEM8helynLpAaXgyNccYwiwVG8lQ78iptBV5cBCtgtH0Qy7zHfzzvRwC5Vdp1v2Tu3Y2N2WS+YTa5SzY23TVx06vXgO/meZTqQriTVzUJUM8lxtVzIzkmUq1BmSxYcryBKCcv5wra4pdk2RykSQ9zAM2yZR6qIYuOESl0tGpSvFwkmkpAXby36qQASLcQiy12bggFFleA7MnSvsmTTgBh+xck8GlyGZxC9zkBoX1As9H5BTemYLQssvPTWw224Nki0mUGInlSofyEEuFxInvQbjt3qcQ1u1ehlXOnVhESQ3+r9Trr4JPUm6NUK2UG39QbO+ec5GmqqYNykEJ+IUryR6y9lDzFeFICLNZ1yC+gh2djh4E3oFIogcc7gxLxsEoeLfLw2vZE2iPtnigchPN1Zw41GAJkWF5U7GTyV5yWbyj+5l2kFpcwrU7eRl3Lzzd4JGkAd0w/+vK+UabmIl/wbx9O0CNy0FlmfP8Nt7IAWP9lIyJHAeSiiVZ1BlcyuxpcKwrMVqZ4i/7hV5PaZvI4KW2YTmYcPhzVDb71YU6RQ9ZHruCoX5rBcWbXAcf67mRWUY3JMG7c+AmhvAgxS3HRpVILZpmYwnO29m/5WrCldcfRgzk9VjNiZAFbkcKGxxJqcqTigywBEEmWc7l1XZWtKnWTfCpE/SVvQDw0DVSQ= 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)(19627405001)(91956017)(19627235002)(83380400001)(9686003)(166002)(86362001)(71200400001)(26005)(186003)(110136005)(508600001)(316002)(76116006)(66476007)(64756008)(38070700005)(66556008)(38100700002)(966005)(8936002)(53546011)(66946007)(8676002)(7696005)(2906002)(6506007)(5660300002)(55016003)(33656002)(122000001)(52536014)(66446008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?he2nQittAo4RDSOwJ+EkPbejgDnd36kp9S/RGUrZQpRDifTdBZIKxr81?= =?Windows-1252?Q?bLCuaF8NPKIHwUH3K2ORfx/qE0sOsBnWnHN0r4Q2km8JNj1+KZCmAqdv?= =?Windows-1252?Q?pJbTgJMBKTvWBLrSUyLGGYPBER4y56PqFpwpnjuvVQwAz33/LPjRDNpy?= =?Windows-1252?Q?0lk9jzue6iKaBeWxFmC1sZtB0uDGfSyaBM+U5ClRIC6dxF9w6LfclI/l?= =?Windows-1252?Q?wDAtpqcm/bFmtdUmrxTTc0aA9DklXiaQ3ECJ9MZAXFLH3EuuUvv1u3Dj?= =?Windows-1252?Q?XMOXpzXxYkFsTdRqZsvZxCA7JpJ+lPwro6Ga39dNmnDcvWFUaDP1L754?= =?Windows-1252?Q?vIypgk0Ua/4NzlCSTxq6El0BQdnmG2N7kcTAhmbptN1nOtZr6fjM5xaa?= =?Windows-1252?Q?/dOrWC5W1BBnoiBl5bxQickKgPaE9u6DukRkkZqa76ofUKoExD02BKNH?= =?Windows-1252?Q?Ot7IDSZIBOmluND60o/PteLBmeXgyZ+5TnfEIbUZ1lCTxfcUoENcAp2n?= =?Windows-1252?Q?sAgp2yWSL/ClGXu5SrjPc1yY9n2IWfB6tBfEfCfuTUc4i7CkAshLQhz3?= =?Windows-1252?Q?g6uVOijnHj0YGeuSmsJSI6/18mo7+ZzHmdc/Fysr7ULkksQjUCVc3isW?= =?Windows-1252?Q?NoJW8KkjJHRIV+A1NjKsPSEnFtEPXODI8r+/9GNIOxkQQvKI+Bgzdo0c?= =?Windows-1252?Q?c1nK/6oOXtGO46ci7YX/QZ79hbEeilSg3KY0LLImqgRtefc70lOwKvVn?= =?Windows-1252?Q?VCR9fCOQAB5pKaJ/XkrvSIZDsYiuQ2dN9+gI/RpGy7/vjCdCn/ev57Ni?= =?Windows-1252?Q?5IXfWdoMxBZOwlgoo8FqDJ5h/whG+2xmkAQnQA97ZJHz5gedS0kbhr7Y?= =?Windows-1252?Q?7Y721xCG+Mu77g88qxMcAid6D6NNwF3OT5gqOEu46Yk5lNETXz+oR2yi?= =?Windows-1252?Q?bd8AiDIuC0Y6ZyvcKgJpWcJVieoSGczR9e1+Mf6vYOEsObFlVnDmZ8gb?= =?Windows-1252?Q?cqhnKpTsK6FMDLkP9b3yeuNk6AKxC0zPqq8yXU94/I1+VoOpF60z2bo2?= =?Windows-1252?Q?g9bJu4h4xPa/Mvp/5PlopZhoX/hO8zyK8blyaWQzVPJ/4BooZhfBkvuP?= =?Windows-1252?Q?w881ClO3AtWcBnhqcr9QvMrU2apor69cb+BTvYQzU1Il7RqLKynCJ77S?= =?Windows-1252?Q?mL3oEVxHZzI2JTAfqawwvtkAO7VxpN+ePKaNfiKWTZ3LP2oTkD3Thn4g?= =?Windows-1252?Q?oxilOeJtgb0P2JAEAx4DFuo1Xu1fgPbayzNeYaCDCt5ZOBcu0BVutTZS?= =?Windows-1252?Q?l2Q2BxctQHFw2/fLH3wa50rrnyfbf8S3BPGECcw15XPgrA3pEW2Y3nhd?= =?Windows-1252?Q?+d7QGW1AhkokSNjY8/l9WDVjTeYSxBknEm+AslrDmXNYUP7VC//UJxT4?= =?Windows-1252?Q?WPFFc3z3LK9vCpYcbOtt31OWANZProG473r9P9W+GHGdOZQjxMGSeB5w?= =?Windows-1252?Q?ZSqbxZwS2Toc2ad9odIHi0D8rwxa8Gr9ZA7/f61x2QiwGdzgy6j4q1uD?= =?Windows-1252?Q?25zxGhaN3bkTk+fRC7LqSIXbOZph6UopUnAD2k3bC0kJrvPkDKYK9wX7?= =?Windows-1252?Q?5Ryvf8WDNfx2Ruy9RfK1s9+lubKtJrhbnMPpAIJ59EZS1tL/UX5uaD7y?= =?Windows-1252?Q?uLoZoeZoR5pVy7oWDTrwqGpiYBhTcV77Y+a0K5B+Aam+L29Gosp73TB0?= =?Windows-1252?Q?hj+0FU5FPX9Ur3SoXKuvdV0QetuUtyUTgpUgH+g+GV4RHITUzEklWSNu?= =?Windows-1252?Q?dKux9cpy8tGpUHTg8vr7cm22Mjt70d2uvFOGow4uVUbenvWrVsMla8BO?= =?Windows-1252?Q?EptslkY/m5Z8SbzXlrAm3ocGEZDmmD7LnMY=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: bb287e37-493c-4564-aad4-08da3f1ce040 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 May 2022 13:37:27.9690 (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: nqV3P5Nwv2rN5aH1b7eFCgYNyELtQufTjkTeSprZCsfFX+wFmDpTkc+1lY0AtP0vf/Xpl9Ehlvy/hTDt6s0TIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1425 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BY5PR12MB5544DA734458F9BF5D2A63CEBAD99BY5PR12MB5544namp_" --_000_BY5PR12MB5544DA734458F9BF5D2A63CEBAD99BY5PR12MB5544namp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable That will not work either in all scenarios as the sort function will need t= o be a part of the caller. If the caller is an entity in edk2, then having = a custom sort function cannot be achieved without a NULL library also being= added to edk2 that can be custom implemented by the user. Thanks Ashish ________________________________ From: Ni, Ray Sent: Thursday, May 26, 2022 7:29 AM To: Ashish Singhal ; devel@edk2.groups.io ; 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 Yes. UefiBootManagerLib is a fundamental BDS library. Please change the cal= ler. From: Ashish Singhal Sent: Thursday, May 26, 2022 9:17 PM To: Ni, Ray ; devel@edk2.groups.io; Wang, Jian J ; Gao, Liming ; Gao, Zhichao Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: Configur= able New Boot Options I understand that. What do you suggest then? Using EfiBootManagerSortLoadOp= tionVariable() is an option only if we update all code paths where we refre= sh the boot options. ________________________________ From: Ni, Ray > Sent: Thursday, May 26, 2022 7:15 AM To: Ashish Singhal = >; devel@edk2.groups.io >; 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 1. I don=92t like PCD. It=92s like a out-of-band control of library API. 2. The PCD doesn=92t take care of all scenarios. Someone may like to put= new options just before the last one. From: Ashish Singhal > Sent: Wednesday, May 18, 2022 12:09 AM To: Ni, Ray >; devel@edk2.groups.= io; Wang, Jian J >; Gao, Liming >; Gao, Zhichao > Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: Configur= able New Boot Options 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 Singhal via groups.i= o > Sent: Tuesday, May 17, 2022 7:02 AM > To: devel@edk2.groups.io; Wang, Jian J >; Gao, Liming >; 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_BY5PR12MB5544DA734458F9BF5D2A63CEBAD99BY5PR12MB5544namp_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable
That will not work either in all scenarios as the sort function will need t= o be a part of the caller. If the caller is an entity in edk2, then having = a custom sort function cannot be achieved without a NULL library also being= added to edk2 that can be custom implemented by the user.

Thanks
Ashish

From: Ni, Ray <ray.ni@in= tel.com>
Sent: Thursday, May 26, 2022 7:29 AM
To: Ashish Singhal <ashishsingha@nvidia.com>; devel@edk2.group= s.io <devel@edk2.groups.io>; 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: Us= e caution opening links or attachments

Yes. UefiBootManagerLib is a fundamental BDS libra= ry. Please change the caller.

 

From: Ashish Singhal <ashishsingha@nvidi= a.com>
Sent: Thursday, May 26, 2022 9:17 PM
To: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; Wang, Ji= an J <jian.j.wang@intel.com>; Gao, Liming <gaoliming@byosoft.com.c= n>; Gao, Zhichao <zhichao.gao@intel.com>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: C= onfigurable New Boot Options

 

I un= derstand that. What do you suggest then? Using EfiBootManagerSortLoadO= ptionVariable() is an option only if we update all code paths where we refr= esh the boot options.


From: Ni, Ray <r= ay.ni@intel.com>
Sent: Thursday, May 26, 2022 7:15 AM
To: Ashish Singhal <as= hishsingha@nvidia.com>; devel@edk2.groups.io <devel@edk2.groups.io>; Wang, Jian = J <jian.j.wang@intel.com>= ;; Gao, Liming <gaoliming@by= osoft.com.cn>; Gao, Zhichao <zhichao.gao@inte= l.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: C= onfigurable New Boot Options

 

External email: Use caution openi= ng links or attachments

 

  1. I don=92t like = PCD. It=92s like a out-of-band control of library API.
  2. The PCD doesn=92t take care of = all scenarios. Someone may like to put new options just before the last one= .

 

From: Ashish Singhal <ashishsingha@nvidia.com>
Sent: Wednesday, May 18, 2022 12:09 AM
To: Ni, Ray <ray.ni@intel.com= >; devel@edk2.groups.io; Wang, Jian J <jian.j.wang@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Gao, Zhichao <= ;zhichao.gao@intel.com>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: C= onfigurable New Boot Options

 

Ray= ,

&nb= sp;

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 re= flect the sorted boot order automatically.

&nb= sp;

Con= sidering this, the change I have is pretty small and takes care of all scen= arios. Please let me know what you think.

&nb= sp;

Tha= nks

Ash= ish


From: Ni, Ray <= ray.ni@intel.com>
Sent: Tuesday, May 17, 2022 8:11 AM
To: devel@edk2.groups.io= <devel@edk2.groups.io>; = Ashish Singhal <ashishsingha@= nvidia.com>; Wang, Jian J <jian.j.wang@intel.com>; Gao, Liming <gaoliming@byos= oft.com.cn>; Gao, Zhichao <zhichao.gao@intel.com>
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: C= onfigurable New Boot Options

 

External email: Us= e caution opening links or attachments


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


> -----Original Message-----
> From: devel@edk2.groups.io= <devel@edk2.groups.io> O= n Behalf Of Ashish 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 <g= aoliming@byosoft.com.cn>; Gao, Zhichao
> <zhichao.gao@intel.com= >; Ni, Ray <ray.ni@intel.com&= gt;
> Cc: Ashish Singhal <ashi= shsingha@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_BY5PR12MB5544DA734458F9BF5D2A63CEBAD99BY5PR12MB5544namp_--