Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbmips/ingenic add mechanism to pass a MAC address...



details:   https://anonhg.NetBSD.org/src/rev/b6f65418f41b
branches:  trunk
changeset: 340884:b6f65418f41b
user:      macallan <macallan%NetBSD.org@localhost>
date:      Thu Oct 08 17:51:15 2015 +0000

description:
add mechanism to pass a MAC address to dme

diffstat:

 sys/arch/evbmips/ingenic/autoconf.c |  27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diffs (56 lines):

diff -r 7ea2b59b40c9 -r b6f65418f41b sys/arch/evbmips/ingenic/autoconf.c
--- a/sys/arch/evbmips/ingenic/autoconf.c       Thu Oct 08 13:43:16 2015 +0000
+++ b/sys/arch/evbmips/ingenic/autoconf.c       Thu Oct 08 17:51:15 2015 +0000
@@ -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 @@
 #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 @@
 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;
+}



Home | Main Index | Thread Index | Old Index