aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/devicetree.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-02-25 10:09:31 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-02-25 10:18:52 -0500
commita906fdaacca49917d83e5032dfc31f694249ad10 (patch)
tree6b00061e1db64f5f2767c129b666ee25487fd59e /arch/x86/kernel/devicetree.c
parent4a66b1d95ad8baf6ab884a1c64461449b463eb78 (diff)
x86: dt: Cleanup local apic setup
Up to now we force enable the local apic in the devicetree setup uncoditionally and set smp_found_config unconditionally to 1 when a devicetree blob is available. This breaks, when local apic is disabled in the Kconfig. Make it consistent by initializing device tree explicitely before smp_get_config() so a non lapic configuration could be used as well. To be functional that would require to implement PIT as an interrupt host, but the only user of this code until now is ce4100 which requires apics to be available. So we leave this up to those who need it. Tested-by: Sebastian Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/devicetree.c')
-rw-r--r--arch/x86/kernel/devicetree.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index 06e5e91939c5..7a8cebc9ff29 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -26,6 +26,7 @@ static DEFINE_RAW_SPINLOCK(big_irq_lock);
26 26
27int __initdata of_ioapic; 27int __initdata of_ioapic;
28 28
29#ifdef CONFIG_X86_IO_APIC
29static void add_interrupt_host(struct irq_domain *ih) 30static void add_interrupt_host(struct irq_domain *ih)
30{ 31{
31 unsigned long flags; 32 unsigned long flags;
@@ -34,6 +35,7 @@ static void add_interrupt_host(struct irq_domain *ih)
34 list_add(&ih->l, &irq_domains); 35 list_add(&ih->l, &irq_domains);
35 raw_spin_unlock_irqrestore(&big_irq_lock, flags); 36 raw_spin_unlock_irqrestore(&big_irq_lock, flags);
36} 37}
38#endif
37 39
38static struct irq_domain *get_ih_from_node(struct device_node *controller) 40static struct irq_domain *get_ih_from_node(struct device_node *controller)
39{ 41{
@@ -223,18 +225,28 @@ static void __init dtb_setup_hpet(void)
223static void __init dtb_lapic_setup(void) 225static void __init dtb_lapic_setup(void)
224{ 226{
225#ifdef CONFIG_X86_LOCAL_APIC 227#ifdef CONFIG_X86_LOCAL_APIC
226 if (apic_force_enable()) 228 struct device_node *dn;
229 struct resource r;
230 int ret;
231
232 dn = of_find_compatible_node(NULL, NULL, "intel,ce4100-lapic");
233 if (!dn)
234 return;
235
236 ret = of_address_to_resource(dn, 0, &r);
237 if (WARN_ON(ret))
227 return; 238 return;
228 239
240 /* Did the boot loader setup the local APIC ? */
241 if (!cpu_has_apic) {
242 if (apic_force_enable(r.start))
243 return;
244 }
229 smp_found_config = 1; 245 smp_found_config = 1;
230 pic_mode = 1; 246 pic_mode = 1;
231 /* Required for ioapic registration */ 247 register_lapic_address(r.start);
232 set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
233 if (boot_cpu_physical_apicid == -1U)
234 boot_cpu_physical_apicid = read_apic_id();
235
236 generic_processor_info(boot_cpu_physical_apicid, 248 generic_processor_info(boot_cpu_physical_apicid,
237 GET_APIC_VERSION(apic_read(APIC_LVR))); 249 GET_APIC_VERSION(apic_read(APIC_LVR)));
238#endif 250#endif
239} 251}
240 252
@@ -259,9 +271,6 @@ static void __init dtb_ioapic_setup(void)
259{ 271{
260 struct device_node *dn; 272 struct device_node *dn;
261 273
262 if (!smp_found_config)
263 return;
264
265 for_each_compatible_node(dn, NULL, "intel,ce4100-ioapic") 274 for_each_compatible_node(dn, NULL, "intel,ce4100-ioapic")
266 dtb_add_ioapic(dn); 275 dtb_add_ioapic(dn);
267 276
@@ -270,7 +279,6 @@ static void __init dtb_ioapic_setup(void)
270 return; 279 return;
271 } 280 }
272 printk(KERN_ERR "Error: No information about IO-APIC in OF.\n"); 281 printk(KERN_ERR "Error: No information about IO-APIC in OF.\n");
273 smp_found_config = 0;
274} 282}
275#else 283#else
276static void __init dtb_ioapic_setup(void) {} 284static void __init dtb_ioapic_setup(void) {}
@@ -282,14 +290,6 @@ static void __init dtb_apic_setup(void)
282 dtb_ioapic_setup(); 290 dtb_ioapic_setup();
283} 291}
284 292
285void __init x86_dtb_find_config(void)
286{
287 if (initial_dtb)
288 smp_found_config = 1;
289 else
290 printk(KERN_ERR "Missing device tree!.\n");
291}
292
293#ifdef CONFIG_OF_FLATTREE 293#ifdef CONFIG_OF_FLATTREE
294static void __init x86_flattree_get_config(void) 294static void __init x86_flattree_get_config(void)
295{ 295{
@@ -325,7 +325,7 @@ static void __init x86_flattree_get_config(void)
325static inline void x86_flattree_get_config(void) { } 325static inline void x86_flattree_get_config(void) { }
326#endif 326#endif
327 327
328void __init x86_dtb_get_config(unsigned int unused) 328void __init x86_dtb_init(void)
329{ 329{
330 x86_flattree_get_config(); 330 x86_flattree_get_config();
331 331