From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web08.5818.1617305303575498762 for ; Thu, 01 Apr 2021 12:28:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=JhJ0bOt7; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: nathaniel.l.desimone@intel.com) IronPort-SDR: 54mA5Vvz30Nzt1Imf8N68IQViDydPuTj5jRl94d2/aJMLo1AKfjF6VP0XexPB49D992D14VjgS rVeEgbsc6cPg== X-IronPort-AV: E=McAfee;i="6000,8403,9941"; a="172348913" X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="172348913" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2021 12:28:23 -0700 IronPort-SDR: w475A7LvNMxB+OJu6TdI4PdbwpFs3QWro6rTjwzPwpJZjA/3aVfW2dlR8xd6NoZPRjx47JYxad gdh8GIgGWoZg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="439334646" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga004.fm.intel.com with ESMTP; 01 Apr 2021 12:28:23 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 1 Apr 2021 12:28:22 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Thu, 1 Apr 2021 12:28:22 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.102) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Thu, 1 Apr 2021 12:28:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eJ1AE6dNM2h6z5PjcAtC8JgVjpwLeSz114wQ8eUMAnx6QJu83Olb6TGi6BXtKbP0xjijHXyginXSx/ufW76GkaVkqYNGVw/EFeGApyH/ZJtKSyeCTf9UeoQ26j2xrdljebVNcDOOZfv0iKX0QeOj6PViBZ1zr8rvVaUjOimiTzjH1dzq0fLXd3Ob3DddOxxS9PkK4vNRZCDBg5TxEDdcGEWNKmKk62R46KxmllRW88s6Izti7c2pA1zPi1v8jMQKR/MsS/o2b+3gGaAyvTmVivanLy/0/BJD3IHILKafv1Gg+E+/DE3MK3fGy5aTWy6VU6I1rbcNpnJAAE53AidQJw== 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-SenderADCheck; bh=vzPTdrOSFENJSmpCIvbFr4lQ6xgRgga5SfLemo5ECmo=; b=Ir5WR9kdNJGAXxTxyhIa0W1RJzLUC86RwXVNy0oodKsQS6UJKgjJJ5iVR8QtTJ9FqKK4YtlkXzBNocCIokbhT9dEMW7f0UyYcVdevM486bJ3+XUzdiWfWYkR7TufbLg54D5NiJyUpSELnU3Aqq3083HKPvWusGa67yYM9HjjdqujrLupn6/5JUlowYbEPxPM9cyMBrZmBST7pJ52LNwv7Pihi5y5IvjrDiNcYL5ECuCNG5pUYvxfXmY1FzCdW6NIYRqnpPGHMcZljqbFIqoScsciwvEk8U7L/0684YzFrQsWJRiOYXC43GTeEccoa8k/SNK/y+WYRl1mzEJBBN9V4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vzPTdrOSFENJSmpCIvbFr4lQ6xgRgga5SfLemo5ECmo=; b=JhJ0bOt7+m5fTWDPESgTN1OZZxJcfXoZ8xk2yRXVz9KW74Dlerp1nXrG5nXNbkBeVIKwjpl+RQZGqWSvGyfFrTnJdcf/5py+zj4GfRz/caH8T6xcO6ygn0Dhvt/drAoIh41dMjtmnqs5AasQcOQaP48lQCaTDHjU9q01nuhSmdY= Received: from MWHPR1101MB2160.namprd11.prod.outlook.com (2603:10b6:301:5b::12) by MW3PR11MB4667.namprd11.prod.outlook.com (2603:10b6:303:53::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Thu, 1 Apr 2021 19:28:21 +0000 Received: from MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::6540:bca7:645a:6788]) by MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::6540:bca7:645a:6788%5]) with mapi id 15.20.3999.029; Thu, 1 Apr 2021 19:28:21 +0000 From: "Nate DeSimone" To: Ling Jia , "devel@edk2.groups.io" CC: Leif Lindholm , Peng Xie , Yiqi Shu , "Liu, Zhiguang" , "Dong, Eric" , Liming Gao , "Agyeman, Prince" , "Ni, Ray" , "Gao, Zhichao" Subject: Re: [PATCH v3 15/46] Intel/BoardModulePkg: sort load option in the first boot Thread-Topic: [PATCH v3 15/46] Intel/BoardModulePkg: sort load option in the first boot Thread-Index: AQHXFy82KfDvVmRsr0W6Ex7VVJvvnqqgK9PQ Date: Thu, 1 Apr 2021 19:28:21 +0000 Message-ID: References: <20210312110141.75749-1-jialing@phytium.com.cn> <20210312110141.75749-4-jialing@phytium.com.cn> In-Reply-To: <20210312110141.75749-4-jialing@phytium.com.cn> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows authentication-results: phytium.com.cn; dkim=none (message not signed) header.d=none;phytium.com.cn; dmarc=none action=none header.from=intel.com; x-originating-ip: [50.53.190.176] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 983d84cf-9ddf-4057-473e-08d8f5444fa8 x-ms-traffictypediagnostic: MW3PR11MB4667: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: FAJhlB01CUy6q9Q3lrTt3P6AzG8Fb9NPMalT0lwMf60CN8jSfj1MaoCoa8HM2ycfYtjWKWa+bPgYl/XKNrt4GBPNXWmmR6IBuejrqvCQO3dke6XzDbHTVCxZWHGPk4+h5h0rZK6K0IopV/N7z72wad6FlvQSecEUEXZ2/flVj3WhOfrhGxVejaaC8Bmvg8ivfe9Ve8FGjDtO1Q04Z5pduVoFFec7QDonWEv5n+JPOyu4DPMQTFYKl1PaFzsnBD0McFWhn5Anyn4oKTHhVmJN1qdE9ndEmyR4b7TYJL70zanv5gBGYC39dbtnRx0HoZWJ1RaB6oUJGJ60E2XryOCmxdM8e+hi9FsvC7BvcYqn65tE9fjNUgY60Y10BYk5gSOs6i90dMQOnf6ltaFS/hq3E45T8/E54UqVaTas7Ik2dXY+LZ5huvnVnowQZRuqiRKGKbp4aOzmRZRBIfgTjmz1ywyfXHDlK4rOQYeY1y2Fh+33hv56UuFcSTaqdUlIC8NQpSwKh/l2Symq3Jkpo6mcbQVPCPIKb/9ceMXNfJBTCGCGmzrF4L9BaTkuxqwoVipv+X7Mjt4Jzon8Cr3SpPQ+svgTkHSE7zNOp8ubYa8NSp3gYakslXwITcPFt6P1a0mzPH9F9aca/XET+XqC0p7RgTV94kBjz5tiVz4I2eXTwJhfHsORKcsrzYeAfvwV23gAODKSUG3sEt+Y5ctgRZ1pPFyhXY+O3ES9+/olT9rt/aGnO3Anqhd8/LXIDS/RHJlQ x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1101MB2160.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(366004)(136003)(376002)(39860400002)(346002)(8936002)(86362001)(8676002)(83380400001)(54906003)(110136005)(316002)(33656002)(478600001)(55016002)(66446008)(966005)(52536014)(107886003)(71200400001)(53546011)(6506007)(38100700001)(2906002)(7696005)(4326008)(9686003)(26005)(76116006)(5660300002)(66946007)(64756008)(186003)(66556008)(66476007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?Z9JoQ5KvqJt17MLJsKsdTLgCHlPJQR430cgVk0nm5IbyNOvspqt2AUAlCFN8?= =?us-ascii?Q?AWGqywPfH0qYcv0N1fYu52FL7nzSzTLrXT0UkQ0kzJ8pn7OtLY4NySn+cMCr?= =?us-ascii?Q?wxOI3rj5GM+w1Lp/cVrFBNlzX1qj+/1FNtXowWaE87TJ+QU/fclQWzwebJxp?= =?us-ascii?Q?ND6rwN32k76NLXzk1Zuxx34crS+EJX6fVZBbZiRjeC9YEWrYbriKDq9drm9d?= =?us-ascii?Q?toOZEDIB8dXDgVMTHpMzCLQ0aQbvEgiIbtjb5dU5MN+okkrYIIud/G1YoRkX?= =?us-ascii?Q?IhyZyFYXPY1VpxAwoeQTzV3gjhBSVwuNFODart3dtWvoLQMvCMzrIMeWQWGm?= =?us-ascii?Q?QkbAByASlveZN63LpWdWKl2Z5chNT28HPM55jveZGa4Vi2NNOxtn+XDl87rE?= =?us-ascii?Q?GIUsCSJMHiNmUbyqRTtEoeNYpSLyESxR0z2jAG/wbSm1kt5EEWu3V7Nv9Lcg?= =?us-ascii?Q?OZD90CuvJodospxMwtFHhB3YC5pnWJzQTwmmhzNyf8LWCv9M2uL//vVfNPdZ?= =?us-ascii?Q?LgUgobGrUqPMb2CbxQstRxFIsYix4+gcSBznZGzBmm2lcDrlg/nwdeEwqjni?= =?us-ascii?Q?IMAfwdBWGqtTpPphkdYrMLuC+qixNeoClhS/xOHv6JInXU/VmFtYUngXFite?= =?us-ascii?Q?35RyH9RzH1Ho3MjokAt5wvFwqCO4SzP4cxGAltkCZ1HdeZ1UU/STPYD6zoif?= =?us-ascii?Q?R1bKqkbjSEdJObaURDyPBAu2jheP8CJ3zV/yXEPZMDufwgKsu1/BZ4pOW2SD?= =?us-ascii?Q?WAtp5HJIMKT+YNui44j8F3Jl7K8Xw48t8KxVsTsi6o31to99R5ZgvLIeSwpA?= =?us-ascii?Q?IE+2UpSd7hZHWEO3+jLIZrnDfu6/uwKgrhCsTLMMtnT4HAxQlYM63sC/jKH4?= =?us-ascii?Q?KmBDw4dZ0xq647onHIIt9dzeddtyws5SVT2YMA/SKf3TAIz295uv+VFtjcHD?= =?us-ascii?Q?YB8Z7MD5+304uTZWorM5qq29u7ir4nUZlFe5JFoYPu8Q6qAfGD8upOblBAVe?= =?us-ascii?Q?KEliTi1UY+sCAycRU2uUQ97ptx4AoYgvOKD6zSnsm5D7B0Rw2nXVOK2bVmLD?= =?us-ascii?Q?dk+9uR0K4VF/qcTCYnoMWJS92F1Sl/udVqM8u6q85oCjUmrHuZr7eiXlNPJj?= =?us-ascii?Q?fMgrUGdJ3sGb4SZKAO75Fwec82t7V0L6XPGAVg+3MOQDWIHwpu7reqEtF7et?= =?us-ascii?Q?UpHWN05pAf3nHt7V6p2oewj4WUGqMCmAEMH9QLGfgUedA97dw1qvGdvzNW14?= =?us-ascii?Q?Z5904TxQrsS4hyPRo1dXbQOVZRNjkM4dwBEC6evMCjMaSuKAc3B5Pnm825WB?= =?us-ascii?Q?asQPqdnk2HrnoVymGPSXexpU?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR1101MB2160.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 983d84cf-9ddf-4057-473e-08d8f5444fa8 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Apr 2021 19:28:21.3945 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: comhbFv6x7lDmgD2k+TQNzyfzt87CrfARpnVLeFYwi3MzJHg+eu05sas5/x4niSyRqPpWHWv+2oGsxsbKL4axLcvzcSJfn4qBugS5oEGgQw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4667 Return-Path: nathaniel.l.desimone@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Ling, This appears to be a duplicate of a patch that has already been applied:=20 https://github.com/tianocore/edk2-platforms/commit/abf4c54 Was this message sent in error? Thanks, Nate > -----Original Message----- > From: Ling Jia > Sent: Friday, March 12, 2021 3:01 AM > To: devel@edk2.groups.io > Cc: Leif Lindholm ; Peng Xie > ; Yiqi Shu ; Liu, > Zhiguang ; Dong, Eric ; > Liming Gao ; Desimone, Nathaniel L > ; Agyeman, Prince > ; Ni, Ray ; Gao, Zhichao > > Subject: [PATCH v3 15/46] Intel/BoardModulePkg: sort load option in the f= irst > boot >=20 > From: "Liu, Zhiguang" >=20 > Currently, load option is only sorted when setup is the first priority in= boot > option. However, Below change in UefiBootManagerLib puts setup in the > end, which causes the sort function won't be called. > MdeModulePkg/UefiBootManagerLib: Put BootMenu at the end of > BootOrder > SHA-1: 7f34681c488aee2563eaa2afcc6a2c8aa7c5b912 >=20 > This patch will set a NV variable in the first boot, and sort the boot op= tion in > first boot. >=20 > Reviewed-by: Eric Dong > Cc: Liming Gao > Cc: Nate DeSimone > Cc: Prince Agyeman > Reviewed-by: Ray Ni > Cc: Zhichao Gao >=20 > Signed-off-by: Zhiguang Liu > --- >=20 > Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLi > b.c | 72 ++++++++++---------- > 1 file changed, 37 insertions(+), 35 deletions(-) >=20 > diff --git > a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook > Lib.c > b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook > Lib.c > index d7612fb80a95..a37139a0074e 100644 > --- > a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook > Lib.c > +++ > b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHook > +++ Lib.c > @@ -20,6 +20,8 @@ > #include "BoardBdsHook.h" +#define IS_FIRST_BOOT_VAR_NAME > L"IsFirstBoot"+ GLOBAL_REMOVE_IF_UNREFERENCED EFI_BOOT_MODE > gBootMode; BOOLEAN gPPRequireUICon= firm; extern > UINTN mBootMenuOptionNumber;@@ -992,37 = +994,6 @@ > ConnectSequence ( > EfiBootManagerConnectAll (); } --/**- The function is to consider the= boot > order which is not in our expectation.- In the case that we need to re-s= ort > the boot option.-- @retval TRUE Need to sort Boot Option.- @re= tval > FALSE Don't need to sort Boot Option.-**/-BOOLEAN- > IsNeedSortBootOption (- VOID- )-{- EFI_BOOT_MANAGER_LOAD_OPTION > *BootOptions;- UINTN BootOptionCount;-- BootOpt= ions =3D > EfiBootManagerGetLoadOptions (&BootOptionCount, > LoadOptionTypeBoot);-- //- // If setup is the first priority in boot op= tion, we > need to sort boot option.- //- if ((BootOptionCount > 1) &&- (((Strn= Cmp > (BootOptions->Description, L"Enter Setup", StrLen (L"Enter Setup"))) =3D= =3D 0) > ||- ((StrnCmp (BootOptions->Description, L"BootManagerMenuApp", > StrLen (L"BootManagerMenuApp"))) =3D=3D 0))) {- return TRUE;- }-- re= turn > FALSE;-}-- /** Connects Root Bridge **/@@ -1332,6 +1303,9 @@ > BdsAfterConsoleReadyBeforeBootOptionCallback ( > ) { EFI_BOOT_MODE LocalBootMode;+ EFI_STATUS > Status;+ BOOLEAN IsFirstBoot;+ UINTN = DataSize; > DEBUG ((DEBUG_INFO, "Event > gBdsAfterConsoleReadyBeforeBootOptionEvent callback starts\n")); //@@ > -1376,14 +1350,42 @@ BdsAfterConsoleReadyBeforeBootOptionCallback ( > // // PXE boot option may appear after boot option enumerati= on > //++ EfiBootManagerRefreshAllBootOption ();+ DataSize =3D sizeo= f > (BOOLEAN);+ Status =3D gRT->GetVariable (+ > IS_FIRST_BOOT_VAR_NAME,+ &gEfiCallerIdGuid,+ > NULL,+ &DataSize,+ &IsFirstBoot= + );+ if > (EFI_ERROR (Status)) {+ //+ // If can't find the variable, = see it as the > first boot+ //+ IsFirstBoot =3D TRUE;+ }++ if (Is= FirstBoot) {+ //+ > // In the first boot, sort the boot option+ //+ > EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, > CompareBootOption);+ IsFirstBoot =3D FALSE;+ Status =3D gRT= - > >SetVariable (+ IS_FIRST_BOOT_VAR_NAME,+ > &gEfiCallerIdGuid,+ EFI_VARIABLE_NON_VOLATILE | > EFI_VARIABLE_BOOTSERVICE_ACCESS,+ sizeof (BOOLEAN)= ,+ > &IsFirstBoot+ );+ }+ break; } Prin= t (L"Press F7 for > BootMenu!\n"); - EfiBootManagerRefreshAllBootOption (); - if > (IsNeedSortBootOption()) {- EfiBootManagerSortLoadOptionVariable > (LoadOptionTypeBoot, CompareBootOption);- } }-- > 2.25.1