• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _SPCOM_H_
20 #define _SPCOM_H_
21 #include <linux/types.h>
22 #ifndef BIT
23 #define BIT(x) (1 << x)
24 #endif
25 #ifndef PAGE_SIZE
26 #define PAGE_SIZE 4096
27 #endif
28 #define SPCOM_MAX_CHANNELS 0x20
29 #define SPCOM_CHANNEL_NAME_SIZE 32
30 #define SPCOM_GET_NEXT_REQUEST_SIZE (PAGE_SIZE - 1)
31 enum spcom_cmd_id {
32   SPCOM_CMD_LOAD_APP = 0x4C4F4144,
33   SPCOM_CMD_RESET_SP = 0x52455354,
34   SPCOM_CMD_SEND = 0x53454E44,
35   SPCOM_CMD_SEND_MODIFIED = 0x534E444D,
36   SPCOM_CMD_LOCK_ION_BUF = 0x4C4F434B,
37   SPCOM_CMD_UNLOCK_ION_BUF = 0x554C434B,
38   SPCOM_CMD_FSSR = 0x46535352,
39   SPCOM_CMD_CREATE_CHANNEL = 0x43524554,
40 #define SPCOM_CMD_ENABLE_SSR SPCOM_CMD_ENABLE_SSR
41   SPCOM_CMD_ENABLE_SSR = 0x45535352,
42 #define SPCOM_CMD_RESTART_SP SPCOM_CMD_RESTART_SP
43   SPCOM_CMD_RESTART_SP = 0x52535452,
44 };
45 enum spcom_poll_events {
46   SPCOM_POLL_LINK_STATE = BIT(1),
47   SPCOM_POLL_CH_CONNECT = BIT(2),
48   SPCOM_POLL_READY_FLAG = BIT(14),
49   SPCOM_POLL_WAIT_FLAG = BIT(15),
50 };
51 struct spcom_user_command {
52   enum spcom_cmd_id cmd_id;
53   uint32_t arg;
54 } __attribute__((packed));
55 struct spcom_send_command {
56   enum spcom_cmd_id cmd_id;
57   uint32_t timeout_msec;
58   uint32_t buf_size;
59   char buf[0];
60 } __attribute__((packed));
61 struct spcom_user_create_channel_command {
62   enum spcom_cmd_id cmd_id;
63   char ch_name[SPCOM_CHANNEL_NAME_SIZE];
64 #define SPCOM_IS_SHARABLE_SUPPORTED
65   bool is_sharable;
66 } __attribute__((packed));
67 #define SPCOM_USER_RESTART_SP_CMD
68 struct spcom_user_restart_sp_command {
69   enum spcom_cmd_id cmd_id;
70   uint32_t arg;
71 #define SPCOM_IS_UPDATED_SUPPORETED
72   uint32_t is_updated;
73 } __attribute__((packed));
74 #define SPCOM_MAX_ION_BUF 4
75 struct spcom_ion_info {
76   int32_t fd;
77   uint32_t buf_offset;
78 };
79 #define SPCOM_ION_FD_UNLOCK_ALL 0xFFFF
80 struct spcom_ion_handle {
81   int32_t fd;
82 };
83 struct spcom_user_send_modified_command {
84   enum spcom_cmd_id cmd_id;
85   struct spcom_ion_info ion_info[SPCOM_MAX_ION_BUF];
86   uint32_t timeout_msec;
87   uint32_t buf_size;
88   char buf[0];
89 } __attribute__((packed));
90 enum {
91   SPCOM_IONFD_CMD,
92   SPCOM_POLL_CMD,
93 };
94 enum spcom_poll_cmd_id {
95   SPCOM_LINK_STATE_REQ,
96   SPCOM_CH_CONN_STATE_REQ,
97 };
98 struct spcom_poll_param {
99   bool wait;
100   enum spcom_poll_cmd_id cmd_id;
101   int retval;
102 } __attribute__((packed));
103 #define SPCOM_IOCTL_MAGIC 'S'
104 #define SPCOM_GET_IONFD _IOR(SPCOM_IOCTL_MAGIC, SPCOM_IONFD_CMD, struct spcom_ion_handle)
105 #define SPCOM_SET_IONFD _IOW(SPCOM_IOCTL_MAGIC, SPCOM_IONFD_CMD, struct spcom_ion_handle)
106 #define SPCOM_POLL_STATE _IOWR(SPCOM_IOCTL_MAGIC, SPCOM_POLL_CMD, struct spcom_poll_param)
107 #endif
108