[PATCH] w1: Adds a sysfs entry (w1_master_search) that allows you to disable/enable...
[linux-2.6/verdex.git] / include / asm-mips / i8259.h
blob0214abe3f0af5b68af05649e829bbaa2608c0b66
1 /*
2 * include/asm-mips/i8259.h
4 * i8259A interrupt definitions.
6 * Copyright (C) 2003 Maciej W. Rozycki
7 * Copyright (C) 2003 Ralf Baechle <ralf@linux-mips.org>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
14 #ifndef _ASM_I8259_H
15 #define _ASM_I8259_H
17 #include <linux/compiler.h>
18 #include <linux/spinlock.h>
20 #include <asm/io.h>
22 extern spinlock_t i8259A_lock;
24 extern void init_i8259_irqs(void);
27 * Do the traditional i8259 interrupt polling thing. This is for the few
28 * cases where no better interrupt acknowledge method is available and we
29 * absolutely must touch the i8259.
31 static inline int i8259_irq(void)
33 int irq;
35 spin_lock(&i8259A_lock);
37 /* Perform an interrupt acknowledge cycle on controller 1. */
38 outb(0x0C, 0x20); /* prepare for poll */
39 irq = inb(0x20) & 7;
40 if (irq == 2) {
42 * Interrupt is cascaded so perform interrupt
43 * acknowledge on controller 2.
45 outb(0x0C, 0xA0); /* prepare for poll */
46 irq = (inb(0xA0) & 7) + 8;
49 if (unlikely(irq == 7)) {
51 * This may be a spurious interrupt.
53 * Read the interrupt status register (ISR). If the most
54 * significant bit is not set then there is no valid
55 * interrupt.
57 outb(0x0B, 0x20); /* ISR register */
58 if(~inb(0x20) & 0x80)
59 irq = -1;
62 spin_unlock(&i8259A_lock);
64 return irq;
67 #endif /* _ASM_I8259_H */