mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 03:59:52 +00:00
776346cd63
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAABAgAGBQJUYh9vAAoJEL7lnXSkw9fbgPQH/065L5+SpaJR1Nte9Lz3N2s1 a6tGSI22yu85tKvYCdYjeoVHSkSTyR57FdTfUd2xc2QPj+J4sWXpA81KILBGTJUp NMpmLpWg4LOh8Ek4ViRgmFFdryzIFa4dT4gc1AcSAIAQ6jsgK1dM7m5kfncC3TN0 TUs248vJ2i/DaE0k8TOeJqxJTqInoFttlJEqG7RD+V5JznokE4zpFNXHDGx9BptE W2J38GJ/TKRPe9UrHMKZI1r6+ZBdXyE/CaqsNNKLJdqrHgSQuAyK/PS6dQbM4BLg M1qdP7Tp0wOlvv9qoEZMOEiUsi54XPqLgaLMbW74Yp5X459fqmLW2imy49pHXt8= =klsW -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2014-11-11' into staging trivial patches for 2014-11-11 # gpg: Signature made Tue 11 Nov 2014 14:38:39 GMT using RSA key ID A4C3D7DB # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" # gpg: aka "Michael Tokarev <mjt@corpit.ru>" # gpg: aka "Michael Tokarev <mjt@debian.org>" * remotes/mjt/tags/pull-trivial-patches-2014-11-11: block: Fix comment for bdrv_co_get_block_status sysbus: Correct SYSTEM_BUS(obj) defines target-i386: cpu: keeping function parameters alignment on new line xen-hvm: Remove redundant variable 'xstate' coroutine-sigaltstack: Change jmp_buf to sigjmp_buf pc-bios: petalogix-s3adsp1800.dtb: Use 'xlnx, xps-ethernetlite-2.00.a' instead of 'xlnx, xps-ethernetlite-2.00.b' gdbstub: Add a missing case of signal number translation in gdbstub numa: make 'info numa' take into account hotplugged memory slirp/smbd: modify/set several parameters in generated smbd.conf qemu-doc.texi: fix typos in x509 examples icc_bus: fix typo ICC_BRIGDE -> ICC_BRIDGE Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
104 lines
3.5 KiB
C
104 lines
3.5 KiB
C
#ifndef HW_SYSBUS_H
|
|
#define HW_SYSBUS_H 1
|
|
|
|
/* Devices attached directly to the main system bus. */
|
|
|
|
#include "hw/qdev.h"
|
|
#include "exec/memory.h"
|
|
|
|
#define QDEV_MAX_MMIO 32
|
|
#define QDEV_MAX_PIO 32
|
|
|
|
#define TYPE_SYSTEM_BUS "System"
|
|
#define SYSTEM_BUS(obj) OBJECT_CHECK(BusState, (obj), TYPE_SYSTEM_BUS)
|
|
|
|
typedef struct SysBusDevice SysBusDevice;
|
|
|
|
#define TYPE_SYS_BUS_DEVICE "sys-bus-device"
|
|
#define SYS_BUS_DEVICE(obj) \
|
|
OBJECT_CHECK(SysBusDevice, (obj), TYPE_SYS_BUS_DEVICE)
|
|
#define SYS_BUS_DEVICE_CLASS(klass) \
|
|
OBJECT_CLASS_CHECK(SysBusDeviceClass, (klass), TYPE_SYS_BUS_DEVICE)
|
|
#define SYS_BUS_DEVICE_GET_CLASS(obj) \
|
|
OBJECT_GET_CLASS(SysBusDeviceClass, (obj), TYPE_SYS_BUS_DEVICE)
|
|
|
|
/**
|
|
* SysBusDeviceClass:
|
|
* @init: Callback function invoked when the #DeviceState.realized property
|
|
* is changed to %true. Deprecated, new types inheriting directly from
|
|
* TYPE_SYS_BUS_DEVICE should use #DeviceClass.realize instead, new leaf
|
|
* types should consult their respective parent type.
|
|
*
|
|
* SysBusDeviceClass is not overriding #DeviceClass.realize, so derived
|
|
* classes overriding it are not required to invoke its implementation.
|
|
*/
|
|
|
|
#define SYSBUS_DEVICE_GPIO_IRQ "sysbus-irq"
|
|
|
|
typedef struct SysBusDeviceClass {
|
|
/*< private >*/
|
|
DeviceClass parent_class;
|
|
/*< public >*/
|
|
|
|
int (*init)(SysBusDevice *dev);
|
|
} SysBusDeviceClass;
|
|
|
|
struct SysBusDevice {
|
|
/*< private >*/
|
|
DeviceState parent_obj;
|
|
/*< public >*/
|
|
|
|
int num_mmio;
|
|
struct {
|
|
hwaddr addr;
|
|
MemoryRegion *memory;
|
|
} mmio[QDEV_MAX_MMIO];
|
|
int num_pio;
|
|
pio_addr_t pio[QDEV_MAX_PIO];
|
|
};
|
|
|
|
typedef int FindSysbusDeviceFunc(SysBusDevice *sbdev, void *opaque);
|
|
|
|
void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory);
|
|
MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n);
|
|
void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
|
|
void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target);
|
|
void sysbus_init_ioports(SysBusDevice *dev, pio_addr_t ioport, pio_addr_t size);
|
|
|
|
|
|
bool sysbus_has_irq(SysBusDevice *dev, int n);
|
|
bool sysbus_has_mmio(SysBusDevice *dev, unsigned int n);
|
|
void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq);
|
|
bool sysbus_is_irq_connected(SysBusDevice *dev, int n);
|
|
qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n);
|
|
void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr);
|
|
void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr,
|
|
int priority);
|
|
void sysbus_add_io(SysBusDevice *dev, hwaddr addr,
|
|
MemoryRegion *mem);
|
|
MemoryRegion *sysbus_address_space(SysBusDevice *dev);
|
|
|
|
/* Call func for every dynamically created sysbus device in the system */
|
|
void foreach_dynamic_sysbus_device(FindSysbusDeviceFunc *func, void *opaque);
|
|
|
|
/* Legacy helper function for creating devices. */
|
|
DeviceState *sysbus_create_varargs(const char *name,
|
|
hwaddr addr, ...);
|
|
DeviceState *sysbus_try_create_varargs(const char *name,
|
|
hwaddr addr, ...);
|
|
static inline DeviceState *sysbus_create_simple(const char *name,
|
|
hwaddr addr,
|
|
qemu_irq irq)
|
|
{
|
|
return sysbus_create_varargs(name, addr, irq, NULL);
|
|
}
|
|
|
|
static inline DeviceState *sysbus_try_create_simple(const char *name,
|
|
hwaddr addr,
|
|
qemu_irq irq)
|
|
{
|
|
return sysbus_try_create_varargs(name, addr, irq, NULL);
|
|
}
|
|
|
|
#endif /* !HW_SYSBUS_H */
|