From 83b991afff40e12a8b6756af06a472842edb1a66 Mon Sep 17 00:00:00 2001 From: Eric Biederman Date: Sat, 11 Oct 2003 06:20:25 +0000 Subject: - O2, enums, and switch statements work in romcc - Support for compiling romcc on non x86 platforms - new romc options -msse and -mmmx for specifying extra registers to use - Bug fixes to device the device disable/enable framework and an amd8111 implementation - Move the link specification to the chip specification instead of the path - Allow specifying devices with internal bridges. - Initial via epia support - Opteron errata fixes git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1200 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/devices/device_util.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/devices/device_util.c') diff --git a/src/devices/device_util.c b/src/devices/device_util.c index 384a3be8e0..6652c86ea0 100644 --- a/src/devices/device_util.c +++ b/src/devices/device_util.c @@ -30,15 +30,17 @@ device_t alloc_find_dev(struct bus *parent, struct device_path *path) */ struct device *dev_find_slot(unsigned int bus, unsigned int devfn) { - struct device *dev; + struct device *dev, *result; + result = 0; for (dev = all_devices; dev; dev = dev->next) { if ((dev->bus->secondary == bus) && (dev->path.u.pci.devfn == devfn)) { + result = dev; break; } } - return dev; + return result; } /** Find a device of a given vendor and type @@ -88,6 +90,9 @@ const char *dev_path(device_t dev) } else { switch(dev->path.type) { + case DEVICE_PATH_ROOT: + memcpy(buffer, "Root Device", 12); + break; case DEVICE_PATH_PCI: sprintf(buffer, "PCI: %02x:%02x.%01x", dev->bus->secondary, @@ -116,8 +121,12 @@ int path_eq(struct device_path *path1, struct device_path *path2) switch(path1->type) { case DEVICE_PATH_NONE: break; + case DEVICE_PATH_ROOT: + equal = 1; + break; case DEVICE_PATH_PCI: - equal = path1->u.pci.devfn == path2->u.pci.devfn; + equal = (path1->u.pci.bus == path2->u.pci.bus) && + (path1->u.pci.devfn == path2->u.pci.devfn); break; case DEVICE_PATH_PNP: equal = (path1->u.pnp.port == path2->u.pnp.port) && -- cgit v1.2.3