Module Name: src Committed By: martin Date: Wed Jan 20 15:45:52 UTC 2010
Modified Files: src/sys/arch/sparc64/sparc64: autoconf.c Log Message: Add the mac address as device property "mac-address" to all devices that look like a network interface. Also add a boolean "without-seeprom" to all apparently on-board network interface (which usually have no eeprom of their own on Suns), this latter can be used to enable driver hacks. To generate a diff of this commit: cvs rdiff -u -r1.163 -r1.164 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/autoconf.c diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.163 src/sys/arch/sparc64/sparc64/autoconf.c:1.164 --- src/sys/arch/sparc64/sparc64/autoconf.c:1.163 Sun Jan 10 13:52:06 2010 +++ src/sys/arch/sparc64/sparc64/autoconf.c Wed Jan 20 15:45:52 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.163 2010/01/10 13:52:06 martin Exp $ */ +/* $NetBSD: autoconf.c,v 1.164 2010/01/20 15:45:52 martin Exp $ */ /* * Copyright (c) 1996 @@ -48,7 +48,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.163 2010/01/10 13:52:06 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.164 2010/01/20 15:45:52 martin Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -76,6 +76,7 @@ #include <prop/proplib.h> #include <net/if.h> +#include <net/if_ether.h> #include <dev/cons.h> #include <sparc64/dev/cons.h> @@ -906,17 +907,45 @@ return; if (ofnode != 0) { - char devtype[32]; + uint8_t eaddr[ETHER_ADDR_LEN]; + char tmpstr[32]; uint64_t nwwn = 0, pwwn = 0; prop_dictionary_t dict; + prop_data_t blob; prop_number_t pwwnd = NULL, nwwnd = NULL; device_setofnode(dev, ofnode); dev_path_exact_match(dev, ofnode); + if (OF_getprop(ofnode, "name", tmpstr, sizeof(tmpstr)) <= 0) + tmpstr[0] = 0; + + /* + * If this is a network interface, note the + * mac address. + */ + if (strcmp(tmpstr, "network") == 0 + || strcmp(tmpstr, "ethernet") == 0 + || OF_getprop(ofnode, "mac-address", &eaddr, sizeof(eaddr)) + == sizeof(eaddr)) { + prom_getether(ofnode, eaddr); + dict = device_properties(dev); + blob = prop_data_create_data(eaddr, ETHER_ADDR_LEN); + prop_dictionary_set(dict, "mac-address", blob); + prop_object_release(blob); + } + /* + * Is it a network interface with FCode? (others are called + * "ethernet" by the firmware) + */ + if (strcmp(tmpstr, "network") == 0) { + dict = device_properties(dev); + prop_dictionary_set_bool(dict, "without-seeprom", true); + } + /* is this a FC node? */ - if (OF_getprop(ofnode, "device_type", devtype, - sizeof(devtype)) > 0 && strcmp(devtype, "scsi-fcp") == 0) { + if (OF_getprop(ofnode, "device_type", tmpstr, + sizeof(tmpstr)) > 0 && strcmp(tmpstr, "scsi-fcp") == 0) { dict = device_properties(dev);