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