setup.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * Machine specific setup for generic
  3. */
  4. #include <linux/smp.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/e820.h>
  10. #include <asm/setup.h>
  11. #ifdef CONFIG_HOTPLUG_CPU
  12. #define DEFAULT_SEND_IPI (1)
  13. #else
  14. #define DEFAULT_SEND_IPI (0)
  15. #endif
  16. int no_broadcast=DEFAULT_SEND_IPI;
  17. /**
  18. * pre_intr_init_hook - initialisation prior to setting up interrupt vectors
  19. *
  20. * Description:
  21. * Perform any necessary interrupt initialisation prior to setting up
  22. * the "ordinary" interrupt call gates. For legacy reasons, the ISA
  23. * interrupts should be initialised here if the machine emulates a PC
  24. * in any way.
  25. **/
  26. void __init pre_intr_init_hook(void)
  27. {
  28. init_ISA_irqs();
  29. }
  30. /*
  31. * IRQ2 is cascade interrupt to second interrupt controller
  32. */
  33. static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL};
  34. /**
  35. * intr_init_hook - post gate setup interrupt initialisation
  36. *
  37. * Description:
  38. * Fill in any interrupts that may have been left out by the general
  39. * init_IRQ() routine. interrupts having to do with the machine rather
  40. * than the devices on the I/O bus (like APIC interrupts in intel MP
  41. * systems) are started here.
  42. **/
  43. void __init intr_init_hook(void)
  44. {
  45. #ifdef CONFIG_X86_LOCAL_APIC
  46. apic_intr_init();
  47. #endif
  48. if (!acpi_ioapic)
  49. setup_irq(2, &irq2);
  50. }
  51. /**
  52. * pre_setup_arch_hook - hook called prior to any setup_arch() execution
  53. *
  54. * Description:
  55. * generally used to activate any machine specific identification
  56. * routines that may be needed before setup_arch() runs. On VISWS
  57. * this is used to get the board revision and type.
  58. **/
  59. void __init pre_setup_arch_hook(void)
  60. {
  61. }
  62. /**
  63. * trap_init_hook - initialise system specific traps
  64. *
  65. * Description:
  66. * Called as the final act of trap_init(). Used in VISWS to initialise
  67. * the various board specific APIC traps.
  68. **/
  69. void __init trap_init_hook(void)
  70. {
  71. }
  72. static struct irqaction irq0 = {
  73. .handler = timer_interrupt,
  74. .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
  75. .mask = CPU_MASK_NONE,
  76. .name = "timer"
  77. };
  78. /**
  79. * time_init_hook - do any specific initialisations for the system timer.
  80. *
  81. * Description:
  82. * Must plug the system timer interrupt source at HZ into the IRQ listed
  83. * in irq_vectors.h:TIMER_IRQ
  84. **/
  85. void __init time_init_hook(void)
  86. {
  87. irq0.mask = cpumask_of_cpu(0);
  88. setup_irq(0, &irq0);
  89. }
  90. #ifdef CONFIG_MCA
  91. /**
  92. * mca_nmi_hook - hook into MCA specific NMI chain
  93. *
  94. * Description:
  95. * The MCA (Microchannel Arcitecture) has an NMI chain for NMI sources
  96. * along the MCA bus. Use this to hook into that chain if you will need
  97. * it.
  98. **/
  99. void mca_nmi_hook(void)
  100. {
  101. /* If I recall correctly, there's a whole bunch of other things that
  102. * we can do to check for NMI problems, but that's all I know about
  103. * at the moment.
  104. */
  105. printk("NMI generated from unknown source!\n");
  106. }
  107. #endif
  108. static __init int no_ipi_broadcast(char *str)
  109. {
  110. get_option(&str, &no_broadcast);
  111. printk ("Using %s mode\n", no_broadcast ? "No IPI Broadcast" :
  112. "IPI Broadcast");
  113. return 1;
  114. }
  115. __setup("no_ipi_broadcast", no_ipi_broadcast);
  116. static int __init print_ipi_mode(void)
  117. {
  118. printk ("Using IPI %s mode\n", no_broadcast ? "No-Shortcut" :
  119. "Shortcut");
  120. return 0;
  121. }
  122. late_initcall(print_ipi_mode);
  123. /**
  124. * machine_specific_memory_setup - Hook for machine specific memory setup.
  125. *
  126. * Description:
  127. * This is included late in kernel/setup.c so that it can make
  128. * use of all of the static functions.
  129. **/
  130. char * __init machine_specific_memory_setup(void)
  131. {
  132. char *who;
  133. who = "BIOS-e820";
  134. /*
  135. * Try to copy the BIOS-supplied E820-map.
  136. *
  137. * Otherwise fake a memory map; one section from 0k->640k,
  138. * the next section from 1mb->appropriate_mem_k
  139. */
  140. sanitize_e820_map(E820_MAP, &E820_MAP_NR);
  141. if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) {
  142. unsigned long mem_size;
  143. /* compare results from other methods and take the greater */
  144. if (ALT_MEM_K < EXT_MEM_K) {
  145. mem_size = EXT_MEM_K;
  146. who = "BIOS-88";
  147. } else {
  148. mem_size = ALT_MEM_K;
  149. who = "BIOS-e801";
  150. }
  151. e820.nr_map = 0;
  152. add_memory_region(0, LOWMEMSIZE(), E820_RAM);
  153. add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
  154. }
  155. return who;
  156. }