3 * ===================================
4 * HARP | Host ATM Research Platform
5 * ===================================
8 * This Host ATM Research Platform ("HARP") file (the "Software") is
9 * made available by Network Computing Services, Inc. ("NetworkCS")
10 * "AS IS". NetworkCS does not provide maintenance, improvements or
11 * support of any kind.
13 * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
14 * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
15 * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
16 * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
17 * In no event shall NetworkCS be responsible for any damages, including
18 * but not limited to consequential damages, arising from or relating to
19 * any use of the Software or related support.
21 * Copyright 1994-1998 Network Computing Services, Inc.
23 * Copies of this Software may be made, however, the above copyright
24 * notice must be reproduced on all copies.
26 * @(#) $FreeBSD: src/sys/dev/hfa/fore_intr.c,v 1.3 1999/08/28 00:41:50 peter Exp $
27 * @(#) $DragonFly: src/sys/dev/atm/hfa/fore_intr.c,v 1.2 2003/06/17 04:28:27 dillon Exp $
31 * FORE Systems 200-Series Adapter Support
32 * ---------------------------------------
34 * Interrupt processing
38 #include <dev/hfa/fore_include.h>
42 * Polling interrupt routine
44 * Polling interrupts are handled by calling all interrupt service
45 * routines for a given level until someone claims to have "handled" the
48 * Called at interrupt level.
54 * 1 an interrupt has been serviced
55 * 0 no interrupts serviced
65 * See if any of our devices are interrupting
67 for ( unit = 0; unit < fore_nunits; unit++ )
69 Fore_unit *fup = fore_units[unit];
74 serviced += fore_intr((void *)fup);
78 * Indicate if we handled an interrupt
80 return (serviced ? 1 : 0);
82 #endif /* defined(sun) */
86 * Device interrupt routine
88 * Called at interrupt level.
91 * arg pointer to device unit structure
94 * 1 device interrupt was serviced
95 * 0 no interrupts serviced
98 #if (defined(BSD) && (BSD <= 199306))
106 Fore_unit *fup = arg;
108 #if (defined(BSD) && (BSD <= 199306))
113 * Try to prevent stuff happening after we've paniced
120 * Get to the microcode shared memory interface
122 if ((aap = fup->fu_aali) == NULL)
126 * Has this card issued an interrupt??
131 if (aap->aali_intr_sent) {
135 * Indicate that we've serviced an interrupt.
137 #if (defined(BSD) && (BSD <= 199306))
142 * Clear the device interrupt
144 switch (fup->fu_config.ac_device) {
147 case DEV_FORE_SBA200E:
148 SBA200E_HCR_SET(*fup->fu_ctlreg, SBA200E_CLR_SBUS_INTR);
151 case DEV_FORE_SBA200:
152 *fup->fu_ctlreg = SBA200_CLR_SBUS_INTR;
156 case DEV_FORE_PCA200E:
157 PCA200E_HCR_SET(*fup->fu_ctlreg, PCA200E_CLR_HBUS_INT);
162 aap->aali_intr_sent = CP_WRITE(0);
165 * Reset the watchdog timer
167 fup->fu_timer = FORE_WATCHDOG;
170 * Device initialization handled separately
172 if ((fup->fu_flags & CUF_INITED) == 0) {
175 * We're just initializing device now, so see if
176 * the initialization command has completed
178 if (CP_READ(aap->aali_init.init_status) &
180 fore_initialize_complete(fup);
183 * If we're still not inited, none of the host
184 * queues are setup yet
186 if ((fup->fu_flags & CUF_INITED) == 0)
191 * Drain the queues of completed work
194 fore_recv_drain(fup);
195 fore_xmit_drain(fup);
198 * Supply more buffers to the CP
200 fore_buf_supply(fup);
204 #if (defined(BSD) && (BSD <= 199306))
213 * Watchdog timeout routine
215 * Called when we haven't heard from the card in a while. Just in case
216 * we missed an interrupt, we'll drain the queues and try to resupply the
217 * CP with more receive buffers. If the CP is partially wedged, hopefully
218 * this will be enough to get it going again.
220 * Called with interrupts locked out.
223 * fup pointer to device unit structure
234 * Try to prevent stuff happening after we've paniced
241 * Reset the watchdog timer
243 fup->fu_timer = FORE_WATCHDOG;
246 * If the device is initialized, nudge it (wink, wink)
248 if (fup->fu_flags & CUF_INITED) {
251 * Drain the queues of completed work
254 fore_recv_drain(fup);
255 fore_xmit_drain(fup);
258 * Supply more buffers to the CP
260 fore_buf_supply(fup);