diff options
Diffstat (limited to 'arch/powerpc/boot/libfdt/libfdt_internal.h')
-rw-r--r-- | arch/powerpc/boot/libfdt/libfdt_internal.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/arch/powerpc/boot/libfdt/libfdt_internal.h b/arch/powerpc/boot/libfdt/libfdt_internal.h index 1e60936beb5b..46eb93e4af5c 100644 --- a/arch/powerpc/boot/libfdt/libfdt_internal.h +++ b/arch/powerpc/boot/libfdt/libfdt_internal.h | |||
@@ -52,38 +52,44 @@ | |||
52 | */ | 52 | */ |
53 | #include <fdt.h> | 53 | #include <fdt.h> |
54 | 54 | ||
55 | #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) | 55 | #define FDT_ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) |
56 | #define PALIGN(p, a) ((void *)ALIGN((unsigned long)(p), (a))) | 56 | #define FDT_TAGALIGN(x) (FDT_ALIGN((x), FDT_TAGSIZE)) |
57 | 57 | ||
58 | #define memeq(p, q, n) (memcmp((p), (q), (n)) == 0) | 58 | #define FDT_CHECK_HEADER(fdt) \ |
59 | #define streq(p, q) (strcmp((p), (q)) == 0) | 59 | { \ |
60 | int err; \ | ||
61 | if ((err = fdt_check_header(fdt)) != 0) \ | ||
62 | return err; \ | ||
63 | } | ||
60 | 64 | ||
61 | uint32_t _fdt_next_tag(const void *fdt, int startoffset, int *nextoffset); | 65 | uint32_t _fdt_next_tag(const void *fdt, int startoffset, int *nextoffset); |
66 | int _fdt_check_node_offset(const void *fdt, int offset); | ||
62 | const char *_fdt_find_string(const char *strtab, int tabsize, const char *s); | 67 | const char *_fdt_find_string(const char *strtab, int tabsize, const char *s); |
63 | int _fdt_node_end_offset(void *fdt, int nodeoffset); | 68 | int _fdt_node_end_offset(void *fdt, int nodeoffset); |
64 | 69 | ||
65 | static inline const void *_fdt_offset_ptr(const void *fdt, int offset) | 70 | static inline const void *_fdt_offset_ptr(const void *fdt, int offset) |
66 | { | 71 | { |
67 | return fdt + fdt_off_dt_struct(fdt) + offset; | 72 | return (const char *)fdt + fdt_off_dt_struct(fdt) + offset; |
68 | } | 73 | } |
69 | 74 | ||
70 | static inline void *_fdt_offset_ptr_w(void *fdt, int offset) | 75 | static inline void *_fdt_offset_ptr_w(void *fdt, int offset) |
71 | { | 76 | { |
72 | return (void *)_fdt_offset_ptr(fdt, offset); | 77 | return (void *)(uintptr_t)_fdt_offset_ptr(fdt, offset); |
73 | } | 78 | } |
74 | 79 | ||
75 | static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n) | 80 | static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n) |
76 | { | 81 | { |
77 | const struct fdt_reserve_entry *rsv_table = | 82 | const struct fdt_reserve_entry *rsv_table = |
78 | fdt + fdt_off_mem_rsvmap(fdt); | 83 | (const struct fdt_reserve_entry *) |
84 | ((const char *)fdt + fdt_off_mem_rsvmap(fdt)); | ||
79 | 85 | ||
80 | return rsv_table + n; | 86 | return rsv_table + n; |
81 | } | 87 | } |
82 | static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n) | 88 | static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n) |
83 | { | 89 | { |
84 | return (void *)_fdt_mem_rsv(fdt, n); | 90 | return (void *)(uintptr_t)_fdt_mem_rsv(fdt, n); |
85 | } | 91 | } |
86 | 92 | ||
87 | #define SW_MAGIC (~FDT_MAGIC) | 93 | #define FDT_SW_MAGIC (~FDT_MAGIC) |
88 | 94 | ||
89 | #endif /* _LIBFDT_INTERNAL_H */ | 95 | #endif /* _LIBFDT_INTERNAL_H */ |