Vladimir Serbinenko (phcoder@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5112
-gerrit
commit 3d635b2efa8cc61a83339f7dd9b8cd4f2ce92114 Author: Vladimir Serbinenko phcoder@gmail.com Date: Tue Feb 4 14:34:11 2014 +0100
device_util: Add dev_find_slot_pnp.
Change-Id: I5223c54c8ddbc60a176e4d718730e99decc772a3 Signed-off-by: Vladimir Serbinenko phcoder@gmail.com --- src/device/device_util.c | 21 +++++++++++++++++++++ src/include/device/device.h | 1 + 2 files changed, 22 insertions(+)
diff --git a/src/device/device_util.c b/src/device/device_util.c index 38654fa..d9a09a0 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -94,6 +94,27 @@ struct device *dev_find_slot_on_smbus(unsigned int bus, unsigned int addr) }
/** + * Given a PnP port and a device number, find the device structure. + * + * @param port The I/O port. + * @param device Logical device number. + * @return Pointer to the device structure (if found), 0 otherwise. + */ +struct device *dev_find_slot_pnp(unsigned int port, unsigned int device) +{ + struct device *dev; + + for (dev = all_devices; dev; dev = dev->next) { + if ((dev->path.type == DEVICE_PATH_PNP) && + (dev->path.pnp.port == port) && + (dev->path.pnp.device == device)) { + return dev; + } + } + return 0; +} + +/** * Given a Local APIC ID, find the device structure. * * @param apic_id The Local APIC ID number. diff --git a/src/include/device/device.h b/src/include/device/device.h index c1a2c3d..3801409 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -169,6 +169,7 @@ device_t dev_find_device (u16 vendor, u16 device, device_t from); device_t dev_find_class (unsigned int class, device_t from); device_t dev_find_slot (unsigned int bus, unsigned int devfn); device_t dev_find_slot_on_smbus (unsigned int bus, unsigned int addr); +device_t dev_find_slot_pnp(unsigned int port, unsigned int device); device_t dev_find_lapic(unsigned apic_id); int dev_count_cpu(void);