/* Read data from serial device and save the data in buffer. */
UINTN EFIAPI PL011UartRead(IN UINTN UartBase, OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
/* Read data from serial device and save the data in buffer. */
UINTN EFIAPI PL011UartRead(IN UINTN UartBase, OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
{
  UINTN  Count;
  for (Count = 0; Count < NumberOfBytes; Count++, Buffer++) {
    while ((MmioRead32 (UartBase + UARTFR) & UART_RX_EMPTY_FLAG_MASK) != 0) {
    }
    *Buffer = MmioRead8 (UartBase + UARTDR);
  }
  return NumberOfBytes;
}