Subject: Re: hme sbus mac address question
To: Julian Coleman <jdc@coris.org.uk>
From: Anthony Sofia <anthony@dryhump.net>
List: port-sparc
Date: 01/22/2004 06:23:26
Thanks! I will try this out tonight and let you know.

On Thu, Jan 22, 2004 at 07:37:41AM +0000, Julian Coleman said:
>> I have a sparcstation5 with a qfe card in it. Each hme interface on this
>> card has it's own mac address which i confirmed in openboot, but it does not
>> appear our hme sbus driver supports using the local mac address, instead the
>> mac address of the system is used. Is there anything I am missing wrt using
>> the local mac address for each hme interface?
>
>Had a chance to look at this last night.  I think I have most of the code
>done but I'm not 100% sure of the format of the "local-mac-address" property
>in the card (I only have an HME, which doesn't have the "local-mac-address"
>property).  Can you try the attached patch which will show the contents of
>the "local-mac-address" and "mac-address" properties and send me the
>relevant parts of `dmesg`, please?
>
>J
>
>-- 
>  My other computer also runs NetBSD    /        Sailing at Newbiggin
>        http://www.netbsd.org/        /   http://www.newbigginsailingclub.org/  

>--- /usr/cvs/src/sys/dev/sbus/if_hme_sbus.c	Tue Dec 10 13:44:47 2002
>+++ if_hme_sbus.c	Thu Jan 22 07:28:10 2004
>@@ -99,7 +99,7 @@
> 	struct hme_softc *sc = &hsc->hsc_hme;
> 	struct sbusdev *sd = &hsc->hsc_sbus;
> 	u_int32_t burst, sbusburst;
>-	int node;
>+	int node, optionsnode;
> 
> 	/* XXX the following declarations should be elsewhere */
> 	extern void myetheraddr __P((u_char *));
>@@ -172,6 +172,31 @@
> 
> 	sd->sd_reset = (void *)hme_reset;
> 	sbus_establish(sd, self);
>+
>+	/*
>+	 * Check the "local-mac-address?" option and the nodes'
>+	 * "local-mac-address" and "mac-address" properties for a local
>+	 * MAC addresses.  Only the QFE card has "local-mac-address" but
>+	 * "mac-address" can be set when net-booting.
>+	 */
>+	optionsnode = prom_findnode(prom_firstchild(prom_findroot()),
>+	    "options");
>+	if (strcmp(PROM_getpropstring(optionsnode,
>+	    "local-mac-address?"), "true") == 0) {
>+		int nitem = 1;
>+		int err;
>+		char *bufp = NULL;
>+		printf("\"local-mac-address?\" option set\n");
>+		err = PROM_getprop(node, "local-mac-address", 1, &nitem, &bufp);
>+		bufp[nitem]='\0';
>+		printf("\"local-mac-address\" %s (%d) (%d)\n", bufp, nitem, err);
>+		free(bufp, M_DEVBUF);
>+		nitem = 1;
>+		err = PROM_getprop(node, "mac-address", 1, &nitem, &bufp);
>+		bufp[nitem]='\0';
>+		printf("\"mac-address\" %s (%d) (%d)\n", bufp, nitem, err);
>+		free(bufp, M_DEVBUF);
>+	}
> 
> 	myetheraddr(sc->sc_enaddr);
> 

Anthony Sofia (anthony@dryhump.net)
--
I'll take care of those murderous trolls.