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.
31 * FORE Systems 200-Series Adapter Support
32 * ---------------------------------------
34 * Interrupt processing
38 #include <sys/param.h>
39 #include <sys/systm.h>
40 #include <sys/socket.h>
42 #include <netatm/port.h>
43 #include <netatm/queue.h>
44 #include <netatm/atm.h>
45 #include <netatm/atm_sys.h>
46 #include <netatm/atm_cm.h>
47 #include <netatm/atm_if.h>
48 #include <dev/pci/pcivar.h>
49 #include <dev/hfa/fore.h>
50 #include <dev/hfa/fore_aali.h>
51 #include <dev/hfa/fore_slave.h>
52 #include <dev/hfa/fore_stats.h>
53 #include <dev/hfa/fore_var.h>
54 #include <dev/hfa/fore_include.h>
57 __RCSID("@(#) $FreeBSD$");
62 * Polling interrupt routine
64 * Polling interrupts are handled by calling all interrupt service
65 * routines for a given level until someone claims to have "handled" the
68 * Called at interrupt level.
74 * 1 an interrupt has been serviced
75 * 0 no interrupts serviced
85 * See if any of our devices are interrupting
87 for ( unit = 0; unit < fore_nunits; unit++ )
89 Fore_unit *fup = fore_units[unit];
94 serviced += fore_intr((void *)fup);
98 * Indicate if we handled an interrupt
100 return (serviced ? 1 : 0);
102 #endif /* defined(sun) */
106 * Device interrupt routine
108 * Called at interrupt level.
111 * arg pointer to device unit structure
114 * 1 device interrupt was serviced
115 * 0 no interrupts serviced
118 #if (defined(BSD) && (BSD <= 199306))
126 Fore_unit *fup = arg;
128 #if (defined(BSD) && (BSD <= 199306))
133 * Try to prevent stuff happening after we've paniced
140 * Get to the microcode shared memory interface
142 if ((aap = fup->fu_aali) == NULL)
146 * Has this card issued an interrupt??
151 * Indicate that we've serviced an interrupt.
153 #if (defined(BSD) && (BSD <= 199306))
158 * Clear the device interrupt
160 if (fup->fu_config.ac_device == DEV_FORE_PCA200E)
161 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) {
179 * We're just initializing device now, so see if
180 * the initialization command has completed
182 if (CP_READ(aap->aali_init.init_status) &
184 fore_initialize_complete(fup);
187 * If we're still not inited, none of the host
188 * queues are setup yet
190 if ((fup->fu_flags & CUF_INITED) == 0)
195 * Drain the queues of completed work
198 fore_recv_drain(fup);
199 fore_xmit_drain(fup);
202 * Supply more buffers to the CP
204 fore_buf_supply(fup);
208 #if (defined(BSD) && (BSD <= 199306))
217 * Watchdog timeout routine
219 * Called when we haven't heard from the card in a while. Just in case
220 * we missed an interrupt, we'll drain the queues and try to resupply the
221 * CP with more receive buffers. If the CP is partially wedged, hopefully
222 * this will be enough to get it going again.
224 * Called with interrupts locked out.
227 * fup pointer to device unit structure
238 * Try to prevent stuff happening after we've paniced
245 * Reset the watchdog timer
247 fup->fu_timer = FORE_WATCHDOG;
250 * If the device is initialized, nudge it (wink, wink)
252 if (fup->fu_flags & CUF_INITED) {
255 * Drain the queues of completed work
258 fore_recv_drain(fup);
259 fore_xmit_drain(fup);
262 * Supply more buffers to the CP
264 fore_buf_supply(fup);