Patchwork [31/34] vga: refactor vga_init

login
register
mail settings
Submitter Blue Swirl
Date July 22, 2010, 10:03 p.m.
Message ID <AANLkTinwm9CSwJDvAV088GsOzjL1dKl9cMYK55vsJZlz@mail.gmail.com>
Download mbox | patch
Permalink /patch/59670/
State New
Headers show

Comments

Blue Swirl - July 22, 2010, 10:03 p.m.
Move common stuff not related to I/O port init from vga_init() to
vga_common_init().

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 hw/vga-isa-mm.c |    1 -
 hw/vga.c        |    5 ++---
 2 files changed, 2 insertions(+), 4 deletions(-)

Patch

diff --git a/hw/vga-isa-mm.c b/hw/vga-isa-mm.c
index 680b557..d4b1e95 100644
--- a/hw/vga-isa-mm.c
+++ b/hw/vga-isa-mm.c
@@ -103,7 +103,6 @@  static void vga_mm_init(ISAVGAMMState *s,
target_phys_addr_t vram_base,
     vmstate_register(NULL, 0, &vmstate_vga_common, s);

     cpu_register_physical_memory(ctrl_base, 0x100000, s_ioport_ctrl);
-    s->vga.bank_offset = 0;
     cpu_register_physical_memory(vram_base + 0x000a0000, 0x20000,
vga_io_memory);
     qemu_register_coalesced_mmio(vram_base + 0x000a0000, 0x20000);
 }
diff --git a/hw/vga.c b/hw/vga.c
index b5c7ee7..b612529 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -2264,6 +2264,7 @@  void vga_common_init(VGACommonState *s, int vga_ram_size)
     s->vram_offset = qemu_ram_alloc(NULL, "vga.vram", vga_ram_size);
     s->vram_ptr = qemu_get_ram_ptr(s->vram_offset);
     s->vram_size = vga_ram_size;
+    s->bank_offset = 0;
     s->get_bpp = vga_get_bpp;
     s->get_offsets = vga_get_offsets;
     s->get_resolution = vga_get_resolution;
@@ -2282,6 +2283,7 @@  void vga_common_init(VGACommonState *s, int vga_ram_size)
         s->update_retrace_info = vga_precise_update_retrace_info;
         break;
     }
+    qemu_register_reset(vga_reset, s);
 }

 /* used by both ISA and PCI */
@@ -2289,8 +2291,6 @@  void vga_init(VGACommonState *s)
 {
     int vga_io_memory;

-    qemu_register_reset(vga_reset, s);
-
     register_ioport_write(0x3c0, 16, 1, vga_ioport_write, s);

     register_ioport_write(0x3b4, 2, 1, vga_ioport_write, s);
@@ -2304,7 +2304,6 @@  void vga_init(VGACommonState *s)
     register_ioport_read(0x3d4, 2, 1, vga_ioport_read, s);
     register_ioport_read(0x3ba, 1, 1, vga_ioport_read, s);
     register_ioport_read(0x3da, 1, 1, vga_ioport_read, s);
-    s->bank_offset = 0;

 #ifdef CONFIG_BOCHS_VBE
 #if defined (TARGET_I386)