Subject: Re: Soekris Net4801: panic on
To: Jun-ichiro itojun Hagino <itojun@iijlab.net>
From: Jaromir Dolecek <jdolecek@NetBSD.org>
List: port-i386
Date: 08/14/2003 16:56:01
Seems following might be the required change - can you try it out?

Jaromir

Index: pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/pci.c,v
retrieving revision 1.80
diff -u -p -r1.80 pci.c
--- pci.c	2003/06/15 23:09:09	1.80
+++ pci.c	2003/08/14 14:52:59
@@ -262,11 +262,14 @@ pci_probe_device(struct pci_softc *sc, p
 
 	pci_decompose_tag(pc, tag, &bus, &device, &function);
 
+	bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG);
+	if (PCI_HDRTYPE_TYPE(bhlcr) > 2)
+		return (0);
+
 	id = pci_conf_read(pc, tag, PCI_ID_REG);
 	csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
 	class = pci_conf_read(pc, tag, PCI_CLASS_REG);
 	intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG);
-	bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG);
 
 	/* Invalid vendor ID value? */
 	if (PCI_VENDOR(id) == PCI_VENDOR_INVALID)
@@ -431,6 +434,11 @@ pci_enumerate_bus_generic(struct pci_sof
 #endif
 	{
 		tag = pci_make_tag(pc, sc->sc_bus, device, 0);
+
+		bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG);
+		if (PCI_HDRTYPE_TYPE(bhlcr) > 2)
+			continue;
+
 		id = pci_conf_read(pc, tag, PCI_ID_REG);
 
 		/* Invalid vendor ID value? */
@@ -442,7 +450,6 @@ pci_enumerate_bus_generic(struct pci_sof
 
 		qd = pci_lookup_quirkdata(PCI_VENDOR(id), PCI_PRODUCT(id));
 
-		bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG);
 		if (PCI_HDRTYPE_MULTIFN(bhlcr) ||
 		    (qd != NULL &&
 		      (qd->quirks & PCI_QUIRK_MULTIFUNCTION) != 0))


Jun-ichiro itojun Hagino wrote:
> >	i cannot seem to boot NetBSD-current on Soekris Net4801
> >	(www.soekris.com).  i heard that there's some quirk/special handling
> >	needed on pci bus access, but i couldn't find the information source.
> >	does anyone remember what was the necessary fix?
> 
> 	more info on bootstrap (GENERIC kernel).  because it's double fault
> 	"trace" on DDB gives me nothing.
> 
> itojun
> 
> 
> % tip ttyU0
> connected
> 
> 
> POST: 0123456789bcefghipajklnoq,,,tvwxy
> comBIOS ver. 1.20  20030721  Copyright (C) 2000-2003 Soekris Engineering.
> 
> net4801
> 
>                                          CPU Geode 266 Mhz 0000 Mbyte Memory0128
> 
> Pri Mas  SanDisk SDCFB-1024              LBA Xlt 993-32-63  1001 Mbyte
> 
> PXE-M00: BootManage UNDI, PXE-2.0 (build 082)
> 
> Slot   Vend Dev  ClassRev Cmd  Stat CL LT HT  Base1    Base2   Int 
> -------------------------------------------------------------------
> 0:00:0 1078 0001 06000000 0107 0280 00 1F 00 00000000 00000000 00
> 0:06:0 100B 0020 02000000 0107 0290 00 3F 00 0000E101 A0000000 10
> 0:07:0 100B 0020 02000000 0107 0290 00 3F 00 0000E201 A0001000 10
> 0:08:0 100B 0020 02000000 0107 0290 00 3F 00 0000E301 A0002000 10
> 0:18:2 100B 0502 01018001 0005 0280 00 00 00 00000000 00000000 00
> 0:19:0 0E11 A0F8 0C031008 0117 0280 08 38 00 A0003000 00000000 11
> 
>    Seconds to automatic boot.   Press Ctrl-P for entering Monitor. 5 4 3 2 1
> 
> NetBSD/i386 ffsv1 Primary Bootstrap
> 
> 
> >> NetBSD/i386 BIOS, Revision 3.0
> >> (itojun@starfruit.itojun.org, Tue Aug 12 02:54:05 JST 2003)
> >> Memory: 639/130048 k
> Press return to boot now, any other key for boot menu
> booting hd0e:netbsd - starting in 5 4 3 2 1 0
> 6384368+133800+438404 [322272+294306]=0x73a0c4
> BIOS CFG: Model-SubM-Rev: fc-00-00, 0x7c<EBDA,WAITEV,KBDINT,RTC,IC2>
> Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
>     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 1.6W (NET4801) #5: Thu Aug 14 21:05:00 JST 2003
> 	itojun@starfruit.itojun.org:/home/itojun/NetBSD/src/sys/arch/i386/compile/NET4801
> total memory = 127 MB
> avail memory = 110 MB
> using 1659 buffers containing 6636 KB of memory
> BIOS32 rev. 0 found at 0xf7840
> mainbus0 (root)
> cpu0 at mainbus0: (uniprocessor)
> cpu0: National Semiconductor Geode GX1 (586-class), 266.64 MHz, id 0x540
> cpu0: features 808131<FPU,TSC,MSR,CX8>
> cpu0: features 808131<CMOV,MMX>
> cpu0: I-cache 12K uOp cache 8-way
> pci0 at mainbus0 bus 0: configuration mode 1
> pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
> pchb0 at pci0 dev 0 function 0
> pchb0: Cyrix Corporation MediaGX Built-in PCI Host Controller (rev. 0x00)
> sip0 at pci0 dev 6 function 0: NatSemi DP83815 10/100 Ethernet, rev 00
> sip0: interrupting at irq 10
> sip0: Ethernet address 00:00:24:c1:34:cc
> nsphyter0 at sip0 phy 0: DP83815 10/100 media interface, rev. 1
> nsphyter0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
> sip1 at pci0 dev 7 function 0: NatSemi DP83815 10/100 Ethernet, rev 00
> sip1: interrupting at irq 10
> sip1: Ethernet address 00:00:24:c1:34:cd
> nsphyter1 at sip1 phy 0: DP83815 10/100 media interface, rev. 1
> nsphyter1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
> sip2 at pci0 dev 8 function 0: NatSemi DP83815 10/100 Ethernet, rev 00
> sip2: interrupting at irq 10
> sip2: Ethernet address 00:00:24:c1:34:ce
> nsphyter2 at sip2 phy 0: DP83815 10/100 media interface, rev. 1
> nsphyter2: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
> pcib0 at pci0 dev 18 function 0
> pcib0: National Semiconductor product 0x0510 (rev. 0x00)
> kernel: double fault trap, code=0
> Stopped in pid 0.1 (swapper) at netbsd:pci_conf_read+0x82:      movl    netbsd:c
> pu_info_primary+0x10c,%eax
> db> ~
> [EOT]
> 

-- 
Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.cz/
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-