Skip to contentSkip to conversation

Maple: Use RTAS power off methods if available

RFC/PATCH Michael Ellerman 2 participants 2 messages Oct 25, 2006 PowerPC

lore
Share & tools
lore
#0 lore raw

Some versions of SLOF have the RTAS power-off/restart methods implemented, if they're available they should be used in preference to the nvram based methods.

Not sure what the best way to do this is, this is the easy approach although it leaves the system unrebootable until the callbacks get rewired. The other option would be to do the check in maple_restart etc. when they're called.

---

 arch/powerpc/Kconfig                 |    1 +
 arch/powerpc/platforms/maple/setup.c |   23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)
arch/powerpc/Kconfig +1 -0
Index: powerpc/arch/powerpc/Kconfig
===================================================================
@@ -422,6 +422,7 @@ config PPC_MAPLE
 	select GENERIC_TBSYNC
 	select PPC_UDBG_16550
 	select PPC_970_NAP
+	select PPC_RTAS
 	default n
 	help
           This option enables support for the Maple 970FX Evaluation Board.
arch/powerpc/platforms/maple/setup.c +23 -0
Index: powerpc/arch/powerpc/platforms/maple/setup.c
===================================================================
@@ -61,6 +61,7 @@
 #include <asm/lmb.h>
 #include <asm/mpic.h>
 #include <asm/udbg.h>
+#include <asm/rtas.h>
 
 #include "maple.h"
 
@@ -185,6 +186,26 @@ void __init maple_setup_arch(void)
 	printk(KERN_DEBUG "Using native/NAP idle loop\n");
 }
 
+static void __init maple_check_for_rtas_poweroff(void)
+{
+#ifdef CONFIG_PPC_RTAS
+	struct device_node *rtas;
+
+	rtas = of_find_node_by_path("/rtas");
+	if (rtas) {
+		if (get_property(rtas, "system-reboot", NULL))
+			ppc_md.restart = rtas_restart;
+
+		if (get_property(rtas, "power-off", NULL)) {
+			ppc_md.power_off = rtas_power_off;
+			ppc_md.halt = rtas_halt;
+		}
+
+		of_node_put(rtas);
+	}
+#endif
+}
+
 /* 
  * Early initialization.
  */
@@ -192,6 +213,8 @@ static void __init maple_init_early(void
 {
 	DBG(" -> maple_init_early\n");
 
+	maple_check_for_rtas_poweroff();
+
 	iommu_init_early_dart();
 
 	DBG(" <- maple_init_early\n");
#1 lore raw
Quoted 37 lines · Michael Ellerman

Index: powerpc/arch/powerpc/Kconfig
===================================================================

arch/powerpc/Kconfig +1 -0
@@ -422,6 +422,7 @@ config PPC_MAPLE
 	select GENERIC_TBSYNC
 	select PPC_UDBG_16550
 	select PPC_970_NAP
+	select PPC_RTAS
 	default n
 	help
           This option enables support for the Maple 970FX Evaluation Board.

Index: powerpc/arch/powerpc/platforms/maple/setup.c
===================================================================

arch/powerpc/platforms/maple/setup.c +9 -0
@@ -61,6 +61,7 @@
 #include <asm/lmb.h>
 #include <asm/mpic.h>
 #include <asm/udbg.h>
+#include <asm/rtas.h>
 
 #include "maple.h"
 
@@ -185,6 +186,26 @@ void __init maple_setup_arch(void)
 	printk(KERN_DEBUG "Using native/NAP idle loop\n");
 }
 
+static void __init maple_check_for_rtas_poweroff(void)
+{
+#ifdef CONFIG_PPC_RTAS
+	struct device_node *rtas;
+
+	rtas = of_find_node_by_path("/rtas");
+	if (rtas) {
+		if (get_property(rtas, "system-reboot", NULL))

arch/powerpc/platforms/maple/setup.c void __init maple_setup_arch(void) · line 206

Quoted 10 lines
arch/powerpc/platforms/maple/setup.c +10 -0
+			ppc_md.restart = rtas_restart;
+
+		if (get_property(rtas, "power-off", NULL)) {
+			ppc_md.power_off = rtas_power_off;
+			ppc_md.halt = rtas_halt;
+		}
+
+		of_node_put(rtas);
+	}
+#endif

PPC_RTAS is selected in Kconfig, the ifdef isn't necessary.