mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
spapr: convert to QEMU Object Model (v2)
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> --- v1 -> v2 - use QOM to check for the default console
This commit is contained in:
parent
b9eea3e6a4
commit
3954d33ab7
5 changed files with 126 additions and 71 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue