4 /* Devices attached directly to the main system bus. */
8 #define QDEV_MAX_MMIO 32
9 #define QDEV_MAX_IRQ 256
11 typedef struct SysBusDevice SysBusDevice
;
12 typedef void (*mmio_mapfunc
)(SysBusDevice
*dev
, target_phys_addr_t addr
);
17 qemu_irq irqs
[QDEV_MAX_IRQ
];
18 qemu_irq
*irqp
[QDEV_MAX_IRQ
];
21 target_phys_addr_t addr
;
22 target_phys_addr_t size
;
25 } mmio
[QDEV_MAX_MMIO
];
28 typedef void (*sysbus_initfn
)(SysBusDevice
*dev
);
30 /* Macros to compensate for lack of type inheritance in C. */
31 #define sysbus_from_qdev(dev) ((SysBusDevice *)(dev))
32 #define FROM_SYSBUS(type, dev) DO_UPCAST(type, busdev, dev)
39 void sysbus_register_dev(const char *name
, size_t size
, sysbus_initfn init
);
40 void sysbus_register_withprop(SysBusDeviceInfo
*info
);
41 void *sysbus_new(void);
42 void sysbus_init_mmio(SysBusDevice
*dev
, target_phys_addr_t size
, int iofunc
);
43 void sysbus_init_mmio_cb(SysBusDevice
*dev
, target_phys_addr_t size
,
45 void sysbus_init_irq(SysBusDevice
*dev
, qemu_irq
*p
);
46 void sysbus_pass_irq(SysBusDevice
*dev
, SysBusDevice
*target
);
49 void sysbus_connect_irq(SysBusDevice
*dev
, int n
, qemu_irq irq
);
50 void sysbus_mmio_map(SysBusDevice
*dev
, int n
, target_phys_addr_t addr
);
52 /* Legacy helper function for creating devices. */
53 DeviceState
*sysbus_create_varargs(const char *name
,
54 target_phys_addr_t addr
, ...);
55 static inline DeviceState
*sysbus_create_simple(const char *name
,
56 target_phys_addr_t addr
,
59 return sysbus_create_varargs(name
, addr
, irq
, NULL
);
62 #endif /* !HW_SYSBUS_H */