/* Reads NumberOfBytes data bytes from a serial device into the buffer specified by Buffer. The number of bytes actually read is returned. If the return value is less than NumberOfBytes, then the rest operation failed. If NumberOfBytes is zero, then return 0. */
UINTN EFIAPI SerialPortRead(OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
/* Reads NumberOfBytes data bytes from a serial device into the buffer specified by Buffer. The number of bytes actually read is returned. If the return value is less than NumberOfBytes, then the rest operation failed. If NumberOfBytes is zero, then return 0. */
UINTN EFIAPI SerialPortRead(OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
{
  UINTN  Index;
  Index = 0;
  while ((Index < NumberOfBytes) && SerialPortPoll ()) {
    Buffer[Index++] = (UINT8)mLastGetChar;
    mLastGetChar    = -1;
  }
  return Index;
}