diff options
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/spufs.h')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/spufs.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h index 48961ac584a1..c715ed0c4014 100644 --- a/arch/powerpc/platforms/cell/spufs/spufs.h +++ b/arch/powerpc/platforms/cell/spufs/spufs.h | |||
@@ -124,6 +124,34 @@ void spu_yield(struct spu_context *ctx); | |||
124 | int __init spu_sched_init(void); | 124 | int __init spu_sched_init(void); |
125 | void __exit spu_sched_exit(void); | 125 | void __exit spu_sched_exit(void); |
126 | 126 | ||
127 | /* | ||
128 | * spufs_wait | ||
129 | * Same as wait_event_interruptible(), except that here | ||
130 | * we need to call spu_release(ctx) before sleeping, and | ||
131 | * then spu_acquire(ctx) when awoken. | ||
132 | */ | ||
133 | |||
134 | #define spufs_wait(wq, condition) \ | ||
135 | ({ \ | ||
136 | int __ret = 0; \ | ||
137 | DEFINE_WAIT(__wait); \ | ||
138 | for (;;) { \ | ||
139 | prepare_to_wait(&(wq), &__wait, TASK_INTERRUPTIBLE); \ | ||
140 | if (condition) \ | ||
141 | break; \ | ||
142 | if (!signal_pending(current)) { \ | ||
143 | spu_release(ctx); \ | ||
144 | schedule(); \ | ||
145 | spu_acquire(ctx); \ | ||
146 | continue; \ | ||
147 | } \ | ||
148 | __ret = -ERESTARTSYS; \ | ||
149 | break; \ | ||
150 | } \ | ||
151 | finish_wait(&(wq), &__wait); \ | ||
152 | __ret; \ | ||
153 | }) | ||
154 | |||
127 | size_t spu_wbox_write(struct spu_context *ctx, u32 data); | 155 | size_t spu_wbox_write(struct spu_context *ctx, u32 data); |
128 | size_t spu_ibox_read(struct spu_context *ctx, u32 *data); | 156 | size_t spu_ibox_read(struct spu_context *ctx, u32 *data); |
129 | 157 | ||