aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/acpi/boot.c4
-rw-r--r--arch/x86/kernel/apic/apic.c8
-rw-r--r--arch/x86/kernel/apic/io_apic.c65
-rw-r--r--arch/x86/kernel/apic/nmi.c2
-rw-r--r--arch/x86/kernel/apic/numaq_32.c1
-rw-r--r--arch/x86/kernel/i8259.c64
-rw-r--r--arch/x86/kernel/irqinit.c2
-rw-r--r--arch/x86/kernel/smpboot.c9
-rw-r--r--arch/x86/kernel/visws_quirks.c21
-rw-r--r--arch/x86/kernel/x86_init.c8
10 files changed, 127 insertions, 57 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 5c96b75c6ea8..db2773c6defd 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -35,6 +35,7 @@
35#include <linux/ioport.h> 35#include <linux/ioport.h>
36#include <linux/pci.h> 36#include <linux/pci.h>
37 37
38#include <asm/pci_x86.h>
38#include <asm/pgtable.h> 39#include <asm/pgtable.h>
39#include <asm/io_apic.h> 40#include <asm/io_apic.h>
40#include <asm/apic.h> 41#include <asm/apic.h>
@@ -1611,6 +1612,9 @@ int __init acpi_boot_init(void)
1611 1612
1612 acpi_table_parse(ACPI_SIG_HPET, acpi_parse_hpet); 1613 acpi_table_parse(ACPI_SIG_HPET, acpi_parse_hpet);
1613 1614
1615 if (!acpi_noirq)
1616 x86_init.pci.init = pci_acpi_init;
1617
1614 return 0; 1618 return 0;
1615} 1619}
1616 1620
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index dfca210f6a10..94f22b12858d 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1390,7 +1390,7 @@ void __init enable_IR_x2apic(void)
1390 } 1390 }
1391 1391
1392 local_irq_save(flags); 1392 local_irq_save(flags);
1393 mask_8259A(); 1393 legacy_pic->mask_all();
1394 mask_IO_APIC_setup(ioapic_entries); 1394 mask_IO_APIC_setup(ioapic_entries);
1395 1395
1396 if (dmar_table_init_ret) 1396 if (dmar_table_init_ret)
@@ -1422,7 +1422,7 @@ void __init enable_IR_x2apic(void)
1422nox2apic: 1422nox2apic:
1423 if (!ret) /* IR enabling failed */ 1423 if (!ret) /* IR enabling failed */
1424 restore_IO_APIC_setup(ioapic_entries); 1424 restore_IO_APIC_setup(ioapic_entries);
1425 unmask_8259A(); 1425 legacy_pic->restore_mask();
1426 local_irq_restore(flags); 1426 local_irq_restore(flags);
1427 1427
1428out: 1428out:
@@ -2018,7 +2018,7 @@ static int lapic_resume(struct sys_device *dev)
2018 } 2018 }
2019 2019
2020 mask_IO_APIC_setup(ioapic_entries); 2020 mask_IO_APIC_setup(ioapic_entries);
2021 mask_8259A(); 2021 legacy_pic->mask_all();
2022 } 2022 }
2023 2023
2024 if (x2apic_mode) 2024 if (x2apic_mode)
@@ -2062,7 +2062,7 @@ static int lapic_resume(struct sys_device *dev)
2062 2062
2063 if (intr_remapping_enabled) { 2063 if (intr_remapping_enabled) {
2064 reenable_intr_remapping(x2apic_mode); 2064 reenable_intr_remapping(x2apic_mode);
2065 unmask_8259A(); 2065 legacy_pic->restore_mask();
2066 restore_IO_APIC_setup(ioapic_entries); 2066 restore_IO_APIC_setup(ioapic_entries);
2067 free_ioapic_entries(ioapic_entries); 2067 free_ioapic_entries(ioapic_entries);
2068 } 2068 }
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 979589881c80..b34854358ee6 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -143,12 +143,6 @@ static struct irq_cfg irq_cfgx[NR_IRQS_LEGACY];
143static struct irq_cfg irq_cfgx[NR_IRQS]; 143static struct irq_cfg irq_cfgx[NR_IRQS];
144#endif 144#endif
145 145
146void __init io_apic_disable_legacy(void)
147{
148 nr_legacy_irqs = 0;
149 nr_irqs_gsi = 0;
150}
151
152int __init arch_early_irq_init(void) 146int __init arch_early_irq_init(void)
153{ 147{
154 struct irq_cfg *cfg; 148 struct irq_cfg *cfg;
@@ -157,11 +151,18 @@ int __init arch_early_irq_init(void)
157 int node; 151 int node;
158 int i; 152 int i;
159 153
154 if (!legacy_pic->nr_legacy_irqs) {
155 nr_irqs_gsi = 0;
156 io_apic_irqs = ~0UL;
157 }
158
160 cfg = irq_cfgx; 159 cfg = irq_cfgx;
161 count = ARRAY_SIZE(irq_cfgx); 160 count = ARRAY_SIZE(irq_cfgx);
162 node= cpu_to_node(boot_cpu_id); 161 node= cpu_to_node(boot_cpu_id);
163 162
164 for (i = 0; i < count; i++) { 163 for (i = 0; i < count; i++) {
164 if (i < legacy_pic->nr_legacy_irqs)
165 cfg[i].vector = IRQ0_VECTOR + i;
165 desc = irq_to_desc(i); 166 desc = irq_to_desc(i);
166 desc->chip_data = &cfg[i]; 167 desc->chip_data = &cfg[i];
167 zalloc_cpumask_var_node(&cfg[i].domain, GFP_NOWAIT, node); 168 zalloc_cpumask_var_node(&cfg[i].domain, GFP_NOWAIT, node);
@@ -170,7 +171,7 @@ int __init arch_early_irq_init(void)
170 * For legacy IRQ's, start with assigning irq0 to irq15 to 171 * For legacy IRQ's, start with assigning irq0 to irq15 to
171 * IRQ0_VECTOR to IRQ15_VECTOR on cpu 0. 172 * IRQ0_VECTOR to IRQ15_VECTOR on cpu 0.
172 */ 173 */
173 if (i < nr_legacy_irqs) { 174 if (i < legacy_pic->nr_legacy_irqs) {
174 cfg[i].vector = IRQ0_VECTOR + i; 175 cfg[i].vector = IRQ0_VECTOR + i;
175 cpumask_set_cpu(0, cfg[i].domain); 176 cpumask_set_cpu(0, cfg[i].domain);
176 } 177 }
@@ -852,7 +853,7 @@ static int __init find_isa_irq_apic(int irq, int type)
852 */ 853 */
853static int EISA_ELCR(unsigned int irq) 854static int EISA_ELCR(unsigned int irq)
854{ 855{
855 if (irq < nr_legacy_irqs) { 856 if (irq < legacy_pic->nr_legacy_irqs) {
856 unsigned int port = 0x4d0 + (irq >> 3); 857 unsigned int port = 0x4d0 + (irq >> 3);
857 return (inb(port) >> (irq & 7)) & 1; 858 return (inb(port) >> (irq & 7)) & 1;
858 } 859 }
@@ -1463,8 +1464,8 @@ static void setup_IO_APIC_irq(int apic_id, int pin, unsigned int irq, struct irq
1463 } 1464 }
1464 1465
1465 ioapic_register_intr(irq, desc, trigger); 1466 ioapic_register_intr(irq, desc, trigger);
1466 if (irq < nr_legacy_irqs) 1467 if (irq < legacy_pic->nr_legacy_irqs)
1467 disable_8259A_irq(irq); 1468 legacy_pic->chip->mask(irq);
1468 1469
1469 ioapic_write_entry(apic_id, pin, entry); 1470 ioapic_write_entry(apic_id, pin, entry);
1470} 1471}
@@ -1877,7 +1878,7 @@ __apicdebuginit(void) print_PIC(void)
1877 unsigned int v; 1878 unsigned int v;
1878 unsigned long flags; 1879 unsigned long flags;
1879 1880
1880 if (!nr_legacy_irqs) 1881 if (!legacy_pic->nr_legacy_irqs)
1881 return; 1882 return;
1882 1883
1883 printk(KERN_DEBUG "\nprinting PIC contents\n"); 1884 printk(KERN_DEBUG "\nprinting PIC contents\n");
@@ -1961,7 +1962,7 @@ void __init enable_IO_APIC(void)
1961 nr_ioapic_registers[apic] = reg_01.bits.entries+1; 1962 nr_ioapic_registers[apic] = reg_01.bits.entries+1;
1962 } 1963 }
1963 1964
1964 if (!nr_legacy_irqs) 1965 if (!legacy_pic->nr_legacy_irqs)
1965 return; 1966 return;
1966 1967
1967 for(apic = 0; apic < nr_ioapics; apic++) { 1968 for(apic = 0; apic < nr_ioapics; apic++) {
@@ -2018,7 +2019,7 @@ void disable_IO_APIC(void)
2018 */ 2019 */
2019 clear_IO_APIC(); 2020 clear_IO_APIC();
2020 2021
2021 if (!nr_legacy_irqs) 2022 if (!legacy_pic->nr_legacy_irqs)
2022 return; 2023 return;
2023 2024
2024 /* 2025 /*
@@ -2251,9 +2252,9 @@ static unsigned int startup_ioapic_irq(unsigned int irq)
2251 struct irq_cfg *cfg; 2252 struct irq_cfg *cfg;
2252 2253
2253 raw_spin_lock_irqsave(&ioapic_lock, flags); 2254 raw_spin_lock_irqsave(&ioapic_lock, flags);
2254 if (irq < nr_legacy_irqs) { 2255 if (irq < legacy_pic->nr_legacy_irqs) {
2255 disable_8259A_irq(irq); 2256 legacy_pic->chip->mask(irq);
2256 if (i8259A_irq_pending(irq)) 2257 if (legacy_pic->irq_pending(irq))
2257 was_pending = 1; 2258 was_pending = 1;
2258 } 2259 }
2259 cfg = irq_cfg(irq); 2260 cfg = irq_cfg(irq);
@@ -2786,8 +2787,8 @@ static inline void init_IO_APIC_traps(void)
2786 * so default to an old-fashioned 8259 2787 * so default to an old-fashioned 8259
2787 * interrupt if we can.. 2788 * interrupt if we can..
2788 */ 2789 */
2789 if (irq < nr_legacy_irqs) 2790 if (irq < legacy_pic->nr_legacy_irqs)
2790 make_8259A_irq(irq); 2791 legacy_pic->make_irq(irq);
2791 else 2792 else
2792 /* Strange. Oh, well.. */ 2793 /* Strange. Oh, well.. */
2793 desc->chip = &no_irq_chip; 2794 desc->chip = &no_irq_chip;
@@ -2944,7 +2945,7 @@ static inline void __init check_timer(void)
2944 /* 2945 /*
2945 * get/set the timer IRQ vector: 2946 * get/set the timer IRQ vector:
2946 */ 2947 */
2947 disable_8259A_irq(0); 2948 legacy_pic->chip->mask(0);
2948 assign_irq_vector(0, cfg, apic->target_cpus()); 2949 assign_irq_vector(0, cfg, apic->target_cpus());
2949 2950
2950 /* 2951 /*
@@ -2957,7 +2958,7 @@ static inline void __init check_timer(void)
2957 * automatically. 2958 * automatically.
2958 */ 2959 */
2959 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); 2960 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
2960 init_8259A(1); 2961 legacy_pic->init(1);
2961#ifdef CONFIG_X86_32 2962#ifdef CONFIG_X86_32
2962 { 2963 {
2963 unsigned int ver; 2964 unsigned int ver;
@@ -3016,7 +3017,7 @@ static inline void __init check_timer(void)
3016 if (timer_irq_works()) { 3017 if (timer_irq_works()) {
3017 if (nmi_watchdog == NMI_IO_APIC) { 3018 if (nmi_watchdog == NMI_IO_APIC) {
3018 setup_nmi(); 3019 setup_nmi();
3019 enable_8259A_irq(0); 3020 legacy_pic->chip->unmask(0);
3020 } 3021 }
3021 if (disable_timer_pin_1 > 0) 3022 if (disable_timer_pin_1 > 0)
3022 clear_IO_APIC_pin(0, pin1); 3023 clear_IO_APIC_pin(0, pin1);
@@ -3039,14 +3040,14 @@ static inline void __init check_timer(void)
3039 */ 3040 */
3040 replace_pin_at_irq_node(cfg, node, apic1, pin1, apic2, pin2); 3041 replace_pin_at_irq_node(cfg, node, apic1, pin1, apic2, pin2);
3041 setup_timer_IRQ0_pin(apic2, pin2, cfg->vector); 3042 setup_timer_IRQ0_pin(apic2, pin2, cfg->vector);
3042 enable_8259A_irq(0); 3043 legacy_pic->chip->unmask(0);
3043 if (timer_irq_works()) { 3044 if (timer_irq_works()) {
3044 apic_printk(APIC_QUIET, KERN_INFO "....... works.\n"); 3045 apic_printk(APIC_QUIET, KERN_INFO "....... works.\n");
3045 timer_through_8259 = 1; 3046 timer_through_8259 = 1;
3046 if (nmi_watchdog == NMI_IO_APIC) { 3047 if (nmi_watchdog == NMI_IO_APIC) {
3047 disable_8259A_irq(0); 3048 legacy_pic->chip->mask(0);
3048 setup_nmi(); 3049 setup_nmi();
3049 enable_8259A_irq(0); 3050 legacy_pic->chip->unmask(0);
3050 } 3051 }
3051 goto out; 3052 goto out;
3052 } 3053 }
@@ -3054,7 +3055,7 @@ static inline void __init check_timer(void)
3054 * Cleanup, just in case ... 3055 * Cleanup, just in case ...
3055 */ 3056 */
3056 local_irq_disable(); 3057 local_irq_disable();
3057 disable_8259A_irq(0); 3058 legacy_pic->chip->mask(0);
3058 clear_IO_APIC_pin(apic2, pin2); 3059 clear_IO_APIC_pin(apic2, pin2);
3059 apic_printk(APIC_QUIET, KERN_INFO "....... failed.\n"); 3060 apic_printk(APIC_QUIET, KERN_INFO "....... failed.\n");
3060 } 3061 }
@@ -3073,22 +3074,22 @@ static inline void __init check_timer(void)
3073 3074
3074 lapic_register_intr(0, desc); 3075 lapic_register_intr(0, desc);
3075 apic_write(APIC_LVT0, APIC_DM_FIXED | cfg->vector); /* Fixed mode */ 3076 apic_write(APIC_LVT0, APIC_DM_FIXED | cfg->vector); /* Fixed mode */
3076 enable_8259A_irq(0); 3077 legacy_pic->chip->unmask(0);
3077 3078
3078 if (timer_irq_works()) { 3079 if (timer_irq_works()) {
3079 apic_printk(APIC_QUIET, KERN_INFO "..... works.\n"); 3080 apic_printk(APIC_QUIET, KERN_INFO "..... works.\n");
3080 goto out; 3081 goto out;
3081 } 3082 }
3082 local_irq_disable(); 3083 local_irq_disable();
3083 disable_8259A_irq(0); 3084 legacy_pic->chip->mask(0);
3084 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector); 3085 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector);
3085 apic_printk(APIC_QUIET, KERN_INFO "..... failed.\n"); 3086 apic_printk(APIC_QUIET, KERN_INFO "..... failed.\n");
3086 3087
3087 apic_printk(APIC_QUIET, KERN_INFO 3088 apic_printk(APIC_QUIET, KERN_INFO
3088 "...trying to set up timer as ExtINT IRQ...\n"); 3089 "...trying to set up timer as ExtINT IRQ...\n");
3089 3090
3090 init_8259A(0); 3091 legacy_pic->init(0);
3091 make_8259A_irq(0); 3092 legacy_pic->make_irq(0);
3092 apic_write(APIC_LVT0, APIC_DM_EXTINT); 3093 apic_write(APIC_LVT0, APIC_DM_EXTINT);
3093 3094
3094 unlock_ExtINT_logic(); 3095 unlock_ExtINT_logic();
@@ -3130,7 +3131,7 @@ void __init setup_IO_APIC(void)
3130 /* 3131 /*
3131 * calling enable_IO_APIC() is moved to setup_local_APIC for BP 3132 * calling enable_IO_APIC() is moved to setup_local_APIC for BP
3132 */ 3133 */
3133 io_apic_irqs = nr_legacy_irqs ? ~PIC_IRQS : ~0UL; 3134 io_apic_irqs = legacy_pic->nr_legacy_irqs ? ~PIC_IRQS : ~0UL;
3134 3135
3135 apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n"); 3136 apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n");
3136 /* 3137 /*
@@ -3141,7 +3142,7 @@ void __init setup_IO_APIC(void)
3141 sync_Arb_IDs(); 3142 sync_Arb_IDs();
3142 setup_IO_APIC_irqs(); 3143 setup_IO_APIC_irqs();
3143 init_IO_APIC_traps(); 3144 init_IO_APIC_traps();
3144 if (nr_legacy_irqs) 3145 if (legacy_pic->nr_legacy_irqs)
3145 check_timer(); 3146 check_timer();
3146} 3147}
3147 3148
@@ -3910,7 +3911,7 @@ static int __io_apic_set_pci_routing(struct device *dev, int irq,
3910 /* 3911 /*
3911 * IRQs < 16 are already in the irq_2_pin[] map 3912 * IRQs < 16 are already in the irq_2_pin[] map
3912 */ 3913 */
3913 if (irq >= nr_legacy_irqs) { 3914 if (irq >= legacy_pic->nr_legacy_irqs) {
3914 cfg = desc->chip_data; 3915 cfg = desc->chip_data;
3915 if (add_pin_to_irq_node_nopanic(cfg, node, ioapic, pin)) { 3916 if (add_pin_to_irq_node_nopanic(cfg, node, ioapic, pin)) {
3916 printk(KERN_INFO "can not add pin %d for irq %d\n", 3917 printk(KERN_INFO "can not add pin %d for irq %d\n",
diff --git a/arch/x86/kernel/apic/nmi.c b/arch/x86/kernel/apic/nmi.c
index 24e7742d633a..f72b5f0f388e 100644
--- a/arch/x86/kernel/apic/nmi.c
+++ b/arch/x86/kernel/apic/nmi.c
@@ -177,7 +177,7 @@ int __init check_nmi_watchdog(void)
177error: 177error:
178 if (nmi_watchdog == NMI_IO_APIC) { 178 if (nmi_watchdog == NMI_IO_APIC) {
179 if (!timer_through_8259) 179 if (!timer_through_8259)
180 disable_8259A_irq(0); 180 legacy_pic->chip->mask(0);
181 on_each_cpu(__acpi_nmi_disable, NULL, 1); 181 on_each_cpu(__acpi_nmi_disable, NULL, 1);
182 } 182 }
183 183
diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c
index 98c4665f251c..be5c4fd47778 100644
--- a/arch/x86/kernel/apic/numaq_32.c
+++ b/arch/x86/kernel/apic/numaq_32.c
@@ -277,6 +277,7 @@ static __init void early_check_numaq(void)
277 x86_init.mpparse.mpc_oem_pci_bus = mpc_oem_pci_bus; 277 x86_init.mpparse.mpc_oem_pci_bus = mpc_oem_pci_bus;
278 x86_init.mpparse.mpc_oem_bus_info = mpc_oem_bus_info; 278 x86_init.mpparse.mpc_oem_bus_info = mpc_oem_bus_info;
279 x86_init.timers.tsc_pre_init = numaq_tsc_init; 279 x86_init.timers.tsc_pre_init = numaq_tsc_init;
280 x86_init.pci.init = pci_numaq_init;
280 } 281 }
281} 282}
282 283
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
index 8c93a84bb627..9bac6817456f 100644
--- a/arch/x86/kernel/i8259.c
+++ b/arch/x86/kernel/i8259.c
@@ -34,6 +34,12 @@
34static int i8259A_auto_eoi; 34static int i8259A_auto_eoi;
35DEFINE_RAW_SPINLOCK(i8259A_lock); 35DEFINE_RAW_SPINLOCK(i8259A_lock);
36static void mask_and_ack_8259A(unsigned int); 36static void mask_and_ack_8259A(unsigned int);
37static void mask_8259A(void);
38static void unmask_8259A(void);
39static void disable_8259A_irq(unsigned int irq);
40static void enable_8259A_irq(unsigned int irq);
41static void init_8259A(int auto_eoi);
42static int i8259A_irq_pending(unsigned int irq);
37 43
38struct irq_chip i8259A_chip = { 44struct irq_chip i8259A_chip = {
39 .name = "XT-PIC", 45 .name = "XT-PIC",
@@ -63,7 +69,7 @@ unsigned int cached_irq_mask = 0xffff;
63 */ 69 */
64unsigned long io_apic_irqs; 70unsigned long io_apic_irqs;
65 71
66void disable_8259A_irq(unsigned int irq) 72static void disable_8259A_irq(unsigned int irq)
67{ 73{
68 unsigned int mask = 1 << irq; 74 unsigned int mask = 1 << irq;
69 unsigned long flags; 75 unsigned long flags;
@@ -77,7 +83,7 @@ void disable_8259A_irq(unsigned int irq)
77 raw_spin_unlock_irqrestore(&i8259A_lock, flags); 83 raw_spin_unlock_irqrestore(&i8259A_lock, flags);
78} 84}
79 85
80void enable_8259A_irq(unsigned int irq) 86static void enable_8259A_irq(unsigned int irq)
81{ 87{
82 unsigned int mask = ~(1 << irq); 88 unsigned int mask = ~(1 << irq);
83 unsigned long flags; 89 unsigned long flags;
@@ -91,7 +97,7 @@ void enable_8259A_irq(unsigned int irq)
91 raw_spin_unlock_irqrestore(&i8259A_lock, flags); 97 raw_spin_unlock_irqrestore(&i8259A_lock, flags);
92} 98}
93 99
94int i8259A_irq_pending(unsigned int irq) 100static int i8259A_irq_pending(unsigned int irq)
95{ 101{
96 unsigned int mask = 1<<irq; 102 unsigned int mask = 1<<irq;
97 unsigned long flags; 103 unsigned long flags;
@@ -107,7 +113,7 @@ int i8259A_irq_pending(unsigned int irq)
107 return ret; 113 return ret;
108} 114}
109 115
110void make_8259A_irq(unsigned int irq) 116static void make_8259A_irq(unsigned int irq)
111{ 117{
112 disable_irq_nosync(irq); 118 disable_irq_nosync(irq);
113 io_apic_irqs &= ~(1<<irq); 119 io_apic_irqs &= ~(1<<irq);
@@ -281,7 +287,7 @@ static int __init i8259A_init_sysfs(void)
281 287
282device_initcall(i8259A_init_sysfs); 288device_initcall(i8259A_init_sysfs);
283 289
284void mask_8259A(void) 290static void mask_8259A(void)
285{ 291{
286 unsigned long flags; 292 unsigned long flags;
287 293
@@ -293,7 +299,7 @@ void mask_8259A(void)
293 raw_spin_unlock_irqrestore(&i8259A_lock, flags); 299 raw_spin_unlock_irqrestore(&i8259A_lock, flags);
294} 300}
295 301
296void unmask_8259A(void) 302static void unmask_8259A(void)
297{ 303{
298 unsigned long flags; 304 unsigned long flags;
299 305
@@ -305,7 +311,7 @@ void unmask_8259A(void)
305 raw_spin_unlock_irqrestore(&i8259A_lock, flags); 311 raw_spin_unlock_irqrestore(&i8259A_lock, flags);
306} 312}
307 313
308void init_8259A(int auto_eoi) 314static void init_8259A(int auto_eoi)
309{ 315{
310 unsigned long flags; 316 unsigned long flags;
311 317
@@ -358,3 +364,47 @@ void init_8259A(int auto_eoi)
358 364
359 raw_spin_unlock_irqrestore(&i8259A_lock, flags); 365 raw_spin_unlock_irqrestore(&i8259A_lock, flags);
360} 366}
367
368/*
369 * make i8259 a driver so that we can select pic functions at run time. the goal
370 * is to make x86 binary compatible among pc compatible and non-pc compatible
371 * platforms, such as x86 MID.
372 */
373
374static void __init legacy_pic_noop(void) { };
375static void __init legacy_pic_uint_noop(unsigned int unused) { };
376static void __init legacy_pic_int_noop(int unused) { };
377
378static struct irq_chip dummy_pic_chip = {
379 .name = "dummy pic",
380 .mask = legacy_pic_uint_noop,
381 .unmask = legacy_pic_uint_noop,
382 .disable = legacy_pic_uint_noop,
383 .mask_ack = legacy_pic_uint_noop,
384};
385static int legacy_pic_irq_pending_noop(unsigned int irq)
386{
387 return 0;
388}
389
390struct legacy_pic null_legacy_pic = {
391 .nr_legacy_irqs = 0,
392 .chip = &dummy_pic_chip,
393 .mask_all = legacy_pic_noop,
394 .restore_mask = legacy_pic_noop,
395 .init = legacy_pic_int_noop,
396 .irq_pending = legacy_pic_irq_pending_noop,
397 .make_irq = legacy_pic_uint_noop,
398};
399
400struct legacy_pic default_legacy_pic = {
401 .nr_legacy_irqs = NR_IRQS_LEGACY,
402 .chip = &i8259A_chip,
403 .mask_all = mask_8259A,
404 .restore_mask = unmask_8259A,
405 .init = init_8259A,
406 .irq_pending = i8259A_irq_pending,
407 .make_irq = make_8259A_irq,
408};
409
410struct legacy_pic *legacy_pic = &default_legacy_pic;
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index fce55d532631..d2f787b3de56 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -109,7 +109,7 @@ void __init init_ISA_irqs(void)
109#if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC) 109#if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC)
110 init_bsp_APIC(); 110 init_bsp_APIC();
111#endif 111#endif
112 init_8259A(0); 112 legacy_pic->init(0);
113 113
114 /* 114 /*
115 * 16 old-style INTA-cycle interrupts: 115 * 16 old-style INTA-cycle interrupts:
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index da99eef1f0dc..86f7edcd0438 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -48,6 +48,7 @@
48#include <linux/err.h> 48#include <linux/err.h>
49#include <linux/nmi.h> 49#include <linux/nmi.h>
50#include <linux/tboot.h> 50#include <linux/tboot.h>
51#include <linux/stackprotector.h>
51 52
52#include <asm/acpi.h> 53#include <asm/acpi.h>
53#include <asm/desc.h> 54#include <asm/desc.h>
@@ -67,6 +68,7 @@
67#include <linux/mc146818rtc.h> 68#include <linux/mc146818rtc.h>
68 69
69#include <asm/smpboot_hooks.h> 70#include <asm/smpboot_hooks.h>
71#include <asm/i8259.h>
70 72
71#ifdef CONFIG_X86_32 73#ifdef CONFIG_X86_32
72u8 apicid_2_node[MAX_APICID]; 74u8 apicid_2_node[MAX_APICID];
@@ -291,9 +293,9 @@ notrace static void __cpuinit start_secondary(void *unused)
291 check_tsc_sync_target(); 293 check_tsc_sync_target();
292 294
293 if (nmi_watchdog == NMI_IO_APIC) { 295 if (nmi_watchdog == NMI_IO_APIC) {
294 disable_8259A_irq(0); 296 legacy_pic->chip->mask(0);
295 enable_NMI_through_LVT0(); 297 enable_NMI_through_LVT0();
296 enable_8259A_irq(0); 298 legacy_pic->chip->unmask(0);
297 } 299 }
298 300
299#ifdef CONFIG_X86_32 301#ifdef CONFIG_X86_32
@@ -328,6 +330,9 @@ notrace static void __cpuinit start_secondary(void *unused)
328 /* enable local interrupts */ 330 /* enable local interrupts */
329 local_irq_enable(); 331 local_irq_enable();
330 332
333 /* to prevent fake stack check failure in clock setup */
334 boot_init_stack_canary();
335
331 x86_cpuinit.setup_percpu_clockev(); 336 x86_cpuinit.setup_percpu_clockev();
332 337
333 wmb(); 338 wmb();
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c
index ab38ce0984fa..e680ea52db9b 100644
--- a/arch/x86/kernel/visws_quirks.c
+++ b/arch/x86/kernel/visws_quirks.c
@@ -49,11 +49,6 @@ extern int no_broadcast;
49char visws_board_type = -1; 49char visws_board_type = -1;
50char visws_board_rev = -1; 50char visws_board_rev = -1;
51 51
52int is_visws_box(void)
53{
54 return visws_board_type >= 0;
55}
56
57static void __init visws_time_init(void) 52static void __init visws_time_init(void)
58{ 53{
59 printk(KERN_INFO "Starting Cobalt Timer system clock\n"); 54 printk(KERN_INFO "Starting Cobalt Timer system clock\n");
@@ -242,6 +237,8 @@ void __init visws_early_detect(void)
242 x86_init.irqs.pre_vector_init = visws_pre_intr_init; 237 x86_init.irqs.pre_vector_init = visws_pre_intr_init;
243 x86_init.irqs.trap_init = visws_trap_init; 238 x86_init.irqs.trap_init = visws_trap_init;
244 x86_init.timers.timer_init = visws_time_init; 239 x86_init.timers.timer_init = visws_time_init;
240 x86_init.pci.init = pci_visws_init;
241 x86_init.pci.init_irq = x86_init_noop;
245 242
246 /* 243 /*
247 * Install reboot quirks: 244 * Install reboot quirks:
@@ -508,7 +505,7 @@ static struct irq_chip cobalt_irq_type = {
508 */ 505 */
509static unsigned int startup_piix4_master_irq(unsigned int irq) 506static unsigned int startup_piix4_master_irq(unsigned int irq)
510{ 507{
511 init_8259A(0); 508 legacy_pic->init(0);
512 509
513 return startup_cobalt_irq(irq); 510 return startup_cobalt_irq(irq);
514} 511}
@@ -532,9 +529,6 @@ static struct irq_chip piix4_master_irq_type = {
532 529
533static struct irq_chip piix4_virtual_irq_type = { 530static struct irq_chip piix4_virtual_irq_type = {
534 .name = "PIIX4-virtual", 531 .name = "PIIX4-virtual",
535 .shutdown = disable_8259A_irq,
536 .enable = enable_8259A_irq,
537 .disable = disable_8259A_irq,
538}; 532};
539 533
540 534
@@ -609,7 +603,7 @@ static irqreturn_t piix4_master_intr(int irq, void *dev_id)
609 handle_IRQ_event(realirq, desc->action); 603 handle_IRQ_event(realirq, desc->action);
610 604
611 if (!(desc->status & IRQ_DISABLED)) 605 if (!(desc->status & IRQ_DISABLED))
612 enable_8259A_irq(realirq); 606 legacy_pic->chip->unmask(realirq);
613 607
614 return IRQ_HANDLED; 608 return IRQ_HANDLED;
615 609
@@ -628,6 +622,12 @@ static struct irqaction cascade_action = {
628 .name = "cascade", 622 .name = "cascade",
629}; 623};
630 624
625static inline void set_piix4_virtual_irq_type(void)
626{
627 piix4_virtual_irq_type.shutdown = i8259A_chip.mask;
628 piix4_virtual_irq_type.enable = i8259A_chip.unmask;
629 piix4_virtual_irq_type.disable = i8259A_chip.mask;
630}
631 631
632void init_VISWS_APIC_irqs(void) 632void init_VISWS_APIC_irqs(void)
633{ 633{
@@ -653,6 +653,7 @@ void init_VISWS_APIC_irqs(void)
653 desc->chip = &piix4_master_irq_type; 653 desc->chip = &piix4_master_irq_type;
654 } 654 }
655 else if (i < CO_IRQ_APIC0) { 655 else if (i < CO_IRQ_APIC0) {
656 set_piix4_virtual_irq_type();
656 desc->chip = &piix4_virtual_irq_type; 657 desc->chip = &piix4_virtual_irq_type;
657 } 658 }
658 else if (IS_CO_APIC(i)) { 659 else if (IS_CO_APIC(i)) {
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index ccd179dec36e..1817cd7a03fa 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -4,9 +4,11 @@
4 * For licencing details see kernel-base/COPYING 4 * For licencing details see kernel-base/COPYING
5 */ 5 */
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/ioport.h>
7 8
8#include <asm/bios_ebda.h> 9#include <asm/bios_ebda.h>
9#include <asm/paravirt.h> 10#include <asm/paravirt.h>
11#include <asm/pci_x86.h>
10#include <asm/mpspec.h> 12#include <asm/mpspec.h>
11#include <asm/setup.h> 13#include <asm/setup.h>
12#include <asm/apic.h> 14#include <asm/apic.h>
@@ -70,6 +72,12 @@ struct x86_init_ops x86_init __initdata = {
70 .iommu = { 72 .iommu = {
71 .iommu_init = iommu_init_noop, 73 .iommu_init = iommu_init_noop,
72 }, 74 },
75
76 .pci = {
77 .init = x86_default_pci_init,
78 .init_irq = x86_default_pci_init_irq,
79 .fixup_irqs = x86_default_pci_fixup_irqs,
80 },
73}; 81};
74 82
75struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = { 83struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = {