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>
This commit is contained in:
Stephen Warren 2013-09-19 22:15:13 +10:00 committed by David Gibson
parent 9476db68b6
commit b290428d71
19 changed files with 120 additions and 1 deletions

View file

@ -1,6 +1,9 @@
/dts-v1/;
/ {
#address-cells = <1>;
#size-cells = <0>;
aliases {
s1 = &sub1;
ss1 = &subsub1;
@ -9,6 +12,7 @@
sub1: subnode@1 {
compatible = "subnode1";
reg = <1>;
subsub1: subsubnode {
compatible = "subsubnode1", "subsubnode";

View file

@ -8,12 +8,17 @@
/include/ "include5.dts" = <0xdeadbeef>;
prop-int64 /include/ "include5a.dts";
prop-str = /include/ "include6.dts";
#address-cells = <1>;
#size-cells = <0>;
/include/ "include7.dts"
subnode@2 {
reg = <2>;
linux,phandle = <0x2000>;
prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
/include/ "include8.dts"
phandle = <0x2001>;

View file

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

View file

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

View file

@ -57,9 +57,12 @@ int main(int argc, char *argv[])
CHECK(fdt_property_u32(fdt, "prop-int", TEST_VALUE_1));
CHECK(fdt_property_u64(fdt, "prop-int64", TEST_VALUE64_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_property_string(fdt, "compatible", "subnode1"));
CHECK(fdt_property_u32(fdt, "reg", 1));
CHECK(fdt_property_cell(fdt, "prop-int", TEST_VALUE_1));
CHECK(fdt_begin_node(fdt, "subsubnode"));
CHECK(fdt_property(fdt, "compatible", "subsubnode1\0subsubnode",
@ -71,9 +74,13 @@ int main(int argc, char *argv[])
CHECK(fdt_end_node(fdt));
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, "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_property_u32(fdt, "reg", 0));
CHECK(fdt_property_cell(fdt, "phandle", PHANDLE_2));
CHECK(fdt_property(fdt, "compatible", "subsubnode2\0subsubnode",
23));

View file

@ -6,9 +6,12 @@
prop-int = <0xdeadbeef>;
prop-int64 = /bits/ 64 <0xdeadbeef01abcdef>;
prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;
subnode@1 {
compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef];
subsubnode {
@ -21,10 +24,14 @@
};
subnode@2 {
reg = <2>;
linux,phandle = <0x2000>;
prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
ssn0: subsubnode@0 {
reg = <0>;
phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>;

View file

@ -6,9 +6,12 @@
compatible = "test_tree1";
prop-int = "wrong!";
prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;
subnode@1 {
compatible = "subnode1";
reg = <1>;
subsubnode {
compatible = "subsubnode1", "subsubnode";
@ -20,8 +23,11 @@
};
subnode@2 {
reg = <2>;
linux,phandle = <0x2000>;
prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
ss2 {
};
@ -36,6 +42,7 @@
};
subnode@2 {
ssn0: subsubnode@0 {
reg = <0>;
phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>;

View file

@ -8,9 +8,12 @@
prop-int = <0xdeadbeef>;
prop-int64 = /bits/ 64 <0xdeadbeef01abcdef>;
prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;
subnode@1 {
compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef];
subsubnode {
@ -23,10 +26,14 @@
};
subnode@2 {
reg = <2>;
linux,phandle = <0x2000>;
prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
ssn0: subsubnode@0 {
reg = <0>;
phandle = <0x2001>;
prop-int = <0xbad>;
};

View file

@ -8,9 +8,12 @@
prop-int = <0xdeadbeef>;
prop-int64 = /bits/ 64 <0xdeadbeef01abcdef>;
prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;
subnode@1 {
compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef];
subsubnode {
@ -23,10 +26,14 @@
};
subnode@2 {
reg = <2>;
linux,phandle = <0x2000>;
prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
ssn0: subsubnode@0 {
reg = <0>;
phandle = <0x2001>;
prop-int = <0xbad>;
};

View file

@ -6,9 +6,12 @@
compatible = "test_tree1";
prop-int = <0xdeadbeef>;
prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;
subnode@1 {
compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef];
subsubnode {
@ -21,10 +24,14 @@
};
subnode@2 {
reg = <2>;
linux,phandle = <0x2000>;
prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
subsubnode@0 {
reg = <0>;
phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>;

View file

@ -6,9 +6,12 @@
/ {
compatible = "test_tree1";
prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;
subnode@1 {
compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef];
subsubnode {
@ -21,10 +24,14 @@
};
subnode@2 {
reg = <2>;
linux,phandle = <0x2000>;
prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
subsubnode@0 {
reg = <0>;
phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>;

View file

@ -7,9 +7,12 @@
compatible = "test_tree1";
prop-int = <0xdeadbeef>;
prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;
subnode@1 {
compatible = "subnode1";
reg = <1>;
subsubnode {
compatible = "subsubnode1", "subsubnode";
@ -21,10 +24,14 @@
};
subnode@2 {
reg = <2>;
linux,phandle = <0x2000>;
prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
subsubnode@0 {
reg = <0>;
phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>;

View file

@ -7,9 +7,12 @@
compatible = "test_tree1";
prop-int = <0xdeadbeef>;
prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;
subnode@1 {
compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef];
subsubnode {
@ -22,10 +25,14 @@
};
subnode@2 {
reg = <2>;
linux,phandle = <0x2000>;
prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
subsubnode@0 {
reg = <0>;
phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>;

View file

@ -7,9 +7,12 @@
compatible = "test_tree1";
prop-int = <0xdeadbefe>;
prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;
subnode@1 {
compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef];
subsubnode {
@ -22,10 +25,14 @@
};
subnode@2 {
reg = <2>;
linux,phandle = <0x2000>;
prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
subsubnode@0 {
reg = <0>;
phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>;

View file

@ -7,9 +7,12 @@
compatible = "test_tree1";
prop-int = <0xdeadbeef>;
prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;
subnode@1 {
compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef];
subsubnode {
@ -23,10 +26,14 @@
};
subnode@2 {
reg = <2>;
linux,phandle = <0x2000>;
prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
subsubnode@0 {
reg = <0>;
phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>;

View file

@ -7,9 +7,12 @@
compatible = "test_tree1";
prop-int = <0xdeadbeef>;
prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;
subnode@1 {
compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef];
subsubnode {
@ -22,10 +25,14 @@
};
subnode@2 {
reg = <2>;
linux,phandle = <0x2000>;
prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
subsubnode@0 {
reg = <0>;
phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>;

View file

@ -7,9 +7,12 @@
compatible = "test_tree1";
prop-int = <0xdeadbeef>;
prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;
subnode@1 {
compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef];
subsubnode {
@ -24,8 +27,12 @@
subnode@2 {
linux,phandle = <0x2000>;
prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
reg = <2>;
subsubnode@0 {
reg = <0>;
phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>;

View file

@ -8,9 +8,12 @@
compatible = "test_tree1";
prop-int = <0xdeadbeef>;
prop-str = "hello world";
#address-cells = <1>;
#size-cells = <0>;
subnode@1 {
compatible = "subnode1";
reg = <1>;
prop-int = [deadbeef];
subsubnode {
@ -23,10 +26,14 @@
};
subnode@2 {
reg = <2>;
linux,phandle = <0x2000>;
prop-int = <123456789>;
#address-cells = <1>;
#size-cells = <0>;
subsubnode@0 {
reg = <0>;
phandle = <0x2001>;
compatible = "subsubnode2", "subsubnode";
prop-int = <0726746425>;

View file

@ -92,9 +92,12 @@ test_tree1_struct:
PROP_INT(test_tree1, prop_int, TEST_VALUE_1)
PROP_INT64(test_tree1, prop_int64, TEST_VALUE64_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")
PROP_STR(test_tree1, compatible, "subnode1")
PROP_INT(test_tree1, reg, 1)
PROP_INT(test_tree1, prop_int, TEST_VALUE_1)
BEGIN_NODE("subsubnode")
@ -108,10 +111,14 @@ test_tree1_struct:
END_NODE
BEGIN_NODE("subnode@2")
PROP_INT(test_tree1, reg, 2)
PROP_INT(test_tree1, linux_phandle, PHANDLE_1)
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")
PROP_INT(test_tree1, reg, 0)
PROP_INT(test_tree1, phandle, PHANDLE_2)
PROP_STR(test_tree1, compatible, "subsubnode2\0subsubnode")
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, linux_phandle, "linux,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_end: