[coreboot] New patch to review for coreboot: 9065d0f Add helper function to find a Local APIC by ID in the device tree.

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Fri Mar 2 23:01:50 CET 2012


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/695

-gerrit

commit 9065d0fbcdc23cc1e393b65306f7d5b2677555fb
Author: Duncan Laurie <dlaurie at chromium.org>
Date:   Mon Jul 18 10:41:36 2011 -0700

    Add helper function to find a Local APIC by ID in the device tree.
    
    Change-Id: Ie2d7d8e1f647a0c92d2de09e32454fbea688b1e7
    Signed-off-by: Duncan Laurie <dlaurie at google.com>
---
 src/devices/device_util.c   |   20 ++++++++++++++++++++
 src/include/device/device.h |    1 +
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/devices/device_util.c b/src/devices/device_util.c
index 47cf988..41c11ee 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).
diff --git a/src/include/device/device.h b/src/include/device/device.h
index a7de0c9..c097f57 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -132,6 +132,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_lapic(unsigned apic_id);
 
 /* Debug functions */
 void print_resource_tree(struct device * root, int debug_level,




More information about the coreboot mailing list