[kernel][arm64] Make zx_debug_read block instead of SHOULD_WAIT

zx_debug_read is supposed to block until at least one character is
read.  However, prior to this CL, on arm64, zx_debug_read would return
ZX_ERR_SHOULD_WAIT when no characters were available to be read.  This
change fixes the arm64 side to match the x86 side.

Change motmot uart driver to propagate the return status from ReadChar
rather than return ZX_ERR_INTERNAL.

Fixed: 103213
Run-All-Tests: true
Change-Id: I3f01e775f890ae9fbe7da09888ee54cb64ce8bb7
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/693507
Reviewed-by: Gianfranco Valentino <gevalentino@google.com>
Reviewed-by: Travis Geiselbrecht <travisg@google.com>
Fuchsia-Auto-Submit: Nick Maniscalco <maniscalco@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
diff --git a/zircon/kernel/dev/uart/motmot/uart.cc b/zircon/kernel/dev/uart/motmot/uart.cc
index 321eae6..6b288c05 100644
--- a/zircon/kernel/dev/uart/motmot/uart.cc
+++ b/zircon/kernel/dev/uart/motmot/uart.cc
@@ -226,7 +226,7 @@
     return result.value();
   }
 
-  return ZX_ERR_INTERNAL;
+  return result.error_value();
 }
 
 // panic-time getc/putc
diff --git a/zircon/kernel/platform/generic-arm/platform.cc b/zircon/kernel/platform/generic-arm/platform.cc
index 79d35e0..c918dbe 100644
--- a/zircon/kernel/platform/generic-arm/platform.cc
+++ b/zircon/kernel/platform/generic-arm/platform.cc
@@ -487,14 +487,16 @@
   if (uart_disabled) {
     return ZX_ERR_NOT_SUPPORTED;
   }
+
   int ret = uart_getc(wait);
-  // uart_getc returns ZX_ERR_INTERNAL if no input was read
-  if (!wait && ret == ZX_ERR_INTERNAL)
+  if (ret >= 0) {
+    *c = static_cast<char>(ret);
+    return 1;
+  }
+  if (ret == ZX_ERR_SHOULD_WAIT) {
     return 0;
-  if (ret < 0)
-    return ret;
-  *c = static_cast<char>(ret);
-  return 1;
+  }
+  return ret;
 }
 
 void platform_pputc(char c) {