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 | |
| 17 | /* BASIC TYPE DEFINITIONS */ |
| 18 | |
| 19 | struct backend_ops_t { |
| 20 | /* |
| 21 | * Runtime model-specific component initialization routine. This |
| 22 | * is an `assuredly` function, would panic if any error occurred. |
| 23 | */ |
| 24 | void (*comp_init_assuredly)(struct partition_t *p_pt, |
| 25 | uint32_t service_setting); |
| 26 | |
| 27 | /* |
| 28 | * Runtime model-specific kick-off method for the whole system. |
| 29 | * Returns a hardware-specific control value, which is transparent |
| 30 | * to SPM common logic. |
| 31 | */ |
| 32 | uint32_t (*system_run)(void); |
| 33 | |
| 34 | /* Runtime model-specific message handling mechanism. */ |
| 35 | psa_status_t (*messaging)(struct service_t *p_serv, |
Mingyang Sun | a09adda | 2022-02-16 18:11:33 +0800 | [diff] [blame] | 36 | struct conn_handle_t *handle); |
Mingyang Sun | deae45d | 2021-09-06 15:31:07 +0800 | [diff] [blame] | 37 | |
Ken Liu | 802a370 | 2021-10-15 12:09:56 +0800 | [diff] [blame] | 38 | /* |
| 39 | * Runtime model-specific message replying. |
Ken Liu | f39d8eb | 2021-10-07 12:55:33 +0800 | [diff] [blame] | 40 | * Return the connection handle or the acked status code. |
Ken Liu | 802a370 | 2021-10-15 12:09:56 +0800 | [diff] [blame] | 41 | */ |
Mingyang Sun | a09adda | 2022-02-16 18:11:33 +0800 | [diff] [blame] | 42 | psa_status_t (*replying)(struct conn_handle_t *handle, int32_t status); |
Kevin Peng | def92de | 2021-11-10 16:14:48 +0800 | [diff] [blame] | 43 | |
| 44 | /* |
| 45 | * Runtime model-specific Partition wait operation. |
| 46 | * Put the Partition to a status that waits for signals. |
| 47 | */ |
| 48 | void (*wait)(struct partition_t *p_pt, psa_signal_t signals); |
| 49 | |
| 50 | /* |
| 51 | * Runtime model-specific Partition wake up operation. |
| 52 | * Wakes up the Partition with the give signals. |
| 53 | */ |
| 54 | void (*wake_up)(struct partition_t *p_pt, psa_signal_t signals); |
Mingyang Sun | deae45d | 2021-09-06 15:31:07 +0800 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | /* RUNTIME MODEL BACKENDS DECLARATION */ |
| 58 | |
| 59 | /* IPC backend */ |
| 60 | extern const struct backend_ops_t backend_instance; |
| 61 | |
| 62 | /* The component list, and a MACRO indicate this is not a common global. */ |
| 63 | extern struct partition_head_t partition_listhead; |
| 64 | #define PARTITION_LIST_ADDR (&partition_listhead) |
| 65 | |
Ken Liu | e07c3b7 | 2021-10-14 16:19:13 +0800 | [diff] [blame] | 66 | /* TODO: Put this into NS Agent related service when available. */ |
| 67 | extern struct context_ctrl_t *p_spm_thread_context; |
| 68 | #define SPM_THREAD_CONTEXT p_spm_thread_context |
| 69 | |
Mingyang Sun | deae45d | 2021-09-06 15:31:07 +0800 | [diff] [blame] | 70 | #endif /* __BACKEND_H__ */ |