Commit 2e9bdce56f307db907f4d6533d3a3917259f859f
1 parent
6f68ecb2
PL110 qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
Showing
5 changed files
with
30 additions
and
19 deletions
hw/integratorcp.c
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | * This code is licenced under the GPL | 7 | * This code is licenced under the GPL |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | -#include "hw.h" | 10 | +#include "sysbus.h" |
| 11 | #include "primecell.h" | 11 | #include "primecell.h" |
| 12 | #include "devices.h" | 12 | #include "devices.h" |
| 13 | #include "sysemu.h" | 13 | #include "sysemu.h" |
| @@ -495,7 +495,8 @@ static void integratorcp_init(ram_addr_t ram_size, | @@ -495,7 +495,8 @@ static void integratorcp_init(ram_addr_t ram_size, | ||
| 495 | pl181_init(0x1c000000, drives_table[sd].bdrv, pic[23], pic[24]); | 495 | pl181_init(0x1c000000, drives_table[sd].bdrv, pic[23], pic[24]); |
| 496 | if (nd_table[0].vlan) | 496 | if (nd_table[0].vlan) |
| 497 | smc91c111_init(&nd_table[0], 0xc8000000, pic[27]); | 497 | smc91c111_init(&nd_table[0], 0xc8000000, pic[27]); |
| 498 | - pl110_init(0xc0000000, pic[22], 0); | 498 | + |
| 499 | + sysbus_create_simple("pl110", 0xc0000000, pic[22]); | ||
| 499 | 500 | ||
| 500 | integrator_binfo.ram_size = ram_size; | 501 | integrator_binfo.ram_size = ram_size; |
| 501 | integrator_binfo.kernel_filename = kernel_filename; | 502 | integrator_binfo.kernel_filename = kernel_filename; |
hw/pl110.c
| 1 | /* | 1 | /* |
| 2 | * Arm PrimeCell PL110 Color LCD Controller | 2 | * Arm PrimeCell PL110 Color LCD Controller |
| 3 | * | 3 | * |
| 4 | - * Copyright (c) 2005-2006 CodeSourcery. | 4 | + * Copyright (c) 2005-2009 CodeSourcery. |
| 5 | * Written by Paul Brook | 5 | * Written by Paul Brook |
| 6 | * | 6 | * |
| 7 | * This code is licenced under the GNU LGPL | 7 | * This code is licenced under the GNU LGPL |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | -#include "hw.h" | ||
| 11 | -#include "primecell.h" | 10 | +#include "sysbus.h" |
| 12 | #include "console.h" | 11 | #include "console.h" |
| 13 | #include "framebuffer.h" | 12 | #include "framebuffer.h" |
| 14 | 13 | ||
| @@ -29,6 +28,7 @@ enum pl110_bppmode | @@ -29,6 +28,7 @@ enum pl110_bppmode | ||
| 29 | }; | 28 | }; |
| 30 | 29 | ||
| 31 | typedef struct { | 30 | typedef struct { |
| 31 | + SysBusDevice busdev; | ||
| 32 | DisplayState *ds; | 32 | DisplayState *ds; |
| 33 | 33 | ||
| 34 | /* The Versatile/PB uses a slightly modified PL110 controller. */ | 34 | /* The Versatile/PB uses a slightly modified PL110 controller. */ |
| @@ -349,20 +349,33 @@ static CPUWriteMemoryFunc *pl110_writefn[] = { | @@ -349,20 +349,33 @@ static CPUWriteMemoryFunc *pl110_writefn[] = { | ||
| 349 | pl110_write | 349 | pl110_write |
| 350 | }; | 350 | }; |
| 351 | 351 | ||
| 352 | -void *pl110_init(uint32_t base, qemu_irq irq, int versatile) | 352 | +static void pl110_init(SysBusDevice *dev) |
| 353 | { | 353 | { |
| 354 | - pl110_state *s; | 354 | + pl110_state *s = FROM_SYSBUS(pl110_state, dev); |
| 355 | int iomemtype; | 355 | int iomemtype; |
| 356 | 356 | ||
| 357 | - s = (pl110_state *)qemu_mallocz(sizeof(pl110_state)); | ||
| 358 | iomemtype = cpu_register_io_memory(0, pl110_readfn, | 357 | iomemtype = cpu_register_io_memory(0, pl110_readfn, |
| 359 | pl110_writefn, s); | 358 | pl110_writefn, s); |
| 360 | - cpu_register_physical_memory(base, 0x00001000, iomemtype); | ||
| 361 | - s->versatile = versatile; | ||
| 362 | - s->irq = irq; | 359 | + sysbus_init_mmio(dev, 0x1000, iomemtype); |
| 360 | + sysbus_init_irq(dev, &s->irq); | ||
| 363 | s->ds = graphic_console_init(pl110_update_display, | 361 | s->ds = graphic_console_init(pl110_update_display, |
| 364 | pl110_invalidate_display, | 362 | pl110_invalidate_display, |
| 365 | NULL, NULL, s); | 363 | NULL, NULL, s); |
| 366 | /* ??? Save/restore. */ | 364 | /* ??? Save/restore. */ |
| 367 | - return s; | ||
| 368 | } | 365 | } |
| 366 | + | ||
| 367 | +static void pl110_versatile_init(SysBusDevice *dev) | ||
| 368 | +{ | ||
| 369 | + pl110_state *s = FROM_SYSBUS(pl110_state, dev); | ||
| 370 | + s->versatile = 1; | ||
| 371 | + pl110_init(dev); | ||
| 372 | +} | ||
| 373 | + | ||
| 374 | +static void pl110_register_devices(void) | ||
| 375 | +{ | ||
| 376 | + sysbus_register_dev("pl110", sizeof(pl110_state), pl110_init); | ||
| 377 | + sysbus_register_dev("pl110_versatile", sizeof(pl110_state), | ||
| 378 | + pl110_versatile_init); | ||
| 379 | +} | ||
| 380 | + | ||
| 381 | +device_init(pl110_register_devices) |
hw/primecell.h
| @@ -8,9 +8,6 @@ | @@ -8,9 +8,6 @@ | ||
| 8 | /* pl031.c */ | 8 | /* pl031.c */ |
| 9 | void pl031_init(uint32_t base, qemu_irq irq); | 9 | void pl031_init(uint32_t base, qemu_irq irq); |
| 10 | 10 | ||
| 11 | -/* pl110.c */ | ||
| 12 | -void *pl110_init(uint32_t base, qemu_irq irq, int); | ||
| 13 | - | ||
| 14 | /* pl011.c */ | 11 | /* pl011.c */ |
| 15 | enum pl011_type { | 12 | enum pl011_type { |
| 16 | PL011_ARM, | 13 | PL011_ARM, |
hw/realview.c
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | * This code is licenced under the GPL. | 7 | * This code is licenced under the GPL. |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | -#include "hw.h" | 10 | +#include "sysbus.h" |
| 11 | #include "arm-misc.h" | 11 | #include "arm-misc.h" |
| 12 | #include "primecell.h" | 12 | #include "primecell.h" |
| 13 | #include "devices.h" | 13 | #include "devices.h" |
| @@ -96,7 +96,7 @@ static void realview_init(ram_addr_t ram_size, | @@ -96,7 +96,7 @@ static void realview_init(ram_addr_t ram_size, | ||
| 96 | sp804_init(0x10011000, pic[4]); | 96 | sp804_init(0x10011000, pic[4]); |
| 97 | sp804_init(0x10012000, pic[5]); | 97 | sp804_init(0x10012000, pic[5]); |
| 98 | 98 | ||
| 99 | - pl110_init(0x10020000, pic[23], 1); | 99 | + sysbus_create_simple("pl110_versatile", 0x10020000, pic[23]); |
| 100 | 100 | ||
| 101 | index = drive_get_index(IF_SD, 0, 0); | 101 | index = drive_get_index(IF_SD, 0, 0); |
| 102 | if (index == -1) { | 102 | if (index == -1) { |
hw/versatilepb.c
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | * This code is licenced under the GPL. | 7 | * This code is licenced under the GPL. |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | -#include "hw.h" | 10 | +#include "sysbus.h" |
| 11 | #include "arm-misc.h" | 11 | #include "arm-misc.h" |
| 12 | #include "primecell.h" | 12 | #include "primecell.h" |
| 13 | #include "devices.h" | 13 | #include "devices.h" |
| @@ -228,7 +228,7 @@ static void versatile_init(ram_addr_t ram_size, | @@ -228,7 +228,7 @@ static void versatile_init(ram_addr_t ram_size, | ||
| 228 | 228 | ||
| 229 | /* The versatile/PB actually has a modified Color LCD controller | 229 | /* The versatile/PB actually has a modified Color LCD controller |
| 230 | that includes hardware cursor support from the PL111. */ | 230 | that includes hardware cursor support from the PL111. */ |
| 231 | - pl110_init(0x10120000, pic[16], 1); | 231 | + sysbus_create_simple("pl110_versatile", 0x10120000, pic[16]); |
| 232 | 232 | ||
| 233 | index = drive_get_index(IF_SD, 0, 0); | 233 | index = drive_get_index(IF_SD, 0, 0); |
| 234 | if (index == -1) { | 234 | if (index == -1) { |