[parisc-linux-cvs] firmware.c: added pdc_soft_power_info() and pdc_soft_power_shutdown() pdc calls

Helge Deller deller@gmx.de
Wed, 14 Nov 2001 00:28:07 +0100


--------------Boundary-00=_VIIR9FZLQ80LD3U6BFFK
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 8bit

firmware.c: added pdc_soft_power_info() and pdc_soft_power_shutdown() pdc calls
--------------Boundary-00=_VIIR9FZLQ80LD3U6BFFK
Content-Type: text/plain;
  charset="iso-8859-1";
  name="diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="diff"

Index: firmware.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/firmware.c,v
retrieving revision 1.35
diff -u -p -r1.35 firmware.c
--- firmware.c	2001/10/10 05:51:26	1.35
+++ firmware.c	2001/11/13 22:36:49
@@ -594,6 +594,48 @@ int pdc_do_reset()
         return retval;
 }
 
+/*
+ * pdc_soft_power_info - Enable soft power switch.
+ * @power_reg: The return buffer
+ *
+ * Enable the soft power switch and return the absolute address 
+ * of the soft power switch register
+ */
+int pdc_soft_power_info(unsigned long *power_reg)
+{
+	int retval;
+
+	spin_lock_irq(&pdc_lock);
+	
+	retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_INFO, __pa(pdc_result), 0);
+	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.
+ *
+ * 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.
+ */
+void pdc_soft_power_shutdown(void)
+{
+	spin_lock_irq(&pdc_lock);
+	mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_ENABLE, __pa(pdc_result), 0);
+	spin_unlock_irq(&pdc_lock);
+}
+
+
 /**
  * pdc_iodc_putc - Console character print using IODC.
  * @c: the character to output.

--------------Boundary-00=_VIIR9FZLQ80LD3U6BFFK--