setup.c 2.7 KB

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