2 * arch/ppc/kernel/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 * Matt Porter <mporter@mvista.com>
14 * Copyright 2002 MontaVista Software Inc.
16 * This program is free software; you can redistribute it and/or modify it
17 * under the terms of the GNU General Public License as published by the
18 * Free Software Foundation; either version 2 of the License, or (at your
19 * option) any later version.
22 #include <linux/config.h>
23 #include <linux/types.h>
24 #include <linux/kernel.h>
26 #include <asm/machdep.h>
28 extern unsigned long serial_init(int, void *);
29 extern unsigned long serial_getc(unsigned long);
30 extern unsigned long serial_putc(unsigned long, unsigned char);
32 #if defined(CONFIG_KGDB_TTYS0)
34 #elif defined(CONFIG_KGDB_TTYS1)
36 #elif defined(CONFIG_KGDB_TTYS2)
38 #elif defined(CONFIG_KGDB_TTYS3)
41 #error "invalid kgdb_tty port"
44 static volatile unsigned int kgdb_debugport;
46 void putDebugChar(unsigned char c)
48 if (kgdb_debugport == 0)
49 kgdb_debugport = serial_init(KGDB_PORT, NULL);
51 serial_putc(kgdb_debugport, c);
54 int getDebugChar(void)
56 if (kgdb_debugport == 0)
57 kgdb_debugport = serial_init(KGDB_PORT, NULL);
59 return(serial_getc(kgdb_debugport));
62 void kgdb_interruptible(int enable)
67 void putDebugString(char* str)
69 while (*str != '\0') {
80 printk("kgdb init\n");
81 if (ppc_md.early_serial_map)
82 ppc_md.early_serial_map();
83 kgdb_debugport = serial_init(KGDB_PORT, NULL);