[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] Rename pci_register_io_region() to pci_register_bar
From: |
Avi Kivity |
Subject: |
[Qemu-devel] [PATCH] Rename pci_register_io_region() to pci_register_bar() |
Date: |
Sun, 31 May 2009 17:20:55 +0300 |
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 <address@hidden>
---
hw/ac97.c | 4 ++--
hw/cirrus_vga.c | 4 ++--
hw/e1000.c | 4 ++--
hw/eepro100.c | 6 +++---
hw/es1370.c | 2 +-
hw/ide.c | 14 +++++++-------
hw/lsi53c895a.c | 6 +++---
hw/macio.c | 2 +-
hw/ne2000.c | 2 +-
hw/openpic.c | 2 +-
hw/pci.c | 2 +-
hw/pci.h | 2 +-
hw/pcnet.c | 4 ++--
hw/rtl8139.c | 4 ++--
hw/sun4u.c | 4 ++--
hw/usb-ohci.c | 2 +-
hw/usb-uhci.c | 4 ++--
hw/vga.c | 4 ++--
hw/virtio-pci.c | 2 +-
hw/vmware_vga.c | 4 ++--
hw/wdt_i6300esb.c | 2 +-
21 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/hw/ac97.c b/hw/ac97.c
index 288f428..a70bb90 100644
--- a/hw/ac97.c
+++ b/hw/ac97.c
@@ -1366,8 +1366,8 @@ int ac97_init (PCIBus *bus)
c[0x3c] = 0x00; /* intr_ln interrupt line rw */
c[0x3d] = 0x01; /* intr_pn interrupt pin ro */
- pci_register_io_region (&d->dev, 0, 256 * 4, PCI_ADDRESS_SPACE_IO,
ac97_map);
- pci_register_io_region (&d->dev, 1, 64 * 4, PCI_ADDRESS_SPACE_IO,
ac97_map);
+ pci_register_bar (&d->dev, 0, 256 * 4, PCI_ADDRESS_SPACE_IO, ac97_map);
+ pci_register_bar (&d->dev, 1, 64 * 4, PCI_ADDRESS_SPACE_IO, ac97_map);
register_savevm ("ac97", 0, 2, ac97_save, ac97_load, s);
qemu_register_reset (ac97_on_reset, 0, s);
AUD_register_card ("ac97", &s->card);
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index 5591149..0a12782 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -3336,10 +3336,10 @@ void pci_cirrus_vga_init(PCIBus *bus)
/* memory #0 LFB */
/* memory #1 memory-mapped I/O */
/* XXX: s->vga.vram_size must be a power of two */
- pci_register_io_region((PCIDevice *)d, 0, 0x2000000,
+ pci_register_bar((PCIDevice *)d, 0, 0x2000000,
PCI_ADDRESS_SPACE_MEM_PREFETCH, cirrus_pci_lfb_map);
if (device_id == CIRRUS_ID_CLGD5446) {
- pci_register_io_region((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE,
+ pci_register_bar((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE,
PCI_ADDRESS_SPACE_MEM, cirrus_pci_mmio_map);
}
/* XXX: ROM BIOS */
diff --git a/hw/e1000.c b/hw/e1000.c
index b34cfd5..624412b 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1075,10 +1075,10 @@ static void pci_e1000_init(PCIDevice *pci_dev)
d->mmio_index = cpu_register_io_memory(e1000_mmio_read,
e1000_mmio_write, d);
- pci_register_io_region((PCIDevice *)d, 0, PNPMMIO_SIZE,
+ pci_register_bar((PCIDevice *)d, 0, PNPMMIO_SIZE,
PCI_ADDRESS_SPACE_MEM, e1000_mmio_map);
- pci_register_io_region((PCIDevice *)d, 1, IOPORT_SIZE,
+ pci_register_bar((PCIDevice *)d, 1, IOPORT_SIZE,
PCI_ADDRESS_SPACE_IO, ioport_map);
memmove(d->eeprom_data, e1000_eeprom_template,
diff --git a/hw/eepro100.c b/hw/eepro100.c
index 2e6d586..69885e9 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -1751,12 +1751,12 @@ static void nic_init(PCIDevice *pci_dev, uint32_t
device)
d->eepro100.mmio_index =
cpu_register_io_memory(pci_mmio_read, pci_mmio_write, s);
- pci_register_io_region(&d->dev, 0, PCI_MEM_SIZE,
+ pci_register_bar(&d->dev, 0, PCI_MEM_SIZE,
PCI_ADDRESS_SPACE_MEM |
PCI_ADDRESS_SPACE_MEM_PREFETCH, pci_mmio_map);
- pci_register_io_region(&d->dev, 1, PCI_IO_SIZE, PCI_ADDRESS_SPACE_IO,
+ pci_register_bar(&d->dev, 1, PCI_IO_SIZE, PCI_ADDRESS_SPACE_IO,
pci_map);
- pci_register_io_region(&d->dev, 2, PCI_FLASH_SIZE, PCI_ADDRESS_SPACE_MEM,
+ pci_register_bar(&d->dev, 2, PCI_FLASH_SIZE, PCI_ADDRESS_SPACE_MEM,
pci_mmio_map);
qdev_get_macaddr(&d->dev.qdev, s->macaddr);
diff --git a/hw/es1370.c b/hw/es1370.c
index 12f2ace..9a88baf 100644
--- a/hw/es1370.c
+++ b/hw/es1370.c
@@ -1053,7 +1053,7 @@ int es1370_init (PCIBus *bus)
s = &d->es1370;
s->pci_dev = &d->dev;
- pci_register_io_region (&d->dev, 0, 256, PCI_ADDRESS_SPACE_IO, es1370_map);
+ pci_register_bar (&d->dev, 0, 256, PCI_ADDRESS_SPACE_IO, es1370_map);
register_savevm ("es1370", 0, 2, es1370_save, es1370_load, s);
qemu_register_reset (es1370_on_reset, 0, s);
diff --git a/hw/ide.c b/hw/ide.c
index dd76aa1..cc37e78 100644
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -3309,15 +3309,15 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState
**hd_table,
pci_conf[0x51] |= 0x08; /* enable IDE1 */
}
- pci_register_io_region((PCIDevice *)d, 0, 0x8,
+ pci_register_bar((PCIDevice *)d, 0, 0x8,
PCI_ADDRESS_SPACE_IO, ide_map);
- pci_register_io_region((PCIDevice *)d, 1, 0x4,
+ pci_register_bar((PCIDevice *)d, 1, 0x4,
PCI_ADDRESS_SPACE_IO, ide_map);
- pci_register_io_region((PCIDevice *)d, 2, 0x8,
+ pci_register_bar((PCIDevice *)d, 2, 0x8,
PCI_ADDRESS_SPACE_IO, ide_map);
- pci_register_io_region((PCIDevice *)d, 3, 0x4,
+ pci_register_bar((PCIDevice *)d, 3, 0x4,
PCI_ADDRESS_SPACE_IO, ide_map);
- pci_register_io_region((PCIDevice *)d, 4, 0x10,
+ pci_register_bar((PCIDevice *)d, 4, 0x10,
PCI_ADDRESS_SPACE_IO, bmdma_map);
pci_conf[0x3d] = 0x01; // interrupt on pin 1
@@ -3376,7 +3376,7 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState
**hd_table, int devfn,
qemu_register_reset(piix3_reset, 0, d);
piix3_reset(d);
- pci_register_io_region((PCIDevice *)d, 4, 0x10,
+ pci_register_bar((PCIDevice *)d, 4, 0x10,
PCI_ADDRESS_SPACE_IO, bmdma_map);
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,
qemu_register_reset(piix3_reset, 0, d);
piix3_reset(d);
- pci_register_io_region((PCIDevice *)d, 4, 0x10,
+ pci_register_bar((PCIDevice *)d, 4, 0x10,
PCI_ADDRESS_SPACE_IO, bmdma_map);
ide_init2(&d->ide_if[0], hd_table[0], hd_table[1], pic[14]);
diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 5bae70a..651b32b 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -2003,11 +2003,11 @@ static void lsi_scsi_init(PCIDevice *dev)
s->ram_io_addr = cpu_register_io_memory(lsi_ram_readfn,
lsi_ram_writefn, s);
- pci_register_io_region((struct PCIDevice *)s, 0, 256,
+ pci_register_bar((struct PCIDevice *)s, 0, 256,
PCI_ADDRESS_SPACE_IO, lsi_io_mapfunc);
- pci_register_io_region((struct PCIDevice *)s, 1, 0x400,
+ pci_register_bar((struct PCIDevice *)s, 1, 0x400,
PCI_ADDRESS_SPACE_MEM, lsi_mmio_mapfunc);
- pci_register_io_region((struct PCIDevice *)s, 2, 0x2000,
+ pci_register_bar((struct PCIDevice *)s, 2, 0x2000,
PCI_ADDRESS_SPACE_MEM, lsi_ram_mapfunc);
s->queue = qemu_malloc(sizeof(lsi_queue));
s->queue_len = 1;
diff --git a/hw/macio.c b/hw/macio.c
index 28dbaa7..8cfadfc 100644
--- a/hw/macio.c
+++ b/hw/macio.c
@@ -114,6 +114,6 @@ 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_io_region(d, 0, 0x80000,
+ pci_register_bar(d, 0, 0x80000,
PCI_ADDRESS_SPACE_MEM, macio_map);
}
diff --git a/hw/ne2000.c b/hw/ne2000.c
index 2af0d10..2bb4196 100644
--- a/hw/ne2000.c
+++ b/hw/ne2000.c
@@ -813,7 +813,7 @@ static void pci_ne2000_init(PCIDevice *pci_dev)
pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
pci_conf[0x3d] = 1; // interrupt pin 0
- pci_register_io_region(&d->dev, 0, 0x100,
+ pci_register_bar(&d->dev, 0, 0x100,
PCI_ADDRESS_SPACE_IO, ne2000_map);
s = &d->ne2000;
s->irq = d->dev.irq[0];
diff --git a/hw/openpic.c b/hw/openpic.c
index 269b965..9742d54 100644
--- a/hw/openpic.c
+++ b/hw/openpic.c
@@ -1212,7 +1212,7 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int
nb_cpus,
pci_conf[0x3d] = 0x00; // no interrupt pin
/* Register I/O spaces */
- pci_register_io_region((PCIDevice *)opp, 0, 0x40000,
+ pci_register_bar((PCIDevice *)opp, 0, 0x40000,
PCI_ADDRESS_SPACE_MEM, &openpic_map);
} else {
opp = qemu_mallocz(sizeof(openpic_t));
diff --git a/hw/pci.c b/hw/pci.c
index 0ab5b94..1f8a149 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -328,7 +328,7 @@ int pci_unregister_device(PCIDevice *pci_dev)
return 0;
}
-void pci_register_io_region(PCIDevice *pci_dev, int region_num,
+void pci_register_bar(PCIDevice *pci_dev, int region_num,
uint32_t size, int type,
PCIMapIORegionFunc *map_func)
{
diff --git a/hw/pci.h b/hw/pci.h
index 0405837..bd46f1a 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -170,7 +170,7 @@ PCIDevice *pci_register_device(PCIBus *bus, const char
*name,
PCIConfigWriteFunc *config_write);
int pci_unregister_device(PCIDevice *pci_dev);
-void pci_register_io_region(PCIDevice *pci_dev, int region_num,
+void pci_register_bar(PCIDevice *pci_dev, int region_num,
uint32_t size, int type,
PCIMapIORegionFunc *map_func);
diff --git a/hw/pcnet.c b/hw/pcnet.c
index 538aebc..ade1481 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -2047,10 +2047,10 @@ static void pci_pcnet_init(PCIDevice *pci_dev)
s->mmio_index =
cpu_register_io_memory(pcnet_mmio_read, pcnet_mmio_write, &d->state);
- pci_register_io_region((PCIDevice *)d, 0, PCNET_IOPORT_SIZE,
+ pci_register_bar((PCIDevice *)d, 0, PCNET_IOPORT_SIZE,
PCI_ADDRESS_SPACE_IO, pcnet_ioport_map);
- pci_register_io_region((PCIDevice *)d, 1, PCNET_PNPMMIO_SIZE,
+ pci_register_bar((PCIDevice *)d, 1, PCNET_PNPMMIO_SIZE,
PCI_ADDRESS_SPACE_MEM, pcnet_mmio_map);
s->irq = pci_dev->irq[0];
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index b97894f..3f4e619 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -3465,10 +3465,10 @@ static void pci_rtl8139_init(PCIDevice *dev)
s->rtl8139_mmio_io_addr =
cpu_register_io_memory(rtl8139_mmio_read, rtl8139_mmio_write, s);
- pci_register_io_region(&d->dev, 0, 0x100,
+ pci_register_bar(&d->dev, 0, 0x100,
PCI_ADDRESS_SPACE_IO, rtl8139_ioport_map);
- pci_register_io_region(&d->dev, 1, 0x100,
+ pci_register_bar(&d->dev, 1, 0x100,
PCI_ADDRESS_SPACE_MEM, rtl8139_mmio_map);
s->pci_dev = (PCIDevice *)d;
diff --git a/hw/sun4u.c b/hw/sun4u.c
index f5bb732..2e41dfd 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -320,9 +320,9 @@ pci_ebus_init(PCIBus *bus, int devfn)
s->config[0x0D] = 0x0a; // latency_timer
s->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
- pci_register_io_region(s, 0, 0x1000000, PCI_ADDRESS_SPACE_MEM,
+ pci_register_bar(s, 0, 0x1000000, PCI_ADDRESS_SPACE_MEM,
ebus_mmio_mapfunc);
- pci_register_io_region(s, 1, 0x800000, PCI_ADDRESS_SPACE_MEM,
+ pci_register_bar(s, 1, 0x800000, PCI_ADDRESS_SPACE_MEM,
ebus_mmio_mapfunc);
}
diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index b921875..c575480 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -1732,7 +1732,7 @@ void usb_ohci_init_pci(struct PCIBus *bus, int num_ports,
int devfn)
usb_ohci_init(&ohci->state, num_ports, devfn, ohci->pci_dev.irq[0],
OHCI_TYPE_PCI, ohci->pci_dev.name, 0);
- pci_register_io_region((struct PCIDevice *)ohci, 0, 256,
+ pci_register_bar((struct PCIDevice *)ohci, 0, 256,
PCI_ADDRESS_SPACE_MEM, ohci_mapfunc);
}
diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index 689d40a..00e740b 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -1097,7 +1097,7 @@ void usb_uhci_piix3_init(PCIBus *bus, int devfn)
/* Use region 4 for consistency with real hardware. BSD guests seem
to rely on this. */
- pci_register_io_region(&s->dev, 4, 0x20,
+ pci_register_bar(&s->dev, 4, 0x20,
PCI_ADDRESS_SPACE_IO, uhci_map);
register_savevm("uhci", 0, 1, uhci_save, uhci_load, s);
@@ -1131,7 +1131,7 @@ void usb_uhci_piix4_init(PCIBus *bus, int devfn)
/* Use region 4 for consistency with real hardware. BSD guests seem
to rely on this. */
- pci_register_io_region(&s->dev, 4, 0x20,
+ pci_register_bar(&s->dev, 4, 0x20,
PCI_ADDRESS_SPACE_IO, uhci_map);
register_savevm("uhci", 0, 1, uhci_save, uhci_load, s);
diff --git a/hw/vga.c b/hw/vga.c
index c07c4da..97bf1b6 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -2510,7 +2510,7 @@ int pci_vga_init(PCIBus *bus,
pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
/* XXX: VGA_RAM_SIZE must be a power of two */
- pci_register_io_region(&d->dev, 0, VGA_RAM_SIZE,
+ pci_register_bar(&d->dev, 0, VGA_RAM_SIZE,
PCI_ADDRESS_SPACE_MEM_PREFETCH, vga_map);
if (vga_bios_size != 0) {
unsigned int bios_total_size;
@@ -2520,7 +2520,7 @@ int pci_vga_init(PCIBus *bus,
bios_total_size = 1;
while (bios_total_size < vga_bios_size)
bios_total_size <<= 1;
- pci_register_io_region(&d->dev, PCI_ROM_SLOT, bios_total_size,
+ pci_register_bar(&d->dev, PCI_ROM_SLOT, bios_total_size,
PCI_ADDRESS_SPACE_MEM_PREFETCH, vga_map);
}
return 0;
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index c072423..24fe837 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -276,7 +276,7 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy,
VirtIODevice *vdev,
if (size & (size-1))
size = 1 << qemu_fls(size);
- pci_register_io_region(&proxy->pci_dev, 0, size, PCI_ADDRESS_SPACE_IO,
+ pci_register_bar(&proxy->pci_dev, 0, size, PCI_ADDRESS_SPACE_IO,
virtio_map);
virtio_bind_device(vdev, &virtio_pci_bindings, proxy);
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index 5c2e524..9c354dd 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -1231,9 +1231,9 @@ void pci_vmsvga_init(PCIBus *bus)
s->card.config[0x2f] = SVGA_PCI_DEVICE_ID >> 8;
s->card.config[0x3c] = 0xff; /* End */
- pci_register_io_region(&s->card, 0, 0x10,
+ pci_register_bar(&s->card, 0, 0x10,
PCI_ADDRESS_SPACE_IO, pci_vmsvga_map_ioport);
- pci_register_io_region(&s->card, 1, VGA_RAM_SIZE,
+ pci_register_bar(&s->card, 1, VGA_RAM_SIZE,
PCI_ADDRESS_SPACE_MEM_PREFETCH, pci_vmsvga_map_mem);
vmsvga_init(&s->chip, VGA_RAM_SIZE);
diff --git a/hw/wdt_i6300esb.c b/hw/wdt_i6300esb.c
index 986a89f..42642c7 100644
--- a/hw/wdt_i6300esb.c
+++ b/hw/wdt_i6300esb.c
@@ -451,7 +451,7 @@ static void i6300esb_pc_init(PCIBus *pci_bus)
pci_config_set_class(pci_conf, PCI_CLASS_SYSTEM_OTHER);
pci_conf[0x0e] = 0x00;
- pci_register_io_region(&d->dev, 0, 0x10,
+ pci_register_bar(&d->dev, 0, 0x10,
PCI_ADDRESS_SPACE_MEM, i6300esb_map);
register_savevm("i6300esb_wdt", -1, sizeof(I6300State),
--
1.6.0.6
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH] Rename pci_register_io_region() to pci_register_bar(),
Avi Kivity <=