audk/ArmVirtPkg/Library
Laszlo Ersek 5f0f5e90ae ArmVirtPkg/FdtPL011SerialPortLib: call PL011UartLib in all SerialPortLib APIs
With the SerialDxe change in commit 4cf3f37c87 ("MdeModulePkg SerialDxe:
Process timeout consistently in SerialRead", 2017-07-18), setting
EFI_SERIAL_INPUT_BUFFER_EMPTY in the "Control" output parameter, in the
GetControl() SerialPortLib function, is no longer a "small optimization".
Namely, due to the SerialDxe change, the GetOneKeyFromSerial() call in
TerminalDxe's TerminalConInTimerHandler() can take very long if the input
queue is empty, even if GetOneKeyFromSerial()'s return value causes the
loop to be exited right after, in the first iteration.

This issue causes a boot hang in ArmVirtQemu: with the input queue empty,
TerminalConInTimerHandler() takes so long to return that, by the time it
returns, there's another execution queued already (due to the associated
timer event being signaled meanwhile). The boot process is stuck in the
timer event handler.

Therefore even the first GetOneKeyFromSerial() iteration must be prevented
in TerminalConInTimerHandler() if the input queue is empty, and that
requires implementing GetControl() for real.

Implement the SetAttributes(), SetControl() and GetControl() APIs (of
SerialPortExtLib origin) in FdtPL011SerialPortLib with calls to matching
PL011UartLib functions. This follows the example of
"ArmPlatformPkg/Library/PL011SerialPortLib" and also matches Star's
original idea under [1].

The patch can be considered a continuation of commit ad7f6bc2e1
("ArmVirtPkg: Use SerialDxe in MdeModulePkg instead of EmbeddedPkg",
2015-11-26), based on the mailing list threads [1] [2] [3].

[1] http://mid.mail-archive.com/1447752930-32880-12-git-send-email-star.zeng@intel.com
[2] http://mid.mail-archive.com/1448243067-1880-12-git-send-email-star.zeng@intel.com
[3] http://mid.mail-archive.com/b748580c-cb51-32c9-acf9-780841ef15da@redhat.com

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Heyi Guo <guoheyi@huawei.com>
Cc: Star Zeng <star.zeng@intel.com>
Originally-suggested-by: Star Zeng <star.zeng@intel.com>
Reported-by: Brijesh Singh <brijesh.singh@amd.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: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-08-17 14:13:23 +02:00
..
ArmQemuRelocatablePlatformLib ArmVirtPkg/FdtParser: avoid unaligned accesses with the MMU off 2016-09-13 15:35:36 +01:00
ArmVirtDxeHobLib ArmVirtPkg DxeHobLib: Update func header description of BuildFv(2)Hob() 2016-11-17 09:27:14 +08:00
ArmVirtGicArchLib ArmVirtPkg/ArmVirtGicArchLib: eliminate unchecked PcdSetXX() calls 2016-10-25 10:46:29 +02:00
ArmVirtMemoryInitPeiLib ArmVirtPkg: restrict mapping attributes of normal memory to EFI_MEMORY_WB 2016-09-08 10:35:22 +01:00
ArmVirtPL031FdtClientLib ArmVirtPkg/ArmVirtPL031FdtClientLib: unconditionally disable DT node 2017-03-09 18:37:04 +01:00
ArmVirtPlatformLib ArmVirtPkg/ArmVirtPlatformLib: eliminate unchecked PcdSetXX() calls 2016-10-25 10:46:33 +02:00
ArmVirtPsciResetSystemLib ArmVirtPkg: switch to generic ResetSystemRuntimeDxe 2017-07-03 18:49:56 +01:00
ArmVirtTimerFdtClientLib ArmVirtPkg/ArmVirtTimerFdtClientLib: eliminate unchecked PcdSetXX() calls 2016-10-25 10:46:35 +02:00
ArmXenRelocatablePlatformLib ArmVirtPkg/FdtParser: avoid unaligned accesses with the MMU off 2016-09-13 15:35:36 +01:00
BaseCachingPciExpressLib ArmVirtPkg/BaseCachingPciExpressLib: depend on PciPcdProducerLib 2016-04-12 16:57:20 +02:00
FdtPL011SerialPortLib ArmVirtPkg/FdtPL011SerialPortLib: call PL011UartLib in all SerialPortLib APIs 2017-08-17 14:13:23 +02:00
FdtPciHostBridgeLib ArmVirtPkg/FdtPciHostBridgeLib: enable 64-bit PCI DMA 2016-09-06 15:46:53 +01:00
FdtPciPcdProducerLib ArmVirtPkg/FdtPciPcdProducerLib: eliminate unchecked PcdSetXX() calls 2016-10-25 10:46:36 +02:00
NorFlashQemuLib ArmVirtPkg/NorFlashQemuLib: rebase to ARRAY_SIZE() 2016-10-27 10:50:19 +02:00
PlatformBootManagerLib ArmVirtPkg/ArmVirtQemu: refer to Shell app via its declared GUID 2017-03-22 15:34:59 +00:00
PlatformPeiLib ArmVirtPkg/PlatformPeiLib: honor DT node 'status' property 2017-04-04 15:25:19 +01:00
QemuFwCfgLib ArmVirtPkg, OvmfPkg: retire QemuFwCfgS3Enabled() from QemuFwCfgLib 2017-03-14 21:49:16 +01:00
XenRealTimeClockLib ArmVirtPkg: XenRealTimeClockLib: fixup typo in Linaro copyright notice 2015-06-08 22:00:32 +00:00