aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/i8259.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/i8259.c')
-rw-r--r--arch/x86/kernel/i8259.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
index 2e977b5d61dd..8af817105e29 100644
--- a/arch/x86/kernel/i8259.c
+++ b/arch/x86/kernel/i8259.c
@@ -299,13 +299,31 @@ static void unmask_8259A(void)
299static void init_8259A(int auto_eoi) 299static void init_8259A(int auto_eoi)
300{ 300{
301 unsigned long flags; 301 unsigned long flags;
302 unsigned char probe_val = ~(1 << PIC_CASCADE_IR);
303 unsigned char new_val;
302 304
303 i8259A_auto_eoi = auto_eoi; 305 i8259A_auto_eoi = auto_eoi;
304 306
305 raw_spin_lock_irqsave(&i8259A_lock, flags); 307 raw_spin_lock_irqsave(&i8259A_lock, flags);
306 308
307 outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */ 309 /*
310 * Check to see if we have a PIC.
311 * Mask all except the cascade and read
312 * back the value we just wrote. If we don't
313 * have a PIC, we will read 0xff as opposed to the
314 * value we wrote.
315 */
308 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */ 316 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */
317 outb(probe_val, PIC_MASTER_IMR);
318 new_val = inb(PIC_MASTER_IMR);
319 if (new_val != probe_val) {
320 printk(KERN_INFO "Using NULL legacy PIC\n");
321 legacy_pic = &null_legacy_pic;
322 raw_spin_unlock_irqrestore(&i8259A_lock, flags);
323 return;
324 }
325
326 outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
309 327
310 /* 328 /*
311 * outb_pic - this has to work on a wide range of PC hardware. 329 * outb_pic - this has to work on a wide range of PC hardware.