From owner-svn-src-head@FreeBSD.ORG Thu Nov 24 07:32:53 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25C2F1065675; Thu, 24 Nov 2011 07:32:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F08698FC14; Thu, 24 Nov 2011 07:32:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAO7Wqv4083408; Thu, 24 Nov 2011 07:32:52 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAO7WqU4083405; Thu, 24 Nov 2011 07:32:52 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201111240732.pAO7WqU4083405@svn.freebsd.org> From: Adrian Chadd Date: Thu, 24 Nov 2011 07:32:52 +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: r227924 - in head/sys: conf mips/atheros X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 24 Nov 2011 07:32:53 -0000 Author: adrian Date: Thu Nov 24 07:32:52 2011 New Revision: 227924 URL: http://svn.freebsd.org/changeset/base/227924 Log: Introduce a new (global, sorry!) option which controls whether the ar71xx platform code should assume a uboot or redboot environment. The current code gets very confused (and just crashes) on a uboot environment, where each attribute=value pair is in a single entry. Redboot on the other hand stores it as "attribute", "value", "attribute", "value", ... This allows the kernel to boot on a TP-LINK TL-WR1043ND from flash, where the uboot environment gets setup. This didn't show up during a netboot as "tftpboot" and "go" don't setup the uboot environment variables. Modified: head/sys/conf/options head/sys/mips/atheros/ar71xx_machdep.c Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu Nov 24 07:25:43 2011 (r227923) +++ head/sys/conf/options Thu Nov 24 07:32:52 2011 (r227924) @@ -899,4 +899,5 @@ RCTL opt_global.h # that "lies" about the amount of RAM it has. Until a cleaner method is # defined, this option will suffice in overriding what Redboot says. AR71XX_REALMEM opt_global.h - +AR71XX_ENV_UBOOT opt_global.h +AR71XX_ENV_REDBOOT opt_global.h Modified: head/sys/mips/atheros/ar71xx_machdep.c ============================================================================== --- head/sys/mips/atheros/ar71xx_machdep.c Thu Nov 24 07:25:43 2011 (r227923) +++ head/sys/mips/atheros/ar71xx_machdep.c Thu Nov 24 07:32:52 2011 (r227924) @@ -168,8 +168,8 @@ platform_start(__register_t a0 __unused, __register_t a2 __unused, __register_t a3 __unused) { uint64_t platform_counter_freq; - int argc, i; - char **argv, **envp; + int argc = 0, i; + char **argv = NULL, **envp = NULL; vm_offset_t kernend; /* @@ -184,9 +184,18 @@ platform_start(__register_t a0 __unused, /* Initialize pcpu stuff */ mips_pcpu0_init(); + /* + * Until some more sensible abstractions for uboot/redboot + * environment handling, we have to make this a compile-time + * hack. The existing code handles the uboot environment + * very incorrectly so we should just ignore initialising + * the relevant pointers. + */ +#ifndef AR71XX_ENV_UBOOT argc = a0; argv = (char**)a1; envp = (char**)a2; +#endif /* * Protect ourselves from garbage in registers */ @@ -255,6 +264,9 @@ platform_start(__register_t a0 __unused, printf(" a2 = %08x\n", a2); printf(" a3 = %08x\n", a3); + /* + * XXX this code is very redboot specific. + */ printf("Cmd line:"); if (MIPS_IS_VALID_PTR(argv)) { for (i = 0; i < argc; i++) {