qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 14/15] usb-uhci: convert to pci_bar_map
@ 2010-07-12 18:42 Blue Swirl
  0 siblings, 0 replies; only message in thread
From: Blue Swirl @ 2010-07-12 18:42 UTC (permalink / raw)
  To: qemu-devel, Anthony Liguori, Michael S. Tsirkin

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(-)

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.7.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-07-12 18:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-12 18:42 [Qemu-devel] [PATCH 14/15] usb-uhci: convert to pci_bar_map Blue Swirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).