PL110 qdev conversion

Signed-off-by: Paul Brook <paul@codesourcery.com>
This commit is contained in:
Paul Brook 2009-05-14 22:35:07 +01:00
parent 6f68ecb2c1
commit 2e9bdce56f
5 changed files with 30 additions and 19 deletions

View File

@ -7,7 +7,7 @@
* This code is licenced under the GPL
*/
#include "hw.h"
#include "sysbus.h"
#include "primecell.h"
#include "devices.h"
#include "sysemu.h"
@ -495,7 +495,8 @@ static void integratorcp_init(ram_addr_t ram_size,
pl181_init(0x1c000000, drives_table[sd].bdrv, pic[23], pic[24]);
if (nd_table[0].vlan)
smc91c111_init(&nd_table[0], 0xc8000000, pic[27]);
pl110_init(0xc0000000, pic[22], 0);
sysbus_create_simple("pl110", 0xc0000000, pic[22]);
integrator_binfo.ram_size = ram_size;
integrator_binfo.kernel_filename = kernel_filename;

View File

@ -1,14 +1,13 @@
/*
* Arm PrimeCell PL110 Color LCD Controller
*
* Copyright (c) 2005-2006 CodeSourcery.
* Copyright (c) 2005-2009 CodeSourcery.
* Written by Paul Brook
*
* This code is licenced under the GNU LGPL
*/
#include "hw.h"
#include "primecell.h"
#include "sysbus.h"
#include "console.h"
#include "framebuffer.h"
@ -29,6 +28,7 @@ enum pl110_bppmode
};
typedef struct {
SysBusDevice busdev;
DisplayState *ds;
/* The Versatile/PB uses a slightly modified PL110 controller. */
@ -349,20 +349,33 @@ static CPUWriteMemoryFunc *pl110_writefn[] = {
pl110_write
};
void *pl110_init(uint32_t base, qemu_irq irq, int versatile)
static void pl110_init(SysBusDevice *dev)
{
pl110_state *s;
pl110_state *s = FROM_SYSBUS(pl110_state, dev);
int iomemtype;
s = (pl110_state *)qemu_mallocz(sizeof(pl110_state));
iomemtype = cpu_register_io_memory(0, pl110_readfn,
pl110_writefn, s);
cpu_register_physical_memory(base, 0x00001000, iomemtype);
s->versatile = versatile;
s->irq = irq;
sysbus_init_mmio(dev, 0x1000, iomemtype);
sysbus_init_irq(dev, &s->irq);
s->ds = graphic_console_init(pl110_update_display,
pl110_invalidate_display,
NULL, NULL, s);
/* ??? Save/restore. */
return s;
}
static void pl110_versatile_init(SysBusDevice *dev)
{
pl110_state *s = FROM_SYSBUS(pl110_state, dev);
s->versatile = 1;
pl110_init(dev);
}
static void pl110_register_devices(void)
{
sysbus_register_dev("pl110", sizeof(pl110_state), pl110_init);
sysbus_register_dev("pl110_versatile", sizeof(pl110_state),
pl110_versatile_init);
}
device_init(pl110_register_devices)

View File

@ -8,9 +8,6 @@
/* pl031.c */
void pl031_init(uint32_t base, qemu_irq irq);
/* pl110.c */
void *pl110_init(uint32_t base, qemu_irq irq, int);
/* pl011.c */
enum pl011_type {
PL011_ARM,

View File

@ -7,7 +7,7 @@
* This code is licenced under the GPL.
*/
#include "hw.h"
#include "sysbus.h"
#include "arm-misc.h"
#include "primecell.h"
#include "devices.h"
@ -96,7 +96,7 @@ static void realview_init(ram_addr_t ram_size,
sp804_init(0x10011000, pic[4]);
sp804_init(0x10012000, pic[5]);
pl110_init(0x10020000, pic[23], 1);
sysbus_create_simple("pl110_versatile", 0x10020000, pic[23]);
index = drive_get_index(IF_SD, 0, 0);
if (index == -1) {

View File

@ -7,7 +7,7 @@
* This code is licenced under the GPL.
*/
#include "hw.h"
#include "sysbus.h"
#include "arm-misc.h"
#include "primecell.h"
#include "devices.h"
@ -228,7 +228,7 @@ static void versatile_init(ram_addr_t ram_size,
/* The versatile/PB actually has a modified Color LCD controller
that includes hardware cursor support from the PL111. */
pl110_init(0x10120000, pic[16], 1);
sysbus_create_simple("pl110_versatile", 0x10120000, pic[16]);
index = drive_get_index(IF_SD, 0, 0);
if (index == -1) {