Browse Source

Ensure all tests have matching reg and unit address

ePAPR 1.1 section 2.2.1.1 "Node Name Requirements" specifies that any
node that has a reg property must include a unit address in its name
with value matching the first entry in its reg property. Conversely, if
a node does not have a reg property, the node name must not include a
unit address.

Adjust all the dtc test-cases to conform to this rule.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
Stephen Warren 11 years ago committed by David Gibson
parent
commit
b290428d71
  1. 4
      tests/aliases.dts
  2. 5
      tests/include1.dts
  3. 1
      tests/include7.dts
  4. 1
      tests/include8.dts
  5. 7
      tests/sw_tree1.c
  6. 7
      tests/test_tree1_body.dtsi
  7. 7
      tests/test_tree1_merge.dts
  8. 7
      tests/test_tree1_merge_labelled.dts
  9. 7
      tests/test_tree1_merge_path.dts
  10. 7
      tests/test_tree1_wrong1.dts
  11. 7
      tests/test_tree1_wrong2.dts
  12. 7
      tests/test_tree1_wrong3.dts
  13. 7
      tests/test_tree1_wrong4.dts
  14. 7
      tests/test_tree1_wrong5.dts
  15. 7
      tests/test_tree1_wrong6.dts
  16. 7
      tests/test_tree1_wrong7.dts
  17. 7
      tests/test_tree1_wrong8.dts
  18. 7
      tests/test_tree1_wrong9.dts
  19. 10
      tests/trees.S

4
tests/aliases.dts

@ -1,6 +1,9 @@
/dts-v1/; /dts-v1/;


/ { / {
#address-cells = <1>;
#size-cells = <0>;

aliases { aliases {
s1 = &sub1; s1 = &sub1;
ss1 = &subsub1; ss1 = &subsub1;
@ -9,6 +12,7 @@


sub1: subnode@1 { sub1: subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;


subsub1: subsubnode { subsub1: subsubnode {
compatible = "subsubnode1", "subsubnode"; compatible = "subsubnode1", "subsubnode";

5
tests/include1.dts

@ -8,12 +8,17 @@
/include/ "include5.dts" = <0xdeadbeef>; /include/ "include5.dts" = <0xdeadbeef>;
prop-int64 /include/ "include5a.dts"; prop-int64 /include/ "include5a.dts";
prop-str = /include/ "include6.dts"; prop-str = /include/ "include6.dts";
#address-cells = <1>;
#size-cells = <0>;


/include/ "include7.dts" /include/ "include7.dts"


subnode@2 { subnode@2 {
reg = <2>;
linux,phandle = <0x2000>; linux,phandle = <0x2000>;
prop-int = <123456789>; prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;


/include/ "include8.dts" /include/ "include8.dts"
phandle = <0x2001>; phandle = <0x2001>;

1
tests/include7.dts

@ -1,5 +1,6 @@
subnode@1 { subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef]; prop-int = [deadbeef];


subsubnode { subsubnode {

1
tests/include8.dts

@ -1 +1,2 @@
subsubnode@0 { subsubnode@0 {
reg = <0>;

7
tests/sw_tree1.c

@ -57,9 +57,12 @@ int main(int argc, char *argv[])
CHECK(fdt_property_u32(fdt, "prop-int", TEST_VALUE_1)); CHECK(fdt_property_u32(fdt, "prop-int", TEST_VALUE_1));
CHECK(fdt_property_u64(fdt, "prop-int64", TEST_VALUE64_1)); CHECK(fdt_property_u64(fdt, "prop-int64", TEST_VALUE64_1));
CHECK(fdt_property_string(fdt, "prop-str", TEST_STRING_1)); CHECK(fdt_property_string(fdt, "prop-str", TEST_STRING_1));
CHECK(fdt_property_u32(fdt, "#address-cells", 1));
CHECK(fdt_property_u32(fdt, "#size-cells", 0));


CHECK(fdt_begin_node(fdt, "subnode@1")); CHECK(fdt_begin_node(fdt, "subnode@1"));
CHECK(fdt_property_string(fdt, "compatible", "subnode1")); CHECK(fdt_property_string(fdt, "compatible", "subnode1"));
CHECK(fdt_property_u32(fdt, "reg", 1));
CHECK(fdt_property_cell(fdt, "prop-int", TEST_VALUE_1)); CHECK(fdt_property_cell(fdt, "prop-int", TEST_VALUE_1));
CHECK(fdt_begin_node(fdt, "subsubnode")); CHECK(fdt_begin_node(fdt, "subsubnode"));
CHECK(fdt_property(fdt, "compatible", "subsubnode1\0subsubnode", CHECK(fdt_property(fdt, "compatible", "subsubnode1\0subsubnode",
@ -71,9 +74,13 @@ int main(int argc, char *argv[])
CHECK(fdt_end_node(fdt)); CHECK(fdt_end_node(fdt));


CHECK(fdt_begin_node(fdt, "subnode@2")); CHECK(fdt_begin_node(fdt, "subnode@2"));
CHECK(fdt_property_u32(fdt, "reg", 2));
CHECK(fdt_property_cell(fdt, "linux,phandle", PHANDLE_1)); CHECK(fdt_property_cell(fdt, "linux,phandle", PHANDLE_1));
CHECK(fdt_property_cell(fdt, "prop-int", TEST_VALUE_2)); CHECK(fdt_property_cell(fdt, "prop-int", TEST_VALUE_2));
CHECK(fdt_property_u32(fdt, "#address-cells", 1));
CHECK(fdt_property_u32(fdt, "#size-cells", 0));
CHECK(fdt_begin_node(fdt, "subsubnode@0")); CHECK(fdt_begin_node(fdt, "subsubnode@0"));
CHECK(fdt_property_u32(fdt, "reg", 0));
CHECK(fdt_property_cell(fdt, "phandle", PHANDLE_2)); CHECK(fdt_property_cell(fdt, "phandle", PHANDLE_2));
CHECK(fdt_property(fdt, "compatible", "subsubnode2\0subsubnode", CHECK(fdt_property(fdt, "compatible", "subsubnode2\0subsubnode",
23)); 23));

7
tests/test_tree1_body.dtsi

@ -6,9 +6,12 @@
prop-int = <0xdeadbeef>; prop-int = <0xdeadbeef>;
prop-int64 = /bits/ 64 <0xdeadbeef01abcdef>; prop-int64 = /bits/ 64 <0xdeadbeef01abcdef>;
prop-str = "hello world"; prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;


subnode@1 { subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef]; prop-int = [deadbeef];


subsubnode { subsubnode {
@ -21,10 +24,14 @@
}; };


subnode@2 { subnode@2 {
reg = <2>;
linux,phandle = <0x2000>; linux,phandle = <0x2000>;
prop-int = <123456789>; prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;


ssn0: subsubnode@0 { ssn0: subsubnode@0 {
reg = <0>;
phandle = <0x2001>; phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode"; compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>; prop-int = <0726746425>;

7
tests/test_tree1_merge.dts

@ -6,9 +6,12 @@
compatible = "test_tree1"; compatible = "test_tree1";
prop-int = "wrong!"; prop-int = "wrong!";
prop-str = "hello world"; prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;


subnode@1 { subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;


subsubnode { subsubnode {
compatible = "subsubnode1", "subsubnode"; compatible = "subsubnode1", "subsubnode";
@ -20,8 +23,11 @@
}; };


subnode@2 { subnode@2 {
reg = <2>;
linux,phandle = <0x2000>; linux,phandle = <0x2000>;
prop-int = <123456789>; prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;


ss2 { ss2 {
}; };
@ -36,6 +42,7 @@
}; };
subnode@2 { subnode@2 {
ssn0: subsubnode@0 { ssn0: subsubnode@0 {
reg = <0>;
phandle = <0x2001>; phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode"; compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>; prop-int = <0726746425>;

7
tests/test_tree1_merge_labelled.dts

@ -8,9 +8,12 @@
prop-int = <0xdeadbeef>; prop-int = <0xdeadbeef>;
prop-int64 = /bits/ 64 <0xdeadbeef01abcdef>; prop-int64 = /bits/ 64 <0xdeadbeef01abcdef>;
prop-str = "hello world"; prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;


subnode@1 { subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef]; prop-int = [deadbeef];


subsubnode { subsubnode {
@ -23,10 +26,14 @@
}; };


subnode@2 { subnode@2 {
reg = <2>;
linux,phandle = <0x2000>; linux,phandle = <0x2000>;
prop-int = <123456789>; prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;


ssn0: subsubnode@0 { ssn0: subsubnode@0 {
reg = <0>;
phandle = <0x2001>; phandle = <0x2001>;
prop-int = <0xbad>; prop-int = <0xbad>;
}; };

7
tests/test_tree1_merge_path.dts

@ -8,9 +8,12 @@
prop-int = <0xdeadbeef>; prop-int = <0xdeadbeef>;
prop-int64 = /bits/ 64 <0xdeadbeef01abcdef>; prop-int64 = /bits/ 64 <0xdeadbeef01abcdef>;
prop-str = "hello world"; prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;


subnode@1 { subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef]; prop-int = [deadbeef];


subsubnode { subsubnode {
@ -23,10 +26,14 @@
}; };


subnode@2 { subnode@2 {
reg = <2>;
linux,phandle = <0x2000>; linux,phandle = <0x2000>;
prop-int = <123456789>; prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;


ssn0: subsubnode@0 { ssn0: subsubnode@0 {
reg = <0>;
phandle = <0x2001>; phandle = <0x2001>;
prop-int = <0xbad>; prop-int = <0xbad>;
}; };

7
tests/test_tree1_wrong1.dts

@ -6,9 +6,12 @@
compatible = "test_tree1"; compatible = "test_tree1";
prop-int = <0xdeadbeef>; prop-int = <0xdeadbeef>;
prop-str = "hello world"; prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;


subnode@1 { subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef]; prop-int = [deadbeef];


subsubnode { subsubnode {
@ -21,10 +24,14 @@
}; };


subnode@2 { subnode@2 {
reg = <2>;
linux,phandle = <0x2000>; linux,phandle = <0x2000>;
prop-int = <123456789>; prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;


subsubnode@0 { subsubnode@0 {
reg = <0>;
phandle = <0x2001>; phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode"; compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>; prop-int = <0726746425>;

7
tests/test_tree1_wrong2.dts

@ -6,9 +6,12 @@
/ { / {
compatible = "test_tree1"; compatible = "test_tree1";
prop-str = "hello world"; prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;


subnode@1 { subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef]; prop-int = [deadbeef];


subsubnode { subsubnode {
@ -21,10 +24,14 @@
}; };


subnode@2 { subnode@2 {
reg = <2>;
linux,phandle = <0x2000>; linux,phandle = <0x2000>;
prop-int = <123456789>; prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;


subsubnode@0 { subsubnode@0 {
reg = <0>;
phandle = <0x2001>; phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode"; compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>; prop-int = <0726746425>;

7
tests/test_tree1_wrong3.dts

@ -7,9 +7,12 @@
compatible = "test_tree1"; compatible = "test_tree1";
prop-int = <0xdeadbeef>; prop-int = <0xdeadbeef>;
prop-str = "hello world"; prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;


subnode@1 { subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;


subsubnode { subsubnode {
compatible = "subsubnode1", "subsubnode"; compatible = "subsubnode1", "subsubnode";
@ -21,10 +24,14 @@
}; };


subnode@2 { subnode@2 {
reg = <2>;
linux,phandle = <0x2000>; linux,phandle = <0x2000>;
prop-int = <123456789>; prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;


subsubnode@0 { subsubnode@0 {
reg = <0>;
phandle = <0x2001>; phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode"; compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>; prop-int = <0726746425>;

7
tests/test_tree1_wrong4.dts

@ -7,9 +7,12 @@
compatible = "test_tree1"; compatible = "test_tree1";
prop-int = <0xdeadbeef>; prop-int = <0xdeadbeef>;
prop-str = "hello world"; prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;


subnode@1 { subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef]; prop-int = [deadbeef];


subsubnode { subsubnode {
@ -22,10 +25,14 @@
}; };


subnode@2 { subnode@2 {
reg = <2>;
linux,phandle = <0x2000>; linux,phandle = <0x2000>;
prop-int = <123456789>; prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;


subsubnode@0 { subsubnode@0 {
reg = <0>;
phandle = <0x2001>; phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode"; compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>; prop-int = <0726746425>;

7
tests/test_tree1_wrong5.dts

@ -7,9 +7,12 @@
compatible = "test_tree1"; compatible = "test_tree1";
prop-int = <0xdeadbefe>; prop-int = <0xdeadbefe>;
prop-str = "hello world"; prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;


subnode@1 { subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef]; prop-int = [deadbeef];


subsubnode { subsubnode {
@ -22,10 +25,14 @@
}; };


subnode@2 { subnode@2 {
reg = <2>;
linux,phandle = <0x2000>; linux,phandle = <0x2000>;
prop-int = <123456789>; prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;


subsubnode@0 { subsubnode@0 {
reg = <0>;
phandle = <0x2001>; phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode"; compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>; prop-int = <0726746425>;

7
tests/test_tree1_wrong6.dts

@ -7,9 +7,12 @@
compatible = "test_tree1"; compatible = "test_tree1";
prop-int = <0xdeadbeef>; prop-int = <0xdeadbeef>;
prop-str = "hello world"; prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;


subnode@1 { subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef]; prop-int = [deadbeef];


subsubnode { subsubnode {
@ -23,10 +26,14 @@
}; };


subnode@2 { subnode@2 {
reg = <2>;
linux,phandle = <0x2000>; linux,phandle = <0x2000>;
prop-int = <123456789>; prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;


subsubnode@0 { subsubnode@0 {
reg = <0>;
phandle = <0x2001>; phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode"; compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>; prop-int = <0726746425>;

7
tests/test_tree1_wrong7.dts

@ -7,9 +7,12 @@
compatible = "test_tree1"; compatible = "test_tree1";
prop-int = <0xdeadbeef>; prop-int = <0xdeadbeef>;
prop-str = "hello world"; prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;


subnode@1 { subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef]; prop-int = [deadbeef];


subsubnode { subsubnode {
@ -22,10 +25,14 @@
}; };


subnode@2 { subnode@2 {
reg = <2>;
linux,phandle = <0x2000>; linux,phandle = <0x2000>;
prop-int = <123456789>; prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;


subsubnode@0 { subsubnode@0 {
reg = <0>;
phandle = <0x2001>; phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode"; compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>; prop-int = <0726746425>;

7
tests/test_tree1_wrong8.dts

@ -7,9 +7,12 @@
compatible = "test_tree1"; compatible = "test_tree1";
prop-int = <0xdeadbeef>; prop-int = <0xdeadbeef>;
prop-str = "hello world"; prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;


subnode@1 { subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef]; prop-int = [deadbeef];


subsubnode { subsubnode {
@ -24,8 +27,12 @@
subnode@2 { subnode@2 {
linux,phandle = <0x2000>; linux,phandle = <0x2000>;
prop-int = <123456789>; prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
reg = <2>;


subsubnode@0 { subsubnode@0 {
reg = <0>;
phandle = <0x2001>; phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode"; compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>; prop-int = <0726746425>;

7
tests/test_tree1_wrong9.dts

@ -8,9 +8,12 @@
compatible = "test_tree1"; compatible = "test_tree1";
prop-int = <0xdeadbeef>; prop-int = <0xdeadbeef>;
prop-str = "hello world"; prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;


subnode@1 { subnode@1 {
compatible = "subnode1"; compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef]; prop-int = [deadbeef];


subsubnode { subsubnode {
@ -23,10 +26,14 @@
}; };


subnode@2 { subnode@2 {
reg = <2>;
linux,phandle = <0x2000>; linux,phandle = <0x2000>;
prop-int = <123456789>; prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;


subsubnode@0 { subsubnode@0 {
reg = <0>;
phandle = <0x2001>; phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode"; compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>; prop-int = <0726746425>;

10
tests/trees.S

@ -92,9 +92,12 @@ test_tree1_struct:
PROP_INT(test_tree1, prop_int, TEST_VALUE_1) PROP_INT(test_tree1, prop_int, TEST_VALUE_1)
PROP_INT64(test_tree1, prop_int64, TEST_VALUE64_1) PROP_INT64(test_tree1, prop_int64, TEST_VALUE64_1)
PROP_STR(test_tree1, prop_str, TEST_STRING_1) PROP_STR(test_tree1, prop_str, TEST_STRING_1)
PROP_INT(test_tree1, address_cells, 1)
PROP_INT(test_tree1, size_cells, 0)


BEGIN_NODE("subnode@1") BEGIN_NODE("subnode@1")
PROP_STR(test_tree1, compatible, "subnode1") PROP_STR(test_tree1, compatible, "subnode1")
PROP_INT(test_tree1, reg, 1)
PROP_INT(test_tree1, prop_int, TEST_VALUE_1) PROP_INT(test_tree1, prop_int, TEST_VALUE_1)


BEGIN_NODE("subsubnode") BEGIN_NODE("subsubnode")
@ -108,10 +111,14 @@ test_tree1_struct:
END_NODE END_NODE


BEGIN_NODE("subnode@2") BEGIN_NODE("subnode@2")
PROP_INT(test_tree1, reg, 2)
PROP_INT(test_tree1, linux_phandle, PHANDLE_1) PROP_INT(test_tree1, linux_phandle, PHANDLE_1)
PROP_INT(test_tree1, prop_int, TEST_VALUE_2) PROP_INT(test_tree1, prop_int, TEST_VALUE_2)
PROP_INT(test_tree1, address_cells, 1)
PROP_INT(test_tree1, size_cells, 0)


BEGIN_NODE("subsubnode@0") BEGIN_NODE("subsubnode@0")
PROP_INT(test_tree1, reg, 0)
PROP_INT(test_tree1, phandle, PHANDLE_2) PROP_INT(test_tree1, phandle, PHANDLE_2)
PROP_STR(test_tree1, compatible, "subsubnode2\0subsubnode") PROP_STR(test_tree1, compatible, "subsubnode2\0subsubnode")
PROP_INT(test_tree1, prop_int, TEST_VALUE_2) PROP_INT(test_tree1, prop_int, TEST_VALUE_2)
@ -133,6 +140,9 @@ test_tree1_strings:
STRING(test_tree1, prop_str, "prop-str") STRING(test_tree1, prop_str, "prop-str")
STRING(test_tree1, linux_phandle, "linux,phandle") STRING(test_tree1, linux_phandle, "linux,phandle")
STRING(test_tree1, phandle, "phandle") STRING(test_tree1, phandle, "phandle")
STRING(test_tree1, reg, "reg")
STRING(test_tree1, address_cells, "#address-cells")
STRING(test_tree1, size_cells, "#size-cells")
test_tree1_strings_end: test_tree1_strings_end:
test_tree1_end: test_tree1_end:



Loading…
Cancel
Save