Subject: Re: ACPI vs VIA USB (netbsd-4 vs netbsd-3)
To: None <port-i386@NetBSD.org>
From: Stephen Borrill <netbsd@precedence.co.uk>
List: port-i386
Date: 10/25/2007 11:07:21
On Mon, 22 Oct 2007, Michael van Elst wrote:
> On Mon, Oct 22, 2007 at 09:32:55AM +0100, Stephen Borrill wrote:
>> On Sun, 21 Oct 2007, Michael van Elst wrote:
>>> netbsd@precedence.co.uk (Stephen Borrill) writes:
>>>> To follow myself up, here's the relevant output with usbdebug and
>>>> uhcidebug set to 10 as I plug in the pendrive with a usb mouse plugged in:
>>> This looks like uhub_explore.
>>> Can you please repeat the test with uhubdebug set to 10 as well?
>> Sure:
>
> If I understand the code correctly the following
> happens:
>
>> uhub_explore: uhub2 port 1 status 0x0108 0x0000
>> uhub_explore: port=1 !C_CONNECT_STATUS
>
> Port 1 says:
> - has power (0x0100)
> - overcurrent (0x0008)
[snip]
> I don't understand where the 'overcurrent' comes from when
> the same hardware worked fine with netbsd3.

More info:

The problem started between 2006-06-20 and 2006-08-01 in HEAD. I can't 
track it down any more finely at this point as all kernels between that 
time reboot as soon as npx1 is detected.

So I compared the dmesgs between kernels from the two dates about:

-acpi: wakecode is installed at 0x1000, size=360
+acpi: wakecode is installed at 0x1000, size=376
  Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 
2006
      The NetBSD Foundation, Inc.  All rights reserved.
  Copyright (c) 1982, 1986, 1989, 1991, 1993
      The Regents of the University of California.  All rights reserved.

-NetBSD 3.99.21 (TCX) #12: Wed Oct 24 12:50:43 BST 2007
+NetBSD 3.99.24 (TCX) #5: Wed Oct 24 10:01:08 BST 2007
         root@devel:/usr/work/src/sys/arch/i386/compile/obj/TCX
  total memory = 111 MB
  avail memory = 107 MB
@@ -18,10 +15,15 @@
  BIOS32 rev. 0 found at 0xfb380
  mainbus0 (root)
  cpu0 at mainbus0: (uniprocessor)
-cpu0: VIA C3 Nehemiah (686-class), 1002.37 MHz, id 0x698
+cpu0: VIA C3 Nehemiah (686-class), 1002.33 MHz, id 0x698
  cpu0: "VIA Nehemiah"
  acpi0 at mainbus0: Advanced Configuration and Power Interface
  acpi0: fixed-feature power button present
+timecounter: Timecounter "ACPI-Fast" frequency 3579545 Hz quality 1000
+timecounter: selected timecounter "ACPI-Fast" frequency 3579545 Hz 
quality 1000
+ACPI-Fast 24-bit timer
+mpacpi: could not get bus number, assuming bus 0
+LNKD: BIOS IRQ 5 for 0.16.INTD is invalid
  ACPI Object Type 'Processor' (0x0c) at acpi0 not configured
  acpibut0 at acpi0 (PNP0C0C): ACPI Power Button
  acpibut1 at acpi0 (PNP0C0E): ACPI Sleep Button
@@ -106,7 +108,7 @@
  uhub2: vendor 0x1106 UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
  uhub2: 2 ports with 2 removable, self powered
  ehci0 at pci0 dev 16 function 3: vendor 0x1106 product 0x3104 (rev. 0x82)
-ehci0: interrupting at irq 5
+ehci0: interrupting at irq 9
  ehci0: BIOS has given up ownership
  ehci0: EHCI version 1.0
  ehci0: companion controllers, 2 ports each: uhci0 uhci1 uhci2

Note the "LNKD: BIOS IRQ 5 for 0.16.INTD is invalid" line.

Doing a quick hack to stop this invalid check "fixes" the problem, but 
clearly isn't a solution! The hack I used is below (with
"options ACPI_IRQ_SKIP=5" in my kernel config):

--- /usr/src/sys/dev/acpi/acpi_pci_link.c~	2007-10-25 10:44:06.000000000 +0100
+++ /usr/src/sys/dev/acpi/acpi_pci_link.c	2007-10-25 10:44:06.000000000 +0100
@@ -661,7 +661,11 @@
  	}

  	/* Validate the BIOS IRQ. */
+#ifdef ACPI_IRQ_SKIP
+	if (ACPI_IRQ_SKIP != bios_irq && !link_valid_irq(link, bios_irq)) {
+#else
  	if (!link_valid_irq(link, bios_irq)) {
+#endif
  		printf("%s: BIOS IRQ %u for %d.%d.INT%c is invalid\n",
  		    sc->pl_name, bios_irq, (int)bus, slot, pin + 'A');
  	} else if (!PCI_INTERRUPT_VALID(link->l_bios_irq)) {

The workaround in PR/33922 doesn't help (but thanks to Martin for the 
pointer).

-- 
Stephen