2 * linux/arch/alpha/kernel/sys_mikasa.c
4 * Copyright (C) 1995 David A Rusling
5 * Copyright (C) 1996 Jay A Estabrook
6 * Copyright (C) 1998, 1999 Richard Henderson
8 * Code supporting the MIKASA (AlphaServer 1000).
11 #include <linux/kernel.h>
12 #include <linux/types.h>
14 #include <linux/sched.h>
15 #include <linux/pci.h>
16 #include <linux/init.h>
17 #include <linux/bitops.h>
19 #include <asm/ptrace.h>
20 #include <asm/system.h>
23 #include <asm/mmu_context.h>
25 #include <asm/pgtable.h>
26 #include <asm/core_apecs.h>
27 #include <asm/core_cia.h>
28 #include <asm/tlbflush.h>
33 #include "machvec_impl.h"
36 /* Note mask bit is true for ENABLED irqs. */
37 static int cached_irq_mask;
40 mikasa_update_irq_hw(int mask)
46 mikasa_enable_irq(unsigned int irq)
48 mikasa_update_irq_hw(cached_irq_mask |= 1 << (irq - 16));
52 mikasa_disable_irq(unsigned int irq)
54 mikasa_update_irq_hw(cached_irq_mask &= ~(1 << (irq - 16)));
58 mikasa_startup_irq(unsigned int irq)
60 mikasa_enable_irq(irq);
65 mikasa_end_irq(unsigned int irq)
67 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
68 mikasa_enable_irq(irq);
71 static struct hw_interrupt_type mikasa_irq_type = {
73 .startup = mikasa_startup_irq,
74 .shutdown = mikasa_disable_irq,
75 .enable = mikasa_enable_irq,
76 .disable = mikasa_disable_irq,
77 .ack = mikasa_disable_irq,
78 .end = mikasa_end_irq,
82 mikasa_device_interrupt(unsigned long vector, struct pt_regs *regs)
87 /* Read the interrupt summary registers */
88 pld = (((~inw(0x534) & 0x0000ffffUL) << 16)
89 | (((unsigned long) inb(0xa0)) << 8)
93 * Now for every possible bit set, work through them and call
94 * the appropriate interrupt handler.
98 pld &= pld - 1; /* clear least bit set */
100 isa_device_interrupt(vector, regs);
108 mikasa_init_irq(void)
113 alpha_mv.device_interrupt = srm_device_interrupt;
115 mikasa_update_irq_hw(0);
117 for (i = 16; i < 32; ++i) {
118 irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;
119 irq_desc[i].chip = &mikasa_irq_type;
123 common_init_isa_dma();
128 * PCI Fixup configuration.
132 * 0 Interrupt Line A from slot 0
133 * 1 Interrupt Line B from slot 0
134 * 2 Interrupt Line C from slot 0
135 * 3 Interrupt Line D from slot 0
136 * 4 Interrupt Line A from slot 1
137 * 5 Interrupt line B from slot 1
138 * 6 Interrupt Line C from slot 1
139 * 7 Interrupt Line D from slot 1
140 * 8 Interrupt Line A from slot 2
141 * 9 Interrupt Line B from slot 2
142 *10 Interrupt Line C from slot 2
143 *11 Interrupt Line D from slot 2
145 *13 Power Supply Fail
149 * The device to slot mapping looks like:
152 * 6 NCR SCSI controller
153 * 7 Intel PCI-EISA bridge chip
154 * 11 PCI on board slot 0
155 * 12 PCI on board slot 1
156 * 13 PCI on board slot 2
159 * This two layered interrupt approach means that we allocate IRQ 16 and
160 * above for PCI interrupts. The IRQ relates to which bit the interrupt
161 * comes in on. This makes interrupt processing much easier.
165 mikasa_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
167 static char irq_tab[8][5] __initdata = {
168 /*INT INTA INTB INTC INTD */
169 {16+12, 16+12, 16+12, 16+12, 16+12}, /* IdSel 17, SCSI */
170 { -1, -1, -1, -1, -1}, /* IdSel 18, PCEB */
171 { -1, -1, -1, -1, -1}, /* IdSel 19, ???? */
172 { -1, -1, -1, -1, -1}, /* IdSel 20, ???? */
173 { -1, -1, -1, -1, -1}, /* IdSel 21, ???? */
174 { 16+0, 16+0, 16+1, 16+2, 16+3}, /* IdSel 22, slot 0 */
175 { 16+4, 16+4, 16+5, 16+6, 16+7}, /* IdSel 23, slot 1 */
176 { 16+8, 16+8, 16+9, 16+10, 16+11}, /* IdSel 24, slot 2 */
178 const long min_idsel = 6, max_idsel = 13, irqs_per_slot = 5;
179 return COMMON_TABLE_LOOKUP;
183 #if defined(CONFIG_ALPHA_GENERIC) || !defined(CONFIG_ALPHA_PRIMO)
185 mikasa_apecs_machine_check(unsigned long vector, unsigned long la_ptr,
186 struct pt_regs * regs)
188 #define MCHK_NO_DEVSEL 0x205U
189 #define MCHK_NO_TABT 0x204U
191 struct el_common *mchk_header;
194 mchk_header = (struct el_common *)la_ptr;
196 /* Clear the error before any reporting. */
204 code = mchk_header->code;
205 process_mcheck_info(vector, la_ptr, regs, "MIKASA APECS",
207 && (code == MCHK_NO_DEVSEL
208 || code == MCHK_NO_TABT)));
217 #if defined(CONFIG_ALPHA_GENERIC) || !defined(CONFIG_ALPHA_PRIMO)
218 struct alpha_machine_vector mikasa_mv __initmv = {
219 .vector_name = "Mikasa",
223 .machine_check = mikasa_apecs_machine_check,
224 .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS,
225 .min_io_address = DEFAULT_IO_BASE,
226 .min_mem_address = APECS_AND_LCA_DEFAULT_MEM_BASE,
229 .device_interrupt = mikasa_device_interrupt,
231 .init_arch = apecs_init_arch,
232 .init_irq = mikasa_init_irq,
233 .init_rtc = common_init_rtc,
234 .init_pci = common_init_pci,
235 .pci_map_irq = mikasa_map_irq,
236 .pci_swizzle = common_swizzle,
241 #if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_PRIMO)
242 struct alpha_machine_vector mikasa_primo_mv __initmv = {
243 .vector_name = "Mikasa-Primo",
247 .machine_check = cia_machine_check,
248 .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS,
249 .min_io_address = DEFAULT_IO_BASE,
250 .min_mem_address = CIA_DEFAULT_MEM_BASE,
253 .device_interrupt = mikasa_device_interrupt,
255 .init_arch = cia_init_arch,
256 .init_irq = mikasa_init_irq,
257 .init_rtc = common_init_rtc,
258 .init_pci = cia_init_pci,
259 .kill_arch = cia_kill_arch,
260 .pci_map_irq = mikasa_map_irq,
261 .pci_swizzle = common_swizzle,
263 ALIAS_MV(mikasa_primo)