diff options
author | Stephen Warren <swarren@nvidia.com> | 2012-09-28 17:25:59 -0400 |
---|---|---|
committer | Rob Herring <rob.herring@calxeda.com> | 2012-10-01 12:11:35 -0400 |
commit | cd296721a9645f9f28800a072490fa15458d1fb7 (patch) | |
tree | 492b9a268a48af07844fbbd39519f95676ee73fe /scripts/dtc/libfdt/fdt_rw.c | |
parent | acc2097934b5403b97f95763fe99fc115b818061 (diff) |
dtc: import latest upstream dtc
This updates scripts/dtc to commit 317a5d9 "dtc: zero out new label
objects" from git://git.jdl.com/software/dtc.git.
This adds features such as:
* /bits/ syntax for cell data.
* Math expressions within cell data.
* The ability to delete properties or nodes.
* Support for #line directives in the input file, which allows the use of
cpp on *.dts.
* -i command-line option (/include/ path)
* -W/-E command-line options for error/warning control.
* Removal of spew to STDOUT containing the filename being compiled.
* Many additions to the libfdt API.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Jon Loeliger <jdl@jdl.com>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'scripts/dtc/libfdt/fdt_rw.c')
-rw-r--r-- | scripts/dtc/libfdt/fdt_rw.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/dtc/libfdt/fdt_rw.c b/scripts/dtc/libfdt/fdt_rw.c index 8e7ec4cb7bcd..24437dfc32b8 100644 --- a/scripts/dtc/libfdt/fdt_rw.c +++ b/scripts/dtc/libfdt/fdt_rw.c | |||
@@ -289,6 +289,33 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name, | |||
289 | return 0; | 289 | return 0; |
290 | } | 290 | } |
291 | 291 | ||
292 | int fdt_appendprop(void *fdt, int nodeoffset, const char *name, | ||
293 | const void *val, int len) | ||
294 | { | ||
295 | struct fdt_property *prop; | ||
296 | int err, oldlen, newlen; | ||
297 | |||
298 | FDT_RW_CHECK_HEADER(fdt); | ||
299 | |||
300 | prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen); | ||
301 | if (prop) { | ||
302 | newlen = len + oldlen; | ||
303 | err = _fdt_splice_struct(fdt, prop->data, | ||
304 | FDT_TAGALIGN(oldlen), | ||
305 | FDT_TAGALIGN(newlen)); | ||
306 | if (err) | ||
307 | return err; | ||
308 | prop->len = cpu_to_fdt32(newlen); | ||
309 | memcpy(prop->data + oldlen, val, len); | ||
310 | } else { | ||
311 | err = _fdt_add_property(fdt, nodeoffset, name, len, &prop); | ||
312 | if (err) | ||
313 | return err; | ||
314 | memcpy(prop->data, val, len); | ||
315 | } | ||
316 | return 0; | ||
317 | } | ||
318 | |||
292 | int fdt_delprop(void *fdt, int nodeoffset, const char *name) | 319 | int fdt_delprop(void *fdt, int nodeoffset, const char *name) |
293 | { | 320 | { |
294 | struct fdt_property *prop; | 321 | struct fdt_property *prop; |
@@ -406,6 +433,8 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize) | |||
406 | struct_size = 0; | 433 | struct_size = 0; |
407 | while (fdt_next_tag(fdt, struct_size, &struct_size) != FDT_END) | 434 | while (fdt_next_tag(fdt, struct_size, &struct_size) != FDT_END) |
408 | ; | 435 | ; |
436 | if (struct_size < 0) | ||
437 | return struct_size; | ||
409 | } | 438 | } |
410 | 439 | ||
411 | if (!_fdt_blocks_misordered(fdt, mem_rsv_size, struct_size)) { | 440 | if (!_fdt_blocks_misordered(fdt, mem_rsv_size, struct_size)) { |