1/*
2 * Copyright (C) 2022 Huawei Technologies Co., Ltd.
3 * Decription: for log cfg api define
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#ifndef LOG_CFG_API_H
15#define LOG_CFG_API_H
16
17#include <linux/types.h>
18
19#if ((defined(CONFIG_BBOX_MEM) || defined(CONFIG_RDR_MEM) || \
20	defined(CONFIG_PAGES_MEM)) && defined(CONFIG_TEELOG))
21int register_log_mem(uint64_t *addr, uint32_t *len);
22int register_log_exception(void);
23void report_log_system_error(void);
24void report_log_system_panic(void);
25int *map_log_mem(uint64_t mem_addr, uint32_t mem_len);
26void unmap_log_mem(int *log_buffer);
27void get_log_chown(uid_t *user, gid_t *group);
28void unregister_log_exception(void);
29void ta_crash_report_log(void);
30#else
31static inline int register_log_mem(const uint64_t *addr, const uint32_t *len)
32{
33	(void)addr;
34	(void)len;
35	return 0;
36}
37
38static inline int register_log_exception(void)
39{
40	return 0;
41}
42
43static inline void report_log_system_error(void)
44{
45}
46
47static inline void report_log_system_panic(void)
48{
49}
50
51static inline int *map_log_mem(uint64_t mem_addr, uint32_t mem_len)
52{
53	(void)mem_addr;
54	(void)mem_len;
55	return NULL;
56}
57static inline void unmap_log_mem(const int *log_buffer)
58{
59	(void)log_buffer;
60}
61static inline void get_log_chown(const uid_t *user, const gid_t *group)
62{
63	(void)user;
64	(void)group;
65}
66static inline void unregister_log_exception(void)
67{
68}
69
70static inline void ta_crash_report_log(void)
71{
72}
73#endif
74#endif
75