blob: 3f2cf11f201aaf78ca5999e20d230e36d762ffdd [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Machine specific setup for generic
3 */
4
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#include <linux/smp.h>
6#include <linux/init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#include <linux/interrupt.h>
8#include <asm/acpi.h>
9#include <asm/arch_hooks.h>
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -070010#include <asm/e820.h>
11#include <asm/setup.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
Jaswinder Singh71e3b812008-07-23 17:44:00 +053013#include <mach_ipi.h>
14
Ashok Raj67664c82005-06-25 14:54:52 -070015#ifdef CONFIG_HOTPLUG_CPU
16#define DEFAULT_SEND_IPI (1)
17#else
18#define DEFAULT_SEND_IPI (0)
19#endif
20
Jaswinder Singh71e3b812008-07-23 17:44:00 +053021int no_broadcast = DEFAULT_SEND_IPI;
Ashok Raj67664c82005-06-25 14:54:52 -070022
Linus Torvalds1da177e2005-04-16 15:20:36 -070023/**
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 **/
32void __init pre_intr_init_hook(void)
33{
Yinghai Lu3c9cb6d2008-07-19 02:07:25 -070034 if (x86_quirks->arch_pre_intr_init) {
35 if (x86_quirks->arch_pre_intr_init())
Ingo Molnar078c0bb2008-07-10 15:48:48 +020036 return;
37 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 init_ISA_irqs();
39}
40
41/*
42 * IRQ2 is cascade interrupt to second interrupt controller
43 */
Thomas Gleixner6a61f6a2007-10-17 18:04:36 +020044static struct irqaction irq2 = {
45 .handler = no_action,
46 .mask = CPU_MASK_NONE,
47 .name = "cascade",
48};
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
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 **/
59void __init intr_init_hook(void)
60{
Yinghai Lu3c9cb6d2008-07-19 02:07:25 -070061 if (x86_quirks->arch_intr_init) {
62 if (x86_quirks->arch_intr_init())
Ingo Molnar078c0bb2008-07-10 15:48:48 +020063 return;
64 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070065#ifdef CONFIG_X86_LOCAL_APIC
66 apic_intr_init();
67#endif
68
69 if (!acpi_ioapic)
70 setup_irq(2, &irq2);
71}
72
73/**
74 * pre_setup_arch_hook - hook called prior to any setup_arch() execution
75 *
76 * Description:
77 * generally used to activate any machine specific identification
Ingo Molnar15e551d2008-07-10 17:02:10 +020078 * routines that may be needed before setup_arch() runs. On Voyager
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 * this is used to get the board revision and type.
80 **/
81void __init pre_setup_arch_hook(void)
82{
83}
84
85/**
86 * trap_init_hook - initialise system specific traps
87 *
88 * Description:
89 * Called as the final act of trap_init(). Used in VISWS to initialise
90 * the various board specific APIC traps.
91 **/
92void __init trap_init_hook(void)
93{
Yinghai Lu3c9cb6d2008-07-19 02:07:25 -070094 if (x86_quirks->arch_trap_init) {
95 if (x86_quirks->arch_trap_init())
Ingo Molnar078c0bb2008-07-10 15:48:48 +020096 return;
97 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070098}
99
Thomas Gleixnere9e2cdb2007-02-16 01:28:04 -0800100static struct irqaction irq0 = {
101 .handler = timer_interrupt,
Bernhard Walleb34942f2007-05-08 00:35:29 -0700102 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
Thomas Gleixnere9e2cdb2007-02-16 01:28:04 -0800103 .mask = CPU_MASK_NONE,
104 .name = "timer"
105};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106
107/**
Yinghai Lu63b5d7a2008-07-19 18:02:26 -0700108 * pre_time_init_hook - do any specific initialisations before.
109 *
110 **/
111void __init pre_time_init_hook(void)
112{
113 if (x86_quirks->arch_pre_time_init)
114 x86_quirks->arch_pre_time_init();
115}
116
117/**
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 * time_init_hook - do any specific initialisations for the system timer.
119 *
120 * Description:
121 * Must plug the system timer interrupt source at HZ into the IRQ listed
122 * in irq_vectors.h:TIMER_IRQ
123 **/
124void __init time_init_hook(void)
125{
Yinghai Lu3c9cb6d2008-07-19 02:07:25 -0700126 if (x86_quirks->arch_time_init) {
Ingo Molnar078c0bb2008-07-10 15:48:48 +0200127 /*
128 * A nonzero return code does not mean failure, it means
129 * that the architecture quirk does not want any
130 * generic (timer) setup to be performed after this:
131 */
Yinghai Lu3c9cb6d2008-07-19 02:07:25 -0700132 if (x86_quirks->arch_time_init())
Ingo Molnar078c0bb2008-07-10 15:48:48 +0200133 return;
134 }
135
Thomas Gleixnere9e2cdb2007-02-16 01:28:04 -0800136 irq0.mask = cpumask_of_cpu(0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 setup_irq(0, &irq0);
138}
139
140#ifdef CONFIG_MCA
141/**
142 * mca_nmi_hook - hook into MCA specific NMI chain
143 *
144 * Description:
Simon Arlott27b46d72007-10-20 01:13:56 +0200145 * The MCA (Microchannel Architecture) has an NMI chain for NMI sources
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146 * along the MCA bus. Use this to hook into that chain if you will need
147 * it.
148 **/
Al Viroaaba6d42007-02-01 13:52:28 +0000149void mca_nmi_hook(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150{
151 /* If I recall correctly, there's a whole bunch of other things that
152 * we can do to check for NMI problems, but that's all I know about
153 * at the moment.
154 */
155
156 printk("NMI generated from unknown source!\n");
157}
158#endif
Ashok Raj67664c82005-06-25 14:54:52 -0700159
160static __init int no_ipi_broadcast(char *str)
161{
162 get_option(&str, &no_broadcast);
163 printk ("Using %s mode\n", no_broadcast ? "No IPI Broadcast" :
164 "IPI Broadcast");
165 return 1;
166}
167
Robert P. J. Day4aad7942007-10-20 00:19:06 +0200168__setup("no_ipi_broadcast=", no_ipi_broadcast);
Ashok Raj67664c82005-06-25 14:54:52 -0700169
170static int __init print_ipi_mode(void)
171{
172 printk ("Using IPI %s mode\n", no_broadcast ? "No-Shortcut" :
173 "Shortcut");
174 return 0;
175}
176
177late_initcall(print_ipi_mode);
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -0700178