summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c
Commit message (Collapse)AuthorAgeFilesLines
* OvmfPkg/PlatformDebugLibIoPort: Reword QEMU to hypervisorAnthony PERARD2020-04-281-1/+1
| | | | | | | | | | We are going to reuse PlatformDebugLibIoPort to use debug IO port from hypervisors that aren't QEMU, so reword "QEMU" to "hypervisor" in the descriptions. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Message-Id: <20200423095358.2518197-3-anthony.perard@citrix.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney2019-04-091-7/+1
| | | | | | | | | | | | | | | | | | | | 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/PlatformDebugLibIoPort: fix port detection for use in the DXE CoreLaszlo Ersek2018-08-061-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The DXE Core is one of those modules that call ProcessLibraryConstructorList() manually. Before DxeMain() [MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c] calls ProcessLibraryConstructorList(), and through it, our PlatformDebugLibIoPortConstructor() function, DxeMain() invokes the DEBUG() macro multiple times. That macro lands in our PlatformDebugLibIoPortFound() function -- which currently relies on the "mDebugIoPortFound" global variable that has (not yet) been set by the constructor. As a result, early debug messages from the DXE Core are lost. Move the device detection into PlatformDebugLibIoPortFound(), also caching the fact (not just the result) of the device detection. (We could introduce a separate DebugLib instance just for the DXE Core, but the above approach works for all modules that currently consume the PlatformDebugLibIoPort instance (which means "everything but SEC").) This restores messages such as: > CoreInitializeMemoryServices: > BaseAddress - 0x7AF21000 Length - 0x3CDE000 MinimalMemorySizeNeeded - 0x10F4000 Keep the empty constructor function -- OVMF's DebugLib instances have always had constructors; we had better not upset constructor dependency ordering by making our instance(s) constructor-less. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Fixes: c09d9571300a089c35f5df2773b70edc25050d0d Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Brijesh Singh <brijesh.singh@amd.com> [lersek@redhat.com: sanitize blank lines around "mDebugIoPortChecked"]
* OvmfPkg: save on I/O port accesses when the debug port is not in usePaolo Bonzini2017-11-171-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When SEV is enabled, every debug message printed by OVMF to the QEMU debug port traps from the guest to QEMU character by character because "REP OUTSB" cannot be used by IoWriteFifo8. Furthermore, when OVMF is built with the DEBUG_VERBOSE bit (value 0x00400000) enabled in "gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel", then the OvmfPkg/IoMmuDxe driver, and the OvmfPkg/Library/BaseMemEncryptSevLib library instance that is built into it, produce a huge amount of log messages. Therefore, in SEV guests, the boot time impact is huge (about 45 seconds _additional_ time spent writing to the debug port). While these messages are very useful for analyzing guest behavior, most of the time the user won't be capturing the OVMF debug log. In fact libvirt does not provide a method for configuring log capture; users that wish to do this (or are instructed to do this) have to resort to <qemu:arg>. The debug console device provides a handy detection mechanism; when read, it returns 0xE9 (which is very much unlike the 0xFF that is returned by an unused port). Use it to skip the possibly expensive OUT instructions when the debug I/O port isn't plugged anywhere. For SEC, the debug port has to be read before each full message. However: - if the debug port is available, then reading one byte before writing a full message isn't tragic, especially because SEC doesn't print many messages - if the debug port is not available, then reading one byte instead of writing a full message is still a win. Contributed-under: TianoCore Contribution Agreement 1.0 Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen (Intel address) <jordan.l.justen@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg: create a separate PlatformDebugLibIoPort instance for SECPaolo Bonzini2017-11-171-0/+31
The next patch will want to add a global variable to PlatformDebugLibIoPort, but this is not suitable for the SEC phase, because SEC runs from read-only flash. The solution is to have two library instances, one for SEC and another for all other firmware phases. This patch adds the "plumbing" for the SEC library instance, separating the INF files and moving the constructor to a separate C source file. Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen (Intel address) <jordan.l.justen@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>