From owner-freebsd-stable Mon Mar 10 3:16:57 2003 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 61C0037B401 for ; Mon, 10 Mar 2003 03:16:53 -0800 (PST) Received: from mail.ffanet.com (cashmoney.ffanet.com [209.116.13.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 174AF43F85 for ; Mon, 10 Mar 2003 03:16:52 -0800 (PST) (envelope-from scottj@mail.ffanet.com) Received: (from scottj@localhost) by mail.ffanet.com (8.11.6/8.9.3) id h2ABYC673441; Mon, 10 Mar 2003 05:34:12 -0600 (CST) Message-Id: <5.2.0.9.2.20030310050138.01a126a8@mail.ffanet.com> X-Sender: scottj@mail.ffanet.com (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 5.2.0.9 Date: Mon, 10 Mar 2003 05:16:49 -0600 To: freebsd-stable@FREEBSD.ORG From: Scott Johnson Subject: USB code change needed? Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello, About a month ago, I realized that I could not boot with the new pseudo-device crypto in my kernel. After quite a bit of email was exchanged with various parties, Ian Dowse recommended that I patch uhci.c. Ian originally said something along the lines of "Is it possible that interrupts are inadvertently getting enabled too early during device probe time? The loop in uhci_waitintr() looks as if it will do the wrong thing if a real interrupt comes in and invokes uhci_intr(), as the interrupt info will not be found because it has already been handled." Based on this theory, Ian suggested the patch below. Without this patch, I cannot boot my system if I'm trying to use a kernel with crypto. With the patch, everything seems to be working ok. OpenSSL is using my crypto hardware just fine. But I haven't tested any of the USB functionality. And I don't have the resources to do so either. So my question is this: Is this patch something that needs to be incorporated into the tree? Or is my hardware just strange? I've been staying current with -STABLE, and as of March 7, -STABLE with crypto enabled still would not boot on my machine. Thanks in advance for any helpful advice. -Scott Here's the patch: =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/uhci.c,v retrieving revision 1.132 diff -u -p -r1.132 uhci.c --- uhci.c 2003/02/28 19:28:29 1.132 +++ uhci.c 2003/03/10 11:01:08 @@ -1511,11 +1511,10 @@ uhci_waitintr(uhci_softc_t *sc, usbd_xfe for (; timo >= 0; timo--) { usb_delay_ms(&sc->sc_bus, 1); DPRINTFN(20,("uhci_waitintr: 0x%04x\n", UREAD2(sc, UHCI_STS))); - if (UREAD2(sc, UHCI_STS) & UHCI_STS_USBINT) { + if (UREAD2(sc, UHCI_STS) & UHCI_STS_USBINT) uhci_intr1(sc); - if (xfer->status != USBD_IN_PROGRESS) + if (xfer->status != USBD_IN_PROGRESS) return; - } } /* Timeout */ And here's my dmesg (patched kernel): Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 4.8-RC #1: Fri Mar 7 01:41:57 CST 2003 root@test01.insane.com:/usr/obj/usr/src/sys/CRYPTO Timecounter "i8254" frequency 1193182 Hz CPU: AMD Athlon(tm) Processor (1008.99-MHz 686-class CPU) Origin = "AuthenticAMD" Id = 0x642 Stepping = 2 Features=0x183f9ff AMD Features=0xc0440000 real memory = 536788992 (524208K bytes) avail memory = 516943872 (504828K bytes) Preloaded elf kernel "kernel" at 0xc053d000. Pentium Pro MTRR support enabled md0: Malloc disk Using $PIR table, 9 entries at 0xc00f1750 npx0: on motherboard npx0: INT 16 interface pcib0: on motherboard pci0: on pcib0 agp0: mem 0xe4000000-0xe7ffffff at device 0.0 on pci0 pcib1: at device 1.0 on pci0 pci1: on pcib1 isab0: at device 4.0 on pci0 isa0: on isab0 atapci0: port 0xd800-0xd80f at device 4.1 on pci0 ata0: at 0x1f0 irq 14 on atapci0 ata1: at 0x170 irq 15 on atapci0 uhci0: port 0xd400-0xd41f irq 10 at device 4.2 on pci0 usb0: on uhci0 usb0: USB revision 1.0 uhub0: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub0: 2 ports with 2 removable, self powered uhci1: port 0xd000-0xd01f irq 10 at device 4.3 on pci0 usb1: on uhci1 usb1: USB revision 1.0 uhub1: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub1: 2 ports with 2 removable, self powered uhub2: ALCOR Generic USB Hub, class 9/0, rev 1.10/1.00, addr 2 uhub2: 4 ports with 4 removable, self powered pci0: (vendor=0x1106, dev=0x3057) at 4.4 hifn0 mem 0xe2800000-0xe2800fff,0xe3000000-0xe3000fff irq 10 at device 9.0 on pci0 hifn0: Hifn 7951, rev 0, 128KB sram, 193 sessions fxp0: port 0xa400-0xa43f mem 0xe1800000-0xe18fffff,0xe2000000-0xe2000fff irq 10 at device 13.0 on pci0 fxp0: Ethernet address 00:02:b3:10:7a:39 inphy0: on miibus0 inphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto atapci1: port 0x8800-0x883f,0x9000-0x9003,0x9400-0x9407,0x9800-0x9803,0xa000-0xa007 mem 0xe1000000-0xe101ffff irq 11 at device 17.0 on pci0 ata2: at 0xa000 on atapci1 ata3: at 0x9400 on atapci1 orm0: