[PATCH] ppc64: do not return from maple halt, power off, restart

David Gibson david at gibson.dropbear.id.au
Tue Jun 7 11:19:40 EST 2005


On Fri, Jun 03, 2005 at 04:34:41PM -0700, Frank Rowand wrote:
> 
> The Maple board currently returns from a request to halt, power off, or
> restart.  This patch causes all processors to instead spin in these cases
> so that the system appears to have halted.
> 
> This patch applies against linux-2.6.12-rc5.

This one is probably a better way to go, though.  This came from Matt
Dharm some time ago, but was never merged due to a miscommunication.
It implements the actual board-level reboot and powerdown by
communicating with the service processor.

Andrew, please apply.

Signed-off-by: David Gibson <dwg at au1.ibm.com>

===== maple_setup.c 1.5 vs edited =====
--- 1.5/arch/ppc64/kernel/maple_setup.c	2005-01-07 21:43:52 -08:00
+++ edited/maple_setup.c	2005-01-28 18:58:39 -08:00
@@ -78,13 +78,72 @@
 extern void generic_find_legacy_serial_ports(u64 *physport,
 		unsigned int *default_speed);
 
-
 static void maple_restart(char *cmd)
 {
+	unsigned int maple_nvram_base;
+	unsigned int maple_nvram_offset;
+	unsigned int maple_nvram_command;
+	struct device_node *rtcs;
+
+	/* find NVRAM device */
+	rtcs = find_compatible_devices("nvram", "AMD8111");
+	if (rtcs && rtcs->addrs) {
+		maple_nvram_base = rtcs->addrs[0].address;
+	} else {
+		printk(KERN_INFO "Maple: Unable to find NVRAM\n");
+		printk(KERN_INFO "Maple: Manual Restart Required\n");
+		return;
+	}
+
+	/* find service processor device */
+	rtcs = find_devices("service-processor");
+	if (!rtcs) {
+		printk(KERN_INFO "Maple: Unable to find Service Processor\n");
+		printk(KERN_INFO "Maple: Manual Restart Required\n");
+		return;
+	}
+	maple_nvram_offset = *(unsigned int*) get_property(rtcs,
+			"restart-addr", NULL);
+	maple_nvram_command = *(unsigned int*) get_property(rtcs,
+			"restart-value", NULL);
+
+	/* send command */
+	outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset);
+	for (;;) ;
 }
 
 static void maple_power_off(void)
 {
+	unsigned int maple_nvram_base;
+	unsigned int maple_nvram_offset;
+	unsigned int maple_nvram_command;
+	struct device_node *rtcs;
+
+	/* find NVRAM device */
+	rtcs = find_compatible_devices("nvram", "AMD8111");
+	if (rtcs && rtcs->addrs) {
+		maple_nvram_base = rtcs->addrs[0].address;
+	} else {
+		printk(KERN_INFO "Maple: Unable to find NVRAM\n");
+		printk(KERN_INFO "Maple: Manual Power-Down Required\n");
+		return;
+	}
+
+	/* find service processor device */
+	rtcs = find_devices("service-processor");
+	if (!rtcs) {
+		printk(KERN_INFO "Maple: Unable to find Service Processor\n");
+		printk(KERN_INFO "Maple: Manual Power-Down Required\n");
+		return;
+	}
+	maple_nvram_offset = *(unsigned int*) get_property(rtcs,
+			"power-off-addr", NULL);
+	maple_nvram_command = *(unsigned int*) get_property(rtcs,
+			"power-off-value", NULL);
+
+	/* send command */
+	outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset);
+	for (;;) ;
 }
 
 static void maple_halt(void)



-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/people/dgibson



More information about the Linuxppc64-dev mailing list