Module Name:    src
Committed By:   jmcneill
Date:           Tue Jan  6 00:52:26 UTC 2015

Modified Files:
        src/sys/arch/evbarm/awin: awin_machdep.c

Log Message:
use BOOTOPT_TYPE_MACADDR


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/evbarm/awin/awin_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/awin/awin_machdep.c
diff -u src/sys/arch/evbarm/awin/awin_machdep.c:1.38 src/sys/arch/evbarm/awin/awin_machdep.c:1.39
--- src/sys/arch/evbarm/awin/awin_machdep.c:1.38	Sun Jan  4 15:59:32 2015
+++ src/sys/arch/evbarm/awin/awin_machdep.c	Tue Jan  6 00:52:26 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: awin_machdep.c,v 1.38 2015/01/04 15:59:32 martin Exp $ */
+/*	$NetBSD: awin_machdep.c,v 1.39 2015/01/06 00:52:26 jmcneill Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_machdep.c,v 1.38 2015/01/04 15:59:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_machdep.c,v 1.39 2015/01/06 00:52:26 jmcneill Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -783,28 +783,18 @@ awin_device_register(device_t self, void
 		return;
 	}
 
-	if (device_is_a(self, "awge")) {
+	if (device_is_a(self, "awge") && device_unit(self) == 0) {
 #if NETHER > 0
 		/*
 		 * Get the GMAC MAC address from cmdline.
 		 */
 		uint8_t enaddr[ETHER_ADDR_LEN];
-		char argname[strlen("awge?.mac-address") + 1];
-		char *mac_addr;
-		snprintf(argname, sizeof(argname), "%s.mac-address",
-		    device_xname(self));
-
-		if (get_bootconf_option(boot_args, argname,
-		    BOOTOPT_TYPE_STRING, &mac_addr)) {
-			char mac[strlen("XX:XX:XX:XX:XX:XX") + 1];
-			strlcpy(mac, mac_addr, sizeof(mac));
-			if (!ether_aton_r(enaddr, sizeof(enaddr), mac)) {
-				prop_data_t pd;
-				pd = prop_data_create_data(enaddr, sizeof(enaddr));
-				KASSERT(pd != NULL);
-				prop_dictionary_set(dict, "mac-address", pd);
-				prop_object_release(pd);
-			}
+		if (get_bootconf_option(boot_args, "awge0.mac-address",
+		    BOOTOPT_TYPE_MACADDR, enaddr)) {
+			prop_data_t pd = prop_data_create_data(enaddr,
+			    sizeof(enaddr));
+			prop_dictionary_set(dict, "mac-address", pd);
+			prop_object_release(pd);
 		}
 #endif
 

Reply via email to