diff mbox

[RFC,v3,56/56] pci: rename pci_register_bar_region() to pci_register_bar()

Message ID 1310321709-30770-57-git-send-email-avi@redhat.com
State New
Headers show

Commit Message

Avi Kivity July 10, 2011, 6:15 p.m. UTC
Signed-off-by: Avi Kivity <avi@redhat.com>
---
 hw/ac97.c         |    4 ++--
 hw/cirrus_vga.c   |    5 ++---
 hw/e1000.c        |    5 ++---
 hw/eepro100.c     |    7 +++----
 hw/es1370.c       |    2 +-
 hw/ide/cmd646.c   |   14 +++++---------
 hw/ide/ich.c      |    2 +-
 hw/ide/piix.c     |    3 +--
 hw/ide/via.c      |    3 +--
 hw/intel-hda.c    |    2 +-
 hw/ivshmem.c      |   15 +++++++--------
 hw/lsi53c895a.c   |    7 +++----
 hw/macio.c        |    3 +--
 hw/ne2000.c       |    2 +-
 hw/openpic.c      |    4 ++--
 hw/pci.c          |    6 +++---
 hw/pci.h          |    4 ++--
 hw/pcnet-pci.c    |    4 ++--
 hw/qxl.c          |   16 ++++++++--------
 hw/rtl8139.c      |    6 ++----
 hw/sun4u.c        |    6 ++----
 hw/usb-ehci.c     |    2 +-
 hw/usb-ohci.c     |    2 +-
 hw/usb-uhci.c     |    3 +--
 hw/vga-pci.c      |    3 +--
 hw/virtio-pci.c   |    9 ++++-----
 hw/vmware_vga.c   |    8 ++++----
 hw/wdt_i6300esb.c |    2 +-
 hw/xen_platform.c |    7 +++----
 29 files changed, 68 insertions(+), 88 deletions(-)
diff mbox

Patch

diff --git a/hw/ac97.c b/hw/ac97.c
index 72a0667..2089030 100644
--- a/hw/ac97.c
+++ b/hw/ac97.c
@@ -1352,8 +1352,8 @@  static int ac97_initfn (PCIDevice *dev)
     memory_region_init_io(&s->io_nam, &ac97_io_nam_ops, s, "ac97-nam", 1024);
     memory_region_init_io(&s->io_nabm, &ac97_io_nabm_ops, s, "ac97-nabm", 256);
 
-    pci_register_bar_region(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam);
-    pci_register_bar_region(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm);
+    pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam);
+    pci_register_bar(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm);
     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 3fac365..7160584 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -2951,10 +2951,9 @@  static int pci_cirrus_vga_initfn(PCIDevice *dev)
      /* memory #0 LFB */
      /* memory #1 memory-mapped I/O */
      /* XXX: s->vga.vram_size must be a power of two */
-     pci_register_bar_region(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH,
-                             &s->pci_bar);
+     pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->pci_bar);
      if (device_id == CIRRUS_ID_CLGD5446) {
-         pci_register_bar_region(&d->dev, 1, 0, &s->cirrus_mmio_io);
+         pci_register_bar(&d->dev, 1, 0, &s->cirrus_mmio_io);
      }
      return 0;
 }
diff --git a/hw/e1000.c b/hw/e1000.c
index 8e4830f..218d21a 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1158,10 +1158,9 @@  static int pci_e1000_init(PCIDevice *pci_dev)
 
     e1000_mmio_setup(d);
 
-    pci_register_bar_region(&d->dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY,
-                            &d->mmio);
+    pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &d->mmio);
 
-    pci_register_bar_region(&d->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &d->io);
+    pci_register_bar(&d->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &d->io);
 
     memmove(d->eeprom_data, e1000_eeprom_template,
         sizeof e1000_eeprom_template);
diff --git a/hw/eepro100.c b/hw/eepro100.c
index 7b4171f..80b9480 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -1879,15 +1879,14 @@  static int e100_nic_init(PCIDevice *pci_dev)
     /* Handler for memory-mapped I/O */
     memory_region_init_io(&s->mmio_bar, &eepro100_ops, s, "eepro100-mmio",
                           PCI_MEM_SIZE);
-    pci_register_bar_region(&s->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH,
-                            &s->mmio_bar);
+    pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->mmio_bar);
     memory_region_init_io(&s->io_bar, &eepro100_ops, s, "eepro100-io",
                           PCI_IO_SIZE);
-    pci_register_bar_region(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_bar);
+    pci_register_bar(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_bar);
     /* FIXME: flash aliases to mmio?! */
     memory_region_init_io(&s->flash_bar, &eepro100_ops, s, "eepro100-flash",
                           PCI_FLASH_SIZE);
-    pci_register_bar_region(&s->dev, 2, 0, &s->flash_bar);
+    pci_register_bar(&s->dev, 2, 0, &s->flash_bar);
 
     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 a696eb2..c814817 100644
--- a/hw/es1370.c
+++ b/hw/es1370.c
@@ -1026,7 +1026,7 @@  static int es1370_initfn (PCIDevice *dev)
     c[PCI_MAX_LAT] = 0x80;
 
     memory_region_init_io(&s->io, &es1370_io_ops, s, "es1370", 256);
-    pci_register_bar_region(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io);
+    pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io);
     qemu_register_reset (es1370_on_reset, s);
 
     AUD_register_card ("es1370", &s->card);
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index 699ad6b..904febb 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -270,16 +270,12 @@  static int pci_cmd646_ide_initfn(PCIDevice *dev)
 
     setup_cmd646_bar(d, 0);
     setup_cmd646_bar(d, 1);
-    pci_register_bar_region(dev, 0, PCI_BASE_ADDRESS_SPACE_IO,
-                            &d->cmd646_bar[0].data);
-    pci_register_bar_region(dev, 1, PCI_BASE_ADDRESS_SPACE_IO,
-                            &d->cmd646_bar[0].cmd);
-    pci_register_bar_region(dev, 2, PCI_BASE_ADDRESS_SPACE_IO,
-                            &d->cmd646_bar[1].data);
-    pci_register_bar_region(dev, 3, PCI_BASE_ADDRESS_SPACE_IO,
-                            &d->cmd646_bar[2].cmd);
+    pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->cmd646_bar[0].data);
+    pci_register_bar(dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &d->cmd646_bar[0].cmd);
+    pci_register_bar(dev, 2, PCI_BASE_ADDRESS_SPACE_IO, &d->cmd646_bar[1].data);
+    pci_register_bar(dev, 3, PCI_BASE_ADDRESS_SPACE_IO, &d->cmd646_bar[2].cmd);
     bmdma_setup_bar(d);
-    pci_register_bar_region(dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar);
+    pci_register_bar(dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar);
 
     /* TODO: RST# value should be 0 */
     pci_conf[PCI_INTERRUPT_PIN] = 0x01; // interrupt on pin 1
diff --git a/hw/ide/ich.c b/hw/ide/ich.c
index 7e497c3..d5207e5 100644
--- a/hw/ide/ich.c
+++ b/hw/ide/ich.c
@@ -93,7 +93,7 @@  static int pci_ich9_ahci_init(PCIDevice *dev)
     msi_init(dev, 0x50, 1, true, false);
     d->ahci.irq = d->card.irq[0];
 
-    pci_register_bar_region(&d->card, 5, 0, &d->ahci.mem);
+    pci_register_bar(&d->card, 5, 0, &d->ahci.mem);
 
     return 0;
 }
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index c11b960..cba46b8 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -155,8 +155,7 @@  static int pci_piix_ide_initfn(PCIDevice *dev)
     qemu_register_reset(piix3_reset, d);
 
     bmdma_setup_bar(d);
-    pci_register_bar_region(&d->dev, 4, PCI_BASE_ADDRESS_SPACE_IO,
-                            &d->bmdma_bar);
+    pci_register_bar(&d->dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar);
 
     vmstate_register(&d->dev.qdev, 0, &vmstate_ide_pci, d);
 
diff --git a/hw/ide/via.c b/hw/ide/via.c
index eb6a409..c0b9d43 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -180,8 +180,7 @@  static int vt82c686b_ide_initfn(PCIDevice *dev)
 
     qemu_register_reset(via_reset, d);
     bmdma_setup_bar(d);
-    pci_register_bar_region(&d->dev, 4, PCI_BASE_ADDRESS_SPACE_IO,
-                            &d->bmdma_bar);
+    pci_register_bar(&d->dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar);
 
     vmstate_register(&dev->qdev, 0, &vmstate_ide_pci, d);
 
diff --git a/hw/intel-hda.c b/hw/intel-hda.c
index 0f5c6c4..35e55bc 100644
--- a/hw/intel-hda.c
+++ b/hw/intel-hda.c
@@ -1165,7 +1165,7 @@  static int intel_hda_init(PCIDevice *pci)
 
     memory_region_init_io(&d->mmio, &intel_hda_mmio_ops, d,
                           "intel-hda", 0x4000);
-    pci_register_bar_region(&d->pci, 0, 0, &d->mmio);
+    pci_register_bar(&d->pci, 0, 0, &d->mmio);
     if (d->msi) {
         msi_init(&d->pci, 0x50, 1, true, false);
     }
diff --git a/hw/ivshmem.c b/hw/ivshmem.c
index 77695a8..4467a47 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
@@ -336,7 +336,7 @@  static void create_shared_memory_BAR(IVShmemState *s, int fd) {
     memory_region_add_subregion(&s->bar, 0, &s->ivshmem);
 
     /* region for shared memory */
-    pci_register_bar_region(&s->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar);
+    pci_register_bar(&s->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar);
 }
 
 static void close_guest_eventfds(IVShmemState *s, int posn)
@@ -543,9 +543,8 @@  static void ivshmem_setup_msi(IVShmemState * s) {
 
     memory_region_init(&s->msix_bar, "ivshmem-msix", 4096);
     if (!msix_init(&s->dev, s->vectors, &s->msix_bar, 1, 0)) {
-        pci_register_bar_region(&s->dev, 1,
-                                PCI_BASE_ADDRESS_SPACE_MEMORY,
-                                &s->msix_bar);
+        pci_register_bar(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY,
+                         &s->msix_bar);
         IVSHMEM_DPRINTF("msix initialized (%d vectors)\n", s->vectors);
     } else {
         IVSHMEM_DPRINTF("msix initialization failed\n");
@@ -665,8 +664,8 @@  static int pci_ivshmem_init(PCIDevice *dev)
     }
 
     /* region for registers*/
-    pci_register_bar_region(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY,
-                            &s->ivshmem_mmio);
+    pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY,
+                     &s->ivshmem_mmio);
 
     memory_region_init(&s->bar, "ivshmem-bar2-container", s->ivshmem_size);
 
@@ -694,8 +693,8 @@  static int pci_ivshmem_init(PCIDevice *dev)
         /* allocate/initialize space for interrupt handling */
         s->peers = qemu_mallocz(s->nb_peers * sizeof(Peer));
 
-        pci_register_bar_region(&s->dev, 2,
-                                PCI_BASE_ADDRESS_SPACE_MEMORY, &s->ivshmem);
+        pci_register_bar(&s->dev, 2,
+                         PCI_BASE_ADDRESS_SPACE_MEMORY, &s->ivshmem);
 
         s->eventfd_chr = qemu_mallocz(s->vectors * sizeof(CharDriverState *));
 
diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index a433920..e614dea 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -2124,10 +2124,9 @@  static int lsi_scsi_init(PCIDevice *dev)
     memory_region_init_io(&s->ram_io, &lsi_ram_ops, s, "lsi-ram", 0x2000);
     memory_region_init_io(&s->io_io, &lsi_io_ops, s, "lsi-io", 256);
 
-    pci_register_bar_region(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_io);
-    pci_register_bar_region(&s->dev, 1, 0, &s->mmio_io);
-    pci_register_bar_region(&s->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY,
-                            &s->ram_io);
+    pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_io);
+    pci_register_bar(&s->dev, 1, 0, &s->mmio_io);
+    pci_register_bar(&s->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->ram_io);
     QTAILQ_INIT(&s->queue);
 
     scsi_bus_new(&s->bus, &dev->qdev, 1, LSI_MAX_DEVS, &lsi_scsi_ops);
diff --git a/hw/macio.c b/hw/macio.c
index 71fa2a8..cc6ae40 100644
--- a/hw/macio.c
+++ b/hw/macio.c
@@ -111,6 +111,5 @@  void macio_init (PCIBus *bus, int device_id, int is_oldworld,
     d->config[0x3d] = 0x01; // interrupt on pin 1
 
     macio_bar_setup(macio_state);
-    pci_register_bar_region(d, 0, PCI_BASE_ADDRESS_SPACE_MEMORY,
-                            &macio_state->bar);
+    pci_register_bar(d, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &macio_state->bar);
 }
diff --git a/hw/ne2000.c b/hw/ne2000.c
index ba20dc2..572ceab 100644
--- a/hw/ne2000.c
+++ b/hw/ne2000.c
@@ -754,7 +754,7 @@  static int pci_ne2000_init(PCIDevice *pci_dev)
 
     s = &d->ne2000;
     ne2000_setup_io(s, 0x100);
-    pci_register_bar_region(&d->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io);
+    pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io);
     s->irq = d->dev.irq[0];
 
     qemu_macaddr_default_if_unset(&s->c.macaddr);
diff --git a/hw/openpic.c b/hw/openpic.c
index fd1ffba..8f72f4b 100644
--- a/hw/openpic.c
+++ b/hw/openpic.c
@@ -1177,8 +1177,8 @@  qemu_irq *openpic_init (PCIBus *bus, MemoryRegion **pmem, int nb_cpus,
 #endif
 
         /* Register I/O spaces */
-        pci_register_bar_region(&opp->pci_dev, 0,
-                                PCI_BASE_ADDRESS_SPACE_MEMORY, &opp->mem);
+        pci_register_bar(&opp->pci_dev, 0,
+                         PCI_BASE_ADDRESS_SPACE_MEMORY, &opp->mem);
     } else {
         opp = qemu_mallocz(sizeof(openpic_t));
         memory_region_init_io(&opp->mem, &openpic_ops, opp, "openpic", 0x40000);
diff --git a/hw/pci.c b/hw/pci.c
index 04b6372..d507845 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -881,8 +881,8 @@  static int pci_unregister_device(DeviceState *dev)
     return 0;
 }
 
-void pci_register_bar_region(PCIDevice *pci_dev, int region_num,
-                             uint8_t type, MemoryRegion *memory)
+void pci_register_bar(PCIDevice *pci_dev, int region_num,
+                      uint8_t type, MemoryRegion *memory)
 {
     PCIIORegion *r;
     uint32_t addr;
@@ -1959,7 +1959,7 @@  static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom)
 
     qemu_put_ram_ptr(ptr);
 
-    pci_register_bar_region(pdev, PCI_ROM_SLOT, 0, &pdev->rom);
+    pci_register_bar(pdev, PCI_ROM_SLOT, 0, &pdev->rom);
 
     return 0;
 }
diff --git a/hw/pci.h b/hw/pci.h
index 274d719..6ff4fdd 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -201,8 +201,8 @@  PCIDevice *pci_register_device(PCIBus *bus, const char *name,
                                PCIConfigReadFunc *config_read,
                                PCIConfigWriteFunc *config_write);
 
-void pci_register_bar_region(PCIDevice *pci_dev, int region_num,
-                             uint8_t attr, MemoryRegion *memory);
+void pci_register_bar(PCIDevice *pci_dev, int region_num,
+                      uint8_t attr, MemoryRegion *memory);
 pcibus_t pci_get_bar_addr(PCIDevice *pci_dev, int region_num);
 
 int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
diff --git a/hw/pcnet-pci.c b/hw/pcnet-pci.c
index fad0722..ece45c9 100644
--- a/hw/pcnet-pci.c
+++ b/hw/pcnet-pci.c
@@ -319,9 +319,9 @@  static int pci_pcnet_init(PCIDevice *pci_dev)
 
     memory_region_init_io(&d->io_bar, &pcnet_io_ops, d, "pcnet-io",
                           PCNET_IOPORT_SIZE);
-    pci_register_bar_region(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->io_bar);
+    pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->io_bar);
 
-    pci_register_bar_region(pci_dev, 1, 0, &s->mmio);
+    pci_register_bar(pci_dev, 1, 0, &s->mmio);
 
     s->irq = pci_dev->irq[0];
     s->phys_mem_read = pci_physical_memory_read;
diff --git a/hw/qxl.c b/hw/qxl.c
index da323f6..569529d 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1220,17 +1220,17 @@  static int qxl_init_common(PCIQXLDevice *qxl)
     }
 
 
-    pci_register_bar_region(&qxl->pci, QXL_IO_RANGE_INDEX,
-                            PCI_BASE_ADDRESS_SPACE_IO, &qxl->io_bar);
+    pci_register_bar(&qxl->pci, QXL_IO_RANGE_INDEX,
+                     PCI_BASE_ADDRESS_SPACE_IO, &qxl->io_bar);
 
-    pci_register_bar_region(&qxl->pci, QXL_ROM_RANGE_INDEX,
-                            PCI_BASE_ADDRESS_SPACE_MEMORY, &qxl->rom_bar);
+    pci_register_bar(&qxl->pci, QXL_ROM_RANGE_INDEX,
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, &qxl->rom_bar);
 
-    pci_register_bar_region(&qxl->pci, QXL_RAM_RANGE_INDEX,
-                            PCI_BASE_ADDRESS_SPACE_MEMORY, &qxl->vga.vram);
+    pci_register_bar(&qxl->pci, QXL_RAM_RANGE_INDEX,
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, &qxl->vga.vram);
 
-    pci_register_bar_region(&qxl->pci, QXL_VRAM_RANGE_INDEX,
-                            PCI_BASE_ADDRESS_SPACE_MEMORY, &qxl->vram_bar);
+    pci_register_bar(&qxl->pci, QXL_VRAM_RANGE_INDEX,
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, &qxl->vram_bar);
 
     qxl->ssd.qxl.base.sif = &qxl_interface.base;
     qxl->ssd.qxl.id = qxl->id;
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index fa661fc..e425463 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -3397,10 +3397,8 @@  static int pci_rtl8139_init(PCIDevice *dev)
 
     memory_region_init_io(&s->bar_io, &rtl8139_io_ops, s, "rtl8139", 0x100);
     memory_region_init_io(&s->bar_mem, &rtl8139_io_ops, s, "rtl8139", 0x100);
-    pci_register_bar_region(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO,
-                            &s->bar_io);
-    pci_register_bar_region(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY,
-                            &s->bar_mem);
+    pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->bar_io);
+    pci_register_bar(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar_mem);
 
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
 
diff --git a/hw/sun4u.c b/hw/sun4u.c
index 74a06a8..160c004 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -554,11 +554,9 @@  pci_ebus_init1(PCIDevice *pci_dev)
     pci_dev->config[0x0D] = 0x0a; // latency_timer
 
     isa_mmio_setup(&s->bar0, 0x1000000);
-    pci_register_bar_region(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY,
-                            &s->bar0);
+    pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar0);
     isa_mmio_setup(&s->bar1, 0x800000);
-    pci_register_bar_region(pci_dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY,
-                            &s->bar1);
+    pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar1);
     return 0;
 }
 
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index bd7fdcb..c433795 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -2224,7 +2224,7 @@  static int usb_ehci_initfn(PCIDevice *dev)
     qemu_register_reset(ehci_reset, s);
 
     memory_region_init_io(&s->mem, &ehci_mem_ops, s, "ehci", MMIO_SIZE);
-    pci_register_bar_region(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mem);
+    pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mem);
 
     fprintf(stderr, "*** EHCI support is under development ***\n");
 
diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 36885cb..50c8e69 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -1759,7 +1759,7 @@  static int usb_ohci_initfn_pci(struct PCIDevice *dev)
     ohci->state.irq = ohci->pci_dev.irq[0];
 
     /* TODO: avoid cast below by using dev */
-    pci_register_bar_region(&ohci->pci_dev, 0, 0, &ohci->state.mem);
+    pci_register_bar(&ohci->pci_dev, 0, 0, &ohci->state.mem);
     return 0;
 }
 
diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index 95ef260..1602a58 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -1160,8 +1160,7 @@  static int usb_uhci_common_initfn(PCIDevice *dev)
     memory_region_init_io(&s->io_bar, &uhci_ioport_ops, s, "uhci", 0x20);
     /* Use region 4 for consistency with real hardware.  BSD guests seem
        to rely on this.  */
-    pci_register_bar_region(&s->dev, 4,
-                            PCI_BASE_ADDRESS_SPACE_IO, &s->io_bar);
+    pci_register_bar(&s->dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &s->io_bar);
 
     return 0;
 }
diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index 7062c4d..c67be0a 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -60,8 +60,7 @@  static int pci_vga_initfn(PCIDevice *dev)
                                   s->screen_dump, s->text_update, s);
 
      /* XXX: VGA_RAM_SIZE must be a power of two */
-     pci_register_bar_region(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH,
-                             &s->vram);
+     pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->vram);
 
      if (!dev->rom_bar) {
          /* compatibility with pc-0.13 and older */
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 9aaac67..5e4ccbe 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -668,9 +668,8 @@  void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev)
     memory_region_init(&proxy->msix_bar, "virtio-msix", 4096);
     if (vdev->nvectors && !msix_init(&proxy->pci_dev, vdev->nvectors,
                                      &proxy->msix_bar, 1, 0)) {
-        pci_register_bar_region(&proxy->pci_dev, 1,
-                                PCI_BASE_ADDRESS_SPACE_MEMORY,
-                                &proxy->msix_bar);
+        pci_register_bar(&proxy->pci_dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY,
+                         &proxy->msix_bar);
     } else
         vdev->nvectors = 0;
 
@@ -682,8 +681,8 @@  void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev)
 
     memory_region_init_io(&proxy->bar, &virtio_pci_config_ops, proxy,
                           "virtio-pci", size);
-    pci_register_bar_region(&proxy->pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO,
-                            &proxy->bar);
+    pci_register_bar(&proxy->pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO,
+                     &proxy->bar);
 
     if (!kvm_has_many_ioeventfds()) {
         proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD;
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index feb7197..baff423 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -1315,13 +1315,13 @@  static int pci_vmsvga_initfn(PCIDevice *dev)
 
     memory_region_init_io(&s->io_bar, &vmsvga_io_ops, &s->chip,
                           "vmsvga-io", 0x10);
-    pci_register_bar_region(&s->card, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_bar);
+    pci_register_bar(&s->card, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_bar);
 
     vmsvga_init(&s->chip, VGA_RAM_SIZE);
 
-    pci_register_bar_region(&s->card, 1, PCI_BASE_ADDRESS_MEM_PREFETCH, iomem);
-    pci_register_bar_region(&s->card, 2, PCI_BASE_ADDRESS_MEM_PREFETCH,
-                            &s->chip.fifo_ram);
+    pci_register_bar(&s->card, 1, PCI_BASE_ADDRESS_MEM_PREFETCH, iomem);
+    pci_register_bar(&s->card, 2, PCI_BASE_ADDRESS_MEM_PREFETCH,
+                     &s->chip.fifo_ram);
 
     if (!dev->rom_bar) {
         /* compatibility with pc-0.13 and older */
diff --git a/hw/wdt_i6300esb.c b/hw/wdt_i6300esb.c
index 242a8fa..c9a778c 100644
--- a/hw/wdt_i6300esb.c
+++ b/hw/wdt_i6300esb.c
@@ -421,7 +421,7 @@  static int i6300esb_init(PCIDevice *dev)
     d->previous_reboot_flag = 0;
 
     memory_region_init_io(&d->io_mem, &i6300esb_ops, d, "i6300esb", 0x10);
-    pci_register_bar_region(&d->dev, 0, 0, &d->io_mem);
+    pci_register_bar(&d->dev, 0, 0, &d->io_mem);
     /* qemu_register_coalesced_mmio (addr, 0x10); ? */
 
     return 0;
diff --git a/hw/xen_platform.c b/hw/xen_platform.c
index b5da08f..d23a621 100644
--- a/hw/xen_platform.c
+++ b/hw/xen_platform.c
@@ -345,13 +345,12 @@  static int xen_platform_initfn(PCIDevice *dev)
     pci_conf[PCI_INTERRUPT_PIN] = 1;
 
     platform_ioport_bar_setup(d);
-    pci_register_bar_region(&d->pci_dev, 0,
-                            PCI_BASE_ADDRESS_SPACE_IO, &d->bar);
+    pci_register_bar(&d->pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->bar);
 
     /* reserve 16MB mmio address for share memory*/
     platform_mmio_setup(d);
-    pci_register_bar_region(&d->pci_dev, 1,
-                            PCI_BASE_ADDRESS_MEM_PREFETCH, &d->mmio_bar);
+    pci_register_bar(&d->pci_dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH,
+                     &d->mmio_bar);
 
     platform_fixed_ioport_init(d);