ip22-setup.c 2.6 KB

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