From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mx.groups.io with SMTP id smtpd.web11.10.1662722112157686911 for ; Fri, 09 Sep 2022 04:15:14 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=k2mZE0bj; spf=pass (domain: gmail.com, ip: 209.85.221.48, mailfrom: theojehl76@gmail.com) Received: by mail-wr1-f48.google.com with SMTP id d2so2196168wrn.1 for ; Fri, 09 Sep 2022 04:15:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=mvuK81/13HR1fgfLyfJvB4MuKvao/QzrZ9JuJnRskoU=; b=k2mZE0bjzCg9dkEIjsjLW/Sq7nVwWjzE8f3tMg59ESFGgS5ifKL5quh7nGSGMqzDGF M4phhFYe2Uefx0pn8Ga2H/BsrXTXA1kVD9XJCeARDv7f6Te4Yowz5pxFL950ZvYXB75m IyKirKwlcwoHyk70wqpN7XX9VyVGl1sbaZuzYDax61eUopItCD57qJFzKycY47XX/guK MNO9Oodfwo86UAcUbmNc+UHlrt15BEkt8lF3fr10tiX2NbdRA5fPXLjZlgU110sHLJHu yF0+vHgQ/c3qDJoZmP9fTZlt7bjq/On4FTm+TKU6H59F51h7FddV2FqkmJI2IZJ7ev/k rd1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=mvuK81/13HR1fgfLyfJvB4MuKvao/QzrZ9JuJnRskoU=; b=mcXH7KpwolZEOeox4WT08FJr4EK2A9Cv/HmrMm7ct0IbgpcveMG8dISWZipijboIGG kIpkvNhEljywXj5EK/9v1iw+fVarlz3FKI6G0AwLVSHfXVNJ42cs8iLkYIIKFczr1SQI vcu0NAnUSeIzQhnMaTxfTWMbdnbhbEP7CyXhDUAcwen6Ij/f1ubaLitI6AhNnJBA48rm YTUs8QrsyOanAXvSYG+IiEGm/Rtu6cjS37Gxuzv4cSgAjwH/l7ErC5kk8y64PSSvahDq 1z+C959gxpaabmx5IVVk9c+tdJqQoNXh1gvh1RoYDEeSYkuCmwQe2JkBIOiMrh7A9ou9 7XVw== X-Gm-Message-State: ACgBeo1fwFGBALKiJzIBDoNWH8+gUJeoRxJ5b/b1Th54oW61BK5/KxFl 1yNMqqUnKUCsvAwRjbX4cwk9sfVsXv2KeAoD X-Google-Smtp-Source: AA6agR5a3c8MzMx/fa6OfdMRDSyMs4RJSRQIlMsNOXe4JGGCwgwcnQ08S1Ct4WFd3tHorj3j8ctUFQ== X-Received: by 2002:a5d:6d84:0:b0:220:5dda:a0e8 with SMTP id l4-20020a5d6d84000000b002205ddaa0e8mr7533266wrs.493.1662722112750; Fri, 09 Sep 2022 04:15:12 -0700 (PDT) Return-Path: Received: from localhost.localdomain (eth-east-parth2-46-193-66-249.wb.wifirst.net. [46.193.66.249]) by smtp.gmail.com with ESMTPSA id i11-20020adfb64b000000b00228df23bd51sm240537wre.82.2022.09.09.04.15.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Sep 2022 04:15:11 -0700 (PDT) From: =?UTF-8?B?VGjDqW8gSmVobA==?= To: devel@edk2.groups.io Cc: Leif Lindholm , Michael D Kinney , Isaac Oram , Pedro Falcato , Gerd Hoffmann , Stefan Hajnoczi Subject: [[edk2-platforms] Patch V2 3/4] QemuOpenBoardPkg: Enable stage 3 Date: Fri, 9 Sep 2022 13:15:03 +0200 Message-Id: <20220909111504.1661-4-theojehl76@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220909111504.1661-1-theojehl76@gmail.com> References: <20220909111504.1661-1-theojehl76@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable This patch adds MinPlatform stage 3 (UEFI boot) functionality Stage 3 adds DxeMain, drivers and modules necessary to reach UEFI shell. Cc: Leif Lindholm =0D Cc: Michael D Kinney =0D Cc: Isaac Oram =0D Cc: Pedro Falcato =0D Cc: Gerd Hoffmann =0D Cc: Stefan Hajnoczi =0D Signed-off-by: Th=C3=A9o Jehl --- Platform/Qemu/QemuOpenBoardPkg/Include/Dsc/Stage3.dsc.inc = | 101 +++++++++ Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.dsc = | 3 +- Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.fdf = | 54 +++++ Platform/Qemu/QemuOpenBoardPkg/Library/BoardBootManagerLib/BoardBootManage= rLib.inf | 39 ++++ Platform/Qemu/QemuOpenBoardPkg/Library/BoardBootManagerLib/BoardBootManage= r.c | 105 ++++++++++ 5 files changed, 301 insertions(+), 1 deletion(-) diff --git a/Platform/Qemu/QemuOpenBoardPkg/Include/Dsc/Stage3.dsc.inc b/Pl= atform/Qemu/QemuOpenBoardPkg/Include/Dsc/Stage3.dsc.inc new file mode 100644 index 000000000000..3e981c3b7209 --- /dev/null +++ b/Platform/Qemu/QemuOpenBoardPkg/Include/Dsc/Stage3.dsc.inc @@ -0,0 +1,101 @@ +## @file=0D +# Common DSC content to begin Stage 3 enabling=0D +#=0D +# @copyright=0D +# Copyright (C) 2022 Th=C3=A9o Jehl=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +##=0D +=0D +[LibraryClasses.Common]=0D + PlatformBootManagerLib | OvmfPkg/Library/PlatformBootManagerLib/Platfor= mBootManagerLib.inf=0D + BootLogoLib | MdeModulePkg/Library/BootLogoLib/BootLogoLib.i= nf=0D + NvVarsFileLib | OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.in= f=0D + QemuFwCfgS3Lib | OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3L= ibFwCfg.inf=0D + QemuLoadImageLib | OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoa= dImageLib.inf=0D + QemuBootOrderLib | OvmfPkg/Library/QemuBootOrderLib/QemuBootOrder= Lib.inf=0D + PlatformBmPrintScLib | OvmfPkg/Library/PlatformBmPrintScLib/PlatformB= mPrintScLib.inf=0D + XenPlatformLib | OvmfPkg/Library/XenPlatformLib/XenPlatformLib.= inf=0D + LoadLinuxLib | OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf= =0D + SerializeVariablesLib | OvmfPkg/Library/SerializeVariablesLib/Serializ= eVariablesLib.inf=0D + BoardBootManagerLib | QemuOpenBoardPkg/Library/BoardBootManagerLib/B= oardBootManagerLib.inf=0D + LocalApicLib | UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApi= cX2ApicLib.inf=0D + IoLib | MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibInt= rinsic.inf=0D + PciExpressLib | MdePkg/Library/BasePciExpressLib/BasePciExpres= sLib.inf=0D + PcdLib | MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D + PciLib | MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf= =0D + DebugLib | MdePkg/Library/BaseDebugLibSerialPort/BaseDebu= gLibSerialPort.inf=0D + SerialPortLib | PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib= .inf=0D +=0D +[Components.$(DXE_ARCH)]=0D + MdeModulePkg/Core/Dxe/DxeMain.inf {=0D + =0D + NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompre= ssLib.inf=0D + }=0D + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {=0D + =0D + PcdLib | MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D + }=0D + MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCod= eRouterRuntimeDxe.inf=0D + MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRun= timeDxe.inf=0D + MdeModulePkg/Universal/Metronome/Metronome.inf=0D + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf=0D + PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.i= nf=0D + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf=0D + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf=0D + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf=0D + MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf=0D + MdeModulePkg/Universal/BdsDxe/BdsDxe.inf=0D + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf=0D + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf=0D + MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf=0D + UefiCpuPkg/CpuDxe/CpuDxe.inf=0D + PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf=0D + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf=0D + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf=0D + MdeModulePkg/Universal/Console/GraphicsOutputDxe/GraphicsOutputDxe.inf=0D + MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf= =0D + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf=0D + MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf=0D + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf=0D + MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf=0D + UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf=0D + OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf=0D + MdeModulePkg/Universal/SerialDxe/SerialDxe.inf=0D + MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf=0D + MdeModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.inf=0D + MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf=0D + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf=0D + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf=0D + PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeControllerDxe.inf=0D + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf=0D + FatPkg/EnhancedFatDxe/Fat.inf=0D + OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf=0D +=0D + ShellPkg/Application/Shell/Shell.inf {=0D + =0D + ShellCommandLib | ShellPkg/Library/UefiShellCommandLib/UefiShellComm= andLib.inf=0D + NULL | ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Co= mmandsLib.inf=0D + NULL | ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1Co= mmandsLib.inf=0D + NULL | ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3Co= mmandsLib.inf=0D + NULL | ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1= CommandsLib.inf=0D + NULL | ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Co= mmandsLib.inf=0D + NULL | ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstal= l1CommandsLib.inf=0D + NULL | ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwor= k1CommandsLib.inf=0D + HandleParsingLib | ShellPkg/Library/UefiHandleParsingLib/UefiHandleP= arsingLib.inf=0D + PrintLib | MdePkg/Library/BasePrintLib/BasePrintLib.inf=0D + BcfgCommandLib | ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellB= cfgCommandLib.inf=0D + =0D + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask | 0xFF=0D + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize | FALSE=0D + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize | 8000=0D + }=0D +=0D + MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf=0D + OvmfPkg/PlatformDxe/Platform.inf=0D + MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf=0D + MdeModulePkg/Application/UiApp/UiApp.inf=0D + OvmfPkg/IoMmuDxe/IoMmuDxe.inf=0D + MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf=0D + OvmfPkg/SioBusDxe/SioBusDxe.inf=0D + MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf=0D diff --git a/Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.dsc b/Platform= /Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.dsc index 897ba727cdb2..55c7c3e3cc00 100644 --- a/Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.dsc +++ b/Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.dsc @@ -38,7 +38,7 @@ OvmfPkg/OvmfPkg.dec=0D =0D [PcdsFixedAtBuild]=0D - gMinPlatformPkgTokenSpaceGuid.PcdBootStage | = 2=0D + gMinPlatformPkgTokenSpaceGuid.PcdBootStage | = 3=0D =0D gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel | = 0x802A00C7=0D gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel | = 0x802A00C7=0D @@ -128,6 +128,7 @@ !include MinPlatformPkg/Include/Dsc/CoreDxeLib.dsc=0D !include QemuOpenBoardPkg/Include/Dsc/Stage1.dsc.inc=0D !include QemuOpenBoardPkg/Include/Dsc/Stage2.dsc.inc=0D +!include QemuOpenBoardPkg/Include/Dsc/Stage3.dsc.inc=0D =0D [LibraryClasses.Common]=0D QemuOpenFwCfgLib | QemuOpenBoardPkg/Library/QemuOpenFwCfgLib/Qemu= OpenFwCfgLib.inf=0D diff --git a/Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.fdf b/Platform= /Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.fdf index 548397dedb5b..8f14ad71c1f8 100644 --- a/Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.fdf +++ b/Platform/Qemu/QemuOpenBoardPkg/QemuOpenBoardPkg.fdf @@ -174,10 +174,64 @@ SET gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaSize = =3D 0x800000 # Stage 3 Firmware Volumes=0D #=0D ###########################=0D +=0D +[FV.FvUefiBootUnCompressed]=0D + !include MinPlatformPkg/Include/Fdf/CommonSpiFvHeaderInfo.fdf=0D + FvNameGuid =3D D2F110DB-2388-4963-BEFD-5889EEE01569=0D +=0D + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf=0D +=0D + INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatu= sCodeRouterRuntimeDxe.inf=0D + INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandle= rRuntimeDxe.inf=0D +=0D + INF MdeModulePkg/Universal/Metronome/Metronome.inf=0D + INF PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf=0D + INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf=0D + INF UefiCpuPkg/CpuDxe/CpuDxe.inf=0D + INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf=0D + INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeD= xe.inf=0D + INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf=0D + INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i= nf=0D + INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf=0D + INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRu= ntimeDxe.inf=0D + INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf=0D + INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf=0D + INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf=0D + INF MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf=0D + INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf=0D +=0D + INF OvmfPkg/IoMmuDxe/IoMmuDxe.inf=0D + INF OvmfPkg/PlatformDxe/Platform.inf=0D +=0D + INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf=0D + INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i= nf=0D + INF MdeModulePkg/Universal/Console/GraphicsOutputDxe/GraphicsOutputDxe.i= nf=0D + INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe= .inf=0D + INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf=0D + INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf=0D + INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf=0D + INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf=0D +=0D + INF MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf=0D + INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf=0D + INF ShellPkg/Application/Shell/Shell.inf=0D +=0D + INF OvmfPkg/SioBusDxe/SioBusDxe.inf=0D + INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf=0D + INF MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf=0D +=0D [FV.FvUefiBoot]=0D !include MinPlatformPkg/Include/Fdf/CommonSpiFvHeaderInfo.fdf=0D FvNameGuid =3D D0C15ADB-FE38-4331-841C-0E96C1B0FBFA=0D =0D + INF MdeModulePkg/Core/Dxe/DxeMain.inf=0D +=0D + FILE FV_IMAGE =3D D2F110DB-2388-4963-BEFD-5889EEE01569 {=0D + SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRE= D =3D TRUE {=0D + SECTION FV_IMAGE =3D FvUefiBootUncompressed=0D + }=0D + }=0D +=0D ###########################=0D #=0D # Stage 4 Firmware Volumes=0D diff --git a/Platform/Qemu/QemuOpenBoardPkg/Library/BoardBootManagerLib/Boa= rdBootManagerLib.inf b/Platform/Qemu/QemuOpenBoardPkg/Library/BoardBootMana= gerLib/BoardBootManagerLib.inf new file mode 100644 index 000000000000..37425d711010 --- /dev/null +++ b/Platform/Qemu/QemuOpenBoardPkg/Library/BoardBootManagerLib/BoardBootM= anagerLib.inf @@ -0,0 +1,39 @@ +## @file=0D +# The module definition file for BoardBootManagerLib.=0D +#=0D +# Copyright (c) 2019, Intel Corporation. All rights reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D BoardBootManagerLib=0D + FILE_GUID =3D 3fe4b589-8bd9-46df-9322-d06fa2c278d6= =0D + MODULE_TYPE =3D DXE_DRIVER=0D + VERSION_STRING =3D 1.0=0D + LIBRARY_CLASS =3D BoardBootManagerLib|DXE_DRIVER=0D +=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 EBC=0D +#=0D +=0D +[Sources]=0D + BoardBootManager.c=0D +=0D +[LibraryClasses]=0D + BaseLib=0D + UefiBootServicesTableLib=0D + DebugLib=0D + UefiLib=0D + HobLib=0D + UefiBootManagerLib=0D + TimerLib=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D + MinPlatformPkg/MinPlatformPkg.dec=0D diff --git a/Platform/Qemu/QemuOpenBoardPkg/Library/BoardBootManagerLib/Boa= rdBootManager.c b/Platform/Qemu/QemuOpenBoardPkg/Library/BoardBootManagerLi= b/BoardBootManager.c new file mode 100644 index 000000000000..9fad6bc56dfd --- /dev/null +++ b/Platform/Qemu/QemuOpenBoardPkg/Library/BoardBootManagerLib/BoardBootM= anager.c @@ -0,0 +1,105 @@ +/** @file=0D + This file include board specific boot manager callbacks=0D +=0D + Copyright (c) 2019, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +BOOLEAN mHotKeypressed =3D FALSE;=0D +EFI_EVENT HotKeyEvent =3D NULL;=0D +UINTN mBootMenuOptionNumber;=0D +=0D +/**=0D + This function is called each second during the boot manager waits timeou= t.=0D +=0D + @param TimeoutRemain The remaining timeout.=0D +**/=0D +VOID=0D +EFIAPI=0D +BoardBootManagerWaitCallback (=0D + UINT16 TimeoutRemain=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TxtInEx;=0D + EFI_KEY_DATA KeyData;=0D + BOOLEAN PausePressed;=0D +=0D + //=0D + // Pause on PAUSE key=0D + //=0D + Status =3D gBS->HandleProtocol (gST->ConsoleInHandle, &gEfiSimpleTextInp= utExProtocolGuid, (VOID **)&TxtInEx);=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + PausePressed =3D FALSE;=0D +=0D + while (TRUE) {=0D + Status =3D TxtInEx->ReadKeyStrokeEx (TxtInEx, &KeyData);=0D + if (EFI_ERROR (Status)) {=0D + break;=0D + }=0D +=0D + if (KeyData.Key.ScanCode =3D=3D SCAN_PAUSE) {=0D + PausePressed =3D TRUE;=0D + break;=0D + }=0D + }=0D +=0D + //=0D + // Loop until non-PAUSE key pressed=0D + //=0D + while (PausePressed) {=0D + Status =3D TxtInEx->ReadKeyStrokeEx (TxtInEx, &KeyData);=0D + if (!EFI_ERROR (Status)) {=0D + DEBUG (=0D + (=0D + DEBUG_INFO, "[PauseCallback] %x/%x %x/%x\n",=0D + KeyData.Key.ScanCode, KeyData.Key.UnicodeChar,=0D + KeyData.KeyState.KeyShiftState, KeyData.KeyState.KeyToggleSt= ate=0D + )=0D + );=0D + PausePressed =3D (BOOLEAN)(KeyData.Key.ScanCode =3D=3D SCAN_PAUSE);= =0D + }=0D + }=0D +}=0D +=0D +/**=0D + The function is called when no boot option could be launched,=0D + including platform recovery options and options pointing to applications= =0D + built into firmware volumes.=0D +=0D + If this function returns, BDS attempts to enter an infinite loop.=0D +**/=0D +VOID=0D +EFIAPI=0D +BoardBootManagerUnableToBoot (=0D + VOID=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_BOOT_MANAGER_LOAD_OPTION BootDeviceList;=0D + CHAR16 OptionName[sizeof ("Boot####")];=0D +=0D + if (mBootMenuOptionNumber =3D=3D LoadOptionNumberUnassigned) {=0D + return;=0D + }=0D +=0D + UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", mBootMenuOp= tionNumber);=0D + Status =3D EfiBootManagerVariableToLoadOption (OptionName, &BootDeviceLi= st);=0D + if (EFI_ERROR (Status)) {=0D + return;=0D + }=0D +=0D + for ( ;;) {=0D + EfiBootManagerBoot (&BootDeviceList);=0D + }=0D +}=0D --=20 2.32.1 (Apple Git-133)