irqhandler.h revision 1.1 1 1.1 thorpej /* $NetBSD: irqhandler.h,v 1.1 2002/02/10 01:57:23 thorpej Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*
4 1.1 thorpej * Copyright (c) 1994-1996 Mark Brinicombe.
5 1.1 thorpej * Copyright (c) 1994 Brini.
6 1.1 thorpej * All rights reserved.
7 1.1 thorpej *
8 1.1 thorpej * This code is derived from software written for Brini by Mark Brinicombe
9 1.1 thorpej *
10 1.1 thorpej * Redistribution and use in source and binary forms, with or without
11 1.1 thorpej * modification, are permitted provided that the following conditions
12 1.1 thorpej * are met:
13 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
14 1.1 thorpej * notice, this list of conditions and the following disclaimer.
15 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
17 1.1 thorpej * documentation and/or other materials provided with the distribution.
18 1.1 thorpej * 3. All advertising materials mentioning features or use of this software
19 1.1 thorpej * must display the following acknowledgement:
20 1.1 thorpej * This product includes software developed by Mark Brinicombe
21 1.1 thorpej * for the NetBSD Project.
22 1.1 thorpej * 4. The name of the company nor the name of the author may be used to
23 1.1 thorpej * endorse or promote products derived from this software without specific
24 1.1 thorpej * prior written permission.
25 1.1 thorpej *
26 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
27 1.1 thorpej * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28 1.1 thorpej * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29 1.1 thorpej * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
30 1.1 thorpej * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31 1.1 thorpej * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32 1.1 thorpej * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 1.1 thorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 1.1 thorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 1.1 thorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 1.1 thorpej * SUCH DAMAGE.
37 1.1 thorpej *
38 1.1 thorpej * IRQ related stuff (defines + structures)
39 1.1 thorpej *
40 1.1 thorpej * Created : 30/09/94
41 1.1 thorpej */
42 1.1 thorpej
43 1.1 thorpej #ifndef _ARM32_IRQHANDLER_H_
44 1.1 thorpej #define _ARM32_IRQHANDLER_H_
45 1.1 thorpej
46 1.1 thorpej #ifndef _LOCORE
47 1.1 thorpej #include <sys/types.h>
48 1.1 thorpej #endif /* _LOCORE */
49 1.1 thorpej
50 1.1 thorpej /* Define the IRQ bits */
51 1.1 thorpej
52 1.1 thorpej /*
53 1.1 thorpej * XXX this is really getting rather horrible.
54 1.1 thorpej * Shortly to be replaced with system specific interrupt tables and handling
55 1.1 thorpej */
56 1.1 thorpej
57 1.1 thorpej #ifdef OFWGENCFG
58 1.1 thorpej /* These are just made up for now! -JJK */
59 1.1 thorpej #define IRQ_TIMER0 0
60 1.1 thorpej #endif
61 1.1 thorpej
62 1.1 thorpej #ifdef SHARK
63 1.1 thorpej /*
64 1.1 thorpej * shark hardware requirements for IRQ's:
65 1.1 thorpej * IDE: 14 (hardwired)
66 1.1 thorpej * PCI: 5, 9, 10, 11, 15(mapped to UMIPCI inta, intb, intc, intd)
67 1.1 thorpej * UMIISA: 10, 11, 12
68 1.1 thorpej * SuperIO: 1, 3..12, 14, 15(all may be remapped. defaults as follows.)
69 1.1 thorpej * KBC: 1
70 1.1 thorpej * USI: 3 (UART with Slow Infrared support)
71 1.1 thorpej * UART: 4
72 1.1 thorpej * FLOPPY: 6 (not currently used on shark)
73 1.1 thorpej * PARALLEL: 7
74 1.1 thorpej * RTC: 8 (not used on shark: RTC in sequoia used)
75 1.1 thorpej * MOUSE: 12
76 1.1 thorpej * Sequoia: 8 (internal RTC hardwired to irq 8)
77 1.1 thorpej * Codec: 5, 7, 9, 10, 15 (irqe, connected to 15, has special status.)
78 1.1 thorpej * CS8900: 5, 10, 11, 12 (P.14 of datasheet sez only 1 used/time)
79 1.1 thorpej * FERR#: 13 (unconnected floating point error)
80 1.1 thorpej *
81 1.1 thorpej * total of 15 irqs:
82 1.1 thorpej * timer, ide, 2 umi = isa/pci, ethernet, 2 codec, kb, usi, uart, floppy,
83 1.1 thorpej * parallel, rtc, mouse, ferr (irq 13)
84 1.1 thorpej *
85 1.1 thorpej * eventually, need to read the OFW dev info tree, and allocate IRQs.
86 1.1 thorpej * hardcoded for now.
87 1.1 thorpej */
88 1.1 thorpej #define IRQ_TIMER0 0x00 /* hardwired to 8254 counter 0 in sequoia */
89 1.1 thorpej #define IRQ_KEYBOARD 0x01
90 1.1 thorpej #define IRQ_CASCADE 0x02 /* hardwired IRQ for second 8259 = IRQ_SLAVE */
91 1.1 thorpej #define IRQ_USI 0x03
92 1.1 thorpej #define IRQ_UART 0x04
93 1.1 thorpej #define IRQ_ETHERNET 0x05
94 1.1 thorpej #define IRQ_FLOPPY 0x06
95 1.1 thorpej #define IRQ_PARALLEL 0x07
96 1.1 thorpej
97 1.1 thorpej #define IRQ_RTC 0x08 /* hardwired to the sequoia RTC */
98 1.1 thorpej #define IRQ_CODEC1 0x09
99 1.1 thorpej #define IRQ_UMI1 0x0A /* isa or pci */
100 1.1 thorpej #define IRQ_UMI2 0x0B /* isa or pci */
101 1.1 thorpej
102 1.1 thorpej #define IRQ_MOUSE 0x0C
103 1.1 thorpej #define IRQ_FERR 0x0D /* FERR# pin on sequoia needs to be connected */
104 1.1 thorpej #define IRQ_IDE 0x0E /* hardwired to the IDE connector */
105 1.1 thorpej #define IRQ_CODEC2 0x0F /* special interrupt on codec */
106 1.1 thorpej
107 1.1 thorpej /* XXX should this go into isa_machdep.h. Somewhere else? */
108 1.1 thorpej /* Interrupt sharing types. */
109 1.1 thorpej #define IST_NONE 0 /* none */
110 1.1 thorpej #define IST_PULSE 1 /* pulsed */
111 1.1 thorpej #define IST_EDGE 2 /* edge-triggered */
112 1.1 thorpej #define IST_LEVEL 3 /* level-triggered */
113 1.1 thorpej
114 1.1 thorpej #endif /* SHARK */
115 1.1 thorpej
116 1.1 thorpej #define IRQ_VSYNC IRQ_FLYBACK /* Aliased */
117 1.1 thorpej #define IRQ_NETSLOT IRQ_EXTENDED
118 1.1 thorpej
119 1.1 thorpej #define IRQ_INSTRUCT -1
120 1.1 thorpej #define NIRQS 0x20
121 1.1 thorpej
122 1.1 thorpej #include <machine/intr.h>
123 1.1 thorpej
124 1.1 thorpej #ifndef _LOCORE
125 1.1 thorpej typedef struct irqhandler {
126 1.1 thorpej int (*ih_func) __P((void *arg));/* handler function */
127 1.1 thorpej void *ih_arg; /* Argument to handler */
128 1.1 thorpej int ih_level; /* Interrupt level */
129 1.1 thorpej int ih_num; /* Interrupt number (for accounting) */
130 1.1 thorpej const char *ih_name; /* Name of interrupt (for vmstat -i) */
131 1.1 thorpej u_int ih_flags; /* Interrupt flags */
132 1.1 thorpej u_int ih_maskaddr; /* mask address for expansion cards */
133 1.1 thorpej u_int ih_maskbits; /* interrupt bit for expansion cards */
134 1.1 thorpej struct irqhandler *ih_next; /* next handler */
135 1.1 thorpej } irqhandler_t;
136 1.1 thorpej
137 1.1 thorpej #ifdef _KERNEL
138 1.1 thorpej extern u_int irqmasks[IPL_LEVELS];
139 1.1 thorpej extern irqhandler_t *irqhandlers[NIRQS];
140 1.1 thorpej
141 1.1 thorpej void irq_init __P((void));
142 1.1 thorpej int irq_claim __P((int, irqhandler_t *));
143 1.1 thorpej int irq_release __P((int, irqhandler_t *));
144 1.1 thorpej void *intr_claim __P((int irq, int level, const char *name, int (*func) __P((void *)), void *arg));
145 1.1 thorpej int intr_release __P((void *ih));
146 1.1 thorpej void irq_setmasks __P((void));
147 1.1 thorpej void disable_irq __P((int));
148 1.1 thorpej void enable_irq __P((int));
149 1.1 thorpej #endif /* _KERNEL */
150 1.1 thorpej #endif /* _LOCORE */
151 1.1 thorpej
152 1.1 thorpej #define IRQ_FLAG_ACTIVE 0x00000001 /* This is the active handler in list */
153 1.1 thorpej
154 1.1 thorpej #endif /* _ARM32_IRQHANDLER_H_ */
155 1.1 thorpej
156 1.1 thorpej /* End of irqhandler.h */
157