From owner-freebsd-sparc64@FreeBSD.ORG Thu Aug 21 16:31:09 2003 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6C81E16A4BF for ; Thu, 21 Aug 2003 16:31:09 -0700 (PDT) Received: from newtrinity.zeist.de (newtrinity.zeist.de [217.24.217.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2E02743FA3 for ; Thu, 21 Aug 2003 16:31:08 -0700 (PDT) (envelope-from marius@newtrinity.zeist.de) Received: from newtrinity.zeist.de (localhost [127.0.0.1]) h7LNV6lc024655; Fri, 22 Aug 2003 01:31:06 +0200 (CEST) (envelope-from marius@newtrinity.zeist.de) Received: (from marius@localhost) by newtrinity.zeist.de (8.12.9/8.12.9/Submit) id h7LNV1xu024654; Fri, 22 Aug 2003 01:31:01 +0200 (CEST) (envelope-from marius) Date: Fri, 22 Aug 2003 01:31:01 +0200 From: Marius Strobl To: Pete Bentley Message-ID: <20030822013101.A24406@newtrinity.zeist.de> References: <20030804164248.GG65432@elvis.mu.org> <6908317B-D429-11D7-A4E7-000A959F6E56@sorted.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="+g7M9IMkV8truYOl" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <6908317B-D429-11D7-A4E7-000A959F6E56@sorted.org>; from pete@sorted.org on Thu, Aug 21, 2003 at 11:47:15PM +0100 cc: freebsd-sparc64@freebsd.org Subject: Re: Netra X1 - Status query and stupid question X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Aug 2003 23:31:09 -0000 --+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 #include +#ifdef __sparc64__ +#include "opt_ofw_pci.h" +#include +#include +#include +#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--