ip22-setup.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * ip22-setup.c: SGI specific setup, including init of the feature struct.
  3. *
  4. * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
  5. * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org)
  6. */
  7. #include <linux/config.h>
  8. #include <linux/ds1286.h>
  9. #include <linux/init.h>
  10. #include <linux/kernel.h>
  11. #include <linux/kdev_t.h>
  12. #include <linux/types.h>
  13. #include <linux/module.h>
  14. #include <linux/console.h>
  15. #include <linux/sched.h>
  16. #include <linux/tty.h>
  17. #include <asm/addrspace.h>
  18. #include <asm/bcache.h>
  19. #include <asm/bootinfo.h>
  20. #include <asm/irq.h>
  21. #include <asm/reboot.h>
  22. #include <asm/time.h>
  23. #include <asm/gdb-stub.h>
  24. #include <asm/io.h>
  25. #include <asm/traps.h>
  26. #include <asm/sgialib.h>
  27. #include <asm/sgi/mc.h>
  28. #include <asm/sgi/hpc3.h>
  29. #include <asm/sgi/ip22.h>
  30. unsigned long sgi_gfxaddr;
  31. /*
  32. * Stop-A is originally a Sun thing that isn't standard on IP22 so to avoid
  33. * accidents it's disabled by default on IP22.
  34. *
  35. * FIXME: provide a mechanism to change the value of stop_a_enabled.
  36. */
  37. int stop_a_enabled;
  38. void ip22_do_break(void)
  39. {
  40. if (!stop_a_enabled)
  41. return;
  42. printk("\n");
  43. ArcEnterInteractiveMode();
  44. }
  45. EXPORT_SYMBOL(ip22_do_break);
  46. extern void ip22_be_init(void) __init;
  47. extern void ip22_time_init(void) __init;
  48. void __init plat_setup(void)
  49. {
  50. char *ctype;
  51. char *cserial;
  52. board_be_init = ip22_be_init;
  53. ip22_time_init();
  54. /* Init the INDY HPC I/O controller. Need to call this before
  55. * fucking with the memory controller because it needs to know the
  56. * boardID and whether this is a Guiness or a FullHouse machine.
  57. */
  58. sgihpc_init();
  59. /* Init INDY memory controller. */
  60. sgimc_init();
  61. #ifdef CONFIG_BOARD_SCACHE
  62. /* Now enable boardcaches, if any. */
  63. indy_sc_init();
  64. #endif
  65. /* Set EISA IO port base for Indigo2
  66. * ioremap cannot fail */
  67. set_io_port_base((unsigned long)ioremap(0x00080000,
  68. 0x1fffffff - 0x00080000));
  69. /* ARCS console environment variable is set to "g?" for
  70. * graphics console, it is set to "d" for the first serial
  71. * line and "d2" for the second serial line.
  72. *
  73. * Need to check if the case is 'g' but no keyboard:
  74. * (ConsoleIn/Out = serial)
  75. */
  76. ctype = ArcGetEnvironmentVariable("console");
  77. cserial = ArcGetEnvironmentVariable("ConsoleOut");
  78. if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
  79. static char options[8];
  80. char *baud = ArcGetEnvironmentVariable("dbaud");
  81. if (baud)
  82. strcpy(options, baud);
  83. add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
  84. baud ? options : NULL);
  85. } else if (!ctype || *ctype != 'g') {
  86. /* Use ARC if we don't want serial ('d') or graphics ('g'). */
  87. prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
  88. add_preferred_console("arc", 0, NULL);
  89. }
  90. #ifdef CONFIG_KGDB
  91. {
  92. char *kgdb_ttyd = prom_getcmdline();
  93. if ((kgdb_ttyd = strstr(kgdb_ttyd, "kgdb=ttyd")) != NULL) {
  94. int line;
  95. kgdb_ttyd += strlen("kgdb=ttyd");
  96. if (*kgdb_ttyd != '1' && *kgdb_ttyd != '2')
  97. printk(KERN_INFO "KGDB: Uknown serial line /dev/ttyd%c"
  98. ", falling back to /dev/ttyd1\n", *kgdb_ttyd);
  99. line = *kgdb_ttyd == '2' ? 0 : 1;
  100. printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
  101. "session\n", line ? 1 : 2);
  102. rs_kgdb_hook(line);
  103. printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
  104. "session, please connect your debugger\n", line ? 1:2);
  105. kgdb_enabled = 1;
  106. /* Breakpoints and stuff are in sgi_irq_setup() */
  107. }
  108. }
  109. #endif
  110. #if defined(CONFIG_VT) && defined(CONFIG_SGI_NEWPORT_CONSOLE)
  111. {
  112. ULONG *gfxinfo;
  113. ULONG * (*__vec)(void) = (void *) (long)
  114. *((_PULONG *)(long)((PROMBLOCK)->pvector + 0x20));
  115. gfxinfo = __vec();
  116. sgi_gfxaddr = ((gfxinfo[1] >= 0xa0000000
  117. && gfxinfo[1] <= 0xc0000000)
  118. ? gfxinfo[1] - 0xa0000000 : 0);
  119. /* newport addresses? */
  120. if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) {
  121. conswitchp = &newport_con;
  122. }
  123. }
  124. #endif
  125. }