| .. | .. |
|---|
| 52 | 52 | #define SIP_SDEI_FIQ_DBG_SWITCH_CPU 0x82000020 |
|---|
| 53 | 53 | #define SIP_SDEI_FIQ_DBG_GET_EVENT_ID 0x82000021 |
|---|
| 54 | 54 | #define RK_SIP_AMP_CFG 0x82000022 |
|---|
| 55 | +#define RK_SIP_FIQ_CTRL 0x82000024 |
|---|
| 56 | +#define SIP_HDCP_CONFIG 0x82000025 |
|---|
| 57 | +#define SIP_WDT_CFG 0x82000026 |
|---|
| 58 | +#define SIP_HDMIRX_CFG 0x82000027 |
|---|
| 59 | + |
|---|
| 60 | +#define TRUSTED_OS_HDCPKEY_INIT 0xB7000003 |
|---|
| 55 | 61 | |
|---|
| 56 | 62 | /* Rockchip Sip version */ |
|---|
| 57 | 63 | #define SIP_IMPLEMENT_V1 (1) |
|---|
| .. | .. |
|---|
| 100 | 106 | #define VIRTUAL_POWEROFF 0x07 |
|---|
| 101 | 107 | #define SUSPEND_WFI_TIME_MS 0x08 |
|---|
| 102 | 108 | #define LINUX_PM_STATE 0x09 |
|---|
| 109 | +#define SUSPEND_IO_RET_CONFIG 0x0a |
|---|
| 110 | +#define SLEEP_PIN_CONFIG 0x0b |
|---|
| 103 | 111 | |
|---|
| 104 | 112 | /* SIP_REMOTECTL_CFG call types */ |
|---|
| 105 | 113 | #define REMOTECTL_SET_IRQ 0xf0 |
|---|
| .. | .. |
|---|
| 109 | 117 | #define REMOTECTL_ENABLE 0xf4 |
|---|
| 110 | 118 | /* wakeup state */ |
|---|
| 111 | 119 | #define REMOTECTL_PWRKEY_WAKEUP 0xdeadbeaf |
|---|
| 120 | + |
|---|
| 121 | +struct dram_addrmap_info { |
|---|
| 122 | + u64 ch_mask[2]; |
|---|
| 123 | + u64 bk_mask[4]; |
|---|
| 124 | + u64 bg_mask[2]; |
|---|
| 125 | + u64 cs_mask[2]; |
|---|
| 126 | + u32 reserved[20]; |
|---|
| 127 | + u32 bank_bit_first; |
|---|
| 128 | + u32 bank_bit_mask; |
|---|
| 129 | +}; |
|---|
| 112 | 130 | |
|---|
| 113 | 131 | /* AMP Ctrl */ |
|---|
| 114 | 132 | enum { |
|---|
| .. | .. |
|---|
| 120 | 138 | RK_AMP_SUB_FUNC_RSV, /* for RTOS */ |
|---|
| 121 | 139 | RK_AMP_SUB_FUNC_CPU_ON, |
|---|
| 122 | 140 | RK_AMP_SUB_FUNC_END, |
|---|
| 123 | | -}; |
|---|
| 124 | | - |
|---|
| 125 | | -struct dram_addrmap_info { |
|---|
| 126 | | - u64 ch_mask[2]; |
|---|
| 127 | | - u64 bk_mask[4]; |
|---|
| 128 | | - u64 bg_mask[2]; |
|---|
| 129 | | - u64 cs_mask[2]; |
|---|
| 130 | | - u32 reserved[20]; |
|---|
| 131 | | - u32 bank_bit_first; |
|---|
| 132 | | - u32 bank_bit_mask; |
|---|
| 133 | 141 | }; |
|---|
| 134 | 142 | |
|---|
| 135 | 143 | enum { |
|---|
| .. | .. |
|---|
| 150 | 158 | SHARE_PAGE_TYPE_DDRFSP, |
|---|
| 151 | 159 | SHARE_PAGE_TYPE_DDR_ADDRMAP, |
|---|
| 152 | 160 | SHARE_PAGE_TYPE_LAST_LOG, |
|---|
| 161 | + SHARE_PAGE_TYPE_HDCP, |
|---|
| 153 | 162 | SHARE_PAGE_TYPE_MAX, |
|---|
| 154 | 163 | } share_page_type_t; |
|---|
| 164 | + |
|---|
| 165 | +/* fiq control sub func */ |
|---|
| 166 | +enum { |
|---|
| 167 | + RK_SIP_FIQ_CTRL_FIQ_EN = 1, |
|---|
| 168 | + RK_SIP_FIQ_CTRL_FIQ_DIS, |
|---|
| 169 | + RK_SIP_FIQ_CTRL_SET_AFF |
|---|
| 170 | +}; |
|---|
| 171 | + |
|---|
| 172 | +/* hdcp function types */ |
|---|
| 173 | +enum { |
|---|
| 174 | + HDCP_FUNC_STORAGE_INCRYPT = 1, |
|---|
| 175 | + HDCP_FUNC_KEY_LOAD, |
|---|
| 176 | + HDCP_FUNC_ENCRYPT_MODE |
|---|
| 177 | +}; |
|---|
| 178 | + |
|---|
| 179 | +/* support hdcp device list */ |
|---|
| 180 | +enum { |
|---|
| 181 | + DP_TX0, |
|---|
| 182 | + DP_TX1, |
|---|
| 183 | + EDP_TX0, |
|---|
| 184 | + EDP_TX1, |
|---|
| 185 | + HDMI_TX0, |
|---|
| 186 | + HDMI_TX1, |
|---|
| 187 | + HDMI_RX, |
|---|
| 188 | + MAX_DEVICE, |
|---|
| 189 | +}; |
|---|
| 190 | + |
|---|
| 191 | +/* SIP_WDT_CONFIG call types */ |
|---|
| 192 | +enum { |
|---|
| 193 | + WDT_START = 0, |
|---|
| 194 | + WDT_STOP = 1, |
|---|
| 195 | + WDT_PING = 2, |
|---|
| 196 | +}; |
|---|
| 197 | + |
|---|
| 198 | +/* SIP_HDMIRX_CONFIG child configs */ |
|---|
| 199 | +enum { |
|---|
| 200 | + HDMIRX_AUTO_TOUCH_EN = 0, |
|---|
| 201 | + HDMIRX_REG_PRE_FETCH = 1, |
|---|
| 202 | + HDMIRX_INFO_NOTIFY = 2, |
|---|
| 203 | +}; |
|---|
| 204 | + |
|---|
| 205 | +struct pt_regs; |
|---|
| 206 | +typedef void (*sip_fiq_debugger_uart_irq_tf_cb_t)(struct pt_regs *_pt_regs, unsigned long cpu); |
|---|
| 155 | 207 | |
|---|
| 156 | 208 | /* |
|---|
| 157 | 209 | * Rules: struct arm_smccc_res contains result and data, details: |
|---|
| .. | .. |
|---|
| 159 | 211 | * a0: error code(0: success, !0: error); |
|---|
| 160 | 212 | * a1~a3: data |
|---|
| 161 | 213 | */ |
|---|
| 162 | | -#if IS_ENABLED(CONFIG_ROCKCHIP_SIP) |
|---|
| 214 | +#if IS_REACHABLE(CONFIG_ROCKCHIP_SIP) |
|---|
| 163 | 215 | struct arm_smccc_res sip_smc_get_atf_version(void); |
|---|
| 164 | 216 | struct arm_smccc_res sip_smc_get_sip_version(void); |
|---|
| 165 | 217 | struct arm_smccc_res sip_smc_dram(u32 arg0, u32 arg1, u32 arg2); |
|---|
| .. | .. |
|---|
| 177 | 229 | int sip_smc_secure_reg_write(u32 addr_phy, u32 val); |
|---|
| 178 | 230 | u32 sip_smc_secure_reg_read(u32 addr_phy); |
|---|
| 179 | 231 | struct arm_smccc_res sip_smc_bus_config(u32 arg0, u32 arg1, u32 arg2); |
|---|
| 232 | +struct dram_addrmap_info *sip_smc_get_dram_map(void); |
|---|
| 180 | 233 | int sip_smc_amp_config(u32 sub_func_id, u32 arg1, u32 arg2, u32 arg3); |
|---|
| 181 | 234 | struct arm_smccc_res sip_smc_get_amp_info(u32 sub_func_id, u32 arg1); |
|---|
| 182 | | -struct dram_addrmap_info *sip_smc_get_dram_map(void); |
|---|
| 183 | 235 | |
|---|
| 236 | +void __iomem *sip_hdcp_request_share_memory(int id); |
|---|
| 237 | +struct arm_smccc_res sip_hdcp_config(u32 arg0, u32 arg1, u32 arg2); |
|---|
| 238 | +ulong sip_cpu_logical_map_mpidr(u32 cpu); |
|---|
| 184 | 239 | /***************************fiq debugger **************************************/ |
|---|
| 185 | 240 | void sip_fiq_debugger_enable_fiq(bool enable, uint32_t tgt_cpu); |
|---|
| 186 | 241 | void sip_fiq_debugger_enable_debug(bool enable); |
|---|
| 187 | | -int sip_fiq_debugger_uart_irq_tf_init(u32 irq_id, void *callback_fn); |
|---|
| 242 | +int sip_fiq_debugger_uart_irq_tf_init(u32 irq_id, sip_fiq_debugger_uart_irq_tf_cb_t callback_fn); |
|---|
| 188 | 243 | int sip_fiq_debugger_set_print_port(u32 port_phyaddr, u32 baudrate); |
|---|
| 189 | 244 | int sip_fiq_debugger_request_share_memory(void); |
|---|
| 190 | 245 | int sip_fiq_debugger_get_target_cpu(void); |
|---|
| .. | .. |
|---|
| 192 | 247 | int sip_fiq_debugger_sdei_switch_cpu(u32 cur_cpu, u32 target_cpu, u32 flag); |
|---|
| 193 | 248 | int sip_fiq_debugger_is_enabled(void); |
|---|
| 194 | 249 | int sip_fiq_debugger_sdei_get_event_id(u32 *fiq, u32 *sw_cpu, u32 *flag); |
|---|
| 250 | +int sip_fiq_control(u32 sub_func, u32 irq, unsigned long data); |
|---|
| 251 | +int sip_wdt_config(u32 sub_func, u32 arg1, u32 arg2, u32 arg3); |
|---|
| 252 | +int sip_hdmirx_config(u32 sub_func, u32 arg1, u32 arg2, u32 arg3); |
|---|
| 253 | +int sip_hdcpkey_init(u32 hdcp_id); |
|---|
| 195 | 254 | #else |
|---|
| 196 | 255 | static inline struct arm_smccc_res sip_smc_get_atf_version(void) |
|---|
| 197 | 256 | { |
|---|
| 198 | | - struct arm_smccc_res tmp = {0}; |
|---|
| 257 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 199 | 258 | return tmp; |
|---|
| 200 | 259 | } |
|---|
| 201 | 260 | |
|---|
| 202 | 261 | static inline struct arm_smccc_res sip_smc_get_sip_version(void) |
|---|
| 203 | 262 | { |
|---|
| 204 | | - struct arm_smccc_res tmp = {0}; |
|---|
| 263 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 205 | 264 | return tmp; |
|---|
| 206 | 265 | } |
|---|
| 207 | 266 | |
|---|
| 208 | 267 | static inline struct arm_smccc_res sip_smc_dram(u32 arg0, u32 arg1, u32 arg2) |
|---|
| 209 | 268 | { |
|---|
| 210 | | - struct arm_smccc_res tmp = {0}; |
|---|
| 269 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 211 | 270 | return tmp; |
|---|
| 212 | 271 | } |
|---|
| 213 | 272 | |
|---|
| 214 | 273 | static inline struct arm_smccc_res sip_smc_request_share_mem |
|---|
| 215 | 274 | (u32 page_num, share_page_type_t page_type) |
|---|
| 216 | 275 | { |
|---|
| 217 | | - struct arm_smccc_res tmp = {0}; |
|---|
| 276 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 218 | 277 | return tmp; |
|---|
| 219 | 278 | } |
|---|
| 220 | 279 | |
|---|
| 221 | 280 | static inline struct arm_smccc_res sip_smc_mcu_el3fiq |
|---|
| 222 | 281 | (u32 arg0, u32 arg1, u32 arg2) |
|---|
| 223 | 282 | { |
|---|
| 224 | | - struct arm_smccc_res tmp = {0}; |
|---|
| 283 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 225 | 284 | return tmp; |
|---|
| 226 | 285 | } |
|---|
| 227 | 286 | |
|---|
| 228 | 287 | static inline struct arm_smccc_res |
|---|
| 229 | 288 | sip_smc_vpu_reset(u32 arg0, u32 arg1, u32 arg2) |
|---|
| 230 | 289 | { |
|---|
| 231 | | - struct arm_smccc_res tmp = {0}; |
|---|
| 290 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 291 | + return tmp; |
|---|
| 292 | +} |
|---|
| 293 | + |
|---|
| 294 | +static inline struct arm_smccc_res sip_smc_get_suspend_info(u32 info) |
|---|
| 295 | +{ |
|---|
| 296 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 232 | 297 | return tmp; |
|---|
| 233 | 298 | } |
|---|
| 234 | 299 | |
|---|
| 235 | 300 | static inline struct arm_smccc_res sip_smc_lastlog_request(void) |
|---|
| 236 | 301 | { |
|---|
| 237 | | - struct arm_smccc_res tmp = {0}; |
|---|
| 302 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 238 | 303 | return tmp; |
|---|
| 239 | 304 | } |
|---|
| 240 | 305 | |
|---|
| .. | .. |
|---|
| 243 | 308 | return 0; |
|---|
| 244 | 309 | } |
|---|
| 245 | 310 | |
|---|
| 246 | | -static inline int sip_smc_get_suspend_info(u32 info) |
|---|
| 247 | | -{ |
|---|
| 248 | | - return 0; |
|---|
| 249 | | -} |
|---|
| 250 | | - |
|---|
| 251 | 311 | static inline int sip_smc_virtual_poweroff(void) { return 0; } |
|---|
| 252 | 312 | static inline int sip_smc_remotectl_config(u32 func, u32 data) { return 0; } |
|---|
| 253 | | -static inline u32 sip_smc_secure_reg_read(u32 addr_phy) { return 0; } |
|---|
| 254 | 313 | static inline int sip_smc_secure_reg_write(u32 addr_phy, u32 val) { return 0; } |
|---|
| 255 | | -static inline int sip_smc_soc_bus_div(u32 arg0, u32 arg1, u32 arg2) |
|---|
| 314 | +static inline u32 sip_smc_secure_reg_read(u32 addr_phy) { return 0; } |
|---|
| 315 | + |
|---|
| 316 | +static inline struct arm_smccc_res sip_smc_bus_config(u32 arg0, u32 arg1, u32 arg2) |
|---|
| 256 | 317 | { |
|---|
| 257 | | - return 0; |
|---|
| 318 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 319 | + return tmp; |
|---|
| 258 | 320 | } |
|---|
| 321 | + |
|---|
| 259 | 322 | static inline struct dram_addrmap_info *sip_smc_get_dram_map(void) |
|---|
| 260 | 323 | { |
|---|
| 261 | 324 | return NULL; |
|---|
| .. | .. |
|---|
| 277 | 340 | return tmp; |
|---|
| 278 | 341 | } |
|---|
| 279 | 342 | |
|---|
| 343 | +static inline void __iomem *sip_hdcp_request_share_memory(int id) |
|---|
| 344 | +{ |
|---|
| 345 | + return NULL; |
|---|
| 346 | +} |
|---|
| 347 | + |
|---|
| 348 | +static inline struct arm_smccc_res sip_hdcp_config(u32 arg0, u32 arg1, u32 arg2) |
|---|
| 349 | +{ |
|---|
| 350 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 351 | + |
|---|
| 352 | + return tmp; |
|---|
| 353 | +} |
|---|
| 354 | + |
|---|
| 355 | +static inline ulong sip_cpu_logical_map_mpidr(u32 cpu) { return 0; } |
|---|
| 356 | + |
|---|
| 280 | 357 | /***************************fiq debugger **************************************/ |
|---|
| 281 | 358 | static inline void sip_fiq_debugger_enable_fiq |
|---|
| 282 | 359 | (bool enable, uint32_t tgt_cpu) { return; } |
|---|
| 283 | 360 | |
|---|
| 284 | 361 | static inline void sip_fiq_debugger_enable_debug(bool enable) { return; } |
|---|
| 285 | 362 | static inline int sip_fiq_debugger_uart_irq_tf_init(u32 irq_id, |
|---|
| 286 | | - void *callback_fn) |
|---|
| 363 | + sip_fiq_debugger_uart_irq_tf_cb_t callback_fn) |
|---|
| 287 | 364 | { |
|---|
| 288 | 365 | return 0; |
|---|
| 289 | 366 | } |
|---|
| .. | .. |
|---|
| 300 | 377 | static inline int sip_fiq_debugger_sdei_switch_cpu(u32 cur_cpu, u32 target_cpu, |
|---|
| 301 | 378 | u32 flag) { return 0; } |
|---|
| 302 | 379 | static inline int sip_fiq_debugger_is_enabled(void) { return 0; } |
|---|
| 380 | +static inline int sip_fiq_debugger_sdei_get_event_id(u32 *fiq, u32 *sw_cpu, u32 *flag) |
|---|
| 381 | +{ |
|---|
| 382 | + return SIP_RET_NOT_SUPPORTED; |
|---|
| 383 | +} |
|---|
| 384 | + |
|---|
| 385 | +static inline int sip_fiq_control(u32 sub_func, u32 irq, unsigned long data) |
|---|
| 386 | +{ |
|---|
| 387 | + return 0; |
|---|
| 388 | +} |
|---|
| 389 | + |
|---|
| 390 | +static inline int sip_wdt_config(u32 sub_func, |
|---|
| 391 | + u32 arg1, |
|---|
| 392 | + u32 arg2, |
|---|
| 393 | + u32 arg3) |
|---|
| 394 | +{ |
|---|
| 395 | + return 0; |
|---|
| 396 | +} |
|---|
| 397 | + |
|---|
| 398 | +static inline int sip_hdmirx_config(u32 sub_func, |
|---|
| 399 | + u32 arg1, |
|---|
| 400 | + u32 arg2, |
|---|
| 401 | + u32 arg3) |
|---|
| 402 | +{ |
|---|
| 403 | + return SIP_RET_NOT_SUPPORTED; |
|---|
| 404 | +} |
|---|
| 405 | + |
|---|
| 406 | +static inline int sip_hdcpkey_init(u32 hdcp_id) |
|---|
| 407 | +{ |
|---|
| 408 | + return 0; |
|---|
| 409 | +} |
|---|
| 303 | 410 | #endif |
|---|
| 304 | 411 | |
|---|
| 305 | 412 | /* 32-bit OP-TEE context, never change order of members! */ |
|---|