Module Name:    src
Committed By:   macallan
Date:           Thu Oct  8 17:51:15 UTC 2015

Modified Files:
        src/sys/arch/evbmips/ingenic: autoconf.c

Log Message:
add mechanism to pass a MAC address to dme


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbmips/ingenic/autoconf.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/evbmips/ingenic/autoconf.c
diff -u src/sys/arch/evbmips/ingenic/autoconf.c:1.1 src/sys/arch/evbmips/ingenic/autoconf.c:1.2
--- src/sys/arch/evbmips/ingenic/autoconf.c:1.1	Sat Nov 22 15:17:02 2014
+++ src/sys/arch/evbmips/ingenic/autoconf.c	Thu Oct  8 17:51:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.1 2014/11/22 15:17:02 macallan Exp $ */
+/* $NetBSD: autoconf.c,v 1.2 2015/10/08 17:51:15 macallan Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.1 2014/11/22 15:17:02 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2 2015/10/08 17:51:15 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -38,6 +38,12 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 #include <sys/device.h>
 #include <sys/systm.h>
 
+#include <net/if_ether.h>
+
+static uint8_t enaddr[ETHER_ADDR_LEN];
+static int have_enaddr = false;
+void ingenic_set_enaddr(uint8_t *);
+
 /*
  * Configure all devices on system
  */     
@@ -63,7 +69,24 @@ cpu_rootconf(void)
 void
 device_register(device_t dev, void *aux)
 {
+	if (device_is_a(dev, "dme") && have_enaddr) {
+		prop_dictionary_t dict;
+		prop_data_t blob;
+		
+		dict = device_properties(dev);
+
+		blob = prop_data_create_data(enaddr, ETHER_ADDR_LEN);
+		prop_dictionary_set(dict, "mac-address", blob);
+		prop_object_release(blob);
+	}
 #ifdef notyet
 	(*platformsw->apsw_device_register)(dev, aux);
 #endif
 }
+
+void
+ingenic_set_enaddr(uint8_t *goop)
+{
+	memcpy(enaddr, goop, ETHER_ADDR_LEN);
+	have_enaddr = true;
+}

Reply via email to