libfdt: add fdt_append_addrrange()

This function will append an address range property using parent node's
"#address-cells" and "#size-cells" properties.

It will be used in implementing kdump with kexec_file_load system call
at linux kernel for arm64 once it is merged into kernel tree.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Message-Id: <20190327061552.17170-2-takahiro.akashi@linaro.org>
[dwg: Correct a SEGV error in the testcase]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 04fc1e8..f6b308f 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -424,6 +424,11 @@
     run_dtc_test -I dts -O dtb -o property_iterate.dtb property_iterate.dts
     run_test property_iterate property_iterate.dtb
 
+    run_dtc_test -I dts -O dtb -o unit-addr-without-reg.dtb unit-addr-without-reg.dts
+    run_test appendprop_addrrange unit-addr-without-reg.dtb 1 1 1
+    run_test appendprop_addrrange unit-addr-without-reg.dtb 2 2 2
+    run_test appendprop_addrrange unit-addr-without-reg.dtb 2 1 3
+
     # Tests for behaviour on various sorts of corrupted trees
     run_test truncated_property
     run_test truncated_string