From owner-p4-projects@FreeBSD.ORG Thu Jan 22 15:19:04 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7F7B91065670; Thu, 22 Jan 2009 15:19:04 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BF6B106564A for ; Thu, 22 Jan 2009 15:19:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 0FEEE8FC0C for ; Thu, 22 Jan 2009 15:19:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n0MFJ3Nw025270 for ; Thu, 22 Jan 2009 15:19:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n0MFJ3tp025268 for perforce@freebsd.org; Thu, 22 Jan 2009 15:19:03 GMT (envelope-from hselasky@FreeBSD.org) Date: Thu, 22 Jan 2009 15:19:03 GMT Message-Id: <200901221519.n0MFJ3tp025268@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 156522 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jan 2009 15:19:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=156522 Change 156522 by hselasky@hselasky_laptop001 on 2009/01/22 15:18:06 UHCI SOF Quirk. Makes some broken USB devices work again. Reported by several people. Patch made by me. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/controller/uhci2.c#23 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/usb2_controller.h#11 edit .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_hub.c#34 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/controller/uhci2.c#23 (text+ko) ==== @@ -3320,7 +3320,13 @@ flags = bus->hw_power_state; + /* + * WARNING: Some FULL speed USB devices require periodic SOF messages! + * If any USB devices are connected through the UHCI, power + * save will be disabled! + */ if (flags & (USB_HW_POWER_CONTROL | + USB_HW_POWER_NON_ROOT_HUB | USB_HW_POWER_BULK | USB_HW_POWER_INTERRUPT | USB_HW_POWER_ISOC)) { ==== //depot/projects/usb/src/sys/dev/usb2/controller/usb2_controller.h#11 (text+ko) ==== @@ -84,6 +84,11 @@ * are active: */ #define USB_HW_POWER_ISOC 0x08 + /* + * The following flag is set if one or more non-root-HUB devices + * are present on the given USB bus: + */ +#define USB_HW_POWER_NON_ROOT_HUB 0x10 /* USB Device mode only - Mandatory */ ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_hub.c#34 (text+ko) ==== @@ -1503,7 +1503,7 @@ unsigned int temp; unsigned int limit; unsigned int mintime; - uint32_t type_refs[4]; + uint32_t type_refs[5]; uint8_t x; uint8_t rem_wakeup; @@ -1564,6 +1564,7 @@ type_refs[1] = 0; type_refs[2] = 0; type_refs[3] = 0; + type_refs[4] = 0; /* Re-loop all the devices to get the actual state */ @@ -1574,6 +1575,9 @@ if (udev == NULL) continue; + /* we found a non-Root-Hub USB device */ + type_refs[4] += 1; + /* "last_xfer_time" can be updated by a resume */ temp = ticks - udev->pwr_save.last_xfer_time; @@ -1604,6 +1608,8 @@ bus->hw_power_state |= USB_HW_POWER_INTERRUPT; if (type_refs[UE_ISOCHRONOUS] != 0) bus->hw_power_state |= USB_HW_POWER_ISOC; + if (type_refs[4] != 0) + bus->hw_power_state |= USB_HW_POWER_NON_ROOT_HUB; } USB_BUS_UNLOCK(bus);