2 * linux/arch/alpha/kernel/sys_alcor.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 ALCOR and XLT (XL-300/366/433).
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/reboot.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_cia.h>
28 #include <asm/tlbflush.h>
33 #include "machvec_impl.h"
36 /* Note mask bit is true for ENABLED irqs. */
37 static unsigned long cached_irq_mask
;
40 alcor_update_irq_hw(unsigned long mask
)
42 *(vuip
)GRU_INT_MASK
= mask
;
47 alcor_enable_irq(struct irq_data
*d
)
49 alcor_update_irq_hw(cached_irq_mask
|= 1UL << (d
->irq
- 16));
53 alcor_disable_irq(struct irq_data
*d
)
55 alcor_update_irq_hw(cached_irq_mask
&= ~(1UL << (d
->irq
- 16)));
59 alcor_mask_and_ack_irq(struct irq_data
*d
)
63 /* On ALCOR/XLT, need to dismiss interrupt via GRU. */
64 *(vuip
)GRU_INT_CLEAR
= 1 << (d
->irq
- 16); mb();
65 *(vuip
)GRU_INT_CLEAR
= 0; mb();
69 alcor_isa_mask_and_ack_irq(struct irq_data
*d
)
71 i8259a_mask_and_ack_irq(d
);
73 /* On ALCOR/XLT, need to dismiss interrupt via GRU. */
74 *(vuip
)GRU_INT_CLEAR
= 0x80000000; mb();
75 *(vuip
)GRU_INT_CLEAR
= 0; mb();
78 static struct irq_chip alcor_irq_type
= {
80 .irq_unmask
= alcor_enable_irq
,
81 .irq_mask
= alcor_disable_irq
,
82 .irq_mask_ack
= alcor_mask_and_ack_irq
,
86 alcor_device_interrupt(unsigned long vector
)
91 /* Read the interrupt summary register of the GRU */
92 pld
= (*(vuip
)GRU_INT_REQ
) & GRU_INT_REQ_BITS
;
95 * Now for every possible bit set, work through them and call
96 * the appropriate interrupt handler.
100 pld
&= pld
- 1; /* clear least bit set */
102 isa_device_interrupt(vector
);
115 alpha_mv
.device_interrupt
= srm_device_interrupt
;
117 *(vuip
)GRU_INT_MASK
= 0; mb(); /* all disabled */
118 *(vuip
)GRU_INT_EDGE
= 0; mb(); /* all are level */
119 *(vuip
)GRU_INT_HILO
= 0x80000000U
; mb(); /* ISA only HI */
120 *(vuip
)GRU_INT_CLEAR
= 0; mb(); /* all clear */
122 for (i
= 16; i
< 48; ++i
) {
123 /* On Alcor, at least, lines 20..30 are not connected
124 and can generate spurious interrupts if we turn them
125 on while IRQ probing. */
126 if (i
>= 16+20 && i
<= 16+30)
128 irq_set_chip_and_handler(i
, &alcor_irq_type
, handle_level_irq
);
129 irq_set_status_flags(i
, IRQ_LEVEL
);
131 i8259a_irq_type
.irq_ack
= alcor_isa_mask_and_ack_irq
;
134 common_init_isa_dma();
136 setup_irq(16+31, &isa_cascade_irqaction
);
141 * PCI Fixup configuration.
143 * Summary @ GRU_INT_REQ:
145 * 0 Interrupt Line A from slot 2
146 * 1 Interrupt Line B from slot 2
147 * 2 Interrupt Line C from slot 2
148 * 3 Interrupt Line D from slot 2
149 * 4 Interrupt Line A from slot 1
150 * 5 Interrupt line B from slot 1
151 * 6 Interrupt Line C from slot 1
152 * 7 Interrupt Line D from slot 1
153 * 8 Interrupt Line A from slot 0
154 * 9 Interrupt Line B from slot 0
155 *10 Interrupt Line C from slot 0
156 *11 Interrupt Line D from slot 0
157 *12 Interrupt Line A from slot 4
158 *13 Interrupt Line B from slot 4
159 *14 Interrupt Line C from slot 4
160 *15 Interrupt Line D from slot 4
161 *16 Interrupt Line D from slot 3
162 *17 Interrupt Line D from slot 3
163 *18 Interrupt Line D from slot 3
164 *19 Interrupt Line D from slot 3
168 * The device to slot mapping looks like:
171 * 6 built-in TULIP (XLT only)
172 * 7 PCI on board slot 0
173 * 8 PCI on board slot 3
174 * 9 PCI on board slot 4
175 * 10 PCEB (PCI-EISA bridge)
176 * 11 PCI on board slot 2
177 * 12 PCI on board slot 1
180 * This two layered interrupt approach means that we allocate IRQ 16 and
181 * above for PCI interrupts. The IRQ relates to which bit the interrupt
182 * comes in on. This makes interrupt processing much easier.
186 alcor_map_irq(struct pci_dev
*dev
, u8 slot
, u8 pin
)
188 static char irq_tab
[7][5] __initdata
= {
189 /*INT INTA INTB INTC INTD */
190 /* note: IDSEL 17 is XLT only */
191 {16+13, 16+13, 16+13, 16+13, 16+13}, /* IdSel 17, TULIP */
192 { 16+8, 16+8, 16+9, 16+10, 16+11}, /* IdSel 18, slot 0 */
193 {16+16, 16+16, 16+17, 16+18, 16+19}, /* IdSel 19, slot 3 */
194 {16+12, 16+12, 16+13, 16+14, 16+15}, /* IdSel 20, slot 4 */
195 { -1, -1, -1, -1, -1}, /* IdSel 21, PCEB */
196 { 16+0, 16+0, 16+1, 16+2, 16+3}, /* IdSel 22, slot 2 */
197 { 16+4, 16+4, 16+5, 16+6, 16+7}, /* IdSel 23, slot 1 */
199 const long min_idsel
= 6, max_idsel
= 12, irqs_per_slot
= 5;
200 return COMMON_TABLE_LOOKUP
;
204 alcor_kill_arch(int mode
)
208 #ifndef ALPHA_RESTORE_SRM_SETUP
210 case LINUX_REBOOT_CMD_RESTART
:
211 /* Who said DEC engineer's have no sense of humor? ;-) */
212 if (alpha_using_srm
) {
213 *(vuip
) GRU_RESET
= 0x0000dead;
217 case LINUX_REBOOT_CMD_HALT
:
219 case LINUX_REBOOT_CMD_POWER_OFF
:
235 * Now we can look to see if we are really running on an XLT-type
236 * motherboard, by looking for a 21040 TULIP in slot 6, which is
237 * built into XLT and BRET/MAVERICK, but not available on ALCOR.
239 dev
= pci_get_device(PCI_VENDOR_ID_DEC
,
240 PCI_DEVICE_ID_DEC_TULIP
,
242 if (dev
&& dev
->devfn
== PCI_DEVFN(6,0)) {
243 alpha_mv
.sys
.cia
.gru_int_req_bits
= XLT_GRU_INT_REQ_BITS
;
244 printk(KERN_INFO
"%s: Detected AS500 or XLT motherboard.\n",
255 struct alpha_machine_vector alcor_mv __initmv
= {
256 .vector_name
= "Alcor",
260 .machine_check
= cia_machine_check
,
261 .max_isa_dma_address
= ALPHA_ALCOR_MAX_ISA_DMA_ADDRESS
,
262 .min_io_address
= EISA_DEFAULT_IO_BASE
,
263 .min_mem_address
= CIA_DEFAULT_MEM_BASE
,
266 .device_interrupt
= alcor_device_interrupt
,
268 .init_arch
= cia_init_arch
,
269 .init_irq
= alcor_init_irq
,
270 .init_rtc
= common_init_rtc
,
271 .init_pci
= alcor_init_pci
,
272 .kill_arch
= alcor_kill_arch
,
273 .pci_map_irq
= alcor_map_irq
,
274 .pci_swizzle
= common_swizzle
,
277 .gru_int_req_bits
= ALCOR_GRU_INT_REQ_BITS
282 struct alpha_machine_vector xlt_mv __initmv
= {
283 .vector_name
= "XLT",
287 .machine_check
= cia_machine_check
,
288 .max_isa_dma_address
= ALPHA_MAX_ISA_DMA_ADDRESS
,
289 .min_io_address
= EISA_DEFAULT_IO_BASE
,
290 .min_mem_address
= CIA_DEFAULT_MEM_BASE
,
293 .device_interrupt
= alcor_device_interrupt
,
295 .init_arch
= cia_init_arch
,
296 .init_irq
= alcor_init_irq
,
297 .init_rtc
= common_init_rtc
,
298 .init_pci
= alcor_init_pci
,
299 .kill_arch
= alcor_kill_arch
,
300 .pci_map_irq
= alcor_map_irq
,
301 .pci_swizzle
= common_swizzle
,
304 .gru_int_req_bits
= XLT_GRU_INT_REQ_BITS
308 /* No alpha_mv alias for XLT, since we compile it in unconditionally
309 with ALCOR; setup_arch knows how to cope. */