1/* 2 * Copyright (c) 2021, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7#include <asm_macros.S> 8#include <services/gtsi_svc.h> 9#include <services/rmi_svc.h> 10#include "trp_private.h" 11 12.global trp_head 13.global trp_smc 14 15.section ".head.text", "ax" 16 17 /* --------------------------------------------- 18 * Populate the params in x0-x7 from the pointer 19 * to the smc args structure in x0. 20 * --------------------------------------------- 21 */ 22 .macro restore_args_call_smc 23 ldp x6, x7, [x0, #TRP_ARG6] 24 ldp x4, x5, [x0, #TRP_ARG4] 25 ldp x2, x3, [x0, #TRP_ARG2] 26 ldp x0, x1, [x0, #TRP_ARG0] 27 smc #0 28 .endm 29 30 /* --------------------------------------------- 31 * Entry point for TRP 32 * --------------------------------------------- 33 */ 34trp_head: 35 bl plat_set_my_stack 36 bl plat_is_my_cpu_primary 37 cbz x0, trp_secondary_cpu_entry 38 39 /* --------------------------------------------- 40 * Zero out BSS section 41 * --------------------------------------------- 42 */ 43 ldr x0, =__BSS_START__ 44 ldr x1, =__BSS_SIZE__ 45 bl zeromem 46 47 bl trp_setup 48 49 bl trp_main 50trp_secondary_cpu_entry: 51 mov_imm x0, RMI_RMM_REQ_COMPLETE 52 mov x1, xzr 53 smc #0 54 b trp_handler 55 56 /* --------------------------------------------- 57 * Direct SMC call to BL31 service provided by 58 * RMM Dispatcher 59 * --------------------------------------------- 60 */ 61func trp_smc 62 restore_args_call_smc 63 ret 64endfunc trp_smc 65 66 /* --------------------------------------------- 67 * RMI call handler 68 * --------------------------------------------- 69 */ 70func trp_handler 71 bl trp_rmi_handler 72 restore_args_call_smc 73 b trp_handler 74endfunc trp_handler 75