From 7faae8309c91009f2448884a9410a2494bc3b222 Mon Sep 17 00:00:00 2001 From: Eric Biederman Date: Mon, 18 Oct 2004 21:21:06 +0000 Subject: - Set the parent's link properly in the bus field git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1686 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/newconfig/config.g | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'util/newconfig/config.g') diff --git a/util/newconfig/config.g b/util/newconfig/config.g index a44f2af987..361088d2b9 100644 --- a/util/newconfig/config.g +++ b/util/newconfig/config.g @@ -108,7 +108,7 @@ class debug_info: print str global debug -debug = debug_info(debug_info.dumptree) +debug = debug_info(debug_info.none) # ----------------------------------------------------------------------------- # Error Handling @@ -727,6 +727,22 @@ class partobj: fatal("Device %s has no device parent; this is a config file error" % self.readable_name()) return parent + def firstparentdevicelink(self): + """Find the first device in the parent link and record which link it is.""" + link = 0 + parent = self.parent + while (parent and (parent.parent != parent) and (parent.chip_or_device != 'device')): + parent = parent.parent + if ((parent.parent != parent) and (parent.chip_or_device != 'device')): + parent = 0 + while(parent and (parent.dup == 1)): + parent = parent.prev_sibling + link = link + 1 + if (not parent): + fatal("Device %s has no device parent; this is a config file error" % self.readable_name()) + return link + + def firstparentchip(self): """Find the first chip in the parent link.""" parent = self.parent @@ -809,7 +825,9 @@ class partobj: file.write("struct device %s = {\n" % self.instance_name) file.write("\t.ops = 0,\n") - file.write("\t.bus = &%s.link[0],\n" % self.firstparentdevice().instance_name) + file.write("\t.bus = &%s.link[%d],\n" % \ + (self.firstparentdevice().instance_name, \ + self.firstparentdevicelink())) file.write("\t.path = {%s},\n" % self.path) file.write("\t.enabled = %d,\n" % self.enabled) if (self.resources): -- cgit v1.2.3