summaryrefslogtreecommitdiffstats
path: root/include/asm-parisc/irq.h
blob: b52415f41b3f66d147fe426968f2f8adabdd6e7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef _ASM_IRQ_H
#define _ASM_IRQ_H

#include <linux/string.h>
#include <asm/ptrace.h>
#include <linux/interrupt.h>

#include <asm/types.h>
/*
 *	linux/include/asm/irq.h
 *
 *	(C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar,
 *		Copyright 1999 SuSE GmbH
 *
 *	IRQ/IPI changes taken from work by Thomas Radke
 *	<tomsoft@informatik.tu-chemnitz.de>
 */

#define CPU_IRQ_REGION	 1
#define TIMER_IRQ	 (IRQ_FROM_REGION(CPU_IRQ_REGION) | 0)
#define	IPI_IRQ		 (IRQ_FROM_REGION(CPU_IRQ_REGION) | 1)

/* This should be 31 for PA1.1 binaries and 63 for PA-2.0 wide mode) */
#define MAX_CPU_IRQ	(BITS_PER_LONG - 1)

#if 1    /* set to 1 to get the new irq offsets, or ...   */
# if BITS_PER_LONG == 32
#  define IRQ_REGION_SHIFT 5
# else
#  define IRQ_REGION_SHIFT 6
# endif
#else   /* 256 irq-entries per region (wastes memory, maybe gains speed? :-))*/
# define IRQ_REGION_SHIFT 8
#endif 

#define IRQ_PER_REGION  (1 << IRQ_REGION_SHIFT)
#define NR_IRQ_REGS	8
#define NR_IRQS		(NR_IRQ_REGS * IRQ_PER_REGION)

#define IRQ_REGION(irq) 	((irq) >> IRQ_REGION_SHIFT)
#define IRQ_OFFSET(irq)		((irq) & ((1<<IRQ_REGION_SHIFT)-1))
#define	IRQ_FROM_REGION(reg)	((reg) << IRQ_REGION_SHIFT)

#define IRQ_REG_DIS	   1	/* support disable_irq / enable_irq */
#define IRQ_REG_MASK	   2	/* require IRQs to be masked */

struct irq_region_ops {
	void (*disable_irq)(void *dev, int irq);
	void (* enable_irq)(void *dev, int irq);
	void (*   mask_irq)(void *dev, int irq);
	void (* unmask_irq)(void *dev, int irq);
};

struct irq_region_data {
	void *dev;
	const char *name;
	unsigned flags;
	int irqbase;
};

struct irq_region {
	struct irq_region_ops ops;
	struct irq_region_data data;

	struct irqaction *action;
};

extern struct irq_region *irq_region[NR_IRQ_REGS];

static __inline__ int irq_cannonicalize(int irq)
{
	return irq;
}

extern void disable_irq(int);
extern void enable_irq(int);

extern void do_irq_mask(unsigned long mask, struct irq_region *region,
	struct pt_regs *regs);

extern struct irq_region *alloc_irq_region(int count, struct irq_region_ops *ops,
	unsigned long flags, const char *name, void *dev);

extern int txn_alloc_irq(void);
extern int txn_claim_irq(int);
extern unsigned int txn_alloc_data(int, unsigned int);
extern unsigned long txn_alloc_addr(int);

#endif /* _ASM_IRQ_H */