aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/spufs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/file.c')
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index b4d38cb65f17..e2c9d48a6804 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -211,37 +211,43 @@ static int spufs_cntl_mmap(struct file *file, struct vm_area_struct *vma)
211#define spufs_cntl_mmap NULL 211#define spufs_cntl_mmap NULL
212#endif /* !SPUFS_MMAP_4K */ 212#endif /* !SPUFS_MMAP_4K */
213 213
214static int spufs_cntl_open(struct inode *inode, struct file *file) 214static u64 spufs_cntl_get(void *data)
215{ 215{
216 struct spufs_inode_info *i = SPUFS_I(inode); 216 struct spu_context *ctx = data;
217 struct spu_context *ctx = i->i_ctx; 217 u64 val;
218 218
219 file->private_data = ctx; 219 spu_acquire(ctx);
220 file->f_mapping = inode->i_mapping; 220 val = ctx->ops->status_read(ctx);
221 ctx->cntl = inode->i_mapping; 221 spu_release(ctx);
222 return 0; 222
223 return val;
223} 224}
224 225
225static ssize_t 226static void spufs_cntl_set(void *data, u64 val)
226spufs_cntl_read(struct file *file, char __user *buffer,
227 size_t size, loff_t *pos)
228{ 227{
229 /* FIXME: read from spu status */ 228 struct spu_context *ctx = data;
230 return -EINVAL; 229
230 spu_acquire(ctx);
231 ctx->ops->runcntl_write(ctx, val);
232 spu_release(ctx);
231} 233}
232 234
233static ssize_t 235static int spufs_cntl_open(struct inode *inode, struct file *file)
234spufs_cntl_write(struct file *file, const char __user *buffer,
235 size_t size, loff_t *pos)
236{ 236{
237 /* FIXME: write to runctl bit */ 237 struct spufs_inode_info *i = SPUFS_I(inode);
238 return -EINVAL; 238 struct spu_context *ctx = i->i_ctx;
239
240 file->private_data = ctx;
241 file->f_mapping = inode->i_mapping;
242 ctx->cntl = inode->i_mapping;
243 return simple_attr_open(inode, file, spufs_cntl_get,
244 spufs_cntl_set, "0x%08lx");
239} 245}
240 246
241static struct file_operations spufs_cntl_fops = { 247static struct file_operations spufs_cntl_fops = {
242 .open = spufs_cntl_open, 248 .open = spufs_cntl_open,
243 .read = spufs_cntl_read, 249 .read = simple_attr_read,
244 .write = spufs_cntl_write, 250 .write = simple_attr_write,
245 .mmap = spufs_cntl_mmap, 251 .mmap = spufs_cntl_mmap,
246}; 252};
247 253