aboutsummaryrefslogtreecommitdiff
path: root/hw/g364fb.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-08-25 14:39:18 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-25 14:39:18 -0500
commit01e0451a08e0afb9af04783c320d70084cf4e574 (patch)
tree30dbbf868845acd99099c7165769f1762fa40e28 /hw/g364fb.c
parentf065aa0a005ac539bf8ca556775e5cc4c3d2d3b7 (diff)
downloadqemu-01e0451a08e0afb9af04783c320d70084cf4e574.zip
qemu-01e0451a08e0afb9af04783c320d70084cf4e574.tar.gz
qemu-01e0451a08e0afb9af04783c320d70084cf4e574.tar.bz2
Revert "Merge remote-tracking branch 'qemu-kvm/memory/batch' into staging"
This reverts commit 8ef9ea85a2cc1007eaefa53e6871f1f83bcef22d, reversing changes made to 444dc48298c480e42e15a8fe676be737d8a6b2a1. From Avi: Please revert the entire pull (git revert 8ef9ea85a2cc1) while I work this out - it isn't trivial. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/g364fb.c')
-rw-r--r--hw/g364fb.c60
1 files changed, 27 insertions, 33 deletions
diff --git a/hw/g364fb.c b/hw/g364fb.c
index a7731ec..b3020c5 100644
--- a/hw/g364fb.c
+++ b/hw/g364fb.c
@@ -36,7 +36,7 @@ do { fprintf(stderr, "g364 ERROR: " fmt , ## __VA_ARGS__);} while (0)
typedef struct G364State {
/* hardware */
uint8_t *vram;
- MemoryRegion vram_region;
+ ram_addr_t vram_offset;
int vram_size;
qemu_irq irq;
/* registers */
@@ -68,17 +68,16 @@ typedef struct G364State {
#define CTLA_FORCE_BLANK 0x00000400
#define CTLA_NO_CURSOR 0x00800000
-static inline int check_dirty(G364State *s, ram_addr_t page)
+static inline int check_dirty(ram_addr_t page)
{
- return memory_region_get_dirty(&s->vram_region, page, DIRTY_MEMORY_VGA);
+ return cpu_physical_memory_get_dirty(page, VGA_DIRTY_FLAG);
}
static inline void reset_dirty(G364State *s,
ram_addr_t page_min, ram_addr_t page_max)
{
- memory_region_reset_dirty(&s->vram_region, page_min,
- page_max + TARGET_PAGE_SIZE - 1,
- DIRTY_MEMORY_VGA);
+ cpu_physical_memory_reset_dirty(page_min, page_max + TARGET_PAGE_SIZE - 1,
+ VGA_DIRTY_FLAG);
}
static void g364fb_draw_graphic8(G364State *s)
@@ -115,7 +114,7 @@ static void g364fb_draw_graphic8(G364State *s)
return;
}
- page = 0;
+ page = s->vram_offset;
page_min = (ram_addr_t)-1;
page_max = 0;
@@ -136,7 +135,7 @@ static void g364fb_draw_graphic8(G364State *s)
/* XXX: out of range in vram? */
data_display = dd = ds_get_data(s->ds);
while (y < s->height) {
- if (check_dirty(s, page)) {
+ if (check_dirty(page)) {
if (y < ymin)
ymin = ymax = y;
if (page_min == (ram_addr_t)-1)
@@ -276,7 +275,7 @@ static inline void g364fb_invalidate_display(void *opaque)
s->blanked = 0;
for (i = 0; i < s->vram_size; i += TARGET_PAGE_SIZE) {
- memory_region_set_dirty(&s->vram_region, i);
+ cpu_physical_memory_set_dirty(s->vram_offset + i);
}
}
@@ -412,7 +411,7 @@ static void g364_invalidate_cursor_position(G364State *s)
end = (ymax + 1) * ds_get_linesize(s->ds);
for (i = start; i < end; i += TARGET_PAGE_SIZE) {
- memory_region_set_dirty(&s->vram_region, i);
+ cpu_physical_memory_set_dirty(s->vram_offset + i);
}
}
@@ -523,20 +522,16 @@ static void g364fb_ctrl_writeb(void *opaque, target_phys_addr_t addr, uint32_t v
g364fb_ctrl_writel(opaque, addr & ~0x3, val);
}
-static const MemoryRegionOps g364fb_ctrl_ops = {
- .old_mmio = {
- .read = {
- g364fb_ctrl_readb,
- g364fb_ctrl_readw,
- g364fb_ctrl_readl,
- },
- .write = {
- g364fb_ctrl_writeb,
- g364fb_ctrl_writew,
- g364fb_ctrl_writel,
- },
- },
- .endianness = DEVICE_NATIVE_ENDIAN,
+static CPUReadMemoryFunc * const g364fb_ctrl_read[3] = {
+ g364fb_ctrl_readb,
+ g364fb_ctrl_readw,
+ g364fb_ctrl_readl,
+};
+
+static CPUWriteMemoryFunc * const g364fb_ctrl_write[3] = {
+ g364fb_ctrl_writeb,
+ g364fb_ctrl_writew,
+ g364fb_ctrl_writel,
};
static int g364fb_load(QEMUFile *f, void *opaque, int version_id)
@@ -588,19 +583,18 @@ static void g364fb_save(QEMUFile *f, void *opaque)
qemu_put_be32(f, s->height);
}
-int g364fb_mm_init(MemoryRegion *system_memory,
- target_phys_addr_t vram_base,
+int g364fb_mm_init(target_phys_addr_t vram_base,
target_phys_addr_t ctrl_base, int it_shift,
qemu_irq irq)
{
G364State *s;
- MemoryRegion *io_ctrl = g_new(MemoryRegion, 1);
+ int io_ctrl;
s = g_malloc0(sizeof(G364State));
s->vram_size = 8 * 1024 * 1024;
- memory_region_init_ram(&s->vram_region, NULL, "g364fb.vram", s->vram_size);
- s->vram = memory_region_get_ram_ptr(&s->vram_region);
+ s->vram_offset = qemu_ram_alloc(NULL, "g364fb.vram", s->vram_size);
+ s->vram = qemu_get_ram_ptr(s->vram_offset);
s->irq = irq;
qemu_register_reset(g364fb_reset, s);
@@ -611,11 +605,11 @@ int g364fb_mm_init(MemoryRegion *system_memory,
g364fb_invalidate_display,
g364fb_screen_dump, NULL, s);
- memory_region_add_subregion(system_memory, vram_base, &s->vram_region);
+ cpu_register_physical_memory(vram_base, s->vram_size, s->vram_offset);
- memory_region_init_io(io_ctrl, &g364fb_ctrl_ops, s,
- "g364fb-ctrl", 0x200000);
- memory_region_add_subregion(system_memory, ctrl_base, io_ctrl);
+ io_ctrl = cpu_register_io_memory(g364fb_ctrl_read, g364fb_ctrl_write, s,
+ DEVICE_NATIVE_ENDIAN);
+ cpu_register_physical_memory(ctrl_base, 0x200000, io_ctrl);
return 0;
}