From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (EUR04-HE1-obe.outbound.protection.outlook.com [40.107.7.71]) by mx.groups.io with SMTP id smtpd.web09.83218.1629461091049313053 for ; Fri, 20 Aug 2021 05:04:52 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=6fKTvSMn; spf=pass (domain: arm.com, ip: 40.107.7.71, mailfrom: sami.mujawar@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=r8iV1i94bE7kmSHm+COuhnmKgL+mzQPBSP3Cjnp0jS8=; b=6fKTvSMn7+yMS9CshyQ3uVfkjQrL9/DlK/rO53u2jlGlYaD0nC/wpNTfVeI8x9fJs4YNHm0+tig8CPDwlIFHuwMal6YUNViOh4hNlv3y9x0kyRfi16pL4ifBfHCjozSGycGceofLZS8x7Q+zi24BloT0AiF5Y6EUa9/cP0zm6i8= Received: from DB8PR06CA0059.eurprd06.prod.outlook.com (2603:10a6:10:120::33) by VI1PR08MB4287.eurprd08.prod.outlook.com (2603:10a6:803:f4::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.19; Fri, 20 Aug 2021 12:04:45 +0000 Received: from DB5EUR03FT031.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:120:cafe::61) by DB8PR06CA0059.outlook.office365.com (2603:10a6:10:120::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Fri, 20 Aug 2021 12:04:45 +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 DB5EUR03FT031.mail.protection.outlook.com (10.152.20.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Fri, 20 Aug 2021 12:04:44 +0000 Received: ("Tessian outbound 8b41f5fb4e9e:v103"); Fri, 20 Aug 2021 12:04:44 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f6c204b7749ec9fd X-CR-MTA-TID: 64aa7808 Received: from be8f31ab286a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 415A9CF0-1480-47C2-A194-D3AAE284E9CA.1; Fri, 20 Aug 2021 12:04:37 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id be8f31ab286a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 20 Aug 2021 12:04:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m1p68E7Tt0HYtDEHXc3owiaiM7kgNdjt19KJjIF3vIJr5EwfMaAchnS0Mhj0me9pwwdeHyPg9dB31qLkU4Ag0XJL7iSkRXIOwgwE6gVQCkI3wP8YZQ00OquWfvLHjitvmGlHSWfHRJyNpgkmpzUBOYWHKwSa+0JT8CGmfLvQzQlAOZVJzMT7mKAI9RYfcBiOz/fT2QexWKJhquKbz+FFA5CBA2dtB2QhtKRUFJQJjyJzqWYN7L2DdESqA9YZKxecwJ3K7FXZE4WsF4JoSm72RmoiVw9+CcNYe9jPqow+Pp+WPrlVh4O7Qpitg08cT97/IySmxn0r/mzVCzYMjxzZ8Q== 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=r8iV1i94bE7kmSHm+COuhnmKgL+mzQPBSP3Cjnp0jS8=; b=ZJ/kRFv/eJCp+2mRrbUAZ+XNhTb6Tsf4zgAMyO9xRsshPONi8LjHvB3m49LPrXno/gm+Kzj8JFDe4eKLlzRJqcXtkSdcBzwL+x1fUw9jqQv8ztm5ZFBF5GD4WJXoXgAuRZLMprACoWBI9MUi6x7+AMOUe7WZ/mTmtcSoSVgnrPPHbgDVaQKTPSvRK3l3Di4ye7bhASfswIcBJvJOyt6YWQgafgGH6L5/Q1Sxb2gd6Yr/A2CMSOUB2LC96tT1TvvE/noPiKtZSL35M2FEFi6eGuH2hjUB191mtqCeo4PY4hYUntH1yiySeEY6GlOcs0Ku1S9VYTGpEK9iefL4bsxVRw== 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=r8iV1i94bE7kmSHm+COuhnmKgL+mzQPBSP3Cjnp0jS8=; b=6fKTvSMn7+yMS9CshyQ3uVfkjQrL9/DlK/rO53u2jlGlYaD0nC/wpNTfVeI8x9fJs4YNHm0+tig8CPDwlIFHuwMal6YUNViOh4hNlv3y9x0kyRfi16pL4ifBfHCjozSGycGceofLZS8x7Q+zi24BloT0AiF5Y6EUa9/cP0zm6i8= Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by AM6PR08MB3544.eurprd08.prod.outlook.com (2603:10a6:20b:4e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.21; Fri, 20 Aug 2021 12:04:33 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::149b:2b95:677b:995d]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::149b:2b95:677b:995d%7]) with mapi id 15.20.4436.019; Fri, 20 Aug 2021 12:04:33 +0000 Subject: Re: [edk2-platforms PATCH v2] ArmPkg: Enable boot discovery policy for ARM package. To: Samer El-Haj-Mahmoud , Grzegorz Bernacki , "devel@edk2.groups.io" Cc: "leif@nuviainc.com" , "ardb+tianocore@kernel.org" , Sunny Wang , "mw@semihalf.com" , "upstream@semihalf.com" , nd References: <20210816100927.3548826-1-gjb@semihalf.com> From: "Sami Mujawar" Message-ID: <40c62f50-ee44-ad2d-85ef-e1286f43f69a@arm.com> Date: Fri, 20 Aug 2021 13:04:31 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 In-Reply-To: X-ClientProxiedBy: LO2P265CA0313.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a4::13) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.1.196.43] (217.140.106.54) by LO2P265CA0313.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Fri, 20 Aug 2021 12:04:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d947679e-302f-45be-1a49-08d963d2b312 X-MS-TrafficTypeDiagnostic: AM6PR08MB3544:|VI1PR08MB4287: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:4502;OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: STL0vd4j6yIZQWlOy6lRvhPDLx+W1Bc+XSqSkdEr+27xYARgGm0h6nq0/dRKUIg2eGj7TtPkHKtRLwp2/1Vy2Wu0gXPXgBzFDn30WFvX4PSN/boYDafdDiTV5R5l7N0yf8I5CJvipZbKnbJycA5483QGQYDiBhAttkXeCTFNTip7rUeFyqLLCDBvOalS5EH1CXaGeQkq4VrqKmpp3kzeizhw5TVpKjOOZnc/fZSPStHMiD60IrWUOZt4YOgGmid2Xr9ajrK41zTyAo/pqA2tXZG+fKETcwpxZsPvZTFrK5ccp22FH80BBbI6bGYZ3iWQiRrOr2o6lkwFzzl0LH+NXips+q9iX9HRAE3mLJohUq/1Yb7vOIsOOy1yy1i7iLhMNRtOTWfo0q0lf1XACh91KZg3YTmJL7msyGF7KCoQhGmjX3cd1f2+zNP1ZU1B82+TBjjshP+3XXxcpbc36d4Q5V+eUPz8D40736x/pVQXwIJTu0+jPwlO07mLop+wKc6RtaTLRh+ZmMKeTrHe9Zeya79/0N+NLDT3KJJG91Cs1DJayDdzAnThGeDKpo+mSmgtQdkblTIjBUTpFdtUcdEexIRvL3IcNqTtbIGazeVIODLV03R6BbFRvsYb8Mgzl6Gmc3n0S1jyTzve4bLVD3nm5tJ2tVzYT+Tr/C1RQloZhRiPwtX8oqavUp/uWrGYPPMVhmnP7GjWUVwFig6PyCaBw/46tY8vF5QRFpwlAlsVAVgcNqq68D2y+1VLdivKhrCGDPeOADZb5ZCmjnOGUBQ7Tw== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR08MB6806.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(346002)(136003)(396003)(366004)(376002)(66476007)(8936002)(53546011)(2906002)(26005)(33964004)(66556008)(5660300002)(186003)(83380400001)(66946007)(36756003)(956004)(110136005)(38100700002)(44832011)(8676002)(38350700002)(86362001)(54906003)(6486002)(31696002)(16576012)(316002)(31686004)(4326008)(2616005)(478600001)(30864003)(52116002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bTBuc1gvOXFnd3F2LzlHM1pVR0ZSS2VMOUFRczg4U3RuM1dwNWFIdittQ1Ur?= =?utf-8?B?eDFtMFprUmpIR2tZRUhpcVVxZ041dUFLdW1tRS82SnFmYkpvZENyYU05Nmpz?= =?utf-8?B?Si9ZaVVML3ROTy9xZUwvTVA0dzJZSVg1ejF5Rm4yTk51K2p0MFM3dmRGZXZo?= =?utf-8?B?U2EwSFI2S2ljZWpvdUxyM0dTQU9kRnQ0WkYxYnJZNTZGQlFrM2FWNmVSZVlR?= =?utf-8?B?ZUpteE0yMUdUY1hVckcxRFBCVXhHM1d2TlJGOEZsUkhrR3BsTFFiUUd5dUJI?= =?utf-8?B?bUtoUnU2bEtNeFVTaERmYVBic0FXcXhkU0c5YS9KRjZUeUx6MUp2S29FSjJP?= =?utf-8?B?OVJ5bkxPOFhRckpuZGRWSnpEOEQrT05HcTZsc0dCMTZDcXExYVh2TEI4T3ha?= =?utf-8?B?M3ZnOStUSFlCcjIvS1VuS3dWMTZJLzFlSmpYR1c3SGNxRlBqSzVKOHN6VDVm?= =?utf-8?B?UVdEMzJJYllrdXJ5MGJQMjRZUUR5YUM5aVUxdkpuSm9yUUVXMWJ6b1VHYUpV?= =?utf-8?B?Y0lrQXNlZFNiSmJNYlBrYkVucTlYL05SL0JNWE91bkRHU21IMmpMbzVOcWdS?= =?utf-8?B?dlJROGFvYnAwbVNXaXdnSWhWSGh0cXdBMGdKTjVCL2Q0d0lCOGhsemFWdTB1?= =?utf-8?B?dTYrOElUVmhpdmgvMFBpWVBmWnQ5cU03bzlUOTVaVFhFRy8vNlpEMDFtV3Yw?= =?utf-8?B?UTZ1MTRyWForaUVVN2oyOEhRV3FUdG1kRElXOHJzSWt2bXh3MVNGSEJkd3dn?= =?utf-8?B?Wkg0ZGh6dHBuL0RDdXZBa0d0ZzlhdEQzeUlhaEtJSjc5cEcrd0RneE1TY0lu?= =?utf-8?B?SlBXN1pZTWJpaDZENVhIek9sU3RPeWI2a1plaFdwQWozNnZjY1ZLcElSeTkz?= =?utf-8?B?MlB6OXMvSitGTEZJK0Vzc1RZTFQ1Tmc5L3VnMjJUbS9PdjFhQ0NJMnhaM0t5?= =?utf-8?B?dEZ6VEZhb2tUbVlkUVFlS2IxWVp2V2Fsd2F2UCtYRi9KMy9DNmE0TWVqbTJJ?= =?utf-8?B?WDl3bVBTS3FXcVdGNGRuVy9JaE8vRmtpM2kxclpZSGY2WTkzc3pUczdyM1g5?= =?utf-8?B?aHd3MHJVL2FnT1YrMDB4T09mVlA2a0U0QkZZU1hCdTJqOCtWZzhwK0ZIOW9S?= =?utf-8?B?RFZhRDBoWm4xckFzSVgyN2hyU0Y3QlhJbGloa2VuWG1VM0FoK21FNy9WWloz?= =?utf-8?B?aGtWVEd4SW0xSDE1YWNGZ0lsekpGWVQ1alNLMlMzUks2NEVFWkxtYlRrMTB0?= =?utf-8?B?UjljWjZodE1aOFQwVTdsMTc1ZytvbCtxdEF0U21yVUZ3UlFCakhJZGhtak5U?= =?utf-8?B?TGVFbnc0N3J3bGxSOHRBelVjeDR4SkZEOGJuOVNhQnAzUWZnOUFCQnJZRFEv?= =?utf-8?B?aDJYWG1SVHcxSlZIODdWdmlOOWFPUVRSLy96T0cwMGV6U0lYTjk5aDJYTyt6?= =?utf-8?B?VXlaVHVtUDE2WnpTVTY0ZFF4Y3FpdjBFVmE4U2tCSnhNMG5nR3N0dE5CVEsv?= =?utf-8?B?V2hPUlJjdEVqNWlKeHhOeXVCaXlkVCtMWmxyZEFlbldnNVJac1NFaVl4RGJq?= =?utf-8?B?aStOZjcvUnhsVk9PNG9nNDMwRStkVEF5d1E1L01uenJkcXYwbW0vaHlJenNa?= =?utf-8?B?Snc5dlQ2MjZyZHM2dWVveHM3NXF6dmN5SnFqb1ZXQmJXT09oRWkrSXpFQ2dI?= =?utf-8?B?KzRCQktQSVBIdDlJdHlvNXpIV2RoQlpNMXJoOFQzcXZ5amNPZUhZOEsyQkdM?= =?utf-8?Q?MPW4VRAARWWp1jra1M1MDz6J6kIZ9a+bHN/JqQ1?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3544 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 4f078987-4e67-46d6-989f-08d963d2ac07 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FQKfu/v8/E0ugLIfBp70catp0T8vpqVv0O6QEY2/VWPUNvhgb8ay+L0h+QoZDkNll1lsRE4q+7nQt9e0qqnvaEpqLmM/9LWIEWgPPL6d88djOtoK47LhcbWxawaTAEoZxvwkZNfdEBidto1QhITkYuGIbP+x3kQZ4CZB4GoyVd07yS/uI9cmOYsnrLGsCGpcKmmTOdWx6xCLNcreFs54CZsqoWabBaq/x2U/p/ikSfAtbhq3bCzBjsI1xiq41E/0NLKcgCsB3etdyX4Ug0dnPZH0DuO6quWRgcNg4ICgalx7QmegdvJwRo/2uIuQtcrZ1rk6IAWz7TroGZifm41kJaHuGkMPybO4y/grMSdNcwCLtkxkB435BUN0P9gpfDyt9cGgrpcJPrEemPLgGk70H5A4mBF3qollGNH9FyPmMIn+tKbFFOiqz1k7103pfm93+h34hNnPJ62ihyGvjvFlmo9TmTrukLnM2Oqp2z92nZdL+l+7VkOjERLXuys9h2EmcoKcI3jl2pByRyqInf4yXdiKG+M5Ux37ShHXVUbZUJva2XDPS0MWteVXWYv0KRF2DE0GdpGfF2tdKOYS5b7M4lf2AOFnTdzMTcgmKLUd3qkA3B3lhAa+gUaKl/63UQ7jwjDpfOB6D/yET3xwJYNg97lUQvF09p47m5Pc1gMiuUXb0Mfa0bAvas9hZtApLLscSZrFJo0XE60xjd0ipEw1RMP7QLlD8G9U9O9CPoK6QnM= 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)(136003)(346002)(396003)(376002)(39860400002)(46966006)(36840700001)(2906002)(30864003)(186003)(5660300002)(44832011)(26005)(8936002)(4326008)(110136005)(336012)(47076005)(83380400001)(33964004)(70206006)(478600001)(82310400003)(8676002)(53546011)(31696002)(86362001)(36860700001)(54906003)(6486002)(956004)(2616005)(356005)(316002)(70586007)(16576012)(31686004)(36756003)(82740400003)(81166007)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2021 12:04:44.8145 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d947679e-302f-45be-1a49-08d963d2b312 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: DB5EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4287 Content-Type: multipart/alternative; boundary="------------A76982A1BA27A816BD70728E" Content-Language: en-GB --------------A76982A1BA27A816BD70728E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi Grzegorz, Thank you for this patch. I have a few minor suggestions, otherwise this patch looks good to me. I have tested this patch on FVP and Juno and both platforms work fine. Reviewed-by: Sami Mujawar Regards, Sami Mujawar On 18/08/2021 08:43 PM, Samer El-Haj-Mahmoud wrote: > + Sami for ArmPkg review > >> -----Original Message----- >> From: Grzegorz Bernacki >> Sent: Monday, August 16, 2021 6:09 AM >> To: devel@edk2.groups.io >> Cc: leif@nuviainc.com; ardb+tianocore@kernel.org; Samer El-Haj-Mahmoud >> ; Sunny Wang >> ; mw@semihalf.com; upstream@semihalf.com; >> Grzegorz Bernacki >> Subject: [edk2-platforms PATCH v2] 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.inf >> 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/Library/PlatformBootManagerLib/PlatformBm.c >> index 5ceb23d822..ef5c323743 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 successfully 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 = sizeof (DiscoveryPolicy); >> + Status = gRT->GetVariable ( >> + BOOT_DISCOVERY_POLICY_VAR, >> + &gBootDiscoveryPolicyMgrFormsetGuid, >> + NULL, >> + &Size, >> + &DiscoveryPolicy >> + ); >> + if (Status == EFI_NOT_FOUND) { >> + Status = PcdSet32S (PcdBootDiscoveryPolicy, PcdGet32 >> (PcdBootDiscoveryPolicy)); >> + if (Status == EFI_NOT_FOUND) { >> + return EFI_SUCCESS; >> + } else if (EFI_ERROR (Status)) { >> + return Status; >> + } >> + DiscoveryPolicy = PcdGet32 (PcdBootDiscoveryPolicy); [SAMI] Can 'DiscoveryPolicy' be initialised a few lines above and used in the call to PcdSet32S ()? >> + } else if (EFI_ERROR (Status)) { >> + return Status; >> + } >> + >> + if (DiscoveryPolicy == BDP_CONNECT_MINIMAL) { >> + return EFI_SUCCESS; >> + } >> + >> + switch (DiscoveryPolicy) { >> + case BDP_CONNECT_NET: >> + Class = &gEfiBootManagerPolicyNetworkGuid; >> + break; >> + case BDP_CONNECT_ALL: >> + Class = &gEfiBootManagerPolicyConnectAllGuid; >> + break; >> + default: >> + DEBUG (( >> + DEBUG_INFO, >> + "%a - Unexpected DiscoveryPolicy (0x%x). Run Minimal Discovery >> Policy\n", >> + __FUNCTION__, >> + DiscoveryPolicy >> + )); >> + return EFI_SUCCESS; >> + } >> + >> + Status = gBS->LocateProtocol ( >> + &gEfiBootManagerPolicyProtocolGuid, >> + NULL, >> + (VOID **)&BMPolicy >> + ); >> + if (EFI_ERROR (Status)) { >> + DEBUG ((DEBUG_INFO, "%a - Failed to locate >> gEfiBootManagerPolicyProtocolGuid." >> + "Driver connect will be skipped.\n", __FUNCTION__)); >> + return Status; >> + } >> + >> + Status = BMPolicy->ConnectDeviceClass (BMPolicy, Class); >> + if (EFI_ERROR (Status)){ >> + DEBUG ((DEBUG_ERROR, "%a - ConnectDeviceClass returns - %r\n", >> __FUNCTION__, Status)); >> + return Status; >> + } >> + >> + EfiBootManagerRefreshAllBootOption(); [SAMI] Please add a space after the function name and the opening parenthesis. >> + >> + 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 --------------A76982A1BA27A816BD70728E Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

Hi Grzegorz,

Thank you for this patch. I have a few minor suggestions, otherwise this patch looks good to me.

I have tested this patch on FVP and Juno and both platforms work fine.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>

Regards,

Sami Mujawar


On 18/08/2021 08:43 PM, Samer El-Haj-Mahmoud wrote:
+ Sami for ArmPkg review

-----Original Message-----
From: Grzegorz Bernacki <gjb@semihalf.com>
Sent: Monday, August 16, 2021 6:09 AM
To: devel@edk2.groups.io
Cc: leif@nuviainc.com; ardb+tianocore@kernel.org; Samer El-Haj-Mahmoud
<Samer.El-Haj-Mahmoud@arm.com>; Sunny Wang
<Sunny.Wang@arm.com>; mw@semihalf.com; upstream@semihalf.com;
Grzegorz Bernacki <gjb@semihalf.com>
Subject: [edk2-platforms PATCH v2] 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 <gjb@semihalf.com>
---
 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.inf
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/Library/PlatformBootManagerLib/PlatformBm.c
index 5ceb23d822..ef5c323743 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.<BR>
+  Copyright (c) 2014 - 2021, ARM Ltd. All rights reserved.<BR>
   Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
   Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
+  Copyright (c) 2021, Semihalf All rights reserved.<BR>

   SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -19,6 +20,7 @@
 #include <Library/UefiBootManagerLib.h>
 #include <Library/UefiLib.h>
 #include <Library/UefiRuntimeServicesTableLib.h>
+#include <Protocol/BootManagerPolicy.h>
 #include <Protocol/DevicePath.h>
 #include <Protocol/EsrtManagement.h>
 #include <Protocol/GraphicsOutput.h>
@@ -27,6 +29,7 @@
 #include <Protocol/PciIo.h>
 #include <Protocol/PciRootBridgeIo.h>
 #include <Protocol/PlatformBootManager.h>
+#include <Guid/BootDiscoveryPolicy.h>
 #include <Guid/EventGroup.h>
 #include <Guid/NonDiscoverableDevice.h>
 #include <Guid/TtyTerm.h>
@@ -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 successfully 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 = sizeof (DiscoveryPolicy);
+  Status = gRT->GetVariable (
+                  BOOT_DISCOVERY_POLICY_VAR,
+                  &gBootDiscoveryPolicyMgrFormsetGuid,
+                  NULL,
+                  &Size,
+                  &DiscoveryPolicy
+                  );
+  if (Status == EFI_NOT_FOUND) {
+    Status = PcdSet32S (PcdBootDiscoveryPolicy, PcdGet32
(PcdBootDiscoveryPolicy));
+    if (Status == EFI_NOT_FOUND) {
+      return EFI_SUCCESS;
+    } else if (EFI_ERROR (Status)) {
+      return Status;
+    }
+    DiscoveryPolicy = PcdGet32 (PcdBootDiscoveryPolicy);
[SAMI] Can 'DiscoveryPolicy' be initialised a few lines above and used in the call to PcdSet32S ()?
+  } else if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  if (DiscoveryPolicy == BDP_CONNECT_MINIMAL) {
+    return EFI_SUCCESS;
+  }
+
+  switch (DiscoveryPolicy) {
+    case BDP_CONNECT_NET:
+      Class = &gEfiBootManagerPolicyNetworkGuid;
+      break;
+    case BDP_CONNECT_ALL:
+      Class = &gEfiBootManagerPolicyConnectAllGuid;
+      break;
+    default:
+      DEBUG ((
+        DEBUG_INFO,
+        "%a - Unexpected DiscoveryPolicy (0x%x). Run Minimal Discovery
Policy\n",
+        __FUNCTION__,
+        DiscoveryPolicy
+        ));
+      return EFI_SUCCESS;
+  }
+
+  Status = gBS->LocateProtocol (
+                  &gEfiBootManagerPolicyProtocolGuid,
+                  NULL,
+                  (VOID **)&BMPolicy
+                  );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_INFO, "%a - Failed to locate
gEfiBootManagerPolicyProtocolGuid."
+      "Driver connect will be skipped.\n", __FUNCTION__));
+    return Status;
+  }
+
+  Status = BMPolicy->ConnectDeviceClass (BMPolicy, Class);
+  if (EFI_ERROR (Status)){
+    DEBUG ((DEBUG_ERROR, "%a - ConnectDeviceClass returns - %r\n",
__FUNCTION__, Status));
+    return Status;
+  }
+
+  EfiBootManagerRefreshAllBootOption();
[SAMI] Please add a space after the function name and the opening parenthesis.
+
+  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

    

--------------A76982A1BA27A816BD70728E--