From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXtp1-0008SL-MD for qemu-devel@nongnu.org; Fri, 25 May 2012 08:40:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXtor-00019d-To for qemu-devel@nongnu.org; Fri, 25 May 2012 08:40:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54676) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXtor-000198-MH for qemu-devel@nongnu.org; Fri, 25 May 2012 08:40:37 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4PCeaDW021778 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 25 May 2012 08:40:36 -0400 From: Gerd Hoffmann Date: Fri, 25 May 2012 14:40:18 +0200 Message-Id: <1337949634-5264-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1337949634-5264-1-git-send-email-kraxel@redhat.com> References: <1337949634-5264-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 02/18] ehci: make ehci_execute work on EHCIPacket instead of EHCIQueue List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann This way it is possible to use ehci_execute to submit others than the first EHCIPacket of the EHCIQueue. Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-ehci.c | 22 +++++++++------------- 1 files changed, 9 insertions(+), 13 deletions(-) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 03ae09f..a7cf282 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -1395,30 +1395,26 @@ static void ehci_execute_complete(EHCIQueue *q) // 4.10.3 -static int ehci_execute(EHCIQueue *q) +static int ehci_execute(EHCIPacket *p) { - EHCIPacket *p = QTAILQ_FIRST(&q->packets); USBDevice *dev; USBEndpoint *ep; int ret; int endp; int devadr; - assert(p != NULL); - assert(p->qtdaddr == q->qtdaddr); - - if ( !(q->qh.token & QTD_TOKEN_ACTIVE)) { - fprintf(stderr, "Attempting to execute inactive QH\n"); + if (!(p->qtd.token & QTD_TOKEN_ACTIVE)) { + fprintf(stderr, "Attempting to execute inactive qtd\n"); return USB_RET_PROCERR; } - p->tbytes = (q->qh.token & QTD_TOKEN_TBYTES_MASK) >> QTD_TOKEN_TBYTES_SH; + p->tbytes = (p->qtd.token & QTD_TOKEN_TBYTES_MASK) >> QTD_TOKEN_TBYTES_SH; if (p->tbytes > BUFF_SIZE) { fprintf(stderr, "Request for more bytes than allowed\n"); return USB_RET_PROCERR; } - p->pid = (q->qh.token & QTD_TOKEN_PID_MASK) >> QTD_TOKEN_PID_SH; + p->pid = (p->qtd.token & QTD_TOKEN_PID_MASK) >> QTD_TOKEN_PID_SH; switch (p->pid) { case 0: p->pid = USB_TOKEN_OUT; @@ -1438,11 +1434,11 @@ static int ehci_execute(EHCIQueue *q) return USB_RET_PROCERR; } - endp = get_field(q->qh.epchar, QH_EPCHAR_EP); - devadr = get_field(q->qh.epchar, QH_EPCHAR_DEVADDR); + endp = get_field(p->queue->qh.epchar, QH_EPCHAR_EP); + devadr = get_field(p->queue->qh.epchar, QH_EPCHAR_DEVADDR); /* TODO: associating device with ehci port */ - dev = ehci_find_device(q->ehci, devadr); + dev = ehci_find_device(p->queue->ehci, devadr); ep = usb_ep_get(dev, p->pid, endp); usb_packet_setup(&p->packet, p->pid, ep); @@ -1912,7 +1908,7 @@ static int ehci_state_execute(EHCIQueue *q, int async) ehci_set_usbsts(q->ehci, USBSTS_REC); } - p->usb_status = ehci_execute(q); + p->usb_status = ehci_execute(p); if (p->usb_status == USB_RET_PROCERR) { again = -1; goto out; -- 1.7.1