blob: ecd52cbbfcaa00e8f6658d50ec541a4bdcbbda0f [file] [log] [blame]
Mingyang Sundeae45d2021-09-06 15:31:07 +08001/*
2 * Copyright (c) 2021, 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>
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
17/* BASIC TYPE DEFINITIONS */
18
19struct 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,
Ken Liu0bed7e02022-02-10 12:38:07 +080036 struct conn_handle_t *hdl);
Mingyang Sundeae45d2021-09-06 15:31:07 +080037
Ken Liu802a3702021-10-15 12:09:56 +080038 /*
39 * Runtime model-specific message replying.
Ken Liuf39d8eb2021-10-07 12:55:33 +080040 * Return the connection handle or the acked status code.
Ken Liu802a3702021-10-15 12:09:56 +080041 */
Ken Liu0bed7e02022-02-10 12:38:07 +080042 int32_t (*replying)(struct conn_handle_t *hdl, int32_t status);
Mingyang Sundeae45d2021-09-06 15:31:07 +080043};
44
45/* RUNTIME MODEL BACKENDS DECLARATION */
46
47/* IPC backend */
48extern const struct backend_ops_t backend_instance;
49
50/* The component list, and a MACRO indicate this is not a common global. */
51extern struct partition_head_t partition_listhead;
52#define PARTITION_LIST_ADDR (&partition_listhead)
53
Ken Liue07c3b72021-10-14 16:19:13 +080054/* TODO: Put this into NS Agent related service when available. */
55extern struct context_ctrl_t *p_spm_thread_context;
56#define SPM_THREAD_CONTEXT p_spm_thread_context
57
Mingyang Sundeae45d2021-09-06 15:31:07 +080058#endif /* __BACKEND_H__ */