1 // SPDX-License-Identifier: GPL-2.0
3 * linux/arch/alpha/kernel/sys_mikasa.c
5 * Copyright (C) 1995 David A Rusling
6 * Copyright (C) 1996 Jay A Estabrook
7 * Copyright (C) 1998, 1999 Richard Henderson
9 * Code supporting the MIKASA (AlphaServer 1000).
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>
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(struct irq_data
*d
)
49 mikasa_update_irq_hw(cached_irq_mask
|= 1 << (d
->irq
- 16));
53 mikasa_disable_irq(struct irq_data
*d
)
55 mikasa_update_irq_hw(cached_irq_mask
&= ~(1 << (d
->irq
- 16)));
58 static struct irq_chip mikasa_irq_type
= {
60 .irq_unmask
= mikasa_enable_irq
,
61 .irq_mask
= mikasa_disable_irq
,
62 .irq_mask_ack
= mikasa_disable_irq
,
66 mikasa_device_interrupt(unsigned long vector
)
71 /* Read the interrupt summary registers */
72 pld
= (((~inw(0x534) & 0x0000ffffUL
) << 16)
73 | (((unsigned long) inb(0xa0)) << 8)
77 * Now for every possible bit set, work through them and call
78 * the appropriate interrupt handler.
82 pld
&= pld
- 1; /* clear least bit set */
84 isa_device_interrupt(vector
);
97 alpha_mv
.device_interrupt
= srm_device_interrupt
;
99 mikasa_update_irq_hw(0);
101 for (i
= 16; i
< 32; ++i
) {
102 irq_set_chip_and_handler(i
, &mikasa_irq_type
,
104 irq_set_status_flags(i
, IRQ_LEVEL
);
108 common_init_isa_dma();
113 * PCI Fixup configuration.
117 * 0 Interrupt Line A from slot 0
118 * 1 Interrupt Line B from slot 0
119 * 2 Interrupt Line C from slot 0
120 * 3 Interrupt Line D from slot 0
121 * 4 Interrupt Line A from slot 1
122 * 5 Interrupt line B from slot 1
123 * 6 Interrupt Line C from slot 1
124 * 7 Interrupt Line D from slot 1
125 * 8 Interrupt Line A from slot 2
126 * 9 Interrupt Line B from slot 2
127 *10 Interrupt Line C from slot 2
128 *11 Interrupt Line D from slot 2
130 *13 Power Supply Fail
134 * The device to slot mapping looks like:
137 * 6 NCR SCSI controller
138 * 7 Intel PCI-EISA bridge chip
139 * 11 PCI on board slot 0
140 * 12 PCI on board slot 1
141 * 13 PCI on board slot 2
144 * This two layered interrupt approach means that we allocate IRQ 16 and
145 * above for PCI interrupts. The IRQ relates to which bit the interrupt
146 * comes in on. This makes interrupt processing much easier.
150 mikasa_map_irq(const struct pci_dev
*dev
, u8 slot
, u8 pin
)
152 static char irq_tab
[8][5] = {
153 /*INT INTA INTB INTC INTD */
154 {16+12, 16+12, 16+12, 16+12, 16+12}, /* IdSel 17, SCSI */
155 { -1, -1, -1, -1, -1}, /* IdSel 18, PCEB */
156 { -1, -1, -1, -1, -1}, /* IdSel 19, ???? */
157 { -1, -1, -1, -1, -1}, /* IdSel 20, ???? */
158 { -1, -1, -1, -1, -1}, /* IdSel 21, ???? */
159 { 16+0, 16+0, 16+1, 16+2, 16+3}, /* IdSel 22, slot 0 */
160 { 16+4, 16+4, 16+5, 16+6, 16+7}, /* IdSel 23, slot 1 */
161 { 16+8, 16+8, 16+9, 16+10, 16+11}, /* IdSel 24, slot 2 */
163 const long min_idsel
= 6, max_idsel
= 13, irqs_per_slot
= 5;
164 return COMMON_TABLE_LOOKUP
;
168 #if defined(CONFIG_ALPHA_GENERIC) || !defined(CONFIG_ALPHA_PRIMO)
170 mikasa_apecs_machine_check(unsigned long vector
, unsigned long la_ptr
)
172 #define MCHK_NO_DEVSEL 0x205U
173 #define MCHK_NO_TABT 0x204U
175 struct el_common
*mchk_header
;
178 mchk_header
= (struct el_common
*)la_ptr
;
180 /* Clear the error before any reporting. */
188 code
= mchk_header
->code
;
189 process_mcheck_info(vector
, la_ptr
, "MIKASA APECS",
191 && (code
== MCHK_NO_DEVSEL
192 || code
== MCHK_NO_TABT
)));
201 #if defined(CONFIG_ALPHA_GENERIC) || !defined(CONFIG_ALPHA_PRIMO)
202 struct alpha_machine_vector mikasa_mv __initmv
= {
203 .vector_name
= "Mikasa",
207 .machine_check
= mikasa_apecs_machine_check
,
208 .max_isa_dma_address
= ALPHA_MAX_ISA_DMA_ADDRESS
,
209 .min_io_address
= DEFAULT_IO_BASE
,
210 .min_mem_address
= APECS_AND_LCA_DEFAULT_MEM_BASE
,
213 .device_interrupt
= mikasa_device_interrupt
,
215 .init_arch
= apecs_init_arch
,
216 .init_irq
= mikasa_init_irq
,
217 .init_rtc
= common_init_rtc
,
218 .init_pci
= common_init_pci
,
219 .pci_map_irq
= mikasa_map_irq
,
220 .pci_swizzle
= common_swizzle
,
225 #if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_PRIMO)
226 struct alpha_machine_vector mikasa_primo_mv __initmv
= {
227 .vector_name
= "Mikasa-Primo",
231 .machine_check
= cia_machine_check
,
232 .max_isa_dma_address
= ALPHA_MAX_ISA_DMA_ADDRESS
,
233 .min_io_address
= DEFAULT_IO_BASE
,
234 .min_mem_address
= CIA_DEFAULT_MEM_BASE
,
237 .device_interrupt
= mikasa_device_interrupt
,
239 .init_arch
= cia_init_arch
,
240 .init_irq
= mikasa_init_irq
,
241 .init_rtc
= common_init_rtc
,
242 .init_pci
= cia_init_pci
,
243 .kill_arch
= cia_kill_arch
,
244 .pci_map_irq
= mikasa_map_irq
,
245 .pci_swizzle
= common_swizzle
,
247 ALIAS_MV(mikasa_primo
)