ip22-setup.c 2.6 KB

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