Commit 60a0004c authored by Frank Rowand's avatar Frank Rowand Committed by Rob Herring

of: overlay: add overlay unittest data for node names and symbols

Add nodes and properties to overlay_base and overlay dts files to
test for
   - incorrect existing node name detection when overlay node name
     has a unit-address
   - adding overlay __symbols__ properties to live tree when an
     overlay is added to the live tree

The following console messages will appear near the end of unittest
until the code errors are corrected:

   OF: Duplicate name in fairway-1, renamed to "ride@100#1"

   ### dt-test ### FAIL of_unittest_overlay_high_level():2296 Adding overlay 'overlay_bad_symbol' failed

   ### dt-test ### end of unittest - 190 passed, 1 failed
Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
parent 0d638a07
obj-y += testcases.dtb.o obj-y += testcases.dtb.o
targets += testcases.dtb testcases.dtb.S
ifdef CONFIG_OF_OVERLAY
obj-y += overlay.dtb.o obj-y += overlay.dtb.o
obj-y += overlay_bad_phandle.dtb.o obj-y += overlay_bad_phandle.dtb.o
obj-y += overlay_bad_symbol.dtb.o
obj-y += overlay_base.dtb.o obj-y += overlay_base.dtb.o
targets += testcases.dtb testcases.dtb.S
targets += overlay.dtb overlay.dtb.S targets += overlay.dtb overlay.dtb.S
targets += overlay_bad_phandle.dtb overlay_bad_phandle.dtb.S targets += overlay_bad_phandle.dtb overlay_bad_phandle.dtb.S
targets += overlay_bad_symbol.dtb overlay_bad_symbol.dtb.S
targets += overlay_base.dtb overlay_base.dtb.S targets += overlay_base.dtb overlay_base.dtb.S
.PRECIOUS: \
$(obj)/%.dtb.S \
$(obj)/%.dtb
# enable creation of __symbols__ node # enable creation of __symbols__ node
DTC_FLAGS_overlay := -@ DTC_FLAGS_overlay := -@
DTC_FLAGS_overlay_bad_phandle := -@ DTC_FLAGS_overlay_bad_phandle := -@
DTC_FLAGS_overlay_bad_symbol := -@
DTC_FLAGS_overlay_base := -@ DTC_FLAGS_overlay_base := -@
endif
.PRECIOUS: \
$(obj)/%.dtb.S \
$(obj)/%.dtb
...@@ -25,7 +25,22 @@ __overlay__ { ...@@ -25,7 +25,22 @@ __overlay__ {
#size-cells = <1>; #size-cells = <1>;
status = "ok"; status = "ok";
ride@200 { ride@100 {
#address-cells = <1>;
#size-cells = <1>;
track@30 {
incline-up = < 48 32 16 >;
};
track@40 {
incline-up = < 47 31 15 >;
};
};
ride_200: ride@200 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "ot,ferris-wheel"; compatible = "ot,ferris-wheel";
reg = < 0x00000200 0x100 >; reg = < 0x00000200 0x100 >;
hvac-provider = < &hvac_2 >; hvac-provider = < &hvac_2 >;
...@@ -36,6 +51,14 @@ ride@200 { ...@@ -36,6 +51,14 @@ ride@200 {
spin-rph = < 30 >; spin-rph = < 30 >;
gondolas = < 16 >; gondolas = < 16 >;
gondola-capacity = < 6 >; gondola-capacity = < 6 >;
ride_200_left: track@10 {
reg = < 0x00000010 0x10 >;
};
ride_200_right: track@20 {
reg = < 0x00000020 0x10 >;
};
}; };
}; };
}; };
......
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&electric_1>;
__overlay__ {
// This label should cause an error when the overlay
// is applied. There is already a symbol hvac_1
// in the base tree
hvac_1: hvac-medium-2 {
compatible = "ot,hvac-medium";
heat-range = < 50 75 >;
cool-range = < 60 80 >;
};
};
};
};
...@@ -44,6 +44,8 @@ rides_1: fairway-1 { ...@@ -44,6 +44,8 @@ rides_1: fairway-1 {
orientation = < 127 >; orientation = < 127 >;
ride@100 { ride@100 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "ot,roller-coaster"; compatible = "ot,roller-coaster";
reg = < 0x00000100 0x100 >; reg = < 0x00000100 0x100 >;
hvac-provider = < &hvac_1 >; hvac-provider = < &hvac_1 >;
...@@ -53,6 +55,15 @@ ride@100 { ...@@ -53,6 +55,15 @@ ride@100 {
spin-controller = < &spin_ctrl_2 5 &spin_ctrl_2 7 >; spin-controller = < &spin_ctrl_2 5 &spin_ctrl_2 7 >;
spin-controller-names = "track_1", "track_2"; spin-controller-names = "track_1", "track_2";
queues = < 2 >; queues = < 2 >;
track@30 {
reg = < 0x00000030 0x10 >;
};
track@40 {
reg = < 0x00000040 0x10 >;
};
}; };
}; };
......
...@@ -1994,6 +1994,8 @@ static void __init of_unittest_overlay(void) ...@@ -1994,6 +1994,8 @@ static void __init of_unittest_overlay(void)
static inline void __init of_unittest_overlay(void) { } static inline void __init of_unittest_overlay(void) { }
#endif #endif
#ifdef CONFIG_OF_OVERLAY
/* /*
* __dtb_ot_begin[] and __dtb_ot_end[] are created by cmd_dt_S_dtb * __dtb_ot_begin[] and __dtb_ot_end[] are created by cmd_dt_S_dtb
* in scripts/Makefile.lib * in scripts/Makefile.lib
...@@ -2021,14 +2023,14 @@ struct overlay_info { ...@@ -2021,14 +2023,14 @@ struct overlay_info {
OVERLAY_INFO_EXTERN(overlay_base); OVERLAY_INFO_EXTERN(overlay_base);
OVERLAY_INFO_EXTERN(overlay); OVERLAY_INFO_EXTERN(overlay);
OVERLAY_INFO_EXTERN(overlay_bad_phandle); OVERLAY_INFO_EXTERN(overlay_bad_phandle);
OVERLAY_INFO_EXTERN(overlay_bad_symbol);
#ifdef CONFIG_OF_OVERLAY
/* order of entries is hard-coded into users of overlays[] */ /* order of entries is hard-coded into users of overlays[] */
static struct overlay_info overlays[] = { static struct overlay_info overlays[] = {
OVERLAY_INFO(overlay_base, -9999), OVERLAY_INFO(overlay_base, -9999),
OVERLAY_INFO(overlay, 0), OVERLAY_INFO(overlay, 0),
OVERLAY_INFO(overlay_bad_phandle, -EINVAL), OVERLAY_INFO(overlay_bad_phandle, -EINVAL),
OVERLAY_INFO(overlay_bad_symbol, -EINVAL),
{} {}
}; };
...@@ -2300,6 +2302,10 @@ static __init void of_unittest_overlay_high_level(void) ...@@ -2300,6 +2302,10 @@ static __init void of_unittest_overlay_high_level(void)
unittest(overlay_data_add(2), unittest(overlay_data_add(2),
"Adding overlay 'overlay_bad_phandle' failed\n"); "Adding overlay 'overlay_bad_phandle' failed\n");
unittest(overlay_data_add(3),
"Adding overlay 'overlay_bad_symbol' failed\n");
return; return;
err_unlock: err_unlock:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment