aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-ehci.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2011-07-12 15:22:25 +0200
committerGerd Hoffmann <kraxel@redhat.com>2011-08-04 15:51:22 +0200
commit4f4321c11ff6e98583846bfd6f0e81954924b003 (patch)
tree5b4c7f185539ed6a91b1c63c0841de7cff6a3ac5 /hw/usb-ehci.c
parentd35bf9ade5293171f13bc5fd1460920a258e3e39 (diff)
usb: use iovecs in USBPacket
Zap data pointer from USBPacket, add a QEMUIOVector instead. Add a bunch of helper functions to manage USBPacket data. Switch over users to the new interface. Note that USBPacket->len was used for two purposes: First to pass in the buffer size and second to return the number of transfered bytes or the status code on async transfers. There is a new result variable for the latter. A new status code was added to catch uninitialized result. Nobody creates iovecs with more than one element (yet). Some users are (temporarely) limited to iovecs with a single element to keep the patch size as small as possible. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb-ehci.c')
-rw-r--r--hw/usb-ehci.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index 8b0dcc335d..799e31a319 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -1235,7 +1235,7 @@ static void ehci_async_complete_packet(USBPort *port, USBPacket *packet)
trace_usb_ehci_queue_action(q, "wakeup");
assert(q->async == EHCI_ASYNC_INFLIGHT);
q->async = EHCI_ASYNC_FINISHED;
- q->usb_status = packet->len;
+ q->usb_status = packet->result;
}
static void ehci_execute_complete(EHCIQueue *q)
@@ -1367,17 +1367,15 @@ static int ehci_execute(EHCIQueue *q)
continue;
}
- q->packet.pid = q->pid;
- q->packet.devaddr = devadr;
- q->packet.devep = endp;
- q->packet.data = q->buffer;
- q->packet.len = q->tbytes;
+ usb_packet_setup(&q->packet, q->pid, devadr, endp);
+ usb_packet_addbuf(&q->packet, q->buffer, q->tbytes);
ret = usb_handle_packet(dev, &q->packet);
- DPRINTF("submit: qh %x next %x qtd %x pid %x len %d (total %d) endp %x ret %d\n",
+ DPRINTF("submit: qh %x next %x qtd %x pid %x len %zd "
+ "(total %d) endp %x ret %d\n",
q->qhaddr, q->qh.next, q->qtdaddr, q->pid,
- q->packet.len, q->tbytes, endp, ret);
+ q->packet.iov.size, q->tbytes, endp, ret);
if (ret != USB_RET_NODEV) {
break;
@@ -1457,11 +1455,8 @@ static int ehci_process_itd(EHCIState *ehci,
continue;
}
- ehci->ipacket.pid = pid;
- ehci->ipacket.devaddr = devaddr;
- ehci->ipacket.devep = endp;
- ehci->ipacket.data = ehci->ibuffer;
- ehci->ipacket.len = len;
+ usb_packet_setup(&ehci->ipacket, pid, devaddr, endp);
+ usb_packet_addbuf(&ehci->ipacket, ehci->ibuffer, len);
ret = usb_handle_packet(dev, &ehci->ipacket);