From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (NAM02-BN1-obe.outbound.protection.outlook.com [40.107.212.93]) by mx.groups.io with SMTP id smtpd.web11.840.1681791926495364004 for ; Mon, 17 Apr 2023 21:25:26 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="no key for verify" header.i=@amperemail.onmicrosoft.com header.s=selector1-amperemail-onmicrosoft-com header.b=UUhaE7nh; spf=pass (domain: os.amperecomputing.com, ip: 40.107.212.93, mailfrom: tinhnguyen@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zp7v0fqhBkLVIZfMILNpcFkSlfCV/+/BrQNNiu1ZayfZrnmP/z5l2/EltldWVrTcGZOuUA5FT8X+2vYkGx2Y7OwpH70Mu1lhTa9YWmdenlMHHvkHLPKnGAl4NgaolomujivkMbpx7ro3CzNVAps/f7ynP1NnSRCl9FWbxEter4xAE6c20wCa4n0GDePV9MjMLpOtoogIBOxF7sXH/rVznFQ2gcg+XkvTw2YccqiKuGUUJQQTnuqEqH1Ojrb9rXd0MjfKF0SeCIs3FOrS7r/wPbAiM5vzT5DgJTPVde1H4c75GXfJFvWjARg5uqsdqcRchycx47q7ZeEkKJ1bSIdubw== 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=6EGoazJyKErtILuTGxJIy0Ml6e2FriYVNM/7AUXIcdM=; b=KysyUyMv4aUhZ34TEzVeriYmxWsr9M2ICaYjqcXT3yetvCgLQkoL359/fc9nN15pM71/fOwtTY0defvnVrjZPfB3s1snL+wHWUz44LTjX/BxmrKIpi9lmUJ9ejACM5avQd6KRNdlHBtCSlD+2sFJF2P2fu09Dy54m1hhQ1JmXEGYlrEahyTJ68ypEa2Hc0jSTU9H9Iti3SFlz3VervrVwmVlSm7h7e+V7H7GMsahILThuTcxFqeRH5/8frkPbI2aB280ug8n1f/m0H8cx5npQ/o4wtLyaFZKwUBZ8HlWccxI9g1CLkMDpg0JZuROO5gqHEqUo8akZh9fZiFGCQHNRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=amperemail.onmicrosoft.com; dkim=pass header.d=amperemail.onmicrosoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amperemail.onmicrosoft.com; s=selector1-amperemail-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6EGoazJyKErtILuTGxJIy0Ml6e2FriYVNM/7AUXIcdM=; b=UUhaE7nhkiwieg1ssLzZq16OzEohXWW5SN/6r1V2XhykXfTNSzyG/GrkRFmRJvM/tcOJEpE2Y6EjRBzjawp5G+bj6JkqnI88coLK1QjD0FZZuhi0zThENdqwonpEGzdMqkYPexD2RdAbsjO10EHWEvL7gM1XkwkYvKj6dZQv7OQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amperemail.onmicrosoft.com; Received: from MW2PR0102MB3338.prod.exchangelabs.com (2603:10b6:302:5::15) by BN8PR01MB5347.prod.exchangelabs.com (2603:10b6:408:b5::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.20; Tue, 18 Apr 2023 04:25:19 +0000 Received: from MW2PR0102MB3338.prod.exchangelabs.com ([fe80::b769:1a23:e2f7:fecc]) by MW2PR0102MB3338.prod.exchangelabs.com ([fe80::b769:1a23:e2f7:fecc%6]) with mapi id 15.20.6319.019; Tue, 18 Apr 2023 04:25:18 +0000 Message-ID: Date: Tue, 18 Apr 2023 11:25:08 +0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [edk2-devel] [edk2][PATCH v2 1/1] MdeModulePkg: Add EDKII Platform Boot Manager Protocol v2 To: "Ni, Ray" , "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" , "rebecca@bsdio.com" References: <17534AB488BFDAF9.3977@groups.io> From: "Tinh Nguyen" In-Reply-To: X-ClientProxiedBy: SI2PR02CA0014.apcprd02.prod.outlook.com (2603:1096:4:194::19) To MW2PR0102MB3338.prod.exchangelabs.com (2603:10b6:302:5::15) Return-Path: tinhnguyen@os.amperecomputing.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW2PR0102MB3338:EE_|BN8PR01MB5347:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b2eb937-f596-4ee3-f097-08db3fc4ea4e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0F3sD5dhvNb9A/wm4ZFnIsGer65glzDjle8C4v2WdDQQLWk1GJuzFFJyUM7/tsEXVB4/XxfTChRT7UZVwjoK2/TqadxHX7VAE/8K0awTMZSgBeOCTWtNO9LsL0CgA0ybchu/mUkyzujy8Oxx/nAdzf8KG5L1gDSsD4Gn/IKkxzCelEocvBha/sshjdU91vJXfv9Q749hvbpeEpJjpwleerPTMCqI2kwZ+xHSizG6rxdnG1rkHhfqQPxCaCb0UEDjNBVBBaX1MSnnmRi8HRZkKG3Gv4YXXnK8iPO+J27i6bziQAARHgUHmOAEMrantmpTafmj+KTgbNatHbcCinDIuVDd5IXVse2eCQRLDH0mjtlTvp9HMhoEnQ71asjZe4BVTWRyXX/TkV2ZLQUcaT0UafAUYHBt7ML7JtPIP+NcEhcXR4Ekcc8q2t+PTLkkQawAlxLRiod24PvFOC6Aq75Bmn6VxQ3Ifajs6Z2K8VTaDZ2DV9c3ZM1/17/rFVNIUh7JOk3LSSlrj/oSptHh/nDF/zTJ6NrIoKf3LAGYwr55HntmRiJRS+nFNuBV27rqPjVJPxzvw0AYu0qHEd62C1AdXfZGAijnoM/tqdoAz9yVcr0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW2PR0102MB3338.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39850400004)(136003)(366004)(376002)(346002)(396003)(451199021)(2906002)(8676002)(8936002)(41300700001)(66899021)(5660300002)(38100700002)(31696002)(478600001)(31686004)(54906003)(110136005)(2616005)(186003)(6512007)(6506007)(26005)(53546011)(6666004)(966005)(6486002)(66556008)(42882007)(66946007)(66476007)(83170400001)(83380400001)(316002)(4326008)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?It+23pQPuDudrRHYNVQ4HUEey1tfagRVIG5LfzrNhNwFsG0m1k1YjLMs+CHJ?= =?us-ascii?Q?T8JwtzkXa+NGdv2DcO/+9nQ2r7hy6LYZROG6NGOrGN6YokRp7QPRh0nKXsxW?= =?us-ascii?Q?87NIQXheDzxckMwsTw/cQ0B+bQrk9//I0z5SSXsKSTXzErL2PCgjyGPUrcaD?= =?us-ascii?Q?+5mqWjZUlc/bhGEbMpjto9J8ZaSEjo5Fk3es6+VHj2iYufyi/M3namZLKTYh?= =?us-ascii?Q?a3fPFPUz7vFLTwf4QRRMNU7QjTalg3g4941WKthX/CNki/f5fk3+MSVlMciX?= =?us-ascii?Q?+69miPdCbS7xOzOTwIIv/GCtkChQXeU6H/NbQ1PrsE+sa6zQEOCWl4VcmVjt?= =?us-ascii?Q?VEltGeEMIE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mZ8cpWlwF?= =?us-ascii?Q?Ah7l+MZ0PhcwHlPSjGs9qa0N6MHFwFoWPm00x7eOptMHc4HGxaD4Y0/9tgaR?= =?us-ascii?Q?FA5Ym92o4p1MrYJuyMwWMCHrCoGHVy9+lKoPiTjsa8iRaNjrzPQLhaOylfuO?= =?us-ascii?Q?ZAoT5IH1DwbJVOSfJpTeOBHbVGHSqcTULhAnWikpQcXh1lJsuZw7YtqekFEh?= =?us-ascii?Q?aJNmqmUQD2DzOjnSUmC5uQmJGx5mzW1zhCZv0FhgghKrUS8AUQIYZSXWcVWp?= =?us-ascii?Q?QYDVdYGD13/dwNJeXXJazZZvxnyxnEyPyVFeEwQi2g9AH2aHf69tYx/UZx5W?= =?us-ascii?Q?GdnV0wQp7RgDP3mLZtt4F2+2pfleYwdsQfbjUvAaNgt+PR6hxLVOFfj+/3pM?= =?us-ascii?Q?m4UQkqnKa7EPP6AR+2+5GOY=3D?= X-OriginatorOrg: amperemail.onmicrosoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b2eb937-f596-4ee3-f097-08db3fc4ea4e X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3338.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2023 04:25:18.4031 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uw1r9Mjx4GTUIZ1JCuDpbLAWdv3tU/bsfneBqBAUvVMQEBuz1JC1hcN9pgxQng1iRvrmkWrBV56KLYnG+dJ9VZSysIrxrpN9NLNVdE8geYvoWKKt9Mg1R0zShHmjQ1xM X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR01MB5347 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi Ray, Many thanks for your feedback. Yes, but it is just for Boot Options that are automatically created by=20 BDS. If users/OS input 2, 3, 4 =E2=80=A6 boot options without option data= =20 (mBmAutoCreateBootOptionGuid), the RefreshAllBootOptions() API should=20 not modify/delete them, right? Users will be confused when their Boot=20 Options change. And I also cannot sort them. And the RefreshAllBootOptions() API just provides a Boot Options List;=20 it doesn=E2=80=99t directly write those to NVRAM. BDS has its rules and the= n=20 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=20 have. This is a suitable time to sort the Boot Options and write this=20 sorting to the BootOrder. Another aspect is that trying to put everything into the=20 RefreshAllBootOptions() API makes this function very complex and hard to=20 maintain. Please, let me know your idea. Thanks -Tinh On 4/18/2023 8:24 AM, Ni, Ray wrote: > RefreshAllBootOptions() API internally can keep an ordering rule so that = platform-level-higher-priority boot options are before > those platform-level-lower-priority options. > > So, that means, you could only change RefreshAllOptions() implementation = 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. Could = 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 n= ot 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 Manage= r >> protocol. >>> + >>> + @retval EFI_SUCCESS Platform successfully modifies >>> + the DriverOrder/BootOrder variables as wanted. >>> + @retval Others There are some errors that happen. Check the st= atus >> 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 >>