audk/MdeModulePkg/Universal
Laszlo Ersek 31ae446b1a MdeModulePkg: TerminalDxe: select the UART's default receive FIFO depth
The Serial IO protocol instances provided by SerialDxe and consumed by
TerminalDxe come with a Mode.ReceiveFifoDepth=1 default setting, as
required by UEFI 2.5.

Although TerminalDxe calls EFI_SERIAL_IO_PROTOCOL.SetAttributes() in the
TerminalDriverBindingStart() and TerminalConInTimerHandler() functions, it
only does so to change the Mode.Timeout member. Other members of Mode,
including Mode.ReceiveFifoDepth, are preserved.

On some platforms this causes the UART that underlies TerminalDxe not to
have enough room for bursts of scan codes, which translates to broken
parsing of escape sequences, e.g. cursor movement keys.

According to the UEFI spec, passing ReceiveFifoDepth=0 to
EFI_SERIAL_IO_PROTOCOL.SetAttributes() "will use the device's default FIFO
depth". While TerminalDxe could try to configure a receive FIFO depth that
matches the longest escape sequence it wishes to parse, in practice the
device-specific default FIFO depth -- which may well differ from the
spec-mandated SerialIo->Mode.ReceiveFifoDepth=1 default -- seems to work.
Hence let's just set that.

This issue was exposed by SVN r18971 / git commit 921e987b2b
("ArmPlatformPkg: Use SerialDxe in MdeModulePkg instead of EmbeddedPkg").
In that conversion, MdeModulePkg's SerialDxe started to initialize
Mode.ReceiveFifoDepth to 1 (in conformance with the spec), unlike the
prior, non-conformant initialization to 0 in EmbeddedPkg's SerialDxe.

Since TerminalDxe would never change ReceiveFifoDepth from the new default
value 1, and the ArmPlatformPkg/Drivers/PL011Uart library instance,
underlying SerialDxe through SerialPortLib, would obey it too, they would
collectively effect a receive queue depth of 1, rather than the default 16
or 32. This broke cursor keys on the ARM FVP and Juno platforms.

It is the client of EFI_SERIAL_IO_PROTOCOL that is responsible for
modifying the attributes, if the defaults are not appropriate, hence this
patch modifies TerminalDxe.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ryan Harkin <ryan.harkin@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Star Zeng <star.zeng@intel.com>
Reported-by: Ryan Harkin <ryan.harkin@linaro.org>
Reference: http://thread.gmane.org/gmane.comp.bios.edk2.devel/4779/focus=6553
Reference: http://thread.gmane.org/gmane.comp.bios.edk2.devel/6594
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Star Zeng <star.zeng@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19701 6f19259b-4bc3-4df7-8a09-765794883524
2016-01-21 00:29:12 +00:00
..
Acpi MdeModulePkg AcpiTableDxe: Fix a typo in function description 2016-01-06 01:11:25 +00:00
BdsDxe MdeModulePkg BdsDxe: Change file format which the existed folder has mixed file format. 2015-12-16 03:23:37 +00:00
BootManagerPolicyDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
CapsulePei MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
CapsuleRuntimeDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
Console MdeModulePkg: TerminalDxe: select the UART's default receive FIFO depth 2016-01-21 00:29:12 +00:00
DebugPortDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DebugSupportDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DevicePathDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
Disk MdeModulePkg DiskIoDxe: Check for MediaPresent in DiskIo2ReadWriteDisk() 2015-12-22 13:55:13 +00:00
DisplayEngineDxe MdeModulePkg:Fix the potential memory leak issue in Display Engine 2016-01-15 09:50:40 +00:00
DriverHealthManagerDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DriverSampleDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
EbcDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
EsrtDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
FaultTolerantWriteDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
FaultTolerantWritePei MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
FileExplorerDxe MdeModulePkg FileExplorerDxe: Change file format which has mixed file format. 2015-12-16 03:22:39 +00:00
FvSimpleFileSystemDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
HiiDatabaseDxe MdeModulePkg:Avoid ASSERT in HiiConfigRoutingRouteConfig 2016-01-06 00:52:53 +00:00
HiiResourcesSampleDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
LegacyRegion2Dxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
LockBox/SmmLockBox MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
MemoryTest MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
Metronome MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
MonotonicCounterRuntimeDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
Network MdeModulePkg: Update MNP driver to recycle TX buffer asynchronously. 2016-01-08 02:38:34 +00:00
PCD MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PcatSingleSegmentPciCfg2Pei MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PlatformDriOverrideDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PrintDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PropertiesTableAttributesDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
RegularExpressionDxe MdeModulePkg: For RegularExpressionDxe use 'sprintf_s' to replace 'sprintf'. 2016-01-04 05:14:53 +00:00
ReportStatusCodeRouter MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
ResetSystemRuntimeDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
SectionExtractionDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
SectionExtractionPei MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
SecurityStubDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
SerialDxe MdeModulePkg: SerialDxe: sync EFI_SERIAL_IO_MODE.Timeout with the spec 2016-01-21 00:29:07 +00:00
SetupBrowserDxe MdeModulePkg: Improved SetupBrowser handling to failed GOTO callback. 2015-12-15 05:53:46 +00:00
SmbiosDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
SmbiosMeasurementDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
StatusCodeHandler MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
TimestampDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
Variable MdeModulePkg: Add MorLock to variable driver. 2016-01-19 13:22:05 +00:00
WatchdogTimerDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00