blob: df167f2656228c83eb58ce2ebd4600074d766e77 [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
Linus Torvalds1da177e2005-04-16 15:20:36 -070041/**
42 * intr_init_hook - post gate setup interrupt initialisation
43 *
44 * Description:
45 * Fill in any interrupts that may have been left out by the general
46 * init_IRQ() routine. interrupts having to do with the machine rather
47 * than the devices on the I/O bus (like APIC interrupts in intel MP
48 * systems) are started here.
49 **/
50void __init intr_init_hook(void)
51{
Yinghai Lu3c9cb6d2008-07-19 02:07:25 -070052 if (x86_quirks->arch_intr_init) {
53 if (x86_quirks->arch_intr_init())
Ingo Molnar078c0bb2008-07-10 15:48:48 +020054 return;
55 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070056}
57
58/**
59 * pre_setup_arch_hook - hook called prior to any setup_arch() execution
60 *
61 * Description:
62 * generally used to activate any machine specific identification
Ingo Molnar15e551d2008-07-10 17:02:10 +020063 * routines that may be needed before setup_arch() runs. On Voyager
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 * this is used to get the board revision and type.
65 **/
66void __init pre_setup_arch_hook(void)
67{
68}
69
70/**
71 * trap_init_hook - initialise system specific traps
72 *
73 * Description:
74 * Called as the final act of trap_init(). Used in VISWS to initialise
75 * the various board specific APIC traps.
76 **/
77void __init trap_init_hook(void)
78{
Yinghai Lu3c9cb6d2008-07-19 02:07:25 -070079 if (x86_quirks->arch_trap_init) {
80 if (x86_quirks->arch_trap_init())
Ingo Molnar078c0bb2008-07-10 15:48:48 +020081 return;
82 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070083}
84
Thomas Gleixnere9e2cdb2007-02-16 01:28:04 -080085static struct irqaction irq0 = {
86 .handler = timer_interrupt,
Bernhard Walleb34942f2007-05-08 00:35:29 -070087 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
Thomas Gleixnere9e2cdb2007-02-16 01:28:04 -080088 .mask = CPU_MASK_NONE,
89 .name = "timer"
90};
Linus Torvalds1da177e2005-04-16 15:20:36 -070091
92/**
Yinghai Lu63b5d7a2008-07-19 18:02:26 -070093 * pre_time_init_hook - do any specific initialisations before.
94 *
95 **/
96void __init pre_time_init_hook(void)
97{
98 if (x86_quirks->arch_pre_time_init)
99 x86_quirks->arch_pre_time_init();
100}
101
102/**
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 * time_init_hook - do any specific initialisations for the system timer.
104 *
105 * Description:
106 * Must plug the system timer interrupt source at HZ into the IRQ listed
107 * in irq_vectors.h:TIMER_IRQ
108 **/
109void __init time_init_hook(void)
110{
Yinghai Lu3c9cb6d2008-07-19 02:07:25 -0700111 if (x86_quirks->arch_time_init) {
Ingo Molnar078c0bb2008-07-10 15:48:48 +0200112 /*
113 * A nonzero return code does not mean failure, it means
114 * that the architecture quirk does not want any
115 * generic (timer) setup to be performed after this:
116 */
Yinghai Lu3c9cb6d2008-07-19 02:07:25 -0700117 if (x86_quirks->arch_time_init())
Ingo Molnar078c0bb2008-07-10 15:48:48 +0200118 return;
119 }
120
Thomas Gleixnere9e2cdb2007-02-16 01:28:04 -0800121 irq0.mask = cpumask_of_cpu(0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 setup_irq(0, &irq0);
123}
124
125#ifdef CONFIG_MCA
126/**
127 * mca_nmi_hook - hook into MCA specific NMI chain
128 *
129 * Description:
Simon Arlott27b46d72007-10-20 01:13:56 +0200130 * The MCA (Microchannel Architecture) has an NMI chain for NMI sources
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 * along the MCA bus. Use this to hook into that chain if you will need
132 * it.
133 **/
Al Viroaaba6d42007-02-01 13:52:28 +0000134void mca_nmi_hook(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135{
Cyrill Gorcunovc805b732008-12-27 17:10:18 +0300136 /*
137 * If I recall correctly, there's a whole bunch of other things that
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 * we can do to check for NMI problems, but that's all I know about
139 * at the moment.
140 */
Cyrill Gorcunovc805b732008-12-27 17:10:18 +0300141 pr_warning("NMI generated from unknown source!\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142}
143#endif
Ashok Raj67664c82005-06-25 14:54:52 -0700144
145static __init int no_ipi_broadcast(char *str)
146{
147 get_option(&str, &no_broadcast);
Cyrill Gorcunovc805b732008-12-27 17:10:18 +0300148 pr_info("Using %s mode\n",
149 no_broadcast ? "No IPI Broadcast" : "IPI Broadcast");
Ashok Raj67664c82005-06-25 14:54:52 -0700150 return 1;
151}
Robert P. J. Day4aad7942007-10-20 00:19:06 +0200152__setup("no_ipi_broadcast=", no_ipi_broadcast);
Ashok Raj67664c82005-06-25 14:54:52 -0700153
154static int __init print_ipi_mode(void)
155{
Cyrill Gorcunovc805b732008-12-27 17:10:18 +0300156 pr_info("Using IPI %s mode\n",
157 no_broadcast ? "No-Shortcut" : "Shortcut");
Ashok Raj67664c82005-06-25 14:54:52 -0700158 return 0;
159}
160
161late_initcall(print_ipi_mode);
Jeremy Fitzhardingee75eac32006-06-25 05:46:50 -0700162