]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c
ArmPlatformPkg/PL011Uart: PL011UartWrite() stop to transmit if the buffer is full
[mirror_edk2.git] / ArmPlatformPkg / Drivers / PL011Uart / PL011Uart.c
index d728121b299fb156f42b935e538267d9ae0a58bd..1f33bd1ef09d9b1eb7d977ce3864b3982a819cf9 100644 (file)
@@ -304,10 +304,12 @@ PL011UartWrite (
   IN UINTN     NumberOfBytes\r
   )\r
 {\r
-  UINTN  Count;\r
+  UINT8* CONST Final = &Buffer[NumberOfBytes];\r
 \r
-  for (Count = 0; Count < NumberOfBytes; Count++, Buffer++) {\r
-    while ((MmioRead32 (UartBase + UARTFR) & UART_TX_EMPTY_FLAG_MASK) == 0);\r
+  while (Buffer < Final) {\r
+    // Wait until UART able to accept another char\r
+    while ((MmioRead32 (UartBase + UARTFR) & UART_TX_FULL_FLAG_MASK));\r
+    \r
     MmioWrite8 (UartBase + UARTDR, *Buffer);\r
   }\r
 \r