diff options
Diffstat (limited to 'hw/spapr_vio.h')
-rw-r--r-- | hw/spapr_vio.h | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/hw/spapr_vio.h b/hw/spapr_vio.h index 0984d559db..7d1155a060 100644 --- a/hw/spapr_vio.h +++ b/hw/spapr_vio.h @@ -34,6 +34,14 @@ enum VIOsPAPR_TCEAccess { #define SPAPR_VTY_BASE_ADDRESS 0x30000000 +#define TYPE_VIO_SPAPR_DEVICE "vio-spapr-device" +#define VIO_SPAPR_DEVICE(obj) \ + OBJECT_CHECK(VIOsPAPRDevice, (obj), TYPE_VIO_SPAPR_DEVICE) +#define VIO_SPAPR_DEVICE_CLASS(klass) \ + OBJECT_CLASS_CHECK(VIOsPAPRDeviceClass, (klass), TYPE_VIO_SPAPR_DEVICE) +#define VIO_SPAPR_DEVICE_GET_CLASS(obj) \ + OBJECT_GET_CLASS(VIOsPAPRDeviceClass, (obj), TYPE_VIO_SPAPR_DEVICE) + struct VIOsPAPRDevice; typedef struct VIOsPAPR_RTCE { @@ -47,7 +55,20 @@ typedef struct VIOsPAPR_CRQ { int(*SendFunc)(struct VIOsPAPRDevice *vdev, uint8_t *crq); } VIOsPAPR_CRQ; -typedef struct VIOsPAPRDevice { +typedef struct VIOsPAPRDevice VIOsPAPRDevice; +typedef struct VIOsPAPRBus VIOsPAPRBus; + +typedef struct VIOsPAPRDeviceClass { + DeviceClass parent_class; + + const char *dt_name, *dt_type, *dt_compatible; + target_ulong signal_mask; + int (*init)(VIOsPAPRDevice *dev); + void (*hcalls)(VIOsPAPRBus *bus); + int (*devnode)(VIOsPAPRDevice *dev, void *fdt, int node_off); +} VIOsPAPRDeviceClass; + +struct VIOsPAPRDevice { DeviceState qdev; uint32_t reg; uint32_t flags; @@ -59,28 +80,24 @@ typedef struct VIOsPAPRDevice { VIOsPAPR_RTCE *rtce_table; int kvmtce_fd; VIOsPAPR_CRQ crq; -} VIOsPAPRDevice; +}; #define DEFINE_SPAPR_PROPERTIES(type, field, default_reg, default_dma_window) \ DEFINE_PROP_UINT32("reg", type, field.reg, default_reg), \ DEFINE_PROP_UINT32("dma-window", type, field.rtce_window_size, \ default_dma_window) -typedef struct VIOsPAPRBus { +struct VIOsPAPRBus { BusState bus; -} VIOsPAPRBus; - -typedef struct { - DeviceInfo qdev; const char *dt_name, *dt_type, *dt_compatible; target_ulong signal_mask; int (*init)(VIOsPAPRDevice *dev); int (*devnode)(VIOsPAPRDevice *dev, void *fdt, int node_off); -} VIOsPAPRDeviceInfo; +}; extern VIOsPAPRBus *spapr_vio_bus_init(void); extern VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg); -extern void spapr_vio_bus_register_withprop(VIOsPAPRDeviceInfo *info); +extern void spapr_vio_bus_register_withprop(DeviceInfo *info); extern int spapr_populate_vdevice(VIOsPAPRBus *bus, void *fdt); extern int spapr_populate_chosen_stdout(void *fdt, VIOsPAPRBus *bus); |