fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / mips / sgi-ip32 / ip32-reset.c
index ac65798..db80844 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/delay.h>
 #include <linux/ds17287rtc.h>
 #include <linux/interrupt.h>
+#include <linux/pm.h>
 
 #include <asm/addrspace.h>
 #include <asm/irq.h>
 
 #define POWERDOWN_TIMEOUT      120
 /*
- * Blink frequency during reboot grace period and when paniced.
+ * Blink frequency during reboot grace period and when panicked.
  */
 #define POWERDOWN_FREQ         (HZ / 4)
 #define PANIC_FREQ             (HZ / 8)
 
 static struct timer_list power_timer, blink_timer, debounce_timer;
-static int has_paniced, shuting_down;
+static int has_panicked, shuting_down;
 
 static void ip32_machine_restart(char *command) __attribute__((noreturn));
 static void ip32_machine_halt(void) __attribute__((noreturn));
@@ -41,7 +42,7 @@ static void ip32_machine_power_off(void) __attribute__((noreturn));
 
 static void ip32_machine_restart(char *cmd)
 {
-       crime_write(CRIME_CONTROL_HARD_RESET, CRIME_CONTROL);
+       crime->control = CRIME_CONTROL_HARD_RESET;
        while (1);
 }
 
@@ -83,9 +84,9 @@ static void power_timeout(unsigned long data)
 
 static void blink_timeout(unsigned long data)
 {
-       unsigned long led = mace_perif_ctrl_read(misc) ^ MACEISA_LED_RED;
-       mace_perif_ctrl_write(led, misc);
-       mod_timer(&blink_timer, jiffies+data);
+       unsigned long led = mace->perif.ctrl.misc ^ MACEISA_LED_RED;
+       mace->perif.ctrl.misc = led;
+       mod_timer(&blink_timer, jiffies + data);
 }
 
 static void debounce(unsigned long data)
@@ -108,7 +109,7 @@ static void debounce(unsigned long data)
        }
        CMOS_WRITE(reg_a & ~DS_REGA_DV0, RTC_REG_A);
 
-       if (has_paniced)
+       if (has_panicked)
                ip32_machine_restart(NULL);
 
        enable_irq(MACEISA_RTC_IRQ);
@@ -116,10 +117,10 @@ static void debounce(unsigned long data)
 
 static inline void ip32_power_button(void)
 {
-       if (has_paniced)
+       if (has_panicked)
                return;
 
-       if (shuting_down || kill_proc(1, SIGINT, 1)) {
+       if (shuting_down || kill_cad_pid(SIGINT, 1)) {
                /* No init process or button pressed twice.  */
                ip32_machine_power_off();
        }
@@ -134,13 +135,13 @@ static inline void ip32_power_button(void)
        add_timer(&power_timer);
 }
 
-static irqreturn_t ip32_rtc_int(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t ip32_rtc_int(int irq, void *dev_id)
 {
        volatile unsigned char reg_c;
 
        reg_c = CMOS_READ(RTC_INTR_FLAGS);
        if (!(reg_c & RTC_IRQF)) {
-               printk(KERN_WARNING 
+               printk(KERN_WARNING
                        "%s: RTC IRQ without RTC_IRQF\n", __FUNCTION__);
        }
        /* Wait until interrupt goes away */
@@ -160,13 +161,13 @@ static int panic_event(struct notifier_block *this, unsigned long event,
 {
        unsigned long led;
 
-       if (has_paniced)
+       if (has_panicked)
                return NOTIFY_DONE;
-       has_paniced = 1;
+       has_panicked = 1;
 
        /* turn off the green LED */
-       led = mace_perif_ctrl_read(misc) | MACEISA_LED_GREEN;
-       mace_perif_ctrl_write(led, misc);
+       led = mace->perif.ctrl.misc | MACEISA_LED_GREEN;
+       mace->perif.ctrl.misc = led;
 
        blink_timer.data = PANIC_FREQ;
        blink_timeout(PANIC_FREQ);
@@ -181,18 +182,20 @@ static struct notifier_block panic_block = {
 static __init int ip32_reboot_setup(void)
 {
        /* turn on the green led only */
-       unsigned long led = mace_perif_ctrl_read(misc);
+       unsigned long led = mace->perif.ctrl.misc;
        led |= MACEISA_LED_RED;
        led &= ~MACEISA_LED_GREEN;
-       mace_perif_ctrl_write(led, misc);
+       mace->perif.ctrl.misc = led;
 
        _machine_restart = ip32_machine_restart;
        _machine_halt = ip32_machine_halt;
-       _machine_power_off = ip32_machine_power_off;
-       request_irq(MACEISA_RTC_IRQ, ip32_rtc_int, 0, "rtc", NULL);
+       pm_power_off = ip32_machine_power_off;
+
        init_timer(&blink_timer);
        blink_timer.function = blink_timeout;
-       notifier_chain_register(&panic_notifier_list, &panic_block);
+       atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
+
+       request_irq(MACEISA_RTC_IRQ, ip32_rtc_int, 0, "rtc", NULL);
 
        return 0;
 }