summaryrefslogtreecommitdiff
path: root/src/devices/device_util.c
diff options
context:
space:
mode:
authorarch import user (historical) <svn@openbios.org>2005-07-06 17:13:46 +0000
committerarch import user (historical) <svn@openbios.org>2005-07-06 17:13:46 +0000
commit98d0d30f6b8237f888cd44b33292319e3c167a47 (patch)
tree0571a9e863b7a7749c2e4fd5bda7ec080831a73c /src/devices/device_util.c
parent577f185d382c8130f20f0ee7e8466ed8bbebbacc (diff)
downloadcoreboot-98d0d30f6b8237f888cd44b33292319e3c167a47.tar.xz
Revision: linuxbios@linuxbios.org--devel/freebios--devel--2.0--patch-30
Creator: Yinghai Lu <yhlu@tyan.com> Nvidia Ck804 support git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1946 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/devices/device_util.c')
-rw-r--r--src/devices/device_util.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/devices/device_util.c b/src/devices/device_util.c
index ff2d90ce6e..a19a878b47 100644
--- a/src/devices/device_util.c
+++ b/src/devices/device_util.c
@@ -64,6 +64,29 @@ struct device *dev_find_slot(unsigned int bus, unsigned int devfn)
return result;
}
+/**
+ * @brief Given a smbus bus and a device number, find the device structure
+ *
+ * @param bus The bus number
+ * @param addr a device number
+ * @return pointer to the device structure
+ */
+struct device *dev_find_slot_on_smbus(unsigned int bus, unsigned int addr)
+{
+ struct device *dev, *result;
+
+ result = 0;
+ for (dev = all_devices; dev; dev = dev->next) {
+ if ((dev->path.type == DEVICE_PATH_I2C) &&
+ (dev->bus->secondary == bus) &&
+ (dev->path.u.i2c.device == addr)) {
+ result = dev;
+ break;
+ }
+ }
+ return result;
+}
+
/** Find a device of a given vendor and type
* @param vendor Vendor ID (e.g. 0x8086 for Intel)
* @param device Device ID
@@ -125,7 +148,8 @@ const char *dev_path(device_t dev)
dev->path.u.pnp.port, dev->path.u.pnp.device);
break;
case DEVICE_PATH_I2C:
- sprintf(buffer, "I2C: %02x",
+ sprintf(buffer, "I2C: %02x:%02x",
+ dev->bus->secondary,
dev->path.u.i2c.device);
break;
case DEVICE_PATH_APIC: