]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: SerialDxe: sync EFI_SERIAL_IO_MODE.Timeout with the spec
authorLaszlo Ersek <lersek@redhat.com>
Thu, 21 Jan 2016 00:29:07 +0000 (00:29 +0000)
committerlersek <lersek@Edk2>
Thu, 21 Jan 2016 00:29:07 +0000 (00:29 +0000)
In "11.8 Serial I/O Protocol", UEFI 2.5 requires:

  The default attributes for all UART-style serial device interfaces are:
  (a) 115,200 baud,
  (b) a 1 byte receive FIFO,
  (c) a 1,000,000 microsecond timeout per character,
  (d) no parity,
  (e) 8 data bits,
  (f) and 1 stop bit.

It also says, about the EFI_SERIAL_IO_MODE.ControlMask member:

  (g) A mask of the Control bits that the device supports. The device must
      always support the Input Buffer Empty control bit.

SerialDxe complies with requirement (b) via hard-coded constants. It
complies with requirements (a), (d), (e) and (f) through PCD defaults (see
MdePkg/MdePkg.dec):

(a) 115,200 baud:
  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200|UINT64|0x00000020

(d) no parity:
  # 1 - No Parity.<BR>
  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|1|UINT8|0x00000022

(e) 8 data bits:
  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|8|UINT8|0x00000021

(f) 1 stop bit:
  # 1 - One Stop Bit.<BR>
  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits|1|UINT8|0x00000023

SerialDxe does not comply with requirements (c) and (g). In this patch, we
fix (c), and leave (g) for later.

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>
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@19700 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/SerialDxe/SerialIo.c

index 489a4a201a84d5226fe3b5b1bc3465271cdd4e72..f5b3064926ab6a357610e362a03c26b46a51c62b 100644 (file)
@@ -185,7 +185,7 @@ EFI_SERIAL_IO_MODE mSerialIoMode = {
   //    value  field                set in SerialDxeInitialize()?\r
   //---------  -------------------  -----------------------------\r
             0, // ControlMask\r
-            0, // Timeout\r
+  1000 * 1000, // Timeout\r
             0, // BaudRate          yes\r
             1, // ReceiveFifoDepth\r
             0, // DataBits          yes\r
@@ -237,7 +237,7 @@ SerialReset (
   // Set the Serial I/O mode\r
   //\r
   This->Mode->ReceiveFifoDepth  = 1;\r
-  This->Mode->Timeout           = 0;\r
+  This->Mode->Timeout           = 1000 * 1000;\r
   This->Mode->BaudRate          = PcdGet64 (PcdUartDefaultBaudRate);\r
   This->Mode->DataBits          = (UINT32) PcdGet8 (PcdUartDefaultDataBits);\r
   This->Mode->Parity            = (UINT32) PcdGet8 (PcdUartDefaultParity);\r