diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2011-02-21 20:57:51 +0000 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2011-03-06 19:01:30 +0100 |
commit | 7063f49f59807ac6f32c69281cf956d14d6c0310 (patch) | |
tree | 7f1e8a1d6190f5a6c9972c4dc0cd3726a4b10dcc /hw | |
parent | b50ff6f524fae78c7d79b27b00af701d7c28e80c (diff) |
hw/pl061.c: Implement ARM PL061 as well as Luminary one
ARM's PL061 has a different set of ID registers to the one in the
Luminary Stellaris; implement this so that the Linux driver can
identify the Realview PBX PL061 correctly.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/pl061.c | 23 | ||||
-rw-r--r-- | hw/stellaris.c | 2 |
2 files changed, 20 insertions, 5 deletions
diff --git a/hw/pl061.c b/hw/pl061.c index 1997b7cd2f..2e181f8c2f 100644 --- a/hw/pl061.c +++ b/hw/pl061.c @@ -24,6 +24,8 @@ do { fprintf(stderr, "pl061: error: " fmt , ## __VA_ARGS__);} while (0) #endif static const uint8_t pl061_id[12] = + { 0x00, 0x00, 0x00, 0x00, 0x61, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 }; +static const uint8_t pl061_id_luminary[12] = { 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x18, 0x01, 0x0d, 0xf0, 0x05, 0xb1 }; typedef struct { @@ -50,6 +52,7 @@ typedef struct { uint8_t float_high; qemu_irq irq; qemu_irq out[8]; + const unsigned char *id; } pl061_state; static void pl061_update(pl061_state *s) @@ -83,7 +86,7 @@ static uint32_t pl061_read(void *opaque, target_phys_addr_t offset) pl061_state *s = (pl061_state *)opaque; if (offset >= 0xfd0 && offset < 0x1000) { - return pl061_id[(offset - 0xfd0) >> 2]; + return s->id[(offset - 0xfd0) >> 2]; } if (offset < 0x400) { return s->data & (offset >> 2); @@ -291,11 +294,11 @@ static int pl061_load(QEMUFile *f, void *opaque, int version_id) return 0; } -static int pl061_init(SysBusDevice *dev) +static int pl061_init(SysBusDevice *dev, const unsigned char *id) { int iomemtype; pl061_state *s = FROM_SYSBUS(pl061_state, dev); - + s->id = id; iomemtype = cpu_register_io_memory(pl061_readfn, pl061_writefn, s, DEVICE_NATIVE_ENDIAN); @@ -308,10 +311,22 @@ static int pl061_init(SysBusDevice *dev) return 0; } +static int pl061_init_luminary(SysBusDevice *dev) +{ + return pl061_init(dev, pl061_id_luminary); +} + +static int pl061_init_arm(SysBusDevice *dev) +{ + return pl061_init(dev, pl061_id); +} + static void pl061_register_devices(void) { sysbus_register_dev("pl061", sizeof(pl061_state), - pl061_init); + pl061_init_arm); + sysbus_register_dev("pl061_luminary", sizeof(pl061_state), + pl061_init_luminary); } device_init(pl061_register_devices) diff --git a/hw/stellaris.c b/hw/stellaris.c index b90327305a..5d8bd5568d 100644 --- a/hw/stellaris.c +++ b/hw/stellaris.c @@ -1338,7 +1338,7 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model, for (i = 0; i < 7; i++) { if (board->dc4 & (1 << i)) { - gpio_dev[i] = sysbus_create_simple("pl061", gpio_addr[i], + gpio_dev[i] = sysbus_create_simple("pl061_luminary", gpio_addr[i], pic[gpio_irq[i]]); for (j = 0; j < 8; j++) { gpio_in[i][j] = qdev_get_gpio_in(gpio_dev[i], j); |