From 47264cb680ee97408a92ef8024769f9b4d09add5 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Sat, 1 Nov 2014 10:50:18 +0000 Subject: [PATCH] Move the definitions of the fdt functions from a uboot header to a new fdt header. There is nothing in the fdt spec that ties it to U-Boot. While here sort and fix the signature of fdt_setup_fdtp. MFC after: 1 week --- sys/boot/fdt/fdt_loader_cmd.c | 1 + sys/boot/fdt/fdt_platform.h | 35 ++++++++++++++++++++++++++++++++ sys/boot/uboot/common/metadata.c | 2 +- sys/boot/uboot/lib/Makefile | 2 +- sys/boot/uboot/lib/libuboot.h | 5 ----- sys/boot/uboot/lib/module.c | 4 ++++ 6 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 sys/boot/fdt/fdt_platform.h diff --git a/sys/boot/fdt/fdt_loader_cmd.c b/sys/boot/fdt/fdt_loader_cmd.c index 7f5d5cd7e147..4f1b6756148d 100644 --- a/sys/boot/fdt/fdt_loader_cmd.c +++ b/sys/boot/fdt/fdt_loader_cmd.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include "bootstrap.h" +#include "fdt_platform.h" #include "glue.h" #ifdef DEBUG diff --git a/sys/boot/fdt/fdt_platform.h b/sys/boot/fdt/fdt_platform.h new file mode 100644 index 000000000000..eb9e4976ea4f --- /dev/null +++ b/sys/boot/fdt/fdt_platform.h @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2014 Andrew Turner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef FDT_PLATFORM_H +#define FDT_PLATFORM_H + +extern int fdt_copy(vm_offset_t); +extern int fdt_setup_fdtp(void); + +#endif /* FDT_PLATFORM_H */ diff --git a/sys/boot/uboot/common/metadata.c b/sys/boot/uboot/common/metadata.c index f986562de8db..c00b56006dfd 100644 --- a/sys/boot/uboot/common/metadata.c +++ b/sys/boot/uboot/common/metadata.c @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include "glue.h" #if defined(LOADER_FDT_SUPPORT) -#include "libuboot.h" +#include #endif static int diff --git a/sys/boot/uboot/lib/Makefile b/sys/boot/uboot/lib/Makefile index 4c9e5919a3e9..1a3f5e9850ff 100644 --- a/sys/boot/uboot/lib/Makefile +++ b/sys/boot/uboot/lib/Makefile @@ -27,7 +27,7 @@ LOADER_FDT_SUPPORT= no .endif .if ${LOADER_FDT_SUPPORT} == "yes" -CFLAGS+= -DLOADER_FDT_SUPPORT +CFLAGS+= -DLOADER_FDT_SUPPORT -I${.CURDIR}/../../fdt .endif # Pick up FDT includes diff --git a/sys/boot/uboot/lib/libuboot.h b/sys/boot/uboot/lib/libuboot.h index 82410a08a720..79005f2c0246 100644 --- a/sys/boot/uboot/lib/libuboot.h +++ b/sys/boot/uboot/lib/libuboot.h @@ -72,8 +72,3 @@ void reboot(void); int uboot_diskgetunit(int type, int type_unit); -#if defined(LOADER_FDT_SUPPORT) -extern int fdt_setup_fdtp(); -extern int fdt_copy(vm_offset_t); -#endif - diff --git a/sys/boot/uboot/lib/module.c b/sys/boot/uboot/lib/module.c index d9b3dc0d502e..ed887b7bb74f 100644 --- a/sys/boot/uboot/lib/module.c +++ b/sys/boot/uboot/lib/module.c @@ -34,6 +34,10 @@ __FBSDID("$FreeBSD$"); #include #include +#if defined(LOADER_FDT_SUPPORT) +#include +#endif + #include "bootstrap.h" #include "libuboot.h"