xref: /openbmc/u-boot/common/kgdb_stubs.c (revision d9b88d25)
1 /*
2  * U-Boot - stub functions for common kgdb code,
3  *          can be overridden in board specific files
4  *
5  * Copyright 2009 Analog Devices Inc.
6  *
7  * Licensed under the GPL-2 or later.
8  */
9 
10 #include <common.h>
11 #include <kgdb.h>
12 
13 int (*debugger_exception_handler)(struct pt_regs *);
14 
15 __attribute__((weak))
16 void kgdb_serial_init(void)
17 {
18 	puts("[on serial] ");
19 }
20 
21 __attribute__((weak))
22 void putDebugChar(int c)
23 {
24 	serial_putc(c);
25 }
26 
27 __attribute__((weak))
28 void putDebugStr(const char *str)
29 {
30 #ifdef DEBUG
31 	serial_puts(str);
32 #endif
33 }
34 
35 __attribute__((weak))
36 int getDebugChar(void)
37 {
38 	return serial_getc();
39 }
40 
41 __attribute__((weak))
42 void kgdb_interruptible(int yes)
43 {
44 	return;
45 }
46 
47 __attribute__((weak))
48 void kgdb_flush_cache_range(void *from, void *to)
49 {
50 	flush_cache((unsigned long)from, (unsigned long)(to - from));
51 }
52 
53 __attribute__((weak))
54 void kgdb_flush_cache_all(void)
55 {
56 	if (dcache_status()) {
57 		dcache_disable();
58 		dcache_enable();
59 	}
60 	if (icache_status()) {
61 		icache_disable();
62 		icache_enable();
63 	}
64 }
65