]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Library/BaseSerialPortLib16550: Ensure FIFO Polled Mode
authorLeo Duran <leo.duran@amd.com>
Thu, 24 May 2018 19:07:30 +0000 (03:07 +0800)
committerStar Zeng <star.zeng@intel.com>
Mon, 11 Jun 2018 02:40:20 +0000 (10:40 +0800)
Put the UART in FIFO Polled Mode by clearing IER after setting FCR.
Also, add comments to show DLAB state for registers 0 and 1.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leo Duran <leo.duran@amd.com>
Cc: Star Zeng <star.zeng@intel.com>
CC: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c

index 0ccac96f419c48f171036a6f5fa05b92f6ff4003..6532c4d26d347966482f243877dd68bdc112c377 100644 (file)
@@ -3,6 +3,8 @@
 \r
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
   Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2018, AMD Incorporated. All rights reserved.<BR>\r
+\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
 //\r
 // 16550 UART register offsets and bitfields\r
 //\r
-#define R_UART_RXBUF          0\r
-#define R_UART_TXBUF          0\r
-#define R_UART_BAUD_LOW       0\r
-#define R_UART_BAUD_HIGH      1\r
+#define R_UART_RXBUF          0   // LCR_DLAB = 0\r
+#define R_UART_TXBUF          0   // LCR_DLAB = 0\r
+#define R_UART_BAUD_LOW       0   // LCR_DLAB = 1\r
+#define R_UART_BAUD_HIGH      1   // LCR_DLAB = 1\r
+#define R_UART_IER            1   // LCR_DLAB = 0\r
 #define R_UART_FCR            2\r
 #define   B_UART_FCR_FIFOE    BIT0\r
 #define   B_UART_FCR_FIFO64   BIT5\r
@@ -553,6 +556,11 @@ SerialPortInitialize (
   SerialPortWriteRegister (SerialRegisterBase, R_UART_FCR, 0x00);\r
   SerialPortWriteRegister (SerialRegisterBase, R_UART_FCR, (UINT8)(PcdGet8 (PcdSerialFifoControl) & (B_UART_FCR_FIFOE | B_UART_FCR_FIFO64)));\r
 \r
+  //\r
+  // Set FIFO Polled Mode by clearing IER after setting FCR\r
+  //\r
+  SerialPortWriteRegister (SerialRegisterBase, R_UART_IER, 0x00);\r
+\r
   //\r
   // Put Modem Control Register(MCR) into its reset state of 0x00.\r
   //  \r