From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42696 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oc3wv-00030V-Hu for qemu-devel@nongnu.org; Thu, 22 Jul 2010 18:09:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oc3oo-00038b-41 for qemu-devel@nongnu.org; Thu, 22 Jul 2010 18:00:43 -0400 Received: from mail-vw0-f45.google.com ([209.85.212.45]:59532) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oc3oo-00038R-1M for qemu-devel@nongnu.org; Thu, 22 Jul 2010 18:00:42 -0400 Received: by vws19 with SMTP id 19so697810vws.4 for ; Thu, 22 Jul 2010 15:00:41 -0700 (PDT) MIME-Version: 1.0 From: Blue Swirl Date: Thu, 22 Jul 2010 22:00:21 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: [Qemu-devel] [PATCH 22/34] vga-pci: convert to pci_bar_map List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Use pci_bar_map() and post_map_func instead of a mapping function. Signed-off-by: Blue Swirl --- 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