/* Polls a serial device to see if there is any data waiting to be read. If there is data waiting to be read from the serial device, then TRUE is returned. If there is no data waiting to be read from the serial device, then FALSE is returned. */
BOOLEAN EFIAPI SerialPortPoll(VOID)
/* Polls a serial device to see if there is any data waiting to be read. If there is data waiting to be read from the serial device, then TRUE is returned. If there is no data waiting to be read from the serial device, then FALSE is returned. */
BOOLEAN EFIAPI SerialPortPoll(VOID)
{
  if (mLastGetChar >= 0) {
    return TRUE;
  }
  if (mHaveDbcn) {
    UINT8    Buffer;
    SBI_RET  Ret;
    Ret = SbiCall (
            SBI_EXT_DBCN,
            SBI_EXT_DBCN_READ,
            3,
            1,
            ((UINTN)&Buffer),
            0
            );
    if ((TranslateError (Ret.Error) == EFI_SUCCESS) &&
        (Ret.Value == 1))
    {
      mLastGetChar = Buffer;
    }
  } else if (mHaveLegacyGetchar) {
    mLastGetChar = (INT64)SbiCall (SBI_EXT_0_1_CONSOLE_GETCHAR, 0, 0).Error;
  }
  return mLastGetChar >= 0;
}