Netra X1 - Status query and stupid question

Marius Strobl marius at alchemy.franken.de
Thu Aug 21 16:31:09 PDT 2003


On Thu, Aug 21, 2003 at 11:47:15PM +0100, Pete Bentley wrote:
> On Monday, August 4, 2003, at 05:42 PM, Maxime Henrion wrote:
> >>> On Mon, Jul 28, 2003 at 12:51:34PM +0100, Pete Bentley wrote:
> >>>> Just wondering what the status is with regard to drivers for
> >>>> the X1's onboard Davicom ethernet?  [...]
> >>>
> > Sorry for bringing bad news, but it probably won't work yet.  First, it
> > seems integrated dc(4) cards in Netra X1's have their MAC address set  
> > to
> > 00:00:00:00:00:00.  This can probably be worked around by setting the
> > MAC via ``ifconfig ether''.
> 
> Seems to work well enough to get the machine going as a self-hosted
> development system.
> 
> As you say, the MAC addresses start off zeroed but I've bodged around
> that for now with a cheesey hack in rc.d/netif.
> 

Just curious, could you please try the attached patch and check if the
MAC addresses get set and then set local-mac-address in the OpenFirmware
and check again if the dc interfaces get different MAC addresses?
The patch should work (I'm just not sure about the different MAC addresses
part), however Maxime doesn't want to have this in the device driver but
at a higher level.
Thanks.

Marius

-------------- next part --------------
--- if_dc.c.orig	Wed Jul  9 13:54:05 2003
+++ if_dc.c	Wed Jul  9 16:47:15 2003
@@ -124,6 +124,13 @@
 #include <pci/pcireg.h>
 #include <pci/pcivar.h>
 
+#ifdef __sparc64__
+#include "opt_ofw_pci.h"
+#include <ofw/openfirm.h>
+#include <machine/ofw_machdep.h>
+#include <sparc64/pci/ofw_pci.h>
+#endif
+
 #define DC_USEIOSPACE
 #ifdef __alpha__
 #define SRM_MEDIA
@@ -1842,6 +1849,9 @@
 	int unit, error = 0, rid, mac_offset;
 	int i;
 	u_int8_t *mac;
+#ifdef __sparc64__
+	phandle_t node;
+#endif
 
 	sc = device_get_softc(dev);
 	unit = device_get_unit(dev);
@@ -2059,7 +2069,6 @@
 	case DC_TYPE_PNIC:
 		dc_read_eeprom(sc, (caddr_t)&eaddr, 0, 3, 1);
 		break;
-	case DC_TYPE_DM9102:
 	case DC_TYPE_21143:
 	case DC_TYPE_ASIX:
 		dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0);
@@ -2073,6 +2082,23 @@
 	case DC_TYPE_CONEXANT:
 		bcopy(sc->dc_srom + DC_CONEXANT_EE_NODEADDR, &eaddr,
 		    ETHER_ADDR_LEN);
+		break;
+	case DC_TYPE_DM9102:
+		dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0);
+#ifdef __sparc64__
+		for (i = 0; i < ETHER_ADDR_LEN; i++)
+			if (eaddr[i] != 0x00)
+				goto done;
+#ifdef OFW_NEWPCI
+		node = ofw_pci_get_node(dev);
+#else
+		node = ofw_pci_node(dev);
+#endif
+		if (OF_getprop(node, "local-mac-address", eaddr,
+			sizeof(eaddr)) == -1)
+			OF_getetheraddr(dev, eaddr);
+done:
+#endif
 		break;
 	case DC_TYPE_XIRCOM:
 		/* The MAC comes from the CIS. */


More information about the freebsd-sparc64 mailing list