31 Jan, 2020
1 commit
-
In upstream libfdt, 6dcb8ba4 "libfdt: Add helpers for accessing
unaligned words" introduced changes to support unaligned reads for ARM
platforms and 11738cf01f15 "libfdt: Don't use memcpy to handle unaligned
reads on ARM" improved the performance of these helpers.In practice however, this only occurs when the user has forced the
device tree to be placed in memory in a non-aligned way, which in turn
violates both our rules and the Linux Kernel rules for how things must
reside in memory to function.This "in practice" part is important as handling these other cases adds
visible (1 second or more) delay to boot in what would be considered the
fast path of the code.Cc: Patrice CHOTARD
Cc: Patrick DELAUNAY
Link: https://www.spinics.net/lists/devicetree-compiler/msg02972.html
Signed-off-by: Tom Rini
Tested-by: Patrice Chotard
05 Nov, 2019
2 commits
-
Bring over the fdt from this commit:
430419c (origin/master) tests: fix some python warnings
adding in the 'assumptions' series designed to reduce code size.
Signed-off-by: Simon Glass
-
For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.Add some controls to select the trade-off between safety and code size.
Signed-off-by: Simon Glass
Reviewed-by: Tom Rini
12 Apr, 2019
1 commit
-
The new fdt_generate_phandle() function can be used to generate a new,
unused phandle given a specific device tree blob. The implementation is
somewhat naive in that it simply walks the entire device tree to find
the highest phandle value and then returns a phandle value one higher
than that. A more clever implementation might try to find holes in the
current set of phandle values and fill them. But this implementation is
relatively simple and works reliably.Also add a test that validates that phandles generated by this new API
are indeed unique.Signed-off-by: Thierry Reding
Reviewed-by: Simon Glass
17 Nov, 2018
1 commit
-
A specially crafted FIT image makes it possible to overflow the stack
with controlled values when using the verified boot feature. Depending
on the memory layout, this could be used to overwrite configuration
variables on the heap and setting them to 0, e.g. disable signature
verification, thus bypassing it.This change fixes a bug in fdt_find_regions where the fdt structure is
parsed. A lower value than -1 of depth can lead to a buffer underflow
write on the stack.Signed-off-by: Konrad Beckmann
Reviewed-by: Simon Glass
31 May, 2018
1 commit
-
This adds the following commits from upstream:
aadd0b65c987 checks: centralize printing of property names in failure messages
88960e398907 checks: centralize printing of node path in check_msg
f1879e1a50eb Add limited read-only support for older (V2 and V3) device tree to libfdt.
37dea76e9700 srcpos: drop special handling of tab
65893da4aee0 libfdt: overlay: Add missing license
962a45ca034d Avoid installing pylibfdt when dependencies are missing
cd6ea1b2bea6 Makefile: Split INSTALL out into INSTALL_{PROGRAM,LIB,DATA,SCRIPT}
51b3a16338df Makefile.tests: Add LIBDL make(1) variable for portability sake
333d533a8f4d Attempt to auto-detect stat(1) being used if not given proper invocation
e54388015af1 dtc: Bump version to v1.4.6
a1fe86f380cb fdtoverlay: Switch from using alloca to malloc
c8d5472de3ff tests: Improve compatibility with other platforms
c81d389a10cc checks: add chosen node checks
e671852042a7 checks: add aliases node checks
d0c44ebe3f42 checks: check for #{size,address}-cells without child nodes
18a3d84bb802 checks: add string list check for *-names properties
8fe94fd6f19f checks: add string list check
6c5730819604 checks: add a string check for 'label' property
a384191eba09 checks: fix sound-dai phandle with arg property check
b260c4f610c0 Fix ambiguous grammar for devicetree rule
fe667e382bac tests: Add some basic tests for the pci_bridge checks
7975f6422260 Fix widespread incorrect use of strneq(), replace with new strprefixeq()
fca296445eab Add strstarts() helper function
cc392f089007 tests: Check non-matching cases for fdt_node_check_compatible()
bba26a5291c8 livetree: avoid assertion of orphan phandles with overlays
c8f8194d76cc implement strnlen for systems that need it
c8b38f65fdec libfdt: Remove leading underscores from identifiers
3b62fdaebfe5 Remove leading underscores from identifiers
2d45d1c5c65e Replace FDT_VERSION() with stringify()
2e6fe5a107b5 Fix some errors in comments
b0ae9e4b0ceb tests: Correct warning in sw_tree1.cCommit c8b38f65fdec upstream ("libfdt: Remove leading underscores from
identifiers") changed the multiple inclusion define protection, so the
kernel's libfdt_env.h needs the corresponding update.Signed-off-by: Rob Herring
[ Linux commit: 9130ba884640328bb78aaa4840e5ddf06ccafb1c ]
[erosca: - Fixup conflicts in include/linux/libfdt_env.h caused by v2018.03-rc4
commit b08c8c487083 ("libfdt: move headers to
and ")
- Fix build errors in lib/libfdt/fdt_ro.c, tools/libfdt/fdt_rw.c by:
- s/_fdt_mem_rsv/fdt_mem_rsv_/
- s/_fdt_offset_ptr/fdt_offset_ptr_/
- s/_fdt_check_node_offset/fdt_check_node_offset_/
- s/_fdt_check_prop_offset/fdt_check_prop_offset_/
- s/_fdt_find_add_string/fdt_find_add_string_/]
Signed-off-by: Eugeniu Rosca
Reviewed-by: Simon Glass
Reviewed-by: Masahiro Yamada
07 May, 2018
2 commits
-
When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.This commit changes all instances where we have multiple licenses (in
these cases, dual license) declared in the SPDX-License-Identifier tag.
In this case we change from listing "LICENSE-A LICENSE-B" or "LICENSE-A
or LICENSE-B" or "(LICENSE-A OR LICENSE-B)" to "LICENSE-A OR LICENSE-B"
as per the Linux Kernel style document. Note that parenthesis are
allowed so when they were used before we continue to use them.Reviewed-by: Fabio Estevam
Signed-off-by: Tom Rini -
When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.Signed-off-by: Tom Rini
01 Apr, 2018
1 commit
-
fdt_region.c does not depend on anything in libfdt_internal.h
Signed-off-by: Masahiro Yamada
Reviewed-by: Simon Glass
05 Mar, 2018
1 commit
-
Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.hand replaces include directives:
#include -> #include
#include -> #includeReported-by: Thomas Petazzoni
Signed-off-by: Masahiro Yamada
29 Jan, 2018
2 commits
-
There is tons of code duplication between lib/libfdt/libfdt.h and
scripts/dtc/libfdt/libfdt.h. Evacuate the U-Boot own code to
include/libfdt.h and remove lib/libfdt/libfdt.h.For host tools, should include scripts/dtc/libfdt/libfdt.h,
which is already suitable for user-space.For compiling U-Boot, should be included because we
need a different libfdt_env.h .Signed-off-by: Masahiro Yamada
-
The only difference between scripts/dtc/libfdt/fdt_rw.c and
lib/libfdt/fdt_rw.c is fdt_remove_unused_strings().It is only used by fdtgrep, so we do not need to compile it for U-Boot
image. Move it to tools/libfdt/fdw_rw.c so that lib/libfdt/fdt_rw.c
can be a wrapper of scripts/dtc/libfdt/fdt_rw.c.Signed-off-by: Masahiro Yamada
Reviewed-by: Simon Glass
04 Dec, 2017
2 commits
-
Now, lib/libfdt/fdt_wip.c is the same as scripts/dtc/libfdt/fdt_wip.c
Change the former to a wrapper of the latter.
Signed-off-by: Masahiro Yamada
Reviewed-by: Simon Glass -
All the other fdt_*_region() functions are located in fdt_region.c,
while only fdt_find_regions() was added to fdt_wip.c, strangely.Move it to the suitable place.
Signed-off-by: Masahiro Yamada
Reviewed-by: Simon Glass
17 Nov, 2017
4 commits
-
lib/libfdt/ and scripts/dtc/libfdt have the same copies for the
followings 6 files:
fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c fdt_strerr.c
fdt_sw.cMake them a wrapper of scripts/dtc/libfdt/*. This is exactly what
Linux does to sync libfdt. In order to make is possible, import
and from Linux 4.14-rc5.Unfortunately, U-Boot locally modified the following 3 files:
fdt_ro.c fdt_wip.c fdt_rw.cThe fdt_region.c is U-Boot own file.
I did not touch them in order to avoid unpredictable impact.
Signed-off-by: Masahiro Yamada
-
Fortunately, U-Boot did not modify libfdt_internal.h locally.
Change it to a wrapper of scripts/dtc/libfdt/fdt.h, which will be
periodically synced with the upstream DTC (or kernel).Signed-off-by: Masahiro Yamada
-
Fortunately, U-Boot did not modify fdt.h locally.
Change it to a wrapper of scripts/dtc/libfdt/fdt.h, which will be
periodically synced with the upstream DTC (or kernel).Signed-off-by: Masahiro Yamada
-
The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.I also rewrote the Makefile in a cleaner Kbuild style.
The scripts from the upstream have been moved as follows:
lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shippedThe .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.Signed-off-by: Masahiro Yamada
15 Sep, 2017
3 commits
-
This patch enables an overlay to refer to a previous overlay's
labels by performing a merge of symbol information at application
time.In a nutshell it allows an overlay to refer to a symbol that a previous
overlay has defined. It requires both the base and all the overlays
to be compiled with the -@ command line switch so that symbol
information is included.base.dts
--------/dts-v1/;
/ {
foo: foonode {
foo-property;
};
};$ dtc -@ -I dts -O dtb -o base.dtb base.dts
bar.dts
-------/dts-v1/;
/plugin/;
/ {
fragment@1 {
target = ;
__overlay__ {
overlay-1-property;
bar: barnode {
bar-property;
};
};
};
};$ dtc -@ -I dts -O dtb -o bar.dtb bar.dts
baz.dts
-------/dts-v1/;
/plugin/;
/ {
fragment@1 {
target = ;
__overlay__ {
overlay-2-property;
baz: baznode {
baz-property;
};
};
};
};$ dtc -@ -I dts -O dtb -o baz.dtb baz.dts
Applying the overlays:
$ fdtoverlay -i base.dtb -o target.dtb bar.dtb baz.dtb
Dumping:
$ fdtdump target.dtb
/ {
foonode {
overlay-1-property;
foo-property;
linux,phandle = ;
phandle = ;
barnode {
overlay-2-property;
phandle = ;
linux,phandle = ;
bar-property;
baznode {
phandle = ;
linux,phandle = ;
baz-property;
};
};
};
__symbols__ {
baz = "/foonode/barnode/baznode";
bar = "/foonode/barnode";
foo = "/foonode";
};
};Signed-off-by: Pantelis Antoniou
Signed-off-by: David Gibson
Acked-by: Simon Glass -
Report Coverity log:
The code uses a variable that has not
been initialized, leading to unpredictable
or unintended results.Reported-by: Coverity (CID: 60519)
Signed-off-by: Tien Fong Chee -
Add upstream changes to U-Boot:
- new pylibfdt functions
- fdt_setprop_placeholder()Signed-off-by: Simon Glass
12 Sep, 2017
1 commit
-
Adjust this code so that it can work with Python 2 and 3.
Fixes: d73fcb1 (moveconfig: Support building a simple config database)
Reported-by: Chris Packham
Signed-off-by: Simon Glass
10 Jul, 2017
1 commit
-
This error code has not been upstreamed and is not really needed since it
is unlikely to be triggered. Drop it to maintain compatability with
upstream.Reported-by: Peter Robinson
Signed-off-by: Simon Glass
Tested-by: Peter Robinson
03 Jun, 2017
5 commits
-
This is no-longer needed, so stop building it.
Signed-off-by: Simon Glass
-
Now that this module has been accepted upstream we should stop using the
local U-Boot one. In preparation for this, rename it to indicate it is for
legacy use.Signed-off-by: Simon Glass
-
U-Boot needs to provide some swig include directories. Add this feature.
Signed-off-by: Simon Glass
-
These header files are actually part of libfdt. Move them there to make
it easier to build pylibfdt and easier to merge changes from upstream.Update the license header to use SPDX at the same time.
Signed-off-by: Simon Glass
-
An early version of this is available upstream. Bring it in as a starting
point. This is from dtc upstream commit e56f2b0.Future work will plumb it into dtoc and remove the now-unnecessary local
libraries.Signed-off-by: Simon Glass
14 Apr, 2017
1 commit
-
With skeleton.dtsi being dropped it is more likely that the /aliases node
will be last in the device tree. Update fdtgrep to handle this.Signed-off-by: Simon Glass
Tested-by: Masahiro Yamada
11 Apr, 2017
2 commits
-
For some reason Python 3 seems to think it does not need to build
the library. Using the --force parameter makes sure that the library
gets built always. This is especially important since we move the
library in the next step of the Makefile, hence forcing a rebuild
every time the higher level Makefile triggers a rebuild is required
to make sure the library is always there.Signed-off-by: Stefan Agner
Acked-by: Simon Glass -
This a few minor changes down from upstream since the last sync.
Signed-off-by: Simon Glass
14 Jan, 2017
1 commit
-
The fdt_overlay_apply() function purports to support the edge cases where
an overlay has no fixups to be applied, or a base tree which has no
symbols (the latter can only work if the former is also true). However it
gets it wrong in a couple of small ways:* In the no fixups case, it doesn't fail immediately, but will attempt
fdt_for_each_property_offset() giving -FDT_ERR_NOTFOUND as the node
offset, which will fail. Instead it should succeed immediately, since
there's nothing to do.
* In the case of no symbols, it again doesn't fail immediately. However
if there is an actual fixup it will fail with an unexpected error,
because -FDT_ERR_NOTFOUND is passed to fdt_getprop() when attempting to
look up the symbols. We should instead return -FDT_ERR_NOTFOUND
directly.Both of these errors lead to the code returning misleading error codes in
failing cases.[ DTC commit: 7d8ef6e1db9794f72805a0855f4f7f12fadd03d3 ]
Signed-off-by: David Gibson
Signed-off-by: Stefan Agner
Acked-by: Simon Glass
24 Oct, 2016
3 commits
-
If fdt_getprop() fails, negative error code should be returned.
[ DTC commit: daa75e8fa5942caa8e97931aed3a1ee0b7edd74b ]
Signed-off-by: Masahiro Yamada
Signed-off-by: David Gibson -
If fdt_getprop() fails, negative error code should be returned.
[ DTC commit: e28eff5b787adb3f461d1653598818b2f1f25a73 ]
Signed-off-by: Masahiro Yamada
Signed-off-by: David Gibson -
Now that the overlay code has been merge upstream, update our copy to
what's been merged, since a significant number of issues have been fixed
during the merge process.Signed-off-by: Maxime Ripard
Acked-by: Simon Glass
14 Oct, 2016
5 commits
-
The fdt_path_offset() function is not inlined in upstream libfdt. Adjust
U-Boot's version to match.Signed-off-by: Simon Glass
-
The signature for this macro has changed. Bring in the upstream version and
adjust U-Boot's usages to suit.Signed-off-by: Simon Glass
Update to drivers/power/pmic/palmas.c:
Signed-off-by: KeerthyChange-Id: I6cc9021339bfe686f9df21d61a1095ca2b3776e8
-
These have now landed upstream. The naming is different and in one case the
function signature has changed. Update the code to match.This applies the following upstream commits by
Thierry Reding :604e61e fdt: Add functions to retrieve strings
8702bd1 fdt: Add a function to get the index of a string
2218387 fdt: Add a function to count stringsSigned-off-by: Simon Glass
-
This includes small changes to the following functions, from upstream
commit 6d1832c:- fdt_get_max_phandle() (upstream commit 84e0e134)
- fdt_node_check_compatible (upstream commit 53bf130b)
- fdt_setprop_inplace_namelen_partial() to remove useless brackets and
use idx instead of index
- _fdt_resize_property() to use idx instead of index
- _fdt_splice() (upstream commit d4c7c25c)It also includes various typo fixes in libfdt.h
Signed-off-by: Simon Glass
-
Using pointer arithmetic to generate a pointer outside a known object is,
technically, undefined behaviour in C. Unfortunately, we were using that
in fdt_offset_ptr() to detect overflows.To fix this we need to do our bounds / overflow checking on the offsets
before constructing pointers from them.Reported-by: David Binderman
Signed-off-by: David Gibson
Signed-off-by: Simon Glass