Subject: Re: USB card with NetBSD 4.0beta
To: None <fox@tcnet.ch>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-cobalt
Date: 09/07/2007 21:17:41
[well, your mail seems caught by a filter due to html attachment]
In article <46D9B6C1.1060400@tcnet.ch>
fox@tcnet.ch wrote:
> When i enable ehci in der kernel by:
>
> ehci* at pci? dev ? function ? # Enhanced Host Controller
>
> i get a panic on kernel load
>
> Cobalt Qube 2
> total memory = 128 MB
> avail memory = 120 MB
> timecounter: Timecounters tick every 10.000 msec
> mainbus0 (root)
> com0 at mainbus0 addr 0x1c800000 level 3: st16650a, working fifo
> com0: console
> cpu0 at mainbus0: QED RM5200 CPU (0x28a0) Rev. 10.0 with built-in FPU
> Rev. 10.0
> cpu0: 32KB/32B 2-way set-associative L1 Instruction cache, 48 TLB entries
> cpu0: 32KB/32B 2-way set-associative write-back L1 Data cache
> mcclock0 at mainbus0 addr 0x10000070: mc146818 compatible time-of-day clock
> panel0 at mainbus0 addr 0x1f000000
> gt0 at mainbus0 addr 0x14000000
> pci0 at gt0
> pci0: i/o space, memory space enabled, rd/line, wr/inv ok
> pchb0 at pci0 dev 0 function 0: Galileo GT-64111 System Controller, rev 1
> tlp0 at pci0 dev 7 function 0: DECchip 21143 Ethernet, pass 4.1
> tlp0: interrupting at level 1
> tlp0: Ethernet address 00:10:e0:00:1a:c9
> lxtphy0 at tlp0 phy 1: LXT970 10/100 media interface, rev. 3
> lxtphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
> pcib0 at pci0 dev 9 function 0
> pcib0: VIA Technologies VT82C586 PCI-ISA Bridge, rev 39
> viaide0 at pci0 dev 9 function 1
> viaide0: VIA Technologies VT82C586 (Apollo VP) ATA33 controller
> viaide0: bus-master DMA support present
> viaide0: primary channel configured to compatibility mode
> viaide0: primary channel interrupting at irq 14
> atabus0 at viaide0 channel 0
> viaide0: secondary channel configured to compatibility mode
> viaide0: secondary channel interrupting at irq 15
> atabus1 at viaide0 channel 1
> uhci0 at pci0 dev 9 function 2: VIA Technologies VT83C572 USB Controller
> (rev. 0x02)
> uhci0: can't map i/o space
> ohci0 at pci0 dev 10 function 0: NEC USB Host Controller (rev. 0x41)
> ohci0: interrupting at irq 9
> ohci0: OHCI version 1.0
> usb0 at ohci0: USB revision 1.0
> uhub0 at usb0
> uhub0: NEC OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
> uhub0: 3 ports with 3 removable, self powered
> ohci1 at pci0 dev 10 function 1: NEC USB Host Controller (rev. 0x41)
> ohci1: interrupting at irq 0
> ohci1: OHCI version 1.0
> usb1 at ohci1: USB revision 1.0
> uhub1 at usb1
> uhub1: NEC OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
> uhub1: 2 ports with 2 removable, self powered
> ehci0 at pci0 dev 10 function 2: NEC USB Host Controller (rev. 0x02)
> panic: icu_intr_establish(): irq 0 is already in use
> Stopped in pid 0.1 (swapper) at netbsd:cpu_Debugger+0x4: jr ra
> bdslot: nop
> db>
>
>
> What i do not really understand is, that this usb card was working with
> NetBSD 3.0 and the instruction i wrote here:
> http://www.aironaut.ch/content/view/19/53/
>
> And now with 4.0 it doesn't, so i think i missed something important in
> my description :-(
>
> I'll just comile a kernel with pci and and without ehci, but my poor
> little qube is working a while on this :-)
>
> Andreas
I've rewritten interrupt handling code on cobalt after 3.0
and the interrupt establish function has been changed not to
accept multiple handlers (to make related structures simpler).
These changes have not been pulled up to netbsd-3 branch
because the diffs are so large.
Anyway the real problem is that the cobalt firmware doesn't
map interrups for multi-function PCI devices, but we should
not panic in case of improper interrupt mappings either.
Could you try the following patch for workaround?
---
Izumi Tsutsui
Index: cobalt/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/cobalt/cobalt/machdep.c,v
retrieving revision 1.87
diff -u -r1.87 machdep.c
--- cobalt/machdep.c 10 Aug 2007 17:44:18 -0000 1.87
+++ cobalt/machdep.c 7 Sep 2007 12:16:25 -0000
@@ -538,8 +538,10 @@
struct cobalt_intrhand *ih;
ih = &icu_intrtab[irq];
- if (ih->ih_func != NULL)
- panic("icu_intr_establish(): irq %d is already in use", irq);
+ if (ih->ih_func != NULL) {
+ printf("%s: irq %d is already in use\n", __func__, irq);
+ return NULL;
+ }
ih->ih_cookie_type = COBALT_COOKIE_TYPE_ICU;
ih->ih_func = func;