summaryrefslogtreecommitdiff
path: root/src/device/device_util.c
diff options
context:
space:
mode:
authorVladimir Serbinenko <phcoder@gmail.com>2014-02-04 14:34:11 +0100
committerVladimir Serbinenko <phcoder@gmail.com>2014-02-07 09:06:05 +0100
commit400c05cf25b50701d39cbd90b94420b80b3a4748 (patch)
tree7c842efbc21ddf4e25868be00914b834e026ece0 /src/device/device_util.c
parent732cee31a6ab9b796043cb2455f4a19765a95c5a (diff)
downloadcoreboot-400c05cf25b50701d39cbd90b94420b80b3a4748.tar.xz
device_util: Add dev_find_slot_pnp.
Change-Id: I5223c54c8ddbc60a176e4d718730e99decc772a3 Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-on: http://review.coreboot.org/5112 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'src/device/device_util.c')
-rw-r--r--src/device/device_util.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/device/device_util.c b/src/device/device_util.c
index 38654fa586..83decc1188 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(u16 port, u8 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.