Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Machine specific setup for generic |
| 3 | */ |
| 4 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | #include <linux/smp.h> |
| 6 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | #include <linux/interrupt.h> |
| 8 | #include <asm/acpi.h> |
| 9 | #include <asm/arch_hooks.h> |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 10 | #include <asm/e820.h> |
| 11 | #include <asm/setup.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | |
Ashok Raj | 67664c8 | 2005-06-25 14:54:52 -0700 | [diff] [blame] | 13 | #ifdef CONFIG_HOTPLUG_CPU |
| 14 | #define DEFAULT_SEND_IPI (1) |
| 15 | #else |
| 16 | #define DEFAULT_SEND_IPI (0) |
| 17 | #endif |
| 18 | |
| 19 | int no_broadcast=DEFAULT_SEND_IPI; |
| 20 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | /** |
| 22 | * pre_intr_init_hook - initialisation prior to setting up interrupt vectors |
| 23 | * |
| 24 | * Description: |
| 25 | * Perform any necessary interrupt initialisation prior to setting up |
| 26 | * the "ordinary" interrupt call gates. For legacy reasons, the ISA |
| 27 | * interrupts should be initialised here if the machine emulates a PC |
| 28 | * in any way. |
| 29 | **/ |
| 30 | void __init pre_intr_init_hook(void) |
| 31 | { |
Yinghai Lu | 3c9cb6d | 2008-07-19 02:07:25 -0700 | [diff] [blame] | 32 | if (x86_quirks->arch_pre_intr_init) { |
| 33 | if (x86_quirks->arch_pre_intr_init()) |
Ingo Molnar | 078c0bb | 2008-07-10 15:48:48 +0200 | [diff] [blame] | 34 | return; |
| 35 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | init_ISA_irqs(); |
| 37 | } |
| 38 | |
| 39 | /* |
| 40 | * IRQ2 is cascade interrupt to second interrupt controller |
| 41 | */ |
Thomas Gleixner | 6a61f6a | 2007-10-17 18:04:36 +0200 | [diff] [blame] | 42 | static struct irqaction irq2 = { |
| 43 | .handler = no_action, |
| 44 | .mask = CPU_MASK_NONE, |
| 45 | .name = "cascade", |
| 46 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * intr_init_hook - post gate setup interrupt initialisation |
| 50 | * |
| 51 | * Description: |
| 52 | * Fill in any interrupts that may have been left out by the general |
| 53 | * init_IRQ() routine. interrupts having to do with the machine rather |
| 54 | * than the devices on the I/O bus (like APIC interrupts in intel MP |
| 55 | * systems) are started here. |
| 56 | **/ |
| 57 | void __init intr_init_hook(void) |
| 58 | { |
Yinghai Lu | 3c9cb6d | 2008-07-19 02:07:25 -0700 | [diff] [blame] | 59 | if (x86_quirks->arch_intr_init) { |
| 60 | if (x86_quirks->arch_intr_init()) |
Ingo Molnar | 078c0bb | 2008-07-10 15:48:48 +0200 | [diff] [blame] | 61 | return; |
| 62 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | #ifdef CONFIG_X86_LOCAL_APIC |
| 64 | apic_intr_init(); |
| 65 | #endif |
| 66 | |
| 67 | if (!acpi_ioapic) |
| 68 | setup_irq(2, &irq2); |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * pre_setup_arch_hook - hook called prior to any setup_arch() execution |
| 73 | * |
| 74 | * Description: |
| 75 | * generally used to activate any machine specific identification |
Ingo Molnar | 15e551d | 2008-07-10 17:02:10 +0200 | [diff] [blame] | 76 | * routines that may be needed before setup_arch() runs. On Voyager |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | * this is used to get the board revision and type. |
| 78 | **/ |
| 79 | void __init pre_setup_arch_hook(void) |
| 80 | { |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * trap_init_hook - initialise system specific traps |
| 85 | * |
| 86 | * Description: |
| 87 | * Called as the final act of trap_init(). Used in VISWS to initialise |
| 88 | * the various board specific APIC traps. |
| 89 | **/ |
| 90 | void __init trap_init_hook(void) |
| 91 | { |
Yinghai Lu | 3c9cb6d | 2008-07-19 02:07:25 -0700 | [diff] [blame] | 92 | if (x86_quirks->arch_trap_init) { |
| 93 | if (x86_quirks->arch_trap_init()) |
Ingo Molnar | 078c0bb | 2008-07-10 15:48:48 +0200 | [diff] [blame] | 94 | return; |
| 95 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | } |
| 97 | |
Thomas Gleixner | e9e2cdb | 2007-02-16 01:28:04 -0800 | [diff] [blame] | 98 | static struct irqaction irq0 = { |
| 99 | .handler = timer_interrupt, |
Bernhard Walle | b34942f | 2007-05-08 00:35:29 -0700 | [diff] [blame] | 100 | .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL, |
Thomas Gleixner | e9e2cdb | 2007-02-16 01:28:04 -0800 | [diff] [blame] | 101 | .mask = CPU_MASK_NONE, |
| 102 | .name = "timer" |
| 103 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | |
| 105 | /** |
Yinghai Lu | 63b5d7a | 2008-07-19 18:02:26 -0700 | [diff] [blame] | 106 | * pre_time_init_hook - do any specific initialisations before. |
| 107 | * |
| 108 | **/ |
| 109 | void __init pre_time_init_hook(void) |
| 110 | { |
| 111 | if (x86_quirks->arch_pre_time_init) |
| 112 | x86_quirks->arch_pre_time_init(); |
| 113 | } |
| 114 | |
| 115 | /** |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | * time_init_hook - do any specific initialisations for the system timer. |
| 117 | * |
| 118 | * Description: |
| 119 | * Must plug the system timer interrupt source at HZ into the IRQ listed |
| 120 | * in irq_vectors.h:TIMER_IRQ |
| 121 | **/ |
| 122 | void __init time_init_hook(void) |
| 123 | { |
Yinghai Lu | 3c9cb6d | 2008-07-19 02:07:25 -0700 | [diff] [blame] | 124 | if (x86_quirks->arch_time_init) { |
Ingo Molnar | 078c0bb | 2008-07-10 15:48:48 +0200 | [diff] [blame] | 125 | /* |
| 126 | * A nonzero return code does not mean failure, it means |
| 127 | * that the architecture quirk does not want any |
| 128 | * generic (timer) setup to be performed after this: |
| 129 | */ |
Yinghai Lu | 3c9cb6d | 2008-07-19 02:07:25 -0700 | [diff] [blame] | 130 | if (x86_quirks->arch_time_init()) |
Ingo Molnar | 078c0bb | 2008-07-10 15:48:48 +0200 | [diff] [blame] | 131 | return; |
| 132 | } |
| 133 | |
Thomas Gleixner | e9e2cdb | 2007-02-16 01:28:04 -0800 | [diff] [blame] | 134 | irq0.mask = cpumask_of_cpu(0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | setup_irq(0, &irq0); |
| 136 | } |
| 137 | |
| 138 | #ifdef CONFIG_MCA |
| 139 | /** |
| 140 | * mca_nmi_hook - hook into MCA specific NMI chain |
| 141 | * |
| 142 | * Description: |
Simon Arlott | 27b46d7 | 2007-10-20 01:13:56 +0200 | [diff] [blame] | 143 | * The MCA (Microchannel Architecture) has an NMI chain for NMI sources |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | * along the MCA bus. Use this to hook into that chain if you will need |
| 145 | * it. |
| 146 | **/ |
Al Viro | aaba6d4 | 2007-02-01 13:52:28 +0000 | [diff] [blame] | 147 | void mca_nmi_hook(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | { |
| 149 | /* If I recall correctly, there's a whole bunch of other things that |
| 150 | * we can do to check for NMI problems, but that's all I know about |
| 151 | * at the moment. |
| 152 | */ |
| 153 | |
| 154 | printk("NMI generated from unknown source!\n"); |
| 155 | } |
| 156 | #endif |
Ashok Raj | 67664c8 | 2005-06-25 14:54:52 -0700 | [diff] [blame] | 157 | |
| 158 | static __init int no_ipi_broadcast(char *str) |
| 159 | { |
| 160 | get_option(&str, &no_broadcast); |
| 161 | printk ("Using %s mode\n", no_broadcast ? "No IPI Broadcast" : |
| 162 | "IPI Broadcast"); |
| 163 | return 1; |
| 164 | } |
| 165 | |
Robert P. J. Day | 4aad794 | 2007-10-20 00:19:06 +0200 | [diff] [blame] | 166 | __setup("no_ipi_broadcast=", no_ipi_broadcast); |
Ashok Raj | 67664c8 | 2005-06-25 14:54:52 -0700 | [diff] [blame] | 167 | |
| 168 | static int __init print_ipi_mode(void) |
| 169 | { |
| 170 | printk ("Using IPI %s mode\n", no_broadcast ? "No-Shortcut" : |
| 171 | "Shortcut"); |
| 172 | return 0; |
| 173 | } |
| 174 | |
| 175 | late_initcall(print_ipi_mode); |
Jeremy Fitzhardinge | e75eac3 | 2006-06-25 05:46:50 -0700 | [diff] [blame] | 176 | |