Preserve datatype markers when emitting dts format

If datatype markers are present in the property value, use them to
output the data in the correct format instead of trying to guess the
datatype. This also will preserve data grouping, such as in an
interrupts list.

This is a step forward for preserving and using datatype information
when processing DTS/DTB files. Schema validation tools can use the
datatype information to make sure a DT is correctly formed and
intepreted.

Signed-off-by: Grant Likely <grant.likely@arm.com>
[robh: rework marker handling and fix label output]
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Grant Likely
2018-06-28 15:37:01 -06:00
committed by David Gibson
parent 6dcb8ba408
commit 32b9c61307
4 changed files with 169 additions and 93 deletions

View File

@@ -551,6 +551,13 @@ dtc_tests () {
run_test dtbs_equal_ordered $tree odts_$tree.test.dtb
done
# Check -Odts preserving type information
for tree in type-preservation.dts; do
run_dtc_test -I dts -O dts -o $tree.test.dts $tree
run_dtc_test -I dts -O dts $tree.test.dts
run_wrap_test cmp $tree $tree.test.dts
done
# Check version conversions
for tree in test_tree1.dtb ; do
for aver in 1 2 3 16 17; do

View File

@@ -0,0 +1,28 @@
/dts-v1/;
/ {
#address-cells = < 0x01 >;
#size-cells = < 0x00 >;
sub1: subnode@1 {
prop_label: compatible = value_label: "subnode1";
reg = < 0x01 >;
int-array = < 0x00 0x01 >, int_value_label: < 0x02 0x03 >;
int8 = [ 56 ];
int8-array = [ 00 12 34 56 label: ];
int16 = /bits/ 16 < 0x3210 >;
int16-array = /bits/ 16 < 0x1234 0x5678 0x90ab 0xcdef >;
int16-matrix = /bits/ 16 < 0x1234 0x5678 >, < 0x90ab 0xcdef >;
int64 = /bits/ 64 < 0x200000000 >;
int64-array = /bits/ 64 < 0x100000000 0x00 int64_array_label_end: >;
a-string-with-nulls = "foo\0bar", "baz";
subsub1: subsubnode {
compatible = "subsubnode1", "subsubnode";
subsubsub1: subsubsubnode {
compatible = "subsubsubnode1", < 0x1234 >, valuea: valueb: "subsubsubnode";
};
};
};
};