diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2023-05-14 16:27:27 +1000 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2023-05-14 16:27:27 +1000 |
commit | 3b02a94b486f998aa22d898b427820a805d0904f (patch) | |
tree | 53c96daf1faa51d372519fea1da871a558234dae /tests | |
parent | d4888958d64bd9b3e0e2e6582af665f9b81706c9 (diff) | |
download | dtc-3b02a94b486f998aa22d898b427820a805d0904f.zip dtc-3b02a94b486f998aa22d898b427820a805d0904f.tar.gz dtc-3b02a94b486f998aa22d898b427820a805d0904f.tar.bz2 |
dtc: Correct invalid dts output with mixed phandles and integers
The handling of "type preservation" dts output is based on the idea of
"phandles with arguments" in properties, which isn't really a thing, other
than a fairly common convention about how bindings are written. There's
nothing preventing a binding which freely mixes phandles and other integers
in an array of cells.
Currently write_propval() handles this incorrectly: specifically the case
of a phandle which follows a regular integer in a 32-bit cell array, but
without a new '< >' delimited causing an extra TYPE_UINT32 marker to be
inserted. In this case it omits the necessary space between the integer
and the phandle reference, leading to output which can't be sent back into
dtc and parsed.
Correct this, and update tests to match. I think this is more or less
correct for now, but really write_propval() is a big mess :(.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/type-preservation.dt.yaml | 1 | ||||
-rw-r--r-- | tests/type-preservation.dts | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/tests/type-preservation.dt.yaml b/tests/type-preservation.dt.yaml index a0cc64c..ae5efcf 100644 --- a/tests/type-preservation.dt.yaml +++ b/tests/type-preservation.dt.yaml @@ -15,6 +15,7 @@ a-string-with-nulls: ["foo\0bar", "baz"] a-phandle: [[!phandle 0x1]] a-phandle-with-args: [[!phandle 0x1, 0x0, 0x1], [!phandle 0x1, 0x2, 0x3]] + mixed-ints-and-phandles: [[0x1, !phandle 0x1, 0x2, !phandle 0x1]] subsubnode: compatible: ["subsubnode1", "subsubnode"] phandle: [[0x1]] diff --git a/tests/type-preservation.dts b/tests/type-preservation.dts index 921ea21..9802fab 100644 --- a/tests/type-preservation.dts +++ b/tests/type-preservation.dts @@ -18,6 +18,7 @@ a-string-with-nulls = "foo\0bar", "baz"; a-phandle = <&subsub1>; a-phandle-with-args = <&subsub1 0x00 0x01>, <&subsub1 0x02 0x03>; + mixed-ints-and-phandles = <0x01 &subsub1 0x02 &subsub1>; subsub1: subsubnode { compatible = "subsubnode1", "subsubnode"; |