hw/display/pl110: Pass frame buffer memory region as link property
Add the PL110::'framebuffer-memory' property. Have the different ARM boards set it. We don't need to call sysbus_address_space() anymore. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20240226173805.289-3-philmd@linaro.org>
This commit is contained in:
parent
49aff03e1b
commit
c2093660d9
@ -671,6 +671,8 @@ static void integratorcp_init(MachineState *machine)
|
||||
}
|
||||
|
||||
dev = qdev_new("pl110");
|
||||
object_property_set_link(OBJECT(dev), "framebuffer-memory",
|
||||
OBJECT(address_space_mem), &error_fatal);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xc0000000);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[22]);
|
||||
|
@ -239,6 +239,8 @@ static void realview_init(MachineState *machine,
|
||||
gpio2 = sysbus_create_simple("pl061", 0x10015000, pic[8]);
|
||||
|
||||
dev = qdev_new("pl111");
|
||||
object_property_set_link(OBJECT(dev), "framebuffer-memory",
|
||||
OBJECT(sysmem), &error_fatal);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x10020000);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[23]);
|
||||
|
@ -300,6 +300,8 @@ static void versatile_init(MachineState *machine, int board_id)
|
||||
/* The versatile/PB actually has a modified Color LCD controller
|
||||
that includes hardware cursor support from the PL111. */
|
||||
dev = qdev_new("pl110_versatile");
|
||||
object_property_set_link(OBJECT(dev), "framebuffer-memory",
|
||||
OBJECT(sysmem), &error_fatal);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x10120000);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[16]);
|
||||
|
@ -299,6 +299,9 @@ static void a9_daughterboard_init(VexpressMachineState *vms,
|
||||
|
||||
/* 0x10020000 PL111 CLCD (daughterboard) */
|
||||
dev = qdev_new("pl111");
|
||||
object_property_set_link(OBJECT(dev), "framebuffer-memory",
|
||||
OBJECT(sysmem), &error_fatal);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x10020000);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[44]);
|
||||
|
||||
@ -654,6 +657,8 @@ static void vexpress_common_init(MachineState *machine)
|
||||
/* VE_COMPACTFLASH: not modelled */
|
||||
|
||||
dev = qdev_new("pl111");
|
||||
object_property_set_link(OBJECT(dev), "framebuffer-memory",
|
||||
OBJECT(sysmem), &error_fatal);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, map[VE_CLCD]);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[14]);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/irq.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "ui/console.h"
|
||||
#include "framebuffer.h"
|
||||
@ -17,6 +18,7 @@
|
||||
#include "qemu/timer.h"
|
||||
#include "qemu/log.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define PL110_CR_EN 0x001
|
||||
@ -74,6 +76,7 @@ struct PL110State {
|
||||
uint32_t palette[256];
|
||||
uint32_t raw_palette[128];
|
||||
qemu_irq irq;
|
||||
MemoryRegion *fbmem;
|
||||
};
|
||||
|
||||
static int vmstate_pl110_post_load(void *opaque, int version_id);
|
||||
@ -210,7 +213,6 @@ static int pl110_enabled(PL110State *s)
|
||||
static void pl110_update_display(void *opaque)
|
||||
{
|
||||
PL110State *s = (PL110State *)opaque;
|
||||
SysBusDevice *sbd;
|
||||
DisplaySurface *surface = qemu_console_surface(s->con);
|
||||
drawfn fn;
|
||||
int src_width;
|
||||
@ -222,8 +224,6 @@ static void pl110_update_display(void *opaque)
|
||||
return;
|
||||
}
|
||||
|
||||
sbd = SYS_BUS_DEVICE(s);
|
||||
|
||||
if (s->cr & PL110_CR_BGR)
|
||||
bpp_offset = 0;
|
||||
else
|
||||
@ -290,7 +290,7 @@ static void pl110_update_display(void *opaque)
|
||||
first = 0;
|
||||
if (s->invalidate) {
|
||||
framebuffer_update_memory_section(&s->fbsection,
|
||||
sysbus_address_space(sbd),
|
||||
s->fbmem,
|
||||
s->upbase,
|
||||
s->rows, src_width);
|
||||
}
|
||||
@ -535,11 +535,22 @@ static const GraphicHwOps pl110_gfx_ops = {
|
||||
.gfx_update = pl110_update_display,
|
||||
};
|
||||
|
||||
static Property pl110_properties[] = {
|
||||
DEFINE_PROP_LINK("framebuffer-memory", PL110State, fbmem,
|
||||
TYPE_MEMORY_REGION, MemoryRegion *),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static void pl110_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
PL110State *s = PL110(dev);
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
|
||||
|
||||
if (!s->fbmem) {
|
||||
error_setg(errp, "'framebuffer-memory' property was not set");
|
||||
return;
|
||||
}
|
||||
|
||||
memory_region_init_io(&s->iomem, OBJECT(s), &pl110_ops, s, "pl110", 0x1000);
|
||||
sysbus_init_mmio(sbd, &s->iomem);
|
||||
sysbus_init_irq(sbd, &s->irq);
|
||||
@ -577,6 +588,7 @@ static void pl110_class_init(ObjectClass *klass, void *data)
|
||||
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
|
||||
dc->vmsd = &vmstate_pl110;
|
||||
dc->realize = pl110_realize;
|
||||
device_class_set_props(dc, pl110_properties);
|
||||
}
|
||||
|
||||
static const TypeInfo pl110_info = {
|
||||
|
Loading…
Reference in New Issue
Block a user