aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/setup.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-03-08 03:27:37 -0500
committerPaul Mundt <lethal@hera.kernel.org>2007-05-06 22:10:51 -0400
commitfa5da2f7bdcf885efe65a37df13907c7d72296f6 (patch)
tree54104d5f660a1ec824505b28540eb2c5e4be390a /arch/sh/kernel/setup.c
parent15700770ef7c5d12e2f1659d2ddbeb3f658d9f37 (diff)
sh: Bring kgdb back from the dead.
This code has suffered quite a bit of bitrot, do some basic tidying to get it to a reasonably functional state again. This gets the basic support and the console working again. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/setup.c')
-rw-r--r--arch/sh/kernel/setup.c94
1 files changed, 1 insertions, 93 deletions
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 98802ab28211..f96490419768 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -25,11 +25,8 @@
25#include <asm/setup.h> 25#include <asm/setup.h>
26#include <asm/clock.h> 26#include <asm/clock.h>
27 27
28#ifdef CONFIG_SH_KGDB
29#include <asm/kgdb.h>
30static int kgdb_parse_options(char *options);
31#endif
32extern void * __rd_start, * __rd_end; 28extern void * __rd_start, * __rd_end;
29
33/* 30/*
34 * Machine setup.. 31 * Machine setup..
35 */ 32 */
@@ -499,92 +496,3 @@ struct seq_operations cpuinfo_op = {
499 .show = show_cpuinfo, 496 .show = show_cpuinfo,
500}; 497};
501#endif /* CONFIG_PROC_FS */ 498#endif /* CONFIG_PROC_FS */
502
503#ifdef CONFIG_SH_KGDB
504/*
505 * Parse command-line kgdb options. By default KGDB is enabled,
506 * entered on error (or other action) using default serial info.
507 * The command-line option can include a serial port specification
508 * and an action to override default or configured behavior.
509 */
510struct kgdb_sermap kgdb_sci_sermap =
511{ "ttySC", 5, kgdb_sci_setup, NULL };
512
513struct kgdb_sermap *kgdb_serlist = &kgdb_sci_sermap;
514struct kgdb_sermap *kgdb_porttype = &kgdb_sci_sermap;
515
516void kgdb_register_sermap(struct kgdb_sermap *map)
517{
518 struct kgdb_sermap *last;
519
520 for (last = kgdb_serlist; last->next; last = last->next)
521 ;
522 last->next = map;
523 if (!map->namelen) {
524 map->namelen = strlen(map->name);
525 }
526}
527
528static int __init kgdb_parse_options(char *options)
529{
530 char c;
531 int baud;
532
533 /* Check for port spec (or use default) */
534
535 /* Determine port type and instance */
536 if (!memcmp(options, "tty", 3)) {
537 struct kgdb_sermap *map = kgdb_serlist;
538
539 while (map && memcmp(options, map->name, map->namelen))
540 map = map->next;
541
542 if (!map) {
543 KGDB_PRINTK("unknown port spec in %s\n", options);
544 return -1;
545 }
546
547 kgdb_porttype = map;
548 kgdb_serial_setup = map->setup_fn;
549 kgdb_portnum = options[map->namelen] - '0';
550 options += map->namelen + 1;
551
552 options = (*options == ',') ? options+1 : options;
553
554 /* Read optional parameters (baud/parity/bits) */
555 baud = simple_strtoul(options, &options, 10);
556 if (baud != 0) {
557 kgdb_baud = baud;
558
559 c = toupper(*options);
560 if (c == 'E' || c == 'O' || c == 'N') {
561 kgdb_parity = c;
562 options++;
563 }
564
565 c = *options;
566 if (c == '7' || c == '8') {
567 kgdb_bits = c;
568 options++;
569 }
570 options = (*options == ',') ? options+1 : options;
571 }
572 }
573
574 /* Check for action specification */
575 if (!memcmp(options, "halt", 4)) {
576 kgdb_halt = 1;
577 options += 4;
578 } else if (!memcmp(options, "disabled", 8)) {
579 kgdb_enabled = 0;
580 options += 8;
581 }
582
583 if (*options) {
584 KGDB_PRINTK("ignored unknown options: %s\n", options);
585 return 0;
586 }
587 return 1;
588}
589__setup("kgdb=", kgdb_parse_options);
590#endif /* CONFIG_SH_KGDB */