]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/SerialDxe/SerialIo.c
InOsEmuPkg/Unix: Allow binary UEFI shell to be used
[mirror_edk2.git] / EmbeddedPkg / SerialDxe / SerialIo.c
index 9543f1d1ec1519f4edfcf30f5c329fc98c5987d8..fe0b1711a8a7aa772dc8b88241202a7d34e0d5c3 100644 (file)
@@ -6,9 +6,9 @@
   #, 0, 0. The 0 and 0 are the ascii characters for the checksum. \r
   \r
 \r
-  Copyright (c) 2008-2009, Apple Inc. All rights reserved.\r
+  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
   \r
-  All rights reserved. This program and the accompanying materials\r
+  This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   http://opensource.org/licenses/bsd-license.php\r
@@ -188,11 +188,17 @@ SerialRead (
   OUT VOID                   *Buffer\r
   )\r
 {\r
-  UINTN Count;\r
+  UINTN Count = 0;\r
   \r
-  Count = SerialPortRead (Buffer, *BufferSize);\r
-  *BufferSize = Count;\r
-  return (Count == 0) ? EFI_DEVICE_ERROR : EFI_SUCCESS;\r
+  if (SerialPortPoll()) {\r
+    Count = SerialPortRead (Buffer, *BufferSize);\r
+    *BufferSize = Count;\r
+    return (Count == 0) ? EFI_DEVICE_ERROR : EFI_SUCCESS;\r
+  }\r
+  \r
+  // No data to return\r
+  *BufferSize = 0;\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 \r
@@ -235,7 +241,7 @@ SIMPLE_TEXT_OUT_DEVICE_PATH mDevicePath = {
     EFI_CALLER_ID_GUID // Use the drivers GUID\r
   },\r
   {\r
-    { END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, sizeof (UART_DEVICE_PATH), 0},\r
+    { MESSAGING_DEVICE_PATH, MSG_UART_DP, sizeof (UART_DEVICE_PATH), 0},\r
     0,        // Reserved\r
     FixedPcdGet64 (PcdUartDefaultBaudRate),   // BaudRate\r
     FixedPcdGet8 (PcdUartDefaultDataBits),    // DataBits\r