Subject: Re: tlp(4) is unable to detect phy.
To: Jochen Kunz <jkunz@unixag-kl.fh-kl.de>
From: Charles M. Hannum <abuse@spamalicious.com>
List: tech-kern
Date: 07/18/2004 22:07:16
--Boundary-00=_VSv+A6eVdRrZTjD
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Sunday 18 July 2004 19:56, Jochen Kunz wrote:
> On my mission to bring port-hp700 PCI support I came acros a problem
> with the build in tlp(4) interface found in B-Class machines. I pluged a
> DEC DE500 PCI card in one PCI slot (PCI dev 2) that works fine. tlp(4)
> is unable to detect the phy of the on board interface (PCI dev 20). As I
> am not a tlp(4) / mii(4) expert I hope someone else can see what is
> going wrong. Below is the output of a NetBSD and an OpenBSD kernel with
> SROM debug enabled. OpenBSD can handle the on board tlp(4) / dc(4) just
> fine.

It looks like the FreeBSD dc driver (which OpenBSD copied) always calls 
mii_attach(), so the fact that the SROM contents are bogus doesn't matter.  
Does the following patch help?

--Boundary-00=_VSv+A6eVdRrZTjD
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="tulip.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="tulip.diff"

Index: tulip.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/tulip.c,v
retrieving revision 1.127
diff -u -r1.127 tulip.c
--- tulip.c	2 Jul 2004 19:53:31 -0000	1.127
+++ tulip.c	18 Jul 2004 22:07:20 -0000
@@ -4619,6 +4619,12 @@
 	/* Get the media count. */
 	m_cnt = *cp++;
 
+	if (m_cnt == 0) {
+		sc->sc_mediasw = &tlp_sio_mii_mediasw;
+		(*sc->sc_mediasw->tmsw_init)(sc);
+		return;
+	}
+
 	for (; m_cnt != 0; cp = ncp, m_cnt--) {
 		/*
 		 * Determine the type and length of this media block.

--Boundary-00=_VSv+A6eVdRrZTjD--