aboutsummaryrefslogtreecommitdiff
path: root/include/hw/char
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2020-09-03 16:43:22 -0400
committerEduardo Habkost <ehabkost@redhat.com>2020-09-09 09:26:43 -0400
commitdb1015e92e04835c9eb50c29625fe566d1202dbd (patch)
tree41fbc0bf3e3f29b7ecb339224a049e3f2a7db8fa /include/hw/char
parent1c8eef0227e2942264063f22f10a06b84e0d3fa9 (diff)
Move QOM typedefs and add missing includes
Some typedefs and macros are defined after the type check macros. This makes it difficult to automatically replace their definitions with OBJECT_DECLARE_TYPE. Patch generated using: $ ./scripts/codeconverter/converter.py -i \ --pattern=QOMStructTypedefSplit $(git grep -l '' -- '*.[ch]') which will split "typdef struct { ... } TypedefName" declarations. Followed by: $ ./scripts/codeconverter/converter.py -i --pattern=MoveSymbols \ $(git grep -l '' -- '*.[ch]') which will: - move the typedefs and #defines above the type check macros - add missing #include "qom/object.h" lines if necessary Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-9-ehabkost@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-10-ehabkost@redhat.com> Message-Id: <20200831210740.126168-11-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'include/hw/char')
-rw-r--r--include/hw/char/avr_usart.h6
-rw-r--r--include/hw/char/bcm2835_aux.h6
-rw-r--r--include/hw/char/cadence_uart.h6
-rw-r--r--include/hw/char/cmsdk-apb-uart.h6
-rw-r--r--include/hw/char/digic-uart.h6
-rw-r--r--include/hw/char/escc.h6
-rw-r--r--include/hw/char/ibex_uart.h6
-rw-r--r--include/hw/char/imx_serial.h6
-rw-r--r--include/hw/char/nrf51_uart.h6
-rw-r--r--include/hw/char/pl011.h6
-rw-r--r--include/hw/char/renesas_sci.h6
-rw-r--r--include/hw/char/serial.h16
-rw-r--r--include/hw/char/stm32f2xx_usart.h6
13 files changed, 58 insertions, 30 deletions
diff --git a/include/hw/char/avr_usart.h b/include/hw/char/avr_usart.h
index 5739aaf26f..67ad345edd 100644
--- a/include/hw/char/avr_usart.h
+++ b/include/hw/char/avr_usart.h
@@ -25,6 +25,7 @@
#include "hw/sysbus.h"
#include "chardev/char-fe.h"
#include "hw/hw.h"
+#include "qom/object.h"
/* Offsets of registers. */
#define USART_DR 0x06
@@ -57,10 +58,11 @@
#define USART_CSRC_CSZ0 (1 << 1)
#define TYPE_AVR_USART "avr-usart"
+typedef struct AVRUsartState AVRUsartState;
#define AVR_USART(obj) \
OBJECT_CHECK(AVRUsartState, (obj), TYPE_AVR_USART)
-typedef struct {
+struct AVRUsartState {
/* <private> */
SysBusDevice parent_obj;
@@ -88,6 +90,6 @@ typedef struct {
qemu_irq txc_irq;
/* Data Register Empty */
qemu_irq dre_irq;
-} AVRUsartState;
+};
#endif /* HW_CHAR_AVR_USART_H */
diff --git a/include/hw/char/bcm2835_aux.h b/include/hw/char/bcm2835_aux.h
index 934acf9c81..2647becc52 100644
--- a/include/hw/char/bcm2835_aux.h
+++ b/include/hw/char/bcm2835_aux.h
@@ -11,13 +11,15 @@
#include "hw/sysbus.h"
#include "chardev/char-fe.h"
+#include "qom/object.h"
#define TYPE_BCM2835_AUX "bcm2835-aux"
+typedef struct BCM2835AuxState BCM2835AuxState;
#define BCM2835_AUX(obj) OBJECT_CHECK(BCM2835AuxState, (obj), TYPE_BCM2835_AUX)
#define BCM2835_AUX_RX_FIFO_LEN 8
-typedef struct {
+struct BCM2835AuxState {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
@@ -29,6 +31,6 @@ typedef struct {
uint8_t read_fifo[BCM2835_AUX_RX_FIFO_LEN];
uint8_t read_pos, read_count;
uint8_t ier, iir;
-} BCM2835AuxState;
+};
#endif
diff --git a/include/hw/char/cadence_uart.h b/include/hw/char/cadence_uart.h
index dabc49ea4f..3d02d6ef1a 100644
--- a/include/hw/char/cadence_uart.h
+++ b/include/hw/char/cadence_uart.h
@@ -24,6 +24,7 @@
#include "chardev/char-fe.h"
#include "qapi/error.h"
#include "qemu/timer.h"
+#include "qom/object.h"
#define CADENCE_UART_RX_FIFO_SIZE 16
#define CADENCE_UART_TX_FIFO_SIZE 16
@@ -31,10 +32,11 @@
#define CADENCE_UART_R_MAX (0x48/4)
#define TYPE_CADENCE_UART "cadence_uart"
+typedef struct CadenceUARTState CadenceUARTState;
#define CADENCE_UART(obj) OBJECT_CHECK(CadenceUARTState, (obj), \
TYPE_CADENCE_UART)
-typedef struct {
+struct CadenceUARTState {
/*< private >*/
SysBusDevice parent_obj;
@@ -51,6 +53,6 @@ typedef struct {
qemu_irq irq;
QEMUTimer *fifo_trigger_handle;
Clock *refclk;
-} CadenceUARTState;
+};
#endif
diff --git a/include/hw/char/cmsdk-apb-uart.h b/include/hw/char/cmsdk-apb-uart.h
index bc9069f9fd..32c0df9df3 100644
--- a/include/hw/char/cmsdk-apb-uart.h
+++ b/include/hw/char/cmsdk-apb-uart.h
@@ -15,12 +15,14 @@
#include "hw/qdev-properties.h"
#include "hw/sysbus.h"
#include "chardev/char-fe.h"
+#include "qom/object.h"
#define TYPE_CMSDK_APB_UART "cmsdk-apb-uart"
+typedef struct CMSDKAPBUART CMSDKAPBUART;
#define CMSDK_APB_UART(obj) OBJECT_CHECK(CMSDKAPBUART, (obj), \
TYPE_CMSDK_APB_UART)
-typedef struct {
+struct CMSDKAPBUART {
/*< private >*/
SysBusDevice parent_obj;
@@ -42,7 +44,7 @@ typedef struct {
/* This UART has no FIFO, only a 1-character buffer for each of Tx and Rx */
uint8_t txbuf;
uint8_t rxbuf;
-} CMSDKAPBUART;
+};
/**
* cmsdk_apb_uart_create - convenience function to create TYPE_CMSDK_APB_UART
diff --git a/include/hw/char/digic-uart.h b/include/hw/char/digic-uart.h
index de9a3e3551..7c6ec2a5c5 100644
--- a/include/hw/char/digic-uart.h
+++ b/include/hw/char/digic-uart.h
@@ -20,8 +20,10 @@
#include "hw/sysbus.h"
#include "chardev/char-fe.h"
+#include "qom/object.h"
#define TYPE_DIGIC_UART "digic-uart"
+typedef struct DigicUartState DigicUartState;
#define DIGIC_UART(obj) \
OBJECT_CHECK(DigicUartState, (obj), TYPE_DIGIC_UART)
@@ -32,7 +34,7 @@ enum {
R_MAX
};
-typedef struct DigicUartState {
+struct DigicUartState {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
@@ -42,6 +44,6 @@ typedef struct DigicUartState {
uint32_t reg_rx;
uint32_t reg_st;
-} DigicUartState;
+};
#endif /* HW_CHAR_DIGIC_UART_H */
diff --git a/include/hw/char/escc.h b/include/hw/char/escc.h
index 794b653484..5de2a39e77 100644
--- a/include/hw/char/escc.h
+++ b/include/hw/char/escc.h
@@ -5,11 +5,13 @@
#include "chardev/char-serial.h"
#include "hw/sysbus.h"
#include "ui/input.h"
+#include "qom/object.h"
/* escc.c */
#define TYPE_ESCC "escc"
#define ESCC_SIZE 4
+typedef struct ESCCState ESCCState;
#define ESCC(obj) OBJECT_CHECK(ESCCState, (obj), TYPE_ESCC)
typedef enum {
@@ -46,7 +48,7 @@ typedef struct ESCCChannelState {
QemuInputHandlerState *hs;
} ESCCChannelState;
-typedef struct ESCCState {
+struct ESCCState {
SysBusDevice parent_obj;
struct ESCCChannelState chn[2];
@@ -55,6 +57,6 @@ typedef struct ESCCState {
MemoryRegion mmio;
uint32_t disabled;
uint32_t frequency;
-} ESCCState;
+};
#endif
diff --git a/include/hw/char/ibex_uart.h b/include/hw/char/ibex_uart.h
index b6bd5a6700..ec9fcde8f0 100644
--- a/include/hw/char/ibex_uart.h
+++ b/include/hw/char/ibex_uart.h
@@ -29,6 +29,7 @@
#include "hw/registerfields.h"
#include "chardev/char-fe.h"
#include "qemu/timer.h"
+#include "qom/object.h"
REG32(INTR_STATE, 0x00)
FIELD(INTR_STATE, TX_WATERMARK, 0, 1)
@@ -69,10 +70,11 @@ REG32(TIMEOUT_CTRL, 0x2c)
#define IBEX_UART_CLOCK 50000000 /* 50MHz clock */
#define TYPE_IBEX_UART "ibex-uart"
+typedef struct IbexUartState IbexUartState;
#define IBEX_UART(obj) \
OBJECT_CHECK(IbexUartState, (obj), TYPE_IBEX_UART)
-typedef struct {
+struct IbexUartState {
/* <private> */
SysBusDevice parent_obj;
@@ -103,5 +105,5 @@ typedef struct {
qemu_irq rx_watermark;
qemu_irq tx_empty;
qemu_irq rx_overflow;
-} IbexUartState;
+};
#endif /* HW_IBEX_UART_H */
diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h
index c8b74284f8..bfaf8ec695 100644
--- a/include/hw/char/imx_serial.h
+++ b/include/hw/char/imx_serial.h
@@ -20,8 +20,10 @@
#include "hw/sysbus.h"
#include "chardev/char-fe.h"
+#include "qom/object.h"
#define TYPE_IMX_SERIAL "imx.serial"
+typedef struct IMXSerialState IMXSerialState;
#define IMX_SERIAL(obj) OBJECT_CHECK(IMXSerialState, (obj), TYPE_IMX_SERIAL)
#define URXD_CHARRDY (1<<15) /* character read is valid */
@@ -76,7 +78,7 @@
#define UTS1_TXFULL (1<<4)
#define UTS1_RXFULL (1<<3)
-typedef struct IMXSerialState {
+struct IMXSerialState {
/*< private >*/
SysBusDevice parent_obj;
@@ -103,6 +105,6 @@ typedef struct IMXSerialState {
qemu_irq irq;
CharBackend chr;
-} IMXSerialState;
+};
#endif
diff --git a/include/hw/char/nrf51_uart.h b/include/hw/char/nrf51_uart.h
index eb1c15b490..20560ba6dc 100644
--- a/include/hw/char/nrf51_uart.h
+++ b/include/hw/char/nrf51_uart.h
@@ -14,11 +14,13 @@
#include "hw/sysbus.h"
#include "chardev/char-fe.h"
#include "hw/registerfields.h"
+#include "qom/object.h"
#define UART_FIFO_LENGTH 6
#define UART_SIZE 0x1000
#define TYPE_NRF51_UART "nrf51_soc.uart"
+typedef struct NRF51UARTState NRF51UARTState;
#define NRF51_UART(obj) OBJECT_CHECK(NRF51UARTState, (obj), TYPE_NRF51_UART)
REG32(UART_STARTRX, 0x000)
@@ -54,7 +56,7 @@ REG32(UART_TXD, 0x51C)
REG32(UART_BAUDRATE, 0x524)
REG32(UART_CONFIG, 0x56C)
-typedef struct NRF51UARTState {
+struct NRF51UARTState {
SysBusDevice parent_obj;
MemoryRegion iomem;
@@ -72,6 +74,6 @@ typedef struct NRF51UARTState {
bool tx_started;
bool pending_tx_byte;
bool enabled;
-} NRF51UARTState;
+};
#endif
diff --git a/include/hw/char/pl011.h b/include/hw/char/pl011.h
index bed758350f..ddbd8ad45b 100644
--- a/include/hw/char/pl011.h
+++ b/include/hw/char/pl011.h
@@ -19,14 +19,16 @@
#include "hw/sysbus.h"
#include "chardev/char-fe.h"
#include "qapi/error.h"
+#include "qom/object.h"
#define TYPE_PL011 "pl011"
+typedef struct PL011State PL011State;
#define PL011(obj) OBJECT_CHECK(PL011State, (obj), TYPE_PL011)
/* This shares the same struct (and cast macro) as the base pl011 device */
#define TYPE_PL011_LUMINARY "pl011_luminary"
-typedef struct PL011State {
+struct PL011State {
SysBusDevice parent_obj;
MemoryRegion iomem;
@@ -49,7 +51,7 @@ typedef struct PL011State {
CharBackend chr;
qemu_irq irq[6];
const unsigned char *id;
-} PL011State;
+};
static inline DeviceState *pl011_create(hwaddr addr,
qemu_irq irq,
diff --git a/include/hw/char/renesas_sci.h b/include/hw/char/renesas_sci.h
index efdebc620a..5a5ebfd28c 100644
--- a/include/hw/char/renesas_sci.h
+++ b/include/hw/char/renesas_sci.h
@@ -11,8 +11,10 @@
#include "chardev/char-fe.h"
#include "hw/sysbus.h"
+#include "qom/object.h"
#define TYPE_RENESAS_SCI "renesas-sci"
+typedef struct RSCIState RSCIState;
#define RSCI(obj) OBJECT_CHECK(RSCIState, (obj), TYPE_RENESAS_SCI)
enum {
@@ -23,7 +25,7 @@ enum {
SCI_NR_IRQ = 4
};
-typedef struct {
+struct RSCIState {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
@@ -46,6 +48,6 @@ typedef struct {
int64_t trtime;
int64_t rx_next;
uint64_t input_freq;
-} RSCIState;
+};
#endif
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index 535fa23a2b..dbeef43676 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -31,10 +31,11 @@
#include "qemu/fifo8.h"
#include "chardev/char.h"
#include "hw/sysbus.h"
+#include "qom/object.h"
#define UART_FIFO_LENGTH 16 /* 16550A Fifo Length */
-typedef struct SerialState {
+struct SerialState {
DeviceState parent;
uint16_t divider;
@@ -77,22 +78,25 @@ typedef struct SerialState {
QEMUTimer *modem_status_poll;
MemoryRegion io;
-} SerialState;
+};
+typedef struct SerialState SerialState;
-typedef struct SerialMM {
+struct SerialMM {
SysBusDevice parent;
SerialState serial;
uint8_t regshift;
uint8_t endianness;
-} SerialMM;
+};
+typedef struct SerialMM SerialMM;
-typedef struct SerialIO {
+struct SerialIO {
SysBusDevice parent;
SerialState serial;
-} SerialIO;
+};
+typedef struct SerialIO SerialIO;
extern const VMStateDescription vmstate_serial;
extern const MemoryRegionOps serial_io_ops;
diff --git a/include/hw/char/stm32f2xx_usart.h b/include/hw/char/stm32f2xx_usart.h
index 8e112671e3..c44faca751 100644
--- a/include/hw/char/stm32f2xx_usart.h
+++ b/include/hw/char/stm32f2xx_usart.h
@@ -27,6 +27,7 @@
#include "hw/sysbus.h"
#include "chardev/char-fe.h"
+#include "qom/object.h"
#define USART_SR 0x00
#define USART_DR 0x04
@@ -53,10 +54,11 @@
#define USART_CR1_RE (1 << 2)
#define TYPE_STM32F2XX_USART "stm32f2xx-usart"
+typedef struct STM32F2XXUsartState STM32F2XXUsartState;
#define STM32F2XX_USART(obj) \
OBJECT_CHECK(STM32F2XXUsartState, (obj), TYPE_STM32F2XX_USART)
-typedef struct {
+struct STM32F2XXUsartState {
/* <private> */
SysBusDevice parent_obj;
@@ -73,5 +75,5 @@ typedef struct {
CharBackend chr;
qemu_irq irq;
-} STM32F2XXUsartState;
+};
#endif /* HW_STM32F2XX_USART_H */