Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm add BOOTOPT_TYPE_MACADDR for parsing mac addres...



details:   https://anonhg.NetBSD.org/src/rev/6a5019684d59
branches:  trunk
changeset: 335409:6a5019684d59
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Jan 06 00:43:21 2015 +0000

description:
add BOOTOPT_TYPE_MACADDR for parsing mac address parameters

diffstat:

 sys/arch/arm/arm/bootconfig.c     |  22 ++++++++++++++++++++--
 sys/arch/arm/include/bootconfig.h |   3 ++-
 2 files changed, 22 insertions(+), 3 deletions(-)

diffs (67 lines):

diff -r 3dfaf6d8b21d -r 6a5019684d59 sys/arch/arm/arm/bootconfig.c
--- a/sys/arch/arm/arm/bootconfig.c     Mon Jan 05 23:48:46 2015 +0000
+++ b/sys/arch/arm/arm/bootconfig.c     Tue Jan 06 00:43:21 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootconfig.c,v 1.7 2014/09/05 05:24:53 matt Exp $      */
+/*     $NetBSD: bootconfig.c,v 1.8 2015/01/06 00:43:21 jmcneill Exp $  */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -36,14 +36,20 @@
  * SUCH DAMAGE.
  */
 
+#include "ether.h"
+
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: bootconfig.c,v 1.7 2014/09/05 05:24:53 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootconfig.c,v 1.8 2015/01/06 00:43:21 jmcneill Exp $");
 
 #include <sys/systm.h>
 
 #include <machine/bootconfig.h>
 
+#if NETHER > 0
+#include <net/if_ether.h>
+#endif
+
 /* 
  * Function to identify and process different types of boot argument
  * Note, results may contain trailing data, eg:
@@ -116,6 +122,18 @@
                                        *((int *)result) =
                                            (u_int)strtoul(ptr, NULL, 16);
                                        break;
+#if NETHER > 0
+                               case BOOTOPT_TYPE_MACADDR : {
+                                       char mac[18];
+                                       if (strlen(ptr) < ETHER_ADDR_LEN)
+                                               return 0;
+                                       strlcpy(mac, ptr, sizeof(mac));
+                                       if (ether_aton_r((u_char *)result,
+                                                        ETHER_ADDR_LEN, mac))
+                                               return 0;
+                                       break;
+                               }
+#endif
                                default:
                                        return 0;
                                }
diff -r 3dfaf6d8b21d -r 6a5019684d59 sys/arch/arm/include/bootconfig.h
--- a/sys/arch/arm/include/bootconfig.h Mon Jan 05 23:48:46 2015 +0000
+++ b/sys/arch/arm/include/bootconfig.h Tue Jan 06 00:43:21 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootconfig.h,v 1.6 2012/08/31 23:59:52 matt Exp $      */
+/*     $NetBSD: bootconfig.h,v 1.7 2015/01/06 00:43:21 jmcneill Exp $  */
 
 /*
  * Copyright (c) 1994 Mark Brinicombe.
@@ -42,6 +42,7 @@
 #define BOOTOPT_TYPE_INT               2
 #define BOOTOPT_TYPE_BININT            3
 #define BOOTOPT_TYPE_HEXINT            4
+#define BOOTOPT_TYPE_MACADDR           5
 #define BOOTOPT_TYPE_MASK              7
 
 struct boot_physmem {



Home | Main Index | Thread Index | Old Index