sysbus.h (98c710f2d5cdf37f29a267352eb1f3c28cbf369d) sysbus.h (046f370fb44172a34e54e341e7aeca4405af67a1)
1#ifndef HW_SYSBUS_H
1#ifndef HW_SYSBUS_H
2#define HW_SYSBUS_H 1
2#define HW_SYSBUS_H
3
4/* Devices attached directly to the main system bus. */
5
6#include "hw/qdev.h"
7#include "exec/memory.h"
8
9#define QDEV_MAX_MMIO 32
10#define QDEV_MAX_PIO 32

--- 59 unchanged lines hidden (view full) ---

70 struct {
71 hwaddr addr;
72 MemoryRegion *memory;
73 } mmio[QDEV_MAX_MMIO];
74 int num_pio;
75 uint32_t pio[QDEV_MAX_PIO];
76};
77
3
4/* Devices attached directly to the main system bus. */
5
6#include "hw/qdev.h"
7#include "exec/memory.h"
8
9#define QDEV_MAX_MMIO 32
10#define QDEV_MAX_PIO 32

--- 59 unchanged lines hidden (view full) ---

70 struct {
71 hwaddr addr;
72 MemoryRegion *memory;
73 } mmio[QDEV_MAX_MMIO];
74 int num_pio;
75 uint32_t pio[QDEV_MAX_PIO];
76};
77
78typedef int FindSysbusDeviceFunc(SysBusDevice *sbdev, void *opaque);
78typedef void FindSysbusDeviceFunc(SysBusDevice *sbdev, void *opaque);
79
80void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory);
81MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n);
82void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
83void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target);
84void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size);
85
86

--- 4 unchanged lines hidden (view full) ---

91qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n);
92void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr);
93void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr,
94 int priority);
95void sysbus_add_io(SysBusDevice *dev, hwaddr addr,
96 MemoryRegion *mem);
97MemoryRegion *sysbus_address_space(SysBusDevice *dev);
98
79
80void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory);
81MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n);
82void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
83void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target);
84void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size);
85
86

--- 4 unchanged lines hidden (view full) ---

91qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n);
92void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr);
93void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr,
94 int priority);
95void sysbus_add_io(SysBusDevice *dev, hwaddr addr,
96 MemoryRegion *mem);
97MemoryRegion *sysbus_address_space(SysBusDevice *dev);
98
99/**
100 * sysbus_init_child_obj:
101 * @parent: The parent object
102 * @childname: Used as name of the "child<>" property in the parent
103 * @child: A pointer to the memory to be used for the object.
104 * @childsize: The maximum size available at @child for the object.
105 * @childtype: The name of the type of the object to instantiate.
106 *
107 * This function will initialize an object and attach it to the main system
108 * bus. The memory for the object should have already been allocated. The
109 * object will then be added as child to the given parent. The returned object
110 * has a reference count of 1 (for the "child<...>" property from the parent),
111 * so the object will be finalized automatically when the parent gets removed.
112 */
113void sysbus_init_child_obj(Object *parent, const char *childname, void *child,
114 size_t childsize, const char *childtype);
115
99/* Call func for every dynamically created sysbus device in the system */
100void foreach_dynamic_sysbus_device(FindSysbusDeviceFunc *func, void *opaque);
101
102/* Legacy helper function for creating devices. */
103DeviceState *sysbus_create_varargs(const char *name,
104 hwaddr addr, ...);
105DeviceState *sysbus_try_create_varargs(const char *name,
106 hwaddr addr, ...);

--- 6 unchanged lines hidden (view full) ---

113
114static inline DeviceState *sysbus_try_create_simple(const char *name,
115 hwaddr addr,
116 qemu_irq irq)
117{
118 return sysbus_try_create_varargs(name, addr, irq, NULL);
119}
120
116/* Call func for every dynamically created sysbus device in the system */
117void foreach_dynamic_sysbus_device(FindSysbusDeviceFunc *func, void *opaque);
118
119/* Legacy helper function for creating devices. */
120DeviceState *sysbus_create_varargs(const char *name,
121 hwaddr addr, ...);
122DeviceState *sysbus_try_create_varargs(const char *name,
123 hwaddr addr, ...);

--- 6 unchanged lines hidden (view full) ---

130
131static inline DeviceState *sysbus_try_create_simple(const char *name,
132 hwaddr addr,
133 qemu_irq irq)
134{
135 return sysbus_try_create_varargs(name, addr, irq, NULL);
136}
137
121#endif /* !HW_SYSBUS_H */
138#endif /* HW_SYSBUS_H */