jbd: fix the way the b_modified flag is cleared
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / asm-powerpc / spu_priv1.h
blob25020a34ce7fd47b6478a272b6969af4e74981aa
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;
27 struct spu_context;
29 /* access to priv1 registers */
31 struct spu_priv1_ops {
32 void (*int_mask_and) (struct spu *spu, int class, u64 mask);
33 void (*int_mask_or) (struct spu *spu, int class, u64 mask);
34 void (*int_mask_set) (struct spu *spu, int class, u64 mask);
35 u64 (*int_mask_get) (struct spu *spu, int class);
36 void (*int_stat_clear) (struct spu *spu, int class, u64 stat);
37 u64 (*int_stat_get) (struct spu *spu, int class);
38 void (*cpu_affinity_set) (struct spu *spu, int cpu);
39 u64 (*mfc_dar_get) (struct spu *spu);
40 u64 (*mfc_dsisr_get) (struct spu *spu);
41 void (*mfc_dsisr_set) (struct spu *spu, u64 dsisr);
42 void (*mfc_sdr_setup) (struct spu *spu);
43 void (*mfc_sr1_set) (struct spu *spu, u64 sr1);
44 u64 (*mfc_sr1_get) (struct spu *spu);
45 void (*mfc_tclass_id_set) (struct spu *spu, u64 tclass_id);
46 u64 (*mfc_tclass_id_get) (struct spu *spu);
47 void (*tlb_invalidate) (struct spu *spu);
48 void (*resource_allocation_groupID_set) (struct spu *spu, u64 id);
49 u64 (*resource_allocation_groupID_get) (struct spu *spu);
50 void (*resource_allocation_enable_set) (struct spu *spu, u64 enable);
51 u64 (*resource_allocation_enable_get) (struct spu *spu);
54 extern const struct spu_priv1_ops* spu_priv1_ops;
56 static inline void
57 spu_int_mask_and (struct spu *spu, int class, u64 mask)
59 spu_priv1_ops->int_mask_and(spu, class, mask);
62 static inline void
63 spu_int_mask_or (struct spu *spu, int class, u64 mask)
65 spu_priv1_ops->int_mask_or(spu, class, mask);
68 static inline void
69 spu_int_mask_set (struct spu *spu, int class, u64 mask)
71 spu_priv1_ops->int_mask_set(spu, class, mask);
74 static inline u64
75 spu_int_mask_get (struct spu *spu, int class)
77 return spu_priv1_ops->int_mask_get(spu, class);
80 static inline void
81 spu_int_stat_clear (struct spu *spu, int class, u64 stat)
83 spu_priv1_ops->int_stat_clear(spu, class, stat);
86 static inline u64
87 spu_int_stat_get (struct spu *spu, int class)
89 return spu_priv1_ops->int_stat_get (spu, class);
92 static inline void
93 spu_cpu_affinity_set (struct spu *spu, int cpu)
95 spu_priv1_ops->cpu_affinity_set(spu, cpu);
98 static inline u64
99 spu_mfc_dar_get (struct spu *spu)
101 return spu_priv1_ops->mfc_dar_get(spu);
104 static inline u64
105 spu_mfc_dsisr_get (struct spu *spu)
107 return spu_priv1_ops->mfc_dsisr_get(spu);
110 static inline void
111 spu_mfc_dsisr_set (struct spu *spu, u64 dsisr)
113 spu_priv1_ops->mfc_dsisr_set(spu, dsisr);
116 static inline void
117 spu_mfc_sdr_setup (struct spu *spu)
119 spu_priv1_ops->mfc_sdr_setup(spu);
122 static inline void
123 spu_mfc_sr1_set (struct spu *spu, u64 sr1)
125 spu_priv1_ops->mfc_sr1_set(spu, sr1);
128 static inline u64
129 spu_mfc_sr1_get (struct spu *spu)
131 return spu_priv1_ops->mfc_sr1_get(spu);
134 static inline void
135 spu_mfc_tclass_id_set (struct spu *spu, u64 tclass_id)
137 spu_priv1_ops->mfc_tclass_id_set(spu, tclass_id);
140 static inline u64
141 spu_mfc_tclass_id_get (struct spu *spu)
143 return spu_priv1_ops->mfc_tclass_id_get(spu);
146 static inline void
147 spu_tlb_invalidate (struct spu *spu)
149 spu_priv1_ops->tlb_invalidate(spu);
152 static inline void
153 spu_resource_allocation_groupID_set (struct spu *spu, u64 id)
155 spu_priv1_ops->resource_allocation_groupID_set(spu, id);
158 static inline u64
159 spu_resource_allocation_groupID_get (struct spu *spu)
161 return spu_priv1_ops->resource_allocation_groupID_get(spu);
164 static inline void
165 spu_resource_allocation_enable_set (struct spu *spu, u64 enable)
167 spu_priv1_ops->resource_allocation_enable_set(spu, enable);
170 static inline u64
171 spu_resource_allocation_enable_get (struct spu *spu)
173 return spu_priv1_ops->resource_allocation_enable_get(spu);
176 /* spu management abstraction */
178 struct spu_management_ops {
179 int (*enumerate_spus)(int (*fn)(void *data));
180 int (*create_spu)(struct spu *spu, void *data);
181 int (*destroy_spu)(struct spu *spu);
182 void (*enable_spu)(struct spu_context *ctx);
183 void (*disable_spu)(struct spu_context *ctx);
184 int (*init_affinity)(void);
187 extern const struct spu_management_ops* spu_management_ops;
189 static inline int
190 spu_enumerate_spus (int (*fn)(void *data))
192 return spu_management_ops->enumerate_spus(fn);
195 static inline int
196 spu_create_spu (struct spu *spu, void *data)
198 return spu_management_ops->create_spu(spu, data);
201 static inline int
202 spu_destroy_spu (struct spu *spu)
204 return spu_management_ops->destroy_spu(spu);
207 static inline int
208 spu_init_affinity (void)
210 return spu_management_ops->init_affinity();
213 static inline void
214 spu_enable_spu (struct spu_context *ctx)
216 spu_management_ops->enable_spu(ctx);
219 static inline void
220 spu_disable_spu (struct spu_context *ctx)
222 spu_management_ops->disable_spu(ctx);
226 * The declarations folowing are put here for convenience
227 * and only intended to be used by the platform setup code.
230 extern const struct spu_priv1_ops spu_priv1_mmio_ops;
231 extern const struct spu_priv1_ops spu_priv1_beat_ops;
233 extern const struct spu_management_ops spu_management_of_ops;
235 #endif /* __KERNEL__ */
236 #endif