summaryrefslogtreecommitdiffstats
path: root/hw/display
diff options
context:
space:
mode:
authorPeter Maydell2020-09-11 20:26:51 +0200
committerPeter Maydell2020-09-11 20:26:51 +0200
commitf4ef8c9cc10b3bee829b9775879d4ff9f77c2442 (patch)
tree8245341c3ebfe98b9673bf7a8cb818b6d494c76f /hw/display
parentMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (diff)
parentvirtio-vga: Use typedef name for instance_size (diff)
downloadqemu-f4ef8c9cc10b3bee829b9775879d4ff9f77c2442.tar.gz
qemu-f4ef8c9cc10b3bee829b9775879d4ff9f77c2442.tar.xz
qemu-f4ef8c9cc10b3bee829b9775879d4ff9f77c2442.zip
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging
QOM boilerplate cleanup Documentation build fix: * memory: Remove kernel-doc comment marker (Eduardo Habkost) QOM cleanups: * Rename QOM macros for consistency between TYPE_* and type checking constants (Eduardo Habkost) QOM new macros: * OBJECT_DECLARE_* and OBJECT_DEFINE_* macros (Daniel P. Berrangé) * DECLARE_*_CHECKER macros (Eduardo Habkost) Automated QOM boilerplate changes: * Automated changes to use DECLARE_*_CHECKER (Eduardo Habkost * Automated changes to use OBJECT_DECLARE* (Eduardo Habkost) # gpg: Signature made Thu 10 Sep 2020 19:17:49 BST # gpg: using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6 # gpg: issuer "ehabkost@redhat.com" # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full] # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/machine-next-pull-request: (33 commits) virtio-vga: Use typedef name for instance_size vhost-user-vga: Use typedef name for instance_size xilinx_axienet: Use typedef name for instance_size lpc_ich9: Use typedef name for instance_size omap_intc: Use typedef name for instance_size xilinx_axidma: Use typedef name for instance_size tusb6010: Rename TUSB to TUSB6010 pc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312 vfio: Rename PCI_VFIO to VFIO_PCI usb: Rename USB_SERIAL_DEV to USB_SERIAL sabre: Rename SABRE_DEVICE to SABRE rs6000_mc: Rename RS6000MC_DEVICE to RS6000MC filter-rewriter: Rename FILTER_COLO_REWRITER to FILTER_REWRITER esp: Rename ESP_STATE to ESP ahci: Rename ICH_AHCI to ICH9_AHCI vmgenid: Rename VMGENID_DEVICE to TYPE_VMGENID vfio: Rename VFIO_AP_DEVICE_TYPE to TYPE_VFIO_AP_DEVICE dev-smartcard-reader: Rename CCID_DEV_NAME to TYPE_USB_CCID_DEV ap-device: Rename AP_DEVICE_TYPE to TYPE_AP_DEVICE gpex: Fix type checking function name ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/display')
-rw-r--r--hw/display/ads7846.c9
-rw-r--r--hw/display/artist.c9
-rw-r--r--hw/display/ati_int.h9
-rw-r--r--hw/display/bochs-display.c10
-rw-r--r--hw/display/cg3.c9
-rw-r--r--hw/display/cirrus_vga.c10
-rw-r--r--hw/display/cirrus_vga_isa.c10
-rw-r--r--hw/display/exynos4210_fimd.c10
-rw-r--r--hw/display/g364fb.c9
-rw-r--r--hw/display/jazz_led.c9
-rw-r--r--hw/display/milkymist-tmu2.c7
-rw-r--r--hw/display/milkymist-vgafb.c7
-rw-r--r--hw/display/next-fb.c6
-rw-r--r--hw/display/pl110.c9
-rw-r--r--hw/display/qxl.h9
-rw-r--r--hw/display/ramfb-standalone.c9
-rw-r--r--hw/display/sii9022.c9
-rw-r--r--hw/display/sm501.c18
-rw-r--r--hw/display/ssd0303.c9
-rw-r--r--hw/display/ssd0323.c9
-rw-r--r--hw/display/tcx.c9
-rw-r--r--hw/display/vga-isa.c9
-rw-r--r--hw/display/vga-pci.c9
-rw-r--r--hw/display/vhost-user-gpu-pci.c10
-rw-r--r--hw/display/vhost-user-vga.c12
-rw-r--r--hw/display/virtio-gpu-pci.c10
-rw-r--r--hw/display/virtio-vga.c16
-rw-r--r--hw/display/virtio-vga.h17
-rw-r--r--hw/display/vmware_vga.c5
29 files changed, 175 insertions, 108 deletions
diff --git a/hw/display/ads7846.c b/hw/display/ads7846.c
index 56bf82fe07..4b87ee7135 100644
--- a/hw/display/ads7846.c
+++ b/hw/display/ads7846.c
@@ -16,8 +16,9 @@
#include "migration/vmstate.h"
#include "qemu/module.h"
#include "ui/console.h"
+#include "qom/object.h"
-typedef struct {
+struct ADS7846State {
SSISlave ssidev;
qemu_irq interrupt;
@@ -27,10 +28,12 @@ typedef struct {
int cycle;
int output;
-} ADS7846State;
+};
+typedef struct ADS7846State ADS7846State;
#define TYPE_ADS7846 "ads7846"
-#define ADS7846(obj) OBJECT_CHECK(ADS7846State, (obj), TYPE_ADS7846)
+DECLARE_INSTANCE_CHECKER(ADS7846State, ADS7846,
+ TYPE_ADS7846)
/* Control-byte bitfields */
#define CB_PD0 (1 << 0)
diff --git a/hw/display/artist.c b/hw/display/artist.c
index 955296d3d8..80cd66e41d 100644
--- a/hw/display/artist.c
+++ b/hw/display/artist.c
@@ -22,9 +22,12 @@
#include "ui/console.h"
#include "trace.h"
#include "framebuffer.h"
+#include "qom/object.h"
#define TYPE_ARTIST "artist"
-#define ARTIST(obj) OBJECT_CHECK(ARTISTState, (obj), TYPE_ARTIST)
+typedef struct ARTISTState ARTISTState;
+DECLARE_INSTANCE_CHECKER(ARTISTState, ARTIST,
+ TYPE_ARTIST)
#ifdef HOST_WORDS_BIGENDIAN
#define ROP8OFF(_i) (3 - (_i))
@@ -40,7 +43,7 @@ struct vram_buffer {
unsigned int height;
};
-typedef struct ARTISTState {
+struct ARTISTState {
SysBusDevice parent_obj;
QemuConsole *con;
@@ -103,7 +106,7 @@ typedef struct ARTISTState {
uint32_t font_write_pos_y;
int draw_line_pattern;
-} ARTISTState;
+};
typedef enum {
ARTIST_BUFFER_AP = 1,
diff --git a/hw/display/ati_int.h b/hw/display/ati_int.h
index 2a16708e4f..714005447d 100644
--- a/hw/display/ati_int.h
+++ b/hw/display/ati_int.h
@@ -13,6 +13,7 @@
#include "hw/pci/pci.h"
#include "hw/i2c/bitbang_i2c.h"
#include "vga_int.h"
+#include "qom/object.h"
/*#define DEBUG_ATI*/
@@ -29,7 +30,9 @@
#define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159
#define TYPE_ATI_VGA "ati-vga"
-#define ATI_VGA(obj) OBJECT_CHECK(ATIVGAState, (obj), TYPE_ATI_VGA)
+typedef struct ATIVGAState ATIVGAState;
+DECLARE_INSTANCE_CHECKER(ATIVGAState, ATI_VGA,
+ TYPE_ATI_VGA)
typedef struct ATIVGARegs {
uint32_t mm_index;
@@ -82,7 +85,7 @@ typedef struct ATIVGARegs {
uint32_t default_sc_bottom_right;
} ATIVGARegs;
-typedef struct ATIVGAState {
+struct ATIVGAState {
PCIDevice dev;
VGACommonState vga;
char *model;
@@ -97,7 +100,7 @@ typedef struct ATIVGAState {
MemoryRegion io;
MemoryRegion mm;
ATIVGARegs regs;
-} ATIVGAState;
+};
const char *ati_reg_name(int num);
diff --git a/hw/display/bochs-display.c b/hw/display/bochs-display.c
index a8e8ab8325..41587388c4 100644
--- a/hw/display/bochs-display.c
+++ b/hw/display/bochs-display.c
@@ -18,6 +18,7 @@
#include "ui/console.h"
#include "ui/qemu-pixman.h"
+#include "qom/object.h"
typedef struct BochsDisplayMode {
pixman_format_code_t format;
@@ -29,7 +30,7 @@ typedef struct BochsDisplayMode {
uint64_t size;
} BochsDisplayMode;
-typedef struct BochsDisplayState {
+struct BochsDisplayState {
/* parent */
PCIDevice pci;
@@ -53,11 +54,12 @@ typedef struct BochsDisplayState {
/* device state */
BochsDisplayMode mode;
-} BochsDisplayState;
+};
+typedef struct BochsDisplayState BochsDisplayState;
#define TYPE_BOCHS_DISPLAY "bochs-display"
-#define BOCHS_DISPLAY(obj) OBJECT_CHECK(BochsDisplayState, (obj), \
- TYPE_BOCHS_DISPLAY)
+DECLARE_INSTANCE_CHECKER(BochsDisplayState, BOCHS_DISPLAY,
+ TYPE_BOCHS_DISPLAY)
static const VMStateDescription vmstate_bochs_display = {
.name = "bochs-display",
diff --git a/hw/display/cg3.c b/hw/display/cg3.c
index 7cbe6e56ff..d66ba9ad6a 100644
--- a/hw/display/cg3.c
+++ b/hw/display/cg3.c
@@ -36,6 +36,7 @@
#include "qemu/log.h"
#include "qemu/module.h"
#include "trace.h"
+#include "qom/object.h"
/* Change to 1 to enable debugging */
#define DEBUG_CG3 0
@@ -65,9 +66,11 @@
#define CG3_VRAM_OFFSET 0x800000
#define TYPE_CG3 "cgthree"
-#define CG3(obj) OBJECT_CHECK(CG3State, (obj), TYPE_CG3)
+typedef struct CG3State CG3State;
+DECLARE_INSTANCE_CHECKER(CG3State, CG3,
+ TYPE_CG3)
-typedef struct CG3State {
+struct CG3State {
SysBusDevice parent_obj;
QemuConsole *con;
@@ -82,7 +85,7 @@ typedef struct CG3State {
uint8_t r[256], g[256], b[256];
uint16_t width, height, depth;
uint8_t dac_index, dac_state;
-} CG3State;
+};
static void cg3_update_display(void *opaque)
{
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index 41e71af08a..c088f38cf8 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -44,6 +44,7 @@
#include "migration/vmstate.h"
#include "ui/pixel_ops.h"
#include "cirrus_vga_internal.h"
+#include "qom/object.h"
/*
* TODO:
@@ -178,14 +179,15 @@ typedef void (*cirrus_fill_t)(struct CirrusVGAState *s,
uint32_t dstaddr, int dst_pitch,
int width, int height);
-typedef struct PCICirrusVGAState {
+struct PCICirrusVGAState {
PCIDevice dev;
CirrusVGAState cirrus_vga;
-} PCICirrusVGAState;
+};
+typedef struct PCICirrusVGAState PCICirrusVGAState;
#define TYPE_PCI_CIRRUS_VGA "cirrus-vga"
-#define PCI_CIRRUS_VGA(obj) \
- OBJECT_CHECK(PCICirrusVGAState, (obj), TYPE_PCI_CIRRUS_VGA)
+DECLARE_INSTANCE_CHECKER(PCICirrusVGAState, PCI_CIRRUS_VGA,
+ TYPE_PCI_CIRRUS_VGA)
static uint8_t rop_to_index[256];
diff --git a/hw/display/cirrus_vga_isa.c b/hw/display/cirrus_vga_isa.c
index 825ba57298..e6adee1df4 100644
--- a/hw/display/cirrus_vga_isa.c
+++ b/hw/display/cirrus_vga_isa.c
@@ -30,16 +30,18 @@
#include "hw/qdev-properties.h"
#include "hw/isa/isa.h"
#include "cirrus_vga_internal.h"
+#include "qom/object.h"
#define TYPE_ISA_CIRRUS_VGA "isa-cirrus-vga"
-#define ISA_CIRRUS_VGA(obj) \
- OBJECT_CHECK(ISACirrusVGAState, (obj), TYPE_ISA_CIRRUS_VGA)
+typedef struct ISACirrusVGAState ISACirrusVGAState;
+DECLARE_INSTANCE_CHECKER(ISACirrusVGAState, ISA_CIRRUS_VGA,
+ TYPE_ISA_CIRRUS_VGA)
-typedef struct ISACirrusVGAState {
+struct ISACirrusVGAState {
ISADevice parent_obj;
CirrusVGAState cirrus_vga;
-} ISACirrusVGAState;
+};
static void isa_cirrus_vga_realizefn(DeviceState *dev, Error **errp)
{
diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c
index 4b7286b7c9..3ef8698eb7 100644
--- a/hw/display/exynos4210_fimd.c
+++ b/hw/display/exynos4210_fimd.c
@@ -32,6 +32,7 @@
#include "qemu/bswap.h"
#include "qemu/module.h"
#include "qemu/log.h"
+#include "qom/object.h"
/* Debug messages configuration */
#define EXYNOS4210_FIMD_DEBUG 0
@@ -293,10 +294,11 @@ struct Exynos4210fimdWindow {
};
#define TYPE_EXYNOS4210_FIMD "exynos4210.fimd"
-#define EXYNOS4210_FIMD(obj) \
- OBJECT_CHECK(Exynos4210fimdState, (obj), TYPE_EXYNOS4210_FIMD)
+typedef struct Exynos4210fimdState Exynos4210fimdState;
+DECLARE_INSTANCE_CHECKER(Exynos4210fimdState, EXYNOS4210_FIMD,
+ TYPE_EXYNOS4210_FIMD)
-typedef struct {
+struct Exynos4210fimdState {
SysBusDevice parent_obj;
MemoryRegion iomem;
@@ -325,7 +327,7 @@ typedef struct {
uint8_t *ifb; /* Internal frame buffer */
bool invalidate; /* Image needs to be redrawn */
bool enabled; /* Display controller is enabled */
-} Exynos4210fimdState;
+};
/* Perform byte/halfword/word swap of data according to WINCON */
static inline void fimd_swap_data(unsigned int swap_ctl, uint64_t *data)
diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c
index adcba96e34..4a32fe4c94 100644
--- a/hw/display/g364fb.c
+++ b/hw/display/g364fb.c
@@ -29,6 +29,7 @@
#include "trace.h"
#include "hw/sysbus.h"
#include "migration/vmstate.h"
+#include "qom/object.h"
typedef struct G364State {
/* hardware */
@@ -486,13 +487,15 @@ static void g364fb_init(DeviceState *dev, G364State *s)
}
#define TYPE_G364 "sysbus-g364"
-#define G364(obj) OBJECT_CHECK(G364SysBusState, (obj), TYPE_G364)
+typedef struct G364SysBusState G364SysBusState;
+DECLARE_INSTANCE_CHECKER(G364SysBusState, G364,
+ TYPE_G364)
-typedef struct {
+struct G364SysBusState {
SysBusDevice parent_obj;
G364State g364;
-} G364SysBusState;
+};
static void g364fb_sysbus_realize(DeviceState *dev, Error **errp)
{
diff --git a/hw/display/jazz_led.c b/hw/display/jazz_led.c
index 1d845597f9..647d05f602 100644
--- a/hw/display/jazz_led.c
+++ b/hw/display/jazz_led.c
@@ -29,22 +29,25 @@
#include "trace.h"
#include "hw/sysbus.h"
#include "migration/vmstate.h"
+#include "qom/object.h"
typedef enum {
REDRAW_NONE = 0, REDRAW_SEGMENTS = 1, REDRAW_BACKGROUND = 2,
} screen_state_t;
#define TYPE_JAZZ_LED "jazz-led"
-#define JAZZ_LED(obj) OBJECT_CHECK(LedState, (obj), TYPE_JAZZ_LED)
+typedef struct LedState LedState;
+DECLARE_INSTANCE_CHECKER(LedState, JAZZ_LED,
+ TYPE_JAZZ_LED)
-typedef struct LedState {
+struct LedState {
SysBusDevice parent_obj;
MemoryRegion iomem;
uint8_t segments;
QemuConsole *con;
screen_state_t state;
-} LedState;
+};
static uint64_t jazz_led_read(void *opaque, hwaddr addr,
unsigned int size)
diff --git a/hw/display/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c
index c34ef1a1bf..8a9e7c23fb 100644
--- a/hw/display/milkymist-tmu2.c
+++ b/hw/display/milkymist-tmu2.c
@@ -38,6 +38,7 @@
#include <X11/Xlib.h>
#include <epoxy/gl.h>
#include <epoxy/glx.h>
+#include "qom/object.h"
enum {
R_CTL = 0,
@@ -82,8 +83,9 @@ struct vertex {
} QEMU_PACKED;
#define TYPE_MILKYMIST_TMU2 "milkymist-tmu2"
-#define MILKYMIST_TMU2(obj) \
- OBJECT_CHECK(MilkymistTMU2State, (obj), TYPE_MILKYMIST_TMU2)
+typedef struct MilkymistTMU2State MilkymistTMU2State;
+DECLARE_INSTANCE_CHECKER(MilkymistTMU2State, MILKYMIST_TMU2,
+ TYPE_MILKYMIST_TMU2)
struct MilkymistTMU2State {
SysBusDevice parent_obj;
@@ -98,7 +100,6 @@ struct MilkymistTMU2State {
GLXFBConfig glx_fb_config;
GLXContext glx_context;
};
-typedef struct MilkymistTMU2State MilkymistTMU2State;
static const int glx_fbconfig_attr[] = {
GLX_GREEN_SIZE, 5,
diff --git a/hw/display/milkymist-vgafb.c b/hw/display/milkymist-vgafb.c
index 6a6441e6ea..2c879129fb 100644
--- a/hw/display/milkymist-vgafb.c
+++ b/hw/display/milkymist-vgafb.c
@@ -32,6 +32,7 @@
#include "ui/pixel_ops.h"
#include "qemu/error-report.h"
#include "qemu/module.h"
+#include "qom/object.h"
#define BITS 8
#include "migration/vmstate.h"
@@ -68,8 +69,9 @@ enum {
};
#define TYPE_MILKYMIST_VGAFB "milkymist-vgafb"
-#define MILKYMIST_VGAFB(obj) \
- OBJECT_CHECK(MilkymistVgafbState, (obj), TYPE_MILKYMIST_VGAFB)
+typedef struct MilkymistVgafbState MilkymistVgafbState;
+DECLARE_INSTANCE_CHECKER(MilkymistVgafbState, MILKYMIST_VGAFB,
+ TYPE_MILKYMIST_VGAFB)
struct MilkymistVgafbState {
SysBusDevice parent_obj;
@@ -84,7 +86,6 @@ struct MilkymistVgafbState {
uint32_t regs[R_MAX];
};
-typedef struct MilkymistVgafbState MilkymistVgafbState;
static int vgafb_enabled(MilkymistVgafbState *s)
{
diff --git a/hw/display/next-fb.c b/hw/display/next-fb.c
index b0513a8fba..94db0202a3 100644
--- a/hw/display/next-fb.c
+++ b/hw/display/next-fb.c
@@ -30,8 +30,11 @@
#include "framebuffer.h"
#include "ui/pixel_ops.h"
#include "hw/m68k/next-cube.h"
+#include "qom/object.h"
-#define NEXTFB(obj) OBJECT_CHECK(NeXTFbState, (obj), TYPE_NEXTFB)
+typedef struct NeXTFbState NeXTFbState;
+DECLARE_INSTANCE_CHECKER(NeXTFbState, NEXTFB,
+ TYPE_NEXTFB)
struct NeXTFbState {
SysBusDevice parent_obj;
@@ -44,7 +47,6 @@ struct NeXTFbState {
uint32_t rows;
int invalidate;
};
-typedef struct NeXTFbState NeXTFbState;
static void nextfb_draw_line(void *opaque, uint8_t *d, const uint8_t *s,
int width, int pitch)
diff --git a/hw/display/pl110.c b/hw/display/pl110.c
index 61fefbffb3..af51a2b9e7 100644
--- a/hw/display/pl110.c
+++ b/hw/display/pl110.c
@@ -17,6 +17,7 @@
#include "qemu/timer.h"
#include "qemu/log.h"
#include "qemu/module.h"
+#include "qom/object.h"
#define PL110_CR_EN 0x001
#define PL110_CR_BGR 0x100
@@ -48,9 +49,11 @@ enum pl110_version
};
#define TYPE_PL110 "pl110"
-#define PL110(obj) OBJECT_CHECK(PL110State, (obj), TYPE_PL110)
+typedef struct PL110State PL110State;
+DECLARE_INSTANCE_CHECKER(PL110State, PL110,
+ TYPE_PL110)
-typedef struct PL110State {
+struct PL110State {
SysBusDevice parent_obj;
MemoryRegion iomem;
@@ -73,7 +76,7 @@ typedef struct PL110State {
uint32_t palette[256];
uint32_t raw_palette[128];
qemu_irq irq;
-} PL110State;
+};
static int vmstate_pl110_post_load(void *opaque, int version_id);
diff --git a/hw/display/qxl.h b/hw/display/qxl.h
index 707631a1f5..714cd01b63 100644
--- a/hw/display/qxl.h
+++ b/hw/display/qxl.h
@@ -8,6 +8,7 @@
#include "ui/qemu-spice.h"
#include "ui/spice-display.h"
+#include "qom/object.h"
enum qxl_mode {
QXL_MODE_UNDEFINED,
@@ -27,7 +28,7 @@ enum qxl_mode {
#define QXL_PAGE_BITS 12
#define QXL_PAGE_SIZE (1 << QXL_PAGE_BITS);
-typedef struct PCIQXLDevice {
+struct PCIQXLDevice {
PCIDevice pci;
PortioList vga_port_list;
SimpleSpiceDisplay ssd;
@@ -126,10 +127,12 @@ typedef struct PCIQXLDevice {
int num_dirty_rects;
QXLRect dirty[QXL_NUM_DIRTY_RECTS];
QEMUBH *update_area_bh;
-} PCIQXLDevice;
+};
+typedef struct PCIQXLDevice PCIQXLDevice;
#define TYPE_PCI_QXL "pci-qxl"
-#define PCI_QXL(obj) OBJECT_CHECK(PCIQXLDevice, (obj), TYPE_PCI_QXL)
+DECLARE_INSTANCE_CHECKER(PCIQXLDevice, PCI_QXL,
+ TYPE_PCI_QXL)
#define PANIC_ON(x) if ((x)) { \
printf("%s: PANIC %s failed\n", __func__, #x); \
diff --git a/hw/display/ramfb-standalone.c b/hw/display/ramfb-standalone.c
index b18db97eeb..8c0094397f 100644
--- a/hw/display/ramfb-standalone.c
+++ b/hw/display/ramfb-standalone.c
@@ -5,14 +5,17 @@
#include "hw/qdev-properties.h"
#include "hw/display/ramfb.h"
#include "ui/console.h"
+#include "qom/object.h"
-#define RAMFB(obj) OBJECT_CHECK(RAMFBStandaloneState, (obj), TYPE_RAMFB_DEVICE)
+typedef struct RAMFBStandaloneState RAMFBStandaloneState;
+DECLARE_INSTANCE_CHECKER(RAMFBStandaloneState, RAMFB,
+ TYPE_RAMFB_DEVICE)
-typedef struct RAMFBStandaloneState {
+struct RAMFBStandaloneState {
SysBusDevice parent_obj;
QemuConsole *con;
RAMFBState *state;
-} RAMFBStandaloneState;
+};
static void display_update_wrapper(void *dev)
{
diff --git a/hw/display/sii9022.c b/hw/display/sii9022.c
index 3b82a8567f..d88166f449 100644
--- a/hw/display/sii9022.c
+++ b/hw/display/sii9022.c
@@ -19,6 +19,7 @@
#include "migration/vmstate.h"
#include "hw/display/i2c-ddc.h"
#include "trace.h"
+#include "qom/object.h"
#define SII9022_SYS_CTRL_DATA 0x1a
#define SII9022_SYS_CTRL_PWR_DWN 0x10
@@ -35,16 +36,18 @@
#define SII9022_INT_STATUS_PLUGGED 0x04;
#define TYPE_SII9022 "sii9022"
-#define SII9022(obj) OBJECT_CHECK(sii9022_state, (obj), TYPE_SII9022)
+typedef struct sii9022_state sii9022_state;
+DECLARE_INSTANCE_CHECKER(sii9022_state, SII9022,
+ TYPE_SII9022)
-typedef struct sii9022_state {
+struct sii9022_state {
I2CSlave parent_obj;
uint8_t ptr;
bool addr_byte;
bool ddc_req;
bool ddc_skip_finish;
bool ddc;
-} sii9022_state;
+};
static const VMStateDescription vmstate_sii9022 = {
.name = "sii9022",
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 9cccc68c35..51120c6c3e 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -40,6 +40,7 @@
#include "ui/pixel_ops.h"
#include "qemu/bswap.h"
#include "trace.h"
+#include "qom/object.h"
#define MMIO_BASE_OFFSET 0x3e00000
#define MMIO_SIZE 0x200000
@@ -1931,10 +1932,11 @@ static const VMStateDescription vmstate_sm501_state = {
};
#define TYPE_SYSBUS_SM501 "sysbus-sm501"
-#define SYSBUS_SM501(obj) \
- OBJECT_CHECK(SM501SysBusState, (obj), TYPE_SYSBUS_SM501)
+typedef struct SM501SysBusState SM501SysBusState;
+DECLARE_INSTANCE_CHECKER(SM501SysBusState, SYSBUS_SM501,
+ TYPE_SYSBUS_SM501)
-typedef struct {
+struct SM501SysBusState {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
@@ -1942,7 +1944,7 @@ typedef struct {
uint32_t vram_size;
uint32_t base;
SerialMM serial;
-} SM501SysBusState;
+};
static void sm501_realize_sysbus(DeviceState *dev, Error **errp)
{
@@ -2034,15 +2036,17 @@ static const TypeInfo sm501_sysbus_info = {
};
#define TYPE_PCI_SM501 "sm501"
-#define PCI_SM501(obj) OBJECT_CHECK(SM501PCIState, (obj), TYPE_PCI_SM501)
+typedef struct SM501PCIState SM501PCIState;
+DECLARE_INSTANCE_CHECKER(SM501PCIState, PCI_SM501,
+ TYPE_PCI_SM501)
-typedef struct {
+struct SM501PCIState {
/*< private >*/
PCIDevice parent_obj;
/*< public >*/
SM501State state;
uint32_t vram_size;
-} SM501PCIState;
+};
static void sm501_realize_pci(PCIDevice *dev, Error **errp)
{
diff --git a/hw/display/ssd0303.c b/hw/display/ssd0303.c
index 718378f6de..0378573a42 100644
--- a/hw/display/ssd0303.c
+++ b/hw/display/ssd0303.c
@@ -16,6 +16,7 @@
#include "migration/vmstate.h"
#include "qemu/module.h"
#include "ui/console.h"
+#include "qom/object.h"
//#define DEBUG_SSD0303 1
@@ -46,9 +47,11 @@ enum ssd0303_cmd {
};
#define TYPE_SSD0303 "ssd0303"
-#define SSD0303(obj) OBJECT_CHECK(ssd0303_state, (obj), TYPE_SSD0303)
+typedef struct ssd0303_state ssd0303_state;
+DECLARE_INSTANCE_CHECKER(ssd0303_state, SSD0303,
+ TYPE_SSD0303)
-typedef struct {
+struct ssd0303_state {
I2CSlave parent_obj;
QemuConsole *con;
@@ -63,7 +66,7 @@ typedef struct {
enum ssd0303_mode mode;
enum ssd0303_cmd cmd_state;
uint8_t framebuffer[132*8];
-} ssd0303_state;
+};
static uint8_t ssd0303_recv(I2CSlave *i2c)
{
diff --git a/hw/display/ssd0323.c b/hw/display/ssd0323.c
index 32d27f008a..037da81127 100644
--- a/hw/display/ssd0323.c
+++ b/hw/display/ssd0323.c
@@ -16,6 +16,7 @@
#include "migration/vmstate.h"
#include "qemu/module.h"
#include "ui/console.h"
+#include "qom/object.h"
//#define DEBUG_SSD0323 1
@@ -47,7 +48,7 @@ enum ssd0323_mode
SSD0323_DATA
};
-typedef struct {
+struct ssd0323_state {
SSISlave ssidev;
QemuConsole *con;
@@ -64,10 +65,12 @@ typedef struct {
int32_t remap;
uint32_t mode;
uint8_t framebuffer[128 * 80 / 2];
-} ssd0323_state;
+};
+typedef struct ssd0323_state ssd0323_state;
#define TYPE_SSD0323 "ssd0323"
-#define SSD0323(obj) OBJECT_CHECK(ssd0323_state, (obj), TYPE_SSD0323)
+DECLARE_INSTANCE_CHECKER(ssd0323_state, SSD0323,
+ TYPE_SSD0323)
static uint32_t ssd0323_transfer(SSISlave *dev, uint32_t data)
diff --git a/hw/display/tcx.c b/hw/display/tcx.c
index 1fb45b1aab..69e901a800 100644
--- a/hw/display/tcx.c
+++ b/hw/display/tcx.c
@@ -33,6 +33,7 @@
#include "migration/vmstate.h"
#include "qemu/error-report.h"
#include "qemu/module.h"
+#include "qom/object.h"
#define TCX_ROM_FILE "QEMU,tcx.bin"
#define FCODE_MAX_ROM_SIZE 0x10000
@@ -55,9 +56,11 @@
#define TCX_THC_CURSBITS 0x980
#define TYPE_TCX "SUNW,tcx"
-#define TCX(obj) OBJECT_CHECK(TCXState, (obj), TYPE_TCX)
+typedef struct TCXState TCXState;
+DECLARE_INSTANCE_CHECKER(TCXState, TCX,
+ TYPE_TCX)
-typedef struct TCXState {
+struct TCXState {
SysBusDevice parent_obj;
QemuConsole *con;
@@ -93,7 +96,7 @@ typedef struct TCXState {
uint32_t cursbits[32];
uint16_t cursx;
uint16_t cursy;
-} TCXState;
+};
static void tcx_set_dirty(TCXState *s, ram_addr_t addr, int len)
{
diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c
index 3aaeeeca1e..0ebfcca9d1 100644
--- a/hw/display/vga-isa.c
+++ b/hw/display/vga-isa.c
@@ -32,17 +32,20 @@
#include "qemu/timer.h"
#include "hw/loader.h"
#include "hw/qdev-properties.h"
+#include "qom/object.h"
#define TYPE_ISA_VGA "isa-vga"
-#define ISA_VGA(obj) OBJECT_CHECK(ISAVGAState, (obj), TYPE_ISA_VGA)
+typedef struct ISAVGAState ISAVGAState;
+DECLARE_INSTANCE_CHECKER(ISAVGAState, ISA_VGA,
+ TYPE_ISA_VGA)
-typedef struct ISAVGAState {
+struct ISAVGAState {
ISADevice parent_obj;
struct VGACommonState state;
PortioList portio_vga;
PortioList portio_vbe;
-} ISAVGAState;
+};
static void vga_isa_reset(DeviceState *dev)
{
diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index a640fd866d..3b45fa3bad 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -34,6 +34,7 @@
#include "qemu/timer.h"
#include "hw/loader.h"
#include "hw/display/edid.h"
+#include "qom/object.h"
enum vga_pci_flags {
PCI_VGA_FLAG_ENABLE_MMIO = 1,
@@ -41,7 +42,7 @@ enum vga_pci_flags {
PCI_VGA_FLAG_ENABLE_EDID = 3,
};
-typedef struct PCIVGAState {
+struct PCIVGAState {
PCIDevice dev;
VGACommonState vga;
uint32_t flags;
@@ -49,10 +50,12 @@ typedef struct PCIVGAState {
MemoryRegion mmio;
MemoryRegion mrs[4];
uint8_t edid[256];
-} PCIVGAState;
+};
+typedef struct PCIVGAState PCIVGAState;
#define TYPE_PCI_VGA "pci-vga"
-#define PCI_VGA(obj) OBJECT_CHECK(PCIVGAState, (obj), TYPE_PCI_VGA)
+DECLARE_INSTANCE_CHECKER(PCIVGAState, PCI_VGA,
+ TYPE_PCI_VGA)
static const VMStateDescription vmstate_vga_pci = {
.name = "vga",
diff --git a/hw/display/vhost-user-gpu-pci.c b/hw/display/vhost-user-gpu-pci.c
index 23ce655e0f..a02b23ecaf 100644
--- a/hw/display/vhost-user-gpu-pci.c
+++ b/hw/display/vhost-user-gpu-pci.c
@@ -11,16 +11,18 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "hw/virtio/virtio-gpu-pci.h"
+#include "qom/object.h"
#define TYPE_VHOST_USER_GPU_PCI "vhost-user-gpu-pci"
-#define VHOST_USER_GPU_PCI(obj) \
- OBJECT_CHECK(VhostUserGPUPCI, (obj), TYPE_VHOST_USER_GPU_PCI)
+typedef struct VhostUserGPUPCI VhostUserGPUPCI;
+DECLARE_INSTANCE_CHECKER(VhostUserGPUPCI, VHOST_USER_GPU_PCI,
+ TYPE_VHOST_USER_GPU_PCI)
-typedef struct VhostUserGPUPCI {
+struct VhostUserGPUPCI {
VirtIOGPUPCIBase parent_obj;
VhostUserGPU vdev;
-} VhostUserGPUPCI;
+};
static void vhost_user_gpu_pci_initfn(Object *obj)
{
diff --git a/hw/display/vhost-user-vga.c b/hw/display/vhost-user-vga.c
index 1690f6b610..a34a99856d 100644
--- a/hw/display/vhost-user-vga.c
+++ b/hw/display/vhost-user-vga.c
@@ -11,17 +11,19 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "virtio-vga.h"
+#include "qom/object.h"
#define TYPE_VHOST_USER_VGA "vhost-user-vga"
-#define VHOST_USER_VGA(obj) \
- OBJECT_CHECK(VhostUserVGA, (obj), TYPE_VHOST_USER_VGA)
+typedef struct VhostUserVGA VhostUserVGA;
+DECLARE_INSTANCE_CHECKER(VhostUserVGA, VHOST_USER_VGA,
+ TYPE_VHOST_USER_VGA)
-typedef struct VhostUserVGA {
+struct VhostUserVGA {
VirtIOVGABase parent_obj;
VhostUserGPU vdev;
-} VhostUserVGA;
+};
static void vhost_user_vga_inst_initfn(Object *obj)
{
@@ -39,7 +41,7 @@ static void vhost_user_vga_inst_initfn(Object *obj)
static const VirtioPCIDeviceTypeInfo vhost_user_vga_info = {
.generic_name = TYPE_VHOST_USER_VGA,
.parent = TYPE_VIRTIO_VGA_BASE,
- .instance_size = sizeof(struct VhostUserVGA),
+ .instance_size = sizeof(VhostUserVGA),
.instance_init = vhost_user_vga_inst_initfn,
};
diff --git a/hw/display/virtio-gpu-pci.c b/hw/display/virtio-gpu-pci.c
index 34d8e93f28..d742a30aec 100644
--- a/hw/display/virtio-gpu-pci.c
+++ b/hw/display/virtio-gpu-pci.c
@@ -19,6 +19,7 @@
#include "hw/virtio/virtio.h"
#include "hw/virtio/virtio-bus.h"
#include "hw/virtio/virtio-gpu-pci.h"
+#include "qom/object.h"
static Property virtio_gpu_pci_base_properties[] = {
DEFINE_VIRTIO_GPU_PCI_PROPERTIES(VirtIOPCIProxy),
@@ -65,13 +66,14 @@ static const TypeInfo virtio_gpu_pci_base_info = {
};
#define TYPE_VIRTIO_GPU_PCI "virtio-gpu-pci"
-#define VIRTIO_GPU_PCI(obj) \
- OBJECT_CHECK(VirtIOGPUPCI, (obj), TYPE_VIRTIO_GPU_PCI)
+typedef struct VirtIOGPUPCI VirtIOGPUPCI;
+DECLARE_INSTANCE_CHECKER(VirtIOGPUPCI, VIRTIO_GPU_PCI,
+ TYPE_VIRTIO_GPU_PCI)
-typedef struct VirtIOGPUPCI {
+struct VirtIOGPUPCI {
VirtIOGPUPCIBase parent_obj;
VirtIOGPU vdev;
-} VirtIOGPUPCI;
+};
static void virtio_gpu_initfn(Object *obj)
{
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index f533d7d1b4..573e7d5928 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -5,6 +5,7 @@
#include "qapi/error.h"
#include "qemu/module.h"
#include "virtio-vga.h"
+#include "qom/object.h"
static void virtio_vga_base_invalidate_display(void *opaque)
{
@@ -194,22 +195,23 @@ static void virtio_vga_base_class_init(ObjectClass *klass, void *data)
static TypeInfo virtio_vga_base_info = {
.name = TYPE_VIRTIO_VGA_BASE,
.parent = TYPE_VIRTIO_PCI,
- .instance_size = sizeof(struct VirtIOVGABase),
- .class_size = sizeof(struct VirtIOVGABaseClass),
+ .instance_size = sizeof(VirtIOVGABase),
+ .class_size = sizeof(VirtIOVGABaseClass),
.class_init = virtio_vga_base_class_init,
.abstract = true,
};
#define TYPE_VIRTIO_VGA "virtio-vga"
-#define VIRTIO_VGA(obj) \
- OBJECT_CHECK(VirtIOVGA, (obj), TYPE_VIRTIO_VGA)
+typedef struct VirtIOVGA VirtIOVGA;
+DECLARE_INSTANCE_CHECKER(VirtIOVGA, VIRTIO_VGA,
+ TYPE_VIRTIO_VGA)
-typedef struct VirtIOVGA {
+struct VirtIOVGA {
VirtIOVGABase parent_obj;
VirtIOGPU vdev;
-} VirtIOVGA;
+};
static void virtio_vga_inst_initfn(Object *obj)
{
@@ -224,7 +226,7 @@ static void virtio_vga_inst_initfn(Object *obj)
static VirtioPCIDeviceTypeInfo virtio_vga_info = {
.generic_name = TYPE_VIRTIO_VGA,
.parent = TYPE_VIRTIO_VGA_BASE,
- .instance_size = sizeof(struct VirtIOVGA),
+ .instance_size = sizeof(VirtIOVGA),
.instance_init = virtio_vga_inst_initfn,
};
diff --git a/hw/display/virtio-vga.h b/hw/display/virtio-vga.h
index c41281a010..5c5671c9c1 100644
--- a/hw/display/virtio-vga.h
+++ b/hw/display/virtio-vga.h
@@ -3,30 +3,27 @@
#include "hw/virtio/virtio-gpu-pci.h"
#include "vga_int.h"
+#include "qom/object.h"
/*
* virtio-vga-base: This extends VirtioPCIProxy.
*/
#define TYPE_VIRTIO_VGA_BASE "virtio-vga-base"
-#define VIRTIO_VGA_BASE(obj) \
- OBJECT_CHECK(VirtIOVGABase, (obj), TYPE_VIRTIO_VGA_BASE)
-#define VIRTIO_VGA_BASE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VirtIOVGABaseClass, obj, TYPE_VIRTIO_VGA_BASE)
-#define VIRTIO_VGA_BASE_CLASS(klass) \
- OBJECT_CLASS_CHECK(VirtIOVGABaseClass, klass, TYPE_VIRTIO_VGA_BASE)
+OBJECT_DECLARE_TYPE(VirtIOVGABase, VirtIOVGABaseClass,
+ virtio_vga_base, VIRTIO_VGA_BASE)
-typedef struct VirtIOVGABase {
+struct VirtIOVGABase {
VirtIOPCIProxy parent_obj;
VirtIOGPUBase *vgpu;
VGACommonState vga;
MemoryRegion vga_mrs[3];
-} VirtIOVGABase;
+};
-typedef struct VirtIOVGABaseClass {
+struct VirtIOVGABaseClass {
VirtioPCIClass parent_class;
DeviceReset parent_reset;
-} VirtIOVGABaseClass;
+};
#endif /* VIRTIO_VGA_H */
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index 2579f6b218..bef0d7d69a 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -33,6 +33,7 @@
#include "hw/pci/pci.h"
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
+#include "qom/object.h"
#undef VERBOSE
#define HW_RECT_ACCEL
@@ -85,8 +86,8 @@ struct vmsvga_state_s {
#define TYPE_VMWARE_SVGA "vmware-svga"
-#define VMWARE_SVGA(obj) \
- OBJECT_CHECK(struct pci_vmsvga_state_s, (obj), TYPE_VMWARE_SVGA)
+DECLARE_INSTANCE_CHECKER(struct pci_vmsvga_state_s, VMWARE_SVGA,
+ TYPE_VMWARE_SVGA)
struct pci_vmsvga_state_s {
/*< private >*/