diff options
author | Stefan Reinauer <reinauer@chromium.org> | 2012-03-30 13:52:58 -0700 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2012-04-02 18:39:58 +0200 |
commit | dc8448fd8be4768ef9d5f9b8cbcf28db0a2029be (patch) | |
tree | d4c7e2ab6cbfb649ee4421d734dddc050c8768a6 /src/devices/device_util.c | |
parent | d40393e3903e57496afcfc88ec094ae17f0e9437 (diff) | |
download | coreboot-dc8448fd8be4768ef9d5f9b8cbcf28db0a2029be.tar.xz |
Add a helper function to determine the number of enabled CPUs
Change-Id: Ia72926002571e0f250849fa5db048bd8b2e92400
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: http://review.coreboot.org/821
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 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/devices/device_util.c b/src/devices/device_util.c index 526490a8c1..5225938e19 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; +} |