From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zrleap.intel-email.com (zrleap.intel-email.com [114.80.218.36]) by mx.groups.io with SMTP id smtpd.web10.29560.1681874780297531284 for ; Tue, 18 Apr 2023 20:26:20 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@byosoft.com.cn header.s=cloud-union header.b=RSamK5lD; spf=pass (domain: byosoft.com.cn, ip: 114.80.218.36, mailfrom: gaoliming@byosoft.com.cn) Received: from zrleap.intel-email.com (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id 44C4DA32E0F1 for ; Wed, 19 Apr 2023 11:26:13 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=byosoft.com.cn; s=cloud-union; t=1681874773; bh=yRENNy3VxpcXMLyiPBHeB2ndHqh66t9zEs4660Ml7v8=; h=From:To:Cc:References:In-Reply-To:Subject:Date; b=RSamK5lDbOJ4nPqE7N/O6/MwDXId0hXlhB9k0sgxeEFU/+/aipypJlRXeiSMIyQKK n3RngHeRJu1Vm0zINaXE6WWSKBr/Uup1kHcc8Hg1o3+cOJp6SiIn9+akYxymmVtGth w8zu3se+5I3XPvpz2czCGKxVhu+3oa3GJr0MnRBs= Received: from localhost (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id 2799CA32E177 for ; Wed, 19 Apr 2023 11:26:13 +0800 (CST) Received: from zrleap.intel-email.com (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id B467BA32E0D9 for ; Wed, 19 Apr 2023 11:26:12 +0800 (CST) Authentication-Results: zrleap.intel-email.com; none Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by zrleap.intel-email.com (Postfix) with SMTP id 22133A32E19B for ; Wed, 19 Apr 2023 11:26:09 +0800 (CST) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Wed, 19 Apr 2023 11:25:46 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , "'Ni, Ray'" Cc: , , , , "'Wang, Jian J'" , "'Gao, Zhichao'" , References: <17534AB488BFDAF9.3977@groups.io> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbICoqIFNQQU1NQUlMICoqIF1SZTogW2VkazItZGV2ZWxdIFtlZGsyXVtQQVRDSCB2MiAxLzFdIE1kZU1vZHVsZVBrZzogQWRkIEVES0lJIFBsYXRmb3JtIEJvb3QgTWFuYWdlciBQcm90b2NvbCB2Mg==?= Date: Wed, 19 Apr 2023 11:25:48 +0800 Message-ID: <016701d9726e$a2bd8a40$e8389ec0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQDvE1VtCr7zcal5r21vIwIwFJXkBAIpvTJUAuUJDV0Bzb1FzbDP0J9A Sender: "gaoliming" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Tinh: By design, EfiBootManagerRefreshAllBootOption() is used to find the availa= ble boot options; EfiBootManagerSortLoadOptionVariable() is used to sort th= e boot option order. They are both called in PlatformBootManagerLib. So, I = think you should handle this issue in PlatformBootManagerLib.=20 Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io = =E4=BB=A3=E8=A1=A8 Tinh Nguyen > via groups.io > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2023=E5=B9=B44=E6=9C=8818=E6=97=A5 = 12:25 > =E6=94=B6=E4=BB=B6=E4=BA=BA: Ni, Ray ; devel@edk2.group= s.io; > tinhnguyen@os.amperecomputing.com > =E6=8A=84=E9=80=81: patches@amperecomputing.com; nhi@os.amperecomputing.c= om; > chuong@os.amperecomputing.com; minhnguyen@os.amperecomputing.com; > Wang, Jian J ; Gao, Liming > ; Gao, Zhichao ; > rebecca@bsdio.com > =E4=B8=BB=E9=A2=98: [ ** SPAMMAIL ** ]Re: [edk2-devel] [edk2][PATCH v2 1/= 1] > MdeModulePkg: Add EDKII Platform Boot Manager Protocol v2 >=20 > Hi Ray, >=20 > Many thanks for your feedback. >=20 > Yes, but it is just for Boot Options that are automatically created by > BDS. If users/OS input 2, 3, 4 =E2=80=A6 boot options without option data > (mBmAutoCreateBootOptionGuid), the RefreshAllBootOptions() API should > not modify/delete them, right? Users will be confused when their Boot > Options change. And I also cannot sort them. >=20 > And the RefreshAllBootOptions() API just provides a Boot Options List; > it doesn=E2=80=99t directly write those to NVRAM. BDS has its rules and t= hen > selects a Boot option from that list to write into NVRAM. > After BDS has done its work, we can confirm what exact boot options we > have. This is a suitable time to sort the Boot Options and write this > sorting to the BootOrder. >=20 > Another aspect is that trying to put everything into the > RefreshAllBootOptions() API makes this function very complex and hard to > maintain. >=20 > Please, let me know your idea. >=20 > Thanks >=20 > -Tinh >=20 >=20 > On 4/18/2023 8:24 AM, Ni, Ray wrote: > > RefreshAllBootOptions() API internally can keep an ordering rule so tha= t > platform-level-higher-priority boot options are before > > those platform-level-lower-priority options. > > > > So, that means, you could only change RefreshAllOptions() implementatio= n > to control the order without adding a new API. > > > > Thanks, > > ray > > > >> -----Original Message----- > >> From: devel@edk2.groups.io On Behalf Of Tinh > >> Nguyen via groups.io > >> Sent: Tuesday, April 11, 2023 1:35 AM > >> To: devel@edk2.groups.io; tinhnguyen@os.amperecomputing.com > >> Cc: patches@amperecomputing.com; nhi@os.amperecomputing.com; > >> chuong@os.amperecomputing.com; > >> minhnguyen@os.amperecomputing.com; Wang, Jian J > >> ; Gao, Liming ; Gao, > >> Zhichao ; Ni, Ray ; > >> rebecca@bsdio.com > >> Subject: Re: [edk2-devel] [edk2][PATCH v2 1/1] MdeModulePkg: Add EDKII > >> Platform Boot Manager Protocol v2 > >> > >> Gentle ping, I=E2=80=99m looking for some feedback on this patch. Coul= d someone > >> please help me to review it? > >> > >> On 4/6/2023 3:19 PM, Tinh Nguyen via groups.io wrote: > >>> This introduces the > >> EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION2, > >>> which adds a new UpdateBootOrder() function to support customizing > >>> the boot options order according to the platform-specific policy. > >>> > >>> Signed-off-by: Tinh Nguyen > >>> --- > >>> > >>> Changes since v1: Correct the format of the email. > >>> > >>> MdeModulePkg/Include/Protocol/PlatformBootManager.h | 24 > >> +++++++++++++++++++- > >>> MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 > ++++++++ > >>> 2 files changed, 32 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/MdeModulePkg/Include/Protocol/PlatformBootManager.h > >> b/MdeModulePkg/Include/Protocol/PlatformBootManager.h > >>> index e527b0ee0eaf..758bc2deb774 100644 > >>> --- a/MdeModulePkg/Include/Protocol/PlatformBootManager.h > >>> +++ b/MdeModulePkg/Include/Protocol/PlatformBootManager.h > >>> @@ -1,6 +1,7 @@ > >>> /** @file > >>> > >>> Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. > >>> + Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
> >>> > >>> SPDX-License-Identifier: BSD-2-Clause-Patent > >>> > >>> @@ -29,7 +30,8 @@ typedef struct > >> _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL > >> EDKII_PLATFORM_BOOT_MANAGER > >>> // All future revisions must be backwards compatible. > >>> // If a future version is not back wards compatible it is > not the same > >> GUID. > >>> // > >>> -#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION > >> 0x00000001 > >>> +#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION > >> 0x00000001 > >>> +#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION2 > >> 0x00000002 > >>> // > >>> // Function Prototypes > >>> @@ -72,9 +74,29 @@ EFI_STATUS > >>> OUT UINTN > *UpdatedBootOptionsCount > >>> ); > >>> > >>> +/** > >>> + This function allows platform to update the DriverOrder/BootOrder > >> variables. > >>> + And it is available from version 2 of the EDKII Platform Boot Mana= ger > >> protocol. > >>> + > >>> + @retval EFI_SUCCESS Platform successfully modifies > >>> + the DriverOrder/BootOrder variables as > wanted. > >>> + @retval Others There are some errors that happen. Check > the status > >> code > >>> + for details. > >>> + > >>> +**/ > >>> +typedef > >>> +EFI_STATUS > >>> +(EFIAPI *PLATFORM_BOOT_MANAGER_UPDATE_BOOT_ORDER)( > >>> + IN VOID > >>> + ); > >>> + > >>> struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL { > >>> UINT64 > Revision; > >>> PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS > >> RefreshAllBootOptions; > >>> + // > >>> + // EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION2 > >>> + // > >>> + PLATFORM_BOOT_MANAGER_UPDATE_BOOT_ORDER > >> UpdateBootOrder; > >>> }; > >>> > >>> extern EFI_GUID gEdkiiPlatformBootManagerProtocolGuid; > >>> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > >> b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > >>> index bde22fa6590e..67d1d54b3c24 100644 > >>> --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > >>> +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > >>> @@ -4,6 +4,7 @@ > >>> Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. > >>> Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.=
> >>> (C) Copyright 2015-2021 Hewlett Packard Enterprise Development > LP
> >>> +Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
> >>> SPDX-License-Identifier: BSD-2-Clause-Patent > >>> > >>> **/ > >>> @@ -2412,6 +2413,8 @@ EfiBootManagerRefreshAllBootOption ( > >>> BootOptions =3D UpdatedBootOptions; > >>> BootOptionCount =3D UpdatedBootOptionCount; > >>> } > >>> + } else { > >>> + PlatformBootManager =3D NULL; > >>> } > >>> > >>> NvBootOptions =3D EfiBootManagerGetLoadOptions > >> (&NvBootOptionCount, LoadOptionTypeBoot); > >>> @@ -2453,6 +2456,12 @@ EfiBootManagerRefreshAllBootOption ( > >>> > >>> EfiBootManagerFreeLoadOptions (BootOptions, > BootOptionCount); > >>> EfiBootManagerFreeLoadOptions (NvBootOptions, > NvBootOptionCount); > >>> + > >>> + if ((PlatformBootManager !=3D NULL) && > >>> + (PlatformBootManager->Revision >=3D > >> EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION2)) > >>> + { > >>> + PlatformBootManager->UpdateBootOrder (); > >>> + } > >>> } > >>> > >>> /** > >>> -- > >>> 2.40.0 > >>> > >>> > >>> > >>> > >>> > >> > >> > >> >=20 >=20 >=20 >=20