From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.92]) by mx.groups.io with SMTP id smtpd.web12.4033.1634974810364695671 for ; Sat, 23 Oct 2021 00:40:10 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=Mg2sgI7z; spf=pass (domain: os.amperecomputing.com, ip: 40.107.244.92, mailfrom: nhi@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uv6rZW3HkU5Mq0yEpMNP80hhhfbECiZVNzprajYx02cZcnXyIK6U3TMQJEEHnaS8CK0aNEj+oyGWkFWpLkb3txnpBDxDk5a1/eaNtl26wWGmdYntI8qVtJn7mQUIzg8roqQyj/Y7GBvXD+SDRpHjQVGW97fU90p0nr9yHU5WuydJIbQ5hGcdbWSCUCQ7VsgUNYcKsMHCJUwtvyEaEhcAQ8gCASpzhzBjPJt8cEeEHCKU4w0SIiJPEWJu9wLyEcBDorGOb+5hnbh4YGBM7+WMNHM3Hq+Djiv33dZRrJsS+HUm5jbEv/SrW8OCnnBJlJjSG2z/X7OwTyry9XQ5/I99wA== 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=UnIVKLyD6kcmZt65nzpYfnncUWFirIx6uBFBrcRRoPA=; b=bEXZwlxeKqgm7M2EVhHSlm2YQUBWqWV0/jQAV3IpQBZbyhL4MtH5IMS9TJThUgebqNyU+rZ4a0/KFx/Zbu8PXjLfnM1JRXx6SQ082Olh9k83h4RptOeOvXaiJCx6TKvb83qLCzF3I5yPvpCPFnh0t9NVkHlnBG/1Ks87Ps1X0CzG8XFp4QpIk+XlL9ZOsdtrh1jZBv6JnXPQp8i4rl/CqrORqFVyC9NJxlz4rKbImMNtNFSTZWF3tIBVTXzBFF1ay4nX41Wo19ihHjl3tz4URctQXAIvfAu5VAe3EQDh5fgYHqntDkK/VpPdEhbqYGFqbYrOpVUxcblr6EaoaVx4Yg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UnIVKLyD6kcmZt65nzpYfnncUWFirIx6uBFBrcRRoPA=; b=Mg2sgI7zaQl7TX4PF0sdOGHT3IssaLErZ36QmDkJwfr5iUXTDbvjoRbeaRfEDfI8VzyPQ5WNv4Su7aGZgSDrLF26nFJ25jiBbnUOh0gW3a4qAbFjjouJhnDmznvrHGI1q090hE72O+PeKdjFWfYn2drU6F3pYDyFmZHQEiZzOTM= Authentication-Results: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6588.prod.exchangelabs.com (2603:10b6:510:90::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16; Sat, 23 Oct 2021 07:40:07 +0000 Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4628.018; Sat, 23 Oct 2021 07:40:07 +0000 Message-ID: <1cad7634-9b64-1374-95b7-6943f7213b6c@os.amperecomputing.com> Date: Sat, 23 Oct 2021 14:39:59 +0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [edk2-devel] [PATCH v2 1/1] ArmPkg: Implement PlatformBootManagerLib for LinuxBoot To: Moritz Fischer , ardb@kernel.org Cc: devel@edk2.groups.io, Samer El-Haj-Mahmoud , "patches@amperecomputing.com" , Leif Lindholm , Ard Biesheuvel , Jeff Booher-Kaeding References: <20210907033857.18848-1-nhi@os.amperecomputing.com> From: "Nhi Pham" In-Reply-To: X-ClientProxiedBy: HK0PR03CA0098.apcprd03.prod.outlook.com (2603:1096:203:b0::14) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) Return-Path: nhi@os.amperecomputing.com MIME-Version: 1.0 Received: from [192.168.1.2] (113.180.2.100) by HK0PR03CA0098.apcprd03.prod.outlook.com (2603:1096:203:b0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16 via Frontend Transport; Sat, 23 Oct 2021 07:40:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dd4c8cb3-7abd-4e83-3609-08d995f855ec X-MS-TrafficTypeDiagnostic: PH0PR01MB6588: X-LD-Processed: 3bc2b170-fd94-476d-b0ce-4229bdc904a7,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Dt/acUmiAzznUMMDVdiTb0RhvTEAZf5N0YRR7p4IN91S5t8j4A7bhzuQk3qTa8K7AZ8s29APi7sAwD4ZcAVvyLVOejH2snDo+sjQL3BXgHcjC9oDH0N874xFCU287vuKoriZ6uLyFYNB7XjK/IkyUKYEAj0VIlx8xegyDVXl/fu3PMuT45PSvSgUx5xihITNVv5iGtGa1YGDXCSh5frbh8QTYn+GWZVOfzbl+gofW5SIOQ+uFavc+l2xgXkA2CGfSRVKnAlFQB8MHiNBSim6+7KTB+JQo4B2qG8N46gEipyHV0cmvXAir+YE7J36y7hkNC9N1LOv3PlNFZizBQknYUSh5Xjc5Eg6JllsJOlc9I8tydueA4zShk66TCEkE8tu28XRqOL2WvQtIFEdedR7sftIP0x6/WRKCA37ve9BqJe4djqDetJ7dQok+67E7YBrO7SFj1KzYcVLEsv0MvauSwrxEXw2D9PqZz+fX5KdgAQJneL9+/N5iMzN1Dt03gg/xr0W60ID4WQYqG4GWtgQs7uaiqhe+RAiwdzfZ6rAK5PEonnxwQ4TkWdUJ0bCi46/7HA5k8OB9OCqNb2u3bUEkxKyAt409UvThO/m6WSzKBD6P15FyZDTfvYHURYbYn0nzajFjyk0HNiETmI9K27RB51oWLEpBPqxpIAtQX1GAhX+1XRjqvcqQRUrxDqCzaHm0T8+CD6KTU7be5jhi5/UpXlWVUQ4NJqtCAb1m1kh4p0CWV9ZB1jj0nePk8u18e1jXwGbtyO24X4hqJ31ctXDi8xzgd11pbYUc7bq1K/PZudiwhezdF7TRebgfjVtTUR+/i1KMJQF0WnZrTTqT9DjlGZccwxlhbIDcKsyMwGz4Ne6ftjbY5saaC1eai1NzXCk X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR01MB7287.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(966005)(16576012)(2616005)(45080400002)(956004)(316002)(38350700002)(508600001)(2906002)(8936002)(186003)(38100700002)(52116002)(6486002)(26005)(4326008)(8676002)(53546011)(54906003)(6666004)(31696002)(5660300002)(66476007)(86362001)(66556008)(66946007)(31686004)(30864003)(83380400001)(9186005)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SXlMY1hhZ3RNa0NRNVRZVXk4RTdOVjd3Q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eU56?= =?utf-8?B?ZERMdTBOWXZFYnpwci9IWDdiRG03c0dDYVE2b3JGOWNSZ3ZqSGtYcUgvSkZE?= =?utf-8?B?cXZhVUI2WVUxU1NEUEdTc0pYdDRxaStsM0QwdlpjQ3hDL29UOHZTVHZpQVQ0?= =?utf-8?B?RjJXYy84VlR0a1Jwb2ErVDQ2Y29iVExHbys1cmpXUGhXZ2xnZlR2bldaNDVu?= =?utf-8?B?R09ZdmdNbUFMNi9GaVArRzVGcnJkVkRlZmhzbXNrS0c3MnhTWnRGNS9TS050?= =?utf-8?B?c0o5TmtCNSszdWlPaGNBaW8yR0R1STFpUGdOd3RGKzdTRzdUZktKcS8xSjNT?= =?utf-8?B?N3BGa0lFU0JDZ21KRFJYYmpKN2FHQWpWakRGSFlpSkpSWC95WXRDejR2N05l?= =?utf-8?B?dmFuZlNKcnJDMlMxTm9NcGN1Z283eDlSSDBVSGY0NVJqY3ZWb1N6R3BXMlNQ?= =?utf-8?Q?/ncK8FeQzujM9Qm06dJrpRv/H9XKi6Tt0GBgqA+Un0=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd4c8cb3-7abd-4e83-3609-08d995f855ec X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2021 07:40:07.8156 (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: 0Qn43n2TXk+VMPJRndd8060G1JVjZbHXNcqD6WpNUtjSGaiw4XpWfbCNG0K8L34f8M+HExOY6GQVc3lB8B5QSl8BH0Yq5Q/micb4RYihCsk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6588 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Ard, I've just sent the v3 for fixing this CI issue. Please help check it. v3 patch: https://edk2.groups.io/g/devel/message/82598 On 23/10/2021 09:34, Moritz Fischer wrote: > On Fri, Oct 22, 2021 at 11:08 AM Ard Biesheuvel wrote: >> This patch triggers CI failures >> >> https://github.com/tianocore/edk2/pull/2114 >> >> Please take a look and resubmit if there is anything to fix. > Looks like a missing comment? Thanks, Moritz for pointing out. Best regards, Nhi >> On Wed, 13 Oct 2021 at 20:43, Samer El-Haj-Mahmoud >> wrote: >>> Ackd-by: Samer El-Haj-Mahmoud > Acked-by: Moritz Fischer >>> Any update on getting this reviewed/merged? We have downstream platforms that depend on this and would like to avoid duplication of similar functionality in platform code. >>> >>> Thanks! >>> --Samer >>> >>> >>>> -----Original Message----- >>>> From: devel@edk2.groups.io On Behalf Of Ard >>>> Biesheuvel via groups.io >>>> Sent: Wednesday, September 22, 2021 7:49 AM >>>> To: Nhi Pham >>>> Cc: edk2-devel-groups-io ; >>>> patches@amperecomputing.com; Leif Lindholm ; Ard >>>> Biesheuvel >>>> Subject: Re: [edk2-devel] [PATCH v2 1/1] ArmPkg: Implement >>>> PlatformBootManagerLib for LinuxBoot >>>> >>>> On Tue, 7 Sept 2021 at 05:40, Nhi Pham >>>> wrote: >>>>> LinuxBoot is a firmware that replaces specific firmware functionality >>>>> like the UEFI DXE phase with a Linux kernel and runtime. It is built-in >>>>> UEFI image like an application, which is executed at the end of DXE >>>>> phase. >>>>> >>>>> To achieve the LinuxBoot boot flow "SEC->PEI->DXE->BDS->LinuxBoot", >>>>> today we use the common well-known GUID of UEFI Shell for LinuxBoot >>>>> payload, so LinuxBoot developers can effortlessly find the UEFI Shell >>>>> Application and replace it with the LinuxBoot payload without >>>>> recompiling platform EDK2 (There might be an issue with a few systems >>>>> that don't have a UEFI Shell). Also, we have a hard requirement to force >>>>> the BDS to boot into the LinuxBoot as it is essentially required that >>>>> only the LinuxBoot boot option is permissible and UEFI is an >>>>> intermediate bootstrap phase. Considering all the above, it is >>>>> reasonable to just have a new GUID for LinuxBoot and require a LinuxBoot >>>>> specific BDS implementation. In addition, with making the BDS >>>>> implementation simpler, we can reduce many DXE drivers which we think it >>>>> is not necessary for LinuxBoot booting. >>>>> >>>>> This patch adds a new PlatformBootManagerLib implementation which >>>>> registers only the gArmTokenSpaceGuid.PcdLinuxBootFileGuid for >>>> LinuxBoot >>>>> payload as an active boot option. It allows BDS to jump to the LinuxBoot >>>>> quickly by skipping the UiApp and UEFI Shell. >>>>> >>>>> The PlatformBootManagerLib library derived from >>>>> ArmPkg/Library/PlatformBootManagerLib. >>>>> >>>>> Cc: Leif Lindholm >>>>> Cc: Ard Biesheuvel >>>>> >>>>> Signed-off-by: Nhi Pham >>>> Acked-by: Ard Biesheuvel >>>> >>>>> --- >>>>> ArmPkg/ArmPkg.dec | 8 + >>>>> ArmPkg/ArmPkg.dsc | 2 + >>>>> ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBootManagerLib.inf >>>> | 58 +++++++ >>>>> ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBm.c | 178 >>>> ++++++++++++++++++++ >>>>> 4 files changed, 246 insertions(+) >>>>> >>>>> diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec >>>>> index 214b2f589217..f68e6ee00860 100644 >>>>> --- a/ArmPkg/ArmPkg.dec >>>>> +++ b/ArmPkg/ArmPkg.dec >>>>> @@ -3,6 +3,7 @@ >>>>> # >>>>> # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
>>>>> # Copyright (c) 2011 - 2021, ARM Limited. All rights reserved. >>>>> +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved. >>>>> # >>>>> # SPDX-License-Identifier: BSD-2-Clause-Patent >>>>> # >>>>> @@ -382,3 +383,10 @@ [PcdsFixedAtBuild.common, >>>> PcdsDynamic.common] >>>>> # >>>>> gArmTokenSpaceGuid.PcdPciBusMin|0x0|UINT32|0x00000059 >>>>> gArmTokenSpaceGuid.PcdPciBusMax|0x0|UINT32|0x0000005A >>>>> + >>>>> +[PcdsDynamicEx] >>>>> + # >>>>> + # This dynamic PCD hold the GUID of a firmware FFS which contains >>>>> + # the LinuxBoot payload. >>>>> + # >>>>> + gArmTokenSpaceGuid.PcdLinuxBootFileGuid|{0x0}|VOID*|0x0000005C >>>>> diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc >>>>> index 926986cf7fbb..ffb1c261861e 100644 >>>>> --- a/ArmPkg/ArmPkg.dsc >>>>> +++ b/ArmPkg/ArmPkg.dsc >>>>> @@ -5,6 +5,7 @@ >>>>> # Copyright (c) 2011 - 2021, Arm Limited. All rights reserved.
>>>>> # Copyright (c) 2016, Linaro Ltd. All rights reserved.
>>>>> # Copyright (c) Microsoft Corporation.
>>>>> +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved. >>>>> # >>>>> # SPDX-License-Identifier: BSD-2-Clause-Patent >>>>> # >>>>> @@ -150,6 +151,7 @@ [Components.common] >>>>> >>>> ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf >>>> ArmPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf >>>>> ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf >>>>> + >>>> ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBootManagerLib.inf >>>>> ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.inf >>>>> ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf >>>>> diff --git >>>> a/ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBootManagerLib.inf >>>> b/ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBootManagerLib.inf >>>>> new file mode 100644 >>>>> index 000000000000..139b6171990a >>>>> --- /dev/null >>>>> +++ >>>> b/ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBootManagerLib.inf >>>>> @@ -0,0 +1,58 @@ >>>>> +## @file >>>>> +# Implementation for PlatformBootManagerLib library class interfaces. >>>>> +# >>>>> +# Copyright (C) 2015-2016, Red Hat, Inc. >>>>> +# Copyright (c) 2014, ARM Ltd. All rights reserved.
>>>>> +# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
>>>>> +# Copyright (c) 2016, Linaro Ltd. All rights reserved.
>>>>> +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights >>>> reserved.
>>>>> +# >>>>> +# SPDX-License-Identifier: BSD-2-Clause-Patent >>>>> +# >>>>> +## >>>>> + >>>>> +[Defines] >>>>> + INF_VERSION = 0x0001001B >>>>> + BASE_NAME = LinuxBootBootManagerLib >>>>> + FILE_GUID = 1FA91547-DB23-4F6A-8AF8-3B9782A7F917 >>>>> + MODULE_TYPE = DXE_DRIVER >>>>> + VERSION_STRING = 1.0 >>>>> + LIBRARY_CLASS = PlatformBootManagerLib|DXE_DRIVER >>>>> + >>>>> +# >>>>> +# The following information is for reference only and not required by the >>>> build tools. >>>>> +# >>>>> +# VALID_ARCHITECTURES = ARM AARCH64 >>>>> +# >>>>> + >>>>> +[Sources] >>>>> + LinuxBootBm.c >>>>> + >>>>> +[Packages] >>>>> + ArmPkg/ArmPkg.dec >>>>> + MdeModulePkg/MdeModulePkg.dec >>>>> + MdePkg/MdePkg.dec >>>>> + ShellPkg/ShellPkg.dec >>>>> + >>>>> +[LibraryClasses] >>>>> + BaseLib >>>>> + BaseMemoryLib >>>>> + DebugLib >>>>> + MemoryAllocationLib >>>>> + PcdLib >>>>> + PrintLib >>>>> + UefiBootManagerLib >>>>> + UefiBootServicesTableLib >>>>> + UefiLib >>>>> + UefiRuntimeServicesTableLib >>>>> + >>>>> +[Pcd] >>>>> + gArmTokenSpaceGuid.PcdLinuxBootFileGuid >>>>> + >>>>> +[Guids] >>>>> + gEfiEndOfDxeEventGroupGuid >>>>> + gUefiShellFileGuid >>>>> + gZeroGuid >>>>> + >>>>> +[Protocols] >>>>> + gEfiLoadedImageProtocolGuid >>>>> diff --git a/ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBm.c >>>> b/ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBm.c >>>>> new file mode 100644 >>>>> index 000000000000..f4941780efcd >>>>> --- /dev/null >>>>> +++ b/ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBm.c >>>>> @@ -0,0 +1,178 @@ >>>>> +/** @file >>>>> + Implementation for PlatformBootManagerLib library class interfaces. >>>>> + >>>>> + Copyright (C) 2015-2016, Red Hat, Inc. >>>>> + Copyright (c) 2014 - 2019, ARM Ltd. All rights reserved.
>>>>> + Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
>>>>> + Copyright (c) 2016, Linaro Ltd. All rights reserved.
>>>>> + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights >>>> reserved.
>>>>> + >>>>> + SPDX-License-Identifier: BSD-2-Clause-Patent >>>>> + >>>>> +**/ >>>>> + >>>>> +#include >>>>> + >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> + >>>>> +STATIC >>>>> +VOID >>>>> +PlatformRegisterFvBootOption ( >>>>> + CONST EFI_GUID *FileGuid, >>>>> + CHAR16 *Description, >>>>> + UINT32 Attributes >>>>> + ) >>>>> +{ >>>>> + EFI_STATUS Status; >>>>> + INTN OptionIndex; >>>>> + EFI_BOOT_MANAGER_LOAD_OPTION NewOption; >>>>> + EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions; >>>>> + UINTN BootOptionCount; >>>>> + MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode; >>>>> + EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; >>>>> + EFI_DEVICE_PATH_PROTOCOL *DevicePath; >>>>> + >>>>> + Status = gBS->HandleProtocol ( >>>>> + gImageHandle, >>>>> + &gEfiLoadedImageProtocolGuid, >>>>> + (VOID **)&LoadedImage >>>>> + ); >>>>> + ASSERT_EFI_ERROR (Status); >>>>> + >>>>> + EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid); >>>>> + DevicePath = DevicePathFromHandle (LoadedImage->DeviceHandle); >>>>> + ASSERT (DevicePath != NULL); >>>>> + DevicePath = AppendDevicePathNode ( >>>>> + DevicePath, >>>>> + (EFI_DEVICE_PATH_PROTOCOL *)&FileNode >>>>> + ); >>>>> + ASSERT (DevicePath != NULL); >>>>> + >>>>> + Status = EfiBootManagerInitializeLoadOption ( >>>>> + &NewOption, >>>>> + LoadOptionNumberUnassigned, >>>>> + LoadOptionTypeBoot, >>>>> + Attributes, >>>>> + Description, >>>>> + DevicePath, >>>>> + NULL, >>>>> + 0 >>>>> + ); >>>>> + ASSERT_EFI_ERROR (Status); >>>>> + FreePool (DevicePath); >>>>> + >>>>> + BootOptions = EfiBootManagerGetLoadOptions ( >>>>> + &BootOptionCount, >>>>> + LoadOptionTypeBoot >>>>> + ); >>>>> + >>>>> + OptionIndex = EfiBootManagerFindLoadOption ( >>>>> + &NewOption, >>>>> + BootOptions, >>>>> + BootOptionCount >>>>> + ); >>>>> + >>>>> + if (OptionIndex == -1) { >>>>> + Status = EfiBootManagerAddLoadOptionVariable (&NewOption, >>>> MAX_UINTN); >>>>> + ASSERT_EFI_ERROR (Status); >>>>> + } >>>>> + EfiBootManagerFreeLoadOption (&NewOption); >>>>> + EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount); >>>>> +} >>>>> + >>>>> +/** >>>>> + Do the platform specific action before the console is connected. >>>>> + >>>>> + Such as: >>>>> + Update console variable; >>>>> + Register new Driver#### or Boot####; >>>>> + Signal ReadyToLock event. >>>>> +**/ >>>>> +VOID >>>>> +EFIAPI >>>>> +PlatformBootManagerBeforeConsole ( >>>>> + VOID >>>>> + ) >>>>> +{ >>>>> + // >>>>> + // Signal EndOfDxe PI Event >>>>> + // >>>>> + EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid); >>>>> +} >>>>> + >>>>> +/** >>>>> + Do the platform specific action after the console is connected. >>>>> + >>>>> + Such as: >>>>> + Dynamically switch output mode; >>>>> + Signal console ready platform customized event; >>>>> + Run diagnostics like memory testing; >>>>> + Connect certain devices; >>>>> + Dispatch additional option roms. >>>>> +**/ >>>>> +VOID >>>>> +EFIAPI >>>>> +PlatformBootManagerAfterConsole ( >>>>> + VOID >>>>> + ) >>>>> +{ >>>>> + EFI_GUID LinuxBootFileGuid; >>>>> + >>>>> + CopyGuid (&LinuxBootFileGuid, PcdGetPtr (PcdLinuxBootFileGuid)); >>>>> + >>>>> + if (!CompareGuid (&LinuxBootFileGuid, &gZeroGuid)) { >>>>> + // >>>>> + // Register LinuxBoot >>>>> + // >>>>> + PlatformRegisterFvBootOption ( >>>>> + &LinuxBootFileGuid, >>>>> + L"LinuxBoot", >>>>> + LOAD_OPTION_ACTIVE >>>>> + ); >>>>> + } else { >>>>> + DEBUG ((DEBUG_ERROR, "%a: PcdLinuxBootFileGuid was not set!\n", >>>> __FUNCTION__)); >>>>> + } >>>>> +} >>>>> + >>>>> +/** >>>>> + This function is called each second during the boot manager waits the >>>>> + timeout. >>>>> + >>>>> + @param TimeoutRemain The remaining timeout. >>>>> +**/ >>>>> +VOID >>>>> +EFIAPI >>>>> +PlatformBootManagerWaitCallback ( >>>>> + UINT16 TimeoutRemain >>>>> + ) >>>>> +{ >>>>> + return; >>>>> +} >>>>> + >>>>> +/** >>>>> + The function is called when no boot option could be launched, >>>>> + including platform recovery options and options pointing to applications >>>>> + built into firmware volumes. >>>>> + >>>>> + If this function returns, BDS attempts to enter an infinite loop. >>>>> +**/ >>>>> +VOID >>>>> +EFIAPI >>>>> +PlatformBootManagerUnableToBoot ( >>>>> + VOID >>>>> + ) >>>>> +{ >>>>> + return; >>>>> +} >>>>> -- >>>>> 2.17.1 >>>>> >>>> >>>> >>>> >>> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please 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. >> >> >> >>