[parisc-linux-cvs] 2.4.18-pa15, pdc_soft_power_button() changes
Helge Deller
deller@gmx.de
Sun, 7 Apr 2002 00:24:29 +0200
--------------Boundary-00=_TK36OYXNZNHYTYKI6S99
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
On Sunday 07 April 2002 00:14, Helge Deller wrote:
> CVSROOT: /var/cvs
> Module name: linux
> Changes by: deller 02/04/06 15:14:57
>
> Modified files:
> . : Makefile
> arch/parisc/kernel: firmware.c power.c process.c traps.c
> include/asm-parisc: pdc.h
>
> Log message:
> 2.4.18-pa15:
> renamed pdc_soft_power_shutdown() to pdc_soft_power_button() since
> it actually only enables/disables the soft power switch and
> changed the comments accordingly.
--------------Boundary-00=_TK36OYXNZNHYTYKI6S99
Content-Type: text/plain;
charset="iso-8859-1";
name="diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="diff"
Index: Makefile
===================================================================
RCS file: /var/cvs/linux/Makefile,v
retrieving revision 1.285
diff -u -p -r1.285 Makefile
--- Makefile 2002/04/05 08:02:02 1.285
+++ Makefile 2002/04/06 22:06:26
@@ -1,7 +1,7 @@
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 18
-EXTRAVERSION = -pa14
+EXTRAVERSION = -pa15
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
Index: arch/parisc/kernel/firmware.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/firmware.c,v
retrieving revision 1.41
diff -u -p -r1.41 firmware.c
--- arch/parisc/kernel/firmware.c 2002/02/22 22:42:22 1.41
+++ arch/parisc/kernel/firmware.c 2002/04/06 22:06:31
@@ -691,43 +691,43 @@ int pdc_do_reset()
/*
* pdc_soft_power_info - Enable soft power switch.
- * @power_reg: The return buffer
+ * @power_reg: address of soft power register
*
- * Enable the soft power switch and return the absolute address
- * of the soft power switch register
+ * Return the absolute address of the soft power switch register
*/
int __init pdc_soft_power_info(unsigned long *power_reg)
{
int retval;
- spin_lock_irq(&pdc_lock);
+ *power_reg = (unsigned long) (-1);
+ spin_lock_irq(&pdc_lock);
retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_INFO, __pa(pdc_result), 0);
- if (retval == PDC_OK) {
+ if (retval == PDC_OK)
*power_reg = pdc_result[0];
- retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_ENABLE, __pa(pdc_result), 1);
- }
-
spin_unlock_irq(&pdc_lock);
-
- if (retval != PDC_OK)
- *power_reg = (unsigned long) (-1);
return retval;
}
/*
- * pdc_soft_power_shutdown - Shutdown system if possible.
+ * pdc_soft_power_button - Control the soft power button behaviour
+ * @sw_control: 0 for hardware control, 1 for software control
*
- * If supported by PDC this functions shuts down the system and
- * does not return to the caller. If not supported by the system
- * this function won't have any effect.
+ *
+ * This PDC function places the soft power button under software or
+ * hardware control.
+ * Under software control the OS may control to when to allow to shut
+ * down the system. Under hardware control pressing the power button
+ * powers off the system immediately.
*/
-void pdc_soft_power_shutdown(void)
+int pdc_soft_power_button(int sw_control)
{
+ int retval;
spin_lock_irq(&pdc_lock);
- mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_ENABLE, __pa(pdc_result), 0);
+ retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_ENABLE, __pa(pdc_result), sw_control);
spin_unlock_irq(&pdc_lock);
+ return retval;
}
/*
Index: arch/parisc/kernel/power.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/power.c,v
retrieving revision 1.5
diff -u -p -r1.5 power.c
--- arch/parisc/kernel/power.c 2001/12/26 23:19:27 1.5
+++ arch/parisc/kernel/power.c 2002/04/06 22:06:31
@@ -33,7 +33,7 @@
* the soft-power switch killing the power at once.
* This may be reached by uncommenting the following line: */
-//#define POWERSWITCH_DISABLED
+#undef POWERSWITCH_DISABLED
/* local time-counter for shutdown */
@@ -176,6 +176,8 @@ static int __init power_init(void)
#if !defined(POWERSWITCH_DISABLED)
/* enable the soft power switch if possible */
ret = pdc_soft_power_info(&soft_power_reg);
+ if (ret == PDC_OK)
+ ret = pdc_soft_power_button(1);
if (ret != PDC_OK)
return 0;
Index: arch/parisc/kernel/process.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/process.c,v
retrieving revision 1.40
diff -u -p -r1.40 process.c
--- arch/parisc/kernel/process.c 2001/11/13 23:39:37 1.40
+++ arch/parisc/kernel/process.c 2002/04/06 22:06:33
@@ -135,16 +135,23 @@ void machine_halt(void)
}
-/* This routine is called from sys_reboot to actually turn off the
- * machine */
+/*
+ * This routine is called from sys_reboot to actually turn off the
+ * machine
+ */
void machine_power_off(void)
{
/* If there is a registered power off handler, call it. */
if(pm_power_off)
pm_power_off();
- /* pdc_soft_power_shutdown() may return... */
- pdc_soft_power_shutdown();
+ /* Put the soft power button back under hardware control.
+ * If the user had already pressed the power button, the
+ * following call will immediately power off. */
+ pdc_soft_power_button(0);
+
+ /* It seems we have no way to power the system off via
+ * software. The user has to press the button himself. */
}
Index: arch/parisc/kernel/traps.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/traps.c,v
retrieving revision 1.61
diff -u -p -r1.61 traps.c
--- arch/parisc/kernel/traps.c 2002/01/06 17:35:10 1.61
+++ arch/parisc/kernel/traps.c 2002/04/06 22:06:33
@@ -456,8 +456,10 @@ void parisc_terminate(char *msg, struct
spin_unlock(&terminate_lock);
- /* re-enable the power-off button */
- pdc_soft_power_shutdown();
+ /* put soft power button back under hardware control;
+ * if the user had pressed it once at any time, the
+ * system will shut down immediately right here. */
+ pdc_soft_power_button(0);
for(;;)
;
Index: include/asm-parisc/pdc.h
===================================================================
RCS file: /var/cvs/linux/include/asm-parisc/pdc.h,v
retrieving revision 1.43
diff -u -p -r1.43 pdc.h
--- include/asm-parisc/pdc.h 2002/02/22 22:35:51 1.43
+++ include/asm-parisc/pdc.h 2002/04/06 22:07:02
@@ -945,7 +945,7 @@ int pdc_mem_mem_table(struct pdc_memory_
int pdc_do_firm_test_reset(unsigned long ftc_bitmap);
int pdc_do_reset(void);
int pdc_soft_power_info(unsigned long *power_reg);
-void pdc_soft_power_shutdown(void);
+int pdc_soft_power_button(int sw_control);
void pdc_suspend_usb(void);
int pdc_iodc_getc(void);
void pdc_iodc_putc(unsigned char c);
--------------Boundary-00=_TK36OYXNZNHYTYKI6S99--