uboot/lib/libfdt/libfdt_internal.h
<<
>>
Prefs
   1#ifndef _LIBFDT_INTERNAL_H
   2#define _LIBFDT_INTERNAL_H
   3/*
   4 * libfdt - Flat Device Tree manipulation
   5 * Copyright (C) 2006 David Gibson, IBM Corporation.
   6 * SPDX-License-Identifier:     GPL-2.0+ BSD-2-Clause
   7 */
   8#include <fdt.h>
   9
  10#define FDT_ALIGN(x, a)         (((x) + (a) - 1) & ~((a) - 1))
  11#define FDT_TAGALIGN(x)         (FDT_ALIGN((x), FDT_TAGSIZE))
  12
  13#define FDT_CHECK_HEADER(fdt) \
  14        { \
  15                int __err; \
  16                if ((__err = fdt_check_header(fdt)) != 0) \
  17                        return __err; \
  18        }
  19
  20int _fdt_check_node_offset(const void *fdt, int offset);
  21int _fdt_check_prop_offset(const void *fdt, int offset);
  22const char *_fdt_find_string(const char *strtab, int tabsize, const char *s);
  23int _fdt_node_end_offset(void *fdt, int nodeoffset);
  24
  25static inline const void *_fdt_offset_ptr(const void *fdt, int offset)
  26{
  27        return (const char *)fdt + fdt_off_dt_struct(fdt) + offset;
  28}
  29
  30static inline void *_fdt_offset_ptr_w(void *fdt, int offset)
  31{
  32        return (void *)(uintptr_t)_fdt_offset_ptr(fdt, offset);
  33}
  34
  35static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n)
  36{
  37        const struct fdt_reserve_entry *rsv_table =
  38                (const struct fdt_reserve_entry *)
  39                ((const char *)fdt + fdt_off_mem_rsvmap(fdt));
  40
  41        return rsv_table + n;
  42}
  43static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n)
  44{
  45        return (void *)(uintptr_t)_fdt_mem_rsv(fdt, n);
  46}
  47
  48#define FDT_SW_MAGIC            (~FDT_MAGIC)
  49
  50#endif /* _LIBFDT_INTERNAL_H */
  51