From nobody Fri Apr 26 15:07:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+49937+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+49937+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=nvidia.com ARC-Seal: i=1; a=rsa-sha256; t=1572889873; cv=none; d=zoho.com; s=zohoarc; b=XeMnAQxif8kjL2sOFVpJOn3AywYciVt9UGEgooVVQapNFlQBnXT07nMqkOu+g4VhELhMoKVvI6Osg+DWmOmE4N35e21KVltc3VHI083G9cvsTGA+CK3mwH/JBPM80nTjpG8QbojEvLwd1W2G3VQgj41fv8lNBbsEmnrjDMaFJPc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572889873; h=Content-Type:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=iBr4qUq6RwgXQ1iMTo0SDwuFkLELKJjjMYpoSijuBoA=; b=Unzjspx/0H7/LgTz74n7RTy0/ge1cBozqRF1aAb4dEzxDZ2ctMC02n3FficOBnueyPByyhucivBft95NnzwufG25QyWF+StcbvNsFwmRfWpbhPRFVxz8apoKZCYjR9mpZyeQcHdrG87T4EkpdGFHI89rdDMZkCrZrciqAFch54o= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+49937+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1572889873687789.3892512090987; Mon, 4 Nov 2019 09:51:13 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Mon, 04 Nov 2019 09:51:13 -0800 X-Received: from hqemgate14.nvidia.com (hqemgate14.nvidia.com [216.228.121.143]) by mx.groups.io with SMTP id smtpd.web12.8776.1572889872637153395 for ; Mon, 04 Nov 2019 09:51:12 -0800 X-Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 04 Nov 2019 09:51:18 -0800 X-Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 04 Nov 2019 09:51:12 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 04 Nov 2019 09:51:12 -0800 X-Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 4 Nov 2019 17:51:11 +0000 X-Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 4 Nov 2019 17:51:11 +0000 X-Received: from ashishsingha-lnx.nvidia.com (Not Verified[10.28.48.147]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 04 Nov 2019 09:51:11 -0800 From: "Ashish Singhal" To: , , CC: Ashish Singhal Subject: [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: Support skipping BM enumeration Date: Mon, 4 Nov 2019 10:51:09 -0700 Message-ID: <2a5e270f960f365c66a4b4f5f04a911cd451f31f.1572889483.git.ashishsingha@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ashishsingha@nvidia.com X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1572889873; bh=r6mlEc8hxoxcYlyvj/dgWojM9Qx0npQze7bpHefCKG8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=f404qs2h1A6i0IQSTSMwPNy3ow9gMcdqER3dQR66UT2RbHS89+eiQINr8BiEayoPOot slnIRD424RzQ87lURYkXeRfYRFfbovWhFS/LDO5WSQLGgbBwJzQrBKe3S+m+gKzfOGFLv UnnO4GNk6fdLWlZ7Lh7IgVKEe/DiKC+Ucgo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Allow support for skipping auto enumeration of a BlockIO or SimpleFileSystem or LoadFile protocol based on a new protocol installed on the same handle. EdkiiSkipBmAutoEnumerate protocol has been added for that purpose. Signed-off-by: Ashish Singhal --- .../Include/Protocol/SkipBmAutoEnumerate.h | 25 ++++++++++++++ MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 40 ++++++++++++++++++= +++- .../Library/UefiBootManagerLib/InternalBm.h | 1 + .../UefiBootManagerLib/UefiBootManagerLib.inf | 1 + MdeModulePkg/MdeModulePkg.dec | 3 ++ 5 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 MdeModulePkg/Include/Protocol/SkipBmAutoEnumerate.h diff --git a/MdeModulePkg/Include/Protocol/SkipBmAutoEnumerate.h b/MdeModul= ePkg/Include/Protocol/SkipBmAutoEnumerate.h new file mode 100644 index 0000000..7efca7a --- /dev/null +++ b/MdeModulePkg/Include/Protocol/SkipBmAutoEnumerate.h @@ -0,0 +1,25 @@ +/** @file + Skip Boot Manager Auto Enumerate protocol header file. + + This is used to skip auto boot manager enumeration. This protocol can + be installed on any handle having BlockIo or SimpleFileSystem or LoadFile + protocol and UEFI boot manager would skip its enumeration. + +Copyright (c) 2019, NVIDIA Corporation. All rights reserved. + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _SKIP_BM_AUTO_ENUMERATE_PROTOCOL_H_ +#define _SKIP_BM_AUTO_ENUMERATE_PROTOCOL_H_ + +/// +/// Global ID for the EDKII SKIP BM AUTO ENUMERATE Protocol. +/// +#define EDKII_SKIP_BM_AUTO_ENUMERATE_PROTOCOL_GUID \ + { 0x2733f321, 0x5a7e, 0x4178, { 0x86, 0xcc, 0x21, 0x65, 0xd2, 0x0c, 0xec= , 0x1e }} + +extern EFI_GUID gEdkiiSkipBmAutoEnumerateProtocolGuid; + +#endif diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePk= g/Library/UefiBootManagerLib/BmBoot.c index 760d764..7b5f176 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -2080,6 +2080,7 @@ BmEnumerateBootOptions ( UINTN HandleCount; EFI_HANDLE *Handles; EFI_BLOCK_IO_PROTOCOL *BlkIo; + VOID *SkipBmAutoEnumerate; UINTN Removable; UINTN Index; CHAR16 *Description; @@ -2111,6 +2112,18 @@ BmEnumerateBootOptions ( continue; } =20 + Status =3D gBS->HandleProtocol ( + Handles[Index], + &gEdkiiSkipBmAutoEnumerateProtocolGuid, + (VOID **) &SkipBmAutoEnumerate + ); + if (!EFI_ERROR (Status)) { + // + // Skip if the file system handle supports a SkipBmAutoEnumerate = protocol + // + continue; + } + // // Skip the logical partitions // @@ -2169,12 +2182,25 @@ BmEnumerateBootOptions ( &gEfiBlockIoProtocolGuid, (VOID **) &BlkIo ); - if (!EFI_ERROR (Status)) { + if (!EFI_ERROR (Status)) { // // Skip if the file system handle supports a BlkIo protocol, which = we've handled in above // continue; } + + Status =3D gBS->HandleProtocol ( + Handles[Index], + &gEdkiiSkipBmAutoEnumerateProtocolGuid, + (VOID **) &SkipBmAutoEnumerate + ); + if (!EFI_ERROR (Status)) { + // + // Skip if the file system handle supports a SkipBmAutoEnumerate pr= otocol + // + continue; + } + Description =3D BmGetBootDescription (Handles[Index]); BootOptions =3D ReallocatePool ( sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCo= unt), @@ -2212,6 +2238,18 @@ BmEnumerateBootOptions ( &Handles ); for (Index =3D 0; Index < HandleCount; Index++) { + Status =3D gBS->HandleProtocol ( + Handles[Index], + &gEdkiiSkipBmAutoEnumerateProtocolGuid, + (VOID **) &SkipBmAutoEnumerate + ); + if (!EFI_ERROR (Status)) { + // + // Skip if the file system handle supports a SkipBmAutoEnumerate pr= otocol + // + continue; + } + // // Ignore BootManagerMenu. its boot option will be created by EfiBootM= anagerGetBootManagerMenu(). // diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h b/MdeModu= lePkg/Library/UefiBootManagerLib/InternalBm.h index 027eb25..f95e58f 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h @@ -41,6 +41,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include =20 #include #include diff --git a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf= b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf index ed6b467..40c668c 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf +++ b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf @@ -107,6 +107,7 @@ gEfiFormBrowser2ProtocolGuid ## SOMETIMES_CONSUMES gEfiRamDiskProtocolGuid ## SOMETIMES_CONSUMES gEfiDeferredImageLoadProtocolGuid ## SOMETIMES_CONSUMES + gEdkiiSkipBmAutoEnumerateProtocolGuid ## SOMETIMES_CONSUMES =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange = ## SOMETIMES_CONSUMES diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index d6bac97..64ef22a 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -604,6 +604,9 @@ ## Include/Protocol/PeCoffImageEmulator.h gEdkiiPeCoffImageEmulatorProtocolGuid =3D { 0x96f46153, 0x97a7, 0x4793, = { 0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } } =20 + ## Include/Protocol/SkipBmAutoEnumerate.h + gEdkiiSkipBmAutoEnumerateProtocolGuid =3D { 0x2733f321, 0x5a7e, 0x4178, = { 0x86, 0xcc, 0x21, 0x65, 0xd2, 0x0c, 0xec, 0x1e } } + # # [Error.gEfiMdeModulePkgTokenSpaceGuid] # 0x80000001 | Invalid value provided. --=20 2.7.4 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#49937): https://edk2.groups.io/g/devel/message/49937 Mute This Topic: https://groups.io/mt/41357237/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-