1 #ifndef _LIBFDT_INTERNAL_H
2 #define _LIBFDT_INTERNAL_H
4 * libfdt - Flat Device Tree manipulation
5 * Copyright (C) 2006 David Gibson, IBM Corporation.
6 * SPDX-License-Identifier: GPL-2.0+ BSD-2-Clause
10 #define FDT_ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
11 #define FDT_TAGALIGN(x) (FDT_ALIGN((x), FDT_TAGSIZE))
13 #define FDT_CHECK_HEADER(fdt) \
16 if ((__err = fdt_check_header(fdt)) != 0) \
20 int _fdt_check_node_offset(const void *fdt, int offset);
21 int _fdt_check_prop_offset(const void *fdt, int offset);
22 const char *_fdt_find_string(const char *strtab, int tabsize, const char *s);
23 int _fdt_node_end_offset(void *fdt, int nodeoffset);
25 static inline const void *_fdt_offset_ptr(const void *fdt, int offset)
27 return (const char *)fdt + fdt_off_dt_struct(fdt) + offset;
30 static inline void *_fdt_offset_ptr_w(void *fdt, int offset)
32 return (void *)(uintptr_t)_fdt_offset_ptr(fdt, offset);
35 static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n)
37 const struct fdt_reserve_entry *rsv_table =
38 (const struct fdt_reserve_entry *)
39 ((const char *)fdt + fdt_off_mem_rsvmap(fdt));
43 static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n)
45 return (void *)(uintptr_t)_fdt_mem_rsv(fdt, n);
48 #define FDT_SW_MAGIC (~FDT_MAGIC)
50 #endif /* _LIBFDT_INTERNAL_H */