1 /*
2  * Copyright (c) 2022, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef __BACKEND_IPC_H__
9 #define __BACKEND_IPC_H__
10 
11 #include <stdint.h>
12 #include "svc_num.h"
13 
14 /* Calculate the service setting. In IPC it is the signal set. */
15 #define BACKEND_SERVICE_SET(set, p_service) ((set) |= (p_service)->signal)
16 
17 /* Trigger SVC handler to run SPM initialization */
18 #define BACKEND_SPM_INIT()  __ASM volatile("SVC %0           \n"         \
19                                            "BX LR            \n"         \
20                                            : : "I" (TFM_SVC_SPM_INIT))
21 
22 /*
23  * Actions done before entering SPM.
24  *
25  * Executes with interrupt unmasked. Check the necessity of switching to SPM
26  * stack and lock scheduler. Return value is the pair of SPM SP and PSPLIM if
27  * necessary. Otherwise, zeros.
28  */
29 uint64_t backend_abi_entering_spm(void);
30 
31 /*
32  * Actions done after leaving SPM and before entering other components.
33  *
34  * Executes with interrupt masked.
35  * Check return value from backend and trigger scheduler in PendSV if necessary.
36  */
37 uint32_t backend_abi_leaving_spm(uint32_t result);
38 
39 #endif /* __BACKEND_IPC_H__ */
40