[DTC PATCH] Remove overreaching semantic tests.

Scott Wood scottwood at freescale.com
Sat May 12 03:55:54 EST 2007


Now that there are more usage models than "complete device tree in the
DTS" and "minimally device-tree aware u-boot that still needs zeroed out
properties to fill in", many of the checks that dtc performs are no
longer appropriate, since the nodes and properties in question can be
added at runtime.

Note that -f is *not* an alternative, as that suppresses all checks.  I
still want it to check for things that are present but wrong; I just
don't want it complaining about things that aren't there at all.

Signed-off-by: Scott Wood <scottwood at freescale.com>
---
I wouldn't be opposed to keeping these tests around if there were a
command line option that cleanly separates the errors/warnings into
classes such as structural, semantic-missing, semantic-broken, etc.

 livetree.c |  127 ------------------------------------------------------------
 1 files changed, 0 insertions(+), 127 deletions(-)

diff --git a/livetree.c b/livetree.c
index ce73f50..492713b 100644
--- a/livetree.c
+++ b/livetree.c
@@ -153,14 +153,6 @@ struct reserve_info *add_reserve_entry(struct reserve_info *list,
  * Tree accessor functions
  */
 
-static char *get_unitname(struct node *node)
-{
-	if (node->name[node->basenamelen] == '\0')
-		return "";
-	else
-		return node->name + node->basenamelen + 1;
-}
-
 static struct property *get_property(struct node *node, char *propname)
 {
 	struct property *prop;
@@ -465,122 +457,6 @@ static int check_structure(struct node *tree)
 				(propname), (node)->fullpath); \
 	} while (0)
 
-static int check_root(struct node *root)
-{
-	struct property *prop;
-	int ok = 1;
-
-	CHECK_HAVE_STRING(root, "model");
-
-	CHECK_HAVE(root, "#address-cells");
-	CHECK_HAVE(root, "#size-cells");
-
-	CHECK_HAVE_WARN(root, "compatible");
-
-	return ok;
-}
-
-static int check_cpus(struct node *root, int outversion, int boot_cpuid_phys)
-{
-	struct node *cpus, *cpu;
-	struct property *prop;
-	struct node *bootcpu = NULL;
-	int ok = 1;
-
-	cpus = get_subnode(root, "cpus");
-	if (! cpus) {
-		ERRMSG("Missing /cpus node\n");
-		return 0;
-	}
-
-	CHECK_HAVE_WARN(cpus, "#address-cells");
-	CHECK_HAVE_WARN(cpus, "#size-cells");
-
-	for_each_child(cpus, cpu) {
-		CHECK_HAVE_STREQ(cpu, "device_type", "cpu");
-
-		if (cpu->addr_cells != 1)
-			DO_ERR("%s has bad #address-cells value %d (should be 1)\n",
-			       cpu->fullpath, cpu->addr_cells);
-		if (cpu->size_cells != 0)
-			DO_ERR("%s has bad #size-cells value %d (should be 0)\n",
-			       cpu->fullpath, cpu->size_cells);
-
-		CHECK_HAVE_ONECELL(cpu, "reg");
-		if (prop) {
-			cell_t unitnum;
-			char *eptr;
-
-			unitnum = strtol(get_unitname(cpu), &eptr, 16);
-			if (*eptr) {
-				WARNMSG("%s has bad format unit name %s (should be CPU number\n",
-					cpu->fullpath, get_unitname(cpu));
-			} else if (unitnum != propval_cell(prop)) {
-				WARNMSG("%s unit name \"%s\" does not match \"reg\" property <%x>\n",
-				       cpu->fullpath, get_unitname(cpu),
-				       propval_cell(prop));
-			}
-		}
-
-/* 		CHECK_HAVE_ONECELL(cpu, "d-cache-line-size"); */
-/* 		CHECK_HAVE_ONECELL(cpu, "i-cache-line-size"); */
-		CHECK_HAVE_ONECELL(cpu, "d-cache-size");
-		CHECK_HAVE_ONECELL(cpu, "i-cache-size");
-
-		CHECK_HAVE_WARN_ONECELL(cpu, "clock-frequency");
-		CHECK_HAVE_WARN_ONECELL(cpu, "timebase-frequency");
-
-		prop = get_property(cpu, "linux,boot-cpu");
-		if (prop) {
-			if (prop->val.len)
-				WARNMSG("\"linux,boot-cpu\" property in %s is non-empty\n",
-					cpu->fullpath);
-			if (bootcpu)
-				DO_ERR("Multiple boot cpus (%s and %s)\n",
-				       bootcpu->fullpath, cpu->fullpath);
-			else
-				bootcpu = cpu;
-		}
-	}
-
-	if (outversion < 2) {
-		if (! bootcpu)
-			WARNMSG("No cpu has \"linux,boot-cpu\" property\n");
-	} else {
-		if (bootcpu)
-			WARNMSG("\"linux,boot-cpu\" property is deprecated in blob version 2 or higher\n");
-		if (boot_cpuid_phys == 0xfeedbeef)
-			WARNMSG("physical boot CPU not set.  Use -b option to set\n");
-	}
-
-	return ok;	
-}
-
-static int check_memory(struct node *root)
-{
-	struct node *mem;
-	struct property *prop;
-	int nnodes = 0;
-	int ok = 1;
-
-	for_each_child(root, mem) {
-		if (! strneq(mem->name, "memory", mem->basenamelen))
-			continue;
-
-		nnodes++;
-
-		CHECK_HAVE_STREQ(mem, "device_type", "memory");
-		CHECK_HAVE(mem, "reg");
-	}
-
-	if (nnodes == 0) {
-		ERRMSG("No memory nodes\n");
-		return 0;
-	}
-
-	return ok;	
-}
-
 static int check_chosen(struct node *root)
 {
 	struct node *chosen;
@@ -748,9 +624,6 @@ int check_device_tree(struct node *dt, int outversion, int boot_cpuid_phys)
 	if (! ok)
 		return 0;
 
-	ok = ok && check_root(dt);
-	ok = ok && check_cpus(dt, outversion, boot_cpuid_phys);
-	ok = ok && check_memory(dt);
 	ok = ok && check_chosen(dt);
 	if (! ok)
 		return 0;
-- 
1.5.0.3



More information about the Linuxppc-dev mailing list