Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 25341
b: refs/heads/master
c: b20367a
h: refs/heads/master
i:
  25339: b381421
v: v3
  • Loading branch information
Jordan Hargrave authored and Linus Torvalds committed Apr 9, 2006
1 parent ebeec2d commit d3cbd5a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 49c93e84d8b2d602a07c302c7e3cd4fa09095fbb
refs/heads/master: b20367a6c2a0cd937cb1f0a8cf848f1402fef99c
2 changes: 2 additions & 0 deletions trunk/arch/x86_64/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,8 @@ void __init time_init(void)
vxtime.hpet_address = 0;

if (hpet_use_timer) {
/* set tick_nsec to use the proper rate for HPET */
tick_nsec = TICK_NSEC_HPET;
cpu_khz = hpet_calibrate_tsc();
timename = "HPET";
#ifdef CONFIG_X86_PM_TIMER
Expand Down
1 change: 1 addition & 0 deletions trunk/include/asm-i386/hpet.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
* then 32 bit HPET counter wrapsaround in less than 0.5 sec.
*/
#define HPET_MIN_PERIOD (100000UL)
#define HPET_TICK_RATE (HZ * 100000UL)

extern unsigned long hpet_tick; /* hpet clks count per tick */
extern unsigned long hpet_address; /* hpet memory map physical address */
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/asm-x86_64/hpet.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@

#define HPET_TN_ROUTE_SHIFT 9

#define HPET_TICK_RATE (HZ * 100000UL)

extern int is_hpet_enabled(void);
extern int hpet_rtc_timer_init(void);
extern int oem_force_hpet_timer(void);
Expand Down
6 changes: 6 additions & 0 deletions trunk/include/linux/jiffies.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
/* LATCH is used in the interval timer and ftape setup. */
#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */

#define LATCH_HPET ((HPET_TICK_RATE + HZ/2) / HZ)

/* Suppose we want to devide two numbers NOM and DEN: NOM/DEN, the we can
* improve accuracy by shifting LSH bits, hence calculating:
* (NOM << LSH) / DEN
Expand All @@ -51,9 +53,13 @@
/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */
#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8))

#define ACTHZ_HPET (SH_DIV (HPET_TICK_RATE, LATCH_HPET, 8))

/* TICK_NSEC is the time between ticks in nsec assuming real ACTHZ */
#define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8))

#define TICK_NSEC_HPET (SH_DIV(1000000UL * 1000, ACTHZ_HPET, 8))

/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)

Expand Down
2 changes: 1 addition & 1 deletion trunk/kernel/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ static void time_interpolator_update(long delta_nsec)
*/
if (jiffies % INTERPOLATOR_ADJUST == 0)
{
if (time_interpolator->skips == 0 && time_interpolator->offset > TICK_NSEC)
if (time_interpolator->skips == 0 && time_interpolator->offset > tick_nsec)
time_interpolator->nsec_per_cyc--;
if (time_interpolator->ns_skipped > INTERPOLATOR_MAX_SKIP && time_interpolator->offset == 0)
time_interpolator->nsec_per_cyc++;
Expand Down

0 comments on commit d3cbd5a

Please sign in to comment.