summaryrefstree
path: root/kernel/include/linux/sec_debug_complete_hint.h
blob: 96d7840a1c79df8074538ac51ec572e2ca4c82ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* Samsung debugging features for Samsung's SoC's.
*
* Copyright (c) 2019 Samsung Electronics Co., Ltd.
*      http://www.samsung.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/

#ifndef SEC_DEBUG_COMPLETE_HINT_H
#define SEC_DEBUG_COMPLETE_HINT_H

#include <linux/sched.h>

#define MAX_HINT 3
#define CALLSTACK_MAX_NUM 5
#define HINT_MAGIC 0xADDB100D

struct complete_hint {
	void * addrs[CALLSTACK_MAX_NUM];
	union {
		struct task_struct *p;
		void *fn;
	};
	int magic;
	int type;
};

struct secdbg_hint {
	struct complete_hint hint[MAX_HINT];	
	int hint_magic;
	unsigned int hint_idx;
};

static inline void secdbg_hint_init(struct secdbg_hint *hint);

#include <linux/completion.h>

static inline void secdbg_hint_add_completion_to_task(struct completion *x)
{
#ifdef CONFIG_SEC_DEBUG_COMPLETE_HINT
	current->x = x;
#endif
}

static inline void secdbg_hint_del_completion_to_task(struct completion *x)
{
#ifdef CONFIG_SEC_DEBUG_COMPLETE_HINT
	current->x = 0;
#endif
}

static inline void secdbg_hint_init(struct secdbg_hint *hint)
{
	if (hint->hint_magic != HINT_MAGIC) {
		hint->hint_idx = 0;
		hint->hint_magic = HINT_MAGIC;
	}
}

extern void secdbg_hint_save_complete_hint(struct secdbg_hint *hint);

extern void secdbg_hint_display_complete_hint(void);

#endif /* SEC_DEBUG_COMPLETE_HINT_H */