1
2
3
4
5
6
7
8
9
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/mm.h>
14#include <linux/sched.h>
15#include <linux/pci.h>
16#include <linux/init.h>
17#include <linux/reboot.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
33
34static void
35miata_srm_device_interrupt(unsigned long vector)
36{
37 int irq;
38
39 irq = (vector - 0x800) >> 4;
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 if (irq >= 16)
56 irq = irq + 8;
57
58 handle_irq(irq);
59}
60
61static void __init
62miata_init_irq(void)
63{
64 if (alpha_using_srm)
65 alpha_mv.device_interrupt = miata_srm_device_interrupt;
66
67#if 0
68
69 *(vulp)PYXIS_INT_HILO = 0x000000B2UL; mb();
70 *(vulp)PYXIS_RT_COUNT = 0UL; mb();
71#endif
72
73 init_i8259a_irqs();
74
75
76
77
78
79
80 init_pyxis_irqs(0x63b0000);
81
82 common_init_isa_dma();
83 setup_irq(16+2, &halt_switch_irqaction);
84 setup_irq(16+6, &timer_cascade_irqaction);
85}
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152static int __init
153miata_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
154{
155 static char irq_tab[18][5] __initdata = {
156
157 {16+ 8, 16+ 8, 16+ 8, 16+ 8, 16+ 8},
158 { -1, -1, -1, -1, -1},
159 { -1, -1, -1, -1, -1},
160 { -1, -1, -1, -1, -1},
161 { -1, -1, -1, -1, -1},
162 { -1, -1, -1, -1, -1},
163 { -1, -1, -1, -1, -1},
164 { -1, -1, -1, -1, -1},
165 {16+12, 16+12, 16+13, 16+14, 16+15},
166 {16+16, 16+16, 16+17, 16+18, 16+19},
167
168 {16+11, 16+11, 16+11, 16+11, 16+11},
169 { -1, -1, -1, -1, -1},
170 { -1, -1, -1, -1, -1},
171 { -1, -1, -1, -1, -1},
172 {16+20, 16+20, 16+21, 16+22, 16+23},
173 {16+24, 16+24, 16+25, 16+26, 16+27},
174 {16+28, 16+28, 16+29, 16+30, 16+31},
175
176 { -1, -1, -1, -1, -1},
177 };
178 const long min_idsel = 3, max_idsel = 20, irqs_per_slot = 5;
179
180
181
182
183 if((slot == 7) && (PCI_FUNC(dev->devfn) == 3)) {
184 u8 irq=0;
185 struct pci_dev *pdev = pci_get_slot(dev->bus, dev->devfn & ~7);
186 if(pdev == NULL || pci_read_config_byte(pdev, 0x40,&irq) != PCIBIOS_SUCCESSFUL) {
187 pci_dev_put(pdev);
188 return -1;
189 }
190 else {
191 pci_dev_put(pdev);
192 return irq;
193 }
194 }
195
196 return COMMON_TABLE_LOOKUP;
197}
198
199static u8 __init
200miata_swizzle(struct pci_dev *dev, u8 *pinp)
201{
202 int slot, pin = *pinp;
203
204 if (dev->bus->number == 0) {
205 slot = PCI_SLOT(dev->devfn);
206 }
207
208 else if ((PCI_SLOT(dev->bus->self->devfn) == 8) ||
209 (PCI_SLOT(dev->bus->self->devfn) == 20)) {
210 slot = PCI_SLOT(dev->devfn) + 9;
211 }
212 else
213 {
214
215 do {
216 if ((PCI_SLOT(dev->bus->self->devfn) == 8) ||
217 (PCI_SLOT(dev->bus->self->devfn) == 20)) {
218 slot = PCI_SLOT(dev->devfn) + 9;
219 break;
220 }
221 pin = pci_swizzle_interrupt_pin(dev, pin);
222
223
224 dev = dev->bus->self;
225
226 slot = PCI_SLOT(dev->devfn);
227 } while (dev->bus->self);
228 }
229 *pinp = pin;
230 return slot;
231}
232
233static void __init
234miata_init_pci(void)
235{
236 cia_init_pci();
237 SMC669_Init(0);
238 es1888_init();
239}
240
241static void
242miata_kill_arch(int mode)
243{
244 cia_kill_arch(mode);
245
246#ifndef ALPHA_RESTORE_SRM_SETUP
247 switch(mode) {
248 case LINUX_REBOOT_CMD_RESTART:
249
250 if (alpha_using_srm) {
251 *(vuip) PYXIS_RESET = 0x0000dead;
252 mb();
253 }
254 break;
255 case LINUX_REBOOT_CMD_HALT:
256 break;
257 case LINUX_REBOOT_CMD_POWER_OFF:
258 break;
259 }
260
261 halt();
262#endif
263}
264
265
266
267
268
269
270struct alpha_machine_vector miata_mv __initmv = {
271 .vector_name = "Miata",
272 DO_EV5_MMU,
273 DO_DEFAULT_RTC,
274 DO_PYXIS_IO,
275 .machine_check = cia_machine_check,
276 .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS,
277 .min_io_address = DEFAULT_IO_BASE,
278 .min_mem_address = DEFAULT_MEM_BASE,
279 .pci_dac_offset = PYXIS_DAC_OFFSET,
280
281 .nr_irqs = 48,
282 .device_interrupt = pyxis_device_interrupt,
283
284 .init_arch = pyxis_init_arch,
285 .init_irq = miata_init_irq,
286 .init_rtc = common_init_rtc,
287 .init_pci = miata_init_pci,
288 .kill_arch = miata_kill_arch,
289 .pci_map_irq = miata_map_irq,
290 .pci_swizzle = miata_swizzle,
291};
292ALIAS_MV(miata)
293