This source file includes following definitions.
- takara_update_irq_hw
- takara_enable_irq
- takara_disable_irq
- takara_device_interrupt
- takara_srm_device_interrupt
- takara_init_irq
- takara_map_irq_srm
- takara_map_irq
- takara_swizzle
- takara_init_pci
1
2
3
4
5
6
7
8
9
10
11
12 #include <linux/kernel.h>
13 #include <linux/types.h>
14 #include <linux/mm.h>
15 #include <linux/sched.h>
16 #include <linux/pci.h>
17 #include <linux/init.h>
18
19 #include <asm/ptrace.h>
20 #include <asm/dma.h>
21 #include <asm/irq.h>
22 #include <asm/mmu_context.h>
23 #include <asm/io.h>
24 #include <asm/pgtable.h>
25 #include <asm/core_cia.h>
26 #include <asm/tlbflush.h>
27
28 #include "proto.h"
29 #include "irq_impl.h"
30 #include "pci_impl.h"
31 #include "machvec_impl.h"
32 #include "pc873xx.h"
33
34
35 static unsigned long cached_irq_mask[2] = { -1, -1 };
36
37 static inline void
38 takara_update_irq_hw(unsigned long irq, unsigned long mask)
39 {
40 int regaddr;
41
42 mask = (irq >= 64 ? mask << 16 : mask >> ((irq - 16) & 0x30));
43 regaddr = 0x510 + (((irq - 16) >> 2) & 0x0c);
44 outl(mask & 0xffff0000UL, regaddr);
45 }
46
47 static inline void
48 takara_enable_irq(struct irq_data *d)
49 {
50 unsigned int irq = d->irq;
51 unsigned long mask;
52 mask = (cached_irq_mask[irq >= 64] &= ~(1UL << (irq & 63)));
53 takara_update_irq_hw(irq, mask);
54 }
55
56 static void
57 takara_disable_irq(struct irq_data *d)
58 {
59 unsigned int irq = d->irq;
60 unsigned long mask;
61 mask = (cached_irq_mask[irq >= 64] |= 1UL << (irq & 63));
62 takara_update_irq_hw(irq, mask);
63 }
64
65 static struct irq_chip takara_irq_type = {
66 .name = "TAKARA",
67 .irq_unmask = takara_enable_irq,
68 .irq_mask = takara_disable_irq,
69 .irq_mask_ack = takara_disable_irq,
70 };
71
72 static void
73 takara_device_interrupt(unsigned long vector)
74 {
75 unsigned intstatus;
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93 intstatus = inw(0x500) & 15;
94 if (intstatus) {
95
96
97
98
99
100 if (intstatus & 8) handle_irq(16+3);
101 if (intstatus & 4) handle_irq(16+2);
102 if (intstatus & 2) handle_irq(16+1);
103 if (intstatus & 1) handle_irq(16+0);
104 } else {
105 isa_device_interrupt (vector);
106 }
107 }
108
109 static void
110 takara_srm_device_interrupt(unsigned long vector)
111 {
112 int irq = (vector - 0x800) >> 4;
113 handle_irq(irq);
114 }
115
116 static void __init
117 takara_init_irq(void)
118 {
119 long i;
120
121 init_i8259a_irqs();
122
123 if (alpha_using_srm) {
124 alpha_mv.device_interrupt = takara_srm_device_interrupt;
125 } else {
126 unsigned int ctlreg = inl(0x500);
127
128
129 ctlreg &= ~0x8000;
130 outl(ctlreg, 0x500);
131
132
133 ctlreg = 0x05107c00;
134 outl(ctlreg, 0x500);
135 }
136
137 for (i = 16; i < 128; i += 16)
138 takara_update_irq_hw(i, -1);
139
140 for (i = 16; i < 128; ++i) {
141 irq_set_chip_and_handler(i, &takara_irq_type,
142 handle_level_irq);
143 irq_set_status_flags(i, IRQ_LEVEL);
144 }
145
146 common_init_isa_dma();
147 }
148
149
150
151
152
153
154
155
156
157
158
159 static int
160 takara_map_irq_srm(const struct pci_dev *dev, u8 slot, u8 pin)
161 {
162 static char irq_tab[15][5] = {
163 { 16+3, 16+3, 16+3, 16+3, 16+3},
164 { 16+2, 16+2, 16+2, 16+2, 16+2},
165 { 16+1, 16+1, 16+1, 16+1, 16+1},
166 { -1, -1, -1, -1, -1},
167 { -1, -1, -1, -1, -1},
168 { -1, -1, -1, -1, -1},
169
170 { 12, 12, 13, 14, 15},
171 { 8, 8, 9, 19, 11},
172 { 4, 4, 5, 6, 7},
173 { 0, 0, 1, 2, 3},
174 { -1, -1, -1, -1, -1},
175 {64+ 0, 64+0, 64+1, 64+2, 64+3},
176 {48+ 0, 48+0, 48+1, 48+2, 48+3},
177 {32+ 0, 32+0, 32+1, 32+2, 32+3},
178 {16+ 0, 16+0, 16+1, 16+2, 16+3},
179 };
180 const long min_idsel = 6, max_idsel = 20, irqs_per_slot = 5;
181 int irq = COMMON_TABLE_LOOKUP;
182 if (irq >= 0 && irq < 16) {
183
184 unsigned int busslot = PCI_SLOT(dev->bus->self->devfn);
185 irq += irq_tab[busslot-min_idsel][0];
186 }
187 return irq;
188 }
189
190 static int __init
191 takara_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
192 {
193 static char irq_tab[15][5] __initdata = {
194 { 16+3, 16+3, 16+3, 16+3, 16+3},
195 { 16+2, 16+2, 16+2, 16+2, 16+2},
196 { 16+1, 16+1, 16+1, 16+1, 16+1},
197 { -1, -1, -1, -1, -1},
198 { -1, -1, -1, -1, -1},
199 { -1, -1, -1, -1, -1},
200 { -1, -1, -1, -1, -1},
201 { -1, -1, -1, -1, -1},
202 { -1, -1, -1, -1, -1},
203 { -1, -1, -1, -1, -1},
204 { -1, -1, -1, -1, -1},
205 { -1, -1, -1, -1, -1},
206 { 16+3, 16+3, 16+3, 16+3, 16+3},
207 { 16+2, 16+2, 16+2, 16+2, 16+2},
208 { 16+1, 16+1, 16+1, 16+1, 16+1},
209 };
210 const long min_idsel = 6, max_idsel = 20, irqs_per_slot = 5;
211 return COMMON_TABLE_LOOKUP;
212 }
213
214 static u8
215 takara_swizzle(struct pci_dev *dev, u8 *pinp)
216 {
217 int slot = PCI_SLOT(dev->devfn);
218 int pin = *pinp;
219 unsigned int ctlreg = inl(0x500);
220 unsigned int busslot;
221
222 if (!dev->bus->self)
223 return slot;
224
225 busslot = PCI_SLOT(dev->bus->self->devfn);
226
227 if (dev->bus->number != 0
228 && busslot > 16
229 && ((1<<(36-busslot)) & ctlreg)) {
230 if (pin == 1)
231 pin += (20 - busslot);
232 else {
233 printk(KERN_WARNING "takara_swizzle: can only "
234 "handle cards with INTA IRQ pin.\n");
235 }
236 } else {
237
238 printk(KERN_WARNING "takara_swizzle: cannot handle "
239 "card-bridge behind builtin bridge yet.\n");
240 }
241
242 *pinp = pin;
243 return slot;
244 }
245
246 static void __init
247 takara_init_pci(void)
248 {
249 if (alpha_using_srm)
250 alpha_mv.pci_map_irq = takara_map_irq_srm;
251
252 cia_init_pci();
253
254 if (pc873xx_probe() == -1) {
255 printk(KERN_ERR "Probing for PC873xx Super IO chip failed.\n");
256 } else {
257 printk(KERN_INFO "Found %s Super IO chip at 0x%x\n",
258 pc873xx_get_model(), pc873xx_get_base());
259 pc873xx_enable_ide();
260 }
261 }
262
263
264
265
266
267
268 struct alpha_machine_vector takara_mv __initmv = {
269 .vector_name = "Takara",
270 DO_EV5_MMU,
271 DO_DEFAULT_RTC,
272 DO_CIA_IO,
273 .machine_check = cia_machine_check,
274 .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS,
275 .min_io_address = DEFAULT_IO_BASE,
276 .min_mem_address = CIA_DEFAULT_MEM_BASE,
277
278 .nr_irqs = 128,
279 .device_interrupt = takara_device_interrupt,
280
281 .init_arch = cia_init_arch,
282 .init_irq = takara_init_irq,
283 .init_rtc = common_init_rtc,
284 .init_pci = takara_init_pci,
285 .kill_arch = cia_kill_arch,
286 .pci_map_irq = takara_map_irq,
287 .pci_swizzle = takara_swizzle,
288 };
289 ALIAS_MV(takara)