[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/34] usb-uhci: convert to pci_bar_map
From: |
Blue Swirl |
Subject: |
[Qemu-devel] [PATCH 14/34] usb-uhci: convert to pci_bar_map |
Date: |
Thu, 22 Jul 2010 21:57:55 +0000 |
Use pci_bar_map() instead of a mapping function.
Signed-off-by: Blue Swirl <address@hidden>
---
hw/usb-uhci.c | 31 +++++++++++++++----------------
1 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index 1d83400..2e1f5ee 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -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;
}
--
1.6.2.4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH 14/34] usb-uhci: convert to pci_bar_map,
Blue Swirl <=