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