setup.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Machine specific setup for generic
  3. */
  4. #include <linux/init.h>
  5. #include <linux/interrupt.h>
  6. #include <asm/arch_hooks.h>
  7. #include <asm/voyager.h>
  8. #include <asm/e820.h>
  9. #include <asm/io.h>
  10. #include <asm/setup.h>
  11. #include <asm/cpu.h>
  12. void __init pre_intr_init_hook(void)
  13. {
  14. init_ISA_irqs();
  15. }
  16. /*
  17. * IRQ2 is cascade interrupt to second interrupt controller
  18. */
  19. static struct irqaction irq2 = {
  20. .handler = no_action,
  21. .mask = CPU_MASK_NONE,
  22. .name = "cascade",
  23. };
  24. void __init intr_init_hook(void)
  25. {
  26. #ifdef CONFIG_SMP
  27. voyager_smp_intr_init();
  28. #endif
  29. setup_irq(2, &irq2);
  30. }
  31. static void voyager_disable_tsc(void)
  32. {
  33. /* Voyagers run their CPUs from independent clocks, so disable
  34. * the TSC code because we can't sync them */
  35. setup_clear_cpu_cap(X86_FEATURE_TSC);
  36. }
  37. void __init pre_setup_arch_hook(void)
  38. {
  39. voyager_disable_tsc();
  40. }
  41. void __init pre_time_init_hook(void)
  42. {
  43. voyager_disable_tsc();
  44. }
  45. void __init trap_init_hook(void)
  46. {
  47. }
  48. static struct irqaction irq0 = {
  49. .handler = timer_interrupt,
  50. .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
  51. .mask = CPU_MASK_NONE,
  52. .name = "timer"
  53. };
  54. void __init time_init_hook(void)
  55. {
  56. irq0.mask = cpumask_of_cpu(safe_smp_processor_id());
  57. setup_irq(0, &irq0);
  58. }
  59. /* Hook for machine specific memory setup. */
  60. char *__init machine_specific_memory_setup(void)
  61. {
  62. char *who;
  63. int new_nr;
  64. who = "NOT VOYAGER";
  65. if (voyager_level == 5) {
  66. __u32 addr, length;
  67. int i;
  68. who = "Voyager-SUS";
  69. e820.nr_map = 0;
  70. for (i = 0; voyager_memory_detect(i, &addr, &length); i++) {
  71. e820_add_region(addr, length, E820_RAM);
  72. }
  73. return who;
  74. } else if (voyager_level == 4) {
  75. __u32 tom;
  76. __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT) << 8;
  77. /* select the DINO config space */
  78. outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT);
  79. /* Read DINO top of memory register */
  80. tom = ((inb(catbase + 0x4) & 0xf0) << 16)
  81. + ((inb(catbase + 0x5) & 0x7f) << 24);
  82. if (inb(catbase) != VOYAGER_DINO) {
  83. printk(KERN_ERR
  84. "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n");
  85. tom = (boot_params.screen_info.ext_mem_k) << 10;
  86. }
  87. who = "Voyager-TOM";
  88. e820_add_region(0, 0x9f000, E820_RAM);
  89. /* map from 1M to top of memory */
  90. e820_add_region(1 * 1024 * 1024, tom - 1 * 1024 * 1024,
  91. E820_RAM);
  92. /* FIXME: Should check the ASICs to see if I need to
  93. * take out the 8M window. Just do it at the moment
  94. * */
  95. e820_add_region(8 * 1024 * 1024, 8 * 1024 * 1024,
  96. E820_RESERVED);
  97. return who;
  98. }
  99. return default_machine_specific_memory_setup();
  100. }