* [DTC PATCH] Remove overreaching semantic tests.
@ 2007-05-11 17:55 Scott Wood
2007-05-14 1:19 ` David Gibson
0 siblings, 1 reply; 5+ messages in thread
From: Scott Wood @ 2007-05-11 17:55 UTC (permalink / raw)
To: linuxppc-dev
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@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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [DTC PATCH] Remove overreaching semantic tests.
2007-05-11 17:55 [DTC PATCH] Remove overreaching semantic tests Scott Wood
@ 2007-05-14 1:19 ` David Gibson
2007-05-14 12:40 ` Segher Boessenkool
2007-05-14 15:51 ` Scott Wood
0 siblings, 2 replies; 5+ messages in thread
From: David Gibson @ 2007-05-14 1:19 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
On Fri, May 11, 2007 at 12:55:54PM -0500, Scott Wood wrote:
> 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@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.
Exactly - which is why I really don't want to simply tear out this
checking code. I've never gotten around to reworking the
error/warning system so it can sensibly divide things into such
classes, and keep detecting further warnings after picking up some
non-fatal ones and so forth.
I'd much prefer you just disable these tests for now, either by
commenting code out, or removing calls to checking functions. That
will make it easier to optionally reinstate later.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [DTC PATCH] Remove overreaching semantic tests.
2007-05-14 1:19 ` David Gibson
@ 2007-05-14 12:40 ` Segher Boessenkool
2007-05-14 15:51 ` Scott Wood
1 sibling, 0 replies; 5+ messages in thread
From: Segher Boessenkool @ 2007-05-14 12:40 UTC (permalink / raw)
To: David Gibson; +Cc: linuxppc-dev
> Exactly - which is why I really don't want to simply tear out this
> checking code. I've never gotten around to reworking the
> error/warning system so it can sensibly divide things into such
> classes, and keep detecting further warnings after picking up some
> non-fatal ones and so forth.
>
> I'd much prefer you just disable these tests for now, either by
> commenting code out, or removing calls to checking functions. That
> will make it easier to optionally reinstate later.
IMO it would be better to have a separate tool to do
semantical checking on a DTB. Until that exists, it
can be helpful to have some checks in the DT compiler.
Segher
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [DTC PATCH] Remove overreaching semantic tests.
2007-05-14 1:19 ` David Gibson
2007-05-14 12:40 ` Segher Boessenkool
@ 2007-05-14 15:51 ` Scott Wood
2007-05-15 0:57 ` David Gibson
1 sibling, 1 reply; 5+ messages in thread
From: Scott Wood @ 2007-05-14 15:51 UTC (permalink / raw)
To: David Gibson; +Cc: linuxppc-dev
David Gibson wrote:
> On Fri, May 11, 2007 at 12:55:54PM -0500, Scott Wood wrote:
>>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.
>
> Exactly - which is why I really don't want to simply tear out this
> checking code. I've never gotten around to reworking the
> error/warning system so it can sensibly divide things into such
> classes, and keep detecting further warnings after picking up some
> non-fatal ones and so forth.
>
> I'd much prefer you just disable these tests for now, either by
> commenting code out, or removing calls to checking functions. That
> will make it easier to optionally reinstate later.
Well, I figured the code would still be there in git, so getting it back
wouldn't be too hard. I can submit a patch that hides it behind a
--warn-missing (or whatever) option, though.
-Scott
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [DTC PATCH] Remove overreaching semantic tests.
2007-05-14 15:51 ` Scott Wood
@ 2007-05-15 0:57 ` David Gibson
0 siblings, 0 replies; 5+ messages in thread
From: David Gibson @ 2007-05-15 0:57 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
On Mon, May 14, 2007 at 10:51:51AM -0500, Scott Wood wrote:
> David Gibson wrote:
> > On Fri, May 11, 2007 at 12:55:54PM -0500, Scott Wood wrote:
> >>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.
> >
> > Exactly - which is why I really don't want to simply tear out this
> > checking code. I've never gotten around to reworking the
> > error/warning system so it can sensibly divide things into such
> > classes, and keep detecting further warnings after picking up some
> > non-fatal ones and so forth.
> >
> > I'd much prefer you just disable these tests for now, either by
> > commenting code out, or removing calls to checking functions. That
> > will make it easier to optionally reinstate later.
>
> Well, I figured the code would still be there in git, so getting it back
> wouldn't be too hard. I can submit a patch that hides it behind a
> --warn-missing (or whatever) option, though.
I'd prefer that, thank you.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-05-15 0:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-11 17:55 [DTC PATCH] Remove overreaching semantic tests Scott Wood
2007-05-14 1:19 ` David Gibson
2007-05-14 12:40 ` Segher Boessenkool
2007-05-14 15:51 ` Scott Wood
2007-05-15 0:57 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).