1/*
2 *  linux/include/asm-arm/mach/irq.h
3 *
4 *  Copyright (C) 1995-2000 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARM_MACH_IRQ_H
11#define __ASM_ARM_MACH_IRQ_H
12
13struct irqdesc;
14struct pt_regs;
15struct seq_file;
16
17typedef void (*irq_handler_t)(unsigned int, struct irqdesc *, struct pt_regs *);
18typedef void (*irq_control_t)(unsigned int);
19
20struct irqchip {
21	/*
22	 * Acknowledge the IRQ.
23	 * If this is a level-based IRQ, then it is expected to mask the IRQ
24	 * as well.
25	 */
26	void (*ack)(unsigned int);
27	/*
28	 * Mask the IRQ in hardware.
29	 */
30	void (*mask)(unsigned int);
31	/*
32	 * Unmask the IRQ in hardware.
33	 */
34	void (*unmask)(unsigned int);
35	/*
36	 * Re-run the IRQ
37	 */
38	void (*rerun)(unsigned int);
39	/*
40	 * Set the type of the IRQ.
41	 */
42	int (*type)(unsigned int, unsigned int);
43};
44
45struct irqdesc {
46	irq_handler_t	handle;
47	struct irqchip	*chip;
48	struct irqaction *action;
49
50	unsigned int	enabled  : 1;		/* IRQ is currently enabled   */
51	unsigned int	triggered: 1;		/* IRQ has occurred	      */
52	unsigned int	running  : 1;		/* IRQ is running             */
53	unsigned int	pending  : 1;		/* IRQ is pending	      */
54	unsigned int	probing  : 1;		/* IRQ in use for a probe     */
55	unsigned int	probe_ok : 1;		/* IRQ can be used for probe  */
56	unsigned int	valid    : 1;		/* IRQ claimable	      */
57	unsigned int	noautoenable : 1;	/* don't automatically enable IRQ */
58	unsigned int	unused   :23;
59	unsigned int	depth;			/* disable depth	      */
60
61	/*
62	 * IRQ lock detection
63	 */
64	unsigned int	lck_cnt;
65	unsigned int	lck_pc;
66	unsigned int	lck_jif;
67};
68
69extern struct irqdesc irq_desc[];
70
71/*
72 * This is internal.  Do not use it.
73 */
74extern void (*init_arch_irq)(void);
75extern void init_FIQ(void);
76extern int show_fiq_list(struct seq_file *, void *);
77void __set_irq_handler(unsigned int irq, irq_handler_t, int);
78
79/*
80 * External stuff.
81 */
82#define set_irq_handler(irq,handler)		__set_irq_handler(irq,handler,0)
83#define set_irq_chained_handler(irq,handler)	__set_irq_handler(irq,handler,1)
84
85void set_irq_chip(unsigned int irq, struct irqchip *);
86void set_irq_flags(unsigned int irq, unsigned int flags);
87
88#define IRQF_VALID	(1 << 0)
89#define IRQF_PROBE	(1 << 1)
90#define IRQF_NOAUTOEN	(1 << 2)
91
92/*
93 * Built-in IRQ handlers.
94 */
95void do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
96void do_edge_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
97void do_simple_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
98void do_bad_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
99void dummy_mask_unmask_irq(unsigned int irq);
100
101#endif
102