Patchwork [16/34] pci: add post_map_func, adjust callers

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

Comments

Blue Swirl - July 22, 2010, 9:58 p.m.
Add a callback for PCI BAR mapping. Replaces map_func.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 hw/ac97.c         |    5 +++--
 hw/cirrus_vga.c   |    5 +++--
 hw/e1000.c        |    4 ++--
 hw/eepro100.c     |    8 ++++----
 hw/es1370.c       |    2 +-
 hw/ide/cmd646.c   |   10 +++++-----
 hw/ide/piix.c     |    2 +-
 hw/ide/via.c      |    3 ++-
 hw/lsi53c895a.c   |    6 +++---
 hw/macio.c        |    2 +-
 hw/ne2000.c       |    2 +-
 hw/openpic.c      |    2 +-
 hw/pci.c          |   17 ++++++++++++++---
 hw/pci.h          |    6 ++++--
 hw/pcnet.c        |    4 ++--
 hw/rtl8139.c      |    5 +++--
 hw/sun4u.c        |    6 ++++--
 hw/usb-ohci.c     |    2 +-
 hw/usb-uhci.c     |    2 +-
 hw/vga-pci.c      |    4 ++--
 hw/virtio-pci.c   |    4 ++--
 hw/vmware_vga.c   |    6 +++---
 hw/wdt_i6300esb.c |    3 ++-
 23 files changed, 65 insertions(+), 45 deletions(-)

Patch

diff --git a/hw/ac97.c b/hw/ac97.c
index d71072d..ad4aef4 100644
--- a/hw/ac97.c
+++ b/hw/ac97.c
@@ -1321,8 +1321,9 @@  static int ac97_initfn (PCIDevice *dev)
     c[PCI_INTERRUPT_PIN] = 0x01;      /* intr_pn interrupt pin ro */

     pci_register_bar (&s->dev, 0, 256 * 4, PCI_BASE_ADDRESS_SPACE_IO,
-                      ac97_map);
-    pci_register_bar (&s->dev, 1, 64 * 4, PCI_BASE_ADDRESS_SPACE_IO, ac97_map);
+                      ac97_map, NULL);
+    pci_register_bar (&s->dev, 1, 64 * 4, PCI_BASE_ADDRESS_SPACE_IO, ac97_map,
+                      NULL);
     qemu_register_reset (ac97_on_reset, s);
     AUD_register_card ("ac97", &s->card);
     ac97_on_reset (s);
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index bbd4b08..7c14361 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -3205,10 +3205,11 @@  static int pci_cirrus_vga_initfn(PCIDevice *dev)
      /* memory #1 memory-mapped I/O */
      /* XXX: s->vga.vram_size must be a power of two */
      pci_register_bar((PCIDevice *)d, 0, 0x2000000,
-                      PCI_BASE_ADDRESS_MEM_PREFETCH, cirrus_pci_lfb_map);
+                      PCI_BASE_ADDRESS_MEM_PREFETCH, cirrus_pci_lfb_map, NULL);
      if (device_id == CIRRUS_ID_CLGD5446) {
          pci_register_bar((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE,
-                          PCI_BASE_ADDRESS_SPACE_MEMORY, cirrus_pci_mmio_map);
+                          PCI_BASE_ADDRESS_SPACE_MEMORY, cirrus_pci_mmio_map,
+                          NULL);
      }
      return 0;
 }
diff --git a/hw/e1000.c b/hw/e1000.c
index db9143d..6d1c3d4 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1105,10 +1105,10 @@  static int pci_e1000_init(PCIDevice *pci_dev)
             e1000_mmio_write, d);

     pci_register_bar((PCIDevice *)d, 0, PNPMMIO_SIZE,
-                           PCI_BASE_ADDRESS_SPACE_MEMORY, e1000_mmio_map);
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, e1000_mmio_map, NULL);

     pci_register_bar((PCIDevice *)d, 1, IOPORT_SIZE,
-                           PCI_BASE_ADDRESS_SPACE_IO, ioport_map);
+                     PCI_BASE_ADDRESS_SPACE_IO, ioport_map, NULL);

     memmove(d->eeprom_data, e1000_eeprom_template,
         sizeof e1000_eeprom_template);
diff --git a/hw/eepro100.c b/hw/eepro100.c
index 2b75c8f..2b86007 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -1869,12 +1869,12 @@  static int e100_nic_init(PCIDevice *pci_dev)
         cpu_register_io_memory(pci_mmio_read, pci_mmio_write, s);

     pci_register_bar(&s->dev, 0, PCI_MEM_SIZE,
-                           PCI_BASE_ADDRESS_SPACE_MEMORY |
-                           PCI_BASE_ADDRESS_MEM_PREFETCH, pci_mmio_map);
+                     PCI_BASE_ADDRESS_SPACE_MEMORY |
+                     PCI_BASE_ADDRESS_MEM_PREFETCH, pci_mmio_map, NULL);
     pci_register_bar(&s->dev, 1, PCI_IO_SIZE, PCI_BASE_ADDRESS_SPACE_IO,
-                           pci_map);
+                     pci_map, NULL);
     pci_register_bar(&s->dev, 2, PCI_FLASH_SIZE, PCI_BASE_ADDRESS_SPACE_MEMORY,
-                           pci_mmio_map);
+                     pci_mmio_map, NULL);

     qemu_macaddr_default_if_unset(&s->conf.macaddr);
     logout("macaddr: %s\n", nic_dump(&s->conf.macaddr.a[0], 6));
diff --git a/hw/es1370.c b/hw/es1370.c
index a6f890e..3a870b4 100644
--- a/hw/es1370.c
+++ b/hw/es1370.c
@@ -1018,7 +1018,7 @@  static int es1370_initfn (PCIDevice *dev)
     c[PCI_MIN_GNT] = 0x0c;
     c[PCI_MAX_LAT] = 0x80;

-    pci_register_bar (&s->dev, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, NULL);
+    pci_register_bar (&s->dev, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
     io_index = cpu_register_io (es1370_reads, es1370_writes, 256, s);
     pci_bar_map (&s->dev, 0, 0, 0, 256, io_index);

diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index ec080e0..ee1c7cb 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -255,19 +255,19 @@  static int pci_cmd646_ide_initfn(PCIDevice *dev)
         pci_conf[0x51] |= 0x08; /* enable IDE1 */
     }

-    pci_register_bar(dev, 0, 8, PCI_BASE_ADDRESS_SPACE_IO, NULL);
+    pci_register_bar(dev, 0, 8, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
     io_index = cpu_register_io(ide_ioport_reads, ide_ioport_writes,
8, &d->bus[0]);
     pci_bar_map(&d->dev, 0, 0, 0, 8, io_index);
-    pci_register_bar(dev, 1, 4, PCI_BASE_ADDRESS_SPACE_IO, NULL);
+    pci_register_bar(dev, 1, 4, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
     io_index = cpu_register_io(ide_status_reads, ide_cmd_writes, 1,
&d->bus[0]);
     pci_bar_map(&d->dev, 1, 0, 2, 1, io_index);
-    pci_register_bar(dev, 2, 8, PCI_BASE_ADDRESS_SPACE_IO, NULL);
+    pci_register_bar(dev, 2, 8, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
     io_index = cpu_register_io(ide_ioport_reads, ide_ioport_writes,
8, &d->bus[1]);
     pci_bar_map(&d->dev, 2, 0, 0, 8, io_index);
-    pci_register_bar(dev, 3, 4, PCI_BASE_ADDRESS_SPACE_IO, NULL);
+    pci_register_bar(dev, 3, 4, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
     io_index = cpu_register_io(ide_status_reads, ide_cmd_writes, 1,
&d->bus[1]);
     pci_bar_map(&d->dev, 3, 0, 2, 1, io_index);
-    pci_register_bar(dev, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, NULL);
+    pci_register_bar(dev, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
     for (i = 0; i < 2; i++) {
         BMDMAState *bm = &d->bmdma[i];

diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 959e061..c23fa5f 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -130,7 +130,7 @@  static int pci_piix_ide_initfn(PCIIDEState *d)

     qemu_register_reset(piix3_reset, d);

-    pci_register_bar(&d->dev, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, NULL);
+    pci_register_bar(&d->dev, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
     for (i = 0; i < 2; i++) {
         BMDMAState *bm = &d->bmdma[i];

diff --git a/hw/ide/via.c b/hw/ide/via.c
index 36901b3..4adf1a0 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -158,7 +158,8 @@  static int vt82c686b_ide_initfn(PCIDevice *dev)
     pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0);

     qemu_register_reset(via_reset, d);
-    pci_register_bar((PCIDevice *)d, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, NULL);
+    pci_register_bar((PCIDevice *)d, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, NULL,
+                     NULL);
     for (i = 0; i < 2; i++) {
         BMDMAState *bm = &d->bmdma[i];

diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index bd7b661..a9cbcef 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -2178,11 +2178,11 @@  static int lsi_scsi_init(PCIDevice *dev)

     /* TODO: use dev and get rid of cast below */
     pci_register_bar((struct PCIDevice *)s, 0, 256,
-                           PCI_BASE_ADDRESS_SPACE_IO, lsi_io_mapfunc);
+                     PCI_BASE_ADDRESS_SPACE_IO, lsi_io_mapfunc, NULL);
     pci_register_bar((struct PCIDevice *)s, 1, 0x400,
-                           PCI_BASE_ADDRESS_SPACE_MEMORY, lsi_mmio_mapfunc);
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, lsi_mmio_mapfunc, NULL);
     pci_register_bar((struct PCIDevice *)s, 2, 0x2000,
-                           PCI_BASE_ADDRESS_SPACE_MEMORY, lsi_ram_mapfunc);
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, lsi_ram_mapfunc, NULL);
     QTAILQ_INIT(&s->queue);

     scsi_bus_new(&s->bus, &dev->qdev, 1, LSI_MAX_DEVS, lsi_command_complete);
diff --git a/hw/macio.c b/hw/macio.c
index 8717bc0..f1e3625 100644
--- a/hw/macio.c
+++ b/hw/macio.c
@@ -46,7 +46,7 @@  void macio_init (PCIBus *bus, int device_id, int
is_oldworld, int pic_mem_index,

     d->config[0x3d] = 0x01; // interrupt on pin 1

-    pci_register_bar(d, 0, 0x80000, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
+    pci_register_bar(d, 0, 0x80000, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL, NULL);
     if (pic_mem_index >= 0) {
         if (is_oldworld) {
             /* Heathrow PIC */
diff --git a/hw/ne2000.c b/hw/ne2000.c
index 2b1e1ad..695b739 100644
--- a/hw/ne2000.c
+++ b/hw/ne2000.c
@@ -744,7 +744,7 @@  static int pci_ne2000_init(PCIDevice *pci_dev)
     pci_conf[PCI_INTERRUPT_PIN] = 1; // interrupt pin 0

     s = &d->ne2000;
-    pci_register_bar(&d->dev, 0, 0x100, PCI_BASE_ADDRESS_SPACE_IO, NULL);
+    pci_register_bar(&d->dev, 0, 0x100, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
     io_index = cpu_register_io(ne2000_io_reads, ne2000_io_writes, 16, s);
     pci_bar_map(&d->dev, 0, 0, 0, 16, io_index);
     io_index = cpu_register_io(ne2000_asic_io_reads,
ne2000_asic_io_writes, 4, s);
diff --git a/hw/openpic.c b/hw/openpic.c
index 3f97afd..6b4140f 100644
--- a/hw/openpic.c
+++ b/hw/openpic.c
@@ -1170,7 +1170,7 @@  qemu_irq *openpic_init (PCIBus *bus, int
*pmem_index, int nb_cpus,

         /* Register I/O spaces */
         pci_register_bar((PCIDevice *)opp, 0, 0x40000,
-                         PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
+                         PCI_BASE_ADDRESS_SPACE_MEMORY, NULL, NULL);
     } else {
         opp = qemu_mallocz(sizeof(openpic_t));
     }
diff --git a/hw/pci.c b/hw/pci.c
index 49f03fb..4ff7b79 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -788,8 +788,9 @@  static int pci_unregister_device(DeviceState *dev)
 }

 void pci_register_bar(PCIDevice *pci_dev, int region_num,
-                            pcibus_t size, int type,
-                            PCIMapIORegionFunc *map_func)
+                      pcibus_t size, int type,
+                      PCIMapIORegionFunc *map_func,
+                      PCIMapIORegionFunc *post_map_func)
 {
     PCIIORegion *r;
     uint32_t addr;
@@ -809,6 +810,7 @@  void pci_register_bar(PCIDevice *pci_dev, int region_num,
     r->size = size;
     r->type = type;
     r->map_func = map_func;
+    r->post_map_func = post_map_func;

     wmask = ~(size - 1);
     addr = pci_bar(pci_dev, region_num);
@@ -1090,6 +1092,10 @@  static void pci_update_mappings(PCIDevice *d)
                         r->map_func(d, i, new_addr, s->filtered_size, r->type);
                     } else {
                         cpu_map_io(new_addr, s->ix);
+                        if (r->post_map_func) {
+                            r->post_map_func(d, i, new_addr, s->filtered_size,
+                                             r->type);
+                        }
                     }
                 } else {
                     if (r->map_func) {
@@ -1100,6 +1106,11 @@  static void pci_update_mappings(PCIDevice *d)
                                                                      new_addr),
                                                      s->filtered_size,
                                                      s->ix);
+                        if (r->post_map_func) {
+                            r->post_map_func(d, i,
+                                             pci_to_cpu_addr(d->bus, new_addr),
+                                             s->filtered_size, r->type);
+                        }
                     }
                 }
             }
@@ -1899,7 +1910,7 @@  static int pci_add_option_rom(PCIDevice *pdev)
     load_image(path, ptr);
     qemu_free(path);

-    pci_register_bar(pdev, PCI_ROM_SLOT, size, 0, NULL);
+    pci_register_bar(pdev, PCI_ROM_SLOT, size, 0, NULL, NULL);
     pci_bar_map(pdev, PCI_ROM_SLOT, 0, 0, size, pdev->rom_offset);

     return 0;
diff --git a/hw/pci.h b/hw/pci.h
index b518b3f..b1064d4 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -96,6 +96,7 @@  typedef struct PCIIORegion {
     pcibus_t size;
     uint8_t type;
     PCIMapIORegionFunc *map_func;
+    PCIMapIORegionFunc *post_map_func;
     PCIIOSubRegion subregions[PCI_NUM_SUBREGIONS];
 } PCIIORegion;

@@ -189,8 +190,9 @@  PCIDevice *pci_register_device(PCIBus *bus, const
char *name,
                                PCIConfigWriteFunc *config_write);

 void pci_register_bar(PCIDevice *pci_dev, int region_num,
-                            pcibus_t size, int type,
-                            PCIMapIORegionFunc *map_func);
+                      pcibus_t size, int type,
+                      PCIMapIORegionFunc *map_func,
+                      PCIMapIORegionFunc *post_map_func);

 void pci_bar_map(PCIDevice *pci_dev, int region_num, int subregion_num,
                  pcibus_t offset, pcibus_t size, int ix);
diff --git a/hw/pcnet.c b/hw/pcnet.c
index 49ff321..e93cdff 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1991,14 +1991,14 @@  static int pci_pcnet_init(PCIDevice *pci_dev)
       cpu_register_io_memory(pcnet_mmio_read, pcnet_mmio_write, &d->state);

     pci_register_bar(pci_dev, 0, PCNET_IOPORT_SIZE,
-                     PCI_BASE_ADDRESS_SPACE_IO, NULL);
+                     PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
     io_index = cpu_register_io(pcnet_aprom_reads, pcnet_aprom_writes, 16, s);
     pci_bar_map(pci_dev, 0, 0, 0, 16, io_index);
     io_index = cpu_register_io(pcnet_ioport_reads, pcnet_ioport_writes, 16, s);
     pci_bar_map(pci_dev, 0, 1, 16, 16, io_index);

     pci_register_bar(pci_dev, 1, PCNET_PNPMMIO_SIZE,
-                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL, NULL);
     pci_bar_map((PCIDevice *)d, 1, 0, 0, PCNET_PNPMMIO_SIZE, s->mmio_index);

     s->irq = pci_dev->irq[0];
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index bc20549..31bc15e 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -3358,10 +3358,11 @@  static int pci_rtl8139_init(PCIDevice *dev)
     s->rtl8139_mmio_io_addr =
         cpu_register_io_memory(rtl8139_mmio_read, rtl8139_mmio_write, s);

-    pci_register_bar(&s->dev, 0, 0x100, PCI_BASE_ADDRESS_SPACE_IO, NULL);
+    pci_register_bar(&s->dev, 0, 0x100, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
     io_index = cpu_register_io(rtl8139_io_reads, rtl8139_io_writes, 0x100, s);
     pci_bar_map(&s->dev, 0, 0, 0, 0x100, io_index);
-    pci_register_bar(&s->dev, 1, 0x100, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
+    pci_register_bar(&s->dev, 1, 0x100, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL,
+                     NULL);
     pci_bar_map(&s->dev, 1, 0, 0, 0x100, s->rtl8139_mmio_io_addr);

     qemu_macaddr_default_if_unset(&s->conf.macaddr);
diff --git a/hw/sun4u.c b/hw/sun4u.c
index 8565243..1553cc3 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -550,11 +550,13 @@  pci_ebus_init1(PCIDevice *s)
     pci_config_set_class(s->config, PCI_CLASS_BRIDGE_OTHER);
     s->config[0x0D] = 0x0a; // latency_timer

-    pci_register_bar(s, 0, 0x1000000, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
+    pci_register_bar(s, 0, 0x1000000, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL,
+                     NULL);
     io_index = pci_isa_mmio_init(1);
     pci_bar_map(s, 0, 0, 0, 0x1000000, io_index);

-    pci_register_bar(s, 1, 0x800000, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
+    pci_register_bar(s, 1, 0x800000, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL,
+                     NULL);
     io_index = pci_isa_mmio_init(1);
     pci_bar_map(s, 1, 0, 0, 0x800000, io_index);

diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 992400e..b09d276 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -1735,7 +1735,7 @@  static int usb_ohci_initfn_pci(struct PCIDevice *dev)

     /* TODO: avoid cast below by using dev */
     pci_register_bar((struct PCIDevice *)ohci, 0, 256,
-                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL, NULL);
     pci_bar_map((struct PCIDevice *)ohci, 0, 0, 256, 0, ohci->state.mem);
     return 0;
 }
diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index 2e1f5ee..1129acd 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -1125,7 +1125,7 @@  static int usb_uhci_common_initfn(UHCIState *s)

     /* Use region 4 for consistency with real hardware.  BSD guests seem
        to rely on this.  */
-    pci_register_bar(&s->dev, 4, 0x20, PCI_BASE_ADDRESS_SPACE_IO, NULL);
+    pci_register_bar(&s->dev, 4, 0x20, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
     io_index = cpu_register_io(uhci_io_reads, uhci_io_writes, 32, s);
     pci_bar_map(&s->dev, 4, 0, 0, 32, io_index);
     return 0;
diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index 2315f70..216071f 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -93,7 +93,7 @@  static int pci_vga_initfn(PCIDevice *dev)

      /* 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);
+                      PCI_BASE_ADDRESS_MEM_PREFETCH, vga_map, NULL);

      if (s->bios_size) {
         unsigned int bios_total_size;
@@ -102,7 +102,7 @@  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);
+                         PCI_BASE_ADDRESS_MEM_PREFETCH, vga_map, NULL);
      }

     vga_init_vbe(s);
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 31a711e..781d83c 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -518,7 +518,7 @@  static void virtio_init_pci(VirtIOPCIProxy *proxy,
VirtIODevice *vdev,
         pci_register_bar(&proxy->pci_dev, 1,
                          msix_bar_size(&proxy->pci_dev),
                          PCI_BASE_ADDRESS_SPACE_MEMORY,
-                         msix_mmio_map);
+                         msix_mmio_map, NULL);
     } else
         vdev->nvectors = 0;

@@ -529,7 +529,7 @@  static void virtio_init_pci(VirtIOPCIProxy *proxy,
VirtIODevice *vdev,
         size = 1 << qemu_fls(size);

     pci_register_bar(&proxy->pci_dev, 0, size, PCI_BASE_ADDRESS_SPACE_IO,
-                           virtio_map);
+                     virtio_map, NULL);

     virtio_bind_device(vdev, &virtio_pci_bindings, proxy);
     proxy->host_features |= 0x1 << VIRTIO_F_NOTIFY_ON_EMPTY;
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index 12bff48..00fa8fd 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -1250,12 +1250,12 @@  static int pci_vmsvga_initfn(PCIDevice *dev)
     s->card.config[PCI_INTERRUPT_LINE] = 0xff;		/* End */

     pci_register_bar(&s->card, 0, 0x10,
-                    PCI_BASE_ADDRESS_SPACE_IO, pci_vmsvga_map_ioport);
+                     PCI_BASE_ADDRESS_SPACE_IO, pci_vmsvga_map_ioport, NULL);
     pci_register_bar(&s->card, 1, VGA_RAM_SIZE,
-                    PCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_mem);
+                     PCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_mem, NULL);

     pci_register_bar(&s->card, 2, SVGA_FIFO_SIZE,
-		     PCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_fifo);
+                     PCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_fifo, NULL);

     vmsvga_init(&s->chip, VGA_RAM_SIZE);

diff --git a/hw/wdt_i6300esb.c b/hw/wdt_i6300esb.c
index 24409ec..400ff82 100644
--- a/hw/wdt_i6300esb.c
+++ b/hw/wdt_i6300esb.c
@@ -401,7 +401,8 @@  static int i6300esb_init(PCIDevice *dev)
     pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_ESB_9);
     pci_config_set_class(pci_conf, PCI_CLASS_SYSTEM_OTHER);

-    pci_register_bar(&d->dev, 0, 0x10, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
+    pci_register_bar(&d->dev, 0, 0x10, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL,
+                     NULL);
     io_mem = cpu_register_io_memory(mem_read, mem_write, d);
     pci_bar_map(&d->dev, 0, 0, 0, 0x10, io_mem);