diff options
| author | Bruce Evans <bde@FreeBSD.org> | 1998-09-20 03:47:54 +0000 |
|---|---|---|
| committer | Bruce Evans <bde@FreeBSD.org> | 1998-09-20 03:47:54 +0000 |
| commit | a6796db6cee3da07bb032c31295ead4f09a19a78 (patch) | |
| tree | bf970d8f6d9d5557cee4754a844c48d280a116f9 | |
| parent | cc59ec0b9ea37ecc3645da9ed7bd15d20152c9c2 (diff) | |
Notes
| -rw-r--r-- | sys/amd64/amd64/tsc.c | 27 | ||||
| -rw-r--r-- | sys/amd64/isa/clock.c | 27 | ||||
| -rw-r--r-- | sys/i386/i386/tsc.c | 27 | ||||
| -rw-r--r-- | sys/i386/isa/clock.c | 27 | ||||
| -rw-r--r-- | sys/isa/atrtc.c | 27 |
5 files changed, 105 insertions, 30 deletions
diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c index 3d8f8cd50da4..667a52ef8c11 100644 --- a/sys/amd64/amd64/tsc.c +++ b/sys/amd64/amd64/tsc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.124 1998/06/09 13:10:46 phk Exp $ + * $Id: clock.c,v 1.125 1998/09/06 22:41:41 tegge Exp $ */ /* @@ -198,11 +198,26 @@ SYSCTL_OPAQUE(_debug, OID_AUTO, i8254_timecounter, CTLFLAG_RD, static void clkintr(struct clockframe frame) { - if (!i8254_ticked) - i8254_offset += timer0_max_count; - else - i8254_ticked = 0; - i8254_lastcount = 0; + if (timecounter->tc_get_timecount == i8254_get_timecount) { + /* + * Maintain i8254_offset and related variables. Optimize + * the usual case where i8254 counter rollover has not been + * detected in i8254_get_timecount() by pretending that we + * read the counter when it rolled over. Otherwise, call + * i8254_get_timecount() to do most of the work. The + * hardware counter must be read to ensure monotonicity + * despite multiple rollovers and misbehaving hardware. + */ + disable_intr(); + if (i8254_ticked) { + i8254_get_timecount(NULL); + i8254_ticked = 0; + } else { + i8254_offset += timer0_max_count; + i8254_lastcount = 0; + } + enable_intr(); + } timer_func(&frame); switch (timer0_state) { diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c index 3d8f8cd50da4..667a52ef8c11 100644 --- a/sys/amd64/isa/clock.c +++ b/sys/amd64/isa/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.124 1998/06/09 13:10:46 phk Exp $ + * $Id: clock.c,v 1.125 1998/09/06 22:41:41 tegge Exp $ */ /* @@ -198,11 +198,26 @@ SYSCTL_OPAQUE(_debug, OID_AUTO, i8254_timecounter, CTLFLAG_RD, static void clkintr(struct clockframe frame) { - if (!i8254_ticked) - i8254_offset += timer0_max_count; - else - i8254_ticked = 0; - i8254_lastcount = 0; + if (timecounter->tc_get_timecount == i8254_get_timecount) { + /* + * Maintain i8254_offset and related variables. Optimize + * the usual case where i8254 counter rollover has not been + * detected in i8254_get_timecount() by pretending that we + * read the counter when it rolled over. Otherwise, call + * i8254_get_timecount() to do most of the work. The + * hardware counter must be read to ensure monotonicity + * despite multiple rollovers and misbehaving hardware. + */ + disable_intr(); + if (i8254_ticked) { + i8254_get_timecount(NULL); + i8254_ticked = 0; + } else { + i8254_offset += timer0_max_count; + i8254_lastcount = 0; + } + enable_intr(); + } timer_func(&frame); switch (timer0_state) { diff --git a/sys/i386/i386/tsc.c b/sys/i386/i386/tsc.c index 3d8f8cd50da4..667a52ef8c11 100644 --- a/sys/i386/i386/tsc.c +++ b/sys/i386/i386/tsc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.124 1998/06/09 13:10:46 phk Exp $ + * $Id: clock.c,v 1.125 1998/09/06 22:41:41 tegge Exp $ */ /* @@ -198,11 +198,26 @@ SYSCTL_OPAQUE(_debug, OID_AUTO, i8254_timecounter, CTLFLAG_RD, static void clkintr(struct clockframe frame) { - if (!i8254_ticked) - i8254_offset += timer0_max_count; - else - i8254_ticked = 0; - i8254_lastcount = 0; + if (timecounter->tc_get_timecount == i8254_get_timecount) { + /* + * Maintain i8254_offset and related variables. Optimize + * the usual case where i8254 counter rollover has not been + * detected in i8254_get_timecount() by pretending that we + * read the counter when it rolled over. Otherwise, call + * i8254_get_timecount() to do most of the work. The + * hardware counter must be read to ensure monotonicity + * despite multiple rollovers and misbehaving hardware. + */ + disable_intr(); + if (i8254_ticked) { + i8254_get_timecount(NULL); + i8254_ticked = 0; + } else { + i8254_offset += timer0_max_count; + i8254_lastcount = 0; + } + enable_intr(); + } timer_func(&frame); switch (timer0_state) { diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index 3d8f8cd50da4..667a52ef8c11 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.124 1998/06/09 13:10:46 phk Exp $ + * $Id: clock.c,v 1.125 1998/09/06 22:41:41 tegge Exp $ */ /* @@ -198,11 +198,26 @@ SYSCTL_OPAQUE(_debug, OID_AUTO, i8254_timecounter, CTLFLAG_RD, static void clkintr(struct clockframe frame) { - if (!i8254_ticked) - i8254_offset += timer0_max_count; - else - i8254_ticked = 0; - i8254_lastcount = 0; + if (timecounter->tc_get_timecount == i8254_get_timecount) { + /* + * Maintain i8254_offset and related variables. Optimize + * the usual case where i8254 counter rollover has not been + * detected in i8254_get_timecount() by pretending that we + * read the counter when it rolled over. Otherwise, call + * i8254_get_timecount() to do most of the work. The + * hardware counter must be read to ensure monotonicity + * despite multiple rollovers and misbehaving hardware. + */ + disable_intr(); + if (i8254_ticked) { + i8254_get_timecount(NULL); + i8254_ticked = 0; + } else { + i8254_offset += timer0_max_count; + i8254_lastcount = 0; + } + enable_intr(); + } timer_func(&frame); switch (timer0_state) { diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index 3d8f8cd50da4..667a52ef8c11 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.124 1998/06/09 13:10:46 phk Exp $ + * $Id: clock.c,v 1.125 1998/09/06 22:41:41 tegge Exp $ */ /* @@ -198,11 +198,26 @@ SYSCTL_OPAQUE(_debug, OID_AUTO, i8254_timecounter, CTLFLAG_RD, static void clkintr(struct clockframe frame) { - if (!i8254_ticked) - i8254_offset += timer0_max_count; - else - i8254_ticked = 0; - i8254_lastcount = 0; + if (timecounter->tc_get_timecount == i8254_get_timecount) { + /* + * Maintain i8254_offset and related variables. Optimize + * the usual case where i8254 counter rollover has not been + * detected in i8254_get_timecount() by pretending that we + * read the counter when it rolled over. Otherwise, call + * i8254_get_timecount() to do most of the work. The + * hardware counter must be read to ensure monotonicity + * despite multiple rollovers and misbehaving hardware. + */ + disable_intr(); + if (i8254_ticked) { + i8254_get_timecount(NULL); + i8254_ticked = 0; + } else { + i8254_offset += timer0_max_count; + i8254_lastcount = 0; + } + enable_intr(); + } timer_func(&frame); switch (timer0_state) { |
