blob: 66aed7cea1c7e268afcbb7274e1c71fa5208c0e8 [file] [log] [blame]
Robin Getz0c909552009-12-21 18:40:42 -05001/*
Bin Menga1875592016-02-05 19:30:11 -08002 * U-Boot - stub functions for common kgdb code,
Robin Getz0c909552009-12-21 18:40:42 -05003 * 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>
Simon Glass9edefc22019-11-14 12:57:37 -070011#include <cpu_func.h>
Robin Getz0c909552009-12-21 18:40:42 -050012#include <kgdb.h>
Simon Glassb03e0512019-11-14 12:57:24 -070013#include <serial.h>
Simon Glass25a58182020-05-10 11:40:06 -060014#include <asm/ptrace.h>
Robin Getz0c909552009-12-21 18:40:42 -050015
16int (*debugger_exception_handler)(struct pt_regs *);
17
18__attribute__((weak))
19void kgdb_serial_init(void)
20{
21 puts("[on serial] ");
22}
23
24__attribute__((weak))
25void putDebugChar(int c)
26{
27 serial_putc(c);
28}
29
30__attribute__((weak))
31void putDebugStr(const char *str)
32{
33#ifdef DEBUG
34 serial_puts(str);
35#endif
36}
37
38__attribute__((weak))
39int getDebugChar(void)
40{
41 return serial_getc();
42}
43
44__attribute__((weak))
45void kgdb_interruptible(int yes)
46{
47 return;
48}
49
50__attribute__((weak))
51void kgdb_flush_cache_range(void *from, void *to)
52{
53 flush_cache((unsigned long)from, (unsigned long)(to - from));
54}
55
56__attribute__((weak))
57void kgdb_flush_cache_all(void)
58{
59 if (dcache_status()) {
60 dcache_disable();
61 dcache_enable();
62 }
63 if (icache_status()) {
64 icache_disable();
65 icache_enable();
66 }
67}