Stefan Reinauer ([email protected]) just uploaded a new patch set to 
gerrit, which you can find at http://review.coreboot.org/821

-gerrit

commit 5a56dc038f16242e624c493bffeb0d9b38b85cad
Author: Stefan Reinauer <[email protected]>
Date:   Fri Mar 30 13:52:58 2012 -0700

    Add a helper function to determine the number of enabled CPUs
    
    Change-Id: Ia72926002571e0f250849fa5db048bd8b2e92400
    Signed-off-by: Duncan Laurie <[email protected]>
---
 src/devices/device_util.c   |   18 ++++++++++++++++++
 src/include/device/device.h |    1 +
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/devices/device_util.c b/src/devices/device_util.c
index 526490a..5225938 100644
--- a/src/devices/device_util.c
+++ b/src/devices/device_util.c
@@ -850,3 +850,21 @@ u32 find_pci_tolm(struct bus *bus)
 
        return tolm;
 }
+
+/* Count of enabled CPUs */
+int dev_count_cpu(void)
+{
+       device_t cpu;
+       int count = 0;
+
+       for (cpu = all_devices; cpu; cpu = cpu->next) {
+               if ((cpu->path.type != DEVICE_PATH_APIC) ||
+                   (cpu->bus->dev->path.type != DEVICE_PATH_APIC_CLUSTER))
+                       continue;
+               if (!cpu->enabled)
+                       continue;
+               count++;
+       }
+
+       return count;
+}
diff --git a/src/include/device/device.h b/src/include/device/device.h
index c097f57..0aea1d6 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -133,6 +133,7 @@ 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);
+int dev_count_cpu(void);
 
 /* Debug functions */
 void print_resource_tree(struct device * root, int debug_level,

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to