summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@foss.st.com>2022-01-04 10:42:48 +0300
committerSimon Glass <sjg@chromium.org>2022-01-25 22:36:10 +0300
commit9876ae7db6da1cf8e106fcb46a36172fbb5781e5 (patch)
treee9112bb9b1a6f541c3d55536ab6ad0cc9c856d32 /test
parenta77f468099be81bdadb872a735f58ae5c2fa5973 (diff)
downloadu-boot-9876ae7db6da1cf8e106fcb46a36172fbb5781e5.tar.xz
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>
Diffstat (limited to 'test')
-rw-r--r--test/dm/ofnode.c2
-rw-r--r--test/dm/pci.c4
-rw-r--r--test/dm/test-fdt.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index 5e7c9681c7..dab0480a42 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -286,7 +286,7 @@ static int dm_test_ofnode_get_reg(struct unit_test_state *uts)
ut_assert(ofnode_valid(node));
addr = ofnode_get_addr(node);
size = ofnode_get_size(node);
- ut_asserteq(FDT_ADDR_T_NONE, addr);
+ ut_asserteq_64(FDT_ADDR_T_NONE, addr);
ut_asserteq(FDT_SIZE_T_NONE, size);
node = ofnode_path("/translation-test@8000/noxlatebus@3,300/dev@42");
diff --git a/test/dm/pci.c b/test/dm/pci.c
index fa2e4a8559..00e4440a9d 100644
--- a/test/dm/pci.c
+++ b/test/dm/pci.c
@@ -331,10 +331,10 @@ static int dm_test_pci_addr_live(struct unit_test_state *uts)
struct udevice *swap1f, *swap1;
ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap1f));
- ut_asserteq(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
+ ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1f));
ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1, 0), &swap1));
- ut_asserteq(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
+ ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr_pci(swap1));
return 0;
}
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index 8866d4d959..e1de066226 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -768,7 +768,7 @@ static int dm_test_fdt_livetree_writing(struct unit_test_state *uts)
/* Test setting generic properties */
/* Non-existent in DTB */
- ut_asserteq(FDT_ADDR_T_NONE, dev_read_addr(dev));
+ ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr(dev));
/* reg = 0x42, size = 0x100 */
ut_assertok(ofnode_write_prop(node, "reg", 8,
"\x00\x00\x00\x42\x00\x00\x01\x00"));