Robin Getz | ed9d08e | 2009-12-21 18:40:42 -0500 | [diff] [blame] | 1 | /* |
Bin Meng | 7557405 | 2016-02-05 19:30:11 -0800 | [diff] [blame] | 2 | * U-Boot - stub functions for common kgdb code, |
Robin Getz | ed9d08e | 2009-12-21 18:40:42 -0500 | [diff] [blame] | 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 | |
Simon Glass | 1d91ba7 | 2019-11-14 12:57:37 -0700 | [diff] [blame] | 10 | #include <cpu_func.h> |
Robin Getz | ed9d08e | 2009-12-21 18:40:42 -0500 | [diff] [blame] | 11 | #include <kgdb.h> |
Simon Glass | 3673618 | 2019-11-14 12:57:24 -0700 | [diff] [blame] | 12 | #include <serial.h> |
Simon Glass | 6b9f010 | 2020-05-10 11:40:06 -0600 | [diff] [blame] | 13 | #include <asm/ptrace.h> |
Robin Getz | ed9d08e | 2009-12-21 18:40:42 -0500 | [diff] [blame] | 14 | |
| 15 | int (*debugger_exception_handler)(struct pt_regs *); |
| 16 | |
| 17 | __attribute__((weak)) |
| 18 | void kgdb_serial_init(void) |
| 19 | { |
| 20 | puts("[on serial] "); |
| 21 | } |
| 22 | |
| 23 | __attribute__((weak)) |
| 24 | void putDebugChar(int c) |
| 25 | { |
| 26 | serial_putc(c); |
| 27 | } |
| 28 | |
| 29 | __attribute__((weak)) |
| 30 | void putDebugStr(const char *str) |
| 31 | { |
| 32 | #ifdef DEBUG |
| 33 | serial_puts(str); |
| 34 | #endif |
| 35 | } |
| 36 | |
| 37 | __attribute__((weak)) |
| 38 | int getDebugChar(void) |
| 39 | { |
| 40 | return serial_getc(); |
| 41 | } |
| 42 | |
| 43 | __attribute__((weak)) |
| 44 | void kgdb_interruptible(int yes) |
| 45 | { |
| 46 | return; |
| 47 | } |
| 48 | |
| 49 | __attribute__((weak)) |
| 50 | void kgdb_flush_cache_range(void *from, void *to) |
| 51 | { |
| 52 | flush_cache((unsigned long)from, (unsigned long)(to - from)); |
| 53 | } |
| 54 | |
| 55 | __attribute__((weak)) |
| 56 | void kgdb_flush_cache_all(void) |
| 57 | { |
| 58 | if (dcache_status()) { |
| 59 | dcache_disable(); |
| 60 | dcache_enable(); |
| 61 | } |
| 62 | if (icache_status()) { |
| 63 | icache_disable(); |
| 64 | icache_enable(); |
| 65 | } |
| 66 | } |