dm: Fix OF_BAD_ADDR definition
authorPatrice Chotard <patrice.chotard@foss.st.com>
Tue, 4 Jan 2022 07:42:48 +0000 (08:42 +0100)
committerSimon Glass <sjg@chromium.org>
Tue, 25 Jan 2022 19:36:10 +0000 (12:36 -0700)
commit9876ae7db6da1cf8e106fcb46a36172fbb5781e5
treee9112bb9b1a6f541c3d55536ab6ad0cc9c856d32
parenta77f468099be81bdadb872a735f58ae5c2fa5973
dm: Fix OF_BAD_ADDR definition

When OF_LIVE flag is enabled on a 64 bits platform, there is an
issue when dev_read_addr() is called and need to perform an address
translation using __of_translate_address().

In case of error, __of_translate_address() return's value is OF_BAD_ADDR
(wich is defined in include/dm/of.h to ((u64)-1) = 0xffffffffffffffff).
The return value of dev_read_addr() is often compared to FDT_ADDR_T_NONE
which is defined as (-1U) = 0xffffffff.
In this case the comparison is always false.

To fix this issue, define FDT_ADDR_T_NONE to (ulong)(-1) in case of
AARCH64. Update accordingly related tests.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
include/fdtdec.h
test/dm/ofnode.c
test/dm/pci.c
test/dm/test-fdt.c