1
2
3
4
5
6
7
8
9
10
11#include <linux/init.h>
12#include <linux/fs.h>
13#include <linux/interrupt.h>
14#include <linux/io.h>
15
16#include <asm/irq.h>
17#include <asm/mach/irq.h>
18
19
20
21
22
23
24
25
26
27static unsigned char cached_irq_mask[2] = { 0xfb, 0xff };
28
29
30
31
32
33static void shark_disable_8259A_irq(struct irq_data *d)
34{
35 unsigned int mask;
36 if (d->irq<8) {
37 mask = 1 << d->irq;
38 cached_irq_mask[0] |= mask;
39 outb(cached_irq_mask[1],0xA1);
40 } else {
41 mask = 1 << (d->irq-8);
42 cached_irq_mask[1] |= mask;
43 outb(cached_irq_mask[0],0x21);
44 }
45}
46
47static void shark_enable_8259A_irq(struct irq_data *d)
48{
49 unsigned int mask;
50 if (d->irq<8) {
51 mask = ~(1 << d->irq);
52 cached_irq_mask[0] &= mask;
53 outb(cached_irq_mask[0],0x21);
54 } else {
55 mask = ~(1 << (d->irq-8));
56 cached_irq_mask[1] &= mask;
57 outb(cached_irq_mask[1],0xA1);
58 }
59}
60
61static void shark_ack_8259A_irq(struct irq_data *d){}
62
63static irqreturn_t bogus_int(int irq, void *dev_id)
64{
65 printk("Got interrupt %i!\n",irq);
66 return IRQ_NONE;
67}
68
69static struct irqaction cascade;
70
71static struct irq_chip fb_chip = {
72 .name = "XT-PIC",
73 .irq_ack = shark_ack_8259A_irq,
74 .irq_mask = shark_disable_8259A_irq,
75 .irq_unmask = shark_enable_8259A_irq,
76};
77
78void __init shark_init_irq(void)
79{
80 int irq;
81
82 for (irq = 0; irq < NR_IRQS; irq++) {
83 irq_set_chip_and_handler(irq, &fb_chip, handle_edge_irq);
84 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
85 }
86
87
88 outb(0x11, 0x20);
89 outb(0x00, 0x21);
90 outb(0x04, 0x21);
91 outb(0x03, 0x21);
92 outb(0x0A, 0x20);
93
94 outb(0x11, 0xA0);
95 outb(0x08, 0xA1);
96 outb(0x02, 0xA1);
97 outb(0x03, 0xA1);
98 outb(0x0A, 0xA0);
99 outb(cached_irq_mask[1],0xA1);
100 outb(cached_irq_mask[0],0x21);
101
102
103
104 cascade.handler = bogus_int;
105 cascade.name = "cascade";
106 setup_irq(2,&cascade);
107}
108
109