blob: 49adfd7bb4a49e33c05da6e82a1378d23c29580c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* two abstractions specific to kernel/smpboot.c, mainly to cater to visws
2 * which needs to alter them. */
3
4static inline void smpboot_clear_io_apic_irqs(void)
5{
Ingo Molnar6a64b5d2008-07-10 15:09:04 +02006#ifdef CONFIG_X86_IO_APIC
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 io_apic_irqs = 0;
Ingo Molnar6a64b5d2008-07-10 15:09:04 +02008#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07009}
10
11static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)
12{
Jan Beulichac619f42011-07-19 11:39:03 +010013 unsigned long flags;
14
15 spin_lock_irqsave(&rtc_lock, flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -070016 CMOS_WRITE(0xa, 0xf);
Jan Beulichac619f42011-07-19 11:39:03 +010017 spin_unlock_irqrestore(&rtc_lock, flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -070018 local_flush_tlb();
Thomas Gleixnercfc1b9a2008-07-21 21:35:38 +020019 pr_debug("1.\n");
Ingo Molnar6f177c02009-01-28 16:09:23 +010020 *((volatile unsigned short *)phys_to_virt(apic->trampoline_phys_high)) =
Yinghai Lu569712b2008-11-16 03:12:49 -080021 start_eip >> 4;
Thomas Gleixnercfc1b9a2008-07-21 21:35:38 +020022 pr_debug("2.\n");
Ingo Molnar6f177c02009-01-28 16:09:23 +010023 *((volatile unsigned short *)phys_to_virt(apic->trampoline_phys_low)) =
Yinghai Lu569712b2008-11-16 03:12:49 -080024 start_eip & 0xf;
Thomas Gleixnercfc1b9a2008-07-21 21:35:38 +020025 pr_debug("3.\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -070026}
27
28static inline void smpboot_restore_warm_reset_vector(void)
29{
Jan Beulichac619f42011-07-19 11:39:03 +010030 unsigned long flags;
31
Linus Torvalds1da177e2005-04-16 15:20:36 -070032 /*
33 * Install writable page 0 entry to set BIOS data area.
34 */
35 local_flush_tlb();
36
37 /*
38 * Paranoid: Set warm reset code and vector here back
39 * to default values.
40 */
Jan Beulichac619f42011-07-19 11:39:03 +010041 spin_lock_irqsave(&rtc_lock, flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 CMOS_WRITE(0, 0xf);
Jan Beulichac619f42011-07-19 11:39:03 +010043 spin_unlock_irqrestore(&rtc_lock, flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
Don Zickus299c5692011-02-07 23:25:00 -050045 *((volatile u32 *)phys_to_virt(apic->trampoline_phys_low)) = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070046}
47
Jacek Luczakb6dbf332008-04-11 13:28:49 +020048static inline void __init smpboot_setup_io_apic(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070049{
Ingo Molnar6a64b5d2008-07-10 15:09:04 +020050#ifdef CONFIG_X86_IO_APIC
Linus Torvalds1da177e2005-04-16 15:20:36 -070051 /*
52 * Here we can be sure that there is an IO-APIC in the system. Let's
53 * go and set it up:
54 */
55 if (!skip_ioapic_setup && nr_ioapics)
56 setup_IO_APIC();
Maciej W. Rozyckid788bad2008-06-06 03:28:13 +010057 else {
Glauber de Oliveira Costa3fa7b342008-03-19 14:26:06 -030058 nr_ioapics = 0;
Maciej W. Rozyckid788bad2008-06-06 03:28:13 +010059 }
Ingo Molnar6a64b5d2008-07-10 15:09:04 +020060#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070061}
Glauber de Oliveira Costa9f3734f2008-03-19 14:26:10 -030062
63static inline void smpboot_clear_io_apic(void)
64{
Ingo Molnar6a64b5d2008-07-10 15:09:04 +020065#ifdef CONFIG_X86_IO_APIC
Glauber de Oliveira Costa9f3734f2008-03-19 14:26:10 -030066 nr_ioapics = 0;
Ingo Molnar6a64b5d2008-07-10 15:09:04 +020067#endif
Glauber de Oliveira Costa9f3734f2008-03-19 14:26:10 -030068}