summaryrefslogtreecommitdiffstats
path: root/sys/mips
diff options
context:
space:
mode:
authorsbruno <sbruno@FreeBSD.org>2013-08-23 13:14:18 +0000
committersbruno <sbruno@FreeBSD.org>2013-08-23 13:14:18 +0000
commitb3ff490a67fc990a3408ce0a28c1b4faa9fc7eed (patch)
tree5e9af8962fcf702f770259d42dbcc97fbe41c65d /sys/mips
parent0b1317fbf9030ee2b7584c0a0cdcf55cc109121f (diff)
downloadFreeBSD-src-b3ff490a67fc990a3408ce0a28c1b4faa9fc7eed.zip
FreeBSD-src-b3ff490a67fc990a3408ce0a28c1b4faa9fc7eed.tar.gz
Some vendors store the mac addresses of arge(4) as a literal sring in the
form xx:xx:xx:xx:xx:xx complete with ":" characters taking of 18 bytes instead of 6 integers. Expose a "readascii" tuneable to handle this case. Remove restriction on eepromac assignement for the first dev instance only. Add eepromac address for DIR-825 to hints file. Add readascii hint for DIR-825 Reviewed by: adrian@
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/atheros/if_arge.c21
-rw-r--r--sys/mips/conf/DIR-825.hints7
2 files changed, 21 insertions, 7 deletions
diff --git a/sys/mips/atheros/if_arge.c b/sys/mips/atheros/if_arge.c
index 7e933df..6487ea4 100644
--- a/sys/mips/atheros/if_arge.c
+++ b/sys/mips/atheros/if_arge.c
@@ -371,6 +371,7 @@ arge_attach(device_t dev)
uint32_t hint;
long eeprom_mac_addr = 0;
int miicfg = 0;
+ int readascii = 0;
sc = device_get_softc(dev);
sc->arge_dev = dev;
@@ -384,16 +385,28 @@ arge_attach(device_t dev)
* Since multiple units seem to use this feature, include
* a method of setting the MAC address based on an flash location
* in CPU address space.
+ *
+ * Some vendors have decided to store the mac address as a literal
+ * string of 18 characters in xx:xx:xx:xx:xx:xx format instead of
+ * an array of numbers. Expose a hint to turn on this conversion
+ * feature via strtol()
*/
- if (sc->arge_mac_unit == 0 &&
- resource_long_value(device_get_name(dev), device_get_unit(dev),
+ if (resource_long_value(device_get_name(dev), device_get_unit(dev),
"eeprommac", &eeprom_mac_addr) == 0) {
int i;
const char *mac =
(const char *) MIPS_PHYS_TO_KSEG1(eeprom_mac_addr);
device_printf(dev, "Overriding MAC from EEPROM\n");
- for (i = 0; i < 6; i++) {
- ar711_base_mac[i] = mac[i];
+ if (resource_int_value(device_get_name(dev), device_get_unit(dev),
+ "readascii", &readascii) == 0) {
+ device_printf(dev, "Vendor stores MAC in ASCII format\n");
+ for (i = 0; i < 6; i++) {
+ ar711_base_mac[i] = strtol(&(mac[i*3]), NULL, 16);
+ }
+ } else {
+ for (i = 0; i < 6; i++) {
+ ar711_base_mac[i] = mac[i];
+ }
}
}
diff --git a/sys/mips/conf/DIR-825.hints b/sys/mips/conf/DIR-825.hints
index 0fe0196..2ffd1b7 100644
--- a/sys/mips/conf/DIR-825.hints
+++ b/sys/mips/conf/DIR-825.hints
@@ -6,13 +6,14 @@
hint.arge.0.phymask=0x0
hint.arge.0.media=1000
hint.arge.0.fduplex=1
-
-# XXX grab these from uboot?
-# hint.arge.0.eeprommac=0x1f01fc00
+hint.arge.0.eeprommac=0x1f66ffa0
+hint.arge.0.readascii=1
hint.arge.1.phymask=0x0
hint.arge.1.media=1000
hint.arge.1.fduplex=1
+hint.arge.1.eeprommac=0x1f66ffb4
+hint.arge.1.readascii=1
# ath0 - slot 17
hint.pcib.0.bus.0.17.0.ath_fixup_addr=0x1f661000
OpenPOWER on IntegriCloud