From owner-svn-src-all@FreeBSD.ORG Thu Oct 29 23:15:27 2009 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 817B010656BC; Thu, 29 Oct 2009 23:15:27 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 535508FC14; Thu, 29 Oct 2009 23:15:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9TNFR4H014330; Thu, 29 Oct 2009 23:15:27 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNFR0X014328; Thu, 29 Oct 2009 23:15:27 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200910292315.n9TNFR0X014328@svn.freebsd.org> From: Andrew Thompson Date: Thu, 29 Oct 2009 23:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198641 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb/controller dev/xen/xenpci 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: Thu, 29 Oct 2009 23:15:27 -0000 Author: thompsa Date: Thu Oct 29 23:15:26 2009 New Revision: 198641 URL: http://svn.freebsd.org/changeset/base/198641 Log: MFC r197554 Import two PCI quirks from Linux - Add quirk for ATI SB600 and SB700 to free SMB controller - Correct schedule sleep time to 10us on the VIA ehci controller Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/usb/controller/ehci_pci.c stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci_pci.c Thu Oct 29 23:14:39 2009 (r198640) +++ stable/8/sys/dev/usb/controller/ehci_pci.c Thu Oct 29 23:15:26 2009 (r198641) @@ -240,6 +240,50 @@ ehci_pci_probe(device_t self) } } +static void +ehci_pci_ati_quirk(device_t self, uint8_t is_sb700) +{ + device_t smbdev; + uint32_t val; + + if (is_sb700) { + /* Lookup SMBUS PCI device */ + smbdev = pci_find_device(PCI_EHCI_VENDORID_ATI, 0x4385); + if (smbdev == NULL) + return; + val = pci_get_revid(smbdev); + if (val != 0x3a && val != 0x3b) + return; + } + + /* + * Note: this bit is described as reserved in SB700 + * Register Reference Guide. + */ + val = pci_read_config(self, 0x53, 1); + if (!(val & 0x8)) { + val |= 0x8; + pci_write_config(self, 0x53, val, 1); + device_printf(self, "AMD SB600/700 quirk applied\n"); + } +} + +static void +ehci_pci_via_quirk(device_t self) +{ + uint32_t val; + + if ((pci_get_device(self) == 0x3104) && + ((pci_get_revid(self) & 0xf0) == 0x60)) { + /* Correct schedule sleep time to 10us */ + val = pci_read_config(self, 0x4b, 1); + if (val & 0x20) + return; + pci_write_config(self, 0x4b, val, 1); + device_printf(self, "VIA-quirk applied\n"); + } +} + static int ehci_pci_attach(device_t self) { @@ -370,6 +414,32 @@ ehci_pci_attach(device_t self) goto error; } ehci_pci_takecontroller(self); + + /* Undocumented quirks taken from Linux */ + + switch (pci_get_vendor(self)) { + case PCI_EHCI_VENDORID_ATI: + /* SB600 and SB700 EHCI quirk */ + switch (pci_get_device(self)) { + case 0x4386: + ehci_pci_ati_quirk(self, 0); + break; + case 0x4396: + ehci_pci_ati_quirk(self, 1); + break; + default: + break; + } + break; + + case PCI_EHCI_VENDORID_VIA: + ehci_pci_via_quirk(self); + break; + + default: + break; + } + err = ehci_init(sc); if (!err) { err = device_probe_and_attach(sc->sc_bus.bdev);