13 #include <linux/errno.h>
14 #include <linux/signal.h>
15 #include <linux/sched.h>
16 #include <linux/types.h>
19 #include <linux/timex.h>
21 #include <linux/random.h>
22 #include <linux/kernel.h>
25 #include <linux/bitops.h>
27 #include <asm/bootinfo.h>
31 #include <asm/processor.h>
33 #include <asm/sn/addrs.h>
35 #include <asm/sn/arch.h>
37 #include <asm/sn/intr.h>
64 #define IRQ_TO_BRIDGE(i) irq_to_bridge[(i)]
65 #define SLOT_FROM_PCI_IRQ(i) irq_to_slot[i]
67 static inline int alloc_level(
int cpu,
int irq)
75 panic(
"Cpu %d flooded with devices", cpu);
83 static inline int find_level(
cpuid_t *cpunum,
int irq)
98 panic(
"Could not identify cpu/level for irq %d", irq);
104 static int ms1bit(
unsigned long x)
108 s = 16;
if (x >> 16 == 0)
s = 0; b +=
s; x >>=
s;
109 s = 8;
if (x >> 8 == 0)
s = 0; b +=
s; x >>=
s;
110 s = 4;
if (x >> 4 == 0)
s = 0; b +=
s; x >>=
s;
111 s = 2;
if (x >> 2 == 0)
s = 0; b +=
s; x >>=
s;
112 s = 1;
if (x >> 1 == 0)
s = 0; b +=
s;
129 static void ip27_do_irq_mask0(
void)
145 swlevel = ms1bit(pend0);
172 static void ip27_do_irq_mask1(
void)
188 swlevel = ms1bit(pend1);
197 static void ip27_prof_timer(
void)
202 static void ip27_hub_error(
void)
207 static int intr_connect_level(
int cpu,
int bit)
225 static int intr_disconnect_level(
int cpu,
int bit)
244 static unsigned int startup_bridge_irq(
struct irq_data *
d)
256 pr_debug(
"bridge_startup(): irq= 0x%x pin=%d\n", d->
irq, pin);
261 swlevel = find_level(&cpu, d->
irq);
280 device &= ~(7 << (pin*3));
281 device |= (pin << (pin*3));
284 bridge->b_wid_tflush;
286 intr_connect_level(cpu, swlevel);
292 static void shutdown_bridge_irq(
struct irq_data *
d)
306 swlevel = find_level(&cpu, d->
irq);
307 intr_disconnect_level(cpu, swlevel);
310 bridge->b_wid_tflush;
313 static inline void enable_bridge_irq(
struct irq_data *
d)
318 swlevel = find_level(&cpu, d->
irq);
319 intr_connect_level(cpu, swlevel);
322 static inline void disable_bridge_irq(
struct irq_data *
d)
327 swlevel = find_level(&cpu, d->
irq);
328 intr_disconnect_level(cpu, swlevel);
331 static struct irq_chip bridge_irq_type = {
333 .irq_startup = startup_bridge_irq,
334 .irq_shutdown = shutdown_bridge_irq,
335 .irq_mask = disable_bridge_irq,
336 .irq_unmask = enable_bridge_irq,
358 swlevel = alloc_level(cpu, irq);
369 intr_connect_level(cpu, swlevel);