58 static int _fdt_sw_check_header(
void *fdt)
66 #define FDT_SW_CHECK_HEADER(fdt) \
69 if ((err = _fdt_sw_check_header(fdt)) != 0) \
73 static void *_fdt_grab_space(
void *fdt,
size_t len)
81 if ((offset + len < offset) || (offset + len > spaceleft))
84 fdt_set_size_dt_struct(fdt, offset + len);
85 return _fdt_offset_ptr_w(fdt, offset);
100 fdt_set_totalsize(fdt, bufsize);
105 fdt_set_off_dt_strings(fdt, bufsize);
128 fdt_set_off_dt_struct(fdt, offset +
sizeof(*re));
145 nh = _fdt_grab_space(fdt,
sizeof(*nh) +
FDT_TAGALIGN(namelen));
168 static int _fdt_find_add_string(
void *fdt,
const char *
s)
181 offset = -strtabsize - len;
186 memcpy(strtab + offset, s, len);
187 fdt_set_size_dt_strings(fdt, strtabsize + len);
198 nameoff = _fdt_find_add_string(fdt, name);
202 prop = _fdt_grab_space(fdt,
sizeof(*prop) +
FDT_TAGALIGN(len));
215 char *p = (
char *)fdt;
217 int oldstroffset, newstroffset;
224 end = _fdt_grab_space(fdt,
sizeof(*end));
233 fdt_set_off_dt_strings(fdt, newstroffset);
240 _fdt_offset_ptr_w(fdt, offset);