ip22-setup.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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/ds1286.h>
  8. #include <linux/init.h>
  9. #include <linux/kernel.h>
  10. #include <linux/kdev_t.h>
  11. #include <linux/types.h>
  12. #include <linux/module.h>
  13. #include <linux/console.h>
  14. #include <linux/sched.h>
  15. #include <linux/tty.h>
  16. #include <asm/addrspace.h>
  17. #include <asm/bcache.h>
  18. #include <asm/bootinfo.h>
  19. #include <asm/irq.h>
  20. #include <asm/reboot.h>
  21. #include <asm/time.h>
  22. #include <asm/gdb-stub.h>
  23. #include <asm/io.h>
  24. #include <asm/traps.h>
  25. #include <asm/sgialib.h>
  26. #include <asm/sgi/mc.h>
  27. #include <asm/sgi/hpc3.h>
  28. #include <asm/sgi/ip22.h>
  29. unsigned long sgi_gfxaddr;
  30. EXPORT_SYMBOL_GPL(sgi_gfxaddr);
  31. extern void ip22_be_init(void) __init;
  32. void __init plat_mem_setup(void)
  33. {
  34. char *ctype;
  35. char *cserial;
  36. board_be_init = ip22_be_init;
  37. /* Init the INDY HPC I/O controller. Need to call this before
  38. * fucking with the memory controller because it needs to know the
  39. * boardID and whether this is a Guiness or a FullHouse machine.
  40. */
  41. sgihpc_init();
  42. /* Init INDY memory controller. */
  43. sgimc_init();
  44. #ifdef CONFIG_BOARD_SCACHE
  45. /* Now enable boardcaches, if any. */
  46. indy_sc_init();
  47. #endif
  48. /* Set EISA IO port base for Indigo2
  49. * ioremap cannot fail */
  50. set_io_port_base((unsigned long)ioremap(0x00080000,
  51. 0x1fffffff - 0x00080000));
  52. /* ARCS console environment variable is set to "g?" for
  53. * graphics console, it is set to "d" for the first serial
  54. * line and "d2" for the second serial line.
  55. *
  56. * Need to check if the case is 'g' but no keyboard:
  57. * (ConsoleIn/Out = serial)
  58. */
  59. ctype = ArcGetEnvironmentVariable("console");
  60. cserial = ArcGetEnvironmentVariable("ConsoleOut");
  61. if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
  62. static char options[8];
  63. char *baud = ArcGetEnvironmentVariable("dbaud");
  64. if (baud)
  65. strcpy(options, baud);
  66. add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
  67. baud ? options : NULL);
  68. } else if (!ctype || *ctype != 'g') {
  69. /* Use ARC if we don't want serial ('d') or graphics ('g'). */
  70. prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
  71. add_preferred_console("arc", 0, NULL);
  72. }
  73. #ifdef CONFIG_KGDB
  74. {
  75. char *kgdb_ttyd = prom_getcmdline();
  76. if ((kgdb_ttyd = strstr(kgdb_ttyd, "kgdb=ttyd")) != NULL) {
  77. int line;
  78. kgdb_ttyd += strlen("kgdb=ttyd");
  79. if (*kgdb_ttyd != '1' && *kgdb_ttyd != '2')
  80. printk(KERN_INFO "KGDB: Uknown serial line /dev/ttyd%c"
  81. ", falling back to /dev/ttyd1\n", *kgdb_ttyd);
  82. line = *kgdb_ttyd == '2' ? 0 : 1;
  83. printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
  84. "session\n", line ? 1 : 2);
  85. rs_kgdb_hook(line);
  86. printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
  87. "session, please connect your debugger\n", line ? 1:2);
  88. kgdb_enabled = 1;
  89. /* Breakpoints and stuff are in sgi_irq_setup() */
  90. }
  91. }
  92. #endif
  93. #if defined(CONFIG_VT) && defined(CONFIG_SGI_NEWPORT_CONSOLE)
  94. {
  95. ULONG *gfxinfo;
  96. ULONG * (*__vec)(void) = (void *) (long)
  97. *((_PULONG *)(long)((PROMBLOCK)->pvector + 0x20));
  98. gfxinfo = __vec();
  99. sgi_gfxaddr = ((gfxinfo[1] >= 0xa0000000
  100. && gfxinfo[1] <= 0xc0000000)
  101. ? gfxinfo[1] - 0xa0000000 : 0);
  102. /* newport addresses? */
  103. if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) {
  104. conswitchp = &newport_con;
  105. }
  106. }
  107. #endif
  108. }