summaryrefslogtreecommitdiff
path: root/hw/omap_lcdc.c
diff options
context:
space:
mode:
authorBenoît Canet <benoit.canet@gmail.com>2011-11-28 13:53:36 +0100
committerAvi Kivity <avi@redhat.com>2011-11-28 15:38:47 +0200
commit30af1ec7295b3fecab641320cf97208b0936571f (patch)
tree1b248ad012463cc06048a4e122f8c3d98de53ccc /hw/omap_lcdc.c
parent1a0726900e4f472cdb389fd249bfdfa0e30f21e7 (diff)
downloadqemu-30af1ec7295b3fecab641320cf97208b0936571f.tar.gz
qemu-30af1ec7295b3fecab641320cf97208b0936571f.tar.bz2
qemu-30af1ec7295b3fecab641320cf97208b0936571f.zip
omap_lcdc: convert to memory API
Signed-off-by: Benoît Canet <benoit.canet@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/omap_lcdc.c')
-rw-r--r--hw/omap_lcdc.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/hw/omap_lcdc.c b/hw/omap_lcdc.c
index 29e604863d..8484f7058d 100644
--- a/hw/omap_lcdc.c
+++ b/hw/omap_lcdc.c
@@ -22,6 +22,7 @@
#include "framebuffer.h"
struct omap_lcd_panel_s {
+ MemoryRegion iomem;
qemu_irq irq;
DisplayState *state;
@@ -323,7 +324,8 @@ static void omap_lcd_update(struct omap_lcd_panel_s *s) {
}
}
-static uint32_t omap_lcdc_read(void *opaque, target_phys_addr_t addr)
+static uint64_t omap_lcdc_read(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
struct omap_lcd_panel_s *s = (struct omap_lcd_panel_s *) opaque;
@@ -356,7 +358,7 @@ static uint32_t omap_lcdc_read(void *opaque, target_phys_addr_t addr)
}
static void omap_lcdc_write(void *opaque, target_phys_addr_t addr,
- uint32_t value)
+ uint64_t value, unsigned size)
{
struct omap_lcd_panel_s *s = (struct omap_lcd_panel_s *) opaque;
@@ -399,16 +401,10 @@ static void omap_lcdc_write(void *opaque, target_phys_addr_t addr,
}
}
-static CPUReadMemoryFunc * const omap_lcdc_readfn[] = {
- omap_lcdc_read,
- omap_lcdc_read,
- omap_lcdc_read,
-};
-
-static CPUWriteMemoryFunc * const omap_lcdc_writefn[] = {
- omap_lcdc_write,
- omap_lcdc_write,
- omap_lcdc_write,
+static const MemoryRegionOps omap_lcdc_ops = {
+ .read = omap_lcdc_read,
+ .write = omap_lcdc_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
void omap_lcdc_reset(struct omap_lcd_panel_s *s)
@@ -433,10 +429,12 @@ void omap_lcdc_reset(struct omap_lcd_panel_s *s)
s->ctrl = 0;
}
-struct omap_lcd_panel_s *omap_lcdc_init(target_phys_addr_t base, qemu_irq irq,
- struct omap_dma_lcd_channel_s *dma, omap_clk clk)
+struct omap_lcd_panel_s *omap_lcdc_init(MemoryRegion *sysmem,
+ target_phys_addr_t base,
+ qemu_irq irq,
+ struct omap_dma_lcd_channel_s *dma,
+ omap_clk clk)
{
- int iomemtype;
struct omap_lcd_panel_s *s = (struct omap_lcd_panel_s *)
g_malloc0(sizeof(struct omap_lcd_panel_s));
@@ -444,9 +442,8 @@ struct omap_lcd_panel_s *omap_lcdc_init(target_phys_addr_t base, qemu_irq irq,
s->dma = dma;
omap_lcdc_reset(s);
- iomemtype = cpu_register_io_memory(omap_lcdc_readfn,
- omap_lcdc_writefn, s, DEVICE_NATIVE_ENDIAN);
- cpu_register_physical_memory(base, 0x100, iomemtype);
+ memory_region_init_io(&s->iomem, &omap_lcdc_ops, s, "omap.lcdc", 0x100);
+ memory_region_add_subregion(sysmem, base, &s->iomem);
s->state = graphic_console_init(omap_update_display,
omap_invalidate_display,