@@ -1088,23 +1088,22 @@ static void uhci_frame_timer(void *opaque)
qemu_mod_timer(s->frame_timer, s->expire_time);
}
-static void uhci_map(PCIDevice *pci_dev, int region_num,
- pcibus_t addr, pcibus_t size, int type)
-{
- UHCIState *s = (UHCIState *)pci_dev;
-
- register_ioport_write(addr, 32, 2, uhci_ioport_writew, s);
- register_ioport_read(addr, 32, 2, uhci_ioport_readw, s);
- register_ioport_write(addr, 32, 4, uhci_ioport_writel, s);
- register_ioport_read(addr, 32, 4, uhci_ioport_readl, s);
- register_ioport_write(addr, 32, 1, uhci_ioport_writeb, s);
- register_ioport_read(addr, 32, 1, uhci_ioport_readb, s);
-}
+static IOPortWriteFunc * const uhci_io_writes[] = {
+ uhci_ioport_writeb,
+ uhci_ioport_writew,
+ uhci_ioport_writel,
+};
+
+static IOPortReadFunc * const uhci_io_reads[] = {
+ uhci_ioport_readb,
+ uhci_ioport_readw,
+ uhci_ioport_readl,
+};
static int usb_uhci_common_initfn(UHCIState *s)
{
uint8_t *pci_conf = s->dev.config;
- int i;
+ int i, io_index;
pci_conf[PCI_REVISION_ID] = 0x01; // revision number
pci_conf[PCI_CLASS_PROG] = 0x00;
@@ -1126,9 +1125,9 @@ 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, uhci_map);
-
+ pci_register_bar(&s->dev, 4, 0x20, PCI_BASE_ADDRESS_SPACE_IO, 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;
}
Use pci_bar_map() instead of a mapping function. Signed-off-by: Blue Swirl <blauwirbel@gmail.com> --- hw/usb-uhci.c | 31 +++++++++++++++---------------- 1 files changed, 15 insertions(+), 16 deletions(-)