From owner-svn-src-all@FreeBSD.ORG Fri Sep 17 01:09:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D697C10656C3; Fri, 17 Sep 2010 01:09:12 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABB8D8FC0C; Fri, 17 Sep 2010 01:09:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8H19CDm013823; Fri, 17 Sep 2010 01:09:12 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8H19CZP013821; Fri, 17 Sep 2010 01:09:12 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201009170109.o8H19CZP013821@svn.freebsd.org> From: Andrew Thompson Date: Fri, 17 Sep 2010 01:09:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212774 - head/sys/mips/atheros X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2010 01:09:12 -0000 Author: thompsa Date: Fri Sep 17 01:09:12 2010 New Revision: 212774 URL: http://svn.freebsd.org/changeset/base/212774 Log: Use getenv to find the mac address since it could be in the bootloader environment or command line and under different names. Modified: head/sys/mips/atheros/ar71xx_machdep.c Modified: head/sys/mips/atheros/ar71xx_machdep.c ============================================================================== --- head/sys/mips/atheros/ar71xx_machdep.c Thu Sep 16 23:33:24 2010 (r212773) +++ head/sys/mips/atheros/ar71xx_machdep.c Fri Sep 17 01:09:12 2010 (r212774) @@ -145,7 +145,7 @@ platform_start(__register_t a0 __unused, { uint64_t platform_counter_freq; int argc, i, count = 0; - char **argv, **envp; + char **argv, **envp, *var; vm_offset_t kernend; /* @@ -167,19 +167,9 @@ platform_start(__register_t a0 __unused, * Protect ourselves from garbage in registers */ if (MIPS_IS_VALID_PTR(envp)) { - for (i = 0; envp[i]; i += 2) - { + for (i = 0; envp[i]; i += 2) { if (strcmp(envp[i], "memsize") == 0) realmem = btoc(strtoul(envp[i+1], NULL, 16)); - else if (strcmp(envp[i], "ethaddr") == 0) { - count = sscanf(envp[i+1], "%x.%x.%x.%x.%x.%x", - &ar711_base_mac[0], &ar711_base_mac[1], - &ar711_base_mac[2], &ar711_base_mac[3], - &ar711_base_mac[4], &ar711_base_mac[5]); - if (count < 6) - memset(ar711_base_mac, 0, - sizeof(ar711_base_mac)); - } } } @@ -245,6 +235,18 @@ platform_start(__register_t a0 __unused, else printf ("envp is invalid\n"); + if ((var = getenv("ethaddr")) != NULL || + (var = getenv("kmac")) != NULL) { + count = sscanf(var, "%x%*c%x%*c%x%*c%x%*c%x%*c%x", + &ar711_base_mac[0], &ar711_base_mac[1], + &ar711_base_mac[2], &ar711_base_mac[3], + &ar711_base_mac[4], &ar711_base_mac[5]); + if (count < 6) + memset(ar711_base_mac, 0, + sizeof(ar711_base_mac)); + freeenv(var); + } + init_param2(physmem); mips_cpu_init(); pmap_bootstrap();