diff options
author | Eric Biederman <ebiederm@xmission.com> | 2004-10-14 20:54:17 +0000 |
---|---|---|
committer | Eric Biederman <ebiederm@xmission.com> | 2004-10-14 20:54:17 +0000 |
commit | b78c1972feed4c57eebba8f94de86a91e32c3fa7 (patch) | |
tree | 2ba60cfe9866f4d1e2de1d9727d0e548139afb35 /src/devices/chip.c | |
parent | cadfd4c462673bcb44cdb1f193e52c95a888762a (diff) |
- First pass through with with device tree enhancement merge. Most of the mechanisms should
be in place but don't expect anything to quite work yet.
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1662 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/devices/chip.c')
-rw-r--r-- | src/devices/chip.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/devices/chip.c b/src/devices/chip.c index 4c74949e46..8315fab674 100644 --- a/src/devices/chip.c +++ b/src/devices/chip.c @@ -69,7 +69,7 @@ void chip_enumerate(struct chip *chip) printk_debug("Enumerating: %s\n", chip->control->name); } - for (i = 0; i < MAX_CHIP_PATHS; i++) { + for(i = 0; i < MAX_CHIP_PATHS; i++) { int identical_paths; identical_paths = (i > 0) && @@ -90,7 +90,7 @@ void chip_enumerate(struct chip *chip) device_t dev; int i = 1; dev = chip->dev; - while (dev && (i != bus)) { + while(dev && (i != bus)) { dev = dev->next; i++; } @@ -103,21 +103,21 @@ void chip_enumerate(struct chip *chip) dev = alloc_dev(parent, &chip->path[i].path); break; } - } else { + } + else { link += 1; } if (dev) { struct chip_resource *res, *res_limit; - printk_spew("path (%p) %s %s", - dev, dev_path(dev), - identical_paths?"identical":""); + printk_spew("path (%p) %s %s", + dev, dev_path(dev), identical_paths?"identical":""); printk_spew(" parent: (%p) %s\n", - dev->bus->dev, dev_path(dev->bus->dev)); + dev->bus->dev, dev_path(dev->bus->dev)); dev->chip = chip; dev->enabled = chip->path[i].enabled; dev->links = link + 1; - for (child = chip->children; child; child = child->next) { + for(child = chip->children; child; child = child->next) { if (!child->bus && child->link == i) { child->bus = &dev->link[link]; } @@ -138,8 +138,10 @@ void chip_enumerate(struct chip *chip) chip->dev = dev; } } - - for (child = chip->children; child; child = child->next) { + if (chip->children && !chip->dev) { + die("No device but children?"); + } + for(child = chip->children; child; child = child->next) { if (!child->bus) { child->bus = &chip->dev->link[0]; } @@ -167,8 +169,7 @@ void chip_enumerate(struct chip *chip) static void enumerate_static_device_chain(struct chip *root) { struct chip *chip; - - for (chip = root; chip; chip = chip->next) { + for(chip = root; chip; chip = chip->next) { void (*enumerate)(struct chip *chip); enumerate = chip_enumerate; if (chip->control && chip->control->enumerate) { @@ -177,7 +178,7 @@ static void enumerate_static_device_chain(struct chip *root) enumerate(chip); } - for (chip = root; chip; chip = chip->next) { + for(chip = root; chip; chip = chip->next) { if (chip->children) { enumerate_static_device_chain(chip->children); } @@ -208,5 +209,6 @@ static void enumerate_static_device_chain(struct chip *root) void enumerate_static_devices(void) { printk_info("Enumerating static devices...\n"); + static_root.dev = &dev_root; enumerate_static_device_chain(&static_root); } |