summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powernv
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-09-19 20:28:03 +0200
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-09-20 08:09:55 +0200
commitec27329ffb3b4f619be9f0065c473fcb36ea52ce (patch)
tree417c97efc83929dfd17320b1e4a7b7f8130d5994 /arch/powerpc/platforms/powernv
parentpowerpc/powernv: Support for OPAL console (diff)
downloadlinux-ec27329ffb3b4f619be9f0065c473fcb36ea52ce.tar.xz
linux-ec27329ffb3b4f619be9f0065c473fcb36ea52ce.zip
powerpc/powernv: Hookup reboot and poweroff functions
This calls the respective HAL functions, and spin on hal_poll_event() to ensure the HAL has a chance to communicate with the FSP to trigger the reboot or shutdown operation Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/powernv')
-rw-r--r--arch/powerpc/platforms/powernv/setup.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 07ba1ecd1807..0fac0a6c951e 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -83,19 +83,39 @@ static void pnv_show_cpuinfo(struct seq_file *m)
of_node_put(root);
}
-static void pnv_restart(char *cmd)
+static void __noreturn pnv_restart(char *cmd)
{
- for (;;);
+ long rc = OPAL_BUSY;
+
+ while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
+ rc = opal_cec_reboot();
+ if (rc == OPAL_BUSY_EVENT)
+ opal_poll_events(NULL);
+ else
+ mdelay(10);
+ }
+ for (;;)
+ opal_poll_events(NULL);
}
-static void pnv_power_off(void)
+static void __noreturn pnv_power_off(void)
{
- for (;;);
+ long rc = OPAL_BUSY;
+
+ while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
+ rc = opal_cec_power_down(0);
+ if (rc == OPAL_BUSY_EVENT)
+ opal_poll_events(NULL);
+ else
+ mdelay(10);
+ }
+ for (;;)
+ opal_poll_events(NULL);
}
-static void pnv_halt(void)
+static void __noreturn pnv_halt(void)
{
- for (;;);
+ pnv_power_off();
}
static unsigned long __init pnv_get_boot_time(void)