From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 13:14:19 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 5C0E79AB; Fri, 23 Aug 2013 13:14:19 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3B715266F; Fri, 23 Aug 2013 13:14:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7NDEJIl048843; Fri, 23 Aug 2013 13:14:19 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NDEImx048841; Fri, 23 Aug 2013 13:14:18 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201308231314.r7NDEImx048841@svn.freebsd.org> From: Sean Bruno Date: Fri, 23 Aug 2013 13:14:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254690 - in head/sys/mips: atheros conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2013 13:14:19 -0000 Author: sbruno Date: Fri Aug 23 13:14:18 2013 New Revision: 254690 URL: http://svnweb.freebsd.org/changeset/base/254690 Log: 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@ Modified: head/sys/mips/atheros/if_arge.c head/sys/mips/conf/DIR-825.hints Modified: head/sys/mips/atheros/if_arge.c ============================================================================== --- head/sys/mips/atheros/if_arge.c Fri Aug 23 12:42:13 2013 (r254689) +++ head/sys/mips/atheros/if_arge.c Fri Aug 23 13:14:18 2013 (r254690) @@ -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]; + } } } Modified: head/sys/mips/conf/DIR-825.hints ============================================================================== --- head/sys/mips/conf/DIR-825.hints Fri Aug 23 12:42:13 2013 (r254689) +++ head/sys/mips/conf/DIR-825.hints Fri Aug 23 13:14:18 2013 (r254690) @@ -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