| .. | .. |
|---|
| 262 | 262 | |
|---|
| 263 | 263 | return res; |
|---|
| 264 | 264 | } |
|---|
| 265 | +EXPORT_SYMBOL_GPL(sip_smc_lastlog_request); |
|---|
| 265 | 266 | |
|---|
| 266 | 267 | int sip_smc_amp_config(u32 sub_func_id, u32 arg1, u32 arg2, u32 arg3) |
|---|
| 267 | 268 | { |
|---|
| .. | .. |
|---|
| 271 | 272 | 0, 0, 0, &res); |
|---|
| 272 | 273 | return res.a0; |
|---|
| 273 | 274 | } |
|---|
| 275 | +EXPORT_SYMBOL_GPL(sip_smc_amp_config); |
|---|
| 274 | 276 | |
|---|
| 275 | 277 | struct arm_smccc_res sip_smc_get_amp_info(u32 sub_func_id, u32 arg1) |
|---|
| 276 | 278 | { |
|---|
| .. | .. |
|---|
| 279 | 281 | arm_smccc_smc(RK_SIP_AMP_CFG, sub_func_id, arg1, 0, 0, 0, 0, 0, &res); |
|---|
| 280 | 282 | return res; |
|---|
| 281 | 283 | } |
|---|
| 284 | +EXPORT_SYMBOL_GPL(sip_smc_get_amp_info); |
|---|
| 282 | 285 | |
|---|
| 283 | | -EXPORT_SYMBOL_GPL(sip_smc_lastlog_request); |
|---|
| 286 | +void __iomem *sip_hdcp_request_share_memory(int id) |
|---|
| 287 | +{ |
|---|
| 288 | + static void __iomem *base; |
|---|
| 289 | + struct arm_smccc_res res; |
|---|
| 290 | + |
|---|
| 291 | + if (id < 0 || id >= MAX_DEVICE) { |
|---|
| 292 | + pr_err("%s: invalid device id\n", __func__); |
|---|
| 293 | + return NULL; |
|---|
| 294 | + } |
|---|
| 295 | + |
|---|
| 296 | + if (!base) { |
|---|
| 297 | + /* request page share memory */ |
|---|
| 298 | + res = sip_smc_request_share_mem(2, SHARE_PAGE_TYPE_HDCP); |
|---|
| 299 | + if (IS_SIP_ERROR(res.a0)) |
|---|
| 300 | + return NULL; |
|---|
| 301 | + base = (void __iomem *)res.a1; |
|---|
| 302 | + } |
|---|
| 303 | + |
|---|
| 304 | + return base + id * 1024; |
|---|
| 305 | +} |
|---|
| 306 | +EXPORT_SYMBOL_GPL(sip_hdcp_request_share_memory); |
|---|
| 307 | + |
|---|
| 308 | +struct arm_smccc_res sip_hdcp_config(u32 arg0, u32 arg1, u32 arg2) |
|---|
| 309 | +{ |
|---|
| 310 | + struct arm_smccc_res res; |
|---|
| 311 | + |
|---|
| 312 | + res = __invoke_sip_fn_smc(SIP_HDCP_CONFIG, arg0, arg1, arg2); |
|---|
| 313 | + return res; |
|---|
| 314 | +} |
|---|
| 315 | +EXPORT_SYMBOL_GPL(sip_hdcp_config); |
|---|
| 284 | 316 | |
|---|
| 285 | 317 | /************************** fiq debugger **************************************/ |
|---|
| 286 | 318 | /* |
|---|
| .. | .. |
|---|
| 300 | 332 | static int fiq_target_cpu; |
|---|
| 301 | 333 | static phys_addr_t ft_fiq_mem_phy; |
|---|
| 302 | 334 | static void __iomem *ft_fiq_mem_base; |
|---|
| 303 | | -static void (*sip_fiq_debugger_uart_irq_tf)(struct pt_regs *_pt_regs, |
|---|
| 304 | | - uint32_t cpu); |
|---|
| 335 | +static sip_fiq_debugger_uart_irq_tf_cb_t sip_fiq_debugger_uart_irq_tf; |
|---|
| 305 | 336 | static struct pt_regs fiq_pt_regs; |
|---|
| 306 | 337 | |
|---|
| 307 | 338 | int sip_fiq_debugger_is_enabled(void) |
|---|
| .. | .. |
|---|
| 388 | 419 | |
|---|
| 389 | 420 | static void sip_fiq_debugger_uart_irq_tf_cb(unsigned long sp_el1, |
|---|
| 390 | 421 | unsigned long offset, |
|---|
| 391 | | - uint32_t cpu) |
|---|
| 422 | + unsigned long cpu) |
|---|
| 392 | 423 | { |
|---|
| 393 | 424 | char *cpu_context; |
|---|
| 394 | 425 | |
|---|
| .. | .. |
|---|
| 403 | 434 | __invoke_sip_fn_smc(SIP_UARTDBG_FN, 0, 0, UARTDBG_CFG_OSHDL_TO_OS); |
|---|
| 404 | 435 | } |
|---|
| 405 | 436 | |
|---|
| 406 | | -int sip_fiq_debugger_uart_irq_tf_init(u32 irq_id, void *callback_fn) |
|---|
| 437 | +int sip_fiq_debugger_uart_irq_tf_init(u32 irq_id, sip_fiq_debugger_uart_irq_tf_cb_t callback_fn) |
|---|
| 407 | 438 | { |
|---|
| 408 | 439 | struct arm_smccc_res res; |
|---|
| 440 | + |
|---|
| 441 | + fiq_target_cpu = 0; |
|---|
| 409 | 442 | |
|---|
| 410 | 443 | /* init fiq debugger callback */ |
|---|
| 411 | 444 | sip_fiq_debugger_uart_irq_tf = callback_fn; |
|---|
| .. | .. |
|---|
| 438 | 471 | { |
|---|
| 439 | 472 | #ifdef MODULE |
|---|
| 440 | 473 | /* Empirically, local "cpu_logical_map()" for rockchip platforms */ |
|---|
| 441 | | - ulong mpidr = 0x00; |
|---|
| 474 | + ulong mpidr = read_cpuid_mpidr(); |
|---|
| 442 | 475 | |
|---|
| 443 | | - if (cpu < 4) |
|---|
| 444 | | - /* 0x00, 0x01, 0x02, 0x03 */ |
|---|
| 445 | | - mpidr = cpu; |
|---|
| 446 | | - else if (cpu < 8) |
|---|
| 447 | | - /* 0x100, 0x101, 0x102, 0x103 */ |
|---|
| 448 | | - mpidr = 0x100 | (cpu - 4); |
|---|
| 449 | | - else |
|---|
| 450 | | - pr_err("Unsupported map cpu: %d\n", cpu); |
|---|
| 476 | + if (mpidr & MPIDR_MT_BITMASK) { |
|---|
| 477 | + /* 0x100, 0x200, 0x300, 0x400 ... */ |
|---|
| 478 | + mpidr = (cpu & 0xff) << 8; |
|---|
| 479 | + } else { |
|---|
| 480 | + if (cpu < 4) |
|---|
| 481 | + /* 0x00, 0x01, 0x02, 0x03 */ |
|---|
| 482 | + mpidr = cpu; |
|---|
| 483 | + else if (cpu < 8) |
|---|
| 484 | + /* 0x100, 0x101, 0x102, 0x103 */ |
|---|
| 485 | + mpidr = 0x100 | (cpu - 4); |
|---|
| 486 | + else |
|---|
| 487 | + pr_err("Unsupported map cpu: %d\n", cpu); |
|---|
| 488 | + } |
|---|
| 451 | 489 | |
|---|
| 452 | 490 | return mpidr; |
|---|
| 453 | 491 | #else |
|---|
| 454 | 492 | return cpu_logical_map(cpu); |
|---|
| 455 | 493 | #endif |
|---|
| 456 | 494 | } |
|---|
| 495 | + |
|---|
| 496 | +ulong sip_cpu_logical_map_mpidr(u32 cpu) |
|---|
| 497 | +{ |
|---|
| 498 | + return cpu_logical_map_mpidr(cpu); |
|---|
| 499 | +} |
|---|
| 500 | +EXPORT_SYMBOL_GPL(sip_cpu_logical_map_mpidr); |
|---|
| 457 | 501 | |
|---|
| 458 | 502 | int sip_fiq_debugger_switch_cpu(u32 cpu) |
|---|
| 459 | 503 | { |
|---|
| .. | .. |
|---|
| 541 | 585 | } |
|---|
| 542 | 586 | EXPORT_SYMBOL_GPL(sip_fiq_debugger_enable_fiq); |
|---|
| 543 | 587 | |
|---|
| 588 | +int sip_fiq_control(u32 sub_func, u32 irq, unsigned long data) |
|---|
| 589 | +{ |
|---|
| 590 | + struct arm_smccc_res res; |
|---|
| 591 | + |
|---|
| 592 | + res = __invoke_sip_fn_smc(RK_SIP_FIQ_CTRL, |
|---|
| 593 | + sub_func, irq, data); |
|---|
| 594 | + return res.a0; |
|---|
| 595 | +} |
|---|
| 596 | +EXPORT_SYMBOL_GPL(sip_fiq_control); |
|---|
| 597 | + |
|---|
| 598 | +int sip_wdt_config(u32 sub_func, u32 arg1, u32 arg2, u32 arg3) |
|---|
| 599 | +{ |
|---|
| 600 | + struct arm_smccc_res res; |
|---|
| 601 | + |
|---|
| 602 | + arm_smccc_smc(SIP_WDT_CFG, sub_func, arg1, arg2, arg3, |
|---|
| 603 | + 0, 0, 0, &res); |
|---|
| 604 | + |
|---|
| 605 | + return res.a0; |
|---|
| 606 | +} |
|---|
| 607 | +EXPORT_SYMBOL_GPL(sip_wdt_config); |
|---|
| 608 | + |
|---|
| 609 | +int sip_hdmirx_config(u32 sub_func, u32 arg1, u32 arg2, u32 arg3) |
|---|
| 610 | +{ |
|---|
| 611 | + struct arm_smccc_res res; |
|---|
| 612 | + |
|---|
| 613 | + arm_smccc_smc(SIP_HDMIRX_CFG, sub_func, arg1, arg2, arg3, |
|---|
| 614 | + 0, 0, 0, &res); |
|---|
| 615 | + |
|---|
| 616 | + return res.a0; |
|---|
| 617 | +} |
|---|
| 618 | +EXPORT_SYMBOL_GPL(sip_hdmirx_config); |
|---|
| 619 | + |
|---|
| 620 | +int sip_hdcpkey_init(u32 hdcp_id) |
|---|
| 621 | +{ |
|---|
| 622 | + struct arm_smccc_res res; |
|---|
| 623 | + |
|---|
| 624 | + res = __invoke_sip_fn_smc(TRUSTED_OS_HDCPKEY_INIT, hdcp_id, 0, 0); |
|---|
| 625 | + |
|---|
| 626 | + return res.a0; |
|---|
| 627 | +} |
|---|
| 628 | +EXPORT_SYMBOL_GPL(sip_hdcpkey_init); |
|---|
| 629 | + |
|---|
| 544 | 630 | /******************************************************************************/ |
|---|
| 545 | 631 | #ifdef CONFIG_ARM |
|---|
| 546 | 632 | static __init int sip_firmware_init(void) |
|---|