4 #ifndef _MT_SECURE_API_H_
5 #define _MT_SECURE_API_H_
7 /* Use the arch_extension sec pseudo op before switching to secure world */
8 #if defined(__GNUC__) && \
9 defined(__GNUC_MINOR__) && \
10 defined(__GNUC_PATCHLEVEL__) && \
11 ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)) \
13 #define MC_ARCH_EXTENSION_SEC
18 * return code for fastcalls
20 #define MC_FC_RET_OK 0
21 #define MC_FC_RET_ERR_INVALID 1
27 * Command to inform SW that we will enter in Power Sleep (Dormant).
29 * - param0, the NW wakeup addr (phys).
30 * - param1, the cpuID who will sleep
33 * - Cannot fail, always MC_FC_RET_OK.
35 #define MC_FC_SLEEP -3
37 * Command to write NW reset addr for Slave cpus.
39 * - param0, the NW reset addr (phys).
40 * - param1, the cpuID.
43 * - Cannot fail, always MC_FC_RET_OK.
45 #define MC_FC_SET_RESET_VECTOR -301
47 * Command to switch off BootRom.
53 * - Cannot fail, always MC_FC_RET_OK.
55 #define MC_FC_TURN_OFF_BOOTROM -302
57 * Command to cancel a sleep command in case of Dormant abort.
63 * - Cannot fail, always MC_FC_RET_OK.
65 #define MC_FC_SLEEP_CANCELLED -302
72 * - cmd, the command we want to execute.
73 * - param0, param1, param2: the parameters used for this command.
75 * - Error code of the command (MC_FC_RET_OK in case of success).
77 static inline int mt_secure_call(uint32_t cmd
, uint32_t param0
, uint32_t param1
, uint32_t param2
)
79 /* SMC expect values in r0-r3 */
80 register u32 reg0
__asm__("r0") = cmd
;
81 register u32 reg1
__asm__("r1") = param0
;
82 register u32 reg2
__asm__("r2") = param1
;
83 register u32 reg3
__asm__("r3") = param2
;
87 #ifdef MC_ARCH_EXTENSION_SEC
88 /* This pseudo op is supported and required from
90 ".arch_extension sec\n"
93 : "+r"(reg0
), "+r"(reg1
), "+r"(reg2
), "+r"(reg3
)
102 #endif /* _MT_SECURE_API_H_ */