Commit 754d78b1 authored by Dan Handley's avatar Dan Handley
Browse files

Minor libfdt changes to enable TF integration



* Move libfdt API headers to include/lib/libfdt
* Add libfdt.mk helper makefile
* Remove unused libfdt files
* Minor changes to fdt.h and libfdt.h to make them C99 compliant
Co-Authored-By: default avatarJens Wiklander <jens.wiklander@linaro.org>

Change-Id: I425842c2b111dcd5fb6908cc698064de4f77220e
parent 91176bc6
...@@ -52,8 +52,16 @@ ...@@ -52,8 +52,16 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/*
* Portions copyright (c) 2016, ARM Limited and Contributors.
* All rights reserved.
*/
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <libfdt_env.h>
struct fdt_header { struct fdt_header {
fdt32_t magic; /* magic word FDT_MAGIC */ fdt32_t magic; /* magic word FDT_MAGIC */
fdt32_t totalsize; /* total size of DT block */ fdt32_t totalsize; /* total size of DT block */
...@@ -80,14 +88,14 @@ struct fdt_reserve_entry { ...@@ -80,14 +88,14 @@ struct fdt_reserve_entry {
struct fdt_node_header { struct fdt_node_header {
fdt32_t tag; fdt32_t tag;
char name[0]; char name[];
}; };
struct fdt_property { struct fdt_property {
fdt32_t tag; fdt32_t tag;
fdt32_t len; fdt32_t len;
fdt32_t nameoff; fdt32_t nameoff;
char data[0]; char data[];
}; };
#endif /* !__ASSEMBLY */ #endif /* !__ASSEMBLY */
......
...@@ -51,6 +51,11 @@ ...@@ -51,6 +51,11 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/*
* Portions copyright (c) 2016, ARM Limited and Contributors.
* All rights reserved.
*/
#include <libfdt_env.h> #include <libfdt_env.h>
#include <fdt.h> #include <fdt.h>
...@@ -186,16 +191,16 @@ int fdt_next_subnode(const void *fdt, int offset); ...@@ -186,16 +191,16 @@ int fdt_next_subnode(const void *fdt, int offset);
struct fdt_header *fdth = (struct fdt_header*)fdt; \ struct fdt_header *fdth = (struct fdt_header*)fdt; \
fdth->name = cpu_to_fdt32(val); \ fdth->name = cpu_to_fdt32(val); \
} }
__fdt_set_hdr(magic); __fdt_set_hdr(magic)
__fdt_set_hdr(totalsize); __fdt_set_hdr(totalsize)
__fdt_set_hdr(off_dt_struct); __fdt_set_hdr(off_dt_struct)
__fdt_set_hdr(off_dt_strings); __fdt_set_hdr(off_dt_strings)
__fdt_set_hdr(off_mem_rsvmap); __fdt_set_hdr(off_mem_rsvmap)
__fdt_set_hdr(version); __fdt_set_hdr(version)
__fdt_set_hdr(last_comp_version); __fdt_set_hdr(last_comp_version)
__fdt_set_hdr(boot_cpuid_phys); __fdt_set_hdr(boot_cpuid_phys)
__fdt_set_hdr(size_dt_strings); __fdt_set_hdr(size_dt_strings)
__fdt_set_hdr(size_dt_struct); __fdt_set_hdr(size_dt_struct)
#undef __fdt_set_hdr #undef __fdt_set_hdr
/** /**
......
# 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)
- Tree traversal functions
- Graft function
- Complete libfdt.h documenting comments
#
# 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
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;
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;
local:
*;
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment