]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/platforms/ps3/interrupt.c
[POWERPC] PS3: Make ps3_virq_setup and ps3_virq_destroy static
[linux-2.6-omap-h63xx.git] / arch / powerpc / platforms / ps3 / interrupt.c
index 51141dc06f9122cf993e13a77af705096449f237..e59634f7af9637d29bca47505508bb30cf624953 100644 (file)
@@ -78,14 +78,14 @@ struct ps3_bmp {
 /**
  * struct ps3_private - a per cpu data structure
  * @bmp: ps3_bmp structure
- * @node: HV logical_ppe_id
- * @cpu: HV thread_id
+ * @ppe_id: HV logical_ppe_id
+ * @thread_id: HV thread_id
  */
 
 struct ps3_private {
        struct ps3_bmp bmp __attribute__ ((aligned (PS3_BMP_MINALIGN)));
-       u64 node;
-       unsigned int cpu;
+       u64 ppe_id;
+       u64 thread_id;
 };
 
 static DEFINE_PER_CPU(struct ps3_private, ps3_private);
@@ -100,24 +100,14 @@ static DEFINE_PER_CPU(struct ps3_private, ps3_private);
 static void ps3_chip_mask(unsigned int virq)
 {
        struct ps3_private *pd = get_irq_chip_data(virq);
-       u64 bit = 0x8000000000000000UL >> virq;
-       u64 *p = &pd->bmp.mask;
-       u64 old;
        unsigned long flags;
 
-       pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq);
+       pr_debug("%s:%d: thread_id %lu, virq %d\n", __func__, __LINE__,
+               pd->thread_id, virq);
 
        local_irq_save(flags);
-       asm volatile(
-                    "1:        ldarx %0,0,%3\n"
-                    "andc      %0,%0,%2\n"
-                    "stdcx.    %0,0,%3\n"
-                    "bne-      1b"
-                    : "=&r" (old), "+m" (*p)
-                    : "r" (bit), "r" (p)
-                    : "cc" );
-
-       lv1_did_update_interrupt_mask(pd->node, pd->cpu);
+       clear_bit(63 - virq, &pd->bmp.mask);
+       lv1_did_update_interrupt_mask(pd->ppe_id, pd->thread_id);
        local_irq_restore(flags);
 }
 
@@ -131,24 +121,14 @@ static void ps3_chip_mask(unsigned int virq)
 static void ps3_chip_unmask(unsigned int virq)
 {
        struct ps3_private *pd = get_irq_chip_data(virq);
-       u64 bit = 0x8000000000000000UL >> virq;
-       u64 *p = &pd->bmp.mask;
-       u64 old;
        unsigned long flags;
 
-       pr_debug("%s:%d: cpu %u, virq %d\n", __func__, __LINE__, pd->cpu, virq);
+       pr_debug("%s:%d: thread_id %lu, virq %d\n", __func__, __LINE__,
+               pd->thread_id, virq);
 
        local_irq_save(flags);
-       asm volatile(
-                    "1:        ldarx %0,0,%3\n"
-                    "or        %0,%0,%2\n"
-                    "stdcx.    %0,0,%3\n"
-                    "bne-      1b"
-                    : "=&r" (old), "+m" (*p)
-                    : "r" (bit), "r" (p)
-                    : "cc" );
-
-       lv1_did_update_interrupt_mask(pd->node, pd->cpu);
+       set_bit(63 - virq, &pd->bmp.mask);
+       lv1_did_update_interrupt_mask(pd->ppe_id, pd->thread_id);
        local_irq_restore(flags);
 }
 
@@ -162,7 +142,7 @@ static void ps3_chip_unmask(unsigned int virq)
 static void ps3_chip_eoi(unsigned int virq)
 {
        const struct ps3_private *pd = get_irq_chip_data(virq);
-       lv1_end_of_interrupt_ext(pd->node, pd->cpu, virq);
+       lv1_end_of_interrupt_ext(pd->ppe_id, pd->thread_id, virq);
 }
 
 /**
@@ -187,8 +167,8 @@ static struct irq_chip ps3_irq_chip = {
  * ps3_private data.
  */
 
-int ps3_virq_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
-       unsigned int *virq)
+static int ps3_virq_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
+                         unsigned int *virq)
 {
        int result;
        struct ps3_private *pd;
@@ -237,12 +217,12 @@ fail_create:
  * Clears chip data and calls irq_dispose_mapping() for the virq.
  */
 
-int ps3_virq_destroy(unsigned int virq)
+static int ps3_virq_destroy(unsigned int virq)
 {
        const struct ps3_private *pd = get_irq_chip_data(virq);
 
-       pr_debug("%s:%d: node %lu, cpu %d, virq %u\n", __func__, __LINE__,
-               pd->node, pd->cpu, virq);
+       pr_debug("%s:%d: ppe_id %lu, thread_id %lu, virq %u\n", __func__,
+               __LINE__, pd->ppe_id, pd->thread_id, virq);
 
        set_irq_chip_data(virq, NULL);
        irq_dispose_mapping(virq);
@@ -278,7 +258,8 @@ int ps3_irq_plug_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
 
        /* Binds outlet to cpu + virq. */
 
-       result = lv1_connect_irq_plug_ext(pd->node, pd->cpu, *virq, outlet, 0);
+       result = lv1_connect_irq_plug_ext(pd->ppe_id, pd->thread_id, *virq,
+               outlet, 0);
 
        if (result) {
                pr_info("%s:%d: lv1_connect_irq_plug_ext failed: %s\n",
@@ -310,12 +291,12 @@ int ps3_irq_plug_destroy(unsigned int virq)
        int result;
        const struct ps3_private *pd = get_irq_chip_data(virq);
 
-       pr_debug("%s:%d: node %lu, cpu %d, virq %u\n", __func__, __LINE__,
-               pd->node, pd->cpu, virq);
+       pr_debug("%s:%d: ppe_id %lu, thread_id %lu, virq %u\n", __func__,
+               __LINE__, pd->ppe_id, pd->thread_id, virq);
 
        ps3_chip_mask(virq);
 
-       result = lv1_disconnect_irq_plug_ext(pd->node, pd->cpu, virq);
+       result = lv1_disconnect_irq_plug_ext(pd->ppe_id, pd->thread_id, virq);
 
        if (result)
                pr_info("%s:%d: lv1_disconnect_irq_plug_ext failed: %s\n",
@@ -564,6 +545,7 @@ int ps3_vuart_irq_setup(enum ps3_cpu_binding cpu, void* virt_addr_bmp,
 
        return result;
 }
+EXPORT_SYMBOL_GPL(ps3_vuart_irq_setup);
 
 int ps3_vuart_irq_destroy(unsigned int virq)
 {
@@ -583,6 +565,7 @@ int ps3_vuart_irq_destroy(unsigned int virq)
 
        return result;
 }
+EXPORT_SYMBOL_GPL(ps3_vuart_irq_destroy);
 
 /**
  * ps3_spe_irq_setup - Setup an spe virq.
@@ -655,8 +638,8 @@ static void _dump_bmp(struct ps3_private* pd, const char* func, int line)
        unsigned long flags;
 
        spin_lock_irqsave(&pd->bmp.lock, flags);
-       _dump_64_bmp("stat", &pd->bmp.status, pd->cpu, func, line);
-       _dump_64_bmp("mask", &pd->bmp.mask, pd->cpu, func, line);
+       _dump_64_bmp("stat", &pd->bmp.status, pd->thread_id, func, line);
+       _dump_64_bmp("mask", &pd->bmp.mask, pd->thread_id, func, line);
        spin_unlock_irqrestore(&pd->bmp.lock, flags);
 }
 
@@ -667,7 +650,7 @@ static void __maybe_unused _dump_mask(struct ps3_private *pd,
        unsigned long flags;
 
        spin_lock_irqsave(&pd->bmp.lock, flags);
-       _dump_64_bmp("mask", &pd->bmp.mask, pd->cpu, func, line);
+       _dump_64_bmp("mask", &pd->bmp.mask, pd->thread_id, func, line);
        spin_unlock_irqrestore(&pd->bmp.lock, flags);
 }
 #else
@@ -690,9 +673,16 @@ static int ps3_host_map(struct irq_host *h, unsigned int virq,
        return 0;
 }
 
+static int ps3_host_match(struct irq_host *h, struct device_node *np)
+{
+       /* Match all */
+       return 1;
+}
+
 static struct irq_host_ops ps3_host_ops = {
        .map = ps3_host_map,
        .unmap = ps3_host_unmap,
+       .match = ps3_host_match,
 };
 
 void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq)
@@ -719,9 +709,9 @@ static unsigned int ps3_get_irq(void)
        asm volatile("cntlzd %0,%1" : "=r" (plug) : "r" (x));
        plug &= 0x3f;
 
-       if (unlikely(plug) == NO_IRQ) {
-               pr_debug("%s:%d: no plug found: cpu %u\n", __func__, __LINE__,
-                       pd->cpu);
+       if (unlikely(plug == NO_IRQ)) {
+               pr_debug("%s:%d: no plug found: thread_id %lu\n", __func__,
+                       __LINE__, pd->thread_id);
                dump_bmp(&per_cpu(ps3_private, 0));
                dump_bmp(&per_cpu(ps3_private, 1));
                return NO_IRQ;
@@ -743,7 +733,7 @@ void __init ps3_init_IRQ(void)
        unsigned cpu;
        struct irq_host *host;
 
-       host = irq_alloc_host(IRQ_HOST_MAP_NOMAP, 0, &ps3_host_ops,
+       host = irq_alloc_host(NULL, IRQ_HOST_MAP_NOMAP, 0, &ps3_host_ops,
                PS3_INVALID_OUTLET);
        irq_set_default_host(host);
        irq_set_virq_count(PS3_PLUG_MAX + 1);
@@ -751,16 +741,16 @@ void __init ps3_init_IRQ(void)
        for_each_possible_cpu(cpu) {
                struct ps3_private *pd = &per_cpu(ps3_private, cpu);
 
-               lv1_get_logical_ppe_id(&pd->node);
-               pd->cpu = get_hard_smp_processor_id(cpu);
+               lv1_get_logical_ppe_id(&pd->ppe_id);
+               pd->thread_id = get_hard_smp_processor_id(cpu);
                spin_lock_init(&pd->bmp.lock);
 
-               pr_debug("%s:%d: node %lu, cpu %d, bmp %lxh\n", __func__,
-                       __LINE__, pd->node, pd->cpu,
+               pr_debug("%s:%d: ppe_id %lu, thread_id %lu, bmp %lxh\n",
+                       __func__, __LINE__, pd->ppe_id, pd->thread_id,
                        ps3_mm_phys_to_lpar(__pa(&pd->bmp)));
 
-               result = lv1_configure_irq_state_bitmap(pd->node, pd->cpu,
-                       ps3_mm_phys_to_lpar(__pa(&pd->bmp)));
+               result = lv1_configure_irq_state_bitmap(pd->ppe_id,
+                       pd->thread_id, ps3_mm_phys_to_lpar(__pa(&pd->bmp)));
 
                if (result)
                        pr_debug("%s:%d: lv1_configure_irq_state_bitmap failed:"