include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / arch / powerpc / platforms / cell / spu_priv1_mmio.c
index abe8a84..121aec3 100644 (file)
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <linux/interrupt.h>
+#include <linux/list.h>
 #include <linux/module.h>
+#include <linux/ptrace.h>
+#include <linux/wait.h>
+#include <linux/mm.h>
+#include <linux/io.h>
+#include <linux/mutex.h>
+#include <linux/device.h>
+#include <linux/sched.h>
 
-#include <asm/io.h>
 #include <asm/spu.h>
 #include <asm/spu_priv1.h>
+#include <asm/firmware.h>
+#include <asm/prom.h>
+
+#include "interrupt.h"
+#include "spu_priv1_mmio.h"
 
 static void int_mask_and(struct spu *spu, int class, u64 mask)
 {
@@ -60,8 +73,21 @@ static u64 int_stat_get(struct spu *spu, int class)
        return in_be64(&spu->priv1->int_stat_RW[class]);
 }
 
-static void int_route_set(struct spu *spu, u64 route)
+static void cpu_affinity_set(struct spu *spu, int cpu)
 {
+       u64 target;
+       u64 route;
+
+       if (nr_cpus_node(spu->node)) {
+               const struct cpumask *spumask = cpumask_of_node(spu->node),
+                       *cpumask = cpumask_of_node(cpu_to_node(cpu));
+
+               if (!cpumask_intersects(spumask, cpumask))
+                       return;
+       }
+
+       target = iic_get_target_id(cpu);
+       route = target << 48 | target << 32 | target << 16;
        out_be64(&spu->priv1->int_route_RW, route);
 }
 
@@ -80,9 +106,9 @@ static void mfc_dsisr_set(struct spu *spu, u64 dsisr)
        out_be64(&spu->priv1->mfc_dsisr_RW, dsisr);
 }
 
-static void mfc_sdr_set(struct spu *spu, u64 sdr)
+static void mfc_sdr_setup(struct spu *spu)
 {
-       out_be64(&spu->priv1->mfc_sdr_RW, sdr);
+       out_be64(&spu->priv1->mfc_sdr_RW, mfspr(SPRN_SDR1));
 }
 
 static void mfc_sr1_set(struct spu *spu, u64 sr1)
@@ -138,11 +164,11 @@ const struct spu_priv1_ops spu_priv1_mmio_ops =
        .int_mask_get = int_mask_get,
        .int_stat_clear = int_stat_clear,
        .int_stat_get = int_stat_get,
-       .int_route_set = int_route_set,
+       .cpu_affinity_set = cpu_affinity_set,
        .mfc_dar_get = mfc_dar_get,
        .mfc_dsisr_get = mfc_dsisr_get,
        .mfc_dsisr_set = mfc_dsisr_set,
-       .mfc_sdr_set = mfc_sdr_set,
+       .mfc_sdr_setup = mfc_sdr_setup,
        .mfc_sr1_set = mfc_sr1_set,
        .mfc_sr1_get = mfc_sr1_get,
        .mfc_tclass_id_set = mfc_tclass_id_set,