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.128]) by mx.groups.io with SMTP id smtpd.web09.31404.1630986189523471444 for ; Mon, 06 Sep 2021 20:43:09 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=DDUFAmKj; spf=pass (domain: os.amperecomputing.com, ip: 40.107.244.128, mailfrom: nhi@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NFwEbYK251ov+lk61XyS6m2L9N5d+VvBqnC/lULOCLmGGaBT2KcEKmur5HZY7DMA/4Iav9FvF4TttjGIZ0wDJR297/lyg+O+Gk3UoSDxehWAf4F+hkwFSK8oM2uPoXOWE77AAe2+6ST1tYsSik5FG2dlLzhst8F9tkMljf09Brf4OvoJNokUP3QHmHPU77+TtFX9kA4UJzc6FdDRK6bfE8fZYslBMt5xnIem3AnGcMjxsJoPymDxRail6w40ZZBJWr0dG7ge20lclUvtTyim7r9BojfvutHuDv+Pr0aIYgGswZZmIvhTQFFhswi4sxp2DAxaY4Lb3Bvt8rYIiI8KyQ== 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; bh=OXlWxV2l3ZBM39HTobSkutJHVWWw3SqVMYiXOjwoP2A=; b=bZC6RPlk1iPGqynYqv0mAUqwiqjuY5vbZ3wA5FvRyUMt3vJZF/EU/u3Zk5I0F83HtINufh4QA3LuJj0vM1Pht9VkMFj816sMUsLI4reBiHxcvvHKVomDUbaGGEAxZ8XqCnJmJHlJ3Z1nlBxXtKjRoJg1+lTmvsjgeXzGvA+WbjmcGThkv7Py1vkzAoh9NYBOselCRCxKH5OeF8gt10wH9rZtfRA6rQ4/r+2KZBmgE3doA1gVcnwoy79oOgE5NjpRzT2lZyajRc/k0FYCI/D2sQnqEAYfOyV1/L/9YIpIf9OXnMB33GFhpK682Cs6W4bXSJOB3y6cKW1hIdj/RxpsNg== 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=OXlWxV2l3ZBM39HTobSkutJHVWWw3SqVMYiXOjwoP2A=; b=DDUFAmKjj76eG8DonhYAppKPivQ7OZuw6YbE76O8NkLQCLwbKTAWh4Lse6I6kkL1LbOM8H07tax7gXm9URdb4o34kb5oxo1m1zGslfjXEw4WZsaxiGrK6ujnpL3GAkoAawWjkFUTW5zBLu1WcmaXciquoiXvL3E2buyUUXNXwus= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM6PR01MB4057.prod.exchangelabs.com (2603:10b6:5:2e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19; Tue, 7 Sep 2021 03:43:08 +0000 Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4478.025; Tue, 7 Sep 2021 03:43:08 +0000 Subject: Re: [PATCH 1/1] ArmPkg: Implement PlatformBootManagerLib for LinuxBoot To: Ard Biesheuvel Cc: edk2-devel-groups-io , patches@amperecomputing.com, Leif Lindholm , Ard Biesheuvel References: <20210903160529.4531-1-nhi@os.amperecomputing.com> From: "Nhi Pham" Message-ID: <848943e1-93b6-f847-82ad-73b5a7d1417b@os.amperecomputing.com> Date: Tue, 7 Sep 2021 10:42:56 +0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: X-ClientProxiedBy: SG2PR06CA0090.apcprd06.prod.outlook.com (2603:1096:3:14::16) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) Return-Path: nhi@os.amperecomputing.com MIME-Version: 1.0 Received: from [192.168.1.7] (116.110.42.117) by SG2PR06CA0090.apcprd06.prod.outlook.com (2603:1096:3:14::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Tue, 7 Sep 2021 03:43:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2644ff65-d83a-4257-10fa-08d971b19b30 X-MS-TrafficTypeDiagnostic: DM6PR01MB4057: X-MS-Exchange-Transport-Forked: True 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: D6MlmUiM6q0COk833ksQBxL6LI3bEzfdm6VGNkUkLWXK5vBpe4zdAD6v4t155BeZc7BnfJvR68qvKNCWkSFEDUcATH6OzKl0DRQZVUYfYewgkFULpUeTn78qlyLJJkovUumWDqV4cIFFs5e56RhoMn62Od+pj8wuAPzpY79qCabdf3VeLTU06FSxdbXBVxsDKF/YqlEzUbynTG/kvMZjvE454J0ELNQklVIca18Z1cBweEq81wdxHAAlzxM1qufC3IeYE8xWrNNd9WM8QCCYmpQolOQ+8l41GTwWExOlPFHHmOA4JwC9qx+7UjEuU90B0JVgMrOgwak+HCziwelAMXbPbV4r7G91yhP5T6+TygYiuyvxy3KEBlZo983ubKn3/Vu6LB7femmHfIG7QfQj34eY5oHXHP/L8LGNUnAIX2YsGyz24u7hRf3oSk7em3smxFtQ+DdUvXbnu0LojqLpRurlf1KvD7JSvZgUwBAiSZQ9ZZ3sx5EJQRmZ4Je8CA1GYugZ4hD6AFe3OgJ/KMut0Fi0Qu7sl3foaz8M5IojOyXTCqg7MWE8+sidUykPmmOkqukcrNP2Jwik1ktvm739h9qlKR9o52wwT+d77jQVABEysVEWJkhmBAMhYU3ascYx+iWpAcd2oAn59A841kQHyOidEOS4Yv2RvcwUdBfz3cUFuoT9/o4ktlBgt0VESOB1qKkssHXspj2kuaAN/BJFIVzL/j10GVlcAoElvRR+kCIHIbo+kNrQEu75oz1ijWVewlEqIWaJvBJanVGWBKzjFg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR01MB5849.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(39840400004)(396003)(346002)(366004)(136003)(376002)(83380400001)(38100700002)(956004)(38350700002)(31686004)(86362001)(31696002)(6666004)(16576012)(66476007)(5660300002)(66556008)(8936002)(2616005)(4326008)(8676002)(52116002)(6916009)(66946007)(316002)(30864003)(186003)(26005)(478600001)(2906002)(6486002)(45080400002)(54906003)(53546011)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dDRlVVVkYmUydmVXVHF3TFpoUG5GZ21nZ2F3YW1yRk5SZHdzZDhMRDF6ajNN?= =?utf-8?B?NkxuWDFRaThFVHJQMDdUZmgraG5TR1FudHVjd3ZlbldvSnk5QzMzSTh0K0Q1?= =?utf-8?B?VWN5alNkc2FrUkExSEZhVDlMWVFSRmwvQW53bzRMaW5ISDFhUS9Ea1p5Z0RE?= =?utf-8?B?d0xvZmtrTS80clFvcjVaT3VQZ2VZeTBMS3c5ZWdLbnRSRi9Ld1lNVUFtREV1?= =?utf-8?B?ckVEMUF1ZnYzSGp2ZXlyODhSRjFVaHd5MUNscHdIdlpwT3pVenlBc3I5M0Qz?= =?utf-8?B?bzk2YmVMWDRvN29DWFJXOVpVSlg2NWRTR3J1b0RoZmV2cXVsZ2MxWGJtMHIw?= =?utf-8?B?dk5pazBDVzYyekxOMU5WbTNtWTd3RzA4VDBSeWRhTGE2ZE91MVpibHl2SGh6?= =?utf-8?B?NWkvU3d3SGRJYzFPWWJLbGZDZUpyalRqclRxQTFsWGFUaGFMdmpneUxFb3NO?= =?utf-8?B?RjA5MW4rVFpveW5XcXlIOFhITWxGYmU0czlaZHNtS2RidDJLRk83N2UwTGZs?= =?utf-8?B?UGZDSnRCaDBTd1VHUjFRVWhyZEw5dTlCMDRGeHUyb1lKZW1Kbk1vT0tRSXFq?= =?utf-8?B?TmIyRUFWdUU4cDhWU2o0V0d3dEM4VjB2c3g2UCtRUWRPMVpienArWTZWTEs3?= =?utf-8?B?UVpnLzJRUEYzTzhBN0tYQ2NCL3RwYkxWTEw4SDlxc0RsbGRIcmVYdVVzTlRi?= =?utf-8?B?eWVjSlR5U1kvVUxsaHVVdDZYb3VoMzRXaW1WanlNM3hYQ0tJQWtWVkJRaXN6?= =?utf-8?B?ZmVndHZtSHFLYythby9WV3NiSGZLc1ltRkp0d1lXa1pBWFhjbC9nMVd6RXpY?= =?utf-8?B?bGhmRCs1YlUvY1FYK3kzcDU5aExlcTRnQmtzaG80NkI1SVBBY1FNUDFocWtI?= =?utf-8?B?RVpsN05OdzN5RS8vdGEydVdQbGlZRDQzaTRzMTY2U2RoeDFFTFQyMDFqd05G?= =?utf-8?B?VWxBNDR5Y1FtTlNIdEJ3OGpiWDlQVGdRemZleXJHakFvS1ZINVhLajJOL3FK?= =?utf-8?B?WUJrMXFLdlRFT0VYZ3drWnl5eEhNRmRhKzZnTXU5ZXJGMG1ZT2ZmbXF1L0dw?= =?utf-8?B?aVZpT2tjcGV6ekk4Tk5PMGMvaVRXKy9MTWVJcm1kOEJKbDhlVFVlOS8zNk8x?= =?utf-8?B?NGhBUTdzOURqd25LcTNySjUwNllJcFVKeUs1Zm5uSWw0Z3hvK1I0b3JnbVE4?= =?utf-8?B?cUpSL1BSeHVVSWFETkxxUGtwLzM5R2E0aFJYL1VaWmJmSUt4emZiUWREL1ox?= =?utf-8?B?LzRpcU10TnhTektWZEdHVmNZQlM3K045TDdNVjEwRmtmaG8vWVBzMlF6TnMx?= =?utf-8?B?TmR0MDMxMWtWdkVzTEo4VXdMWUtuOU5uSFVwMHJCWnZoZjl3bENteXRwS2pL?= =?utf-8?B?QUh0WHYrdmZJQ0ZQK1c0TGx6VW8veUR4bU5iWTdoKzRPcU9JYjN6a2l4Y1Nv?= =?utf-8?B?S29XRXQ1OXJYZ1FtZ0J6WEN6bk8rdTNkOHBSWlIwT2JkdGtFNlBTM1RJVTVB?= =?utf-8?B?b0tvQldFNy82VHZMaUNZZVBROCttYzlXdHc3cVJ4TDhLajNTYTcxcmxXajR1?= =?utf-8?B?Smt6bXJJVEY3ZC90WU9ZaHBJREsyb3pRbnlhc0F1TDU3a29rdmRiQS9QdG40?= =?utf-8?B?cmZKMmpYK2s3QW5nblpJaTN0UVdLaXdUblpZdE5rUXNuTTJPS0VRc0greDI3?= =?utf-8?B?UEZYUGVBdzVJQWV3QWpKZEFFVTZxaTYyTDRkcDBrYWdCQ1kyQVRZMTBicGpN?= =?utf-8?Q?l7zooxpqzhYtST98xpVcUQd+3A+U3IhDDJjtAE/?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2644ff65-d83a-4257-10fa-08d971b19b30 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2021 03:43:07.9572 (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: LZQANn8crcWT4awdQjk7yi1yJ15l9T+VsZmTDcdf9Lhj4jKm/42HHGJwoiXI52X6qnj+ntumi/TsI0wDyh//qO8kniZnaYEOTF2p1H9BW28= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB4057 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Hi Ard, On 04/09/2021 00:50, Ard Biesheuvel wrote: > On Fri, 3 Sept 2021 at 18:07, 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 as it will be executed at the end of DXE >> phase. >> >> This PlatformBootManagerLib instance registers only a GUID defined by >> gArmTokenSpaceGuid.PcdLinuxBootFileGuid for LinuxBoot Payload as active >> boot option. It allows BDS to jump to the LinuxBoot Shell immediately >> with skipping the UiApp Setup Screen or UEFI Shell. >> >> The PlatformBootManagerLib library derived from >> ArmPkg/Library/PlatformBootManagerLib. >> >> Cc: Leif Lindholm >> Cc: Ard Biesheuvel >> >> Signed-off-by: Nhi Pham > I *think* I know the answer, but could you please clarify in the > commit log why this justifies/requires a completely different > BootManagerLib implementation? I just sent out the v2 of this patch which updates the commit message to clarify the reason why we need to implement a new PlatformBootManagerLib for LinuxBoot. Thanks for your reviewing! -Nhi > >> --- >> 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 >>