summaryrefslogtreecommitdiffstats
path: root/EmbeddedPkg
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-05-02 20:04:42 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-05-02 20:04:42 +0000
commit40ab42ddca705bc0fedce6a933ef3b4787863445 (patch)
tree204d22ac95ede45e92b5924e18193235c21a6d27 /EmbeddedPkg
parentc54de82204db5ae68b2ad2840c8388c2fd725727 (diff)
downloadedk2-40ab42ddca705bc0fedce6a933ef3b4787863445.tar.gz
edk2-40ab42ddca705bc0fedce6a933ef3b4787863445.tar.bz2
edk2-40ab42ddca705bc0fedce6a933ef3b4787863445.zip
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
Diffstat (limited to 'EmbeddedPkg')
-rw-r--r--EmbeddedPkg/SerialDxe/SerialIo.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/EmbeddedPkg/SerialDxe/SerialIo.c b/EmbeddedPkg/SerialDxe/SerialIo.c
index 59d904c192..ef4e6a1910 100644
--- a/EmbeddedPkg/SerialDxe/SerialIo.c
+++ b/EmbeddedPkg/SerialDxe/SerialIo.c
@@ -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);
+ }
+
+ if (Count != *BufferSize) {
*BufferSize = Count;
- return (Count == 0) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
+ return EFI_TIMEOUT;
}
-
- // No data to return
- *BufferSize = 0;
+
return EFI_SUCCESS;
}