1 /* 2 * This file is auto-generated. Modifications will be lost. 3 * 4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ 5 * for more information. 6 */ 7 #ifndef _SPCOM_H_ 8 #define _SPCOM_H_ 9 #include <linux/types.h> 10 #ifndef BIT 11 #define BIT(x) (1 << x) 12 #endif 13 #ifndef PAGE_SIZE 14 #define PAGE_SIZE 4096 15 #endif 16 #define SPCOM_MAX_CHANNELS 0x20 17 #define SPCOM_CHANNEL_NAME_SIZE 32 18 #define SPCOM_GET_NEXT_REQUEST_SIZE (PAGE_SIZE - 1) 19 enum spcom_cmd_id { 20 SPCOM_CMD_LOAD_APP = 0x4C4F4144, 21 SPCOM_CMD_RESET_SP = 0x52455354, 22 SPCOM_CMD_SEND = 0x53454E44, 23 SPCOM_CMD_SEND_MODIFIED = 0x534E444D, 24 SPCOM_CMD_LOCK_ION_BUF = 0x4C4F434B, 25 SPCOM_CMD_UNLOCK_ION_BUF = 0x554C434B, 26 SPCOM_CMD_FSSR = 0x46535352, 27 SPCOM_CMD_CREATE_CHANNEL = 0x43524554, 28 #define SPCOM_CMD_ENABLE_SSR SPCOM_CMD_ENABLE_SSR 29 SPCOM_CMD_ENABLE_SSR = 0x45535352, 30 #define SPCOM_CMD_RESTART_SP SPCOM_CMD_RESTART_SP 31 SPCOM_CMD_RESTART_SP = 0x52535452, 32 }; 33 enum spcom_poll_events { 34 SPCOM_POLL_LINK_STATE = BIT(1), 35 SPCOM_POLL_CH_CONNECT = BIT(2), 36 SPCOM_POLL_READY_FLAG = BIT(14), 37 SPCOM_POLL_WAIT_FLAG = BIT(15), 38 }; 39 struct spcom_user_command { 40 enum spcom_cmd_id cmd_id; 41 uint32_t arg; 42 } __attribute__((packed)); 43 struct spcom_send_command { 44 enum spcom_cmd_id cmd_id; 45 uint32_t timeout_msec; 46 uint32_t buf_size; 47 char buf[0]; 48 } __attribute__((packed)); 49 struct spcom_user_create_channel_command { 50 enum spcom_cmd_id cmd_id; 51 char ch_name[SPCOM_CHANNEL_NAME_SIZE]; 52 #define SPCOM_IS_SHARABLE_SUPPORTED 53 bool is_sharable; 54 } __attribute__((packed)); 55 #define SPCOM_USER_RESTART_SP_CMD 56 struct spcom_user_restart_sp_command { 57 enum spcom_cmd_id cmd_id; 58 uint32_t arg; 59 #define SPCOM_IS_UPDATED_SUPPORETED 60 uint32_t is_updated; 61 } __attribute__((packed)); 62 #define SPCOM_MAX_ION_BUF 4 63 struct spcom_ion_info { 64 int32_t fd; 65 uint32_t buf_offset; 66 }; 67 #define SPCOM_ION_FD_UNLOCK_ALL 0xFFFF 68 struct spcom_ion_handle { 69 int32_t fd; 70 }; 71 struct spcom_user_send_modified_command { 72 enum spcom_cmd_id cmd_id; 73 struct spcom_ion_info ion_info[SPCOM_MAX_ION_BUF]; 74 uint32_t timeout_msec; 75 uint32_t buf_size; 76 char buf[0]; 77 } __attribute__((packed)); 78 enum { 79 SPCOM_IONFD_CMD, 80 SPCOM_POLL_CMD, 81 }; 82 enum spcom_poll_cmd_id { 83 SPCOM_LINK_STATE_REQ, 84 SPCOM_CH_CONN_STATE_REQ, 85 }; 86 struct spcom_poll_param { 87 bool wait; 88 enum spcom_poll_cmd_id cmd_id; 89 int retval; 90 } __attribute__((packed)); 91 #define SPCOM_IOCTL_MAGIC 'S' 92 #define SPCOM_GET_IONFD _IOR(SPCOM_IOCTL_MAGIC, SPCOM_IONFD_CMD, struct spcom_ion_handle) 93 #define SPCOM_SET_IONFD _IOW(SPCOM_IOCTL_MAGIC, SPCOM_IONFD_CMD, struct spcom_ion_handle) 94 #define SPCOM_POLL_STATE _IOWR(SPCOM_IOCTL_MAGIC, SPCOM_POLL_CMD, struct spcom_poll_param) 95 #endif 96