From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.112]) by mx.groups.io with SMTP id smtpd.web11.4015.1634974472894691807 for ; Sat, 23 Oct 2021 00:34:33 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=e80UBY/j; spf=pass (domain: os.amperecomputing.com, ip: 40.107.94.112, mailfrom: nhi@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G30cNzQEQ209iDMi2fsbHY4VapQ+kvI73k+8tl6QTy5sTvilB2vd4LhZeLtUvsSVe80AMOXXdsjLHgVK45/90JjGWV4ztGW85PB5duvK6DoakPcoXcW4l0hkztq56QzYKXi2Awvf/D/+srjXdD5KNJ9VsYWd9oLD1WpLxzSJB9dDka0ydjgd+NszIN8tsvanG+48mGCceRkUvL0iKEYxxA3O5xQL77fX2YSKDdSq6niy7/CaiEEhRqBIG682/K3ZO7ibhnjHaEGlEuz+80xcqhbAjFadi5GabYm+Vpd1TlRLyaHzKXMXhMO86b2+vigpvD77f5rR489zRGmU51F8PQ== 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=qq1UjfMby54cqRbCxTWxQlKj/f7CFZZ8/rAnPZ2rMfA=; b=ExqXHBZW0de5+aU461pbli8fgf/mPdwF5B2DeGm37beaYzhXQP8qoAys84cqPw9xDzvQEYliz6iCVpHiLq/gFKyaDENSW0ralDXPGKwNoyRdkiLwkhxQ/8azwee+cB3dBMTsoQwDwnAxU3oXcfKcr5nItkfaWke9cbB5jn7zPqkfzTLoqjivnAXwYaSjm7hyLF5DSG3ADCLDPkFDb9ennjxfix/8IeIbDkPLiJJ6VO0m8qkcKWIO6EepWABxVbAJW9vtsXi5NH84pWG52Db/zjw+kI8upsp7tjepAbKSVg89lDXN6JWw9MxcgrRJkVH5QO6VmsWNjasiRzhccLnnwg== 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=qq1UjfMby54cqRbCxTWxQlKj/f7CFZZ8/rAnPZ2rMfA=; b=e80UBY/jBUUW27xY5DA6UCmaitO/1HeubQxwuiM6kEr04EjDS5AEwS+37g5bQstOcUMdv6xo6w5Oc3BRtWzVCOvmlU2X5K2b7x2oFn/MzO09827h6glAvSvGA4RAH3WkF/MW8iply9jrFUnentjQmDYmVxH1Cpj2K2yfZ8ouG3k= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7522.prod.exchangelabs.com (2603:10b6:510:f5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Sat, 23 Oct 2021 07:34:30 +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:34:30 +0000 From: "Nhi Pham" To: devel@edk2.groups.io Cc: patches@amperecomputing.com, Samer.El-Haj-Mahmoud@arm.com, moritzf@google.com, Nhi Pham , Leif Lindholm , Ard Biesheuvel Subject: [PATCH v3 1/1] ArmPkg: Implement PlatformBootManagerLib for LinuxBoot Date: Sat, 23 Oct 2021 14:32:41 +0700 Message-Id: <20211023073241.23211-1-nhi@os.amperecomputing.com> X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) Return-Path: nhi@os.amperecomputing.com MIME-Version: 1.0 Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) 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:34:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2ae87678-0cb3-4100-a866-08d995f78ca0 X-MS-TrafficTypeDiagnostic: PH0PR01MB7522: X-LD-Processed: 3bc2b170-fd94-476d-b0ce-4229bdc904a7,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: di/ZuJ+0eA9Ke/ozJQnVjnVxqDweBM99rvdtTSFPt0Et0xKDFkUZ1JCCPDLtWrls4jV6+SipKysJpiaKI3DPb3LohuFOB9ajWaiWIonuxeZlNYyX1UN8SEBdS0eXFXFTS2k/FLObqqdK93bvMC/BwXvX2uXKfvSAGbdNJN8DvwKNG3al+QXjW7nOSIBdSgE1Vdm/VC8cdPmP9Rokx9vDEwDozDh+E9tGuS0xUZnvsf0X++nDTqKMptDGGYeAKlxeAnGgQztiHKDT9y6TduEi3GrXW5Nxd+MZQYY1e3j4M4JuUu6Yq+pWHdu8CvW5D1fMUAT5Rn9Ap2WTN3ysWeKO7nziC49FPK+JFj4h/6G1+16JTXhTDqnC58Y7ooD4gcqXCgxQXS0nA2JQoMqI/2LgtRft5J6K7h52by6YloVT/lo6R5ltBva3wAadbvgcqzcd+Z8fBj//JZyaxqBcaQ0aCeSYajo86jW8RLtNmn4iLk6DA1onZB97ZRLjpuWTp3Udd33no9kIYVs51Hd4Iw+VONr6jMO561q2seocw8wmYa77O420bkQojmEiTrIIL1SEv8cDI/m/w6kwSVPjO2CvA5Z7sIcFXW75UZApPCZq3voW+dVHNZ9ppaLX/CFVQ7yonHnWmVs6HZX4B0WkqvL8NqPnDtFuAQbBF2gKSmmAoB0LKO0pbcRrTR13+pS1sDndVOFGpMnM2JedKGW+FzPoAA== 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)(38350700002)(66556008)(6916009)(38100700002)(2616005)(6666004)(6512007)(26005)(2906002)(508600001)(52116002)(54906003)(6486002)(5660300002)(8936002)(4326008)(6506007)(956004)(1076003)(8676002)(66476007)(83380400001)(186003)(66946007)(316002)(86362001)(45080400002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?UwgqDG0O5kF9ECh8g7RtYeDTj6GVEBLk64YhlKWTevNf9csU5U/JTkSPhCtS?= =?us-ascii?Q?cjYY+AnKIBdRonMLwU4sCaEE8E6z6Cxn27txOGZQibIvawpoqP9z0DY4kz94?= =?us-ascii?Q?MJUw+DiE3DOOalTDGBmAe68VqDmBHhkZObotlHDhqWWv69D4coEYwiJXQTYs?= =?us-ascii?Q?bBCi/QYgM67qGnfX2uapTRGnzIHVt4IpEX85F/p7SPFpw6Miv8yWNKazajdh?= =?us-ascii?Q?OGMWB+PzOLcY23CvsRqoAVCeR8Y+xTbrxq0JKC19UWlY+ret6w81mVZZpWJ0?= =?us-ascii?Q?E4KWAj4PfcgHalqGc6mBws4hdYgHTBtMrly2xdRYl+k8tN1zNNsbozB8d7U8?= =?us-ascii?Q?VglW2nZV7DGuOUEL4Cb8WxC9m82+ROoQnNsueW2s8UsrOWJj1jM2H3tS7DKp?= =?us-ascii?Q?6MV+3M0Usa7NNImRV4bfiHS4xgNfZLKDxs1YSZgNokSU2xpWbVTgoOzHmkyu?= =?us-ascii?Q?mbLMnyqgWS+6U8dxwQmqqnSKXyuss5zxxWaWtWi8W/C0N/m8qidock+l76wG?= =?us-ascii?Q?Ffk8NCbV6Ic+P7TPS3Jn6b+WPOCVvB7zPo7+cerccz0JBq3rDjajnUrhstej?= =?us-ascii?Q?5eEUel2Vav7CEBeBzi9O9s2YQ/DtEtpLr0G8UjG9FnBjIw37SY11f50Xc11N?= =?us-ascii?Q?MO2+63m/oBw5IMfYoht6Pk0sxLhdlPUhH3yXCjKDYqFB9B4wcEa9T2ToE5Gq?= =?us-ascii?Q?Nj9qqy5KL94DM6bsj31bQNGqVJ6GmNupw4TJUzu1MHUcaWwgzV9BUXJwe7HB?= =?us-ascii?Q?+VcsCp/ANcPDvAdfKPSAtk6mvsazX6kj47Jwy0eQBMZlPZNtURnPuECNjNwG?= =?us-ascii?Q?UfflQNnE2VwILlWFRiAnX8/jqtB0DL6EzbCBdLMHphrrLas6RPBfAFbyC1+F?= =?us-ascii?Q?1SjvJzXgQKTBFf6Sa4pPpw+nCfIB0nK6IgOnWpEy2kQ9XPIxB8kjQGI6j/0r?= =?us-ascii?Q?aIXhvBeUWeSfkNud/yQJqF+gZn7JspB7H3c37QL1+5MM2XZkm7KxlGG2isW/?= =?us-ascii?Q?YvCtdSJePUvJre9iu07jj7TRZWijipmCi/fr1TIiIs+T8joRHzKAkAMIRGYD?= =?us-ascii?Q?pS/k1g3TioKxKroH8d+eNkYCDwEThJ43ycxzHFLS2d06Vqws2OikZqF2OWy+?= =?us-ascii?Q?XW3YgBUXE9iJ6+a9/RmSB+TkpL3fisoQ/kXMK66i3BU/TydMrdoAVgomJFC2?= =?us-ascii?Q?q9EDYR9Bf0u8HKcjy0FuJZ8PSvfxqMeUAWmHmaVSmuZ0GJIBdbBxA7LtNPeA?= =?us-ascii?Q?i1VitvsDoDKUFu/lp030Is+FjVsYkkyxQ8tNk809RFtQg+V+8lszaYvPC8EO?= =?us-ascii?Q?FDkgO139xkAtoUNDxX/xTu/gkUo09WXVCDjh9G00SavXDmkEwr/7PF4fereL?= =?us-ascii?Q?HzJ0WTktrDMFC2oWCkvLhevHYgc6HL+sPGBK4dr24pAVYgB+n5DncxMkEeGr?= =?us-ascii?Q?v1eNjSdBmg54d4w28qMLi2JSb+ULDCkT+MXmCJfyifEb2qrGQtxCVCPlGYyN?= =?us-ascii?Q?EHJiywCVwxafsGMCZLB0SHtfV4yldG0zuDew0bTp1zY4OohGeuDgd+/VsB6+?= =?us-ascii?Q?e9l7GcxszPx5FD8cnx+tgVUmiHnZf+372uWeNtsyz5RLO4h4HrLZ0wH5yqlq?= =?us-ascii?Q?myXyYtLi8RvuZU/hn5bnHK3UjL8EGb5ueEmjVkIJZLQsDKWtex4+27BM+kAc?= =?us-ascii?Q?vKnHag=3D=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ae87678-0cb3-4100-a866-08d995f78ca0 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2021 07:34:30.4907 (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: xI/YxsYRl9ud6J2VYzx2fN5U1d+fPcDfKBtz1SvPwxg8SS/ETfc5lUyFM0YekOtZLFbIsoNZ979NK0G6BxuN2gfowrItFMOwXKhQmUOOm8o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7522 Content-Type: text/plain 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 Acked-by: Samer El-Haj-Mahmoud Acked-by: Moritz Fischer --- Changes from v2: * Added description for PlatformRegisterFvBootOption function to resolve the CI failure. ArmPkg/ArmPkg.dec | 8 + ArmPkg/ArmPkg.dsc | 2 + ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBootManagerLib.inf | 58 ++++++ ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBm.c | 186 ++++++++++++++++++++ 4 files changed, 254 insertions(+) diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index 5935663fa9a3..9da1bbc9f216 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 # @@ -379,3 +380,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 8abe3713c829..59fd8f295d4f 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..3295c5a070bc --- /dev/null +++ b/ArmPkg/Library/LinuxBootBootManagerLib/LinuxBootBm.c @@ -0,0 +1,186 @@ +/** @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 + +/** + Register a boot option using a file GUID in the FV. + + @param FileGuid The file GUID name in the FV. + @param Description The description of the boot option. + @param Attributes The attributes of the boot option. + +**/ +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