1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License.  See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994 by Waldorf GMBH, written by Ralf Baechle
7 * Copyright (C) 1995, 96, 97, 98, 99, 2000, 01, 02 by Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 2001 Kanoj Sarcar
10 */
11#ifndef _ASM_IRQ_H
12#define _ASM_IRQ_H
13
14#include <linux/config.h>
15#include <asm/sn/arch.h>
16
17#define NR_IRQS 256
18
19/*
20 * Number of levels in INT_PEND0. Can be set to 128 if we also
21 * consider INT_PEND1.
22 */
23#define PERNODE_LEVELS	64
24
25extern int node_level_to_irq[MAX_COMPACT_NODES][PERNODE_LEVELS];
26
27/*
28 * we need to map irq's up to at least bit 7 of the INT_MASK0_A register
29 * since bits 0-6 are pre-allocated for other purposes.
30 */
31#define LEAST_LEVEL	7
32#define FAST_IRQ_TO_LEVEL(i)	((i) + LEAST_LEVEL)
33#define LEVEL_TO_IRQ(c, l) \
34			(node_level_to_irq[CPUID_TO_COMPACT_NODEID(c)][(l)])
35
36#ifdef CONFIG_I8259
37static inline int irq_cannonicalize(int irq)
38{
39	return ((irq == 2) ? 9 : irq);
40}
41#else
42#define irq_cannonicalize(irq) (irq)	/* Sane hardware, sane code ... */
43#endif
44
45struct irqaction;
46extern int i8259_setup_irq(int irq, struct irqaction * new);
47
48extern void disable_irq(unsigned int);
49extern void disable_irq_nosync(unsigned int);
50extern void enable_irq(unsigned int);
51
52/* Machine specific interrupt initialization  */
53extern void (*irq_setup)(void);
54
55extern void init_generic_irq(void);
56
57#endif /* _ASM_IRQ_H */
58