setup.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. void __init pre_intr_init_hook(void)
  12. {
  13. init_ISA_irqs();
  14. }
  15. /*
  16. * IRQ2 is cascade interrupt to second interrupt controller
  17. */
  18. static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL};
  19. void __init intr_init_hook(void)
  20. {
  21. #ifdef CONFIG_SMP
  22. smp_intr_init();
  23. #endif
  24. setup_irq(2, &irq2);
  25. }
  26. void __init pre_setup_arch_hook(void)
  27. {
  28. /* Voyagers run their CPUs from independent clocks, so disable
  29. * the TSC code because we can't sync them */
  30. tsc_disable = 1;
  31. }
  32. void __init trap_init_hook(void)
  33. {
  34. }
  35. static struct irqaction irq0 = {
  36. .handler = timer_interrupt,
  37. .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
  38. .mask = CPU_MASK_NONE,
  39. .name = "timer"
  40. };
  41. void __init time_init_hook(void)
  42. {
  43. irq0.mask = cpumask_of_cpu(safe_smp_processor_id());
  44. setup_irq(0, &irq0);
  45. }
  46. /* Hook for machine specific memory setup. */
  47. char * __init machine_specific_memory_setup(void)
  48. {
  49. char *who;
  50. who = "NOT VOYAGER";
  51. if(voyager_level == 5) {
  52. __u32 addr, length;
  53. int i;
  54. who = "Voyager-SUS";
  55. e820.nr_map = 0;
  56. for(i=0; voyager_memory_detect(i, &addr, &length); i++) {
  57. add_memory_region(addr, length, E820_RAM);
  58. }
  59. return who;
  60. } else if(voyager_level == 4) {
  61. __u32 tom;
  62. __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT)<<8;
  63. /* select the DINO config space */
  64. outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT);
  65. /* Read DINO top of memory register */
  66. tom = ((inb(catbase + 0x4) & 0xf0) << 16)
  67. + ((inb(catbase + 0x5) & 0x7f) << 24);
  68. if(inb(catbase) != VOYAGER_DINO) {
  69. printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n");
  70. tom = (EXT_MEM_K)<<10;
  71. }
  72. who = "Voyager-TOM";
  73. add_memory_region(0, 0x9f000, E820_RAM);
  74. /* map from 1M to top of memory */
  75. add_memory_region(1*1024*1024, tom - 1*1024*1024, E820_RAM);
  76. /* FIXME: Should check the ASICs to see if I need to
  77. * take out the 8M window. Just do it at the moment
  78. * */
  79. add_memory_region(8*1024*1024, 8*1024*1024, E820_RESERVED);
  80. return who;
  81. }
  82. who = "BIOS-e820";
  83. /*
  84. * Try to copy the BIOS-supplied E820-map.
  85. *
  86. * Otherwise fake a memory map; one section from 0k->640k,
  87. * the next section from 1mb->appropriate_mem_k
  88. */
  89. sanitize_e820_map(E820_MAP, &E820_MAP_NR);
  90. if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) {
  91. unsigned long mem_size;
  92. /* compare results from other methods and take the greater */
  93. if (ALT_MEM_K < EXT_MEM_K) {
  94. mem_size = EXT_MEM_K;
  95. who = "BIOS-88";
  96. } else {
  97. mem_size = ALT_MEM_K;
  98. who = "BIOS-e801";
  99. }
  100. e820.nr_map = 0;
  101. add_memory_region(0, LOWMEMSIZE(), E820_RAM);
  102. add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
  103. }
  104. return who;
  105. }