From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <andreas.faerber@web.de>,
"Gerd Hoffmann" <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 03/10] uhci: stop using portio lists
Date: Fri, 4 Jan 2013 22:29:38 +0100 [thread overview]
Message-ID: <1357334986-13941-4-git-send-email-hpoussin@reactos.org> (raw)
In-Reply-To: <1357334986-13941-1-git-send-email-hpoussin@reactos.org>
From: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
---
hw/usb/hcd-uhci.c | 106 +++++++++++++++--------------------------------------
trace-events | 2 -
2 files changed, 30 insertions(+), 78 deletions(-)
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 2af754b..528d23f 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -455,40 +455,11 @@ static const VMStateDescription vmstate_uhci = {
}
};
-static void uhci_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
+static void uhci_port_write(void *opaque, hwaddr addr,
+ uint64_t val, unsigned size)
{
UHCIState *s = opaque;
- addr &= 0x1f;
- switch(addr) {
- case 0x0c:
- s->sof_timing = val;
- break;
- }
-}
-
-static uint32_t uhci_ioport_readb(void *opaque, uint32_t addr)
-{
- UHCIState *s = opaque;
- uint32_t val;
-
- addr &= 0x1f;
- switch(addr) {
- case 0x0c:
- val = s->sof_timing;
- break;
- default:
- val = 0xff;
- break;
- }
- return val;
-}
-
-static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
-{
- UHCIState *s = opaque;
-
- addr &= 0x1f;
trace_usb_uhci_mmio_writew(addr, val);
switch(addr) {
@@ -537,6 +508,17 @@ static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
if (s->status & UHCI_STS_HCHALTED)
s->frnum = val & 0x7ff;
break;
+ case 0x08:
+ s->fl_base_addr &= 0xffff0000;
+ s->fl_base_addr |= val & ~0xfff;
+ break;
+ case 0x0a:
+ s->fl_base_addr &= 0x0000ffff;
+ s->fl_base_addr |= (val << 16);
+ break;
+ case 0x0c:
+ s->sof_timing = val & 0xff;
+ break;
case 0x10 ... 0x1f:
{
UHCIPort *port;
@@ -568,12 +550,11 @@ static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
}
}
-static uint32_t uhci_ioport_readw(void *opaque, uint32_t addr)
+static uint64_t uhci_port_read(void *opaque, hwaddr addr, unsigned size)
{
UHCIState *s = opaque;
uint32_t val;
- addr &= 0x1f;
switch(addr) {
case 0x00:
val = s->cmd;
@@ -587,6 +568,15 @@ static uint32_t uhci_ioport_readw(void *opaque, uint32_t addr)
case 0x06:
val = s->frnum;
break;
+ case 0x08:
+ val = s->fl_base_addr & 0xffff;
+ break;
+ case 0x0a:
+ val = (s->fl_base_addr >> 16) & 0xffff;
+ break;
+ case 0x0c:
+ val = s->sof_timing;
+ break;
case 0x10 ... 0x1f:
{
UHCIPort *port;
@@ -609,38 +599,6 @@ static uint32_t uhci_ioport_readw(void *opaque, uint32_t addr)
return val;
}
-static void uhci_ioport_writel(void *opaque, uint32_t addr, uint32_t val)
-{
- UHCIState *s = opaque;
-
- addr &= 0x1f;
- trace_usb_uhci_mmio_writel(addr, val);
-
- switch(addr) {
- case 0x08:
- s->fl_base_addr = val & ~0xfff;
- break;
- }
-}
-
-static uint32_t uhci_ioport_readl(void *opaque, uint32_t addr)
-{
- UHCIState *s = opaque;
- uint32_t val;
-
- addr &= 0x1f;
- switch(addr) {
- case 0x08:
- val = s->fl_base_addr;
- break;
- default:
- val = 0xffffffff;
- break;
- }
- trace_usb_uhci_mmio_readl(addr, val);
- return val;
-}
-
/* signal resume if controller suspended */
static void uhci_resume (void *opaque)
{
@@ -1213,18 +1171,14 @@ static void uhci_frame_timer(void *opaque)
qemu_mod_timer(s->frame_timer, s->expire_time);
}
-static const MemoryRegionPortio uhci_portio[] = {
- { 0, 32, 2, .write = uhci_ioport_writew, },
- { 0, 32, 2, .read = uhci_ioport_readw, },
- { 0, 32, 4, .write = uhci_ioport_writel, },
- { 0, 32, 4, .read = uhci_ioport_readl, },
- { 0, 32, 1, .write = uhci_ioport_writeb, },
- { 0, 32, 1, .read = uhci_ioport_readb, },
- PORTIO_END_OF_LIST()
-};
-
static const MemoryRegionOps uhci_ioport_ops = {
- .old_portio = uhci_portio,
+ .read = uhci_port_read,
+ .write = uhci_port_write,
+ .valid.min_access_size = 1,
+ .valid.max_access_size = 4,
+ .impl.min_access_size = 2,
+ .impl.max_access_size = 2,
+ .endianness = DEVICE_LITTLE_ENDIAN,
};
static USBPortOps uhci_port_ops = {
diff --git a/trace-events b/trace-events
index 4023a4c..2183183 100644
--- a/trace-events
+++ b/trace-events
@@ -307,8 +307,6 @@ usb_uhci_frame_loop_stop_idle(void) ""
usb_uhci_frame_loop_continue(void) ""
usb_uhci_mmio_readw(uint32_t addr, uint32_t val) "addr 0x%04x, ret 0x%04x"
usb_uhci_mmio_writew(uint32_t addr, uint32_t val) "addr 0x%04x, val 0x%04x"
-usb_uhci_mmio_readl(uint32_t addr, uint32_t val) "addr 0x%04x, ret 0x%08x"
-usb_uhci_mmio_writel(uint32_t addr, uint32_t val) "addr 0x%04x, val 0x%08x"
usb_uhci_queue_add(uint32_t token) "token 0x%x"
usb_uhci_queue_del(uint32_t token, const char *reason) "token 0x%x: %s"
usb_uhci_packet_add(uint32_t token, uint32_t addr) "token 0x%x, td 0x%x"
--
1.7.10.4
next prev parent reply other threads:[~2013-01-04 21:29 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-04 21:29 [Qemu-devel] [PATCH 00/10] memory: remove old_portio usage Hervé Poussineau
2013-01-04 21:29 ` [Qemu-devel] [PATCH 01/10] ppc/newworld: add ISA bus, required by VGA card Hervé Poussineau
2013-01-12 16:03 ` Andreas Färber
2013-01-04 21:29 ` [Qemu-devel] [PATCH 02/10] ppc/oldworld: " Hervé Poussineau
2013-01-04 21:29 ` Hervé Poussineau [this message]
2013-01-10 17:18 ` [Qemu-devel] [PATCH 03/10] uhci: stop using portio lists Andreas Färber
2013-01-11 7:38 ` Gerd Hoffmann
2013-01-04 21:29 ` [Qemu-devel] [PATCH 04/10] sun4u: create VGA card after ISA bus Hervé Poussineau
2013-01-10 17:24 ` Andreas Färber
2013-01-10 19:30 ` Hervé Poussineau
2013-01-12 11:42 ` Blue Swirl
2013-01-12 15:58 ` Andreas Färber
2013-01-04 21:29 ` [Qemu-devel] [PATCH 05/10] xen_platform: do not use old_portio-style callbacks Hervé Poussineau
2013-01-12 16:06 ` Andreas Färber
2013-01-15 17:09 ` Andreas Färber
2013-01-15 17:43 ` Stefano Stabellini
2013-01-04 21:29 ` [Qemu-devel] [PATCH 06/10] acpi-piix4: " Hervé Poussineau
2013-01-12 16:20 ` Andreas Färber
2013-01-12 18:02 ` Andreas Färber
2013-01-12 19:20 ` Hervé Poussineau
2013-01-04 21:29 ` [Qemu-devel] [PATCH 07/10] vga/qxl: do not use portio_list_init/portio_list_add Hervé Poussineau
2013-01-04 21:29 ` [Qemu-devel] [PATCH 08/10] isa: use memory regions instead of portio_list_* functions Hervé Poussineau
2013-01-12 19:21 ` Andreas Färber
2013-01-04 21:29 ` [Qemu-devel] [PATCH 09/10] ioport: remove now useless " Hervé Poussineau
2013-01-04 21:29 ` [Qemu-devel] [PATCH 10/10] memory: remove old_portio-style callbacks support Hervé Poussineau
2013-01-10 17:45 ` Andreas Färber
2013-01-10 19:33 ` Hervé Poussineau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357334986-13941-4-git-send-email-hpoussin@reactos.org \
--to=hpoussin@reactos.org \
--cc=andreas.faerber@web.de \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).