Patchwork [11/13] vga: Refactor lfb_vram_mapped to vga_mem_mapped

login
register
mail settings
Submitter Jan Kiszka
Date June 14, 2011, 4:53 p.m.
Message ID <717705ff37f8cdd369edf59b378f4460d31790ca.1308070416.git.jan.kiszka@siemens.com>
Download mbox | patch
Permalink /patch/100385/
State New
Headers show

Comments

Jan Kiszka - June 14, 2011, 4:53 p.m.
Make it clearer that this flag indicates wether the legacy VGA memory
region is mapped as RAM. And change its type to bool.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/cirrus_vga.c |   10 ++++------
 hw/vga.c        |    4 ++--
 hw/vga_int.h    |    2 +-
 3 files changed, 7 insertions(+), 9 deletions(-)

Patch

diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index 98a9b8e..54a730d 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -1179,7 +1179,7 @@  static void cirrus_update_bank_ptr(CirrusVGAState * s, unsigned bank_index)
     if (limit > 0) {
         /* Thinking about changing bank base? First, drop the dirty bitmap information
          * on the current location, otherwise we lose this pointer forever */
-        if (s->vga.lfb_vram_mapped) {
+        if (s->vga.vga_mem_mapped) {
             target_phys_addr_t base_addr = isa_mem_base + 0xa0000 + bank_index * 0x8000;
             cpu_physical_sync_dirty_bitmap(base_addr, base_addr + 0x8000);
         }
@@ -2497,8 +2497,6 @@  static void map_linear_vram(CirrusVGAState *s)
     if (!s->vga.map_addr)
         return;
 
-    s->vga.lfb_vram_mapped = 0;
-
     if (!(s->cirrus_srcptr != s->cirrus_srcptr_end)
         && !((s->vga.sr[0x07] & 0x01) == 0)
         && !((s->vga.gr[0x0B] & 0x14) == 0x14)
@@ -2513,11 +2511,11 @@  static void map_linear_vram(CirrusVGAState *s)
 					  s->cirrus_bank_base[1]) |
 					 IO_MEM_RAM, 0, true);
 
-        s->vga.lfb_vram_mapped = 1;
-    }
-    else {
+        s->vga.vga_mem_mapped = true;
+    } else {
         cpu_register_physical_memory(isa_mem_base + 0xa0000, 0x20000,
                                      s->vga.vga_io_memory);
+        s->vga.vga_mem_mapped = false;
     }
 }
 
diff --git a/hw/vga.c b/hw/vga.c
index 1290317..ee0c68e 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -1556,7 +1556,7 @@  static void vga_sync_dirty_bitmap(VGACommonState *s)
     if (s->map_addr)
         cpu_physical_sync_dirty_bitmap(s->map_addr, s->map_end);
 
-    if (s->lfb_vram_mapped) {
+    if (s->vga_mem_mapped) {
         cpu_physical_sync_dirty_bitmap(isa_mem_base + 0xa0000, 0xa8000);
         cpu_physical_sync_dirty_bitmap(isa_mem_base + 0xa8000, 0xb0000);
     }
@@ -1868,7 +1868,7 @@  void vga_common_reset(VGACommonState *s)
     s->lfb_end = 0;
     s->map_addr = 0;
     s->map_end = 0;
-    s->lfb_vram_mapped = 0;
+    s->vga_mem_mapped = false;
     s->sr_index = 0;
     memset(s->sr, '\0', sizeof(s->sr));
     s->gr_index = 0;
diff --git a/hw/vga_int.h b/hw/vga_int.h
index 73328c2..a6ea93c 100644
--- a/hw/vga_int.h
+++ b/hw/vga_int.h
@@ -111,7 +111,7 @@  typedef struct VGACommonState {
     uint32_t lfb_end;
     uint32_t map_addr;
     uint32_t map_end;
-    uint32_t lfb_vram_mapped; /* whether 0xa0000 is mapped as ram */
+    bool vga_mem_mapped; /* whether 0xa0000..0xbffff is mapped as RAM */
     uint32_t latch;
     uint8_t sr_index;
     uint8_t sr[256];