summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarek Vasut <[email protected]>2026-03-16 00:57:23 +0100
committerTom Rini <[email protected]>2026-04-07 15:27:22 -0600
commita383c9689282269bb9687ec6c115de094c27fa67 (patch)
tree26f961e89b7a5583b91a9c14a60c4b9551663b0b /test
parent6201fd7c1ffa134f8ba229b434e6f14a3fd5bb14 (diff)
dm: Respect dma-ranges size
Rework dev_phys_to_bus() and dev_bus_to_phys() to respect the size of the area specified in dma-ranges DT property. The area outside of ranges is remapped 1:1, while the area in the ranges is remapped according to the description in the dma-ranges property. Adjust the test to test the area within the remapped range, not area outside the remapped range, which was incorrect. Signed-off-by: Marek Vasut <[email protected]> Reviewed-by: Markus Schneider-Pargmann <[email protected]>
Diffstat (limited to 'test')
-rw-r--r--test/dm/core.c6
-rw-r--r--test/dm/phys2bus.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/test/dm/core.c b/test/dm/core.c
index 78ee14af228..bb9f526b064 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -1248,13 +1248,13 @@ static int dm_test_dma_offset(struct unit_test_state *uts)
node = ofnode_path("/mmio-bus@0");
ut_assert(ofnode_valid(node));
ut_assertok(uclass_get_device_by_ofnode(UCLASS_TEST_BUS, node, &dev));
- ut_asserteq_64(0, dev->dma_offset);
+ ut_asserteq_64(0, dev->dma_cpu - dev->dma_bus);
/* Device behind a bus with dma-ranges */
node = ofnode_path("/mmio-bus@0/subnode@0");
ut_assert(ofnode_valid(node));
ut_assertok(uclass_get_device_by_ofnode(UCLASS_TEST_FDT, node, &dev));
- ut_asserteq_64(-0x10000000ULL, dev->dma_offset);
+ ut_asserteq_64(-0x10000000ULL, dev->dma_cpu - dev->dma_bus);
/* This one has no dma-ranges */
node = ofnode_path("/mmio-bus@1");
@@ -1263,7 +1263,7 @@ static int dm_test_dma_offset(struct unit_test_state *uts)
node = ofnode_path("/mmio-bus@1/subnode@0");
ut_assert(ofnode_valid(node));
ut_assertok(uclass_get_device_by_ofnode(UCLASS_TEST_FDT, node, &dev));
- ut_asserteq_64(0, dev->dma_offset);
+ ut_asserteq_64(0, dev->dma_cpu - dev->dma_bus);
return 0;
}
diff --git a/test/dm/phys2bus.c b/test/dm/phys2bus.c
index 0f30c7e37fd..67f33904943 100644
--- a/test/dm/phys2bus.c
+++ b/test/dm/phys2bus.c
@@ -28,8 +28,8 @@ static int dm_test_phys_to_bus(struct unit_test_state *uts)
node = ofnode_path("/mmio-bus@0/subnode@0");
ut_assert(ofnode_valid(node));
ut_assertok(uclass_get_device_by_ofnode(UCLASS_TEST_FDT, node, &dev));
- ut_asserteq_addr((void*)0x100fffffULL, (void*)dev_phys_to_bus(dev, 0xfffff));
- ut_asserteq_addr((void*)0xfffffULL, (void*)(ulong)dev_bus_to_phys(dev, 0x100fffff));
+ ut_asserteq_addr((void*)0x1003ffffULL, (void*)dev_phys_to_bus(dev, 0x3ffff));
+ ut_asserteq_addr((void*)0x3ffffULL, (void*)(ulong)dev_bus_to_phys(dev, 0x1003ffff));
return 0;
}