Revision 40905a6a hw/pl061.c

b/hw/pl061.c
8 8
 * This code is licenced under the GPL.
9 9
 */
10 10

  
11
#include "hw.h"
12
#include "primecell.h"
11
#include "sysbus.h"
13 12

  
14 13
//#define DEBUG_PL061 1
15 14

  
......
28 27
  { 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x18, 0x01, 0x0d, 0xf0, 0x05, 0xb1 };
29 28

  
30 29
typedef struct {
30
    SysBusDevice busdev;
31 31
    int locked;
32 32
    uint8_t data;
33 33
    uint8_t old_data;
......
291 291
    return 0;
292 292
}
293 293

  
294
/* Returns an array of inputs.  */
295
qemu_irq *pl061_init(uint32_t base, qemu_irq irq, qemu_irq **out)
294
static void pl061_init(SysBusDevice *dev)
296 295
{
297 296
    int iomemtype;
298
    pl061_state *s;
297
    pl061_state *s = FROM_SYSBUS(pl061_state, dev);
299 298

  
300
    s = (pl061_state *)qemu_mallocz(sizeof(pl061_state));
301 299
    iomemtype = cpu_register_io_memory(0, pl061_readfn,
302 300
                                       pl061_writefn, s);
303
    cpu_register_physical_memory(base, 0x00001000, iomemtype);
304
    s->irq = irq;
301
    sysbus_init_mmio(dev, 0x1000, iomemtype);
302
    sysbus_init_irq(dev, &s->irq);
303
    qdev_init_gpio_in(&dev->qdev, pl061_set_irq, 8);
304
    qdev_init_gpio_out(&dev->qdev, s->out, 8);
305 305
    pl061_reset(s);
306
    if (out)
307
        *out = s->out;
308

  
309 306
    register_savevm("pl061_gpio", -1, 1, pl061_save, pl061_load, s);
310
    return qemu_allocate_irqs(pl061_set_irq, s, 8);
311 307
}
308

  
309
static void pl061_register_devices(void)
310
{
311
    sysbus_register_dev("pl061", sizeof(pl061_state),
312
                        pl061_init);
313
}
314

  
315
device_init(pl061_register_devices)

Also available in: Unified diff