Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * IMPORTANT: The following constants must match the ones used and defined in
0004  * external/qemu/include/hw/misc/goldfish_pipe.h
0005  */
0006 
0007 #ifndef GOLDFISH_PIPE_QEMU_H
0008 #define GOLDFISH_PIPE_QEMU_H
0009 
0010 /* List of bitflags returned in status of CMD_POLL command */
0011 enum PipePollFlags {
0012     PIPE_POLL_IN    = 1 << 0,
0013     PIPE_POLL_OUT   = 1 << 1,
0014     PIPE_POLL_HUP   = 1 << 2
0015 };
0016 
0017 /* Possible status values used to signal errors */
0018 enum PipeErrors {
0019     PIPE_ERROR_INVAL    = -1,
0020     PIPE_ERROR_AGAIN    = -2,
0021     PIPE_ERROR_NOMEM    = -3,
0022     PIPE_ERROR_IO       = -4
0023 };
0024 
0025 /* Bit-flags used to signal events from the emulator */
0026 enum PipeWakeFlags {
0027     /* emulator closed pipe */
0028     PIPE_WAKE_CLOSED        = 1 << 0,
0029 
0030     /* pipe can now be read from */
0031     PIPE_WAKE_READ          = 1 << 1,
0032 
0033     /* pipe can now be written to */
0034     PIPE_WAKE_WRITE         = 1 << 2,
0035 
0036     /* unlock this pipe's DMA buffer */
0037     PIPE_WAKE_UNLOCK_DMA        = 1 << 3,
0038 
0039     /* unlock DMA buffer of the pipe shared to this pipe */
0040     PIPE_WAKE_UNLOCK_DMA_SHARED = 1 << 4,
0041 };
0042 
0043 /* Possible pipe closing reasons */
0044 enum PipeCloseReason {
0045     /* guest sent a close command */
0046     PIPE_CLOSE_GRACEFUL     = 0,
0047 
0048     /* guest rebooted, we're closing the pipes */
0049     PIPE_CLOSE_REBOOT       = 1,
0050 
0051     /* close old pipes on snapshot load */
0052     PIPE_CLOSE_LOAD_SNAPSHOT    = 2,
0053 
0054     /* some unrecoverable error on the pipe */
0055     PIPE_CLOSE_ERROR        = 3,
0056 };
0057 
0058 /* Bit flags for the 'flags' field */
0059 enum PipeFlagsBits {
0060     BIT_CLOSED_ON_HOST = 0,  /* pipe closed by host */
0061     BIT_WAKE_ON_WRITE  = 1,  /* want to be woken on writes */
0062     BIT_WAKE_ON_READ   = 2,  /* want to be woken on reads */
0063 };
0064 
0065 enum PipeRegs {
0066     PIPE_REG_CMD = 0,
0067 
0068     PIPE_REG_SIGNAL_BUFFER_HIGH = 4,
0069     PIPE_REG_SIGNAL_BUFFER = 8,
0070     PIPE_REG_SIGNAL_BUFFER_COUNT = 12,
0071 
0072     PIPE_REG_OPEN_BUFFER_HIGH = 20,
0073     PIPE_REG_OPEN_BUFFER = 24,
0074 
0075     PIPE_REG_VERSION = 36,
0076 
0077     PIPE_REG_GET_SIGNALLED = 48,
0078 };
0079 
0080 enum PipeCmdCode {
0081     /* to be used by the pipe device itself */
0082     PIPE_CMD_OPEN       = 1,
0083 
0084     PIPE_CMD_CLOSE,
0085     PIPE_CMD_POLL,
0086     PIPE_CMD_WRITE,
0087     PIPE_CMD_WAKE_ON_WRITE,
0088     PIPE_CMD_READ,
0089     PIPE_CMD_WAKE_ON_READ,
0090 
0091     /*
0092      * TODO(zyy): implement a deferred read/write execution to allow
0093      * parallel processing of pipe operations on the host.
0094      */
0095     PIPE_CMD_WAKE_ON_DONE_IO,
0096 };
0097 
0098 #endif /* GOLDFISH_PIPE_QEMU_H */