}
FDT_TEST(fdt_test_addr_resize, UT_TESTF_CONSOLE_REC);
+static int fdt_test_move(struct unit_test_state *uts)
+{
+ char fdt[256];
+ ulong addr, newaddr = 0x10000;
+ const int size = sizeof(fdt);
+ uint32_t ts;
+ void *buf;
+
+ /* Original source DT */
+ ut_assertok(make_test_fdt(uts, fdt, size));
+ ts = fdt_totalsize(fdt);
+ addr = map_to_sysmem(fdt);
+ set_working_fdt_addr(addr);
+
+ /* Moved target DT location */
+ buf = map_sysmem(newaddr, size);
+ memset(buf, 0, size);
+
+ /* Test moving the working FDT to a new location */
+ ut_assertok(console_record_reset_enable());
+ ut_assertok(run_commandf("fdt move %08x %08x %x", addr, newaddr, ts));
+ ut_assert_nextline("Working FDT set to %lx", newaddr);
+ ut_assertok(ut_check_console_end(uts));
+
+ /* Compare the source and destination DTs */
+ ut_assertok(console_record_reset_enable());
+ ut_assertok(run_commandf("cmp.b %08x %08x %x", addr, newaddr, ts));
+ ut_assert_nextline("Total of %d byte(s) were the same", ts);
+ ut_assertok(ut_check_console_end(uts));
+
+ return 0;
+}
+FDT_TEST(fdt_test_move, UT_TESTF_CONSOLE_REC);
+
/* Test 'fdt get value' reading an fdt */
static int fdt_test_get_value_string(struct unit_test_state *uts,
const char *node, const char *prop,