~vcs-imports/qemu/maemo

« back to all changes in this revision

Viewing changes to hw/sysbus.h

  • Committer: Riku Voipio
  • Date: 2009-06-08 15:31:58 UTC
  • mfrom: (6281.2.366)
  • mto: This revision was merged to the branch mainline in revision 6452.
  • Revision ID: git-v1:759b334a9739814df2883aa4c41b1c0f5670e90a
Merge commit 'gnu/master' into test

Epic merge

Conflicts:
        Makefile
        block.c
        block.h
        configure
        hw/boards.h
        hw/flash.h
        hw/integratorcp.c
        hw/nand.c
        hw/omap2.c
        hw/omap_i2c.c
        hw/sd.c
        hw/smc91c111.c
        hw/tsc2005.c
        hw/tusb6010.c
        hw/usb-musb.c
        linux-user/syscall.c
        target-arm/machine.c
        target-arm/translate.c

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef HW_SYSBUS_H
 
2
#define HW_SYSBUS_H 1
 
3
 
 
4
/* Devices attached directly to the main system bus.  */
 
5
 
 
6
#include "qdev.h"
 
7
 
 
8
#define QDEV_MAX_MMIO 5
 
9
#define QDEV_MAX_IRQ 32
 
10
 
 
11
typedef struct SysBusDevice SysBusDevice;
 
12
typedef void (*mmio_mapfunc)(SysBusDevice *dev, target_phys_addr_t addr);
 
13
 
 
14
struct SysBusDevice {
 
15
    DeviceState qdev;
 
16
    int num_irq;
 
17
    qemu_irq irqs[QDEV_MAX_IRQ];
 
18
    qemu_irq *irqp[QDEV_MAX_IRQ];
 
19
    int num_mmio;
 
20
    struct {
 
21
        target_phys_addr_t addr;
 
22
        target_phys_addr_t size;
 
23
        mmio_mapfunc cb;
 
24
        int iofunc;
 
25
    } mmio[QDEV_MAX_MMIO];
 
26
};
 
27
 
 
28
typedef void (*sysbus_initfn)(SysBusDevice *dev);
 
29
 
 
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)
 
33
 
 
34
typedef struct {
 
35
    DeviceInfo qdev;
 
36
    sysbus_initfn init;
 
37
} SysBusDeviceInfo;
 
38
 
 
39
void sysbus_register_dev(const char *name, size_t size, sysbus_initfn init);
 
40
void sysbus_register_withprop(const char *name, size_t size,
 
41
                              SysBusDeviceInfo *info);
 
42
void *sysbus_new(void);
 
43
void sysbus_init_mmio(SysBusDevice *dev, target_phys_addr_t size, int iofunc);
 
44
void sysbus_init_mmio_cb(SysBusDevice *dev, target_phys_addr_t size,
 
45
                            mmio_mapfunc cb);
 
46
void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
 
47
void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target);
 
48
 
 
49
 
 
50
void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq);
 
51
void sysbus_mmio_map(SysBusDevice *dev, int n, target_phys_addr_t addr);
 
52
 
 
53
/* Legacy helper function for creating devices.  */
 
54
DeviceState *sysbus_create_varargs(const char *name,
 
55
                                 target_phys_addr_t addr, ...);
 
56
static inline DeviceState *sysbus_create_simple(const char *name,
 
57
                                              target_phys_addr_t addr,
 
58
                                              qemu_irq irq)
 
59
{
 
60
    return sysbus_create_varargs(name, addr, irq, NULL);
 
61
}
 
62
 
 
63
#endif /* !HW_SYSBUS_H */