Arnd Bergmann | 67207b9 | 2005-11-15 15:53:48 -0500 | [diff] [blame^] | 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> |
| 31 | |
| 32 | /* The magic number for our file system */ |
| 33 | enum { |
| 34 | SPUFS_MAGIC = 0x23c9b64e, |
| 35 | }; |
| 36 | |
| 37 | struct spu_context { |
| 38 | struct spu *spu; /* pointer to a physical SPU */ |
| 39 | struct rw_semaphore backing_sema; /* protects the above */ |
| 40 | spinlock_t mmio_lock; /* protects mmio access */ |
| 41 | |
| 42 | struct kref kref; |
| 43 | }; |
| 44 | |
| 45 | struct spufs_inode_info { |
| 46 | struct spu_context *i_ctx; |
| 47 | struct inode vfs_inode; |
| 48 | }; |
| 49 | #define SPUFS_I(inode) \ |
| 50 | container_of(inode, struct spufs_inode_info, vfs_inode) |
| 51 | |
| 52 | extern struct tree_descr spufs_dir_contents[]; |
| 53 | |
| 54 | /* system call implementation */ |
| 55 | long spufs_run_spu(struct file *file, |
| 56 | struct spu_context *ctx, u32 *npc, u32 *status); |
| 57 | long spufs_create_thread(struct nameidata *nd, const char *name, |
| 58 | unsigned int flags, mode_t mode); |
| 59 | |
| 60 | /* context management */ |
| 61 | struct spu_context * alloc_spu_context(void); |
| 62 | void destroy_spu_context(struct kref *kref); |
| 63 | struct spu_context * get_spu_context(struct spu_context *ctx); |
| 64 | int put_spu_context(struct spu_context *ctx); |
| 65 | |
| 66 | void spu_acquire(struct spu_context *ctx); |
| 67 | void spu_release(struct spu_context *ctx); |
| 68 | void spu_acquire_runnable(struct spu_context *ctx); |
| 69 | void spu_acquire_saved(struct spu_context *ctx); |
| 70 | |
| 71 | #endif |