linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / arch / sparc / kernel / sun4d_irq.c
index 74eed97..5262134 100644 (file)
@@ -6,6 +6,7 @@
  *  Heavily based on arch/sparc/kernel/irq.c.
  */
 
+#include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/linkage.h>
 #include <linux/kernel_stat.h>
@@ -53,7 +54,7 @@ unsigned char cpu_leds[32];
 unsigned char sbus_tid[32];
 #endif
 
-static struct irqaction *irq_action[NR_IRQS];
+extern struct irqaction *irq_action[];
 extern spinlock_t irq_action_lock;
 
 struct sbus_action {
@@ -102,18 +103,20 @@ found_it: seq_printf(p, "%3d: ", i);
 #ifndef CONFIG_SMP
                seq_printf(p, "%10u ", kstat_irqs(i));
 #else
-               for_each_online_cpu(x)
-                       seq_printf(p, "%10u ",
-                              kstat_cpu(cpu_logical_map(x)).irqs[i]);
+               for (x = 0; x < NR_CPUS; x++) {
+                       if (cpu_online(x))
+                               seq_printf(p, "%10u ",
+                                      kstat_cpu(cpu_logical_map(x)).irqs[i]);
+               }
 #endif
                seq_printf(p, "%c %s",
-                       (action->flags & IRQF_DISABLED) ? '+' : ' ',
+                       (action->flags & SA_INTERRUPT) ? '+' : ' ',
                        action->name);
                action = action->next;
                for (;;) {
                        for (; action; action = action->next) {
                                seq_printf(p, ",%s %s",
-                                       (action->flags & IRQF_DISABLED) ? " +" : "",
+                                       (action->flags & SA_INTERRUPT) ? " +" : "",
                                        action->name);
                        }
                        if (!sbusl) break;
@@ -160,7 +163,7 @@ void sun4d_free_irq(unsigned int irq, void *dev_id)
                        printk("Trying to free free shared IRQ%d\n",irq);
                        goto out_unlock;
                }
-       } else if (action->flags & IRQF_SHARED) {
+       } else if (action->flags & SA_SHIRQ) {
                printk("Trying to free shared IRQ%d with NULL device ID\n", irq);
                goto out_unlock;
        }
@@ -298,13 +301,13 @@ int sun4d_request_irq(unsigned int irq,
        action = *actionp;
        
        if (action) {
-               if ((action->flags & IRQF_SHARED) && (irqflags & IRQF_SHARED)) {
+               if ((action->flags & SA_SHIRQ) && (irqflags & SA_SHIRQ)) {
                        for (tmp = action; tmp->next; tmp = tmp->next);
                } else {
                        ret = -EBUSY;
                        goto out_unlock;
                }
-               if ((action->flags & IRQF_DISABLED) ^ (irqflags & IRQF_DISABLED)) {
+               if ((action->flags & SA_INTERRUPT) ^ (irqflags & SA_INTERRUPT)) {
                        printk("Attempt to mix fast and slow interrupts on IRQ%d denied\n", irq);
                        ret = -EBUSY;
                        goto out_unlock;
@@ -490,7 +493,7 @@ static void __init sun4d_init_timers(irqreturn_t (*counter_fn)(int, void *, stru
 
        irq = request_irq(TIMER_IRQ,
                          counter_fn,
-                         (IRQF_DISABLED | SA_STATIC_ALLOC),
+                         (SA_INTERRUPT | SA_STATIC_ALLOC),
                          "timer", NULL);
        if (irq) {
                prom_printf("time_init: unable to attach IRQ%d\n",TIMER_IRQ);
@@ -559,6 +562,17 @@ void __init sun4d_init_sbi_irq(void)
        }
 }
 
+static char *sun4d_irq_itoa(unsigned int irq)
+{
+       static char buff[16];
+       
+       if (irq < (1 << 5))
+               sprintf(buff, "%d", irq);
+       else
+               sprintf(buff, "%d,%x", sbus_to_pil[(irq >> 2) & 7], irq);
+       return buff;
+}
+
 void __init sun4d_init_IRQ(void)
 {
        local_irq_disable();
@@ -569,6 +583,7 @@ void __init sun4d_init_IRQ(void)
        BTFIXUPSET_CALL(clear_clock_irq, sun4d_clear_clock_irq, BTFIXUPCALL_NORM);
        BTFIXUPSET_CALL(clear_profile_irq, sun4d_clear_profile_irq, BTFIXUPCALL_NORM);
        BTFIXUPSET_CALL(load_profile_irq, sun4d_load_profile_irq, BTFIXUPCALL_NORM);
+       BTFIXUPSET_CALL(__irq_itoa, sun4d_irq_itoa, BTFIXUPCALL_NORM);
        sparc_init_timers = sun4d_init_timers;
 #ifdef CONFIG_SMP
        BTFIXUPSET_CALL(set_cpu_int, sun4d_set_cpu_int, BTFIXUPCALL_NORM);