[Skiboot] [PATCH 1/4] hdata/test: Fix up linux,sml-base property

Oliver O'Halloran oohall at gmail.com
Tue Feb 19 18:53:36 AEDT 2019


The linux,sml-base property stores a raw pointer into the HDAT area.
When running the hdat parser tester the load address of the HDAT will
change each time the tool is run so we need to sanatise the property
to get consistent output.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 hdata/test/hdata_to_dt.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/hdata/test/hdata_to_dt.c b/hdata/test/hdata_to_dt.c
index fd2957ce60d0..a5f152e86b63 100644
--- a/hdata/test/hdata_to_dt.c
+++ b/hdata/test/hdata_to_dt.c
@@ -253,8 +253,23 @@ static void squash_blobs(struct dt_node *root)
 
 static void dump_hdata_fdt(struct dt_node *root)
 {
+	struct dt_node *n;
 	void *fdt_blob;
 
+	/* delete some properties that hardcode pointers */
+	dt_for_each_node(dt_root, n) {
+		struct dt_property *base;
+
+		/*
+		 * sml-base is a raw pointer into the HDAT area so it changes
+		 * on each execution of hdata_to_dt. Work around this by
+		 * zeroing it.
+		 */
+		base = __dt_find_property(n, "linux,sml-base");
+		if (base)
+			memset(base->prop, 0, base->len);
+	}
+
 	fdt_blob = create_dtb(root, false);
 
 	if (!fdt_blob) {
-- 
2.20.1



More information about the Skiboot mailing list