Commit 28c2c26495da884f534d95bfda7c9b411e1417fc

Authored by Avi Kivity
Committed by Anthony Liguori
1 parent e9179ce1

Rename pci_register_io_region() to pci_register_bar()

This function is used to manage a PCI BAR, so make the more generic
pci_register_io_region() available to other uses.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/ac97.c
... ... @@ -1366,8 +1366,8 @@ int ac97_init (PCIBus *bus)
1366 1366 c[0x3c] = 0x00; /* intr_ln interrupt line rw */
1367 1367 c[0x3d] = 0x01; /* intr_pn interrupt pin ro */
1368 1368  
1369   - pci_register_io_region (&d->dev, 0, 256 * 4, PCI_ADDRESS_SPACE_IO, ac97_map);
1370   - pci_register_io_region (&d->dev, 1, 64 * 4, PCI_ADDRESS_SPACE_IO, ac97_map);
  1369 + pci_register_bar (&d->dev, 0, 256 * 4, PCI_ADDRESS_SPACE_IO, ac97_map);
  1370 + pci_register_bar (&d->dev, 1, 64 * 4, PCI_ADDRESS_SPACE_IO, ac97_map);
1371 1371 register_savevm ("ac97", 0, 2, ac97_save, ac97_load, s);
1372 1372 qemu_register_reset (ac97_on_reset, 0, s);
1373 1373 AUD_register_card ("ac97", &s->card);
... ...
hw/cirrus_vga.c
... ... @@ -3336,10 +3336,10 @@ void pci_cirrus_vga_init(PCIBus *bus)
3336 3336 /* memory #0 LFB */
3337 3337 /* memory #1 memory-mapped I/O */
3338 3338 /* XXX: s->vga.vram_size must be a power of two */
3339   - pci_register_io_region((PCIDevice *)d, 0, 0x2000000,
  3339 + pci_register_bar((PCIDevice *)d, 0, 0x2000000,
3340 3340 PCI_ADDRESS_SPACE_MEM_PREFETCH, cirrus_pci_lfb_map);
3341 3341 if (device_id == CIRRUS_ID_CLGD5446) {
3342   - pci_register_io_region((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE,
  3342 + pci_register_bar((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE,
3343 3343 PCI_ADDRESS_SPACE_MEM, cirrus_pci_mmio_map);
3344 3344 }
3345 3345 /* XXX: ROM BIOS */
... ...
hw/e1000.c
... ... @@ -1104,10 +1104,10 @@ static void pci_e1000_init(PCIDevice *pci_dev)
1104 1104 d->mmio_index = cpu_register_io_memory(e1000_mmio_read,
1105 1105 e1000_mmio_write, d);
1106 1106  
1107   - pci_register_io_region((PCIDevice *)d, 0, PNPMMIO_SIZE,
  1107 + pci_register_bar((PCIDevice *)d, 0, PNPMMIO_SIZE,
1108 1108 PCI_ADDRESS_SPACE_MEM, e1000_mmio_map);
1109 1109  
1110   - pci_register_io_region((PCIDevice *)d, 1, IOPORT_SIZE,
  1110 + pci_register_bar((PCIDevice *)d, 1, IOPORT_SIZE,
1111 1111 PCI_ADDRESS_SPACE_IO, ioport_map);
1112 1112  
1113 1113 memmove(d->eeprom_data, e1000_eeprom_template,
... ...
hw/eepro100.c
... ... @@ -1752,12 +1752,12 @@ static void nic_init(PCIDevice *pci_dev, uint32_t device)
1752 1752 d->eepro100.mmio_index =
1753 1753 cpu_register_io_memory(pci_mmio_read, pci_mmio_write, s);
1754 1754  
1755   - pci_register_io_region(&d->dev, 0, PCI_MEM_SIZE,
  1755 + pci_register_bar(&d->dev, 0, PCI_MEM_SIZE,
1756 1756 PCI_ADDRESS_SPACE_MEM |
1757 1757 PCI_ADDRESS_SPACE_MEM_PREFETCH, pci_mmio_map);
1758   - pci_register_io_region(&d->dev, 1, PCI_IO_SIZE, PCI_ADDRESS_SPACE_IO,
  1758 + pci_register_bar(&d->dev, 1, PCI_IO_SIZE, PCI_ADDRESS_SPACE_IO,
1759 1759 pci_map);
1760   - pci_register_io_region(&d->dev, 2, PCI_FLASH_SIZE, PCI_ADDRESS_SPACE_MEM,
  1760 + pci_register_bar(&d->dev, 2, PCI_FLASH_SIZE, PCI_ADDRESS_SPACE_MEM,
1761 1761 pci_mmio_map);
1762 1762  
1763 1763 qdev_get_macaddr(&d->dev.qdev, s->macaddr);
... ...
hw/es1370.c
... ... @@ -1053,7 +1053,7 @@ int es1370_init (PCIBus *bus)
1053 1053 s = &d->es1370;
1054 1054 s->pci_dev = &d->dev;
1055 1055  
1056   - pci_register_io_region (&d->dev, 0, 256, PCI_ADDRESS_SPACE_IO, es1370_map);
  1056 + pci_register_bar (&d->dev, 0, 256, PCI_ADDRESS_SPACE_IO, es1370_map);
1057 1057 register_savevm ("es1370", 0, 2, es1370_save, es1370_load, s);
1058 1058 qemu_register_reset (es1370_on_reset, 0, s);
1059 1059  
... ...
hw/ide.c
... ... @@ -3309,15 +3309,15 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table,
3309 3309 pci_conf[0x51] |= 0x08; /* enable IDE1 */
3310 3310 }
3311 3311  
3312   - pci_register_io_region((PCIDevice *)d, 0, 0x8,
  3312 + pci_register_bar((PCIDevice *)d, 0, 0x8,
3313 3313 PCI_ADDRESS_SPACE_IO, ide_map);
3314   - pci_register_io_region((PCIDevice *)d, 1, 0x4,
  3314 + pci_register_bar((PCIDevice *)d, 1, 0x4,
3315 3315 PCI_ADDRESS_SPACE_IO, ide_map);
3316   - pci_register_io_region((PCIDevice *)d, 2, 0x8,
  3316 + pci_register_bar((PCIDevice *)d, 2, 0x8,
3317 3317 PCI_ADDRESS_SPACE_IO, ide_map);
3318   - pci_register_io_region((PCIDevice *)d, 3, 0x4,
  3318 + pci_register_bar((PCIDevice *)d, 3, 0x4,
3319 3319 PCI_ADDRESS_SPACE_IO, ide_map);
3320   - pci_register_io_region((PCIDevice *)d, 4, 0x10,
  3320 + pci_register_bar((PCIDevice *)d, 4, 0x10,
3321 3321 PCI_ADDRESS_SPACE_IO, bmdma_map);
3322 3322  
3323 3323 pci_conf[0x3d] = 0x01; // interrupt on pin 1
... ... @@ -3376,7 +3376,7 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
3376 3376 qemu_register_reset(piix3_reset, 0, d);
3377 3377 piix3_reset(d);
3378 3378  
3379   - pci_register_io_region((PCIDevice *)d, 4, 0x10,
  3379 + pci_register_bar((PCIDevice *)d, 4, 0x10,
3380 3380 PCI_ADDRESS_SPACE_IO, bmdma_map);
3381 3381  
3382 3382 ide_init2(&d->ide_if[0], hd_table[0], hd_table[1], pic[14]);
... ... @@ -3416,7 +3416,7 @@ void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
3416 3416 qemu_register_reset(piix3_reset, 0, d);
3417 3417 piix3_reset(d);
3418 3418  
3419   - pci_register_io_region((PCIDevice *)d, 4, 0x10,
  3419 + pci_register_bar((PCIDevice *)d, 4, 0x10,
3420 3420 PCI_ADDRESS_SPACE_IO, bmdma_map);
3421 3421  
3422 3422 ide_init2(&d->ide_if[0], hd_table[0], hd_table[1], pic[14]);
... ...
hw/lsi53c895a.c
... ... @@ -2003,11 +2003,11 @@ static void lsi_scsi_init(PCIDevice *dev)
2003 2003 s->ram_io_addr = cpu_register_io_memory(lsi_ram_readfn,
2004 2004 lsi_ram_writefn, s);
2005 2005  
2006   - pci_register_io_region((struct PCIDevice *)s, 0, 256,
  2006 + pci_register_bar((struct PCIDevice *)s, 0, 256,
2007 2007 PCI_ADDRESS_SPACE_IO, lsi_io_mapfunc);
2008   - pci_register_io_region((struct PCIDevice *)s, 1, 0x400,
  2008 + pci_register_bar((struct PCIDevice *)s, 1, 0x400,
2009 2009 PCI_ADDRESS_SPACE_MEM, lsi_mmio_mapfunc);
2010   - pci_register_io_region((struct PCIDevice *)s, 2, 0x2000,
  2010 + pci_register_bar((struct PCIDevice *)s, 2, 0x2000,
2011 2011 PCI_ADDRESS_SPACE_MEM, lsi_ram_mapfunc);
2012 2012 s->queue = qemu_malloc(sizeof(lsi_queue));
2013 2013 s->queue_len = 1;
... ...
hw/macio.c
... ... @@ -114,6 +114,6 @@ void macio_init (PCIBus *bus, int device_id, int is_oldworld, int pic_mem_index,
114 114  
115 115 d->config[0x3d] = 0x01; // interrupt on pin 1
116 116  
117   - pci_register_io_region(d, 0, 0x80000,
  117 + pci_register_bar(d, 0, 0x80000,
118 118 PCI_ADDRESS_SPACE_MEM, macio_map);
119 119 }
... ...
hw/ne2000.c
... ... @@ -816,7 +816,7 @@ static void pci_ne2000_init(PCIDevice *pci_dev)
816 816 pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
817 817 pci_conf[0x3d] = 1; // interrupt pin 0
818 818  
819   - pci_register_io_region(&d->dev, 0, 0x100,
  819 + pci_register_bar(&d->dev, 0, 0x100,
820 820 PCI_ADDRESS_SPACE_IO, ne2000_map);
821 821 s = &d->ne2000;
822 822 s->irq = d->dev.irq[0];
... ...
hw/openpic.c
... ... @@ -1212,7 +1212,7 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus,
1212 1212 pci_conf[0x3d] = 0x00; // no interrupt pin
1213 1213  
1214 1214 /* Register I/O spaces */
1215   - pci_register_io_region((PCIDevice *)opp, 0, 0x40000,
  1215 + pci_register_bar((PCIDevice *)opp, 0, 0x40000,
1216 1216 PCI_ADDRESS_SPACE_MEM, &openpic_map);
1217 1217 } else {
1218 1218 opp = qemu_mallocz(sizeof(openpic_t));
... ...
hw/pci.c
... ... @@ -322,7 +322,7 @@ int pci_unregister_device(PCIDevice *pci_dev)
322 322 return 0;
323 323 }
324 324  
325   -void pci_register_io_region(PCIDevice *pci_dev, int region_num,
  325 +void pci_register_bar(PCIDevice *pci_dev, int region_num,
326 326 uint32_t size, int type,
327 327 PCIMapIORegionFunc *map_func)
328 328 {
... ...
hw/pci.h
... ... @@ -166,7 +166,7 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name,
166 166 PCIConfigWriteFunc *config_write);
167 167 int pci_unregister_device(PCIDevice *pci_dev);
168 168  
169   -void pci_register_io_region(PCIDevice *pci_dev, int region_num,
  169 +void pci_register_bar(PCIDevice *pci_dev, int region_num,
170 170 uint32_t size, int type,
171 171 PCIMapIORegionFunc *map_func);
172 172  
... ...
hw/pcnet.c
... ... @@ -2050,10 +2050,10 @@ static void pci_pcnet_init(PCIDevice *pci_dev)
2050 2050 s->mmio_index =
2051 2051 cpu_register_io_memory(pcnet_mmio_read, pcnet_mmio_write, &d->state);
2052 2052  
2053   - pci_register_io_region((PCIDevice *)d, 0, PCNET_IOPORT_SIZE,
  2053 + pci_register_bar((PCIDevice *)d, 0, PCNET_IOPORT_SIZE,
2054 2054 PCI_ADDRESS_SPACE_IO, pcnet_ioport_map);
2055 2055  
2056   - pci_register_io_region((PCIDevice *)d, 1, PCNET_PNPMMIO_SIZE,
  2056 + pci_register_bar((PCIDevice *)d, 1, PCNET_PNPMMIO_SIZE,
2057 2057 PCI_ADDRESS_SPACE_MEM, pcnet_mmio_map);
2058 2058  
2059 2059 s->irq = pci_dev->irq[0];
... ...
hw/rtl8139.c
... ... @@ -3471,10 +3471,10 @@ static void pci_rtl8139_init(PCIDevice *dev)
3471 3471 s->rtl8139_mmio_io_addr =
3472 3472 cpu_register_io_memory(rtl8139_mmio_read, rtl8139_mmio_write, s);
3473 3473  
3474   - pci_register_io_region(&d->dev, 0, 0x100,
  3474 + pci_register_bar(&d->dev, 0, 0x100,
3475 3475 PCI_ADDRESS_SPACE_IO, rtl8139_ioport_map);
3476 3476  
3477   - pci_register_io_region(&d->dev, 1, 0x100,
  3477 + pci_register_bar(&d->dev, 1, 0x100,
3478 3478 PCI_ADDRESS_SPACE_MEM, rtl8139_mmio_map);
3479 3479  
3480 3480 s->pci_dev = (PCIDevice *)d;
... ...
hw/sun4u.c
... ... @@ -320,9 +320,9 @@ pci_ebus_init(PCIBus *bus, int devfn)
320 320 s->config[0x0D] = 0x0a; // latency_timer
321 321 s->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
322 322  
323   - pci_register_io_region(s, 0, 0x1000000, PCI_ADDRESS_SPACE_MEM,
  323 + pci_register_bar(s, 0, 0x1000000, PCI_ADDRESS_SPACE_MEM,
324 324 ebus_mmio_mapfunc);
325   - pci_register_io_region(s, 1, 0x800000, PCI_ADDRESS_SPACE_MEM,
  325 + pci_register_bar(s, 1, 0x800000, PCI_ADDRESS_SPACE_MEM,
326 326 ebus_mmio_mapfunc);
327 327 }
328 328  
... ...
hw/usb-ohci.c
... ... @@ -1732,7 +1732,7 @@ void usb_ohci_init_pci(struct PCIBus *bus, int num_ports, int devfn)
1732 1732 usb_ohci_init(&ohci->state, num_ports, devfn, ohci->pci_dev.irq[0],
1733 1733 OHCI_TYPE_PCI, ohci->pci_dev.name, 0);
1734 1734  
1735   - pci_register_io_region((struct PCIDevice *)ohci, 0, 256,
  1735 + pci_register_bar((struct PCIDevice *)ohci, 0, 256,
1736 1736 PCI_ADDRESS_SPACE_MEM, ohci_mapfunc);
1737 1737 }
1738 1738  
... ...
hw/usb-uhci.c
... ... @@ -1097,7 +1097,7 @@ void usb_uhci_piix3_init(PCIBus *bus, int devfn)
1097 1097  
1098 1098 /* Use region 4 for consistency with real hardware. BSD guests seem
1099 1099 to rely on this. */
1100   - pci_register_io_region(&s->dev, 4, 0x20,
  1100 + pci_register_bar(&s->dev, 4, 0x20,
1101 1101 PCI_ADDRESS_SPACE_IO, uhci_map);
1102 1102  
1103 1103 register_savevm("uhci", 0, 1, uhci_save, uhci_load, s);
... ... @@ -1131,7 +1131,7 @@ void usb_uhci_piix4_init(PCIBus *bus, int devfn)
1131 1131  
1132 1132 /* Use region 4 for consistency with real hardware. BSD guests seem
1133 1133 to rely on this. */
1134   - pci_register_io_region(&s->dev, 4, 0x20,
  1134 + pci_register_bar(&s->dev, 4, 0x20,
1135 1135 PCI_ADDRESS_SPACE_IO, uhci_map);
1136 1136  
1137 1137 register_savevm("uhci", 0, 1, uhci_save, uhci_load, s);
... ...
hw/vga.c
... ... @@ -2510,7 +2510,7 @@ int pci_vga_init(PCIBus *bus,
2510 2510 pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
2511 2511  
2512 2512 /* XXX: VGA_RAM_SIZE must be a power of two */
2513   - pci_register_io_region(&d->dev, 0, VGA_RAM_SIZE,
  2513 + pci_register_bar(&d->dev, 0, VGA_RAM_SIZE,
2514 2514 PCI_ADDRESS_SPACE_MEM_PREFETCH, vga_map);
2515 2515 if (vga_bios_size != 0) {
2516 2516 unsigned int bios_total_size;
... ... @@ -2520,7 +2520,7 @@ int pci_vga_init(PCIBus *bus,
2520 2520 bios_total_size = 1;
2521 2521 while (bios_total_size < vga_bios_size)
2522 2522 bios_total_size <<= 1;
2523   - pci_register_io_region(&d->dev, PCI_ROM_SLOT, bios_total_size,
  2523 + pci_register_bar(&d->dev, PCI_ROM_SLOT, bios_total_size,
2524 2524 PCI_ADDRESS_SPACE_MEM_PREFETCH, vga_map);
2525 2525 }
2526 2526 return 0;
... ...
hw/virtio-pci.c
... ... @@ -276,7 +276,7 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,
276 276 if (size & (size-1))
277 277 size = 1 << qemu_fls(size);
278 278  
279   - pci_register_io_region(&proxy->pci_dev, 0, size, PCI_ADDRESS_SPACE_IO,
  279 + pci_register_bar(&proxy->pci_dev, 0, size, PCI_ADDRESS_SPACE_IO,
280 280 virtio_map);
281 281  
282 282 virtio_bind_device(vdev, &virtio_pci_bindings, proxy);
... ...
hw/vmware_vga.c
... ... @@ -1231,9 +1231,9 @@ void pci_vmsvga_init(PCIBus *bus)
1231 1231 s->card.config[0x2f] = SVGA_PCI_DEVICE_ID >> 8;
1232 1232 s->card.config[0x3c] = 0xff; /* End */
1233 1233  
1234   - pci_register_io_region(&s->card, 0, 0x10,
  1234 + pci_register_bar(&s->card, 0, 0x10,
1235 1235 PCI_ADDRESS_SPACE_IO, pci_vmsvga_map_ioport);
1236   - pci_register_io_region(&s->card, 1, VGA_RAM_SIZE,
  1236 + pci_register_bar(&s->card, 1, VGA_RAM_SIZE,
1237 1237 PCI_ADDRESS_SPACE_MEM_PREFETCH, pci_vmsvga_map_mem);
1238 1238  
1239 1239 vmsvga_init(&s->chip, VGA_RAM_SIZE);
... ...
hw/wdt_i6300esb.c
... ... @@ -451,7 +451,7 @@ static void i6300esb_pc_init(PCIBus *pci_bus)
451 451 pci_config_set_class(pci_conf, PCI_CLASS_SYSTEM_OTHER);
452 452 pci_conf[0x0e] = 0x00;
453 453  
454   - pci_register_io_region(&d->dev, 0, 0x10,
  454 + pci_register_bar(&d->dev, 0, 0x10,
455 455 PCI_ADDRESS_SPACE_MEM, i6300esb_map);
456 456  
457 457 register_savevm("i6300esb_wdt", -1, sizeof(I6300State),
... ...