diff options
author | Duncan Laurie <dlaurie@chromium.org> | 2011-07-18 10:41:36 -0700 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2012-03-09 20:34:03 +0100 |
commit | 6f88a6ec7dce8eb12f52afcc0f7fcbaececa06e7 (patch) | |
tree | b520d5c7110b96e64e72ff47b38c819bb66c8f3a /src/devices/device_util.c | |
parent | 5807555f9a0afb94ad92535dd2933ee4dbd25088 (diff) |
Add helper function to find a Local APIC by ID in the device tree.
Change-Id: Ie2d7d8e1f647a0c92d2de09e32454fbea688b1e7
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: http://review.coreboot.org/695
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/devices/device_util.c')
-rw-r--r-- | src/devices/device_util.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/devices/device_util.c b/src/devices/device_util.c index 84fb11505c..5b182e1e89 100644 --- a/src/devices/device_util.c +++ b/src/devices/device_util.c @@ -110,6 +110,26 @@ struct device *dev_find_slot_on_smbus(unsigned int bus, unsigned int addr) } /** + * Given a Local APIC ID, find the device structure. + * + * @param apic_id The Local APIC ID number. + * @return Pointer to the device structure (if found), 0 otherwise. + */ +device_t dev_find_lapic(unsigned apic_id) +{ + device_t dev, result = NULL; + + for (dev = all_devices; dev; dev = dev->next) { + if (dev->path.type == DEVICE_PATH_APIC && + dev->path.apic.apic_id == apic_id) { + result = dev; + break; + } + } + return result; +} + +/** * Find a device of a given vendor and type. * * @param vendor A PCI vendor ID (e.g. 0x8086 for Intel). |