aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/platforms/cell/setup.c4
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c5
-rw-r--r--arch/powerpc/platforms/cell/spu_priv1_mmio.c104
-rw-r--r--arch/powerpc/platforms/cell/spufs/hw_ops.c1
-rw-r--r--arch/powerpc/platforms/cell/spufs/switch.c1
-rw-r--r--include/asm-powerpc/spu.h23
-rw-r--r--include/asm-powerpc/spu_priv1.h182
7 files changed, 256 insertions, 64 deletions
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index eb8ab9bbf744..3d1831d331e5 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -49,6 +49,7 @@
49#include <asm/ppc-pci.h> 49#include <asm/ppc-pci.h>
50#include <asm/irq.h> 50#include <asm/irq.h>
51#include <asm/spu.h> 51#include <asm/spu.h>
52#include <asm/spu_priv1.h>
52 53
53#include "interrupt.h" 54#include "interrupt.h"
54#include "iommu.h" 55#include "iommu.h"
@@ -83,6 +84,9 @@ static void __init cell_setup_arch(void)
83{ 84{
84 ppc_md.init_IRQ = iic_init_IRQ; 85 ppc_md.init_IRQ = iic_init_IRQ;
85 ppc_md.get_irq = iic_get_irq; 86 ppc_md.get_irq = iic_get_irq;
87#ifdef CONFIG_SPU_BASE
88 spu_priv1_ops = &spu_priv1_mmio_ops;
89#endif
86 90
87 cbe_regs_init(); 91 cbe_regs_init();
88 92
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index eb367dd89a7d..c3bb7299c4b5 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -34,10 +34,15 @@
34#include <asm/prom.h> 34#include <asm/prom.h>
35#include <linux/mutex.h> 35#include <linux/mutex.h>
36#include <asm/spu.h> 36#include <asm/spu.h>
37#include <asm/spu_priv1.h>
37#include <asm/mmu_context.h> 38#include <asm/mmu_context.h>
38 39
39#include "interrupt.h" 40#include "interrupt.h"
40 41
42const struct spu_priv1_ops *spu_priv1_ops;
43
44EXPORT_SYMBOL_GPL(spu_priv1_ops);
45
41static int __spu_trap_invalid_dma(struct spu *spu) 46static int __spu_trap_invalid_dma(struct spu *spu)
42{ 47{
43 pr_debug("%s\n", __FUNCTION__); 48 pr_debug("%s\n", __FUNCTION__);
diff --git a/arch/powerpc/platforms/cell/spu_priv1_mmio.c b/arch/powerpc/platforms/cell/spu_priv1_mmio.c
index b2656421c7b5..abe8a84925d2 100644
--- a/arch/powerpc/platforms/cell/spu_priv1_mmio.c
+++ b/arch/powerpc/platforms/cell/spu_priv1_mmio.c
@@ -1,133 +1,155 @@
1/* 1/*
2 * access to SPU privileged registers 2 * spu hypervisor abstraction for direct hardware access.
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
5 * Copyright 2006 Sony Corp.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3 */ 19 */
20
4#include <linux/module.h> 21#include <linux/module.h>
5 22
6#include <asm/io.h> 23#include <asm/io.h>
7#include <asm/spu.h> 24#include <asm/spu.h>
25#include <asm/spu_priv1.h>
8 26
9void spu_int_mask_and(struct spu *spu, int class, u64 mask) 27static void int_mask_and(struct spu *spu, int class, u64 mask)
10{ 28{
11 u64 old_mask; 29 u64 old_mask;
12 30
13 old_mask = in_be64(&spu->priv1->int_mask_RW[class]); 31 old_mask = in_be64(&spu->priv1->int_mask_RW[class]);
14 out_be64(&spu->priv1->int_mask_RW[class], old_mask & mask); 32 out_be64(&spu->priv1->int_mask_RW[class], old_mask & mask);
15} 33}
16EXPORT_SYMBOL_GPL(spu_int_mask_and);
17 34
18void spu_int_mask_or(struct spu *spu, int class, u64 mask) 35static void int_mask_or(struct spu *spu, int class, u64 mask)
19{ 36{
20 u64 old_mask; 37 u64 old_mask;
21 38
22 old_mask = in_be64(&spu->priv1->int_mask_RW[class]); 39 old_mask = in_be64(&spu->priv1->int_mask_RW[class]);
23 out_be64(&spu->priv1->int_mask_RW[class], old_mask | mask); 40 out_be64(&spu->priv1->int_mask_RW[class], old_mask | mask);
24} 41}
25EXPORT_SYMBOL_GPL(spu_int_mask_or);
26 42
27void spu_int_mask_set(struct spu *spu, int class, u64 mask) 43static void int_mask_set(struct spu *spu, int class, u64 mask)
28{ 44{
29 out_be64(&spu->priv1->int_mask_RW[class], mask); 45 out_be64(&spu->priv1->int_mask_RW[class], mask);
30} 46}
31EXPORT_SYMBOL_GPL(spu_int_mask_set);
32 47
33u64 spu_int_mask_get(struct spu *spu, int class) 48static u64 int_mask_get(struct spu *spu, int class)
34{ 49{
35 return in_be64(&spu->priv1->int_mask_RW[class]); 50 return in_be64(&spu->priv1->int_mask_RW[class]);
36} 51}
37EXPORT_SYMBOL_GPL(spu_int_mask_get);
38 52
39void spu_int_stat_clear(struct spu *spu, int class, u64 stat) 53static void int_stat_clear(struct spu *spu, int class, u64 stat)
40{ 54{
41 out_be64(&spu->priv1->int_stat_RW[class], stat); 55 out_be64(&spu->priv1->int_stat_RW[class], stat);
42} 56}
43EXPORT_SYMBOL_GPL(spu_int_stat_clear);
44 57
45u64 spu_int_stat_get(struct spu *spu, int class) 58static u64 int_stat_get(struct spu *spu, int class)
46{ 59{
47 return in_be64(&spu->priv1->int_stat_RW[class]); 60 return in_be64(&spu->priv1->int_stat_RW[class]);
48} 61}
49EXPORT_SYMBOL_GPL(spu_int_stat_get);
50 62
51void spu_int_route_set(struct spu *spu, u64 route) 63static void int_route_set(struct spu *spu, u64 route)
52{ 64{
53 out_be64(&spu->priv1->int_route_RW, route); 65 out_be64(&spu->priv1->int_route_RW, route);
54} 66}
55EXPORT_SYMBOL_GPL(spu_int_route_set);
56 67
57u64 spu_mfc_dar_get(struct spu *spu) 68static u64 mfc_dar_get(struct spu *spu)
58{ 69{
59 return in_be64(&spu->priv1->mfc_dar_RW); 70 return in_be64(&spu->priv1->mfc_dar_RW);
60} 71}
61EXPORT_SYMBOL_GPL(spu_mfc_dar_get);
62 72
63u64 spu_mfc_dsisr_get(struct spu *spu) 73static u64 mfc_dsisr_get(struct spu *spu)
64{ 74{
65 return in_be64(&spu->priv1->mfc_dsisr_RW); 75 return in_be64(&spu->priv1->mfc_dsisr_RW);
66} 76}
67EXPORT_SYMBOL_GPL(spu_mfc_dsisr_get);
68 77
69void spu_mfc_dsisr_set(struct spu *spu, u64 dsisr) 78static void mfc_dsisr_set(struct spu *spu, u64 dsisr)
70{ 79{
71 out_be64(&spu->priv1->mfc_dsisr_RW, dsisr); 80 out_be64(&spu->priv1->mfc_dsisr_RW, dsisr);
72} 81}
73EXPORT_SYMBOL_GPL(spu_mfc_dsisr_set);
74 82
75void spu_mfc_sdr_set(struct spu *spu, u64 sdr) 83static void mfc_sdr_set(struct spu *spu, u64 sdr)
76{ 84{
77 out_be64(&spu->priv1->mfc_sdr_RW, sdr); 85 out_be64(&spu->priv1->mfc_sdr_RW, sdr);
78} 86}
79EXPORT_SYMBOL_GPL(spu_mfc_sdr_set);
80 87
81void spu_mfc_sr1_set(struct spu *spu, u64 sr1) 88static void mfc_sr1_set(struct spu *spu, u64 sr1)
82{ 89{
83 out_be64(&spu->priv1->mfc_sr1_RW, sr1); 90 out_be64(&spu->priv1->mfc_sr1_RW, sr1);
84} 91}
85EXPORT_SYMBOL_GPL(spu_mfc_sr1_set);
86 92
87u64 spu_mfc_sr1_get(struct spu *spu) 93static u64 mfc_sr1_get(struct spu *spu)
88{ 94{
89 return in_be64(&spu->priv1->mfc_sr1_RW); 95 return in_be64(&spu->priv1->mfc_sr1_RW);
90} 96}
91EXPORT_SYMBOL_GPL(spu_mfc_sr1_get);
92 97
93void spu_mfc_tclass_id_set(struct spu *spu, u64 tclass_id) 98static void mfc_tclass_id_set(struct spu *spu, u64 tclass_id)
94{ 99{
95 out_be64(&spu->priv1->mfc_tclass_id_RW, tclass_id); 100 out_be64(&spu->priv1->mfc_tclass_id_RW, tclass_id);
96} 101}
97EXPORT_SYMBOL_GPL(spu_mfc_tclass_id_set);
98 102
99u64 spu_mfc_tclass_id_get(struct spu *spu) 103static u64 mfc_tclass_id_get(struct spu *spu)
100{ 104{
101 return in_be64(&spu->priv1->mfc_tclass_id_RW); 105 return in_be64(&spu->priv1->mfc_tclass_id_RW);
102} 106}
103EXPORT_SYMBOL_GPL(spu_mfc_tclass_id_get);
104 107
105void spu_tlb_invalidate(struct spu *spu) 108static void tlb_invalidate(struct spu *spu)
106{ 109{
107 out_be64(&spu->priv1->tlb_invalidate_entry_W, 0ul); 110 out_be64(&spu->priv1->tlb_invalidate_entry_W, 0ul);
108} 111}
109EXPORT_SYMBOL_GPL(spu_tlb_invalidate);
110 112
111void spu_resource_allocation_groupID_set(struct spu *spu, u64 id) 113static void resource_allocation_groupID_set(struct spu *spu, u64 id)
112{ 114{
113 out_be64(&spu->priv1->resource_allocation_groupID_RW, id); 115 out_be64(&spu->priv1->resource_allocation_groupID_RW, id);
114} 116}
115EXPORT_SYMBOL_GPL(spu_resource_allocation_groupID_set);
116 117
117u64 spu_resource_allocation_groupID_get(struct spu *spu) 118static u64 resource_allocation_groupID_get(struct spu *spu)
118{ 119{
119 return in_be64(&spu->priv1->resource_allocation_groupID_RW); 120 return in_be64(&spu->priv1->resource_allocation_groupID_RW);
120} 121}
121EXPORT_SYMBOL_GPL(spu_resource_allocation_groupID_get);
122 122
123void spu_resource_allocation_enable_set(struct spu *spu, u64 enable) 123static void resource_allocation_enable_set(struct spu *spu, u64 enable)
124{ 124{
125 out_be64(&spu->priv1->resource_allocation_enable_RW, enable); 125 out_be64(&spu->priv1->resource_allocation_enable_RW, enable);
126} 126}
127EXPORT_SYMBOL_GPL(spu_resource_allocation_enable_set);
128 127
129u64 spu_resource_allocation_enable_get(struct spu *spu) 128static u64 resource_allocation_enable_get(struct spu *spu)
130{ 129{
131 return in_be64(&spu->priv1->resource_allocation_enable_RW); 130 return in_be64(&spu->priv1->resource_allocation_enable_RW);
132} 131}
133EXPORT_SYMBOL_GPL(spu_resource_allocation_enable_get); 132
133const struct spu_priv1_ops spu_priv1_mmio_ops =
134{
135 .int_mask_and = int_mask_and,
136 .int_mask_or = int_mask_or,
137 .int_mask_set = int_mask_set,
138 .int_mask_get = int_mask_get,
139 .int_stat_clear = int_stat_clear,
140 .int_stat_get = int_stat_get,
141 .int_route_set = int_route_set,
142 .mfc_dar_get = mfc_dar_get,
143 .mfc_dsisr_get = mfc_dsisr_get,
144 .mfc_dsisr_set = mfc_dsisr_set,
145 .mfc_sdr_set = mfc_sdr_set,
146 .mfc_sr1_set = mfc_sr1_set,
147 .mfc_sr1_get = mfc_sr1_get,
148 .mfc_tclass_id_set = mfc_tclass_id_set,
149 .mfc_tclass_id_get = mfc_tclass_id_get,
150 .tlb_invalidate = tlb_invalidate,
151 .resource_allocation_groupID_set = resource_allocation_groupID_set,
152 .resource_allocation_groupID_get = resource_allocation_groupID_get,
153 .resource_allocation_enable_set = resource_allocation_enable_set,
154 .resource_allocation_enable_get = resource_allocation_enable_get,
155};
diff --git a/arch/powerpc/platforms/cell/spufs/hw_ops.c b/arch/powerpc/platforms/cell/spufs/hw_ops.c
index a13a8b5a014d..ede2cac46b6d 100644
--- a/arch/powerpc/platforms/cell/spufs/hw_ops.c
+++ b/arch/powerpc/platforms/cell/spufs/hw_ops.c
@@ -32,6 +32,7 @@
32 32
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/spu.h> 34#include <asm/spu.h>
35#include <asm/spu_priv1.h>
35#include <asm/spu_csa.h> 36#include <asm/spu_csa.h>
36#include <asm/mmu_context.h> 37#include <asm/mmu_context.h>
37#include "spufs.h" 38#include "spufs.h"
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
index 85bea06e798b..2dae062a9aec 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -46,6 +46,7 @@
46 46
47#include <asm/io.h> 47#include <asm/io.h>
48#include <asm/spu.h> 48#include <asm/spu.h>
49#include <asm/spu_priv1.h>
49#include <asm/spu_csa.h> 50#include <asm/spu_csa.h>
50#include <asm/mmu_context.h> 51#include <asm/mmu_context.h>
51 52
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index 946489929eb2..c7812e92f683 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -183,29 +183,6 @@ static inline void unregister_spu_syscalls(struct spufs_calls *calls)
183#endif /* MODULE */ 183#endif /* MODULE */
184 184
185 185
186/* access to priv1 registers */
187void spu_int_mask_and(struct spu *spu, int class, u64 mask);
188void spu_int_mask_or(struct spu *spu, int class, u64 mask);
189void spu_int_mask_set(struct spu *spu, int class, u64 mask);
190u64 spu_int_mask_get(struct spu *spu, int class);
191void spu_int_stat_clear(struct spu *spu, int class, u64 stat);
192u64 spu_int_stat_get(struct spu *spu, int class);
193void spu_int_route_set(struct spu *spu, u64 route);
194u64 spu_mfc_dar_get(struct spu *spu);
195u64 spu_mfc_dsisr_get(struct spu *spu);
196void spu_mfc_dsisr_set(struct spu *spu, u64 dsisr);
197void spu_mfc_sdr_set(struct spu *spu, u64 sdr);
198void spu_mfc_sr1_set(struct spu *spu, u64 sr1);
199u64 spu_mfc_sr1_get(struct spu *spu);
200void spu_mfc_tclass_id_set(struct spu *spu, u64 tclass_id);
201u64 spu_mfc_tclass_id_get(struct spu *spu);
202void spu_tlb_invalidate(struct spu *spu);
203void spu_resource_allocation_groupID_set(struct spu *spu, u64 id);
204u64 spu_resource_allocation_groupID_get(struct spu *spu);
205void spu_resource_allocation_enable_set(struct spu *spu, u64 enable);
206u64 spu_resource_allocation_enable_get(struct spu *spu);
207
208
209/* 186/*
210 * This defines the Local Store, Problem Area and Privlege Area of an SPU. 187 * This defines the Local Store, Problem Area and Privlege Area of an SPU.
211 */ 188 */
diff --git a/include/asm-powerpc/spu_priv1.h b/include/asm-powerpc/spu_priv1.h
new file mode 100644
index 000000000000..cb87d1f7e9bc
--- /dev/null
+++ b/include/asm-powerpc/spu_priv1.h
@@ -0,0 +1,182 @@
1/*
2 * Defines an spu hypervisor abstraction layer.
3 *
4 * Copyright 2006 Sony Corp.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#if !defined(_SPU_PRIV1_H)
21#define _SPU_PRIV1_H
22#if defined(__KERNEL__)
23
24struct spu;
25
26/* access to priv1 registers */
27
28struct spu_priv1_ops
29{
30 void (*int_mask_and) (struct spu *spu, int class, u64 mask);
31 void (*int_mask_or) (struct spu *spu, int class, u64 mask);
32 void (*int_mask_set) (struct spu *spu, int class, u64 mask);
33 u64 (*int_mask_get) (struct spu *spu, int class);
34 void (*int_stat_clear) (struct spu *spu, int class, u64 stat);
35 u64 (*int_stat_get) (struct spu *spu, int class);
36 void (*int_route_set) (struct spu *spu, u64 route);
37 u64 (*mfc_dar_get) (struct spu *spu);
38 u64 (*mfc_dsisr_get) (struct spu *spu);
39 void (*mfc_dsisr_set) (struct spu *spu, u64 dsisr);
40 void (*mfc_sdr_set) (struct spu *spu, u64 sdr);
41 void (*mfc_sr1_set) (struct spu *spu, u64 sr1);
42 u64 (*mfc_sr1_get) (struct spu *spu);
43 void (*mfc_tclass_id_set) (struct spu *spu, u64 tclass_id);
44 u64 (*mfc_tclass_id_get) (struct spu *spu);
45 void (*tlb_invalidate) (struct spu *spu);
46 void (*resource_allocation_groupID_set) (struct spu *spu, u64 id);
47 u64 (*resource_allocation_groupID_get) (struct spu *spu);
48 void (*resource_allocation_enable_set) (struct spu *spu, u64 enable);
49 u64 (*resource_allocation_enable_get) (struct spu *spu);
50};
51
52extern const struct spu_priv1_ops* spu_priv1_ops;
53
54static inline void
55spu_int_mask_and (struct spu *spu, int class, u64 mask)
56{
57 spu_priv1_ops->int_mask_and(spu, class, mask);
58}
59
60static inline void
61spu_int_mask_or (struct spu *spu, int class, u64 mask)
62{
63 spu_priv1_ops->int_mask_or(spu, class, mask);
64}
65
66static inline void
67spu_int_mask_set (struct spu *spu, int class, u64 mask)
68{
69 spu_priv1_ops->int_mask_set(spu, class, mask);
70}
71
72static inline u64
73spu_int_mask_get (struct spu *spu, int class)
74{
75 return spu_priv1_ops->int_mask_get(spu, class);
76}
77
78static inline void
79spu_int_stat_clear (struct spu *spu, int class, u64 stat)
80{
81 spu_priv1_ops->int_stat_clear(spu, class, stat);
82}
83
84static inline u64
85spu_int_stat_get (struct spu *spu, int class)
86{
87 return spu_priv1_ops->int_stat_get (spu, class);
88}
89
90static inline void
91spu_int_route_set (struct spu *spu, u64 route)
92{
93 spu_priv1_ops->int_stat_get(spu, route);
94}
95
96static inline u64
97spu_mfc_dar_get (struct spu *spu)
98{
99 return spu_priv1_ops->mfc_dar_get(spu);
100}
101
102static inline u64
103spu_mfc_dsisr_get (struct spu *spu)
104{
105 return spu_priv1_ops->mfc_dsisr_get(spu);
106}
107
108static inline void
109spu_mfc_dsisr_set (struct spu *spu, u64 dsisr)
110{
111 spu_priv1_ops->mfc_dsisr_set(spu, dsisr);
112}
113
114static inline void
115spu_mfc_sdr_set (struct spu *spu, u64 sdr)
116{
117 spu_priv1_ops->mfc_sdr_set(spu, sdr);
118}
119
120static inline void
121spu_mfc_sr1_set (struct spu *spu, u64 sr1)
122{
123 spu_priv1_ops->mfc_sr1_set(spu, sr1);
124}
125
126static inline u64
127spu_mfc_sr1_get (struct spu *spu)
128{
129 return spu_priv1_ops->mfc_sr1_get(spu);
130}
131
132static inline void
133spu_mfc_tclass_id_set (struct spu *spu, u64 tclass_id)
134{
135 spu_priv1_ops->mfc_tclass_id_set(spu, tclass_id);
136}
137
138static inline u64
139spu_mfc_tclass_id_get (struct spu *spu)
140{
141 return spu_priv1_ops->mfc_tclass_id_get(spu);
142}
143
144static inline void
145spu_tlb_invalidate (struct spu *spu)
146{
147 spu_priv1_ops->tlb_invalidate(spu);
148}
149
150static inline void
151spu_resource_allocation_groupID_set (struct spu *spu, u64 id)
152{
153 spu_priv1_ops->resource_allocation_groupID_set(spu, id);
154}
155
156static inline u64
157spu_resource_allocation_groupID_get (struct spu *spu)
158{
159 return spu_priv1_ops->resource_allocation_groupID_get(spu);
160}
161
162static inline void
163spu_resource_allocation_enable_set (struct spu *spu, u64 enable)
164{
165 spu_priv1_ops->resource_allocation_enable_set(spu, enable);
166}
167
168static inline u64
169spu_resource_allocation_enable_get (struct spu *spu)
170{
171 return spu_priv1_ops->resource_allocation_enable_get(spu);
172}
173
174/* The declarations folowing are put here for convenience
175 * and only intended to be used by the platform setup code
176 * for initializing spu_priv1_ops.
177 */
178
179extern const struct spu_priv1_ops spu_priv1_mmio_ops;
180
181#endif /* __KERNEL__ */
182#endif