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/config.h>
12 #include <linux/kernel.h>
13 #include <linux/types.h>
15 #include <linux/sched.h>
16 #include <linux/pci.h>
17 #include <linux/init.h>
18 #include <linux/bitops.h>
20 #include <asm/ptrace.h>
21 #include <asm/system.h>
24 #include <asm/mmu_context.h>
26 #include <asm/pgtable.h>
27 #include <asm/core_apecs.h>
28 #include <asm/core_cia.h>
29 #include <asm/tlbflush.h>
34 #include "machvec_impl.h"
37 /* Note mask bit is true for ENABLED irqs. */
38 static int cached_irq_mask
;
41 mikasa_update_irq_hw(int mask
)
47 mikasa_enable_irq(unsigned int irq
)
49 mikasa_update_irq_hw(cached_irq_mask
|= 1 << (irq
- 16));
53 mikasa_disable_irq(unsigned int irq
)
55 mikasa_update_irq_hw(cached_irq_mask
&= ~(1 << (irq
- 16)));
59 mikasa_startup_irq(unsigned int irq
)
61 mikasa_enable_irq(irq
);
66 mikasa_end_irq(unsigned int irq
)
68 if (!(irq_desc
[irq
].status
& (IRQ_DISABLED
|IRQ_INPROGRESS
)))
69 mikasa_enable_irq(irq
);
72 static struct hw_interrupt_type mikasa_irq_type
= {
74 .startup
= mikasa_startup_irq
,
75 .shutdown
= mikasa_disable_irq
,
76 .enable
= mikasa_enable_irq
,
77 .disable
= mikasa_disable_irq
,
78 .ack
= mikasa_disable_irq
,
79 .end
= mikasa_end_irq
,
83 mikasa_device_interrupt(unsigned long vector
, struct pt_regs
*regs
)
88 /* Read the interrupt summary registers */
89 pld
= (((~inw(0x534) & 0x0000ffffUL
) << 16)
90 | (((unsigned long) inb(0xa0)) << 8)
94 * Now for every possible bit set, work through them and call
95 * the appropriate interrupt handler.
99 pld
&= pld
- 1; /* clear least bit set */
101 isa_device_interrupt(vector
, regs
);
109 mikasa_init_irq(void)
114 alpha_mv
.device_interrupt
= srm_device_interrupt
;
116 mikasa_update_irq_hw(0);
118 for (i
= 16; i
< 32; ++i
) {
119 irq_desc
[i
].status
= IRQ_DISABLED
| IRQ_LEVEL
;
120 irq_desc
[i
].handler
= &mikasa_irq_type
;
124 common_init_isa_dma();
129 * PCI Fixup configuration.
133 * 0 Interrupt Line A from slot 0
134 * 1 Interrupt Line B from slot 0
135 * 2 Interrupt Line C from slot 0
136 * 3 Interrupt Line D from slot 0
137 * 4 Interrupt Line A from slot 1
138 * 5 Interrupt line B from slot 1
139 * 6 Interrupt Line C from slot 1
140 * 7 Interrupt Line D from slot 1
141 * 8 Interrupt Line A from slot 2
142 * 9 Interrupt Line B from slot 2
143 *10 Interrupt Line C from slot 2
144 *11 Interrupt Line D from slot 2
146 *13 Power Supply Fail
150 * The device to slot mapping looks like:
153 * 6 NCR SCSI controller
154 * 7 Intel PCI-EISA bridge chip
155 * 11 PCI on board slot 0
156 * 12 PCI on board slot 1
157 * 13 PCI on board slot 2
160 * This two layered interrupt approach means that we allocate IRQ 16 and
161 * above for PCI interrupts. The IRQ relates to which bit the interrupt
162 * comes in on. This makes interrupt processing much easier.
166 mikasa_map_irq(struct pci_dev
*dev
, u8 slot
, u8 pin
)
168 static char irq_tab
[8][5] __initdata
= {
169 /*INT INTA INTB INTC INTD */
170 {16+12, 16+12, 16+12, 16+12, 16+12}, /* IdSel 17, SCSI */
171 { -1, -1, -1, -1, -1}, /* IdSel 18, PCEB */
172 { -1, -1, -1, -1, -1}, /* IdSel 19, ???? */
173 { -1, -1, -1, -1, -1}, /* IdSel 20, ???? */
174 { -1, -1, -1, -1, -1}, /* IdSel 21, ???? */
175 { 16+0, 16+0, 16+1, 16+2, 16+3}, /* IdSel 22, slot 0 */
176 { 16+4, 16+4, 16+5, 16+6, 16+7}, /* IdSel 23, slot 1 */
177 { 16+8, 16+8, 16+9, 16+10, 16+11}, /* IdSel 24, slot 2 */
179 const long min_idsel
= 6, max_idsel
= 13, irqs_per_slot
= 5;
180 return COMMON_TABLE_LOOKUP
;
184 #if defined(CONFIG_ALPHA_GENERIC) || !defined(CONFIG_ALPHA_PRIMO)
186 mikasa_apecs_machine_check(unsigned long vector
, unsigned long la_ptr
,
187 struct pt_regs
* regs
)
189 #define MCHK_NO_DEVSEL 0x205U
190 #define MCHK_NO_TABT 0x204U
192 struct el_common
*mchk_header
;
195 mchk_header
= (struct el_common
*)la_ptr
;
197 /* Clear the error before any reporting. */
205 code
= mchk_header
->code
;
206 process_mcheck_info(vector
, la_ptr
, regs
, "MIKASA APECS",
208 && (code
== MCHK_NO_DEVSEL
209 || code
== MCHK_NO_TABT
)));
218 #if defined(CONFIG_ALPHA_GENERIC) || !defined(CONFIG_ALPHA_PRIMO)
219 struct alpha_machine_vector mikasa_mv __initmv
= {
220 .vector_name
= "Mikasa",
224 .machine_check
= mikasa_apecs_machine_check
,
225 .max_isa_dma_address
= ALPHA_MAX_ISA_DMA_ADDRESS
,
226 .min_io_address
= DEFAULT_IO_BASE
,
227 .min_mem_address
= APECS_AND_LCA_DEFAULT_MEM_BASE
,
230 .device_interrupt
= mikasa_device_interrupt
,
232 .init_arch
= apecs_init_arch
,
233 .init_irq
= mikasa_init_irq
,
234 .init_rtc
= common_init_rtc
,
235 .init_pci
= common_init_pci
,
236 .pci_map_irq
= mikasa_map_irq
,
237 .pci_swizzle
= common_swizzle
,
242 #if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_PRIMO)
243 struct alpha_machine_vector mikasa_primo_mv __initmv
= {
244 .vector_name
= "Mikasa-Primo",
248 .machine_check
= cia_machine_check
,
249 .max_isa_dma_address
= ALPHA_MAX_ISA_DMA_ADDRESS
,
250 .min_io_address
= DEFAULT_IO_BASE
,
251 .min_mem_address
= CIA_DEFAULT_MEM_BASE
,
254 .device_interrupt
= mikasa_device_interrupt
,
256 .init_arch
= cia_init_arch
,
257 .init_irq
= mikasa_init_irq
,
258 .init_rtc
= common_init_rtc
,
259 .init_pci
= cia_init_pci
,
260 .kill_arch
= cia_kill_arch
,
261 .pci_map_irq
= mikasa_map_irq
,
262 .pci_swizzle
= common_swizzle
,
264 ALIAS_MV(mikasa_primo
)