DTC: Remove support for the legacy DTS source file format.
PATCH v2 1/1 DTC: Remove support for the legacy DTS source file format.
Now that all in-kernel-tree DTS files are properly /dts-v1/, remove direct support for the older, un-numbered DTS source file format.
Convert existing tests to /dts-v1/ and remove support for the conversion tests themselves.
For now, though, the conversion tool still exists.
---
Bah. Forgot to eliminate the legacy BASE and LITERAL tokens in the first version of this patch.
There's still a bit more improvement possible WRT the initial dts_versio value and lexer state. Later.
dtc-lexer.l | 23 ---------------------- dtc-parser.y | 46 --------------------------------------------- tests/base01.dts | 24 ++++++++++++---------- tests/empty.dts | 2 + tests/escapes.dts | 2 + tests/label01.dts | 38 +++++++++++++++++++----------------- tests/references_dts0.dts | 12 ++++++---- tests/run_tests.sh | 27 +------------------------- tests/test01.dts | 38 +++++++++++++++++++----------------- tests/test_tree1_dts0.dts | 18 +++++++++------- 10 files changed, 75 insertions(+), 155 deletions(-)
dtc-lexer.l +0 -23
@@ -110,29 +110,6 @@ static int pop_input_file(void); return DT_LABEL; } -<INITIAL>[bodh]# { - yylloc.file = srcpos_file; - yylloc.first_line = yylineno; - if (*yytext == 'b') - yylval.cbase = 2; - else if (*yytext == 'o') - yylval.cbase = 8; - else if (*yytext == 'd') - yylval.cbase = 10; - else - yylval.cbase = 16; - DPRINT("Base: %d\n", yylval.cbase); - return DT_BASE; - } - -<INITIAL>[0-9a-fA-F]+ { - yylloc.file = srcpos_file; - yylloc.first_line = yylineno; - yylval.literal = strdup(yytext); - DPRINT("Literal: '%s'\n", yylval.literal); - return DT_LEGACYLITERAL; - } - <V1>[0-9]+|0[xX][0-9a-fA-F]+ { yylloc.file = srcpos_file; yylloc.first_line = yylineno;
dtc-parser.y +0 -46
88 lines not on this page · raw message
tests/base01.dts +13 -11
@@ -1,3 +1,5 @@ +/dts-v1/; + / { model = "SomeModel"; compatible = "Nothing";
@@ -6,26 +8,26 @@ memory@0 { device_type = "memory"; - reg = <00000000 00000000 00000000 20000000>; + reg = <0x00000000 0x00000000 0x00000000 0x20000000>; }; cpus { #address-cells = <1>; #size-cells = <0>; - d10 = <d# 10>; // hex: 0xa - d23 = <d# 23>; // hex: 0x17 - b101 = <b# 101>; // hex: 0x5 - o17 = <o# 17>; // hex: 0xf - hd00d = <h# d00d>; // hex: 0xd00d + d10 = < 10>; // hex: 0xa + d23 = < 23>; // hex: 0x17 + b101 = < 0x5>; // hex: 0x5 + o17 = < 017>; // hex: 0xf + hd00d = < 0xd00d>; // hex: 0xd00d // hex: 0x4d2 0x163e 0x2334 0xd80 - stuff = <d# 1234 d# 5678 d# 9012 d# 3456>; + stuff = < 1234 5678 9012 3456>; - bad-d-1 = <d# abc123>; // Hrm. 0 - bad-d-2 = <d# 123456789012345>; - bad-o-1 = <o# 891>; - bad-o-2 = <o# 123456123456>; + bad-d-1 = < 0>; // Hrm. 0 + bad-d-2 = < 123456789012345>; + bad-o-1 = < 00>; + bad-o-2 = < 0123456123456>; }; };
tests/empty.dts +2 -0
@@ -1,2 +1,4 @@ +/dts-v1/; + / { };
tests/escapes.dts +2 -0
@@ -1,3 +1,5 @@ +/dts-v1/; + / { compatible = "test_string_escapes"; escape-str = "nastystring: \a\b\t\n\v\f\r\\\"";
tests/label01.dts +20 -18
@@ -1,6 +1,8 @@ -/memreserve/ 1000000000000000 0000000002000000; -memrsv2: /memreserve/ 2000000000000000-20ffffffffffffff; -/memreserve/ 0-13; +/dts-v1/; + +/memreserve/ 0x1000000000000000 0x0000000002000000; +memrsv2: /memreserve/ 0x2000000000000000 0x0100000000000000; +/memreserve/ 0x0000000000000000 0x0000000000000014; / { model = "MyBoardName";
@@ -9,28 +11,28 @@ memrsv2: /memreserve/ 2000000000000000-20ffffffffffffff; #size-cells = <2>; cpus { - linux,phandle = <1>; + linux,phandle = <0x1>; #address-cells = <1>; #size-cells = <0>; PowerPC,970@0 { name = "PowerPC,970"; device_type = "cpu"; - reg = <0>; - clock-frequency = <5f5e1000>; - timebase-frequency = <1FCA055>; + reg = <0x00000000>; + clock-frequency = <1600000000>; + timebase-frequency = <33333333>; linux,boot-cpu; - i-cache-size = <10000>; - d-cache-size = <8000>; + i-cache-size = <65536>; + d-cache-size = <32768>; }; PowerPC,970@1 { name = "PowerPC,970"; device_type = "cpu"; - reg = <1>; - clock-frequency = <5f5e1000>; - timebase-frequency = <1FCA055>; - i-cache-size = <10000>; - d-cache-size = <8000>; + reg = <0x00000001>; + clock-frequency = <1600000000>; + timebase-frequency = <33333333>; + i-cache-size = <65536>; + d-cache-size = <32768>; }; };
@@ -38,8 +40,8 @@ memrsv2: /memreserve/ 2000000000000000-20ffffffffffffff; node: randomnode { prop: string = str: "foo", str_mid: "stuffstuff\t\t\t\n\n\n" str_end: ; blob = [byte: 0a 0b 0c 0d byte_mid: de ea ad be ef byte_end: ]; - ref = < cell: &/memory@0 0 cell_mid: ffffffff cell_end: >; - mixed = "abc", pre: [1234] post: , gap: < aligned: a b c>; + ref = < cell: &{/memory@0} 0x0 cell_mid: 0xffffffff cell_end: >; + mixed = "abc", pre: [1234] post: , gap: < aligned: 0xa 0xb 0xc>; tricky1 = [61 lt1: 62 63 00]; subnode: child { };
@@ -49,12 +51,12 @@ memrsv2: /memreserve/ 2000000000000000-20ffffffffffffff; memory@0 { device_type = "memory"; - memreg: reg = <00000000 00000000 00000000 20000000>; + memreg: reg = <0x00000000 0x00000000 0x00000000 0x20000000>; }; chosen { bootargs = "root=/dev/sda2"; - linux,platform = <00000600>; + linux,platform = <0x600>; }; };
tests/references_dts0.dts +7 -5
@@ -1,19 +1,21 @@ +/dts-v1/; + / { /* Explicit phandles */ n1: node1 { - linux,phandle = <2000>; - ref = <&/node2>; /* reference precedes target */ + linux,phandle = <0x2000>; + ref = <&{/node2}>; /* reference precedes target */ lref = <&n2>; }; n2: node2 { - linux,phandle = <1>; - ref = <&/node1>; /* reference after target */ + linux,phandle = <0x1>; + ref = <&{/node1}>; /* reference after target */ lref = <&n1>; }; /* Implicit phandles */ n3: node3 { - ref = <&/node4>; + ref = <&{/node4}>; lref = <&n4>; }; n4: node4 {
tests/run_tests.sh +1 -26
@@ -71,13 +71,6 @@ run_dtc_test () { base_run_test wrap_test $VALGRIND $DTC "$@" } -CONVERT=../convert-dtsv0 - -run_convert_test () { - echo -n "convert-dtsv0 $@: " - base_run_test wrap_test $VALGRIND $CONVERT "$@" -} - tree1_tests () { TREE=$1
@@ -287,21 +280,6 @@ dtc_tests () { run_sh_test dtc-fatal.sh -I fs -O dtb nosuchfile } -convert_tests () { - V0_DTS="test_tree1_dts0.dts references_dts0.dts empty.dts escapes.dts \ - test01.dts label01.dts" - for dts in $V0_DTS; do - run_dtc_test -I dts -O dtb -o cvtraw_$dts.test.dtb $dts - run_dtc_test -I dts -O dts -o cvtdtc_$dts.test.dts $dts - run_dtc_test -I dts -O dtb -o cvtdtc_$dts.test.dtb cvtdtc_$dts.test.dts - run_convert_test $dts - run_dtc_test -I dts -O dtb -o cvtcvt_$dts.test.dtb ${dts}v1 - - run_wrap_test cmp cvtraw_$dts.test.dtb cvtdtc_$dts.test.dtb - run_wrap_test cmp cvtraw_$dts.test.dtb cvtcvt_$dts.test.dtb - done -} - while getopts "vt:m" ARG ; do case $ARG in "v")
@@ -317,7 +295,7 @@ while getopts "vt:m" ARG ; do done if [ -z "$TESTSETS" ]; then - TESTSETS="libfdt dtc convert" + TESTSETS="libfdt dtc" fi # Make sure we don't have stale blobs lying around
@@ -331,9 +309,6 @@ for set in $TESTSETS; do "dtc") dtc_tests ;; - "convert") - convert_tests - ;; esac done
tests/test01.dts +20 -18
@@ -1,6 +1,8 @@ -/memreserve/ 1000000000000000 0000000002000000; -/memreserve/ 2000000000000000-20ffffffffffffff; -/memreserve/ 0-13; +/dts-v1/; + +/memreserve/ 0x1000000000000000 0x0000000002000000; +/memreserve/ 0x2000000000000000 0x0100000000000000; +/memreserve/ 0x0000000000000000 0x0000000000000014; / { model = "MyBoardName";
@@ -9,28 +11,28 @@ #size-cells = <2>; cpus { - linux,phandle = <1>; + linux,phandle = <0x1>; #address-cells = <1>; #size-cells = <0>; PowerPC,970@0 { name = "PowerPC,970"; device_type = "cpu"; - reg = <0>; - clock-frequency = <5f5e1000>; - timebase-frequency = <1FCA055>; + reg = <0x00000000>; + clock-frequency = <1600000000>; + timebase-frequency = <33333333>; linux,boot-cpu; - i-cache-size = <10000>; - d-cache-size = <8000>; + i-cache-size = <65536>; + d-cache-size = <32768>; }; PowerPC,970@1 { name = "PowerPC,970"; device_type = "cpu"; - reg = <1>; - clock-frequency = <5f5e1000>; - timebase-frequency = <1FCA055>; - i-cache-size = <10000>; - d-cache-size = <8000>; + reg = <0x00000001>; + clock-frequency = <1600000000>; + timebase-frequency = <33333333>; + i-cache-size = <65536>; + d-cache-size = <32768>; }; };
@@ -38,18 +40,18 @@ randomnode { string = "\xff\0stuffstuff\t\t\t\n\n\n"; blob = [0a 0b 0c 0d de ea ad be ef]; - ref = < &/memory@0 >; - mixed = "abc", [1234], <a b c>; + ref = < &{/memory@0} >; + mixed = "abc", [1234], <0xa 0xb 0xc>; }; memory@0 { device_type = "memory"; - memreg: reg = <00000000 00000000 00000000 20000000>; + memreg: reg = <0x00000000 0x00000000 0x00000000 0x20000000>; }; chosen { bootargs = "root=/dev/sda2"; - linux,platform = <00000600>; + linux,platform = <0x600>; }; };
tests/test_tree1_dts0.dts +10 -8
@@ -1,9 +1,11 @@ -/memreserve/ deadbeef00000000-deadbeef000fffff; -/memreserve/ 75bcd15 1000; +/dts-v1/; + +/memreserve/ 0xdeadbeef00000000 0x0000000000100000; +/memreserve/ 0x00000000075bcd15 0x0000000000001000; / { compatible = "test_tree1"; - prop-int = <deadbeef>; + prop-int = <0xdeadbeef>; prop-str = "hello world"; subnode@1 {
@@ -12,18 +14,18 @@ subsubnode { compatible = "subsubnode1", "subsubnode"; - prop-int = <h# deadbeef>; + prop-int = < 0xdeadbeef>; }; }; subnode@2 { - linux,phandle = <2000>; - prop-int = <d# 123456789>; + linux,phandle = <0x2000>; + prop-int = < 123456789>; subsubnode@0 { - linux,phandle = <2001>; + linux,phandle = <0x2001>; compatible = "subsubnode2", "subsubnode"; - prop-int = <o# 0726746425>; + prop-int = < 0726746425>; }; }; };
Signature · 1 line
1.5.6
Quoted 3 lines · Jon Loeliger
Now that all in-kernel-tree DTS files are properly /dts-v1/, remove direct support for the older, un-numbered DTS source file format.
Um.. why? I just don't see a compelling reason to remove this backwards compatibility. It costs us very little to keep it around indefinitely.
Quoted 4 lines
Convert existing tests to /dts-v1/ and remove support for the conversion tests themselves.
For now, though, the conversion tool still exists.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · David Gibson
Quoted 3 lines · Jon Loeliger
Now that all in-kernel-tree DTS files are properly /dts-v1/, remove direct support for the older, un-numbered DTS source file format.
Um.. why? I just don't see a compelling reason to remove this backwards compatibility. It costs us very little to keep it around indefinitely.
I agree, why are we removing backwards compatibility? The dts-v1 format isn't that old, so I'm sure there are plenty of device trees out there, especially on our BSPs, that haven't been updated yet.
How about just printing a warning and saying that the device tree should be updated with the conversion tool?
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
Quoted 10 lines
Quoted 8 lines · David Gibson
Quoted 3 lines · Jon Loeliger
Now that all in-kernel-tree DTS files are properly /dts-v1/, remove direct support for the older, un-numbered DTS source file format.
Um.. why? I just don't see a compelling reason to remove this backwards compatibility. It costs us very little to keep it around indefinitely.
Because we are going to get rid of the cruft, simplify things, and move forward. Really. This was the plan from the onset.
Quoted 3 lines
I agree, why are we removing backwards compatibility? The dts-v1 format isn't that old, so I'm sure there are plenty of device trees out there, especially on our BSPs, that haven't been updated yet.
They can run the conversion tool and be fine.
Quoted 2 lines
How about just printing a warning and saying that the device tree should be updated with the conversion tool?
How about all the in-tree DTS files are already V1?
jdl
A message that is not in the archive (sent off-list or not yet received): E1KU1Td-0006ub-8O-CYoMK+44s/[email protected]
Quoted 7 lines · Jon Loeliger
Quoted 7 lines
Quoted 5 lines · David Gibson
Quoted 3 lines · Jon Loeliger
Now that all in-kernel-tree DTS files are properly /dts-v1/, remove direct support for the older, un-numbered DTS source file format.
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Um.. why? I just don't see a compelling reason to remove this backwards compatibility. It costs us very little to keep it around indefinitely.
Because we are going to get rid of the cruft, simplify things, and move forward. Really. This was the plan from the onset.
Uh.. removing compatibility for the old format was never part of *my* plan for the change. Discourage any further use of the v0 format, yes, remove support for, no.
I just don't see a benefit to this.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson