2 * arch/ppc/syslib/gen550_kgdb.c
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.
10 * Adapted from ppc4xx_kgdb.c.
12 * Author: Matt Porter <mporter@kernel.crashing.org>
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
20 #include <linux/config.h>
21 #include <linux/types.h>
22 #include <linux/kernel.h>
24 #include <asm/machdep.h>
26 extern unsigned long serial_init(int, void *);
27 extern unsigned long serial_getc(unsigned long);
28 extern unsigned long serial_putc(unsigned long, unsigned char);
30 #if defined(CONFIG_KGDB_TTYS0)
32 #elif defined(CONFIG_KGDB_TTYS1)
34 #elif defined(CONFIG_KGDB_TTYS2)
36 #elif defined(CONFIG_KGDB_TTYS3)
39 #error "invalid kgdb_tty port"
42 static volatile unsigned int kgdb_debugport;
44 void putDebugChar(unsigned char c)
46 if (kgdb_debugport == 0)
47 kgdb_debugport = serial_init(KGDB_PORT, NULL);
49 serial_putc(kgdb_debugport, c);
52 int getDebugChar(void)
54 if (kgdb_debugport == 0)
55 kgdb_debugport = serial_init(KGDB_PORT, NULL);
57 return(serial_getc(kgdb_debugport));
60 void kgdb_interruptible(int enable)
65 void putDebugString(char* str)
67 while (*str != '\0') {
76 * Note: gen550_init() must be called already on the port we are going
80 gen550_kgdb_map_scc(void)
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);