Author: stepan Date: Mon Aug 9 14:02:00 2010 New Revision: 5686 URL: https://tracker.coreboot.org/trac/coreboot/changeset/5686
Log: non-root devices are not supposed to be accessed outside of static.c except by walking the tree.
Signed-off-by: Stefan Reinauer stepan@coresystems.de Acked-by: Stefan Reinauer stepan@coresystems.de
Modified: trunk/util/sconfig/main.c
Modified: trunk/util/sconfig/main.c ============================================================================== --- trunk/util/sconfig/main.c Thu Aug 5 16:41:29 2010 (r5685) +++ trunk/util/sconfig/main.c Mon Aug 9 14:02:00 2010 (r5686) @@ -283,18 +283,20 @@ if (ptr->type == device && ptr->id == 0) fprintf(fil, "struct bus %s_links[];\n", ptr->name); if ((ptr->type == device) && (ptr->id != 0) && (!ptr->used)) { - fprintf(fil, "struct device %s;\n", ptr->name); + fprintf(fil, "static struct device %s;\n", ptr->name); if (ptr->rescnt > 0) fprintf(fil, "struct resource %s_res[];\n", ptr->name); if (ptr->children || ptr->multidev) fprintf(fil, "struct bus %s_links[];\n", ptr->name); } if ((ptr->type == device) && (ptr->id != 0) && ptr->used) - fprintf(fil, "struct device %s;\n", ptr->aliased_name); + fprintf(fil, "static struct device %s;\n", ptr->aliased_name); }
static void pass1(FILE *fil, struct device *ptr) { if (!ptr->used && (ptr->type == device)) { + if (ptr->id != 0) + fprintf(fil, "static ", ptr->name); fprintf(fil, "struct device %s = {\n", ptr->name); fprintf(fil, "\t.ops = %s,\n", (ptr->ops)?(ptr->ops):"0"); fprintf(fil, "\t.bus = &%s_links[%d],\n", ptr->bus->name, ptr->bus->link);
repository service wrote:
non-root devices are not supposed to be accessed outside of static.c except by walking the tree.
Hmm, how does this fit with the gx2/lx code that looks for 5536, or if it was the other way around?
//Peter
On 8/9/10 2:16 PM, Peter Stuge wrote:
repository service wrote:
non-root devices are not supposed to be accessed outside of static.c except by walking the tree.
Hmm, how does this fit with the gx2/lx code that looks for 5536, or if it was the other way around?
All device operations within coreboot are done by walking the device tree. No devices except the root node are externally referenced.
BTW: Sorry for breaking the tree, I tested the change long ago when I implemented it, and then again in a tree without "WARNINGS_ARE_ERRORS". Looking into those lost devices (which potentially indicates a bug in sconfig or devicetree.cb)
Stefan
Am 09.08.2010 14:16, schrieb Peter Stuge:
repository service wrote:
non-root devices are not supposed to be accessed outside of static.c except by walking the tree.
Hmm, how does this fit with the gx2/lx code that looks for 5536, or if it was the other way around?
I _really_ hope that code doesn't rely on the dev_* naming of the static device tree nodes. So ideally, it already walks the tree (but I didn't look).
I'm currently investigating the other issue with that patch.
Patrick