14#include <libfdt/libfdt.h>
16#define FDT_SIZE_KB 1024
17#define FDT_SIZE_MB (1024 * FDT_SIZE_KB)
19#define FDT_SIZE_MAX (2 * FDT_SIZE_MB)
20#define FDT_PADDING_SIZE (1 * FDT_SIZE_KB)
24static inline uint8_t fdt8_to_cpu(
fdt8_t x)
32#define fdt_setprop_cstring(fdt, nodeoffset, name, str) \
33 fdt_setprop((fdt), (nodeoffset), (name), (str), sizeof(str))
35#define fdt_prop_cells_ops(ops, fdt, nodeoffset, prop, ...) \
38 uint32_t tmp[] = { __VA_ARGS__ }; \
39 for (int i = 0; i < sizeof(tmp) / sizeof(tmp[0]); ++i) \
41 tmp[i] = cpu_to_fdt32(tmp[i]); \
43 ret += ops(fdt, nodeoffset, prop, tmp, sizeof(tmp)); \
47#define fdt_setprop_cells(fdt, nodeoffset, prop, ...) \
48 fdt_prop_cells_ops(fdt_setprop, fdt, nodeoffset, prop, __VA_ARGS__)
50#define fdt_appendprop_cells(fdt, nodeoffset, prop, ...) \
51 fdt_prop_cells_ops(fdt_appendprop, fdt, nodeoffset, prop, __VA_ARGS__)
53int fdt_setprop_uxx(
void *fdt,
int nodeoffset,
const char *name, uint64_t val,
bool is_u64);
54int fdt_getprop_u8(
void *fdt,
int nodeoffset,
const char *name, uint8_t *out_value,
int *lenp);
55int fdt_getprop_s8(
void *fdt,
int nodeoffset,
const char *name, int8_t *out_value,
int *lenp);
56int fdt_getprop_u16(
void *fdt,
int nodeoffset,
const char *name, uint16_t *out_value,
int *lenp);
57int fdt_getprop_s16(
void *fdt,
int nodeoffset,
const char *name, int16_t *out_value,
int *lenp);
58int fdt_getprop_u32(
void *fdt,
int nodeoffset,
const char *name, uint32_t *out_value,
int *lenp);
59int fdt_getprop_s32(
void *fdt,
int nodeoffset,
const char *name, int32_t *out_value,
int *lenp);
int fdt_io_addr_cells(void *fdt, int nodeoffset)
int fdt_add_mem_rsv_possible(void *fdt, size_t addr, size_t size)
int fdt_getprop_u8(void *fdt, int nodeoffset, const char *name, uint8_t *out_value, int *lenp)
int fdt_getprop_s32(void *fdt, int nodeoffset, const char *name, int32_t *out_value, int *lenp)
int fdt_install_initrd(void *fdt, char *os_name, size_t initrd_addr, size_t initrd_size)
int fdt_getprop_u16(void *fdt, int nodeoffset, const char *name, uint16_t *out_value, int *lenp)
int fdt_getprop_s8(void *fdt, int nodeoffset, const char *name, int8_t *out_value, int *lenp)
int fdt_getprop_s16(void *fdt, int nodeoffset, const char *name, int16_t *out_value, int *lenp)
int fdt_add_subnode_possible(void *fdt, int parentoffset, const char *name)
int fdt_setprop_uxx(void *fdt, int nodeoffset, const char *name, uint64_t val, bool is_u64)
int fdt_getprop_u32(void *fdt, int nodeoffset, const char *name, uint32_t *out_value, int *lenp)
int fdt_io_size_cells(void *fdt, int nodeoffset)