From owner-freebsd-current@FreeBSD.ORG Mon Sep 28 13:47:08 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1B5A1065672; Mon, 28 Sep 2009 13:47:07 +0000 (UTC) (envelope-from john@baldwin.cx) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id ABCC88FC1F; Mon, 28 Sep 2009 13:47:07 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 429EF46B0D; Mon, 28 Sep 2009 09:47:07 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 710ED8A027; Mon, 28 Sep 2009 09:47:06 -0400 (EDT) From: John Baldwin To: Andriy Gapon Date: Mon, 28 Sep 2009 07:48:44 -0400 User-Agent: KMail/1.9.7 References: <4ABA36B1.9070706@icyb.net.ua> <4ABF57F5.1050106@icyb.net.ua> <4ABF643D.1080705@freebsd.org> In-Reply-To: <4ABF643D.1080705@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200909280748.45528.john@baldwin.cx> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 28 Sep 2009 09:47:06 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.8 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx X-Mailman-Approved-At: Mon, 28 Sep 2009 14:00:47 +0000 Cc: freebsd-current@freebsd.org, freebsd-usb@freebsd.org, Hans Petter Selasky Subject: Re: sb600/sb700 ohci experimental patch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2009 13:47:08 -0000 On Sunday 27 September 2009 9:10:21 am Andriy Gapon wrote: > on 27/09/2009 15:17 Andriy Gapon said the following: > > Another idea of working around this: > > 1) in pci fixup code disable USB SMI for these chipsets > > 2) (optional) in ohci code skip takeover step > > Sounds messy. > > BTW, just for the sake of experiment I did exactly what I suggested. > I've got the following messages: > > kernel: ohci_controller_init:195: SMM active, request owner change > kernel: usbus0: SMM does not respond, resetting > kernel: ohci_controller_init:195: SMM active, request owner change > kernel: usbus1: SMM does not respond, resetting > kernel: ohci_controller_init:195: SMM active, request owner change > kernel: usbus3: SMM does not respond, resetting > kernel: ohci_controller_init:195: SMM active, request owner change > kernel: usbus4: SMM does not respond, resetting > kernel: ohci_controller_init:195: SMM active, request owner change > kernel: usbus6: SMM does not respond, resetting > > And the register value stayed intact after initial programming, so no > re-programming was needed. > > Here is the (dirty) hack: > diff --git a/sys/dev/pci/fixup_pci.c b/sys/dev/pci/fixup_pci.c > index 566e503..1463c24 100644 > --- a/sys/dev/pci/fixup_pci.c > +++ b/sys/dev/pci/fixup_pci.c > @@ -53,6 +53,7 @@ static int fixup_pci_probe(device_t dev); > static void fixwsc_natoma(device_t dev); > static void fixc1_nforce2(device_t dev); > static void fixrtc_piix4(device_t dev); > +static void fixsmi_usb(device_t dev); > > static device_method_t fixup_pci_methods[] = { > /* Device interface */ > @@ -84,6 +85,9 @@ fixup_pci_probe(device_t dev) > case 0x01e010de: /* nVidia nForce2 */ > fixc1_nforce2(dev); > break; > + case 0x96001022: /* AMD SB700 */ > + fixsmi_usb(dev); > + break; > } > return(ENXIO); > } > @@ -124,6 +128,21 @@ > } > > > +/* Disable USB SMI */ > +static void > +fixsmi_usb(device_t dev) > +{ > + uint32_t features; > + > + dev = pci_find_device(0x1002, 0x4385); > + features = pci_read_config(dev, 0x64, 4); > + if (features & (1 << 15)) { > + printf("Disabling USB SMI on SB7xx\n"); > + features &= ~(1 << 15); > + pci_write_config(dev, 0x64, features, 4); > + } > +} > + > /* > * Set the SYSTEM_IDLE_TIMEOUT to 80 ns on nForce2 systems to work > * around a hang that is triggered when the CPU generates a very fast I don't think you can do this because it is a "feature" to not disable SMM if ohci(4) is not loaded so that a USB keyboard works when the USB driver isn't loaded via PS/2 emulation, even when the OS is running. I am curious if we really need to do the handover for each controller or if disabling it for ohci0 effectively disables it for all controllers? What do other OS's do? -- John Baldwin