@@ -106,6 +106,9 @@ int isa_vga_mm_init(hwaddr vram_base,
s->vga.con = graphic_console_init(NULL, 0, s->vga.hw_ops, s);
- vga_init_vbe(&s->vga, NULL, address_space);
+ memory_region_add_subregion(address_space,
+ VBE_DISPI_LFB_PHYSICAL_ADDRESS,
+ &s->vga.vram);
+
return 0;
}
@@ -76,7 +76,9 @@ static void vga_isa_realizefn(DeviceState *dev, Error **errp)
memory_region_set_coalescing(vga_io_memory);
s->con = graphic_console_init(DEVICE(dev), 0, s->hw_ops, s);
- vga_init_vbe(s, OBJECT(dev), isa_address_space(isadev));
+ memory_region_add_subregion(isa_address_space(isadev),
+ VBE_DISPI_LFB_PHYSICAL_ADDRESS,
+ &s->vram);
/* ROM BIOS */
rom_add_vga(VGABIOS_FILENAME);
}
@@ -2301,15 +2301,3 @@ void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
portio_list_add(&s->vbe_port_list, address_space_io, 0x1ce);
}
}
-
-void vga_init_vbe(VGACommonState *s, Object *obj, MemoryRegion *system_memory)
-{
- /* Use an alias to avoid double-mapping the same region */
- memory_region_init_alias(&s->vram_vbe, obj, "vram.vbe",
- &s->vram, 0, memory_region_size(&s->vram));
- /* XXX: use optimized standard vga accesses */
- memory_region_add_subregion(system_memory,
- VBE_DISPI_LFB_PHYSICAL_ADDRESS,
- &s->vram_vbe);
- s->vbe_mapped = 1;
-}
@@ -60,7 +60,6 @@ typedef struct VGACommonState {
MemoryRegion *legacy_address_space;
uint8_t *vram_ptr;
MemoryRegion vram;
- MemoryRegion vram_vbe;
uint32_t vram_size;
uint32_t vram_size_mb; /* property */
uint32_t vbe_size;
@@ -106,7 +105,6 @@ typedef struct VGACommonState {
uint32_t vbe_start_addr;
uint32_t vbe_line_offset;
uint32_t vbe_bank_mask;
- int vbe_mapped;
/* display refresh support */
QemuConsole *con;
uint32_t font_offsets[2];
@@ -178,7 +176,6 @@ void vga_invalidate_scanlines(VGACommonState *s, int y1, int y2);
int vga_ioport_invalid(VGACommonState *s, uint32_t addr);
-void vga_init_vbe(VGACommonState *s, Object *obj, MemoryRegion *address_space);
uint32_t vbe_ioport_read_data(void *opaque, uint32_t addr);
void vbe_ioport_write_index(void *opaque, uint32_t addr, uint32_t val);
void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val);
vga_init_vbe is now used only from ISA VGA cards. Since the alias is not needed anymore, remove it (effectively reverting commit 8294a64d7f, "vga: fix vram double-mapping with -vga std and -M pc-0.12", 2012-05-29) and the now unused vbe_mapped field of VGACommonState. The function now consists of a single memory_region_add_subregion call, so we can inline it; this avoids incorrect usage from PCI cards. Suggested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Based-on: <05af415a-5058-98b4-4a12-9d093a30b1e3@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- hw/display/vga-isa-mm.c | 5 ++++- hw/display/vga-isa.c | 4 +++- hw/display/vga.c | 12 ------------ hw/display/vga_int.h | 3 --- 4 files changed, 7 insertions(+), 17 deletions(-)