blob: 0132e868279c0b4ae2492e7091477334cc509fad [file] [log] [blame]
Mingyang Sundeae45d2021-09-06 15:31:07 +08001/*
Mingyang Suna09adda2022-02-16 18:11:33 +08002 * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
Mingyang Sundeae45d2021-09-06 15:31:07 +08003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef __BACKEND_H__
9#define __BACKEND_H__
10
11#include <stdint.h>
Mingyang Sundeae45d2021-09-06 15:31:07 +080012#include "spm_ipc.h"
Ken Liue07c3b72021-10-14 16:19:13 +080013#include "tfm_arch.h"
Mingyang Sundeae45d2021-09-06 15:31:07 +080014#include "load/spm_load_api.h"
Ken Liue07c3b72021-10-14 16:19:13 +080015#include "psa/error.h"
Mingyang Sundeae45d2021-09-06 15:31:07 +080016
Ken Liu995a9742022-05-18 19:28:30 +080017/*
18 * Runtime model-specific component initialization routine. This
19 * is an `assuredly` function, would panic if any error occurred.
20 */
21void backend_init_comp_assuredly(struct partition_t *p_pt,
22 uint32_t service_setting);
Mingyang Sundeae45d2021-09-06 15:31:07 +080023
Ken Liu995a9742022-05-18 19:28:30 +080024/*
25 * Runtime model-specific kick-off method for the whole system.
26 * Returns a hardware-specific control value, which is transparent
27 * to SPM common logic.
28 */
29uint32_t backend_system_run(void);
Mingyang Sundeae45d2021-09-06 15:31:07 +080030
Ken Liu995a9742022-05-18 19:28:30 +080031/* Runtime model-specific message handling mechanism. */
32psa_status_t backend_messaging(struct service_t *p_serv,
33 struct conn_handle_t *handle);
Mingyang Sundeae45d2021-09-06 15:31:07 +080034
Ken Liu995a9742022-05-18 19:28:30 +080035/*
36 * Runtime model-specific message replying.
37 * Return the connection handle or the acked status code.
38 */
39psa_status_t backend_replying(struct conn_handle_t *handle, int32_t status);
Mingyang Sundeae45d2021-09-06 15:31:07 +080040
Ken Liu995a9742022-05-18 19:28:30 +080041/*
42 * Runtime model-specific Partition wait operation.
43 * Put the Partition to a status that waits for signals.
44 */
45psa_signal_t backend_wait(struct partition_t *p_pt, psa_signal_t signal_mask);
Kevin Pengdef92de2021-11-10 16:14:48 +080046
Ken Liu995a9742022-05-18 19:28:30 +080047/*
48 * Runtime model-specific Partition wake up operation.
49 * Wakes up the Partition with the asserted signals in 'p_pt'.
50 */
51void backend_wake_up(struct partition_t *p_pt);
Kevin Pengdef92de2021-11-10 16:14:48 +080052
Mingyang Sundeae45d2021-09-06 15:31:07 +080053
54/* The component list, and a MACRO indicate this is not a common global. */
55extern struct partition_head_t partition_listhead;
56#define PARTITION_LIST_ADDR (&partition_listhead)
57
Ken Liue07c3b72021-10-14 16:19:13 +080058/* TODO: Put this into NS Agent related service when available. */
59extern struct context_ctrl_t *p_spm_thread_context;
60#define SPM_THREAD_CONTEXT p_spm_thread_context
61
Mingyang Sundeae45d2021-09-06 15:31:07 +080062#endif /* __BACKEND_H__ */