Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6/linux-loongson.git] / include / asm-powerpc / spu_priv1.h
blob7e78f6a1ab8b0e9fe56606ff945aaa74beef394e
1 /*
2 * Defines an spu hypervisor abstraction layer.
4 * Copyright 2006 Sony Corp.
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.
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.
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
20 #if !defined(_SPU_PRIV1_H)
21 #define _SPU_PRIV1_H
22 #if defined(__KERNEL__)
24 #include <linux/types.h>
26 struct spu;
28 /* access to priv1 registers */
30 struct spu_priv1_ops {
31 void (*int_mask_and) (struct spu *spu, int class, u64 mask);
32 void (*int_mask_or) (struct spu *spu, int class, u64 mask);
33 void (*int_mask_set) (struct spu *spu, int class, u64 mask);
34 u64 (*int_mask_get) (struct spu *spu, int class);
35 void (*int_stat_clear) (struct spu *spu, int class, u64 stat);
36 u64 (*int_stat_get) (struct spu *spu, int class);
37 void (*cpu_affinity_set) (struct spu *spu, int cpu);
38 u64 (*mfc_dar_get) (struct spu *spu);
39 u64 (*mfc_dsisr_get) (struct spu *spu);
40 void (*mfc_dsisr_set) (struct spu *spu, u64 dsisr);
41 void (*mfc_sdr_setup) (struct spu *spu);
42 void (*mfc_sr1_set) (struct spu *spu, u64 sr1);
43 u64 (*mfc_sr1_get) (struct spu *spu);
44 void (*mfc_tclass_id_set) (struct spu *spu, u64 tclass_id);
45 u64 (*mfc_tclass_id_get) (struct spu *spu);
46 void (*tlb_invalidate) (struct spu *spu);
47 void (*resource_allocation_groupID_set) (struct spu *spu, u64 id);
48 u64 (*resource_allocation_groupID_get) (struct spu *spu);
49 void (*resource_allocation_enable_set) (struct spu *spu, u64 enable);
50 u64 (*resource_allocation_enable_get) (struct spu *spu);
53 extern const struct spu_priv1_ops* spu_priv1_ops;
55 static inline void
56 spu_int_mask_and (struct spu *spu, int class, u64 mask)
58 spu_priv1_ops->int_mask_and(spu, class, mask);
61 static inline void
62 spu_int_mask_or (struct spu *spu, int class, u64 mask)
64 spu_priv1_ops->int_mask_or(spu, class, mask);
67 static inline void
68 spu_int_mask_set (struct spu *spu, int class, u64 mask)
70 spu_priv1_ops->int_mask_set(spu, class, mask);
73 static inline u64
74 spu_int_mask_get (struct spu *spu, int class)
76 return spu_priv1_ops->int_mask_get(spu, class);
79 static inline void
80 spu_int_stat_clear (struct spu *spu, int class, u64 stat)
82 spu_priv1_ops->int_stat_clear(spu, class, stat);
85 static inline u64
86 spu_int_stat_get (struct spu *spu, int class)
88 return spu_priv1_ops->int_stat_get (spu, class);
91 static inline void
92 spu_cpu_affinity_set (struct spu *spu, int cpu)
94 spu_priv1_ops->cpu_affinity_set(spu, cpu);
97 static inline u64
98 spu_mfc_dar_get (struct spu *spu)
100 return spu_priv1_ops->mfc_dar_get(spu);
103 static inline u64
104 spu_mfc_dsisr_get (struct spu *spu)
106 return spu_priv1_ops->mfc_dsisr_get(spu);
109 static inline void
110 spu_mfc_dsisr_set (struct spu *spu, u64 dsisr)
112 spu_priv1_ops->mfc_dsisr_set(spu, dsisr);
115 static inline void
116 spu_mfc_sdr_setup (struct spu *spu)
118 spu_priv1_ops->mfc_sdr_setup(spu);
121 static inline void
122 spu_mfc_sr1_set (struct spu *spu, u64 sr1)
124 spu_priv1_ops->mfc_sr1_set(spu, sr1);
127 static inline u64
128 spu_mfc_sr1_get (struct spu *spu)
130 return spu_priv1_ops->mfc_sr1_get(spu);
133 static inline void
134 spu_mfc_tclass_id_set (struct spu *spu, u64 tclass_id)
136 spu_priv1_ops->mfc_tclass_id_set(spu, tclass_id);
139 static inline u64
140 spu_mfc_tclass_id_get (struct spu *spu)
142 return spu_priv1_ops->mfc_tclass_id_get(spu);
145 static inline void
146 spu_tlb_invalidate (struct spu *spu)
148 spu_priv1_ops->tlb_invalidate(spu);
151 static inline void
152 spu_resource_allocation_groupID_set (struct spu *spu, u64 id)
154 spu_priv1_ops->resource_allocation_groupID_set(spu, id);
157 static inline u64
158 spu_resource_allocation_groupID_get (struct spu *spu)
160 return spu_priv1_ops->resource_allocation_groupID_get(spu);
163 static inline void
164 spu_resource_allocation_enable_set (struct spu *spu, u64 enable)
166 spu_priv1_ops->resource_allocation_enable_set(spu, enable);
169 static inline u64
170 spu_resource_allocation_enable_get (struct spu *spu)
172 return spu_priv1_ops->resource_allocation_enable_get(spu);
175 /* spu management abstraction */
177 struct spu_management_ops {
178 int (*enumerate_spus)(int (*fn)(void *data));
179 int (*create_spu)(struct spu *spu, void *data);
180 int (*destroy_spu)(struct spu *spu);
183 extern const struct spu_management_ops* spu_management_ops;
185 static inline int
186 spu_enumerate_spus (int (*fn)(void *data))
188 return spu_management_ops->enumerate_spus(fn);
191 static inline int
192 spu_create_spu (struct spu *spu, void *data)
194 return spu_management_ops->create_spu(spu, data);
197 static inline int
198 spu_destroy_spu (struct spu *spu)
200 return spu_management_ops->destroy_spu(spu);
204 * The declarations folowing are put here for convenience
205 * and only intended to be used by the platform setup code.
208 extern const struct spu_priv1_ops spu_priv1_mmio_ops;
209 extern const struct spu_priv1_ops spu_priv1_beat_ops;
211 extern const struct spu_management_ops spu_management_of_ops;
213 #endif /* __KERNEL__ */
214 #endif