summary refs log tree commit diff stats
path: root/include/hw/char/sifive_uart.h
diff options
context:
space:
mode:
authorLukas Jünger <lukas.juenger@greensocs.com>2021-06-16 11:23:26 +0200
committerAlistair Francis <alistair.francis@wdc.com>2021-06-24 05:00:12 -0700
commit6ee7ba1b8a10bd8eb1d3b918eaaf9f832a51adb4 (patch)
treeb6278d5a9a5ad5bd5c0fc93f36d11aa1be72d7ed /include/hw/char/sifive_uart.h
parent244a9fcb31c0f2b599caa7370c8e9d064497a920 (diff)
downloadfocaccia-qemu-6ee7ba1b8a10bd8eb1d3b918eaaf9f832a51adb4.tar.gz
focaccia-qemu-6ee7ba1b8a10bd8eb1d3b918eaaf9f832a51adb4.zip
hw/char: QOMify sifive_uart
This QOMifies the SiFive UART model. Migration and reset have been
implemented.

Signed-off-by: Lukas Jünger <lukas.juenger@greensocs.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20210616092326.59639-3-lukas.juenger@greensocs.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'include/hw/char/sifive_uart.h')
-rw-r--r--include/hw/char/sifive_uart.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/include/hw/char/sifive_uart.h b/include/hw/char/sifive_uart.h
index 3e962be659..7f6c79f8bd 100644
--- a/include/hw/char/sifive_uart.h
+++ b/include/hw/char/sifive_uart.h
@@ -21,6 +21,7 @@
 #define HW_SIFIVE_UART_H
 
 #include "chardev/char-fe.h"
+#include "hw/qdev-properties.h"
 #include "hw/sysbus.h"
 #include "qom/object.h"
 
@@ -49,12 +50,10 @@ enum {
 
 #define SIFIVE_UART_GET_TXCNT(txctrl)   ((txctrl >> 16) & 0x7)
 #define SIFIVE_UART_GET_RXCNT(rxctrl)   ((rxctrl >> 16) & 0x7)
+#define SIFIVE_UART_RX_FIFO_SIZE 8
 
 #define TYPE_SIFIVE_UART "riscv.sifive.uart"
-
-typedef struct SiFiveUARTState SiFiveUARTState;
-DECLARE_INSTANCE_CHECKER(SiFiveUARTState, SIFIVE_UART,
-                         TYPE_SIFIVE_UART)
+OBJECT_DECLARE_SIMPLE_TYPE(SiFiveUARTState, SIFIVE_UART)
 
 struct SiFiveUARTState {
     /*< private >*/
@@ -64,8 +63,8 @@ struct SiFiveUARTState {
     qemu_irq irq;
     MemoryRegion mmio;
     CharBackend chr;
-    uint8_t rx_fifo[8];
-    unsigned int rx_fifo_len;
+    uint8_t rx_fifo[SIFIVE_UART_RX_FIFO_SIZE];
+    uint8_t rx_fifo_len;
     uint32_t ie;
     uint32_t ip;
     uint32_t txctrl;