Subject: kern/17949: panic 'no media present' in pcn/nsphy
To: None <gnats-bugs@gnats.netbsd.org>
From: None <rb-netbsd@bigscarychildren.net>
List: netbsd-bugs
Date: 08/15/2002 09:35:49
>Number:         17949
>Category:       kern
>Synopsis:       panic on boot with pcn driver - 'no media present'
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 15 06:39:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Rick Byers
>Release:        NetBSD 1.6_RC1 - 20020812
>Organization:
>Environment:
System: NetBSD new.iaw.on.ca 1.6_RC1 NetBSD 1.6_RC1 (CANAL) #1: Wed Aug 14 14:19:27 EDT 2002 root@new.iaw.on.ca:/usr/src/sys/arch/i386/compile/CANAL i386
Architecture: i386
Machine: i386
>Description:

On an "IBM PC Server 325" (on board ethernet), with a GENERIC or INSTALL 
1.6_RC1 kernel, I get:

pcn0 at pci1 dev5 function 0: AMD PCnet-PCI Ethernet
pcn0: Am79c971 PCnet-FAST rev 5
nsphy0 at pcn0 phy1: DP8384 10/100 media interface, rev. 1
nsphy0: no media present
ifmedia_set: no match for 0x20/0xffffffff
panic: ifmedia_set

Under NetBSD-1.5.3 or if I disable the pcn driver and use the le 
driver it works fine:

le0 at pci1 dev 5 funct ion 0: PCnet-PCI Ethernet
le0: address 00:60:94:57:3b:b9
le0: 8 receive buffers, 2 transmit buffers
le0: interrupting at irq 14

If I boot the computer with the ethernet cable removed from the card, it 
boots fine:

pcn0 at pci1 dev 5 function 0: AMD PCnet-PCI Ethernet
pcn0: Am79c971 PCnet-FAST rev 5, Ethernet address 00:60:94:57:3b:b9
pcn0: interrupting at irq 14
nsphy0 at pcn0 phy 1: DP83840 10/100 media interface, rev. 1
nsphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto

If I then plug the cable back in, the interface appears to work properly!

>How-To-Repeat:
	Just try booting a kernel with the pcn driver on an IBM PC Server 
	325, or presumably any other machine with the same version of the
	on-board PCnet interface.
>Fix:
	The panic is caused by line 2066 of if_pcn.c (1.9.4.1).  If a PHY
	is present, it assumes that media types exist.  It should 
	probably also verify that the PHY has media types before calling
	ifmedia_set.  However, although this prevents the panic, the
	interface will not function properly.  Something needs to be done
	to properly get the meida types, or work around the hardware bug
	if thats the case.  I'm not sure how to debug this further.

>Release-Note:
>Audit-Trail:
>Unformatted: