qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 22/34] vga-pci: convert to pci_bar_map


From: Blue Swirl
Subject: [Qemu-devel] [PATCH 22/34] vga-pci: convert to pci_bar_map
Date: Thu, 22 Jul 2010 22:00:21 +0000

Use pci_bar_map() and post_map_func instead of a mapping function.

Signed-off-by: Blue Swirl <address@hidden>
---
 hw/vga-pci.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index 216071f..c627a79 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -52,14 +52,12 @@ static void vga_map(PCIDevice *pci_dev, int region_num,
 {
     PCIVGAState *d = (PCIVGAState *)pci_dev;
     VGACommonState *s = &d->vga;
-    if (region_num == PCI_ROM_SLOT) {
-        cpu_register_physical_memory(addr, s->bios_size, s->bios_offset);
-    } else {
-        cpu_register_physical_memory(addr, s->vram_size, s->vram_offset);
-        s->map_addr = addr;
-        s->map_end = addr + s->vram_size;
-        vga_dirty_log_start(s);
-    }
+
+    assert(region_num != PCI_ROM_SLOT);
+
+    s->map_addr = addr;
+    s->map_end = addr + s->vram_size;
+    vga_dirty_log_start(s);
 }

 static void pci_vga_write_config(PCIDevice *d,
@@ -92,8 +90,9 @@ static int pci_vga_initfn(PCIDevice *dev)
      pci_config_set_class(pci_conf, PCI_CLASS_DISPLAY_VGA);

      /* XXX: VGA_RAM_SIZE must be a power of two */
-     pci_register_bar(&d->dev, 0, VGA_RAM_SIZE,
-                      PCI_BASE_ADDRESS_MEM_PREFETCH, vga_map, NULL);
+     pci_register_bar(&d->dev, 0, VGA_RAM_SIZE, PCI_BASE_ADDRESS_MEM_PREFETCH,
+                      NULL, vga_map);
+     pci_bar_map(&d->dev, 0, 0, 0, s->vram_size, s->vram_offset);

      if (s->bios_size) {
         unsigned int bios_total_size;
@@ -102,7 +101,8 @@ static int pci_vga_initfn(PCIDevice *dev)
         while (bios_total_size < s->bios_size)
             bios_total_size <<= 1;
         pci_register_bar(&d->dev, PCI_ROM_SLOT, bios_total_size,
-                         PCI_BASE_ADDRESS_MEM_PREFETCH, vga_map, NULL);
+                         PCI_BASE_ADDRESS_MEM_PREFETCH, NULL, NULL);
+        pci_bar_map(&d->dev, PCI_ROM_SLOT, 0, 0, s->bios_size, s->bios_offset);
      }

     vga_init_vbe(s);
-- 
1.6.2.4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]