From owner-svn-src-stable@FreeBSD.ORG Tue Apr 29 00:36:53 2014 Return-Path: Delivered-To: svn-src-stable@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 ESMTPS id 48FC4465; Tue, 29 Apr 2014 00:36:53 +0000 (UTC) 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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34EB4163C; Tue, 29 Apr 2014 00:36:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3T0arfY028996; Tue, 29 Apr 2014 00:36:53 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3T0aqKj028991; Tue, 29 Apr 2014 00:36:52 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201404290036.s3T0aqKj028991@svn.freebsd.org> From: Ian Lepore Date: Tue, 29 Apr 2014 00:36:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r265069 - in stable/10/sys/boot: fdt uboot/common uboot/lib X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Apr 2014 00:36:53 -0000 Author: ian Date: Tue Apr 29 00:36:51 2014 New Revision: 265069 URL: http://svnweb.freebsd.org/changeset/base/265069 Log: MFC r262664, r262694: Prevent fdt data loaded from a file from overwriting the kernel environment, by having uboot_autoload() do the fdt setup (which may load a file) rather than waiting until we're actually in the process of launching the kernel. As part of making this happen... - Define LOADER_FDT_SUPPORT on the uboot/lib compile command line when MK_FDT is set. - Make fdt_setup_fdtb() public. - Declare public fdt_whatever() functions in a header instead of using scattered extern decls in .c files. Modified: stable/10/sys/boot/fdt/fdt_loader_cmd.c stable/10/sys/boot/uboot/common/metadata.c stable/10/sys/boot/uboot/lib/Makefile stable/10/sys/boot/uboot/lib/libuboot.h stable/10/sys/boot/uboot/lib/module.c Modified: stable/10/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- stable/10/sys/boot/fdt/fdt_loader_cmd.c Tue Apr 29 00:31:32 2014 (r265068) +++ stable/10/sys/boot/fdt/fdt_loader_cmd.c Tue Apr 29 00:36:51 2014 (r265069) @@ -279,7 +279,7 @@ fdt_load_dtb_file(const char * filename) return (0); } -static int +int fdt_setup_fdtp() { struct preloaded_file *bfp; Modified: stable/10/sys/boot/uboot/common/metadata.c ============================================================================== --- stable/10/sys/boot/uboot/common/metadata.c Tue Apr 29 00:31:32 2014 (r265068) +++ stable/10/sys/boot/uboot/common/metadata.c Tue Apr 29 00:36:51 2014 (r265069) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include "glue.h" #if defined(LOADER_FDT_SUPPORT) -extern int fdt_copy(vm_offset_t); +#include "libuboot.h" #endif /* Modified: stable/10/sys/boot/uboot/lib/Makefile ============================================================================== --- stable/10/sys/boot/uboot/lib/Makefile Tue Apr 29 00:31:32 2014 (r265068) +++ stable/10/sys/boot/uboot/lib/Makefile Tue Apr 29 00:36:51 2014 (r265069) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + .PATH: ${.CURDIR}/../../common LIB= uboot @@ -18,6 +20,16 @@ SRCS+= disk.c CFLAGS+= -DLOADER_DISK_SUPPORT .endif +.if ${MK_FDT} != "no" +LOADER_FDT_SUPPORT= yes +.else +LOADER_FDT_SUPPORT= no +.endif + +.if ${LOADER_FDT_SUPPORT} == "yes" +CFLAGS+= -DLOADER_FDT_SUPPORT +.endif + # Pick up FDT includes CFLAGS+= -I${.CURDIR}/../../../../sys/contrib/libfdt/ Modified: stable/10/sys/boot/uboot/lib/libuboot.h ============================================================================== --- stable/10/sys/boot/uboot/lib/libuboot.h Tue Apr 29 00:31:32 2014 (r265068) +++ stable/10/sys/boot/uboot/lib/libuboot.h Tue Apr 29 00:36:51 2014 (r265069) @@ -69,3 +69,9 @@ struct file_format; extern struct file_format uboot_elf; void reboot(void); + +#if defined(LOADER_FDT_SUPPORT) +extern int fdt_setup_fdtp(); +extern int fdt_copy(vm_offset_t); +#endif + Modified: stable/10/sys/boot/uboot/lib/module.c ============================================================================== --- stable/10/sys/boot/uboot/lib/module.c Tue Apr 29 00:31:32 2014 (r265068) +++ stable/10/sys/boot/uboot/lib/module.c Tue Apr 29 00:36:51 2014 (r265069) @@ -29,19 +29,23 @@ __FBSDID("$FreeBSD$"); /* * U-Boot-specific module functionality. - * - * XXX not much for now... - * */ #include #include #include "bootstrap.h" +#include "libuboot.h" int uboot_autoload(void) { +#if defined(LOADER_FDT_SUPPORT) + int err; + + if ((err = fdt_setup_fdtp()) != 0) + return (err); +#endif return(0); }