Patchwork cadence_uart: More debug information

login
register
mail settings
Submitter Peter Crosthwaite
Date Oct. 19, 2012, 9:08 a.m.
Message ID <1350637684-32300-1-git-send-email-peter.crosthwaite@xilinx.com>
Download mbox | patch
Permalink /patch/192621/
State New
Headers show

Comments

Peter Crosthwaite - Oct. 19, 2012, 9:08 a.m.
Add more helpful debug information to the cadence UART.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
 hw/cadence_uart.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
Peter Maydell - Oct. 19, 2012, 10:54 a.m.
On 19 October 2012 10:08, Peter Crosthwaite
<peter.crosthwaite@xilinx.com> wrote:
> Add more helpful debug information to the cadence UART.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM
Stefan Hajnoczi - Oct. 29, 2012, 9:47 a.m.
On Fri, Oct 19, 2012 at 07:08:04PM +1000, Peter Crosthwaite wrote:
> Add more helpful debug information to the cadence UART.
> 
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
>  hw/cadence_uart.c |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

Patch

diff --git a/hw/cadence_uart.c b/hw/cadence_uart.c
index f8afc4e..483a316 100644
--- a/hw/cadence_uart.c
+++ b/hw/cadence_uart.c
@@ -359,7 +359,7 @@  static void uart_write(void *opaque, target_phys_addr_t offset,
 {
     UartState *s = (UartState *)opaque;
 
-    DB_PRINT(" offset:%x data:%08x\n", offset, (unsigned)value);
+    DB_PRINT(" offset:%x data:%08x\n", (unsigned)offset, (unsigned)value);
     offset >>= 2;
     switch (offset) {
     case R_IER: /* ier (wts imr) */
@@ -405,12 +405,15 @@  static uint64_t uart_read(void *opaque, target_phys_addr_t offset,
 
     offset >>= 2;
     if (offset >= R_MAX) {
-        return 0;
+        c = 0;
     } else if (offset == R_TX_RX) {
         uart_read_rx_fifo(s, &c);
-        return c;
+    } else {
+       c = s->r[offset];
     }
-    return s->r[offset];
+
+    DB_PRINT(" offset:%x data:%08x\n", (unsigned)(offset << 2), (unsigned)c);
+    return c;
 }
 
 static const MemoryRegionOps uart_ops = {