1 /* 2 * Copyright (c) 2022-2025, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef TRP_HELPERS_H 8 #define TRP_HELPERS_H 9 10 /* Definitions to help the assembler access the SMC/ERET args structure */ 11 #define TRP_ARGS_SIZE TRP_ARGS_END 12 #define TRP_ARG0 0x0 13 #define TRP_ARG1 0x8 14 #define TRP_ARG2 0x10 15 #define TRP_ARG3 0x18 16 #define TRP_ARG4 0x20 17 #define TRP_ARG5 0x28 18 #define TRP_ARG6 0x30 19 #define TRP_ARG7 0x38 20 #define TRP_ARG8 0x40 21 #define TRP_ARG9 0x48 22 #define TRP_ARG10 0x50 23 #define TRP_ARG11 0x58 24 #define TRP_ARGS_END 0x60 25 26 #ifndef __ASSEMBLER__ 27 28 #include <platform_def.h> 29 30 /* Data structure to hold SMC arguments */ 31 typedef struct trp_args { 32 uint64_t regs[TRP_ARGS_END >> 3]; 33 } __aligned(CACHE_WRITEBACK_GRANULE) trp_args_t; 34 35 trp_args_t *set_smc_args(uint64_t arg0, 36 uint64_t arg1, 37 uint64_t arg2, 38 uint64_t arg3, 39 uint64_t arg4, 40 uint64_t arg5, 41 uint64_t arg6, 42 uint64_t arg7, 43 uint64_t arg8, 44 uint64_t arg9, 45 uint64_t arg10, 46 uint64_t arg11); 47 48 __dead2 void trp_boot_abort(uint64_t err); 49 50 /* TRP SMC result registers X0-X4 */ 51 #define TRP_SMC_RESULT_REGS 5 52 53 struct trp_smc_result { 54 unsigned long long x[TRP_SMC_RESULT_REGS]; 55 }; 56 57 #endif /* __ASSEMBLER __ */ 58 #endif /* TRP_HELPERS_H */ 59