]> nv-tegra.nvidia Code Review - linux-2.6.git/blob - arch/i386/mach-default/setup.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
[linux-2.6.git] / arch / i386 / mach-default / setup.c
1 /*
2  *      Machine specific setup for generic
3  */
4
5 #include <linux/config.h>
6 #include <linux/smp.h>
7 #include <linux/init.h>
8 #include <linux/interrupt.h>
9 #include <asm/acpi.h>
10 #include <asm/arch_hooks.h>
11 #include <asm/e820.h>
12 #include <asm/setup.h>
13
14 #ifdef CONFIG_HOTPLUG_CPU
15 #define DEFAULT_SEND_IPI        (1)
16 #else
17 #define DEFAULT_SEND_IPI        (0)
18 #endif
19
20 int no_broadcast=DEFAULT_SEND_IPI;
21
22 /**
23  * pre_intr_init_hook - initialisation prior to setting up interrupt vectors
24  *
25  * Description:
26  *      Perform any necessary interrupt initialisation prior to setting up
27  *      the "ordinary" interrupt call gates.  For legacy reasons, the ISA
28  *      interrupts should be initialised here if the machine emulates a PC
29  *      in any way.
30  **/
31 void __init pre_intr_init_hook(void)
32 {
33         init_ISA_irqs();
34 }
35
36 /*
37  * IRQ2 is cascade interrupt to second interrupt controller
38  */
39 static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL};
40
41 /**
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  **/
50 void __init intr_init_hook(void)
51 {
52 #ifdef CONFIG_X86_LOCAL_APIC
53         apic_intr_init();
54 #endif
55
56         if (!acpi_ioapic)
57                 setup_irq(2, &irq2);
58 }
59
60 /**
61  * pre_setup_arch_hook - hook called prior to any setup_arch() execution
62  *
63  * Description:
64  *      generally used to activate any machine specific identification
65  *      routines that may be needed before setup_arch() runs.  On VISWS
66  *      this is used to get the board revision and type.
67  **/
68 void __init pre_setup_arch_hook(void)
69 {
70 }
71
72 /**
73  * trap_init_hook - initialise system specific traps
74  *
75  * Description:
76  *      Called as the final act of trap_init().  Used in VISWS to initialise
77  *      the various board specific APIC traps.
78  **/
79 void __init trap_init_hook(void)
80 {
81 }
82
83 static struct irqaction irq0  = { timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer", NULL, NULL};
84
85 /**
86  * time_init_hook - do any specific initialisations for the system timer.
87  *
88  * Description:
89  *      Must plug the system timer interrupt source at HZ into the IRQ listed
90  *      in irq_vectors.h:TIMER_IRQ
91  **/
92 void __init time_init_hook(void)
93 {
94         setup_irq(0, &irq0);
95 }
96
97 #ifdef CONFIG_MCA
98 /**
99  * mca_nmi_hook - hook into MCA specific NMI chain
100  *
101  * Description:
102  *      The MCA (Microchannel Arcitecture) has an NMI chain for NMI sources
103  *      along the MCA bus.  Use this to hook into that chain if you will need
104  *      it.
105  **/
106 void __init mca_nmi_hook(void)
107 {
108         /* If I recall correctly, there's a whole bunch of other things that
109          * we can do to check for NMI problems, but that's all I know about
110          * at the moment.
111          */
112
113         printk("NMI generated from unknown source!\n");
114 }
115 #endif
116
117 static __init int no_ipi_broadcast(char *str)
118 {
119         get_option(&str, &no_broadcast);
120         printk ("Using %s mode\n", no_broadcast ? "No IPI Broadcast" :
121                                                                                         "IPI Broadcast");
122         return 1;
123 }
124
125 __setup("no_ipi_broadcast", no_ipi_broadcast);
126
127 static int __init print_ipi_mode(void)
128 {
129         printk ("Using IPI %s mode\n", no_broadcast ? "No-Shortcut" :
130                                                                                         "Shortcut");
131         return 0;
132 }
133
134 late_initcall(print_ipi_mode);
135
136 /**
137  * machine_specific_memory_setup - Hook for machine specific memory setup.
138  *
139  * Description:
140  *      This is included late in kernel/setup.c so that it can make
141  *      use of all of the static functions.
142  **/
143
144 char * __init machine_specific_memory_setup(void)
145 {
146         char *who;
147
148
149         who = "BIOS-e820";
150
151         /*
152          * Try to copy the BIOS-supplied E820-map.
153          *
154          * Otherwise fake a memory map; one section from 0k->640k,
155          * the next section from 1mb->appropriate_mem_k
156          */
157         sanitize_e820_map(E820_MAP, &E820_MAP_NR);
158         if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) {
159                 unsigned long mem_size;
160
161                 /* compare results from other methods and take the greater */
162                 if (ALT_MEM_K < EXT_MEM_K) {
163                         mem_size = EXT_MEM_K;
164                         who = "BIOS-88";
165                 } else {
166                         mem_size = ALT_MEM_K;
167                         who = "BIOS-e801";
168                 }
169
170                 e820.nr_map = 0;
171                 add_memory_region(0, LOWMEMSIZE(), E820_RAM);
172                 add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
173         }
174         return who;
175 }