setup.c 4.1 KB

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