Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/evbarm/awin use BOOTOPT_TYPE_MACADDR



details:   https://anonhg.NetBSD.org/src/rev/8ee72bf64200
branches:  trunk
changeset: 805554:8ee72bf64200
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Jan 06 00:52:26 2015 +0000

description:
use BOOTOPT_TYPE_MACADDR

diffstat:

 sys/arch/evbarm/awin/awin_machdep.c |  28 +++++++++-------------------
 1 files changed, 9 insertions(+), 19 deletions(-)

diffs (54 lines):

diff -r 80ba885ed212 -r 8ee72bf64200 sys/arch/evbarm/awin/awin_machdep.c
--- a/sys/arch/evbarm/awin/awin_machdep.c       Tue Jan 06 00:45:45 2015 +0000
+++ b/sys/arch/evbarm/awin/awin_machdep.c       Tue Jan 06 00:52:26 2015 +0000
@@ -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 @@
                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
 



Home | Main Index | Thread Index | Old Index