From owner-svn-src-all@FreeBSD.ORG Fri Jan 13 07:28:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B3281065670; Fri, 13 Jan 2012 07:28:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F7B08FC13; Fri, 13 Jan 2012 07:28:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0D7SZpZ048512; Fri, 13 Jan 2012 07:28:35 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0D7SZmU048509; Fri, 13 Jan 2012 07:28:35 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201201130728.q0D7SZmU048509@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 13 Jan 2012 07:28:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230050 - in head/sys/dev/usb: . controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 13 Jan 2012 07:28:35 -0000 Author: hselasky Date: Fri Jan 13 07:28:34 2012 New Revision: 230050 URL: http://svn.freebsd.org/changeset/base/230050 Log: Correct use of USB 3.0 POWER bit in the port status register, hence it was overlapping the USB 3.0 root HUB's speed bits. Reported by: Kohji Okuno MFC after: 1 week Modified: head/sys/dev/usb/controller/xhci.c head/sys/dev/usb/usb_hub.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Fri Jan 13 07:19:02 2012 (r230049) +++ head/sys/dev/usb/controller/xhci.c Fri Jan 13 07:28:34 2012 (r230050) @@ -3194,8 +3194,13 @@ xhci_roothub_exec(struct usb_device *ude i |= UPS_OVERCURRENT_INDICATOR; if (v & XHCI_PS_PR) i |= UPS_RESET; - if (v & XHCI_PS_PP) - i |= UPS_PORT_POWER_SS; + if (v & XHCI_PS_PP) { + /* + * The USB 3.0 RH is using the + * USB 2.0's power bit + */ + i |= UPS_PORT_POWER; + } USETW(sc->sc_hub_desc.ps.wPortStatus, i); i = 0; Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Fri Jan 13 07:19:02 2012 (r230049) +++ head/sys/dev/usb/usb_hub.c Fri Jan 13 07:28:34 2012 (r230050) @@ -327,6 +327,7 @@ uhub_reattach_port(struct uhub_softc *sc enum usb_dev_speed speed; enum usb_hc_mode mode; usb_error_t err; + uint16_t power_mask; uint8_t timeout; DPRINTF("reattaching port %d\n", portno); @@ -373,20 +374,22 @@ repeat: case USB_SPEED_HIGH: case USB_SPEED_FULL: case USB_SPEED_LOW: - if (!(sc->sc_st.port_status & UPS_PORT_POWER)) { - DPRINTF("WARNING: strange, connected port %d " - "has no power\n", portno); - } + power_mask = UPS_PORT_POWER; break; case USB_SPEED_SUPER: - if (!(sc->sc_st.port_status & UPS_PORT_POWER_SS)) { - DPRINTF("WARNING: strange, connected port %d " - "has no power\n", portno); - } + if (udev->parent_hub == NULL) + power_mask = UPS_PORT_POWER; + else + power_mask = UPS_PORT_POWER_SS; break; default: + power_mask = 0; break; } + if (!(sc->sc_st.port_status & power_mask)) { + DPRINTF("WARNING: strange, connected port %d " + "has no power\n", portno); + } /* check if the device is in Host Mode */