Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
[pandora-kernel.git] / arch / sparc64 / prom / misc.c
index 577bde8..68c83ad 100644 (file)
@@ -6,7 +6,6 @@
  * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  */
 
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <asm/openprom.h>
 #include <asm/oplib.h>
 #include <asm/system.h>
+#include <asm/ldc.h>
+
+int prom_service_exists(const char *service_name)
+{
+       int err = p1275_cmd("test", P1275_ARG(0, P1275_ARG_IN_STRING) |
+                           P1275_INOUT(1, 1), service_name);
+
+       if (err)
+               return 0;
+       return 1;
+}
+
+void prom_sun4v_guest_soft_state(void)
+{
+       const char *svc = "SUNW,soft-state-supported";
+
+       if (!prom_service_exists(svc))
+               return;
+       p1275_cmd(svc, P1275_INOUT(0, 0));
+}
 
 /* Reset and reboot the machine with the command 'bcommand'. */
 void prom_reboot(const char *bcommand)
 {
+#ifdef CONFIG_SUN_LDOMS
+       if (ldom_domaining_enabled)
+               ldom_reboot(bcommand);
+#endif
        p1275_cmd("boot", P1275_ARG(0, P1275_ARG_IN_STRING) |
                  P1275_INOUT(1, 0), bcommand);
 }
@@ -49,7 +72,7 @@ void prom_cmdline(void)
 
        local_irq_save(flags);
 
-       if (!serial_console && prom_palette)
+       if (prom_palette)
                prom_palette(1);
 
 #ifdef CONFIG_SMP
@@ -62,7 +85,7 @@ void prom_cmdline(void)
        smp_release();
 #endif
 
-       if (!serial_console && prom_palette)
+       if (prom_palette)
                prom_palette(0);
 
        local_irq_restore(flags);
@@ -73,6 +96,10 @@ void prom_cmdline(void)
  */
 void prom_halt(void)
 {
+#ifdef CONFIG_SUN_LDOMS
+       if (ldom_domaining_enabled)
+               ldom_power_off();
+#endif
 again:
        p1275_cmd("exit", P1275_INOUT(0, 0));
        goto again; /* PROM is out to get me -DaveM */
@@ -80,6 +107,10 @@ again:
 
 void prom_halt_power_off(void)
 {
+#ifdef CONFIG_SUN_LDOMS
+       if (ldom_domaining_enabled)
+               ldom_power_off();
+#endif
        p1275_cmd("SUNW,power-off", P1275_INOUT(0, 0));
 
        /* if nothing else helps, we just halt */