xref: /optee_os/core/include/kernel/ts_manager.h (revision 3560d990ed9a8731f9bbe6aef77d4b5266469cdb)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2014, STMicroelectronics International N.V.
4  * Copyright (c) 2017-2020, Linaro Limited
5  */
6 
7 #ifndef __KERNEL_TS_MANAGER_H
8 #define __KERNEL_TS_MANAGER_H
9 
10 #include <sys/queue.h>
11 #include <tee_api_types.h>
12 
13 struct ts_ctx {
14 	TEE_UUID uuid;
15 	const struct tee_ta_ops *ops;
16 };
17 
18 struct ts_session {
19 	TAILQ_ENTRY(ts_session) link_tsd;
20 	struct ts_ctx *ctx;	/* Generic TS context */
21 #if defined(CFG_TA_GPROF_SUPPORT)
22 	struct sample_buf *sbuf; /* Profiling data (PC sampling) */
23 #endif
24 #if defined(CFG_FTRACE_SUPPORT)
25 	struct ftrace_buf *fbuf; /* ftrace buffer */
26 #endif
27 };
28 
29 struct ts_session *ts_get_current_session(void);
30 struct ts_session *ts_get_current_session_may_fail(void);
31 
32 void ts_push_current_session(struct ts_session *sess);
33 struct ts_session *ts_pop_current_session(void);
34 struct ts_session *ts_get_calling_session(void);
35 
36 #endif /*__KERNEL_TS_MANAGER_H*/
37