From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (EUR02-VE1-obe.outbound.protection.outlook.com [40.107.2.87]) by mx.groups.io with SMTP id smtpd.web08.2510.1628240546375699590 for ; Fri, 06 Aug 2021 02:02:27 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=8PFgMHoe; spf=pass (domain: arm.com, ip: 40.107.2.87, mailfrom: sunny.wang@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a5Wr6hGdIXpu5TSBbl1Xb5Bsr8PtxMGO1tPoaNYSOt4=; b=8PFgMHoelRISClKasSfQ5Q/PR1IFwc3xzMpvD3lZt2NS4Xf2B9dA5dOnDx+ktUySyHe9KAQOpweHB2d4VXCUbNeOfKS+yMdqX61vB7cYE7PR2rfGsZjdGxCm/uIrp0Nyc8er9k1gXTA69IFhK9McayJi9eTCVrSKLl9GW2B9QQE= Received: from AS8P250CA0005.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:330::10) by DB6PR0801MB1671.eurprd08.prod.outlook.com (2603:10a6:4:3c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15; Fri, 6 Aug 2021 09:02:19 +0000 Received: from VE1EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:330:cafe::7e) by AS8P250CA0005.outlook.office365.com (2603:10a6:20b:330::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Fri, 6 Aug 2021 09:02:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT018.mail.protection.outlook.com (10.152.18.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.16 via Frontend Transport; Fri, 6 Aug 2021 09:02:19 +0000 Received: ("Tessian outbound ab45ca2b67bc:v101"); Fri, 06 Aug 2021 09:02:18 +0000 X-CR-MTA-TID: 64aa7808 Received: from 9a4b96ea82d8.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A5DB35AA-5229-478B-9E2E-7ECFED09572C.1; Fri, 06 Aug 2021 09:02:12 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9a4b96ea82d8.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 06 Aug 2021 09:02:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ADoyDOZ+Db/YRhP5aHkfu65cQ9ib5/YCmfpmPJXvnot8cIRJv1Wh1T7x3sdCJEC12Dgh/U33JGNnvqA7vw25mqzop4a47hYm6MKoBSPy4qIRFfyDc8XbISkL508IhC1rFdW/crZsbDOAo/oVYV34VGsUWg60VhRpkcOP/7BXud0kBqZlKotgEZv+0psS6ousuLkjENPZmBqDv7bcCEnfKtPDZjWYWE0mrMOBdFGvAc7WSuPybYWBaUZhmbcCsK/598wYnwJRQU2jenz+6o3EP3g2UHmrXaMTWP/Zia4aRp4f8H26vDW+fXVd3WdY2YhosqQ1hl0et9llU/cqSUrjuA== 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=a5Wr6hGdIXpu5TSBbl1Xb5Bsr8PtxMGO1tPoaNYSOt4=; b=QgKqDOKeUQvnclzZCk6Exao30/3VDnkLeWywinMB9IJYza2UR9VAAvNgZ3NnaZ6bp7riMo1QflIUhjYqYkOYUs97+LHy4rUjRAbY8uwfpS7URywFeNV/vTvupsq7xhdAGtUVmYVEXi0qeCYkKl0b107jeTvoVweD+bieWborP8t2vqMDycSZt56Wy6SQYylhUQNoWhXXY6v7Ra3VoG1O7GlIceK609rR/H1XMUCKiDhmVEdLA9xNpQJTBuTGD9PXJoh6ajj03j2x1DHSmMIMfH3rjNBccNNthRmRMW1BWgJ7yBPNPBFKhnhOWKaJbzw6J0qBFC1IyfhvZhzbu/5kug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a5Wr6hGdIXpu5TSBbl1Xb5Bsr8PtxMGO1tPoaNYSOt4=; b=8PFgMHoelRISClKasSfQ5Q/PR1IFwc3xzMpvD3lZt2NS4Xf2B9dA5dOnDx+ktUySyHe9KAQOpweHB2d4VXCUbNeOfKS+yMdqX61vB7cYE7PR2rfGsZjdGxCm/uIrp0Nyc8er9k1gXTA69IFhK9McayJi9eTCVrSKLl9GW2B9QQE= Received: from DB8PR08MB3993.eurprd08.prod.outlook.com (2603:10a6:10:ad::26) by DB7PR08MB3515.eurprd08.prod.outlook.com (2603:10a6:10:50::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.17; Fri, 6 Aug 2021 09:02:10 +0000 Received: from DB8PR08MB3993.eurprd08.prod.outlook.com ([fe80::14b0:85d6:deeb:9ee0]) by DB8PR08MB3993.eurprd08.prod.outlook.com ([fe80::14b0:85d6:deeb:9ee0%7]) with mapi id 15.20.4394.019; Fri, 6 Aug 2021 09:02:10 +0000 From: "Sunny Wang" To: Grzegorz Bernacki , "devel@edk2.groups.io" CC: "leif@nuviainc.com" , "ardb+tianocore@kernel.org" , Samer El-Haj-Mahmoud , "mw@semihalf.com" , "upstream@semihalf.com" , Sunny Wang Subject: Re: [PATCH] ArmPkg: Enable boot discovery policy for ARM package. Thread-Topic: [PATCH] ArmPkg: Enable boot discovery policy for ARM package. Thread-Index: AQHXip1vuQfoe0PpLkuY4L4Fs4ovNatmKzxA Date: Fri, 6 Aug 2021 09:02:09 +0000 Message-ID: References: <20210806083026.3295056-1-gjb@semihalf.com> In-Reply-To: <20210806083026.3295056-1-gjb@semihalf.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 58ABA3D82610AE44B8B239D17EFBAC87.0 x-checkrecipientchecked: true Authentication-Results-Original: semihalf.com; dkim=none (message not signed) header.d=none;semihalf.com; dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 435c3d45-a425-46d7-9f6f-08d958b8e559 x-ms-traffictypediagnostic: DB7PR08MB3515:|DB6PR0801MB1671: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: yEIXhhUmxxqHsKUtIe99ANg+9YvVUM17C3ZK6aKt7v7UI5KF5s5r3fsByIzRhogWByPqb3NGLNKvG/IvwSLZCIFyZ70TBPMSw+w9BMmUxI2ETB1zgHo699xOgr0uq3eVkhm7AE/9MGQ7esQrkrVbKXerU8KRv7z8xoHem/B5C2q3BWU8e6Xs96AsJUT0z+s6oIEvjiNqS/4m3KVOH1jxsw4VR1ffxM/32GnmkttngWvFVBf6Sg4lOOgYED0Cx5ZIzvGjVgWhWOtlZ6vrWpT5JWkW+w8puPqwDhiGZu7cq8urlYImjS/TZ1om7PYlXjZ/gytYpcSsE1ABwy7BQIubdpM+bAuxLuoU81z41VkS71PAuwuPJ/Fygz2CzLSn52Uc/v0H9VIbRRaZSDmlbobYuuHHlUVhsNd+Ssd9PlOOWvfuDzpTN/GnbLS4DtCnDM5UertYRymNXSwnMn/P5wTagzc8NHoDbwtpF5kYZIunvuHpSmc7mUNFQ0RWOhvJ8QNFEio7nuITqcBEW8rwl94B4NHCBrBVXpZW2ZL3neMB1ynctUUW3gtyFvnEo81WtOEAj61I71/dYHSARKl0/Quh8vIXRCNbQ1/zBysBRuHsKI60f1ZdT4AFQoPQOPLpdbPHWlT7ghYOSKSZYyN7qdnpzWHrPf2Kbhj4UAh1RC/5QjRxLiqvKhblgwFWSQ/Dn7jjzT9nh2wvbBV1uMpfnr5GCYTdze2iAIB7cv0Xpazs0DPFOKFhLNrLje6vBaRseD94TzCVQ7LJfBC+EgSyk4zxjxnBDalP4zhAB2GS4Z9uT1I= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB8PR08MB3993.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(366004)(136003)(346002)(39860400002)(396003)(86362001)(9686003)(54906003)(53546011)(71200400001)(52536014)(4326008)(2906002)(6506007)(66556008)(66446008)(64756008)(7696005)(66476007)(26005)(76116006)(66946007)(186003)(8936002)(478600001)(110136005)(966005)(38100700002)(122000001)(38070700005)(33656002)(55016002)(5660300002)(316002)(8676002)(83380400001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Fpidz8YZdeGuMP0DoWKUSpjwZ/5Yt2HqJvtHa84IjF8DCfB8zdYVRWxTQ8Jg?= =?us-ascii?Q?zWwqaEcDjUxIygbuKuc8o+g73awK55tHmU5rQEhwBi/VCIs4ZrEgapdvLlu6?= =?us-ascii?Q?HoAC7NPIPiU17qaGFeLClqN5nN5+FE+CcgyedbOOvyfhpeIDn44LbrMW5e0r?= =?us-ascii?Q?p9qKvqlU21oGLuvhUMlwxw9aRswhJZsI6X9l13eANg/7//z3UkSAXptu4Q/S?= =?us-ascii?Q?530gj1ffqAx10ZtH517HuSFyZFy4/sQ6n0ha6dfTqUzhYAiQHlj+ynAxn34i?= =?us-ascii?Q?kiPMmYYlC6sFZ2/YFuZned3gOrYYfovNWUpBvY0jQ/ss0haT4k79oUOXqLLB?= =?us-ascii?Q?pgQEM6YK30jSUU4fMvlaStsAg4P36i3GdgeLmXGENhqBDYhH1csQGQKkyGYc?= =?us-ascii?Q?WNhAg11pjpzz8nQ1rdwa7OvfiXapQgTTNHtaYQp6L3iJiGbywhF4FC+WbJkw?= =?us-ascii?Q?MGCoJDL19ny/jhq5zzjYLBrQkcU9/jxroApVkt7TzyOw/Ml1g1EitHQcCLuG?= =?us-ascii?Q?Vj7auS+Co5D8TY1ZZpdQ/ZcV1LU4gDNsFBCDCbCJeO5a7RM91lEp88xZmTNN?= =?us-ascii?Q?4P21l42W+tQ0Vyh8wCl0VzhcNwJBRU3U3gHUa39rE3qbBOaUNy0O7yiRkbSv?= =?us-ascii?Q?CXJcRUZpBFNS+pClvwhHCvCFimqfH5aaspZfh9yFeXDVvoxdVLvxl6nRbvKP?= =?us-ascii?Q?9oUPZ1bB0dNWAT244ygpXBsUSbp/cbXq2W3OGgQbmwazMSyGqTt0iR6TzPpe?= =?us-ascii?Q?oJxFm674JeyZTt16OSjYyX2fkI/BFW8QnxGXjrBrJW1haNCfs1XfikyxvzTS?= =?us-ascii?Q?8MqIL41qvkbS+cG6M3jwk6MVXQOrfzE3m6vMlW5ksYm36BEgLBJ09QJ+C86N?= =?us-ascii?Q?YGg8a/4cTKz6lUDVLXBHrfihP5g9FGSGsfevWKQTH1bPwZrv9cIpL9IqY2ND?= =?us-ascii?Q?fM8GZp6+YbjXHyk+xYF5x8TcZfqX2mDzhqEJSFVu6ETyBKCoU6B3YFWP4FL3?= =?us-ascii?Q?tNmCotg5zQAjGPpsGSB/u0j1uS3pM6pkJiq/rf9KEdlJIP/EhO5GHpYWJCzH?= =?us-ascii?Q?CO6a9J1Og17gAvFtb5P4CrAqU+6aPFWcNt1vgDIQkcV+8tdY30tlX2oyvEFf?= =?us-ascii?Q?V7QNcwX4uptHuDEsW6ezdEtlxiGMS2v3m7AUFXAAgq5Xl55qnYCiQebDND+v?= =?us-ascii?Q?MPcUj+b1+2t62BllOeeu1ghLJcClxNyOfot6telIjGFfz0XSpHcyZmkhUV0o?= =?us-ascii?Q?BDpewx9++NOELGVCCjwW2I30Kr8NmNAuLPXsVy7ynSgB+CDWxu60S+zH9w+H?= =?us-ascii?Q?kFT0f3fwcYLh4HduY/ZMTDWf?= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3515 Original-Authentication-Results: semihalf.com; dkim=none (message not signed) header.d=none;semihalf.com; dmarc=none action=none header.from=arm.com; Return-Path: Sunny.Wang@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: fd978d91-2e46-4030-2884-08d958b8dfbd X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ap7piOV5MOUTgzfGEGrcW9J9M+PnXeyfQDKY1YwJbnRWYLp0XZgL7910Ad8TBb8Uq4vTswVeNkFG4L9MoylAg430m+8ZZhlRqXYqkMsRQNQZPq/Fc89c7tkJV4ocvDLj81gJ18tsw9IE4Pfn1ESqGhOq2t1DZLbpWEA6rur1dO0Q6l1PYfjKl1eVLv3u6NHyytiDgFUEDpzhsxmeFH1Vh08DdX8HPxei9n/EMw1R85XauiNiELiYwbDks5m5LwYy5CKKRtWJvkaw9uN4OH6+G7Lja/pkmREFQT4A1RuAqwdHzxajfgVfpL9W4X2nx1uoxUDsUZ2X3YVO/czvwlLD+cfn12A1KZOuhMrwQgEUpHML73FN5WDNxzhsVo4mAFFjiM+r4z5uMLo6EzOfX1iygUdvryMZqDmVjfIE4M6GpUrVOqBFqevhPkl62Civ3zzbiz5ZB5gbMI558rqFQpJj1dTzs+pBqawLeVhv3ufjn2JHmUmTANqPvHOlsTRDVqMoLe8aKwJhl6shGDODoFW6Zy1YbhHct8/UWEo+2tTgIs2vIs741hE2LvH2wt/ADrppuR+3AvDAVTdRFqBGapCkfOY6XQABvi3kOcVG+/F03XBtCAgjKOCsr/q70oML03UsEuFN0qGiXCmuBcQFZXR+g91MjuQEGkt2taQWwYO4RYp3knBi+WeTTuGvSHMuXSq5okgv4YkS0VIDVXlI1Cd+IrCz+g9EL395/RjtAEjRLdig0tZhslkQm07cWFaCmW/42HsH4Ut+urDZWdMWwRRzKO7lspJc+pv7C9wjRVpdkBY= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(396003)(376002)(136003)(346002)(39860400002)(36840700001)(46966006)(86362001)(26005)(83380400001)(81166007)(5660300002)(8936002)(186003)(82740400003)(7696005)(356005)(2906002)(4326008)(70586007)(70206006)(9686003)(33656002)(54906003)(47076005)(316002)(966005)(110136005)(36860700001)(6506007)(53546011)(55016002)(8676002)(82310400003)(336012)(478600001)(52536014);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2021 09:02:19.3129 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 435c3d45-a425-46d7-9f6f-08d958b8e559 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1671 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Looks good. Thanks, Greg. Reviewed-by: Sunny Wang For others' reference, this patch is similar to the one below for Rasberry = Pi that just got merged. - https://edk2.groups.io/g/devel/message/78514 After merging this change, we should be able to easily enable "boot discove= ry policy" on other ARM platforms. For the platform that doesn't include B= ootManagerPolicyDxe driver but using ArmPkg PlatformBootManagerLib, it woul= d just do nothing (the behavior will be kept the same as before). Best Regards, Sunny Wang -----Original Message----- From: Grzegorz Bernacki Sent: Friday, August 6, 2021 4:30 PM To: devel@edk2.groups.io Cc: leif@nuviainc.com; ardb+tianocore@kernel.org; Samer El-Haj-Mahmoud ; Sunny Wang ; mw@semihalf.co= m; upstream@semihalf.com; Grzegorz Bernacki Subject: [PATCH] ArmPkg: Enable boot discovery policy for ARM package. This commit adds code which check BootDiscoveryPolicy variable and calls Boot Policy Manager Protocol to connect device specified by the variable. To enable that mechanism for platform EfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy PCD must be added to DSC file and BootDiscoveryPolicyUiLib should be added to UiApp libraries. Signed-off-by: Grzegorz Bernacki --- ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 5 + ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 96 ++++= +++++++++++++++- 2 files changed, 100 insertions(+), 1 deletion(-) diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.i= nf b/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index 353d7a967b..86751b45f8 100644 --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -65,11 +65,15 @@ [Pcd] gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut + gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy [Guids] + gBootDiscoveryPolicyMgrFormsetGuid gEdkiiNonDiscoverableEhciDeviceGuid gEdkiiNonDiscoverableUhciDeviceGuid gEdkiiNonDiscoverableXhciDeviceGuid + gEfiBootManagerPolicyNetworkGuid + gEfiBootManagerPolicyConnectAllGuid gEfiFileInfoGuid gEfiFileSystemInfoGuid gEfiFileSystemVolumeLabelInfoIdGuid @@ -79,6 +83,7 @@ [Protocols] gEdkiiNonDiscoverableDeviceProtocolGuid + gEfiBootManagerPolicyProtocolGuid gEfiDevicePathProtocolGuid gEfiGraphicsOutputProtocolGuid gEfiLoadedImageProtocolGuid diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Li= brary/PlatformBootManagerLib/PlatformBm.c index 5ceb23d822..4332c45bb7 100644 --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -2,9 +2,10 @@ Implementation for PlatformBootManagerLib library class interfaces. Copyright (C) 2015-2016, Red Hat, Inc. - Copyright (c) 2014 - 2019, ARM Ltd. All rights reserved.
+ Copyright (c) 2014 - 2021, ARM Ltd. All rights reserved.
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
Copyright (c) 2016, Linaro Ltd. All rights reserved.
+ Copyright (c) 2021, Semihalf All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -19,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -27,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -703,6 +706,91 @@ HandleCapsules ( #define VERSION_STRING_PREFIX L"Tianocore/EDK2 firmware version " +/** + This functions checks the value of BootDiscoverPolicy variable and + connect devices of class specified by that variable. Then it refreshes + Boot order for newly discovered boot device. + + @retval EFI_SUCCESS Devices connected succesfully or connection + not required. + @retval others Return values from GetVariable(), LocateProtocol() + and ConnectDeviceClass(). +--*/ +STATIC +EFI_STATUS +BootDiscoveryPolicyHandler ( + VOID + ) +{ + EFI_STATUS Status; + UINT32 DiscoveryPolicy; + UINTN Size; + EFI_BOOT_MANAGER_POLICY_PROTOCOL *BMPolicy; + EFI_GUID *Class; + + Size =3D sizeof (DiscoveryPolicy); + Status =3D gRT->GetVariable ( + BOOT_DISCOVERY_POLICY_VAR, + &gBootDiscoveryPolicyMgrFormsetGuid, + NULL, + &Size, + &DiscoveryPolicy + ); + if (Status =3D=3D EFI_NOT_FOUND) { + Status =3D PcdSet32S (PcdBootDiscoveryPolicy, PcdGet32 (PcdBootDiscove= ryPolicy)); + if (Status =3D=3D EFI_NOT_FOUND) { + return EFI_SUCCESS; + } else if (EFI_ERROR (Status)) { + return Status; + } + DiscoveryPolicy =3D PcdGet32 (PcdBootDiscoveryPolicy); + } else if (EFI_ERROR (Status)) { + return Status; + } + + if (DiscoveryPolicy =3D=3D BDP_CONNECT_MINIMAL) { + return EFI_SUCCESS; + } + + switch (DiscoveryPolicy) { + case BDP_CONNECT_NET: + Class =3D &gEfiBootManagerPolicyNetworkGuid; + break; + case BDP_CONNECT_ALL: + Class =3D &gEfiBootManagerPolicyConnectAllGuid; + break; + default: + DEBUG (( + DEBUG_INFO, + "%a - Unexpected DiscoveryPolicy (0x%x). Run Minimal Discovery Pol= icy\n", + __FUNCTION__, + DiscoveryPolicy + )); + return EFI_SUCCESS; + } + + Status =3D gBS->LocateProtocol ( + &gEfiBootManagerPolicyProtocolGuid, + NULL, + (VOID **)&BMPolicy + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "%a - Failed to locate gEfiBootManagerPolicyProtoc= olGuid." + "Driver connect will be skipped.\n", __FUNCTION__)); + return Status; + } + + Status =3D BMPolicy->ConnectDeviceClass (BMPolicy, Class); + if (EFI_ERROR (Status)){ + DEBUG ((DEBUG_ERROR, "%a - ConnectDeviceClass returns - %r\n", __FUNCT= ION__, Status)); + return Status; + } + + EfiBootManagerRefreshAllBootOption(); + + return EFI_SUCCESS; +} + /** Do the platform specific action after the console is ready Possible things that can be done in PlatformBootManagerAfterConsole: @@ -753,6 +841,12 @@ PlatformBootManagerAfterConsole ( } } + // + // Connect device specified by BootDiscoverPolicy variable and + // refresh Boot order for newly discovered boot devices + // + BootDiscoveryPolicyHandler (); + // // On ARM, there is currently no reason to use the phased capsule // update approach where some capsules are dispatched before EndOfDxe -- 2.25.1 IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.