EmbeddedPkg/SerialDxe: Do not block UART when no data is available on the port
Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13255 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -167,7 +167,7 @@ SerialWrite (
|
||||
}
|
||||
|
||||
/**
|
||||
Writes data to a serial device.
|
||||
Reads data from a serial device.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param BufferSize On input, the size of the Buffer. On output, the amount of
|
||||
@@ -189,15 +189,16 @@ SerialRead (
|
||||
)
|
||||
{
|
||||
UINTN Count = 0;
|
||||
|
||||
|
||||
if (SerialPortPoll()) {
|
||||
Count = SerialPortRead (Buffer, *BufferSize);
|
||||
*BufferSize = Count;
|
||||
return (Count == 0) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
|
||||
}
|
||||
|
||||
// No data to return
|
||||
*BufferSize = 0;
|
||||
|
||||
if (Count != *BufferSize) {
|
||||
*BufferSize = Count;
|
||||
return EFI_TIMEOUT;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user