From nobody Mon Feb 9 09:16:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487662112421237.2369588456355; Mon, 20 Feb 2017 23:28:32 -0800 (PST) Received: from localhost ([::1]:42713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cg4sB-0004UP-5i for importer@patchew.org; Tue, 21 Feb 2017 02:28:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cg4gc-0002yg-4R for qemu-devel@nongnu.org; Tue, 21 Feb 2017 02:16:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cg4gZ-00087J-VP for qemu-devel@nongnu.org; Tue, 21 Feb 2017 02:16:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44446) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cg4gZ-00086x-NL for qemu-devel@nongnu.org; Tue, 21 Feb 2017 02:16:31 -0500 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF1F5C04BD40 for ; Tue, 21 Feb 2017 07:16:31 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-47.ams2.redhat.com [10.36.116.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75CF81CDD91; Tue, 21 Feb 2017 07:16:31 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 256798184A; Tue, 21 Feb 2017 08:16:28 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 21 Feb 2017 08:16:21 +0100 Message-Id: <1487661385-7720-8-git-send-email-kraxel@redhat.com> In-Reply-To: <1487661385-7720-1-git-send-email-kraxel@redhat.com> References: <1487661385-7720-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 21 Feb 2017 07:16:31 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 07/11] xhci: fix nec vendor quirk handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Only the TYPE_NEC_XHCI controller will have the nec vendor quirks. Signed-off-by: Gerd Hoffmann Message-id: 1486382139-30630-4-git-send-email-kraxel@redhat.com --- hw/usb/hcd-xhci.c | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index c534b43..4ac67ae 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -487,6 +487,8 @@ struct XHCIState { XHCIInterrupter intr[MAXINTRS]; =20 XHCIRing cmd_ring; + + bool nec_quirks; }; =20 #define TYPE_XHCI "base-xhci" @@ -2745,20 +2747,26 @@ static void xhci_process_commands(XHCIState *xhci) xhci_via_challenge(xhci, trb.parameter); break; case CR_VENDOR_NEC_FIRMWARE_REVISION: - event.type =3D 48; /* NEC reply */ - event.length =3D 0x3025; + if (xhci->nec_quirks) { + event.type =3D 48; /* NEC reply */ + event.length =3D 0x3025; + } else { + event.ccode =3D CC_TRB_ERROR; + } break; case CR_VENDOR_NEC_CHALLENGE_RESPONSE: - { - uint32_t chi =3D trb.parameter >> 32; - uint32_t clo =3D trb.parameter; - uint32_t val =3D xhci_nec_challenge(chi, clo); - event.length =3D val & 0xFFFF; - event.epid =3D val >> 16; - slotid =3D val >> 24; - event.type =3D 48; /* NEC reply */ - } - break; + if (xhci->nec_quirks) { + uint32_t chi =3D trb.parameter >> 32; + uint32_t clo =3D trb.parameter; + uint32_t val =3D xhci_nec_challenge(chi, clo); + event.length =3D val & 0xFFFF; + event.epid =3D val >> 16; + slotid =3D val >> 24; + event.type =3D 48; /* NEC reply */ + } else { + event.ccode =3D CC_TRB_ERROR; + } + break; default: trace_usb_xhci_unimplemented("command", type); event.ccode =3D CC_TRB_ERROR; @@ -3265,9 +3273,12 @@ static void xhci_runtime_write(void *ptr, hwaddr reg, intr->erstsz =3D val & 0xffff; break; case 0x10: /* ERSTBA low */ - /* XXX NEC driver bug: it doesn't align this to 64 bytes - intr->erstba_low =3D val & 0xffffffc0; */ - intr->erstba_low =3D val & 0xfffffff0; + if (xhci->nec_quirks) { + /* NEC driver bug: it doesn't align this to 64 bytes */ + intr->erstba_low =3D val & 0xfffffff0; + } else { + intr->erstba_low =3D val & 0xffffffc0; + } break; case 0x14: /* ERSTBA high */ intr->erstba_high =3D val; @@ -3562,6 +3573,9 @@ static void usb_xhci_realize(struct PCIDevice *dev, E= rror **errp) dev->config[PCI_CACHE_LINE_SIZE] =3D 0x10; dev->config[0x60] =3D 0x30; /* release number */ =20 + if (strcmp(object_get_typename(OBJECT(dev)), TYPE_NEC_XHCI) =3D=3D 0) { + xhci->nec_quirks =3D true; + } if (xhci->numintrs > MAXINTRS) { xhci->numintrs =3D MAXINTRS; } --=20 1.8.3.1