Commit a7054210 authored by Eric Brower's avatar Eric Brower Committed by David S. Miller

[SPARC]: Add sysctl to control serial console power-off restrictions.

parent 0458380f
...@@ -55,6 +55,12 @@ void (*pm_idle)(void); ...@@ -55,6 +55,12 @@ void (*pm_idle)(void);
*/ */
void (*pm_power_off)(void); void (*pm_power_off)(void);
/*
* sysctl - toggle power-off restriction for serial console
* systems in machine_power_off()
*/
int scons_pwroff = 1;
extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *); extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *);
struct task_struct *last_task_used_math = NULL; struct task_struct *last_task_used_math = NULL;
...@@ -186,7 +192,7 @@ EXPORT_SYMBOL(machine_restart); ...@@ -186,7 +192,7 @@ EXPORT_SYMBOL(machine_restart);
void machine_power_off(void) void machine_power_off(void)
{ {
#ifdef CONFIG_SUN_AUXIO #ifdef CONFIG_SUN_AUXIO
if (auxio_power_register && !serial_console) if (auxio_power_register && (!serial_console || scons_pwroff))
*auxio_power_register |= AUXIO_POWER_OFF; *auxio_power_register |= AUXIO_POWER_OFF;
#endif #endif
machine_halt(); machine_halt();
......
...@@ -20,6 +20,12 @@ ...@@ -20,6 +20,12 @@
#define __KERNEL_SYSCALLS__ #define __KERNEL_SYSCALLS__
#include <linux/unistd.h> #include <linux/unistd.h>
/*
* sysctl - toggle power-off restriction for serial console
* systems in machine_power_off()
*/
int scons_pwroff = 1;
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
static unsigned long power_reg = 0UL; static unsigned long power_reg = 0UL;
...@@ -44,7 +50,7 @@ static void (*poweroff_method)(void) = machine_alt_power_off; ...@@ -44,7 +50,7 @@ static void (*poweroff_method)(void) = machine_alt_power_off;
void machine_power_off(void) void machine_power_off(void)
{ {
if (!serial_console) { if (!serial_console || scons_pwroff) {
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
if (power_reg != 0UL) { if (power_reg != 0UL) {
/* Both register bits seem to have the /* Both register bits seem to have the
......
...@@ -131,6 +131,7 @@ enum ...@@ -131,6 +131,7 @@ enum
KERN_PRINTK_RATELIMIT_BURST=61, /* int: tune printk ratelimiting */ KERN_PRINTK_RATELIMIT_BURST=61, /* int: tune printk ratelimiting */
KERN_PTY=62, /* dir: pty driver */ KERN_PTY=62, /* dir: pty driver */
KERN_NGROUPS_MAX=63, /* int: NGROUPS_MAX */ KERN_NGROUPS_MAX=63, /* int: NGROUPS_MAX */
KERN_SPARC_SCONS_PWROFF=64, /* int: serial console power-off halt */
}; };
......
...@@ -93,6 +93,7 @@ extern int sem_ctls[]; ...@@ -93,6 +93,7 @@ extern int sem_ctls[];
#ifdef __sparc__ #ifdef __sparc__
extern char reboot_command []; extern char reboot_command [];
extern int stop_a_enabled; extern int stop_a_enabled;
extern int scons_pwroff;
#endif #endif
#ifdef __hppa__ #ifdef __hppa__
...@@ -325,6 +326,14 @@ static ctl_table kern_table[] = { ...@@ -325,6 +326,14 @@ static ctl_table kern_table[] = {
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec, .proc_handler = &proc_dointvec,
}, },
{
.ctl_name = KERN_SPARC_SCONS_PWROFF,
.procname = "scons-poweroff",
.data = &scons_pwroff,
.maxlen = sizeof (int),
.mode = 0644,
.proc_handler = &proc_dointvec,
},
#endif #endif
#ifdef __hppa__ #ifdef __hppa__
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment