• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2012-2022 Huawei Technologies Co., Ltd.
3  * Description: tzdriver internal functions.
4  *
5  * This software is licensed under the terms of the GNU General Public
6  * License version 2, as published by the Free Software Foundation, and
7  * may be copied, distributed, and modified under those terms.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  */
14 
15 #ifndef INTERNAL_FUNCTIONS_H
16 #define INTERNAL_FUNCTIONS_H
17 
18 #include <linux/device.h>
19 #include <securec.h>
20 #include "teek_ns_client.h"
21 #include "teek_client_constants.h"
22 
23 #ifndef CONFIG_TEE_FAULT_MANAGER
fault_monitor_start(int32_t type)24 static inline void fault_monitor_start(int32_t type)
25 {
26 	(void)type;
27 	return;
28 }
29 
fault_monitor_end(void)30 static inline void fault_monitor_end(void)
31 {
32 	return;
33 }
34 #endif
35 
36 #ifdef CONFIG_KTHREAD_AFFINITY
37 #include "tz_kthread_affinity.h"
38 #else
init_kthread_cpumask(void)39 static inline void init_kthread_cpumask(void)
40 {
41 }
42 
tz_kthread_bind_mask(struct task_struct * kthread)43 static inline void tz_kthread_bind_mask(struct task_struct *kthread)
44 {
45 	(void)kthread;
46 }
47 
tz_workqueue_bind_mask(struct workqueue_struct * wq,uint32_t flag)48 static inline void tz_workqueue_bind_mask(struct workqueue_struct *wq,
49 	uint32_t flag)
50 {
51 	(void)wq;
52 	(void)flag;
53 }
54 #endif
55 
56 #ifdef CONFIG_LIVEPATCH_ENABLE
57 #include "livepatch_cmd.h"
58 #else
livepatch_init(const struct device * dev)59 static inline int livepatch_init(const struct device *dev)
60 {
61 	(void)dev;
62 	return 0;
63 }
livepatch_down_read_sem(void)64 static inline void livepatch_down_read_sem(void)
65 {
66 }
livepatch_up_read_sem(void)67 static inline void livepatch_up_read_sem(void)
68 {
69 }
free_livepatch(void)70 static inline void free_livepatch(void)
71 {
72 }
73 #endif
74 
75 #ifdef CONFIG_TEE_TRACE
76 #include "tee_trace_event.h"
77 #include "tee_trace_interrupt.h"
78 #else
tee_trace_add_event(enum tee_event_id id,uint64_t add_info)79 static inline void tee_trace_add_event(enum tee_event_id id, uint64_t add_info)
80 {
81 	(void)id;
82 	(void)add_info;
83 }
free_event_mem(void)84 static inline void free_event_mem(void)
85 {
86 }
free_interrupt_trace(void)87 static inline void free_interrupt_trace(void)
88 {
89 }
90 #endif
91 
92 #ifdef CONFIG_TEE_REBOOT
93 #include "reboot.h"
94 #else
is_tee_rebooting(void)95 static inline bool is_tee_rebooting(void)
96 {
97 	return false;
98 }
tee_init_reboot_thread(void)99 static inline int tee_init_reboot_thread(void)
100 {
101 	return 0;
102 }
tee_wake_up_reboot(void)103 static inline int tee_wake_up_reboot(void)
104 {
105 	return 0;
106 }
free_reboot_thread(void)107 static inline void free_reboot_thread(void)
108 {
109 	return;
110 }
111 #endif
112 #endif