From owner-svn-src-all@freebsd.org Fri Jan 10 09:32:45 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A0481E1C45; Fri, 10 Jan 2020 09:32:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47vHp50MLLz4PQt; Fri, 10 Jan 2020 09:32:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07BFC18021; Fri, 10 Jan 2020 09:32:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00A9Wi91033786; Fri, 10 Jan 2020 09:32:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00A9Wis9033785; Fri, 10 Jan 2020 09:32:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202001100932.00A9Wis9033785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 10 Jan 2020 09:32:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356598 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 356598 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jan 2020 09:32:45 -0000 Author: hselasky Date: Fri Jan 10 09:32:44 2020 New Revision: 356598 URL: https://svnweb.freebsd.org/changeset/base/356598 Log: Check the XHCI endpoint state before stopping any endpoint. This avoids getting the XHCI_TRB_ERROR_CONTEXT_STATE error code from the XHCI controller when the endpoint is disabled or already stopped. Suggested by: Shichun.Ma@dell.com MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/controller/xhci.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Fri Jan 10 09:07:43 2020 (r356597) +++ head/sys/dev/usb/controller/xhci.c Fri Jan 10 09:32:44 2020 (r356598) @@ -1598,10 +1598,26 @@ static usb_error_t xhci_cmd_stop_ep(struct xhci_softc *sc, uint8_t suspend, uint8_t ep_id, uint8_t slot_id) { + struct usb_page_search buf_dev; + struct xhci_dev_ctx *pdev; struct xhci_trb trb; uint32_t temp; DPRINTF("\n"); + + usbd_get_page(&sc->sc_hw.devs[slot_id].device_pc, 0, &buf_dev); + pdev = buf_dev.buffer; + usb_pc_cpu_invalidate(&sc->sc_hw.devs[slot_id].device_pc); + + switch (XHCI_EPCTX_0_EPSTATE_GET(pdev->ctx_ep[ep_id - 1].dwEpCtx0)) { + case XHCI_EPCTX_0_EPSTATE_DISABLED: + case XHCI_EPCTX_0_EPSTATE_STOPPED: + DPRINTF("Endpoint %u on slot %u is already stopped\n", + ep_id, slot_id); + return (USB_ERR_NORMAL_COMPLETION); + default: + break; + } trb.qwTrb0 = 0; trb.dwTrb2 = 0;