Mingyang Sun | deae45d | 2021-09-06 15:31:07 +0800 | [diff] [blame] | 1 | /* |
Mingyang Sun | a09adda | 2022-02-16 18:11:33 +0800 | [diff] [blame] | 2 | * Copyright (c) 2021-2022, Arm Limited. All rights reserved. |
Mingyang Sun | deae45d | 2021-09-06 15:31:07 +0800 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef __BACKEND_H__ |
| 9 | #define __BACKEND_H__ |
| 10 | |
| 11 | #include <stdint.h> |
Mingyang Sun | deae45d | 2021-09-06 15:31:07 +0800 | [diff] [blame] | 12 | #include "spm_ipc.h" |
Ken Liu | e07c3b7 | 2021-10-14 16:19:13 +0800 | [diff] [blame] | 13 | #include "tfm_arch.h" |
Mingyang Sun | deae45d | 2021-09-06 15:31:07 +0800 | [diff] [blame] | 14 | #include "load/spm_load_api.h" |
Ken Liu | e07c3b7 | 2021-10-14 16:19:13 +0800 | [diff] [blame] | 15 | #include "psa/error.h" |
Mingyang Sun | deae45d | 2021-09-06 15:31:07 +0800 | [diff] [blame] | 16 | |
Ken Liu | 995a974 | 2022-05-18 19:28:30 +0800 | [diff] [blame] | 17 | /* |
| 18 | * Runtime model-specific component initialization routine. This |
| 19 | * is an `assuredly` function, would panic if any error occurred. |
| 20 | */ |
| 21 | void backend_init_comp_assuredly(struct partition_t *p_pt, |
| 22 | uint32_t service_setting); |
Mingyang Sun | deae45d | 2021-09-06 15:31:07 +0800 | [diff] [blame] | 23 | |
Ken Liu | 995a974 | 2022-05-18 19:28:30 +0800 | [diff] [blame] | 24 | /* |
| 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 | */ |
| 29 | uint32_t backend_system_run(void); |
Mingyang Sun | deae45d | 2021-09-06 15:31:07 +0800 | [diff] [blame] | 30 | |
Ken Liu | 995a974 | 2022-05-18 19:28:30 +0800 | [diff] [blame] | 31 | /* Runtime model-specific message handling mechanism. */ |
| 32 | psa_status_t backend_messaging(struct service_t *p_serv, |
| 33 | struct conn_handle_t *handle); |
Mingyang Sun | deae45d | 2021-09-06 15:31:07 +0800 | [diff] [blame] | 34 | |
Ken Liu | 995a974 | 2022-05-18 19:28:30 +0800 | [diff] [blame] | 35 | /* |
| 36 | * Runtime model-specific message replying. |
| 37 | * Return the connection handle or the acked status code. |
| 38 | */ |
| 39 | psa_status_t backend_replying(struct conn_handle_t *handle, int32_t status); |
Mingyang Sun | deae45d | 2021-09-06 15:31:07 +0800 | [diff] [blame] | 40 | |
Ken Liu | 995a974 | 2022-05-18 19:28:30 +0800 | [diff] [blame] | 41 | /* |
| 42 | * Runtime model-specific Partition wait operation. |
| 43 | * Put the Partition to a status that waits for signals. |
| 44 | */ |
| 45 | psa_signal_t backend_wait(struct partition_t *p_pt, psa_signal_t signal_mask); |
Kevin Peng | def92de | 2021-11-10 16:14:48 +0800 | [diff] [blame] | 46 | |
Ken Liu | 995a974 | 2022-05-18 19:28:30 +0800 | [diff] [blame] | 47 | /* |
| 48 | * Runtime model-specific Partition wake up operation. |
| 49 | * Wakes up the Partition with the asserted signals in 'p_pt'. |
| 50 | */ |
| 51 | void backend_wake_up(struct partition_t *p_pt); |
Kevin Peng | def92de | 2021-11-10 16:14:48 +0800 | [diff] [blame] | 52 | |
Mingyang Sun | deae45d | 2021-09-06 15:31:07 +0800 | [diff] [blame] | 53 | |
| 54 | /* The component list, and a MACRO indicate this is not a common global. */ |
| 55 | extern struct partition_head_t partition_listhead; |
| 56 | #define PARTITION_LIST_ADDR (&partition_listhead) |
| 57 | |
Ken Liu | e07c3b7 | 2021-10-14 16:19:13 +0800 | [diff] [blame] | 58 | /* TODO: Put this into NS Agent related service when available. */ |
| 59 | extern struct context_ctrl_t *p_spm_thread_context; |
| 60 | #define SPM_THREAD_CONTEXT p_spm_thread_context |
| 61 | |
Mingyang Sun | deae45d | 2021-09-06 15:31:07 +0800 | [diff] [blame] | 62 | #endif /* __BACKEND_H__ */ |