atlas_setup.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:4k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * Carsten Langgaard, carstenl@mips.com
  3.  * Copyright (C) 1999,2000 MIPS Technologies, Inc.  All rights reserved.
  4.  *
  5.  *  This program is free software; you can distribute it and/or modify it
  6.  *  under the terms of the GNU General Public License (Version 2) as
  7.  *  published by the Free Software Foundation.
  8.  *
  9.  *  This program is distributed in the hope it will be useful, but WITHOUT
  10.  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11.  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12.  *  for more details.
  13.  *
  14.  *  You should have received a copy of the GNU General Public License along
  15.  *  with this program; if not, write to the Free Software Foundation, Inc.,
  16.  *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  17.  *
  18.  * Atlas specific setup.
  19.  */
  20. #include <linux/config.h>
  21. #include <linux/init.h>
  22. #include <linux/sched.h>
  23. #include <linux/mc146818rtc.h>
  24. #include <linux/ioport.h>
  25. #include <asm/cpu.h>
  26. #include <asm/bootinfo.h>
  27. #include <asm/irq.h>
  28. #include <asm/mips-boards/generic.h>
  29. #include <asm/mips-boards/prom.h>
  30. #include <asm/mips-boards/atlasint.h>
  31. #include <asm/gt64120.h>
  32. #include <asm/time.h>
  33. #include <asm/traps.h>
  34. #if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_PROM_CONSOLE)
  35. extern void console_setup(char *, int *);
  36. char serial_console[20];
  37. #endif
  38. #ifdef CONFIG_REMOTE_DEBUG
  39. extern void rs_kgdb_hook(int);
  40. extern void saa9730_kgdb_hook(void);
  41. extern void breakpoint(void);
  42. int remote_debug = 0;
  43. #endif
  44. extern struct rtc_ops atlas_rtc_ops;
  45. extern void mips_reboot_setup(void);
  46. const char *get_system_type(void)
  47. {
  48. return "MIPS Atlas";
  49. }
  50. void __init bus_error_init(void)
  51. {
  52. }
  53. extern void mips_time_init(void);
  54. extern void mips_timer_setup(struct irqaction *irq);
  55. extern unsigned long mips_rtc_get_time(void);
  56. void __init atlas_setup(void)
  57. {
  58. #ifdef CONFIG_REMOTE_DEBUG
  59. int rs_putDebugChar(char);
  60. char rs_getDebugChar(void);
  61. int saa9730_putDebugChar(char);
  62. char saa9730_getDebugChar(void);
  63. extern int (*generic_putDebugChar)(char);
  64. extern char (*generic_getDebugChar)(void);
  65. #endif
  66. char *argptr;
  67. ioport_resource.end = 0x7fffffff;
  68. #ifdef CONFIG_SERIAL_CONSOLE
  69. argptr = prom_getcmdline();
  70. if ((argptr = strstr(argptr, "console=ttyS0")) == NULL) {
  71. int i = 0;
  72. char *s = prom_getenv("modetty0");
  73. while(s[i] >= '0' && s[i] <= '9')
  74. i++;
  75. strcpy(serial_console, "ttyS0,");
  76. strncpy(serial_console + 6, s, i);
  77. prom_printf("Config serial console: %sn", serial_console);
  78. console_setup(serial_console, NULL);
  79. }
  80. #endif
  81. #ifdef CONFIG_REMOTE_DEBUG
  82. argptr = prom_getcmdline();
  83. if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
  84. int line;
  85. argptr += strlen("kgdb=ttyS");
  86. if (*argptr != '0' && *argptr != '1')
  87. printk("KGDB: Uknown serial line /dev/ttyS%c, "
  88.        "falling back to /dev/ttyS1n", *argptr);
  89. line = *argptr == '0' ? 0 : 1;
  90. printk("KGDB: Using serial line /dev/ttyS%d for sessionn",
  91.        line ? 1 : 0);
  92. if(line == 0) {
  93. rs_kgdb_hook(line);
  94. generic_putDebugChar = rs_putDebugChar;
  95. generic_getDebugChar = rs_getDebugChar;
  96. } else {
  97. saa9730_kgdb_hook();
  98. generic_putDebugChar = saa9730_putDebugChar;
  99. generic_getDebugChar = saa9730_getDebugChar;
  100. }
  101. prom_printf("KGDB: Using serial line /dev/ttyS%d for session, "
  102.     "please connect your debuggern", line ? 1 : 0);
  103. remote_debug = 1;
  104. /* Breakpoints and stuff are in atlas_irq_setup() */
  105. }
  106. #endif
  107. argptr = prom_getcmdline();
  108. if ((argptr = strstr(argptr, "nofpu")) != NULL)
  109. mips_cpu.options &= ~MIPS_CPU_FPU;
  110. rtc_ops = &atlas_rtc_ops;
  111. board_time_init = mips_time_init;
  112. board_timer_setup = mips_timer_setup;
  113. rtc_get_time = mips_rtc_get_time;
  114. mips_reboot_setup();
  115. }