aboutsummaryrefslogtreecommitdiff
path: root/core/cpu.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2016-12-30 13:25:20 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-01-05 15:41:02 +1100
commitc38fdc4908aa64819e17fd6fb7ce66bda2c56bdc (patch)
treea9b6121293893342461bc374f66758e81f654661 /core/cpu.c
parentee5c9e9cd107a44656ac1bfb5a52d99c39897881 (diff)
downloadskiboot-c38fdc4908aa64819e17fd6fb7ce66bda2c56bdc.zip
skiboot-c38fdc4908aa64819e17fd6fb7ce66bda2c56bdc.tar.gz
skiboot-c38fdc4908aa64819e17fd6fb7ce66bda2c56bdc.tar.bz2
cpu: Add iterators for "present" CPUs
Some code path want to look at all the CPUs that are "present", which means they have been enabled by HB/Cronus and can be accessed via XSCOMs, even if they haven't called in yet. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/cpu.c')
-rw-r--r--core/cpu.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/cpu.c b/core/cpu.c
index 5d76adf..c7e650d 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -494,6 +494,20 @@ struct cpu_thread *first_available_cpu(void)
return next_available_cpu(NULL);
}
+struct cpu_thread *next_present_cpu(struct cpu_thread *cpu)
+{
+ do {
+ cpu = next_cpu(cpu);
+ } while(cpu && !cpu_is_present(cpu));
+
+ return cpu;
+}
+
+struct cpu_thread *first_present_cpu(void)
+{
+ return next_present_cpu(NULL);
+}
+
u8 get_available_nr_cores_in_chip(u32 chip_id)
{
struct cpu_thread *core;