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 /* TRP SMC result registers X0-X7 */ 27 #define TRP_SMC_RESULT_REGS 8 28 /* Size of the TRP SMC result structure in bytes */ 29 #define TRP_RESULT_SIZE (TRP_SMC_RESULT_REGS * 8) 30 31 #ifndef __ASSEMBLER__ 32 33 #include <platform_def.h> 34 35 /* Data structure to hold SMC arguments */ 36 typedef struct trp_args { 37 uint64_t regs[TRP_ARGS_END >> 3]; 38 } __aligned(CACHE_WRITEBACK_GRANULE) trp_args_t; 39 40 trp_args_t *set_smc_args(uint64_t arg0, 41 uint64_t arg1, 42 uint64_t arg2, 43 uint64_t arg3, 44 uint64_t arg4, 45 uint64_t arg5, 46 uint64_t arg6, 47 uint64_t arg7, 48 uint64_t arg8, 49 uint64_t arg9, 50 uint64_t arg10, 51 uint64_t arg11); 52 53 __dead2 void trp_boot_abort(uint64_t err); 54 55 struct trp_smc_result { 56 unsigned long long x[TRP_SMC_RESULT_REGS]; 57 }; 58 59 #endif /* __ASSEMBLER __ */ 60 #endif /* TRP_HELPERS_H */ 61