1 #include <linux/linkage.h>
2 #include <linux/errno.h>
3 #include <linux/signal.h>
4 #include <linux/sched.h>
7 #include <linux/timex.h>
8 #include <linux/random.h>
12 #include <linux/bitops.h>
18 #include <asm/timer.h>
19 #include <asm/hw_irq.h>
20 #include <asm/pgtable.h>
23 #include <asm/i8259.h>
31 static void init_8259A(
int auto_eoi);
33 static int i8259A_auto_eoi;
56 static void mask_8259A_irq(
unsigned int irq)
58 unsigned int mask = 1 << irq;
72 mask_8259A_irq(data->
irq);
75 static void unmask_8259A_irq(
unsigned int irq)
77 unsigned int mask = ~(1 << irq);
91 unmask_8259A_irq(data->
irq);
96 unsigned int mask = 1<<irq;
125 static inline int i8259A_irq_real(
unsigned int irq)
128 int irqmask = 1<<irq;
150 unsigned int irq = data->
irq;
151 unsigned int irqmask = 1 << irq;
170 if (cached_irq_mask & irqmask)
171 goto spurious_8259A_irq;
194 if (i8259A_irq_real(irq))
199 goto handle_real_irq;
202 static int spurious_irq_mask;
207 if (!(spurious_irq_mask & irqmask)) {
209 "spurious 8259A interrupt: IRQ%d.\n", irq);
210 spurious_irq_mask |= irqmask;
218 goto handle_real_irq;
224 .irq_mask = disable_8259A_irq,
225 .irq_disable = disable_8259A_irq,
226 .irq_unmask = enable_8259A_irq,
227 .irq_mask_ack = mask_and_ack_8259A,
230 static char irq_trigger[2];
234 static void restore_ELCR(
char *
trigger)
236 outb(trigger[0], 0x4d0);
237 outb(trigger[1], 0x4d1);
240 static void save_ELCR(
char *
trigger)
243 trigger[0] =
inb(0x4d0) & 0xF8;
244 trigger[1] =
inb(0x4d1) & 0xDE;
247 static void i8259A_resume(
void)
249 init_8259A(i8259A_auto_eoi);
250 restore_ELCR(irq_trigger);
253 static int i8259A_suspend(
void)
255 save_ELCR(irq_trigger);
259 static void i8259A_shutdown(
void)
270 .suspend = i8259A_suspend,
271 .resume = i8259A_resume,
272 .shutdown = i8259A_shutdown,
275 static void mask_8259A(
void)
287 static void unmask_8259A(
void)
299 static void init_8259A(
int auto_eoi)
303 i8259A_auto_eoi = auto_eoi;
359 static void legacy_pic_noop(
void) { };
360 static void legacy_pic_uint_noop(
unsigned int unused) { };
361 static void legacy_pic_int_noop(
int unused) { };
362 static int legacy_pic_irq_pending_noop(
unsigned int irq)
370 .mask = legacy_pic_uint_noop,
371 .unmask = legacy_pic_uint_noop,
372 .mask_all = legacy_pic_noop,
373 .restore_mask = legacy_pic_noop,
374 .init = legacy_pic_int_noop,
375 .irq_pending = legacy_pic_irq_pending_noop,
376 .make_irq = legacy_pic_uint_noop,
381 .chip = &i8259A_chip,
382 .mask = mask_8259A_irq,
383 .unmask = unmask_8259A_irq,
384 .mask_all = mask_8259A,
385 .restore_mask = unmask_8259A,
393 static int __init i8259A_init_ops(
void)
395 if (legacy_pic == &default_legacy_pic)