Merge branch 'linus' into irq/numa
[sfrench/cifs-2.6.git] / arch / powerpc / sysdev / mpic.c
index 532e205303a29ea530ab4e3e180cfd4e459ceaa4..352d8c3ef5269c97e548789edccc49c420214a71 100644 (file)
@@ -807,7 +807,7 @@ static void mpic_end_ipi(unsigned int irq)
 
 #endif /* CONFIG_SMP */
 
-void mpic_set_affinity(unsigned int irq, const struct cpumask *cpumask)
+int mpic_set_affinity(unsigned int irq, const struct cpumask *cpumask)
 {
        struct mpic *mpic = mpic_from_irq(irq);
        unsigned int src = mpic_irq_to_hw(irq);
@@ -824,6 +824,8 @@ void mpic_set_affinity(unsigned int irq, const struct cpumask *cpumask)
                mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION),
                               mpic_physmask(cpus_addr(tmp)[0]));
        }
+
+       return 0;
 }
 
 static unsigned int mpic_type_to_vecpri(struct mpic *mpic, unsigned int type)
@@ -1057,13 +1059,6 @@ struct mpic * __init mpic_alloc(struct device_node *node,
        memset(mpic, 0, sizeof(struct mpic));
        mpic->name = name;
 
-       mpic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR,
-                                      isu_size, &mpic_host_ops,
-                                      flags & MPIC_LARGE_VECTORS ? 2048 : 256);
-       if (mpic->irqhost == NULL)
-               return NULL;
-
-       mpic->irqhost->host_data = mpic;
        mpic->hc_irq = mpic_irq_chip;
        mpic->hc_irq.typename = name;
        if (flags & MPIC_PRIMARY)
@@ -1170,6 +1165,12 @@ struct mpic * __init mpic_alloc(struct device_node *node,
                        mb();
        }
 
+       /* CoreInt */
+       if (flags & MPIC_ENABLE_COREINT)
+               mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0),
+                          mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0))
+                          | MPIC_GREG_GCONF_COREINT);
+
        if (flags & MPIC_ENABLE_MCK)
                mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0),
                           mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0))
@@ -1207,6 +1208,15 @@ struct mpic * __init mpic_alloc(struct device_node *node,
        mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1);
        mpic->isu_mask = (1 << mpic->isu_shift) - 1;
 
+       mpic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR,
+                                      isu_size ? isu_size : mpic->num_sources,
+                                      &mpic_host_ops,
+                                      flags & MPIC_LARGE_VECTORS ? 2048 : 256);
+       if (mpic->irqhost == NULL)
+               return NULL;
+
+       mpic->irqhost->host_data = mpic;
+
        /* Display version */
        switch (greg_feature & MPIC_GREG_FEATURE_VERSION_MASK) {
        case 1:
@@ -1525,6 +1535,34 @@ unsigned int mpic_get_irq(void)
        return mpic_get_one_irq(mpic);
 }
 
+unsigned int mpic_get_coreint_irq(void)
+{
+#ifdef CONFIG_BOOKE
+       struct mpic *mpic = mpic_primary;
+       u32 src;
+
+       BUG_ON(mpic == NULL);
+
+       src = mfspr(SPRN_EPR);
+
+       if (unlikely(src == mpic->spurious_vec)) {
+               if (mpic->flags & MPIC_SPV_EOI)
+                       mpic_eoi(mpic);
+               return NO_IRQ;
+       }
+       if (unlikely(mpic->protected && test_bit(src, mpic->protected))) {
+               if (printk_ratelimit())
+                       printk(KERN_WARNING "%s: Got protected source %d !\n",
+                              mpic->name, (int)src);
+               return NO_IRQ;
+       }
+
+       return irq_linear_revmap(mpic->irqhost, src);
+#else
+       return NO_IRQ;
+#endif
+}
+
 unsigned int mpic_get_mcirq(void)
 {
        struct mpic *mpic = mpic_primary;