4 /* Devices attached directly to the main system bus. */
9 #define QDEV_MAX_MMIO 32
10 #define QDEV_MAX_PIO 32
11 #define QDEV_MAX_IRQ 256
13 typedef struct SysBusDevice SysBusDevice
;
14 typedef void (*mmio_mapfunc
)(SysBusDevice
*dev
, target_phys_addr_t addr
);
19 qemu_irq irqs
[QDEV_MAX_IRQ
];
20 qemu_irq
*irqp
[QDEV_MAX_IRQ
];
23 target_phys_addr_t addr
;
24 target_phys_addr_t size
;
28 } mmio
[QDEV_MAX_MMIO
];
30 pio_addr_t pio
[QDEV_MAX_PIO
];
33 typedef int (*sysbus_initfn
)(SysBusDevice
*dev
);
35 /* Macros to compensate for lack of type inheritance in C. */
36 #define sysbus_from_qdev(dev) ((SysBusDevice *)(dev))
37 #define FROM_SYSBUS(type, dev) DO_UPCAST(type, busdev, dev)
44 void sysbus_register_dev(const char *name
, size_t size
, sysbus_initfn init
);
45 void sysbus_register_withprop(SysBusDeviceInfo
*info
);
46 void *sysbus_new(void);
47 void sysbus_init_mmio(SysBusDevice
*dev
, target_phys_addr_t size
,
49 void sysbus_init_mmio_cb(SysBusDevice
*dev
, target_phys_addr_t size
,
51 void sysbus_init_mmio_region(SysBusDevice
*dev
, MemoryRegion
*memory
);
52 void sysbus_init_irq(SysBusDevice
*dev
, qemu_irq
*p
);
53 void sysbus_pass_irq(SysBusDevice
*dev
, SysBusDevice
*target
);
54 void sysbus_init_ioports(SysBusDevice
*dev
, pio_addr_t ioport
, pio_addr_t size
);
57 void sysbus_connect_irq(SysBusDevice
*dev
, int n
, qemu_irq irq
);
58 void sysbus_mmio_map(SysBusDevice
*dev
, int n
, target_phys_addr_t addr
);
60 /* Legacy helper function for creating devices. */
61 DeviceState
*sysbus_create_varargs(const char *name
,
62 target_phys_addr_t addr
, ...);
63 DeviceState
*sysbus_try_create_varargs(const char *name
,
64 target_phys_addr_t addr
, ...);
65 static inline DeviceState
*sysbus_create_simple(const char *name
,
66 target_phys_addr_t addr
,
69 return sysbus_create_varargs(name
, addr
, irq
, NULL
);
72 static inline DeviceState
*sysbus_try_create_simple(const char *name
,
73 target_phys_addr_t addr
,
76 return sysbus_try_create_varargs(name
, addr
, irq
, NULL
);
79 #endif /* !HW_SYSBUS_H */