[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XenPPC] [pushed] [ppc] remove (almost) all mpic code from external.c and put it in mpic_init.c



changeset:   10297:2c4956f3947b2d3af9e1c8c843589aea852c8667
tag:         tip
user:        jimix@xxxxxxxxxxxxxxxxxxxxx
date:        Fri May 19 07:01:47 2006 -0400
files:       xen/arch/ppc/external.c xen/arch/ppc/mpic_init.c 
xen/arch/ppc/mpic_init.h
description:
[ppc] remove (almost) all mpic code from external.c and put it in mpic_init.c


diff -r b5a8acc8a021b509267de6a80a693abdbc029bae -r 
2c4956f3947b2d3af9e1c8c843589aea852c8667 xen/arch/ppc/external.c
--- a/xen/arch/ppc/external.c   Fri May 19 06:35:16 2006 -0400
+++ b/xen/arch/ppc/external.c   Fri May 19 07:01:47 2006 -0400
@@ -26,7 +26,7 @@
 #include <asm/current.h>
 #include <asm/hardirq.h>
 #include <asm/mpic.h>
-#include "find_mpic.h"
+#include "mpic_init.h"
 
 #undef DEBUG
 #ifdef DEBUG
@@ -42,8 +42,7 @@ unsigned long io_apic_irqs;
 unsigned long io_apic_irqs;
 int ioapic_ack_new = 1;
 
-static struct mpic *mpic;
-static struct hw_interrupt_type hc_irq;
+static struct hw_interrupt_type *hc_irq;
 
 /* deliver_ee: called with interrupts off when resuming every vcpu */
 void deliver_ee(struct cpu_user_regs *regs)
@@ -82,19 +81,14 @@ void do_external(struct cpu_user_regs *r
     BUG_ON(!(regs->msr & MSR_EE));
     BUG_ON(mfmsr() & MSR_EE);
 
-    for (;;) {
-        vec = mpic_get_one_irq(mpic, regs);
-
-        if (vec != -1) {
-            DBG("EE:0x%lx isrc: %d\n", regs->msr, vec);
-            regs->entry_vector = vec;
-            do_IRQ(regs);
-
-            BUG_ON(mfmsr() & MSR_EE);
-
-            continue;
-        }
-        break;
+    vec = xen_mpic_get_irq(regs);
+
+    if (vec != -1) {
+        DBG("EE:0x%lx isrc: %d\n", regs->msr, vec);
+        regs->entry_vector = vec;
+        do_IRQ(regs);
+
+        BUG_ON(mfmsr() & MSR_EE);
     }
 }
 
@@ -113,7 +107,7 @@ static unsigned int xen_startup_irq(unsi
 {
     DBG("%s(%d)\n", __func__, irq);
     if (xen_local_irq(irq)) {
-        return hc_irq.startup(irq);
+        return hc_irq->startup(irq);
     }
        return 0;
 }
@@ -122,7 +116,7 @@ static void xen_shutdown_irq(unsigned in
 {
     DBG("%s(%d)\n", __func__, irq);
     if (xen_local_irq(irq)) {
-        hc_irq.shutdown(irq);
+        hc_irq->shutdown(irq);
     }
 }
 
@@ -130,7 +124,7 @@ static void xen_enable_irq(unsigned int 
 {
     DBG("%s(%d)\n", __func__, irq);
     if (xen_local_irq(irq)) {
-        hc_irq.enable(irq);
+        hc_irq->enable(irq);
     }
 }
 
@@ -138,7 +132,7 @@ static void xen_disable_irq(unsigned int
 {
     DBG("%s(%d)\n", __func__, irq);
     if (xen_local_irq(irq)) {
-        hc_irq.disable(irq);
+        hc_irq->disable(irq);
     }
 }
     
@@ -146,7 +140,7 @@ static void xen_ack_irq(unsigned int irq
 {
     DBG("%s(%d)\n", __func__, irq);
     if (xen_local_irq(irq)) {
-        if (hc_irq.ack) hc_irq.ack(irq);
+        if (hc_irq->ack) hc_irq->ack(irq);
     }
 }
 
@@ -154,7 +148,7 @@ static void xen_end_irq(unsigned int irq
 {
     DBG("%s(%d)\n", __func__, irq);
     if (xen_local_irq(irq)) {
-        hc_irq.end(irq);
+        hc_irq->end(irq);
     }
 }
 
@@ -162,72 +156,23 @@ static void xen_set_affinity(unsigned in
 {
     DBG("%s(%d)\n", __func__, irq);
     if (xen_local_irq(irq)) {
-        if (hc_irq.set_affinity) hc_irq.set_affinity(irq, mask);
-    }
-}
+        if (hc_irq->set_affinity) hc_irq->set_affinity(irq, mask);
+    }
+}
+
+static struct hw_interrupt_type xen_irq = {
+    .startup = xen_startup_irq,
+    .enable = xen_enable_irq,
+    .disable = xen_disable_irq,
+    .shutdown = xen_shutdown_irq,
+    .ack = xen_ack_irq,
+    .end = xen_end_irq,
+    .set_affinity = xen_set_affinity,
+};
 
 void init_IRQ(unsigned long oftree)
 {
-    unsigned int isu_size;
-    unsigned int irq_offset;
-    unsigned int irq_count;
-    unsigned int ipi_offset;
-    unsigned char *senses;
-    unsigned int senses_count;
-
-    printk("%s: start\n", __func__);
-
-    io_apic_irqs = ~0;  /* all IRQs go through IOAPIC */
-       irq_vector[0] = FIRST_DEVICE_VECTOR;
-       vector_irq[FIRST_DEVICE_VECTOR] = 0;
-
-    isu_size = 0;
-    irq_offset = 0;
-    irq_count = 128;
-    ipi_offset = 128;
-    senses = NULL;
-    senses_count = 0;
-
-    if (find_mpic(oftree)) {
-        printk("%s: ERROR: Could not find open pic.\n", __func__);
-        return;
-    } else {
-        unsigned long opic_addr = get_mpic_address();
-        unsigned int opic_flags = get_mpic_flags();
-
-        mpic = mpic_alloc(opic_addr,
-                          MPIC_PRIMARY |
-                          MPIC_BROKEN_U3 | MPIC_WANTS_RESET |
-                          opic_flags,
-                          isu_size, irq_offset, irq_count,
-                          ipi_offset, senses, senses_count, "Xen-U3-MPIC");
-
-        BUG_ON(mpic == NULL);
-        mpic_init(mpic);
-
-        hc_irq.startup = mpic->hc_irq.startup;
-        mpic->hc_irq.startup = xen_startup_irq;
-
-        hc_irq.enable = mpic->hc_irq.enable;
-        mpic->hc_irq.enable = xen_enable_irq;
-
-        hc_irq.disable = mpic->hc_irq.disable;
-        mpic->hc_irq.disable = xen_disable_irq;
-
-        hc_irq.shutdown = mpic->hc_irq.shutdown;
-        mpic->hc_irq.shutdown = xen_shutdown_irq;
-
-        hc_irq.ack = mpic->hc_irq.ack;
-        mpic->hc_irq.ack = xen_ack_irq;
-
-        hc_irq.end = mpic->hc_irq.end;
-        mpic->hc_irq.end = xen_end_irq;
-
-        hc_irq.set_affinity = mpic->hc_irq.set_affinity;
-        mpic->hc_irq.set_affinity = xen_set_affinity;
-
-        printk("%s: success\n", __func__);
-    }
+    hc_irq = xen_mpic_init(oftree, &xen_irq);
 }
 
 void ack_APIC_irq(void) {
diff -r b5a8acc8a021b509267de6a80a693abdbc029bae -r 
2c4956f3947b2d3af9e1c8c843589aea852c8667 xen/arch/ppc/mpic_init.c
--- a/xen/arch/ppc/mpic_init.c  Fri May 19 06:35:16 2006 -0400
+++ b/xen/arch/ppc/mpic_init.c  Fri May 19 07:01:47 2006 -0400
@@ -5,6 +5,7 @@
 #include <xen/compile.h>
 #include <public/of-devtree.h>
 #include <asm/mpic.h>
+#include "mpic_init.h"
 
 #undef DEBUG
 #undef NOSERIAL
@@ -22,9 +23,9 @@ int of_printf(const char *fmt, ...)
 
 #define PANIC(fmt...) DBG(fmt)
 
-unsigned long opic_addr;
-unsigned int opic_flags;
-
+static struct mpic *mpic;
+static unsigned long opic_addr;
+static unsigned int opic_flags;
 
 /*
  * from OF_IEEE_1275
@@ -207,7 +208,7 @@ static unsigned int find_pic_flags_from_
     return flags;
 }
 
-static int find_mpic_simple_probe(void *oft_p )
+static int find_mpic_simple_probe(void *oft_p)
 {
     u32 addr_cells;
     int rc;
@@ -287,7 +288,7 @@ static int find_mpic_canonical_probe(voi
     return -1;
 }
 
-int find_mpic(unsigned long oftree)
+static int find_mpic(unsigned long oftree)
 {
     void *oft_p;
     int rc;
@@ -306,12 +307,74 @@ int find_mpic(unsigned long oftree)
     return rc;
 }
 
-unsigned long get_mpic_address()
-{
-    return opic_addr;
-}
-
-unsigned int get_mpic_flags()
-{
-    return opic_flags;
-}
+static struct hw_interrupt_type hc_irq;
+
+struct hw_interrupt_type *xen_mpic_init(
+    unsigned long oftree, struct hw_interrupt_type *xen_irq)
+{
+    unsigned int isu_size;
+    unsigned int irq_offset;
+    unsigned int irq_count;
+    unsigned int ipi_offset;
+    unsigned char *senses;
+    unsigned int senses_count;
+
+    printk("%s: start\n", __func__);
+
+    io_apic_irqs = ~0;  /* all IRQs go through IOAPIC */
+       irq_vector[0] = FIRST_DEVICE_VECTOR;
+       vector_irq[FIRST_DEVICE_VECTOR] = 0;
+
+    isu_size = 0;
+    irq_offset = 0;
+    irq_count = 128;
+    ipi_offset = 128;
+    senses = NULL;
+    senses_count = 0;
+
+    if (find_mpic(oftree)) {
+        printk("%s: ERROR: Could not find open pic.\n", __func__);
+        return NULL;
+    }
+
+    mpic = mpic_alloc(opic_addr,
+                      MPIC_PRIMARY |
+                      MPIC_BROKEN_U3 | MPIC_WANTS_RESET |
+                      opic_flags,
+                      isu_size, irq_offset, irq_count,
+                      ipi_offset, senses, senses_count, "Xen-U3-MPIC");
+
+    BUG_ON(mpic == NULL);
+    mpic_init(mpic);
+
+    hc_irq.startup = mpic->hc_irq.startup;
+    mpic->hc_irq.startup = xen_irq->startup;
+
+    hc_irq.enable = mpic->hc_irq.enable;
+    mpic->hc_irq.enable = xen_irq->enable;
+
+    hc_irq.disable = mpic->hc_irq.disable;
+    mpic->hc_irq.disable = xen_irq->disable;
+
+    hc_irq.shutdown = mpic->hc_irq.shutdown;
+    mpic->hc_irq.shutdown = xen_irq->shutdown;
+
+    hc_irq.ack = mpic->hc_irq.ack;
+    mpic->hc_irq.ack = xen_irq->ack;
+
+    hc_irq.end = mpic->hc_irq.end;
+    mpic->hc_irq.end = xen_irq->end;
+
+    hc_irq.set_affinity = mpic->hc_irq.set_affinity;
+    mpic->hc_irq.set_affinity = xen_irq->set_affinity;
+
+    printk("%s: success\n", __func__);
+    return &hc_irq;
+}
+
+int xen_mpic_get_irq(struct cpu_user_regs *regs)
+{
+    BUG_ON(mpic == NULL);
+
+       return mpic_get_one_irq(mpic, regs);
+}
diff -r b5a8acc8a021b509267de6a80a693abdbc029bae -r 
2c4956f3947b2d3af9e1c8c843589aea852c8667 xen/arch/ppc/mpic_init.h
--- a/xen/arch/ppc/mpic_init.h  Fri May 19 06:35:16 2006 -0400
+++ b/xen/arch/ppc/mpic_init.h  Fri May 19 07:01:47 2006 -0400
@@ -1,8 +1,9 @@
-#ifndef _FIND_MPIC_H
-#define _FIND_MPIC_H
+#ifndef _MPIC_INIT_H
+#define _MPIC_INIT_H
 
-int find_mpic(unsigned long oftree);
-unsigned long get_mpic_address();
-unsigned int get_mpic_flags();
+extern struct hw_interrupt_type *xen_mpic_init(
+    unsigned long oftree, struct hw_interrupt_type *xen_irq);
 
-#endif  /* #ifndef _FIND_MPIC_H */
+extern int xen_mpic_get_irq(struct cpu_user_regs *regs);
+
+#endif  /* #ifndef _MPIC_INIT_H */



_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.