*/
 extern void platform_setup (char **);
 
-/*
- * platform_halt is called to stop the system and halt.
- */
-extern void platform_halt (void);
-
-/*
- * platform_power_off is called to stop the system and power it off.
- */
-extern void platform_power_off (void);
-
 /*
  * platform_idle is called from the idle function.
  */
 
 
 _F(void, init, (bp_tag_t *first), { });
 _F(void, setup, (char** cmd), { });
-_F(void, halt, (void), { while(1); });
-_F(void, power_off, (void), { while(1); });
 _F(void, idle, (void), { __asm__ __volatile__ ("waiti 0" ::: "memory"); });
 
 #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
 
 
 void machine_halt(void)
 {
-       platform_halt();
-       while (1);
+       local_irq_disable();
+       smp_send_stop();
+       do_kernel_power_off();
+       while (1)
+               cpu_relax();
 }
 
 void machine_power_off(void)
 {
-       platform_power_off();
-       while (1);
+       local_irq_disable();
+       smp_send_stop();
+       do_kernel_power_off();
+       while (1)
+               cpu_relax();
 }
 #ifdef CONFIG_PROC_FS
 
 
 #include <platform/simcall.h>
 
 
-void platform_halt(void)
-{
-       pr_info(" ** Called platform_halt() **\n");
-       simc_exit(0);
-}
-
-void platform_power_off(void)
+static int iss_power_off(struct sys_off_data *unused)
 {
        pr_info(" ** Called platform_power_off() **\n");
        simc_exit(0);
+       return NOTIFY_DONE;
 }
 
 static int iss_restart(struct notifier_block *this,
 
        atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
        register_restart_handler(&iss_restart_block);
+       register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
+                                SYS_OFF_PRIO_PLATFORM,
+                                iss_power_off, NULL);
 }
 
                    break;
 }
 
-void platform_halt(void)
-{
-       led_print (0, "  HALT  ");
-       local_irq_disable();
-       while (1);
-}
-
-void platform_power_off(void)
+static int xt2000_power_off(struct sys_off_data *unused)
 {
        led_print (0, "POWEROFF");
        local_irq_disable();
        while (1);
+       return NOTIFY_DONE;
 }
 
 static int xt2000_restart(struct notifier_block *this,
        platform_device_register(&xt2000_sonic_device);
        mod_timer(&heartbeat_timer, jiffies + HZ / 2);
        register_restart_handler(&xt2000_restart_block);
+       register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
+                                SYS_OFF_PRIO_DEFAULT,
+                                xt2000_power_off, NULL);
        return 0;
 }
 
 
 #include <platform/lcd.h>
 #include <platform/hardware.h>
 
-void platform_halt(void)
-{
-       lcd_disp_at_pos(" HALT ", 0);
-       local_irq_disable();
-       while (1)
-               cpu_relax();
-}
-
-void platform_power_off(void)
+static int xtfpga_power_off(struct sys_off_data *unused)
 {
        lcd_disp_at_pos("POWEROFF", 0);
        local_irq_disable();
        while (1)
                cpu_relax();
+       return NOTIFY_DONE;
 }
 
 static int xtfpga_restart(struct notifier_block *this,
 static void __init xtfpga_register_handlers(void)
 {
        register_restart_handler(&xtfpga_restart_block);
+       register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
+                                SYS_OFF_PRIO_DEFAULT,
+                                xtfpga_power_off, NULL);
 }
 
 #ifdef CONFIG_USE_OF