From patchwork Fri Mar 2 18:32:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 144299 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AB8811007D6 for ; Sat, 3 Mar 2012 05:32:50 +1100 (EST) Received: from localhost ([::1]:51213 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3XHc-0004D9-BO for incoming@patchwork.ozlabs.org; Fri, 02 Mar 2012 13:32:48 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3XG5-0000Wf-BH for qemu-devel@nongnu.org; Fri, 02 Mar 2012 13:31:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S3XFl-00066U-F7 for qemu-devel@nongnu.org; Fri, 02 Mar 2012 13:31:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3XFl-000669-6R for qemu-devel@nongnu.org; Fri, 02 Mar 2012 13:30:53 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q22IUpl1027799 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 2 Mar 2012 13:30:51 -0500 Received: from shalem.localdomain.com (vpn1-7-1.ams2.redhat.com [10.36.7.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q22IUlt5003764; Fri, 2 Mar 2012 13:30:50 -0500 From: Hans de Goede To: Gerd Hoffmann Date: Fri, 2 Mar 2012 19:32:23 +0100 Message-Id: <1330713154-3229-3-git-send-email-hdegoede@redhat.com> In-Reply-To: <1330713154-3229-1-git-send-email-hdegoede@redhat.com> References: <1330713154-3229-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Hans de Goede , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 02/13] usb-ehci: Never follow table entries with the T-bit set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Before this patch the T-bit was not checked in 2 places, while it should be. Once we properly check the T-bit everywhere we no longer need the weird entry < 0x1000 and entry > 0x1000 checks, so this patch removes them. Signed-off-by: Hans de Goede --- hw/usb-ehci.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c index afc8ccf..d41b80e 100644 --- a/hw/usb-ehci.c +++ b/hw/usb-ehci.c @@ -1568,8 +1568,7 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async) int again = 0; uint32_t entry = ehci_get_fetch_addr(ehci, async); - if (entry < 0x1000) { - DPRINTF("fetchentry: entry invalid (0x%08x)\n", entry); + if (NLPTR_TBIT(entry)) { ehci_set_state(ehci, async, EST_ACTIVE); goto out; } @@ -1677,7 +1676,8 @@ static EHCIQueue *ehci_state_fetchqh(EHCIState *ehci, int async) if (q->qh.token & QTD_TOKEN_HALT) { ehci_set_state(ehci, async, EST_HORIZONTALQH); - } else if ((q->qh.token & QTD_TOKEN_ACTIVE) && (q->qh.current_qtd > 0x1000)) { + } else if ((q->qh.token & QTD_TOKEN_ACTIVE) && + (NLPTR_TBIT(q->qh.current_qtd) == 0)) { q->qtdaddr = q->qh.current_qtd; ehci_set_state(ehci, async, EST_FETCHQTD); @@ -1756,7 +1756,6 @@ static int ehci_state_advqueue(EHCIQueue *q, int async) * want data and alt-next qTD is valid */ if (((q->qh.token & QTD_TOKEN_TBYTES_MASK) != 0) && - (q->qh.altnext_qtd > 0x1000) && (NLPTR_TBIT(q->qh.altnext_qtd) == 0)) { q->qtdaddr = q->qh.altnext_qtd; ehci_set_state(q->ehci, async, EST_FETCHQTD); @@ -1764,8 +1763,7 @@ static int ehci_state_advqueue(EHCIQueue *q, int async) /* * next qTD is valid */ - } else if ((q->qh.next_qtd > 0x1000) && - (NLPTR_TBIT(q->qh.next_qtd) == 0)) { + } else if (NLPTR_TBIT(q->qh.next_qtd) == 0) { q->qtdaddr = q->qh.next_qtd; ehci_set_state(q->ehci, async, EST_FETCHQTD);