Subject: Re: network problem with netra t1 105
To: Maxime Henrion <mux@qualys.com>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: port-sparc64
Date: 10/17/2001 15:20:22
--QKdGvSO+nmPlgiQ/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Oct 17, 2001 at 05:49:38PM +0200, Maxime Henrion wrote:

 > Here is the ls from the node above :
 > 
 > ok ls
 > f00955a4 network@3,1
 > f008f728 scsi@2
 > f0087b24 network@1,1
 > f006b390 ebus@1

Ok, this problem should now be fixed.  I just committed the diff
attached to this message.  Please try it and verify that both
HME devices are found.

Now to figure out what to do about the apparently-shared PHY
management bus...

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>

--QKdGvSO+nmPlgiQ/
Content-Type: text/plain; charset=us-ascii
Content-Description: pci_dev_funcorder.diff
Content-Disposition: attachment; filename=foo

Index: dev/pci/pci.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/pci/pci.c,v
retrieving revision 1.56
diff -c -r1.56 pci.c
*** dev/pci/pci.c	2001/09/13 21:49:40	1.56
--- dev/pci/pci.c	2001/10/17 22:08:38
***************
*** 127,133 ****
  	struct pci_softc *sc = (struct pci_softc *)self;
  	bus_space_tag_t iot, memt;
  	pci_chipset_tag_t pc;
- 	const struct pci_quirkdata *qd;
  	int bus, device, function, nfunctions, ret;
  #ifdef __PCI_BUS_DEVORDER
  	char devs[32];
--- 127,132 ----
***************
*** 136,141 ****
--- 135,142 ----
  #ifdef __PCI_DEV_FUNCORDER
  	char funcs[8];
  	int j;
+ #else
+ 	const struct pci_quirkdata *qd;
  #endif
  
  	iot = sc->sc_iot;
***************
*** 154,159 ****
--- 155,164 ----
  		struct pci_attach_args pa;
  		int pin;
  
+ #ifdef __PCI_DEV_FUNCORDER
+ 		pci_dev_funcorder(sc->sc_pc, sc->sc_bus, device, funcs);
+ 		nfunctions = 8;
+ #else
  		tag = pci_make_tag(pc, bus, device, 0);
  		id = pci_conf_read(pc, tag, PCI_ID_REG);
  
***************
*** 173,181 ****
  			nfunctions = 8;
  		else
  			nfunctions = 1;
  
  #ifdef __PCI_DEV_FUNCORDER
- 		pci_dev_funcorder(sc->sc_pc, sc->sc_bus, device, funcs);
  		for (j = 0; (function = funcs[j]) < nfunctions &&
  		    function >= 0; j++)
  #else
--- 178,186 ----
  			nfunctions = 8;
  		else
  			nfunctions = 1;
+ #endif /* __PCI_DEV_FUNCORDER */
  
  #ifdef __PCI_DEV_FUNCORDER
  		for (j = 0; (function = funcs[j]) < nfunctions &&
  		    function >= 0; j++)
  #else
Index: arch/sparc64/dev/pci_machdep.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sparc64/dev/pci_machdep.c,v
retrieving revision 1.24
diff -c -r1.24 pci_machdep.c
*** arch/sparc64/dev/pci_machdep.c	2001/09/15 19:32:14	1.24
--- arch/sparc64/dev/pci_machdep.c	2001/10/17 22:08:38
***************
*** 171,183 ****
  	}
  #endif
  	/*
! 	 * Functions are siblings.  Presumably we're only called when the
! 	 * first instance of this device is detected, so we should be able to
! 	 * get to all the other functions with OF_peer().  But there seems
! 	 * some issues with this scheme, so we always go to the first node on
! 	 * this bus segment for a scan.  
  	 */
! 	for (node = OF_child(OF_parent(node)); node; node = OF_peer(node)) {
  		len = OF_getproplen(node, "reg");
  		if (len < sizeof(reg))
  			continue;
--- 171,184 ----
  	}
  #endif
  	/*
! 	 * Initially, curnode is the root of the pci tree.  As we
! 	 * attach bridges, curnode should be set to that of the bridge.
! 	 *
! 	 * Note this search is almost exactly the same as pci_bus_devorder()'s,
! 	 * except that we limit the search to only those with a matching
! 	 * "device" number.
  	 */
! 	for (node = OF_child(node); node; node = OF_peer(node)) {
  		len = OF_getproplen(node, "reg");
  		if (len < sizeof(reg))
  			continue;

--QKdGvSO+nmPlgiQ/--