Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Aug 2003 01:31:01 +0200
From:      Marius Strobl <marius@alchemy.franken.de>
To:        Pete Bentley <pete@sorted.org>
Cc:        freebsd-sparc64@freebsd.org
Subject:   Re: Netra X1 - Status query and stupid question
Message-ID:  <20030822013101.A24406@newtrinity.zeist.de>
In-Reply-To: <6908317B-D429-11D7-A4E7-000A959F6E56@sorted.org>; from pete@sorted.org on Thu, Aug 21, 2003 at 11:47:15PM %2B0100
References:  <20030804164248.GG65432@elvis.mu.org> <6908317B-D429-11D7-A4E7-000A959F6E56@sorted.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--+g7M9IMkV8truYOl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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


--+g7M9IMkV8truYOl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="sys_pci_if_dc.c.diff"

--- 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. */

--+g7M9IMkV8truYOl--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030822013101.A24406>