summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Library/PlatformBootManagerLib
Commit message (Collapse)AuthorAgeFilesLines
* OvmfPkg/QemuBootOrderLib: add StoreQemuBootOrder()Gerd Hoffmann2022-09-061-0/+5
| | | | | | | | | | | | The function reads the boot order from qemu fw_cfg, translates it into device paths and stores them in 'QemuBootOrderNNNN' variables. In case there is no boot ordering configured the function will do nothing. Use case: Allow applications loaded via 'qemu -kernel bootloader.efi' obey the boot order. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* OvmfPkg/CloudHv: Connect serial consoleSebastien Boeuf2022-01-131-1/+7
| | | | | | | | | | Cloud Hypervisor doesn't emulate any LPC bridge, therefore we simply need to rely on the serial I/O port to be connected as a console. It reuses the code from Xen since it's very generic. Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
* OvmfPkg: Call PlatformInitializeConsole for GPU passthrough caseStefan Berger2021-12-171-0/+7
| | | | | | | | | | | | | For GPU passthrough support we have to initialize the console after EfiBootManagerDispatchDeferredImages() has loaded ROMs, so call it after this. This was the calling order before the TCG physical presence support had to be moved and the console initialized earlier so user interaction could be supported before processing TCG physical presence opcodes. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Tested-by: Shivanshu Goyal <shivanshu3@gmail.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* OvmfPkg: Handle Cloud Hypervisor host bridgeSebastien Boeuf2021-12-111-0/+1
| | | | | | | | | | Handle things differently when the detected host bridge matches the Cloud Hypervisor PCI host bridge identifier. Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Rob Bradford <robert.bradford@intel.com> Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
* OvmfPkg: Apply uncrustify changesMichael Kubacki2021-12-074-400/+527
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the OvmfPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Andrew Fish <afish@apple.com>
* OvmfPkg: Change complex DEBUG_CODE() to DEBUG_CODE_BEGIN/END()Michael D Kinney2021-12-071-2/+2
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3767 Update use of DEBUG_CODE(Expression) if Expression is a complex code block with if/while/for/case statements that use {}. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Andrew Fish <afish@apple.com>
* OvmfPkg: Reproduce builds across source format changesMichael D Kinney2021-11-081-2/+2
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3688 Use DEBUG_LINE_NUMBER instead of __LINE__. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> Tested-by: Michael Kubacki <michael.kubacki@microsoft.com>
* OvmfPkg/Microvm: wire up serial console, drop super-ioGerd Hoffmann2021-10-051-0/+40
| | | | | | | | | | | | Microvm has no LPC bridge, so drop the PciSioSerialDxe driver. Use SerialDxe instead, with ioport hardcoded to 0x3f8 aka com1 aka ttyS0. With this tianocore boots to uefi shell prompt on the serial console. Direct kernel boot can be used too. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
* OvmfPkg/Microvm: BdsPlatform: PciAcpiInitialization tweak.Gerd Hoffmann2021-10-051-0/+2
| | | | | | | | Nothing to do here ;) Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
* OvmfPkg: Handle TPM 2 physical presence opcodes much earlierStefan Berger2021-09-301-8/+11
| | | | | | | | | | | | | | | | | | | | | Handle the TPM 2 physical presence interface (PPI) opcodes in PlatformBootManagerBeforeConsole() before the TPM 2 platform hierarchy is disabled. Since the handling of the PPI opcodes may require inter- action with the user, initialize the keyboard before handling PPI codes. Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Peter Grehan <grehan@freebsd.org> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
* OvmfPkg/PlatformBootManagerLib: use PcdAcpiS3Enable to detect S3 supportLin, Gary (HPS OE-Linux)2021-08-312-1/+2
| | | | | | | | | | | | To avoid the potential inconsistency between PcdAcpiS3Enable and QemuFwCfgS3Enabled(), this commit modifies PlatformBootManagerLib to detect S3 support by PcdAcpiS3Enable as modules in MdeModulePkg do. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3573 Signed-off-by: Gary Lin <gary.lin@hpe.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> Tested-by: Jim Fehlig <jfehlig@suse.com>
* OvmfPkg/PlatformBootManagerLib: fix PCI interrupt link (LNKx)Borghorst, Hendrik via groups.io2020-12-181-13/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes an issue with the current programming of the i440fx PCI Interrupt routing assignment. Explanation by Laszlo Ersek: (1) The rotating pattern is a map: (slot, function) --> (interrupt link) [LNKA..LNKD] (more precisely, it is a pattern from (slot, pin) to (interrupt link), but function<->pin is an identity mapping in the QEMU hardware, so we can just use (slot, function) rather than (slot, pin) on the left hand side. But I digress.) The ACPI _PRT object is generated by QEMU; it describes this map. (2) Another map is (interrupt link) --> { set of possible interrupt numbers, for this link } This map is given by the LNK[A..D] ACPI objects, also given by QEMU. (3) What the firmware is expected to do is: (3a) for each interrupt link, select an *actual* interrupt from the set that's possible for that link, yielding a deterministic map (interrupt link) --> (actual interrupt number) and (3b) for each PCI device/function with an interrupt pin, resolve the (slot, function) --> (interrupt link) --> (actual interrupt number) functional composition, and program the result into the Interrupt Line register of the device. In OVMF, we do not parse the rotating map described under (1) from QEMU's _PRT object. Instead, we duplicate the code. This is not a problem. In OVMF, we also do not parse the map described under (2) from QEMU's ACPI content. Instead, we pick a specific selection (3a) that we "apriori" know satisfies (2). This is also not a problem. OVMF's particular selection is the PciHostIrqs table. ( Table (2) from QEMU is LNKA -> { 5, 10, 11 } LNKB -> { 5, 10, 11 } LNKC -> { 5, 10, 11 } LNKD -> { 5, 10, 11 } and our specific pick in OVMF, in the PciHostIrqs table, is LNKA -> 10 LNKB -> 10 LNKC -> 11 LNKD -> 11 ) In OVMF, we also cover step (3b), in the SetPciIntLine() function. What's missing in OVMF -- and what this patch corrects -- is that we currently fail to program our selection for table (3) into the hardware. We pick a specific LNKx->IRQ# mapping for each interrupt link, and we correctly program the PCI Interrupt Line registers through those link-to-IRQ mappings -- but we don't tell the hardware about the link-to-IRQ mappings. More precisely, we program such a link-to-IRQ mapping table into the hardware that is then not matched by the mapping we use for programming the PCI device/function interrupt lines. As a result, some PCI Interrupt Line registers will have impossible values -- a given (slot, function) may use a particular link, but also report an interrupt number that was never picked for that link. Output of Linux PCI Interrupt Links for i440fx before the patch: [ 0.327305] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 10 *11) [ 0.327944] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 10 *11) [ 0.328582] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 *10 11) [ 0.329208] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 *10 11) [ 0.329807] ACPI: PCI Interrupt Link [LNKS] (IRQs *9) after the patch: [ 0.327292] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11) [ 0.327934] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11) [ 0.328564] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11) [ 0.329195] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11) [ 0.329785] ACPI: PCI Interrupt Link [LNKS] (IRQs *9) Output of Linux PCI Interrupt Links for q35 before the patch: [ 0.307474] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11) [ 0.308027] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11) [ 0.308764] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11) [ 0.309310] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11) [ 0.309853] ACPI: PCI Interrupt Link [LNKE] (IRQs 5 *10 11) [ 0.310508] ACPI: PCI Interrupt Link [LNKF] (IRQs 5 *10 11) [ 0.311051] ACPI: PCI Interrupt Link [LNKG] (IRQs 5 10 *11) [ 0.311589] ACPI: PCI Interrupt Link [LNKH] (IRQs 5 10 *11) after the patch: [ 0.301991] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11) [ 0.302833] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11) [ 0.303354] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11) [ 0.303873] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11) [ 0.304399] ACPI: PCI Interrupt Link [LNKE] (IRQs 5 *10 11) [ 0.304918] ACPI: PCI Interrupt Link [LNKF] (IRQs 5 *10 11) [ 0.305436] ACPI: PCI Interrupt Link [LNKG] (IRQs 5 10 *11) [ 0.305954] ACPI: PCI Interrupt Link [LNKH] (IRQs 5 10 *11) Signed-off-by: Hendrik Borghorst <hborghor@amazon.de> Reviewed-by: David Woodhouse <dwmw@amazon.co.uk> Message-Id: <8dbedc4c7a1c3fd390aca915270814e3b35e13a5.camel@amazon.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg: replace old EFI_D_ debug levels with new DEBUG_ onesRebecca Cran2020-04-301-16/+16
| | | | | | | | | | | | | Generated mechanically with: find OvmfPkg -type f -exec sed -i -e 's/EFI_D_/DEBUG_/g' {} \; Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Cc: Philippe Mathieu-Daude <philmd@redhat.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Laszlo Ersek <lersek@redhat.com> Message-Id: <20200429215327.606467-1-rebecca@bsdio.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg/PlatformBootManagerLib: switch to QemuLoadImageLibArd Biesheuvel2020-03-052-132/+14
| | | | | | | | | | | | Replace the open coded sequence to load Linux on x86 with a short and generic sequence invoking QemuLoadImageLib, which can be provided by a generic version that only supports the LoadImage and StartImage boot services, and one that incorporates the entire legacy loading sequence as well. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2566 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg/PlatformBootManagerLib: sync Timeout with PcdPlatformBootTimeOutLaszlo Ersek2020-03-052-2/+26
| | | | | | | | | | | | | | | | | | Set the Timeout global variable to the same value as PcdPlatformBootTimeOut. This way the "setvar" command in the UEFI shell, and the "efibootmgr" command in a Linux guest, can report the front page timeout that was requested on the QEMU command line (see GetFrontPageTimeoutFromQemu()). A DEBUG_VERBOSE message is logged on success too, for our QE team's sake. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20200304094413.19462-2-lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
* OvmfPkg/PlatformBootManagerLib: Don't update progress if Pcd is 0Pete Batard2019-10-161-3/+12
| | | | | | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2266 Independently of how we decide to address other aspects of the regression introduced with commit 2de1f611be06ded3a59726a4052a9039be7d459b, it doesn't make much sense to call for a progress update if PcdPlatformBootTimeOut is zero. PcdPlatformBootTimeOut 0, which is the cause of the bug (division by zero) should be considered to indicate that a platform is not interested in displaying a progress report, so we alter PlatformBootManagerWaitCallback to behave that way. We also change one variable name to make the code more explicit. Signed-off-by: Pete Batard <pete@akeo.ie> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Message-Id: <20191014150311.16740-2-pete@akeo.ie>
* OvmfPkg/PlatformBootManagerLib: Use a Xen console for ConOut/ConInAnthony PERARD2019-08-214-4/+53
| | | | | | | | | | | | | | | | | | | | On a Xen PVH guest, none of the existing serial or console interface works, so we add a new one, based on XenConsoleSerialPortLib, and implemented via SerialDxe. That is a simple console implementation that can work on both PVH guest and HVM guests, even if it is rarely going to be used on HVM. Have PlatformBootManagerLib look for the new console, when running as a Xen guest. Since we use VENDOR_UART_DEVICE_PATH, fix its description and coding style. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689 Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20190813113119.14804-32-anthony.perard@citrix.com>
* OvmfPkg/PlatformBootManagerLib: Handle the absence of PCI bus on Xen PVHAnthony PERARD2019-08-211-0/+6
| | | | | | | | | | | | When running in a Xen PVH guest, there's nothing to do in PciAcpiInitialization() because there isn't any PCI bus. When the Host Bridge DID isn't recognised, simply continue. (The value of PcdOvmfHostBridgePciDevId would be 0 because it isn't set.) Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689 Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20190813113119.14804-29-anthony.perard@citrix.com>
* OvmfPkg/PlatformBootManagerLib: Use XenDetected from XenPlatformLibAnthony PERARD2019-08-212-34/+2
| | | | | | | | | | Replace the XenDetected() implementation by the one from XenPlatformLib. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689 Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20190813113119.14804-28-anthony.perard@citrix.com>
* OvmfPkg: Refer to Shell app via its declared GUIDHao A Wu2019-06-172-5/+5
| | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1843 Currently, the file GUID reference of the UEFI Shell app is indirected via the PCD gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile, which is set to a fixed value for OvmfPkg. So instead, use the symbolic GUID in ShellPkg for this purpose, and drop the reference to this PCD, and to the IntelFrameworkModulePkg package entirely. Cc: Ray Ni <ray.ni@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg/PlatformBootManagerLib: Remove dependency on Mps.hShenglei Zhang2019-04-281-1/+0
| | | | | | | | | | | | | Mps.h is included in BdsPlatform.h but not actually used. So remove it. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* OvmfPkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney2019-04-095-35/+5
| | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg/PlatformBootManagerLib: display boot option loading/startingLaszlo Ersek2019-02-252-0/+4
| | | | | | | | | | | | | | | | | Consume PlatformBmPrintScLib, added earlier in this series. When BdsDxe+UefiBootManagerLib report LoadImage() / StartImage() preparations and return statuses, print the reports to the UEFI console. This allows end-users better visibility into the boot process. Cc: Anthony Perard <anthony.perard@citrix.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Julien Grall <julien.grall@linaro.org> Cc: Ray Ni <ray.ni@intel.com> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1515418 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* OvmfPkg/PlatformBds: Implement PlatformBootManagerUnableToBootRuiyu Ni2018-07-271-1/+60
| | | | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Anthony Perard <anthony.perard@citrix.com> Cc: Julien Grall <julien.grall@linaro.org>
* OvmfPkg: Removing ipf which is no longer supported from edk2.chenc22018-06-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removing rules for Ipf sources file: * Remove the source file which path with "ipf" and also listed in [Sources.IPF] section of INF file. * Remove the source file which listed in [Components.IPF] section of DSC file and not listed in any other [Components] section. * Remove the embedded Ipf code for MDE_CPU_IPF. Removing rules for Inf file: * Remove IPF from VALID_ARCHITECTURES comments. * Remove DXE_SAL_DRIVER from LIBRARY_CLASS in [Defines] section. * Remove the INF which only listed in [Components.IPF] section in DSC. * Remove statements from [BuildOptions] that provide IPF specific flags. * Remove any IPF sepcific sections. Removing rules for Dec file: * Remove [Includes.IPF] section from Dec. Removing rules for Dsc file: * Remove IPF from SUPPORTED_ARCHITECTURES in [Defines] section of DSC. * Remove any IPF specific sections. * Remove statements from [BuildOptions] that provide IPF specific flags. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* OvmfPkg: add QemuRamfb to platform consoleGerd Hoffmann2018-06-141-0/+51
| | | | | | | | | | Add QemuRamfbDxe device path to the list of platform console devices, so ConSplitter will pick up the device even though it isn't a PCI GPU. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg/PlatformBootManagerLib: add missing report status code callArd Biesheuvel2018-05-292-0/+5
| | | | | | | | | | | Consumers of status code reports may rely on a status code to be reported when the ReadyToBoot event is signalled. For instance, FirmwarePerformanceDxe will fail to install the FPDT ACPI table in this case. So add the missing call. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg/PlatformBootManagerLib: process TPM PPI requestMarc-André Lureau2018-05-222-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Call Tcg2PhysicalPresenceLibProcessRequest() to process pending PPI requests from PlatformBootManagerAfterConsole(). Laszlo understanding of edk2 is that the PPI operation processing was meant to occur *entirely* before End-Of-Dxe, so that 3rd party UEFI drivers couldn't interfere with PPI opcode processing *at all*. He suggested that we should *not* call Tcg2PhysicalPresenceLibProcessRequest() from BeforeConsole(). Because, an "auth" console, i.e. one that does not depend on a 3rd party driver, is *in general* impossible to guarantee. Instead we could opt to trust 3rd party drivers, and use the "normal" console(s) in AfterConsole(), in order to let the user confirm the PPI requests. It will depend on the user to enable Secure Boot, so that the trustworthiness of those 3rd party drivers is ensured. If an attacker roots the guest OS from within, queues some TPM2 PPI requests, and also modifies drivers on the EFI system partition and/or in GPU option ROMs (?), then those drivers will not load after guest reboot, and thus the dependent console(s) won't be used for confirming the PPI requests. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg/PlatformBootManagerLib: connect Virtio RNG devices againLaszlo Ersek2018-05-182-0/+106
| | | | | | | | | | | | | | | | | | | Virtio RNG devices are never boot devices, so in commit 245c643cc8b7 we stopped connecting them. This is a problem because an OS boot loader may depend on EFI_RNG_PROTOCOL to seed the OS's RNG. Connect Virtio RNG devices again. And, while commit 245c643cc8b7 removed that from PlatformBootManagerAfterConsole(), reintroduce it now to PlatformBootManagerBeforeConsole() -- this way Driver#### options launched between both functions may access EFI_RNG_PROTOCOL too. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Fixes: 245c643cc8b73240c3b88cb55b2911b285a8c10d Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1579518 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* OvmfPkg/PlatformBootManagerLib: connect consoles unconditionallyLaszlo Ersek2018-05-141-83/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | If both ConIn and ConOut exist, but ConIn references none of the PS/2 keyboard, the USB wild-card keyboard, and any serial ports, then PlatformInitializeConsole() currently allows the boot to proceed without any input devices at all. This makes for a bad user experience -- the firmware menu could only be entered through OsIndications, set by a guest OS. Do what ArmVirtQemu does already, namely connect the consoles, and add them to ConIn / ConOut / ErrOut, unconditionally. (The underlying EfiBootManagerUpdateConsoleVariable() function checks for duplicates.) The issue used to be masked by the EfiBootManagerConnectAll() call that got conditionalized in commit 245c643cc8b7. This patch is best viewed with "git show -b -W". Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Fixes: 245c643cc8b73240c3b88cb55b2911b285a8c10d Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1577546 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* OvmfPkg/PlatformBootManagerLib: add USB keyboard to ConInLaszlo Ersek2018-04-161-0/+32
| | | | | | | | | | | | | | | | | | | PlatformInitializeConsole() (called by PlatformBootManagerBeforeConsole()) adds elements of "gPlatformConsole" to ConIn / ConOut / ErrOut (as requested per element) if at boot at least one of ConIn and ConOut doesn't exist. This typically applies to new VMs, and VMs with freshly recreated varstores. Add a USB keyboard wildcard to ConIn via "gPlatformConsole", so that we not only bind the PS/2 keyboard. (The PS/2 keyboard is added in PrepareLpcBridgeDevicePath()). Explicitly connecting the USB keyboard is necessary after commit 245c643cc8b7. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* OvmfPkg/PlatformBootManagerLib: process "-kernel" before boot devicesLaszlo Ersek2018-03-161-4/+4
| | | | | | | | | | | | | | | | | | This improves the UEFI boot time for VMs that have "-kernel", many disks or NICs, and no "bootindex" properties. (Unlike in ArmVirt commit 23d04b58e27b, in OvmfPkg commit 52fba28994e9 we introduced TryRunningQemuKernel() right from the start *after* BdsLibConnectAll(). Therefore, unlike in patch 'ArmVirtPkg/PlatformBootManagerLib: return to "-kernel before boot devices"', we adopt the logic as new in this patch.) Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Gabriel Somlo <gsomlo@gmail.com>
* OvmfPkg/PlatformBootManagerLib: hoist PciAcpiInitialization()Laszlo Ersek2018-03-161-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PlatformBootManagerAfterConsole() <--------------------------------+ PlatformBdsConnectSequence() | ConnectDevicesFromQemu() / EfiBootManagerConnectAll() | PciAcpiInitialization() ---------------------------------+ TryRunningQemuKernel() Functionally this is a no-op: - PciAcpiInitialization() iterates over PciIo protocol instances, which are available just the same at the new call site. - The PCI interrupt line register exists only to inform system software (it doesn't affect hardware) and UEFI drivers don't use PCI interrupts anyway. (More background in commits 2e70cf8ade0d and 5218c27950c4.) This change will let us move TryRunningQemuKernel() between PciAcpiInitialization() and PlatformBdsConnectSequence() in the next patch. Cc: "Gabriel L. Somlo" <gsomlo@gmail.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Gabriel Somlo <gsomlo@gmail.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Gabriel Somlo <gsomlo@gmail.com>
* OvmfPkg/PlatformBootManagerLib: rejuvenate old-style function commentsLaszlo Ersek2018-03-161-102/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | The old-style "Routine Description: ..." comments use the leftmost column and are placed between the parameter list and the function body. Therefore they cause git-diff to produce bogus hunk headers that fail to name the function being patched. Convert these comment blocks to the current edk2 style. While at it, clean them up too. For PlatformBootManagerBeforeConsole() and PlatformBootManagerAfterConsole(), copy the descriptions from the call sites in "MdeModulePkg/Universal/BdsDxe/BdsEntry.c". They are more detailed than the comments in the lib class header "MdeModulePkg/Include/Library/PlatformBootManagerLib.h"; ArmVirtPkg already uses these comments. No functional changes. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Gabriel Somlo <gsomlo@gmail.com>
* OvmfPkg/PlatformBootManagerLib: wrap overlong lines in "BdsPlatform.c"Laszlo Ersek2018-03-161-28/+51
| | | | | | | | | | | No functional changes. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Gabriel Somlo <gsomlo@gmail.com>
* OvmfPkg/PlatformBootManagerLib: minimize the set of connected devicesLaszlo Ersek2018-03-141-6/+10
| | | | | | | | | | | | | | Prefer ConnectDevicesFromQemu() to EfiBootManagerConnectAll(). Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Shannon Zhao <zhaoshenglong@huawei.com> Cc: Xiang Zheng <xiang.zheng@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> # ArmVirtQemu Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Xiang Zheng <xiang.zheng@linaro.org>
* OvmfPkg/PlatformBootManagerLib: log informative message at DEBUG_INFO lvlLaszlo Ersek2017-09-111-1/+1
| | | | | | | | | "Boot Mode:%x" is an informative message, not an error report. Set its debug mask to DEBUG_INFO. Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg, OvmfPkg: retire QemuFwCfgS3Enabled() from QemuFwCfgLibLaszlo Ersek2017-03-142-0/+2
| | | | | | | | | | | | | | | | | | | | At this point we're ready to retire QemuFwCfgS3Enabled() from the QemuFwCfgLib class, together with its implementations in: - ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c - OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c Extend all modules that call the function with a new QemuFwCfgS3Lib class dependency. Thanks to the previously added library class, instances, and class resolutions, we can do this switch now as tightly as possible. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=394 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* OvmgPkg/PlatformBootManagerLib: Add Debug Agent consoleMichael Kinney2017-01-103-3/+67
| | | | | | | | | | | | | | | | | | | | | | The Debug Agent in the SourceLevelDebugPkg can multiplex both source level debug messages and console messages on the same UART. When this is done, the Debug Agent owns the UART device and an additional device handle with a Serial I/O Protocol is produced with a VenHw device path node. In order for a platform to provide a UART based console when the Debug Agent is using the same UART device, the PlatformBootManagerLib must consider the SerialI/O Protocol produces by the Debug Agent as one of the supported consoles. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Jeff Fan <jeff.fan@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg/PlatformBds: Dispatch deferred images after EndOfDxeRuiyu Ni2016-11-101-0/+5
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Sunny Wang <sunnywang@hpe.com>
* OvmfPkg/PlatformBootManagerLib: remove module-local ARRAY_SIZE macroLaszlo Ersek2016-10-271-7/+0
| | | | | | | | | Rely on the central macro definition from "MdePkg/Include/Base.h" instead. Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* OvmfPkg/PlatformBootManagerLib: guard the definition of ARRAY_SIZELaszlo Ersek2016-10-271-0/+2
| | | | | | | | | | | | | In one of the next patches, we'll introduce ARRAY_SIZE in "MdePkg/Include/Base.h". In order to proceed in small steps, make the module-local definition of ARRAY_SIZE conditional. This way the introduction of the macro under MdePkg will silently switch this module over (after which we can remove the module-local definition completely). Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* OvmfPkg/PlatformBootManagerLib: eliminate unchecked PcdSetXX() callsLaszlo Ersek2016-10-251-4/+10
| | | | | | | | | | | | | | | | | | These are deprecated / disabled under the DISABLE_NEW_DEPRECATED_INTERFACES feature test macro. Introduce a variable called PcdStatus, and use it to assert the success of these operations (there is no reason for them to fail here). Cc: Anthony PERARD <anthony.perard@citrix.com> Cc: Gary Lin <glin@suse.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=166 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Gary Lin <glin@suse.com> Tested-by: Gary Lin <glin@suse.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* OvmfPkg: Fix typos in commentsGary Lin2016-10-191-7/+7
| | | | | | | | | | | | | | | - Incude -> Include - futhure -> future - Predfined -> Predefined - minimue -> minimum - predeined -> predefined - excute -> execute - dirver -> driver - inforamtion -> information Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* OvmfPkg: Use the new LogoDxe driverRuiyu Ni2016-09-281-7/+1
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Cc: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* OvmfPkg/PlatformBds: Do not call BootLogoEnableLogoRuiyu Ni2016-09-282-8/+7
| | | | | | | | | | Prototype of BootLogoEnableLogo will change in following patches, so do not call BootLogoEnableLogo to avoid build failure. Contributed-under: TianoCore Contribution Agreement 1.0 Cc: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* OvmfPkg: Fix typing errorsThomas Huth2016-09-121-4/+4
| | | | | | | | | | | Correct some typos (discovered with the codespell utility) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Thomas Huth <thuth@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* OvmfPkg/PlatformBootManagerLib: relax device class requirement for ConOutLaszlo Ersek2016-09-011-5/+5
| | | | | | | | | | | | | | | | | | | This will add virtio-gpu-pci devices to ConOut automatically. For further benefit, the change also allows OVMF to use the legacy-free / secondary VGA adapter (added in QEMU commit 63e3e24d, "vga: add secondary stdvga variant") as console. ArmVirtPkg's PlatformBootManagerLib already filters with IS_PCI_DISPLAY(); see IsPciDisplay(). Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://tianocore.acgmultimedia.com/show_bug.cgi?id=66 Originally-suggested-by: Gerd Hoffmann <kraxel@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* OvmfPkg/PlatformBootManagerLib: remove stale FvFile boot optionsLaszlo Ersek2016-07-132-0/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes any boot options that point to binaries built into the firmware and have become stale due to any of the following: - DXEFV's base address or size changed (historical), - DXEFV's FvNameGuid changed, - the FILE_GUID of the pointed-to binary changed, - the referenced binary is no longer built into the firmware. For example, multiple such "EFI Internal Shell" boot options can coexist. They technically differ from each other, but may not describe any built-in shell binary exactly. Such options can accumulate in a varstore over time, and while they remain generally bootable (thanks to the efforts of BmGetFileBufferByFvFilePath()), they look bad. Filter out any stale options. This functionality is not added to QemuBootOrderLib, because it is independent from QEMU and fw_cfg. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Gary Lin <glin@suse.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* OvmfPkg/PlatformBootManagerLib: Connect the Xen drivers before loading NvVarsGary Lin2016-06-022-2/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | When OVMF tried to load the file-based NvVars, it checked all the PCI instances and connected the drivers to the mass storage device. However, Xen registered its PCI device with a special class id (0xFF80), so ConnectRecursivelyIfPciMassStorage() couldn't recognize it and skipped the driver connecting for Xen PCI devices. In the end, the Xen block device wasn't initialized until EfiBootManagerConnectAll() was called, and it's already too late to load NvVars. This commit connects the Xen drivers in ConnectRecursivelyIfPciMassStorage() so that Xen can use the file-based NvVars. v3: * Introduce XenDetected() to cache the result of Xen detection instead of relying on PcdPciDisableBusEnumeration. v2: * Cosmetic changes Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>