]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c
ArmPlatformPkg/PL011Uart: Ignore BAUD rate if Integral non-zero
[mirror_edk2.git] / ArmPlatformPkg / Drivers / PL011Uart / PL011Uart.c
index 2b6741528ba8d869854a5e400150fb9e7ce0f395..9361205b1990d2da8e170d2ea205a7bf952ecce0 100644 (file)
@@ -130,19 +130,17 @@ PL011UartInitializePort (
   // Baud Rate\r
   //\r
 \r
-  // If BaudRate is zero then use default baud rate\r
-  if (*BaudRate == 0) {\r
-    if (PcdGet32 (PL011UartInteger) != 0) {\r
+  // If PL011 Integral value has been defined then always ignore the BAUD rate\r
+  if (PcdGet32 (PL011UartInteger) != 0) {\r
       MmioWrite32 (UartBase + UARTIBRD, PcdGet32 (PL011UartInteger));\r
       MmioWrite32 (UartBase + UARTFBRD, PcdGet32 (PL011UartFractional));\r
-    } else {\r
+  } else {\r
+    // If BAUD rate is zero then replace it with the system default value\r
+    if (*BaudRate == 0) {\r
       *BaudRate = PcdGet32 (PcdSerialBaudRate);\r
       ASSERT (*BaudRate != 0);\r
     }\r
-  }\r
 \r
-  // If BaudRate != 0 then we must calculate the divisor from the value\r
-  if (*BaudRate != 0) {\r
     Divisor = (PcdGet32 (PL011UartClkInHz) * 4) / *BaudRate;\r
     MmioWrite32 (UartBase + UARTIBRD, Divisor >> 6);\r
     MmioWrite32 (UartBase + UARTFBRD, Divisor & 0x3F);\r