]>
Commit | Line | Data |
---|---|---|
67207b96 AB |
1 | /* |
2 | * SPU file system | |
3 | * | |
4 | * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 | |
5 | * | |
6 | * Author: Arnd Bergmann <arndb@de.ibm.com> | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License as published by | |
10 | * the Free Software Foundation; either version 2, or (at your option) | |
11 | * any later version. | |
12 | * | |
13 | * This program is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | * GNU General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with this program; if not, write to the Free Software | |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
21 | */ | |
22 | #ifndef SPUFS_H | |
23 | #define SPUFS_H | |
24 | ||
25 | #include <linux/kref.h> | |
26 | #include <linux/rwsem.h> | |
27 | #include <linux/spinlock.h> | |
28 | #include <linux/fs.h> | |
29 | ||
30 | #include <asm/spu.h> | |
5473af04 | 31 | #include <asm/spu_csa.h> |
67207b96 AB |
32 | |
33 | /* The magic number for our file system */ | |
34 | enum { | |
35 | SPUFS_MAGIC = 0x23c9b64e, | |
36 | }; | |
37 | ||
38 | struct spu_context { | |
39 | struct spu *spu; /* pointer to a physical SPU */ | |
5473af04 | 40 | struct spu_state csa; /* SPU context save area. */ |
67207b96 AB |
41 | struct rw_semaphore backing_sema; /* protects the above */ |
42 | spinlock_t mmio_lock; /* protects mmio access */ | |
43 | ||
44 | struct kref kref; | |
45 | }; | |
46 | ||
47 | struct spufs_inode_info { | |
48 | struct spu_context *i_ctx; | |
49 | struct inode vfs_inode; | |
50 | }; | |
51 | #define SPUFS_I(inode) \ | |
52 | container_of(inode, struct spufs_inode_info, vfs_inode) | |
53 | ||
54 | extern struct tree_descr spufs_dir_contents[]; | |
55 | ||
56 | /* system call implementation */ | |
57 | long spufs_run_spu(struct file *file, | |
58 | struct spu_context *ctx, u32 *npc, u32 *status); | |
59 | long spufs_create_thread(struct nameidata *nd, const char *name, | |
60 | unsigned int flags, mode_t mode); | |
61 | ||
62 | /* context management */ | |
63 | struct spu_context * alloc_spu_context(void); | |
64 | void destroy_spu_context(struct kref *kref); | |
65 | struct spu_context * get_spu_context(struct spu_context *ctx); | |
66 | int put_spu_context(struct spu_context *ctx); | |
67 | ||
68 | void spu_acquire(struct spu_context *ctx); | |
69 | void spu_release(struct spu_context *ctx); | |
70 | void spu_acquire_runnable(struct spu_context *ctx); | |
71 | void spu_acquire_saved(struct spu_context *ctx); | |
72 | ||
73 | #endif |