From a78676b105a90c286ad43e58fc02477512235114 Mon Sep 17 00:00:00 2001 From: Antonio Nino Diaz Date: Mon, 16 Jan 2017 16:08:19 +0000 Subject: [PATCH] libfdt: Minor changes to enable TF integration * Add libfdt.mk helper makefile * Remove unused libfdt files * Minor changes to fdt.h and libfdt.h to make them C99 compliant Adapted from 754d78b1b331b07456c6ea439e401402a186c626. Change-Id: I0847f1c2e6e11f0c899b0b7ecc522c0ad7de210c Signed-off-by: Antonio Nino Diaz --- lib/libfdt_updated/Makefile.libfdt | 11 ----- lib/libfdt_updated/TODO | 3 -- lib/libfdt_updated/fdt.h | 12 +++++- lib/libfdt_updated/libfdt.h | 25 ++++++----- lib/libfdt_updated/libfdt.mk | 41 ++++++++++++++++++ lib/libfdt_updated/version.lds | 67 ------------------------------ 6 files changed, 66 insertions(+), 93 deletions(-) delete mode 100644 lib/libfdt_updated/Makefile.libfdt delete mode 100644 lib/libfdt_updated/TODO create mode 100644 lib/libfdt_updated/libfdt.mk delete mode 100644 lib/libfdt_updated/version.lds diff --git a/lib/libfdt_updated/Makefile.libfdt b/lib/libfdt_updated/Makefile.libfdt deleted file mode 100644 index 09c322ed8..000000000 --- a/lib/libfdt_updated/Makefile.libfdt +++ /dev/null @@ -1,11 +0,0 @@ -# Makefile.libfdt -# -# This is not a complete Makefile of itself. Instead, it is designed to -# be easily embeddable into other systems of Makefiles. -# -LIBFDT_soname = libfdt.$(SHAREDLIB_EXT).1 -LIBFDT_INCLUDES = fdt.h libfdt.h libfdt_env.h -LIBFDT_VERSION = version.lds -LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c fdt_empty_tree.c \ - fdt_addresses.c -LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o) diff --git a/lib/libfdt_updated/TODO b/lib/libfdt_updated/TODO deleted file mode 100644 index 288437e39..000000000 --- a/lib/libfdt_updated/TODO +++ /dev/null @@ -1,3 +0,0 @@ -- Tree traversal functions -- Graft function -- Complete libfdt.h documenting comments diff --git a/lib/libfdt_updated/fdt.h b/lib/libfdt_updated/fdt.h index 526aedb51..c833dc1b7 100644 --- a/lib/libfdt_updated/fdt.h +++ b/lib/libfdt_updated/fdt.h @@ -52,8 +52,16 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * Portions copyright (c) 2016-2017, ARM Limited and Contributors. + * All rights reserved. + */ + #ifndef __ASSEMBLY__ +#include + + struct fdt_header { fdt32_t magic; /* magic word FDT_MAGIC */ fdt32_t totalsize; /* total size of DT block */ @@ -80,14 +88,14 @@ struct fdt_reserve_entry { struct fdt_node_header { fdt32_t tag; - char name[0]; + char name[]; }; struct fdt_property { fdt32_t tag; fdt32_t len; fdt32_t nameoff; - char data[0]; + char data[]; }; #endif /* !__ASSEMBLY */ diff --git a/lib/libfdt_updated/libfdt.h b/lib/libfdt_updated/libfdt.h index 376e62815..f66237857 100644 --- a/lib/libfdt_updated/libfdt.h +++ b/lib/libfdt_updated/libfdt.h @@ -51,6 +51,11 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * Portions copyright (c) 2016-2017, ARM Limited and Contributors. + * All rights reserved. + */ + #include #include @@ -219,16 +224,16 @@ int fdt_next_subnode(const void *fdt, int offset); struct fdt_header *fdth = (struct fdt_header *)fdt; \ fdth->name = cpu_to_fdt32(val); \ } -__fdt_set_hdr(magic); -__fdt_set_hdr(totalsize); -__fdt_set_hdr(off_dt_struct); -__fdt_set_hdr(off_dt_strings); -__fdt_set_hdr(off_mem_rsvmap); -__fdt_set_hdr(version); -__fdt_set_hdr(last_comp_version); -__fdt_set_hdr(boot_cpuid_phys); -__fdt_set_hdr(size_dt_strings); -__fdt_set_hdr(size_dt_struct); +__fdt_set_hdr(magic) +__fdt_set_hdr(totalsize) +__fdt_set_hdr(off_dt_struct) +__fdt_set_hdr(off_dt_strings) +__fdt_set_hdr(off_mem_rsvmap) +__fdt_set_hdr(version) +__fdt_set_hdr(last_comp_version) +__fdt_set_hdr(boot_cpuid_phys) +__fdt_set_hdr(size_dt_strings) +__fdt_set_hdr(size_dt_struct) #undef __fdt_set_hdr /** diff --git a/lib/libfdt_updated/libfdt.mk b/lib/libfdt_updated/libfdt.mk new file mode 100644 index 000000000..f2e8d091a --- /dev/null +++ b/lib/libfdt_updated/libfdt.mk @@ -0,0 +1,41 @@ +# +# Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# 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. +# +# Neither the name of ARM nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. +# + +LIBFDT_SRCS := $(addprefix lib/libfdt/, \ + fdt.c \ + fdt_addresses.c \ + fdt_empty_tree.c \ + fdt_ro.c \ + fdt_rw.c \ + fdt_strerror.c \ + fdt_sw.c \ + fdt_wip.c) \ + +INCLUDES += -Iinclude/lib/libfdt diff --git a/lib/libfdt_updated/version.lds b/lib/libfdt_updated/version.lds deleted file mode 100644 index 1f4e1eab2..000000000 --- a/lib/libfdt_updated/version.lds +++ /dev/null @@ -1,67 +0,0 @@ -LIBFDT_1.2 { - global: - fdt_next_node; - fdt_check_header; - fdt_move; - fdt_string; - fdt_num_mem_rsv; - fdt_get_mem_rsv; - fdt_subnode_offset_namelen; - fdt_subnode_offset; - fdt_path_offset_namelen; - fdt_path_offset; - fdt_get_name; - fdt_get_property_namelen; - fdt_get_property; - fdt_getprop_namelen; - fdt_getprop; - fdt_get_phandle; - fdt_get_alias_namelen; - fdt_get_alias; - fdt_get_path; - fdt_supernode_atdepth_offset; - fdt_node_depth; - fdt_parent_offset; - fdt_node_offset_by_prop_value; - fdt_node_offset_by_phandle; - fdt_node_check_compatible; - fdt_node_offset_by_compatible; - fdt_setprop_inplace; - fdt_nop_property; - fdt_nop_node; - fdt_create; - fdt_add_reservemap_entry; - fdt_finish_reservemap; - fdt_begin_node; - fdt_property; - fdt_end_node; - fdt_finish; - fdt_open_into; - fdt_pack; - fdt_add_mem_rsv; - fdt_del_mem_rsv; - fdt_set_name; - fdt_setprop; - fdt_delprop; - fdt_add_subnode_namelen; - fdt_add_subnode; - fdt_del_node; - fdt_strerror; - fdt_offset_ptr; - fdt_next_tag; - fdt_appendprop; - fdt_create_empty_tree; - fdt_first_property_offset; - fdt_get_property_by_offset; - fdt_getprop_by_offset; - fdt_next_property_offset; - fdt_first_subnode; - fdt_next_subnode; - fdt_address_cells; - fdt_size_cells; - fdt_stringlist_contains; - fdt_resize; - - local: - *; -};