summaryrefslogtreecommitdiff
path: root/arch/powerpc/platforms/pseries/smp.c
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2010-04-28 17:39:41 +0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-05-06 10:49:25 +0400
commitf8b67691828321f5c85bb853283aa101ae673130 (patch)
tree0938bf959cb7d830547d76bc8a40c33dd03c1d2a /arch/powerpc/platforms/pseries/smp.c
parenta32fe93daf9c6b6ffbab1d9b9e2a8e4c335bda5c (diff)
downloadlinux-f8b67691828321f5c85bb853283aa101ae673130.tar.xz
powerpc/pseries: Make query_cpu_stopped callable outside hotplug cpu
This moves query_cpu_stopped() out of the hotplug cpu code and into smp.c so it can called in other places and renames it to smp_query_cpu_stopped(). It also cleans up the return values by adding some #defines Cc: <stable@kernel.org> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/pseries/smp.c')
-rw-r--r--arch/powerpc/platforms/pseries/smp.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 4e7f89a84561..20b694280a66 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -57,6 +57,28 @@
*/
static cpumask_t of_spin_map;
+/* Query where a cpu is now. Return codes #defined in plpar_wrappers.h */
+int smp_query_cpu_stopped(unsigned int pcpu)
+{
+ int cpu_status, status;
+ int qcss_tok = rtas_token("query-cpu-stopped-state");
+
+ if (qcss_tok == RTAS_UNKNOWN_SERVICE) {
+ printk(KERN_INFO "Firmware doesn't support "
+ "query-cpu-stopped-state\n");
+ return QCSS_HARDWARE_ERROR;
+ }
+
+ status = rtas_call(qcss_tok, 1, 2, &cpu_status, pcpu);
+ if (status != 0) {
+ printk(KERN_ERR
+ "RTAS query-cpu-stopped-state failed: %i\n", status);
+ return status;
+ }
+
+ return cpu_status;
+}
+
/**
* smp_startup_cpu() - start the given cpu
*