Skip to contentSkip to conversation

HPET: make frequency calculations 32 bit safe

PATCH Karsten Wiese 2 participants 2 messages Sep 23, 2005 – Sep 26, 2005

lore
Share & tools
lore
#0 lore raw

drivers/char/hpet.c 2005-09-22 12:08:48.000000000 +0200 struct hpets { · line 81

Quoted 8 lines
drivers/char/hpet.c 2005-09-22 12:08:48.000000000 +0200 renamed from drivers/char/hpet.c 2005-09-22 11:10:01.000000000 +0200 +1 -1
@@ -78,7 +78,7 @@ struct hpets {
        struct hpet __iomem *hp_hpet;
        unsigned long hp_hpet_phys;
        struct time_interpolator *hp_interpolator;
-       unsigned long hp_period;
+       unsigned long long hp_tick_freq;

An 'unsigned long' is enough.
Are we expecting hpets stepping at more than 4GHz? They are called 'legacy' in some docs already ;-) Here the via8237's hpet runs at ~14MHz.

drivers/char/hpet.c 2005-09-22 12:08:48.000000000 +0200 struct hpets { · line 84

Quoted 3 lines
drivers/char/hpet.c 2005-09-22 12:08:48.000000000 +0200 renamed from drivers/char/hpet.c 2005-09-22 11:10:01.000000000 +0200 +0 -0
        unsigned long hp_delta;
        unsigned int hp_ntimer;
        unsigned int hp_which;

Tested OK on i386 2.6.13-rt14 with above nitpick applied.

Karsten

___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de

#1 lore raw
Quoted 8 lines · Karsten Wiese

drivers/char/hpet.c 2005-09-22 12:08:48.000000000 +0200

Quoted 5 lines
drivers/char/hpet.c 2005-09-22 12:08:48.000000000 +0200 renamed from drivers/char/hpet.c 2005-09-22 11:10:01.000000000 +0200 +1 -1
...
-       unsigned long hp_period;
+       unsigned long long hp_tick_freq;

An 'unsigned long' is enough.
Are we expecting hpets stepping at more than 4GHz?

The HPET specification allows up to 10 GHz.

Quoted 1 line

They are called 'legacy' in some docs already ;-)

Do these docs mention a non-legacy alternative?

Quoted 1 line

Here the via8237's hpet runs at ~14MHz.

AFAIK all current implementations still use the good ol' 14.138180MHz timer.

Regards,
Clemens