Lines Matching refs:pipe

24  *    .... write() or read() through the pipe.
66 /* pipe device registers */
110 #define PIPE_WAKE_CLOSED (1 << 0) /* emulator closed pipe */
111 #define PIPE_WAKE_READ (1 << 1) /* pipe can now be read from */
112 #define PIPE_WAKE_WRITE (1 << 2) /* pipe can now be written to */
137 /* This data type models a given pipe instance */
148 BIT_CLOSED_ON_HOST = 0, /* pipe closed by host */
154 static u32 goldfish_cmd_status(struct goldfish_pipe *pipe, u32 cmd)
158 struct goldfish_pipe_dev *dev = pipe->dev;
161 gf_write64((u64)(unsigned long)pipe, dev->base + PIPE_REG_CHANNEL,
169 static void goldfish_cmd(struct goldfish_pipe *pipe, u32 cmd)
172 struct goldfish_pipe_dev *dev = pipe->dev;
175 gf_write64((u64)(unsigned long)pipe, dev->base + PIPE_REG_CHANNEL,
243 struct goldfish_pipe *pipe, int *status)
251 aps->channel = (unsigned long)pipe;
267 * pipe.
273 struct goldfish_pipe *pipe = filp->private_data;
274 struct goldfish_pipe_dev *dev = pipe->dev;
280 /* If the emulator already closed the pipe, no need to go further */
281 if (test_bit(BIT_CLOSED_ON_HOST, &pipe->flags))
293 /* Serialize access to the pipe */
294 if (mutex_lock_interruptible(&pipe->lock))
329 address, avail, pipe, &status)) {
330 gf_write64((u64)(unsigned long)pipe,
367 * First, mark the pipe as waiting for a specific wake signal.
370 set_bit(wakeBit, &pipe->flags);
373 goldfish_cmd(pipe, CMD_WAKE_ON_WRITE + cmd_offset);
375 /* Unlock the pipe, then wait for the wake signal */
376 mutex_unlock(&pipe->lock);
378 while (test_bit(wakeBit, &pipe->flags)) {
380 pipe->wake_queue,
381 !test_bit(wakeBit, &pipe->flags)))
384 if (test_bit(BIT_CLOSED_ON_HOST, &pipe->flags))
389 if (mutex_lock_interruptible(&pipe->lock))
395 mutex_unlock(&pipe->lock);
416 struct goldfish_pipe *pipe = filp->private_data;
420 mutex_lock(&pipe->lock);
422 poll_wait(filp, &pipe->wake_queue, wait);
424 status = goldfish_cmd_status(pipe, CMD_POLL);
426 mutex_unlock(&pipe->lock);
437 if (test_bit(BIT_CLOSED_ON_HOST, &pipe->flags))
451 * blocked pipe (i.e. channel).
456 struct goldfish_pipe *pipe;
471 /* Convert channel to struct pipe pointer + read wake flags */
473 pipe = (struct goldfish_pipe *)(ptrdiff_t)channel;
475 /* Did the emulator just closed a pipe? */
477 set_bit(BIT_CLOSED_ON_HOST, &pipe->flags);
481 clear_bit(BIT_WAKE_ON_READ, &pipe->flags);
483 clear_bit(BIT_WAKE_ON_WRITE, &pipe->flags);
485 wake_up_interruptible(&pipe->wake_queue);
498 * Create a new pipe link between the emulator and the use application.
499 * Each new request produces a new pipe.
501 * Note: we use the pipe ID as a mux. All goldfish emulations are 32bit
506 struct goldfish_pipe *pipe;
510 /* Allocate new pipe kernel object */
511 pipe = kzalloc(sizeof(*pipe), GFP_KERNEL);
512 if (pipe == NULL)
515 pipe->dev = dev;
516 mutex_init(&pipe->lock);
517 init_waitqueue_head(&pipe->wake_queue);
520 * Now, tell the emulator we're opening a new pipe. We use the
521 * pipe object's address as the channel identifier for simplicity.
524 status = goldfish_cmd_status(pipe, CMD_OPEN);
526 kfree(pipe);
530 /* All is done, save the pipe into the file's private data field */
531 file->private_data = pipe;
537 struct goldfish_pipe *pipe = filp->private_data;
540 goldfish_cmd(pipe, CMD_CLOSE);
541 kfree(pipe);