Delete unused tb_invalidate_page_range
[qemu/mdroth.git] / hw / sysbus.h
blob4e8cb16d4206d007fa52914932a68d0081273ac7
1 #ifndef HW_SYSBUS_H
2 #define HW_SYSBUS_H 1
4 /* Devices attached directly to the main system bus. */
6 #include "qdev.h"
8 #define QDEV_MAX_MMIO 32
9 #define QDEV_MAX_PIO 32
10 #define QDEV_MAX_IRQ 256
12 typedef struct SysBusDevice SysBusDevice;
13 typedef void (*mmio_mapfunc)(SysBusDevice *dev, target_phys_addr_t addr);
15 struct SysBusDevice {
16 DeviceState qdev;
17 int num_irq;
18 qemu_irq irqs[QDEV_MAX_IRQ];
19 qemu_irq *irqp[QDEV_MAX_IRQ];
20 int num_mmio;
21 struct {
22 target_phys_addr_t addr;
23 target_phys_addr_t size;
24 mmio_mapfunc cb;
25 ram_addr_t iofunc;
26 } mmio[QDEV_MAX_MMIO];
27 int num_pio;
28 pio_addr_t pio[QDEV_MAX_PIO];
31 typedef int (*sysbus_initfn)(SysBusDevice *dev);
33 /* Macros to compensate for lack of type inheritance in C. */
34 #define sysbus_from_qdev(dev) ((SysBusDevice *)(dev))
35 #define FROM_SYSBUS(type, dev) DO_UPCAST(type, busdev, dev)
37 typedef struct {
38 DeviceInfo qdev;
39 sysbus_initfn init;
40 } SysBusDeviceInfo;
42 void sysbus_register_dev(const char *name, size_t size, sysbus_initfn init);
43 void sysbus_register_withprop(SysBusDeviceInfo *info);
44 void *sysbus_new(void);
45 void sysbus_init_mmio(SysBusDevice *dev, target_phys_addr_t size,
46 ram_addr_t iofunc);
47 void sysbus_init_mmio_cb(SysBusDevice *dev, target_phys_addr_t size,
48 mmio_mapfunc cb);
49 void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
50 void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target);
51 void sysbus_init_ioports(SysBusDevice *dev, pio_addr_t ioport, pio_addr_t size);
54 void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq);
55 void sysbus_mmio_map(SysBusDevice *dev, int n, target_phys_addr_t addr);
57 /* Legacy helper function for creating devices. */
58 DeviceState *sysbus_create_varargs(const char *name,
59 target_phys_addr_t addr, ...);
60 DeviceState *sysbus_try_create_varargs(const char *name,
61 target_phys_addr_t addr, ...);
62 static inline DeviceState *sysbus_create_simple(const char *name,
63 target_phys_addr_t addr,
64 qemu_irq irq)
66 return sysbus_create_varargs(name, addr, irq, NULL);
69 static inline DeviceState *sysbus_try_create_simple(const char *name,
70 target_phys_addr_t addr,
71 qemu_irq irq)
73 return sysbus_try_create_varargs(name, addr, irq, NULL);
76 #endif /* !HW_SYSBUS_H */