[SPARC64]: Kill show_stackframe{,32}().
[sfrench/cifs-2.6.git] / arch / sparc64 / kernel / process.c
index f5f97e2c669c53d71a9429c9eeaa5f624e767a8a..548af5d1f2c4d2d77900e913caaaa76363b23d3d 100644 (file)
 #include <linux/kernel.h>
 #include <linux/kallsyms.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/stddef.h>
 #include <linux/ptrace.h>
 #include <linux/slab.h>
 #include <linux/user.h>
-#include <linux/a.out.h>
 #include <linux/reboot.h>
 #include <linux/delay.h>
 #include <linux/compat.h>
 #include <linux/tick.h>
 #include <linux/init.h>
+#include <linux/cpu.h>
 
 #include <asm/oplib.h>
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
 #include <asm/hypervisor.h>
 #include <asm/sstate.h>
+#include <asm/reboot.h>
 
 /* #define VERBOSE_SHOWREGS */
 
-static void sparc64_yield(void)
+static void sparc64_yield(int cpu)
 {
        if (tlb_type != hypervisor)
                return;
@@ -57,7 +59,7 @@ static void sparc64_yield(void)
        clear_thread_flag(TIF_POLLING_NRFLAG);
        smp_mb__after_clear_bit();
 
-       while (!need_resched()) {
+       while (!need_resched() && !cpu_is_offline(cpu)) {
                unsigned long pstate;
 
                /* Disable interrupts. */
@@ -68,7 +70,7 @@ static void sparc64_yield(void)
                        : "=&r" (pstate)
                        : "i" (PSTATE_IE));
 
-               if (!need_resched())
+               if (!need_resched() && !cpu_is_offline(cpu))
                        sun4v_cpu_yield();
 
                /* Re-enable interrupts. */
@@ -86,15 +88,25 @@ static void sparc64_yield(void)
 /* The idle loop on sparc64. */
 void cpu_idle(void)
 {
+       int cpu = smp_processor_id();
+
        set_thread_flag(TIF_POLLING_NRFLAG);
 
        while(1) {
                tick_nohz_stop_sched_tick();
-               while (!need_resched())
-                       sparc64_yield();
+
+               while (!need_resched() && !cpu_is_offline(cpu))
+                       sparc64_yield(cpu);
+
                tick_nohz_restart_sched_tick();
 
                preempt_enable_no_resched();
+
+#ifdef CONFIG_HOTPLUG_CPU
+               if (cpu_is_offline(cpu))
+                       cpu_play_dead();
+#endif
+
                schedule();
                preempt_disable();
        }
@@ -102,16 +114,9 @@ void cpu_idle(void)
 
 extern char reboot_command [];
 
-extern void (*prom_palette)(int);
-extern void (*prom_keyboard)(void);
-
 void machine_halt(void)
 {
        sstate_halt();
-       if (!serial_console && prom_palette)
-               prom_palette (1);
-       if (prom_keyboard)
-               prom_keyboard();
        prom_halt();
        panic("Halt failed!");
 }
@@ -119,10 +124,6 @@ void machine_halt(void)
 void machine_alt_power_off(void)
 {
        sstate_poweroff();
-       if (!serial_console && prom_palette)
-               prom_palette(1);
-       if (prom_keyboard)
-               prom_keyboard();
        prom_halt_power_off();
        panic("Power-off failed!");
 }
@@ -134,10 +135,6 @@ void machine_restart(char * cmd)
        sstate_reboot();
        p = strchr (reboot_command, '\n');
        if (p) *p = 0;
-       if (!serial_console && prom_palette)
-               prom_palette (1);
-       if (prom_keyboard)
-               prom_keyboard();
        if (cmd)
                prom_reboot(cmd);
        if (*reboot_command)
@@ -215,62 +212,6 @@ static void show_regwindow(struct pt_regs *regs)
                print_symbol("I7: <%s>\n", rwk->ins[7]);
 }
 
-void show_stackframe(struct sparc_stackf *sf)
-{
-       unsigned long size;
-       unsigned long *stk;
-       int i;
-
-       printk("l0: %016lx l1: %016lx l2: %016lx l3: %016lx\n"
-              "l4: %016lx l5: %016lx l6: %016lx l7: %016lx\n",
-              sf->locals[0], sf->locals[1], sf->locals[2], sf->locals[3],
-              sf->locals[4], sf->locals[5], sf->locals[6], sf->locals[7]);
-       printk("i0: %016lx i1: %016lx i2: %016lx i3: %016lx\n"
-              "i4: %016lx i5: %016lx fp: %016lx ret_pc: %016lx\n",
-              sf->ins[0], sf->ins[1], sf->ins[2], sf->ins[3],
-              sf->ins[4], sf->ins[5], (unsigned long)sf->fp, sf->callers_pc);
-       printk("sp: %016lx x0: %016lx x1: %016lx x2: %016lx\n"
-              "x3: %016lx x4: %016lx x5: %016lx xx: %016lx\n",
-              (unsigned long)sf->structptr, sf->xargs[0], sf->xargs[1],
-              sf->xargs[2], sf->xargs[3], sf->xargs[4], sf->xargs[5],
-              sf->xxargs[0]);
-       size = ((unsigned long)sf->fp) - ((unsigned long)sf);
-       size -= STACKFRAME_SZ;
-       stk = (unsigned long *)((unsigned long)sf + STACKFRAME_SZ);
-       i = 0;
-       do {
-               printk("s%d: %016lx\n", i++, *stk++);
-       } while ((size -= sizeof(unsigned long)));
-}
-
-void show_stackframe32(struct sparc_stackf32 *sf)
-{
-       unsigned long size;
-       unsigned *stk;
-       int i;
-
-       printk("l0: %08x l1: %08x l2: %08x l3: %08x\n",
-              sf->locals[0], sf->locals[1], sf->locals[2], sf->locals[3]);
-       printk("l4: %08x l5: %08x l6: %08x l7: %08x\n",
-              sf->locals[4], sf->locals[5], sf->locals[6], sf->locals[7]);
-       printk("i0: %08x i1: %08x i2: %08x i3: %08x\n",
-              sf->ins[0], sf->ins[1], sf->ins[2], sf->ins[3]);
-       printk("i4: %08x i5: %08x fp: %08x ret_pc: %08x\n",
-              sf->ins[4], sf->ins[5], sf->fp, sf->callers_pc);
-       printk("sp: %08x x0: %08x x1: %08x x2: %08x\n"
-              "x3: %08x x4: %08x x5: %08x xx: %08x\n",
-              sf->structptr, sf->xargs[0], sf->xargs[1],
-              sf->xargs[2], sf->xargs[3], sf->xargs[4], sf->xargs[5],
-              sf->xxargs[0]);
-       size = ((unsigned long)sf->fp) - ((unsigned long)sf);
-       size -= STACKFRAME32_SZ;
-       stk = (unsigned *)((unsigned long)sf + STACKFRAME32_SZ);
-       i = 0;
-       do {
-               printk("s%d: %08x\n", i++, *stk++);
-       } while ((size -= sizeof(unsigned)));
-}
-
 #ifdef CONFIG_SMP
 static DEFINE_SPINLOCK(regdump_lock);
 #endif
@@ -713,17 +654,6 @@ pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
        return retval;
 }
 
-/*
- * fill in the user structure for a core dump..
- */
-void dump_thread(struct pt_regs * regs, struct user * dump)
-{
-       /* Only should be used for SunOS and ancient a.out
-        * SparcLinux binaries...  Not worth implementing.
-        */
-       memset(dump, 0, sizeof(struct user));
-}
-
 typedef struct {
        union {
                unsigned int    pr_regs[32];