summaryrefstree
path: root/kernel/include/linux/debug-snapshot-helper.h
blob: a90ad8e5fe904953a4a96d779b28aef94aec82c5 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com
 *
 * Debug-SnapShot: Debug Framework for Ramdump based debugging method
 * The original code is Exynos-Snapshot for Exynos SoC
 *
 * Author: Hosung Kim <hosung0.kim@samsung.com>
 * Author: Changki Kim <changki.kim@samsung.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef DEBUG_SNAPSHOT_HELPER_H
#define DEBUG_SNAPSHOT_HELPER_H

struct dbg_snapshot_helper_ops {
	void (*soc_early_panic)(void *);

	void (*soc_prepare_panic_entry)(void *);
	void (*soc_prepare_panic_exit)(void *);

	void (*soc_post_panic_entry)(void *);
	void (*soc_post_panic_exit)(void *);

	void (*soc_post_reboot_entry)(void *);
	void (*soc_post_reboot_exit)(void *);

	void (*soc_save_context_entry)(void *);
	void (*soc_save_context_exit)(void *);

	void (*soc_save_core)(void *);
	void (*soc_save_context)(void *);
	void (*soc_save_system)(void *);
	void (*soc_dump_info)(void *);

	void (*soc_start_watchdog)(void *);
	void (*soc_expire_watchdog)(void *);
	void (*soc_stop_watchdog)(void *);
	void (*soc_kick_watchdog)(void *);

	int (*soc_is_power_cpu)(unsigned int);
	int (*soc_smc_call)(unsigned long, unsigned long, unsigned long, unsigned long);

	void (*soc_do_dpm_policy)(void *);
};

extern void dbg_snapshot_register_soc_ops(struct dbg_snapshot_helper_ops *ops);
extern bool dbg_snapshot_is_scratch(void);

extern void dbg_snapshot_set_debug_test_reg(unsigned int val);
extern bool dbg_snapshot_debug_test_enabled(void);
extern void dbg_snapshot_set_debug_test_case(unsigned int val);
extern unsigned int dbg_snapshot_get_debug_test_case(void);
extern void dbg_snapshot_set_debug_test_next(unsigned int val);
extern unsigned int dbg_snapshot_get_debug_test_next(void);
extern void dbg_snapshot_set_debug_test_panic(unsigned int val);
extern unsigned int dbg_snapshot_get_debug_test_panic(void);
extern void dbg_snapshot_set_debug_test_wdt(unsigned int val);
extern unsigned int dbg_snapshot_get_debug_test_wdt(void);
extern void dbg_snapshot_set_debug_test_wtsr(unsigned int val);
extern unsigned int dbg_snapshot_get_debug_test_wtsr(void);
extern void dbg_snapshot_set_debug_test_smpl(unsigned int val);
extern unsigned int dbg_snapshot_get_debug_test_smpl(void);
extern void dbg_snapshot_set_debug_test_curr(unsigned int val);
extern unsigned int dbg_snapshot_get_debug_test_curr(void);
extern void dbg_snapshot_set_debug_test_total(unsigned int val);
extern unsigned int dbg_snapshot_get_debug_test_total(void);
extern void dbg_snapshot_set_debug_test_run(unsigned int test_id, unsigned int var);
extern unsigned int dbg_snapshot_get_debug_test_run(unsigned int test_id);
extern void dbg_snapshot_clear_debug_test_runflag(void);
extern unsigned int dbg_snapshot_get_debug_test_runflag(void);
extern void dbg_snapshot_set_debug_test_buffer_addr(u64 paddr, unsigned int cpu);
extern unsigned int dbg_snapshot_get_debug_test_buffer_addr(unsigned int cpu);

#ifdef CONFIG_ARM64
struct dbg_snapshot_mmu_reg {
	long SCTLR_EL1;
	long TTBR0_EL1;
	long TTBR1_EL1;
	long TCR_EL1;
	long ESR_EL1;
	long FAR_EL1;
	long CONTEXTIDR_EL1;
	long TPIDR_EL0;
	long TPIDRRO_EL0;
	long TPIDR_EL1;
	long MAIR_EL1;
	long ELR_EL1;
	long SP_EL0;
};

#else
struct dbg_snapshot_mmu_reg {
	int SCTLR;
	int TTBR0;
	int TTBR1;
	int TTBCR;
	int DACR;
	int DFSR;
	int DFAR;
	int IFSR;
	int IFAR;
	int DAFSR;
	int IAFSR;
	int PMRRR;
	int NMRRR;
	int FCSEPID;
	int CONTEXT;
	int URWTPID;
	int UROTPID;
	int POTPIDR;
};
#endif
#endif