kernel: Sync ACPICA with Intel's version 20140424.
[dragonfly.git] / sys / dev / atm / hfa / fore_timer.c
1 /*
2  *
3  * ===================================
4  * HARP  |  Host ATM Research Platform
5  * ===================================
6  *
7  *
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.
12  *
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.
20  *
21  * Copyright 1994-1998 Network Computing Services, Inc.
22  *
23  * Copies of this Software may be made, however, the above copyright
24  * notice must be reproduced on all copies.
25  *
26  *      @(#) $FreeBSD: src/sys/dev/hfa/fore_timer.c,v 1.3 1999/08/28 00:41:52 peter Exp $
27  *      @(#) $DragonFly: src/sys/dev/atm/hfa/fore_timer.c,v 1.4 2008/03/01 22:03:13 swildner Exp $
28  */
29
30 /*
31  * FORE Systems 200-Series Adapter Support
32  * ---------------------------------------
33  *
34  * Timer processing
35  *
36  */
37
38 #include "fore_include.h"
39
40 /*
41  * Process a Fore timer tick
42  * 
43  * This function is called every FORE_TIME_TICK seconds in order to update
44  * all of the unit watchdog timers.  
45  *
46  * Called at splnet.
47  *
48  * Arguments:
49  *      tip     pointer to fore timer control block
50  *
51  * Returns:
52  *      none
53  *
54  */
55 void
56 fore_timeout(struct atm_time *tip)
57 {
58         Fore_unit       *fup;
59         int             i;
60
61
62         /*
63          * Schedule next timeout
64          */
65         atm_timeout(&fore_timer, ATM_HZ * FORE_TIME_TICK, fore_timeout);
66
67         /*
68          * Run through all units, updating each active timer.
69          * If an expired timer is found, notify that unit.
70          */
71         for (i = 0; i < fore_nunits; i++) {
72
73                 if ((fup = fore_units[i]) == NULL)
74                         continue;
75
76                 /*
77                  * Decrement timer, if it's active
78                  */
79                 if (fup->fu_timer && (--fup->fu_timer == 0)) {
80
81                         /*
82                          * Timeout occurred - go check out the queues
83                          */
84                         ATM_DEBUG0("fore_timeout\n");
85                         DEVICE_LOCK((Cmn_unit *)fup);
86                         fore_watchdog(fup);
87                         DEVICE_UNLOCK((Cmn_unit *)fup);
88                 }
89         }
90 }
91