1 /* SPDX-License-Identifier: GPL-2.0 */
3 * IMPORTANT: The following constants must match the ones used and defined in
4 * external/qemu/include/hw/misc/goldfish_pipe.h
7 #ifndef GOLDFISH_PIPE_QEMU_H
8 #define GOLDFISH_PIPE_QEMU_H
10 /* List of bitflags returned in status of CMD_POLL command */
12 PIPE_POLL_IN
= 1 << 0,
13 PIPE_POLL_OUT
= 1 << 1,
14 PIPE_POLL_HUP
= 1 << 2
17 /* Possible status values used to signal errors */
19 PIPE_ERROR_INVAL
= -1,
20 PIPE_ERROR_AGAIN
= -2,
21 PIPE_ERROR_NOMEM
= -3,
25 /* Bit-flags used to signal events from the emulator */
27 /* emulator closed pipe */
28 PIPE_WAKE_CLOSED
= 1 << 0,
30 /* pipe can now be read from */
31 PIPE_WAKE_READ
= 1 << 1,
33 /* pipe can now be written to */
34 PIPE_WAKE_WRITE
= 1 << 2,
36 /* unlock this pipe's DMA buffer */
37 PIPE_WAKE_UNLOCK_DMA
= 1 << 3,
39 /* unlock DMA buffer of the pipe shared to this pipe */
40 PIPE_WAKE_UNLOCK_DMA_SHARED
= 1 << 4,
43 /* Possible pipe closing reasons */
44 enum PipeCloseReason
{
45 /* guest sent a close command */
46 PIPE_CLOSE_GRACEFUL
= 0,
48 /* guest rebooted, we're closing the pipes */
49 PIPE_CLOSE_REBOOT
= 1,
51 /* close old pipes on snapshot load */
52 PIPE_CLOSE_LOAD_SNAPSHOT
= 2,
54 /* some unrecoverable error on the pipe */
58 /* Bit flags for the 'flags' field */
60 BIT_CLOSED_ON_HOST
= 0, /* pipe closed by host */
61 BIT_WAKE_ON_WRITE
= 1, /* want to be woken on writes */
62 BIT_WAKE_ON_READ
= 2, /* want to be woken on reads */
68 PIPE_REG_SIGNAL_BUFFER_HIGH
= 4,
69 PIPE_REG_SIGNAL_BUFFER
= 8,
70 PIPE_REG_SIGNAL_BUFFER_COUNT
= 12,
72 PIPE_REG_OPEN_BUFFER_HIGH
= 20,
73 PIPE_REG_OPEN_BUFFER
= 24,
75 PIPE_REG_VERSION
= 36,
77 PIPE_REG_GET_SIGNALLED
= 48,
81 /* to be used by the pipe device itself */
87 PIPE_CMD_WAKE_ON_WRITE
,
89 PIPE_CMD_WAKE_ON_READ
,
92 * TODO(zyy): implement a deferred read/write execution to allow
93 * parallel processing of pipe operations on the host.
95 PIPE_CMD_WAKE_ON_DONE_IO
,
98 #endif /* GOLDFISH_PIPE_QEMU_H */