[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/26] ehci: Add an ehci_get_pid helper function
From: |
Hans de Goede |
Subject: |
[Qemu-devel] [PATCH 07/26] ehci: Add an ehci_get_pid helper function |
Date: |
Fri, 14 Dec 2012 14:35:28 +0100 |
Signed-off-by: Hans de Goede <address@hidden>
---
hw/usb/hcd-ehci.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index dde2ff3..dae414a 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -481,6 +481,21 @@ static inline int put_dwords(EHCIState *ehci, uint32_t
addr,
return num;
}
+static int ehci_get_pid(EHCIqtd *qtd)
+{
+ switch (get_field(qtd->token, QTD_TOKEN_PID)) {
+ case 0:
+ return USB_TOKEN_OUT;
+ case 1:
+ return USB_TOKEN_IN;
+ case 2:
+ return USB_TOKEN_SETUP;
+ default:
+ fprintf(stderr, "bad token\n");
+ return 0;
+ }
+}
+
static bool ehci_verify_qh(EHCIQueue *q, EHCIqh *qh)
{
uint32_t devaddr = get_field(qh->epchar, QH_EPCHAR_DEVADDR);
@@ -1352,22 +1367,7 @@ static int ehci_execute(EHCIPacket *p, const char
*action)
return -1;
}
- p->pid = (p->qtd.token & QTD_TOKEN_PID_MASK) >> QTD_TOKEN_PID_SH;
- switch (p->pid) {
- case 0:
- p->pid = USB_TOKEN_OUT;
- break;
- case 1:
- p->pid = USB_TOKEN_IN;
- break;
- case 2:
- p->pid = USB_TOKEN_SETUP;
- break;
- default:
- fprintf(stderr, "bad token\n");
- break;
- }
-
+ p->pid = ehci_get_pid(&p->qtd);
endp = get_field(p->queue->qh.epchar, QH_EPCHAR_EP);
ep = usb_ep_get(p->queue->dev, p->pid, endp);
--
1.8.0.1
- [Qemu-devel] [PATCH 00/26] usb: Hans' pending qemu usb patches, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 01/26] ehci: Add a ehci_writeback_async_complete_packet helper function, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 02/26] ehci: Add ehci_verify_qh and ehci_verify_qtd helper functions, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 03/26] ehci: Verify guest does not change the token of inflight qtd-s, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 05/26] ehci: writeback_async_complete_packet: verify qh and qtd, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 06/26] ehci: Verify qtd for async completed packets, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 04/26] ehci: Move get / put_dwords upwards, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 08/26] ehci: Verify a queue's ep direction does not change, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 07/26] ehci: Add an ehci_get_pid helper function,
Hans de Goede <=
- [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Hans de Goede, 2012/12/14
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Gerd Hoffmann, 2012/12/17
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Hans de Goede, 2012/12/17
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Gerd Hoffmann, 2012/12/17
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Hans de Goede, 2012/12/17
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Gerd Hoffmann, 2012/12/17
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Hans de Goede, 2012/12/18
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Gerd Hoffmann, 2012/12/18
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Hans de Goede, 2012/12/18
[Qemu-devel] [PATCH 12/26] uhci: Fix 1 ms delay in interrupt reporting to the guest, Hans de Goede, 2012/12/14