2 * Generic 16550 kgdb support intended to be useful on a variety
3 * of platforms. To enable this support, it is necessary to set
4 * the CONFIG_GEN550 option. Any virtual mapping of the serial
5 * port(s) to be used can be accomplished by setting
6 * ppc_md.early_serial_map to a platform-specific mapping function.
8 * Adapted from ppc4xx_kgdb.c.
10 * Author: Matt Porter <mporter@kernel.crashing.org>
12 * 2002-2004 (c) MontaVista Software, Inc. This file is licensed under
13 * the terms of the GNU General Public License version 2. This program
14 * is licensed "as is" without any warranty of any kind, whether express
18 #include <linux/types.h>
19 #include <linux/kernel.h>
21 #include <asm/machdep.h>
23 extern unsigned long serial_init(int, void *);
24 extern unsigned long serial_getc(unsigned long);
25 extern unsigned long serial_putc(unsigned long, unsigned char);
27 #if defined(CONFIG_KGDB_TTYS0)
29 #elif defined(CONFIG_KGDB_TTYS1)
31 #elif defined(CONFIG_KGDB_TTYS2)
33 #elif defined(CONFIG_KGDB_TTYS3)
36 #error "invalid kgdb_tty port"
39 static volatile unsigned int kgdb_debugport
;
41 void putDebugChar(unsigned char c
)
43 if (kgdb_debugport
== 0)
44 kgdb_debugport
= serial_init(KGDB_PORT
, NULL
);
46 serial_putc(kgdb_debugport
, c
);
49 int getDebugChar(void)
51 if (kgdb_debugport
== 0)
52 kgdb_debugport
= serial_init(KGDB_PORT
, NULL
);
54 return(serial_getc(kgdb_debugport
));
57 void kgdb_interruptible(int enable
)
62 void putDebugString(char* str
)
64 while (*str
!= '\0') {
73 * Note: gen550_init() must be called already on the port we are going
77 gen550_kgdb_map_scc(void)
79 printk(KERN_DEBUG
"kgdb init\n");
80 if (ppc_md
.early_serial_map
)
81 ppc_md
.early_serial_map();
82 kgdb_debugport
= serial_init(KGDB_PORT
, NULL
);