Commit | Line | Data |
---|---|---|
0413cd09 YK |
1 | |
2 | #ifndef DEBUG_SNAPSHOT_LOG_H | |
3 | #define DEBUG_SNAPSHOT_LOG_H | |
4 | ||
2585dbeb YK |
5 | #include <generated/autoconf.h> |
6 | ||
ae09f559 YK |
7 | #ifdef CONFIG_DEBUG_SNAPSHOT_BINDER |
8 | #include <linux/debug-snapshot-binder.h> | |
9 | #endif | |
10 | ||
0413cd09 YK |
11 | #ifdef DSS_ANALYZER |
12 | ||
13 | #define TASK_COMM_LEN 16 | |
14 | #define NR_CPUS 8 | |
15 | #undef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
2585dbeb YK |
16 | #include <stdio.h> |
17 | #include <stdlib.h> | |
0413cd09 YK |
18 | |
19 | #else // DSS_ANALYZER | |
20 | ||
0413cd09 YK |
21 | #include <linux/clk-provider.h> |
22 | #include <linux/debug-snapshot.h> | |
23 | #include <linux/debug-snapshot-helper.h> | |
24 | ||
25 | #endif // DSS_ANALYZER | |
26 | ||
27 | #include <dt-bindings/soc/samsung/debug-snapshot-table.h> | |
28 | ||
29 | /* Size domain */ | |
30 | #define DSS_KEEP_HEADER_SZ (SZ_256 * 3) | |
31 | #define DSS_HEADER_SZ SZ_4K | |
32 | #define DSS_MMU_REG_SZ SZ_4K | |
33 | #define DSS_CORE_REG_SZ SZ_4K | |
34 | #define DSS_DBGC_LOG_SZ SZ_4K | |
35 | #define DSS_HEADER_TOTAL_SZ (DSS_HEADER_SZ + DSS_MMU_REG_SZ + DSS_CORE_REG_SZ + DSS_DBGC_LOG_SZ) | |
36 | #define DSS_SPARE_SZ (DSS_HEADER_SIZE - DSS_HEADER_TOTAL_SZ) | |
37 | ||
38 | /* Length domain */ | |
39 | #define DSS_LOG_STRING_LENGTH SZ_128 | |
40 | #define DSS_MMU_REG_OFFSET SZ_512 | |
41 | #define DSS_CORE_REG_OFFSET SZ_512 | |
42 | #define DSS_LOG_MAX_NUM SZ_1K | |
43 | #define DSS_API_MAX_NUM SZ_2K | |
44 | #define DSS_EX_MAX_NUM SZ_8 | |
45 | #define DSS_IN_MAX_NUM SZ_8 | |
46 | #define DSS_CALLSTACK_MAX_NUM 4 | |
47 | #define DSS_ITERATION 5 | |
48 | #define DSS_NR_CPUS NR_CPUS | |
49 | #define DSS_ITEM_MAX_NUM 10 | |
50 | ||
51 | /* Sign domain */ | |
52 | #define DSS_SIGN_RESET 0x0 | |
53 | #define DSS_SIGN_RESERVED 0x1 | |
54 | #define DSS_SIGN_SCRATCH 0xD | |
55 | #define DSS_SIGN_ALIVE 0xFACE | |
56 | #define DSS_SIGN_DEAD 0xDEAD | |
57 | #define DSS_SIGN_PANIC 0xBABA | |
58 | #define DSS_SIGN_SAFE_FAULT 0xFAFA | |
59 | #define DSS_SIGN_NORMAL_REBOOT 0xCAFE | |
60 | #define DSS_SIGN_FORCE_REBOOT 0xDAFE | |
61 | #define DSS_SIGN_LOCKUP 0xDEADBEEF | |
62 | ||
63 | /* Specific Address Information */ | |
64 | #define DSS_FIXED_VIRT_BASE (VMALLOC_START + 0xF6000000) | |
65 | #define DSS_OFFSET_SCRATCH (0x100) | |
66 | #define DSS_OFFSET_LAST_LOGBUF (0x200) | |
67 | #define DSS_OFFSET_EMERGENCY_REASON (0x300) | |
68 | #define DSS_OFFSET_CORE_POWER_STAT (0x400) | |
69 | #define DSS_OFFSET_PANIC_STAT (0x500) | |
70 | #define DSS_OFFSET_CORE_LAST_PC (0x600) | |
71 | ||
72 | /* S5P_VA_SS_BASE + 0xC00 -- 0xFFF is reserved */ | |
73 | #define DSS_OFFSET_PANIC_STRING (0xC00) | |
74 | #define DSS_OFFSET_SPARE_BASE (DSS_HEADER_TOTAL_SZ) | |
75 | ||
76 | struct dbg_snapshot_log { | |
77 | struct __task_log { | |
78 | unsigned long long time; | |
79 | unsigned long sp; | |
80 | #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
81 | struct task_struct *task; | |
82 | #else | |
83 | void *task; | |
84 | #endif | |
85 | char task_comm[TASK_COMM_LEN]; | |
bf2bb2c5 | 86 | int pid; |
0413cd09 YK |
87 | } task[DSS_NR_CPUS][DSS_LOG_MAX_NUM]; |
88 | ||
89 | struct __work_log { | |
90 | unsigned long long time; | |
91 | unsigned long sp; | |
92 | #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
93 | struct worker *worker; | |
94 | work_func_t fn; | |
95 | #else | |
96 | void *worker; | |
97 | void *fn; | |
98 | #endif | |
99 | char task_comm[TASK_COMM_LEN]; | |
100 | int en; | |
101 | } work[DSS_NR_CPUS][DSS_LOG_MAX_NUM]; | |
102 | ||
103 | struct __cpuidle_log { | |
104 | unsigned long long time; | |
105 | unsigned long sp; | |
106 | char *modes; | |
107 | unsigned int state; | |
108 | #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
109 | u32 num_online_cpus; | |
110 | #else | |
111 | unsigned int num_online_cpus; | |
112 | #endif | |
113 | int delta; | |
114 | int en; | |
115 | } cpuidle[DSS_NR_CPUS][DSS_LOG_MAX_NUM]; | |
116 | ||
117 | struct __suspend_log { | |
118 | unsigned long long time; | |
119 | unsigned long sp; | |
120 | void *fn; | |
121 | #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
122 | struct device *dev; | |
123 | #else | |
124 | void *dev; | |
125 | #endif | |
126 | int en; | |
127 | int core; | |
128 | } suspend[DSS_LOG_MAX_NUM * 4]; | |
129 | ||
130 | struct __irq_log { | |
131 | unsigned long long time; | |
132 | unsigned long sp; | |
133 | int irq; | |
134 | void *fn; | |
135 | #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
136 | struct irqaction *action; | |
137 | #else | |
138 | void *action; | |
139 | #endif | |
140 | int en; | |
141 | } irq[DSS_NR_CPUS][DSS_LOG_MAX_NUM * 2]; | |
142 | ||
143 | #ifdef CONFIG_DEBUG_SNAPSHOT_IRQ_EXIT | |
144 | struct __irq_exit_log { | |
145 | unsigned long long time; | |
146 | unsigned long sp; | |
147 | unsigned long long end_time; | |
148 | unsigned long long latency; | |
149 | int irq; | |
150 | } irq_exit[DSS_NR_CPUS][DSS_LOG_MAX_NUM]; | |
151 | #endif | |
152 | #ifdef CONFIG_DEBUG_SNAPSHOT_SPINLOCK | |
153 | struct __spinlock_log { | |
154 | unsigned long long time; | |
155 | unsigned long sp; | |
156 | unsigned long long jiffies; | |
157 | #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
158 | raw_spinlock_t *lock; | |
159 | #ifdef CONFIG_DEBUG_SPINLOCK | |
160 | u16 next; | |
161 | u16 owner; | |
162 | #endif | |
163 | #else | |
164 | void *lock; | |
165 | #ifdef CONFIG_DEBUG_SPINLOCK | |
166 | unsigned short next; | |
167 | unsigned short owner; | |
168 | #endif | |
169 | #endif | |
170 | int en; | |
171 | void *caller[DSS_CALLSTACK_MAX_NUM]; | |
172 | } spinlock[DSS_NR_CPUS][DSS_LOG_MAX_NUM]; | |
173 | #endif | |
174 | #ifdef CONFIG_DEBUG_SNAPSHOT_IRQ_DISABLED | |
175 | struct __irqs_disabled_log { | |
176 | unsigned long long time; | |
177 | unsigned long index; | |
178 | #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
179 | struct task_struct *task; | |
180 | #else | |
181 | void *task; | |
182 | #endif | |
183 | char *task_comm; | |
184 | void *caller[DSS_CALLSTACK_MAX_NUM]; | |
185 | } irqs_disabled[DSS_NR_CPUS][SZ_32]; | |
186 | #endif | |
187 | #ifdef CONFIG_DEBUG_SNAPSHOT_CLK | |
188 | struct __clk_log { | |
189 | unsigned long long time; | |
190 | #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
191 | struct clk_hw *clk; | |
192 | #else | |
193 | void *clk; | |
194 | #endif | |
195 | const char *f_name; | |
196 | int mode; | |
197 | unsigned long arg; | |
198 | } clk[DSS_LOG_MAX_NUM]; | |
199 | #endif | |
200 | #ifdef CONFIG_DEBUG_SNAPSHOT_PMU | |
201 | struct __pmu_log { | |
202 | unsigned long long time; | |
203 | unsigned int id; | |
204 | const char *f_name; | |
205 | int mode; | |
206 | } pmu[DSS_LOG_MAX_NUM]; | |
207 | #endif | |
208 | #ifdef CONFIG_DEBUG_SNAPSHOT_FREQ | |
209 | struct __freq_log { | |
210 | unsigned long long time; | |
211 | int cpu; | |
bf2bb2c5 | 212 | int type; |
0413cd09 YK |
213 | char *freq_name; |
214 | unsigned long old_freq; | |
215 | unsigned long target_freq; | |
216 | int en; | |
217 | } freq[DSS_LOG_MAX_NUM]; | |
218 | #endif | |
219 | #ifdef CONFIG_DEBUG_SNAPSHOT_DM | |
220 | struct __dm_log { | |
221 | unsigned long long time; | |
222 | int cpu; | |
223 | int dm_num; | |
224 | unsigned long min_freq; | |
225 | unsigned long max_freq; | |
226 | #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
227 | s32 wait_dmt; | |
228 | s32 do_dmt; | |
229 | #else | |
230 | int wait_dmt; | |
231 | int do_dmt; | |
232 | #endif | |
233 | } dm[DSS_LOG_MAX_NUM]; | |
234 | #endif | |
235 | #ifdef CONFIG_DEBUG_SNAPSHOT_REG | |
236 | struct __reg_log { | |
237 | unsigned long long time; | |
238 | int read; | |
239 | size_t val; | |
240 | size_t reg; | |
241 | int en; | |
242 | void *caller[DSS_CALLSTACK_MAX_NUM]; | |
243 | } reg[DSS_NR_CPUS][DSS_LOG_MAX_NUM]; | |
244 | #endif | |
245 | #ifdef CONFIG_DEBUG_SNAPSHOT_HRTIMER | |
246 | struct __hrtimer_log { | |
247 | unsigned long long time; | |
248 | unsigned long long now; | |
249 | #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
250 | struct hrtimer *timer; | |
251 | #else | |
252 | void *timer; | |
253 | #endif | |
254 | void *fn; | |
255 | int en; | |
256 | } hrtimers[DSS_NR_CPUS][DSS_LOG_MAX_NUM]; | |
257 | #endif | |
258 | #ifdef CONFIG_DEBUG_SNAPSHOT_REGULATOR | |
259 | struct __regulator_log { | |
260 | unsigned long long time; | |
261 | unsigned long long acpm_time; | |
262 | int cpu; | |
263 | char name[SZ_16]; | |
264 | unsigned int reg; | |
265 | unsigned int voltage; | |
266 | unsigned int raw_volt; | |
267 | int en; | |
268 | } regulator[DSS_LOG_MAX_NUM]; | |
269 | #endif | |
270 | #ifdef CONFIG_DEBUG_SNAPSHOT_THERMAL | |
271 | struct __thermal_log { | |
272 | unsigned long long time; | |
273 | int cpu; | |
274 | #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
275 | struct exynos_tmu_platform_data *data; | |
276 | #else | |
277 | void *data; | |
278 | #endif | |
279 | unsigned int temp; | |
280 | char *cooling_device; | |
281 | unsigned int cooling_state; | |
282 | } thermal[DSS_LOG_MAX_NUM]; | |
283 | #endif | |
284 | #ifdef CONFIG_DEBUG_SNAPSHOT_ACPM | |
285 | struct __acpm_log { | |
286 | unsigned long long time; | |
287 | unsigned long long acpm_time; | |
288 | char log[9]; | |
289 | unsigned int data; | |
290 | } acpm[DSS_LOG_MAX_NUM]; | |
291 | #endif | |
292 | #ifdef CONFIG_DEBUG_SNAPSHOT_I2C | |
293 | struct __i2c_log { | |
294 | unsigned long long time; | |
295 | int cpu; | |
296 | #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
297 | struct i2c_adapter *adap; | |
298 | struct i2c_msg *msgs; | |
299 | #else | |
300 | void *adp; | |
301 | void *msgs; | |
302 | #endif | |
303 | int num; | |
304 | int en; | |
305 | } i2c[DSS_LOG_MAX_NUM]; | |
306 | #endif | |
307 | #ifdef CONFIG_DEBUG_SNAPSHOT_SPI | |
308 | struct __spi_log { | |
309 | unsigned long long time; | |
310 | int cpu; | |
311 | #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
312 | struct spi_controller *ctlr; | |
313 | struct spi_message *cur_msg; | |
314 | #else | |
315 | void *ctlr; | |
316 | void *cur_msg; | |
317 | #endif | |
318 | int en; | |
319 | } spi[DSS_LOG_MAX_NUM]; | |
320 | #endif | |
ae09f559 YK |
321 | #ifdef CONFIG_DEBUG_SNAPSHOT_BINDER |
322 | struct __binder_log { | |
323 | unsigned long long time; | |
324 | int cpu; | |
325 | struct trace_binder_transaction_base base; | |
326 | struct trace_binder_transaction transaction; | |
327 | struct trace_binder_transaction_error error; | |
328 | } binder[DSS_API_MAX_NUM << 2]; | |
329 | #endif | |
0413cd09 YK |
330 | |
331 | #ifndef CONFIG_DEBUG_SNAPSHOT_MINIMIZED_MODE | |
332 | struct __clockevent_log { | |
333 | unsigned long long time; | |
334 | unsigned long long mct_cycle; | |
335 | #ifdef CONFIG_DEBUG_SNAPSHOT_LINUX_BUILD | |
336 | int64_t delta_ns; | |
337 | ktime_t next_event; | |
338 | #else | |
339 | long long delta_ns; | |
340 | long long next_event; | |
341 | #endif | |
342 | void *caller[DSS_CALLSTACK_MAX_NUM]; | |
343 | } clockevent[DSS_NR_CPUS][DSS_LOG_MAX_NUM]; | |
344 | ||
345 | struct __printkl_log { | |
346 | unsigned long long time; | |
347 | int cpu; | |
348 | size_t msg; | |
349 | size_t val; | |
350 | void *caller[DSS_CALLSTACK_MAX_NUM]; | |
351 | } printkl[DSS_API_MAX_NUM]; | |
352 | ||
353 | struct __printk_log { | |
354 | unsigned long long time; | |
355 | int cpu; | |
356 | char log[DSS_LOG_STRING_LENGTH]; | |
357 | void *caller[DSS_CALLSTACK_MAX_NUM]; | |
358 | } printk[DSS_API_MAX_NUM]; | |
359 | #endif | |
360 | }; | |
361 | ||
362 | #endif |