aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/syslib/gen550_kgdb.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/ppc/syslib/gen550_kgdb.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/ppc/syslib/gen550_kgdb.c')
-rw-r--r--arch/ppc/syslib/gen550_kgdb.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/arch/ppc/syslib/gen550_kgdb.c b/arch/ppc/syslib/gen550_kgdb.c
new file mode 100644
index 000000000000..7239d5d7ddcd
--- /dev/null
+++ b/arch/ppc/syslib/gen550_kgdb.c
@@ -0,0 +1,86 @@
1/*
2 * arch/ppc/syslib/gen550_kgdb.c
3 *
4 * Generic 16550 kgdb support intended to be useful on a variety
5 * of platforms. To enable this support, it is necessary to set
6 * the CONFIG_GEN550 option. Any virtual mapping of the serial
7 * port(s) to be used can be accomplished by setting
8 * ppc_md.early_serial_map to a platform-specific mapping function.
9 *
10 * Adapted from ppc4xx_kgdb.c.
11 *
12 * Author: Matt Porter <mporter@kernel.crashing.org>
13 *
14 * 2002-2004 (c) MontaVista Software, Inc. This file is licensed under
15 * the terms of the GNU General Public License version 2. This program
16 * is licensed "as is" without any warranty of any kind, whether express
17 * or implied.
18 */
19
20#include <linux/config.h>
21#include <linux/types.h>
22#include <linux/kernel.h>
23
24#include <asm/machdep.h>
25
26extern unsigned long serial_init(int, void *);
27extern unsigned long serial_getc(unsigned long);
28extern unsigned long serial_putc(unsigned long, unsigned char);
29
30#if defined(CONFIG_KGDB_TTYS0)
31#define KGDB_PORT 0
32#elif defined(CONFIG_KGDB_TTYS1)
33#define KGDB_PORT 1
34#elif defined(CONFIG_KGDB_TTYS2)
35#define KGDB_PORT 2
36#elif defined(CONFIG_KGDB_TTYS3)
37#define KGDB_PORT 3
38#else
39#error "invalid kgdb_tty port"
40#endif
41
42static volatile unsigned int kgdb_debugport;
43
44void putDebugChar(unsigned char c)
45{
46 if (kgdb_debugport == 0)
47 kgdb_debugport = serial_init(KGDB_PORT, NULL);
48
49 serial_putc(kgdb_debugport, c);
50}
51
52int getDebugChar(void)
53{
54 if (kgdb_debugport == 0)
55 kgdb_debugport = serial_init(KGDB_PORT, NULL);
56
57 return(serial_getc(kgdb_debugport));
58}
59
60void kgdb_interruptible(int enable)
61{
62 return;
63}
64
65void putDebugString(char* str)
66{
67 while (*str != '\0') {
68 putDebugChar(*str);
69 str++;
70 }
71 putDebugChar('\r');
72 return;
73}
74
75/*
76 * Note: gen550_init() must be called already on the port we are going
77 * to use.
78 */
79void
80gen550_kgdb_map_scc(void)
81{
82 printk(KERN_DEBUG "kgdb init\n");
83 if (ppc_md.early_serial_map)
84 ppc_md.early_serial_map();
85 kgdb_debugport = serial_init(KGDB_PORT, NULL);
86}