1 /*
2  * Copyright (c) 2021-2023, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef __BACKEND_H__
9 #define __BACKEND_H__
10 
11 #include <stdint.h>
12 #include "spm.h"
13 #include "tfm_arch.h"
14 #include "load/spm_load_api.h"
15 #include "psa/error.h"
16 
17 #if CONFIG_TFM_SPM_BACKEND_IPC == 1
18 #include "backend_ipc.h"
19 #elif CONFIG_TFM_SPM_BACKEND_SFN == 1
20 #include "backend_sfn.h"
21 #else
22 #error "No backend selected, check configurations."
23 #endif
24 
25 /*
26  * Runtime model-specific component initialization routine. This
27  * is an `assuredly` function, would panic if any error occurred.
28  */
29 void backend_init_comp_assuredly(struct partition_t *p_pt,
30                                  uint32_t service_setting);
31 
32 /*
33  * Runtime model-specific kick-off method for the whole system.
34  * Returns a hardware-specific control value, which is transparent
35  * to SPM common logic.
36  */
37 uint32_t backend_system_run(void);
38 
39 /* Runtime model-specific message handling mechanism. */
40 psa_status_t backend_messaging(struct connection_t *p_connection);
41 
42 /*
43  * Runtime model-specific message replying.
44  * Return the connection handle or the acked status code.
45  */
46 psa_status_t backend_replying(struct connection_t *handle, int32_t status);
47 
48 /**
49  * \brief Set the wait signal pattern in current partition.
50  */
51 psa_signal_t backend_wait_signals(struct partition_t *p_pt, psa_signal_t signals);
52 
53 /**
54  * \brief Set the asserted signal pattern in current partition.
55  */
56 psa_status_t backend_assert_signal(struct partition_t *p_pt, psa_signal_t signal);
57 
58 /* The component list, and a MACRO indicate this is not a common global. */
59 extern struct partition_head_t partition_listhead;
60 #define PARTITION_LIST_ADDR (&partition_listhead)
61 
62 /* TODO: Put this into NS Agent related service when available. */
63 extern struct context_ctrl_t *p_spm_thread_context;
64 #define SPM_THREAD_CONTEXT p_spm_thread_context
65 
66 #endif /* __BACKEND_H__ */
67