aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-12-09tests: Make overlay/plugin tests unconditionalDavid Gibson1-37/+34
When overlay apply supprt was added to libfdt the testcases included some which could only be executed with the (then) out of tree dtc with overlay output support. So, the test script automatically skipped those tests if it wasn't available. Now that the overlay support is merged into dtc mainline there's no reason to keep this logic. Instead run all the overlay tests unconditionally. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-12-09tests: Add overlay testsPantelis Antoniou4-0/+64
Add a number of tests for dynamic objects/overlays. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-12-09tests: Add check_path testPantelis Antoniou4-1/+88
Add a test that checks for existence or not of a node. It is useful for testing the various cases when generating symbols and fixups for dynamic device tree objects. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-12-09dtc: Plugin and fixup supportPantelis Antoniou9-11/+373
This patch enable the generation of symbols & local fixup information for trees compiled with the -@ (--symbols) option. Using this patch labels in the tree and their users emit information in __symbols__ and __local_fixups__ nodes. The __fixups__ node make possible the dynamic resolution of phandle references which are present in the plugin tree but lie in the tree that are applying the overlay against. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-12-09dtc: Document the dynamic plugin internalsPantelis Antoniou1-0/+310
Provides the document explaining the internal mechanics of plugins and options. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-11-28checks: Pass boot_info instead of root nodePantelis Antoniou1-36/+42
As preparation for overlay support we need to pass the boot info parameter instead of the root node to each check method. The root node can be retrieved by accessing boot info's dt member. No other functional changes are made. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-11-04libfdt: add missing errors to fdt_strerror()Benjamin Fair1-0/+3
Some error values were missing from the table which meant that they could not be translated by fdt_strerror(). Signed-off-by: Benjamin Fair <b-fair@ti.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-17libfdt: fix fdt_stringlist_search()Masahiro Yamada1-1/+1
If fdt_getprop() fails, negative error code should be returned. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-17libfdt: fix fdt_stringlist_count()Masahiro Yamada1-1/+1
If fdt_getprop() fails, negative error code should be returned. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-12tests: overlay: Rename the device tree blobs to be more explicitMaxime Ripard1-7/+7
Rename the blobs to have a more explicit output that will give us a clearer idea about whether a DT (and the test) has been compiled using a dtc with our without overlays support. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-11tests: overlay: Add test suffix to the compiled blobsMaxime Ripard1-8/+8
The compiled blobs in the overlay tests do not have the test suffix which is usually used to clean up and ignore the test artifacts. Let's add that suffix. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-11libfdt: Add fdt_overlay_apply to the exported symbolsMaxime Ripard1-0/+1
fdt_overlay_apply was not usable in the shared library. Export it to allow its use. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-11fdt: strerr: Remove spurious BADOVERLAYMaxime Ripard1-1/+0
There's one FDT_ERR_BADOVERLAY too many in the fdt error table. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-07tests: overlay: Move back the bad fixup testsMaxime Ripard1-7/+7
The bad fixups tests were meant to be usable even for a non-overlay-enabled dtc. Move them out of that check. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-07libfdt: overlay: Fix symbols and fixups nodes conditionMaxime Ripard1-4/+3
Some base device tree might not have any __symbols__ nodes, since they might not have any phandle at all. Similarly, if an overlay doesn't use any base device tree phandles, its __fixups__ node will be empty. In such cases, we don't want to stop the phandle parsing, but rather just ignore the error reported about the missing node. If it's actually an issue for the overlay we're trying to apply on a given base device tree, it will be caught later on, but we cannot make the assumption that early in the application process. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-07libfdt: overlay: Report a bad overlay for mismatching local fixupsMaxime Ripard1-0/+2
The __local_fixups__ node as a structure that mimics the structure of the main overlay part. This means that if we have a child node somewhere in the local fixups sub-tree and if that node is not present in the main tree, the overlay is poorly formatted, and we should report it as such. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-07libfdt: Add BADPHANDLE error stringMaxime Ripard1-0/+1
The BADPHANDLE error was missing a string, leading to an <unknown error> string being returned if you were to call fdt_strerror. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-06libfdt: Don't use 'index' as a local variable nameDavid Gibson2-25/+25
Using 'index' as a local variable name shadows the standard library index() function. This causes warnings on at least some compiler versions. The recently added overlay code has a number of instances of this. This patch replaces 'index' with 'poffset', since 'index' is being used to mean "offset within a property value" in these cases. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-06tests: Add tests cases for the overlay codeMaxime Ripard17-1/+656
Add some test infrastructure to test that the overlay can be merged, but also that poorly formatted fixups would fail as expected. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> [dwg: Don't execute bad overlay tests without overlay aware dtc] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-06libfdt: Add overlay application functionMaxime Ripard4-1/+703
The device tree overlays are a good way to deal with user-modifyable boards or boards with some kind of an expansion mechanism where we can easily plug new board in (like the BBB, the Raspberry Pi or the CHIP). Add a new function to merge overlays with a base device tree. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-06libfdt: Extend the reach of FDT_ERR_BADPHANDLEMaxime Ripard1-2/+4
So far, the BADPHANDLE error was only used for incorrect phandle values. Extend that meaning to an improperly formatted phandle property. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-06libfdt: Add new errors for the overlay codeMaxime Ripard2-1/+13
Add a few new error codes to report the failure conditions we might encounter in the overlay application code: - FDT_ERR_BADOVERLAY, when an overlay cannot be parsed, even though its structure is correct - FDT_ERR_NOPHANDLES, when we ran out of available phandles and we cannot use a new phandle without either using an invalid one (-1 or 0), or one already used. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-09-28dtc: Remove "home page" linkDavid Gibson1-4/+0
The supposed home page hasn't existed for some time. We don't really have anything else, so remove the link from the README. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-09-27Fix some typing errors in libfdt.h and livetree.cThomas Huth2-3/+3
Correct some typos discovered with the codespell utility. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-09-24Merge tag 'v1.4.2'David Gibson1-4/+20
Fix a mistake where the v1.4.2 release tag wasn't actually merged to master.
2016-09-22dtc: Fix assorted problems in the testcases for the -a optionDavid Gibson1-17/+14
We just added the -a option to allow padding of the output dtb's size to a specified alignment. Unfortunately the test cases for this had several bugs: * Didn't actually test anything since "alignbase" instead of $alignbase was passed to the checker function * Introduced an unnecessary run_local_test wrapper * Didn't provide very helpful output on failure * Only attempted to check one alignment value This patch fixes up these problems. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-09-22Implement the -a option to pad dtb alignedTim Wang4-5/+58
There is one condition that need cat the dtb files into one dtb.img which can support several boards use same SoC platform. And the original dtb file size is not aligned to any base. This may cause "Synchronous Abort" when load from a unligned address on some SoC machine, such as ARM. So this patch implement the -a <aligned number> option to pad zero at the end of dtb files and make the dtb size aligned to <aligned number>. Then, the aligned dtbs can cat together and load without "Synchronous Abort". Signed-off-by: Tim Wang <timwang@asrmicro.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-09-03dtc: Makefile improvements for release uploadingv1.4.2David Gibson1-4/+20
This has some fixes to the make dist target, and a new make kup target for maintainer convenience uploading new releases. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-09-03dtc: Bump version to 1.4.2David Gibson1-1/+1
Bump version in preparation for a new release. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-08-22libfdt: simplify fdt_del_mem_rsv()Masahiro Yamada1-5/+1
The variable "err" is unneeded. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-08-01libfdt: Add fdt_setprop_inplace_namelen_partialMaxime Ripard4-4/+59
Add a function to modify inplace only a portion of a property.. This is especially useful when the property is an array of values, and you want to update one of them without changing the DT size. Acked-by: Simon Glass <sjg@chromium.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> [dwg: Remove unnecessary unsigned qualifier, correct a comment] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-07-28libfdt: Add fdt_getprop_namelen_wMaxime Ripard1-0/+7
Add a function to retrieve a writeable property only by the first characters of its name. Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-07-28libfdt: Add max phandle retrieval functionMaxime Ripard3-0/+47
Add a function to retrieve the highest phandle in a given device tree. Acked-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Agner <stefan@agner.ch> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-07-28libfdt: Add iterator over propertiesMaxime Ripard6-0/+152
Implement a macro based on fdt_first_property_offset and fdt_next_property_offset that provides a convenience to iterate over all the properties of a given node. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Simon Glass <sjg@chromium.org> [dwg: Removed a stray trailing blank line] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-07-28libfdt: Add a subnodes iterator macroThierry Reding2-6/+30
The fdt_for_each_subnode() iterator macro provided by this patch can be used to iterate over a device tree node's subnodes. At each iteration a loop variable will be set to the next subnode. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-07-24fdtput.c: Fix memory leak.Jean-Christophe Dubois1-1/+6
CID 132821 (#1 of 1): Resource leak (RESOURCE_LEAK) 12. leaked_storage: Variable value going out of scope leaks the storage it points to. Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-07-24fdtget.c: Fix memory leakJean-Christophe Dubois1-1/+7
CID 132823 (#1 of 1): Resource leak (RESOURCE_LEAK) 5. leaked_storage: Variable blob going out of scope leaks the storage it points to. Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-07-24convert-dtsv0-lexer.l: fix memory leakDavid Gibson1-0/+2
CID 132822 (#1 of 1): Resource leak (RESOURCE_LEAK) 9. leaked_storage: Variable newname going out of scope leaks the storage it points to Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> [dwg: Removed unnecessary hunk] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-07-24fdtdump.c: make sure size_t argument to memchr is always unsigned.Jean-Christophe Dubois1-4/+6
CID 132817 (#1 of 1): Integer overflowed argument (INTEGER_OVERFLOW) 15. overflow_sink: Overflowed or truncated value (or a value computed from an overflowed or truncated value) endp - p - 4L used as critical argument to function. Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-07-13Remove unused srcpos_dump() functionDavid Gibson2-16/+0
srcpos_dump() has no current users, and I have no plans to use it. So remove it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-07-11DTC: Fix memory leak on flatname.Jean-Christophe Dubois1-0/+4
If flatname was not referenced by the "node" structure, the reference to the allocated string is lost at function exit. We need to free it if is not used by "node". Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-05-27Simplify check field and macro namesDavid Gibson1-42/+36
Now that "node" checks are the only type of checks, simplify some names accordingly. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-05-27Remove property check functionsDavid Gibson1-100/+114
Property checking functions aren't particularly useful. They're used only in a handful of cases, and most of those really only check a small handful of specific properties. This patches converts the few cases to node check functions and removes property check functions entirely. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-05-27Remove tree check functionsDavid Gibson1-37/+32
The tree check functions from the checking infrastructure aren't very useful. There were only two examples using them, and they're basically equivalent to a node check which is applied only to the root node, so those are easily replaced. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-05-27Alter grammar to allow multiple /dts-v1/ tagsDavid Gibson4-48/+52
This patch allows dtc to accept multiple /dts-v1/ tags (provided they're all at the beginning of the input), rather than giving a syntax error. This makes it more convenient to include one .dts file from another without having to be careful that the /dts-v1/ tag is in exactly one of them. We a couple of existing testcases to take advantage of this, which simplifies them slightly. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-05-25Use xasprintf() in srcposDavid Gibson1-12/+8
Now that we have an xasprintf() helper function, use it to simplify the srcpos_string() implementation. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-05-25util: Add xasprintf portable asprintf variantPantelis Antoniou2-0/+31
Include a portable asprintf variant that works on any C99 conforming platform. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-03-07Correct a missing space in a fdt_header castSimon Glass1-1/+1
The code style here is slightly incorrect. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-03-07Correct line lengths in libfdt.hSimon Glass1-12/+23
There are a few lines that are over 80 columns. Fix these. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-03-07Correct space-after-tab in libfdt.hSimon Glass1-13/+12
There are a few places with a space before a tab in this file. Fix them. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>