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

Benjamin Herrenschmidt benh at kernel.crashing.org
Tue Jun 7 12:10:25 EST 2005


> David,
> 
> I tried this patch on linux-2.6.12-rc5.  The maple_restart() worked fine.
> The maple_halt() did not power off the board.  The maintenance processor
> PIBS reports:
> 
>    PIBS $ Message received: Power off.
>    Powering down 970s and the CPC925 ...
>    Power down complete.
> 
> but the board remains powered on.

This is the problem I've talked about. Full power off doesn't work on
Maple.

> Some other comments:
> 
> maple_halt() should do the same thing as maple_power_off().  (It could
> even just call maple_power_off().)

That's debatable... lots of people claim that halt() should just ...
halt the kernel and not power off the computer :) I would personally
have it do power off, but since that doesn't work ...

> maple_restart(), maple_power_off(), and maple_halt() should not ever
> return.  The returns could be replaced with the code from my patch
> that started this thread.

I think the "return" case should be handled at the toplevel function in
setup.c that calls ppc_md.

> I don't know if smp_send_stop() is necesary (there seems to be a lack
> of consistency among the different architectures) but it seems like a
> good idea.
> 
> Do you want me to rework the patch with these suggestions?  (But I'm
> not sure how to resolve the failure to power off.)
> 
> > 
> > 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)
> > 
> > 
> > 
> 
> -Frank
> -- 
> Frank Rowand <frank_rowand at mvista.com>
> MontaVista Software, Inc
> 
> _______________________________________________
> Linuxppc64-dev mailing list
> Linuxppc64-dev at ozlabs.org
> https://ozlabs.org/cgi-bin/mailman/listinfo/linuxppc64-dev




More information about the Linuxppc64-dev mailing list