diff options
author | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2003-09-04 15:48:10 +0000 |
---|---|---|
committer | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2003-09-04 15:48:10 +0000 |
commit | b57ae3ec73a40518d79a83b24a6ce9b66cfa6636 (patch) | |
tree | cb8ca9274b2f8cc61eee67393384d8808cd75cf5 /xen | |
parent | 63dd32e592130db73d98c942719b18cf11ab312a (diff) | |
download | xen-b57ae3ec73a40518d79a83b24a6ce9b66cfa6636.tar.gz xen-b57ae3ec73a40518d79a83b24a6ce9b66cfa6636.tar.bz2 xen-b57ae3ec73a40518d79a83b24a6ce9b66cfa6636.zip |
bitkeeper revision 1.403 (3f575ebaoJ7dB2rgSY4sqPbfOQLFxA)
time.h, time.c, setup.c, apic.c:
Fixes for machines with no local APIC.
Diffstat (limited to 'xen')
-rw-r--r-- | xen/arch/i386/apic.c | 7 | ||||
-rw-r--r-- | xen/arch/i386/setup.c | 6 | ||||
-rw-r--r-- | xen/arch/i386/time.c | 6 | ||||
-rw-r--r-- | xen/include/xeno/time.h | 6 |
4 files changed, 15 insertions, 10 deletions
diff --git a/xen/arch/i386/apic.c b/xen/arch/i386/apic.c index 3aff8aa993..ecc96eab2f 100644 --- a/xen/arch/i386/apic.c +++ b/xen/arch/i386/apic.c @@ -486,7 +486,6 @@ void __init init_apic_mappings(void) static unsigned int bus_freq; static u32 bus_cycle; /* length of one bus cycle in pico-seconds */ static u32 bus_scale; /* scaling factor convert ns to bus cycles */ -u64 cpu_freq; /* * The timer chip is already set up at HZ interrupts per second here, @@ -616,7 +615,11 @@ int __init calibrate_APIC_clock(void) result / (1000000/HZ), result % (1000000/HZ)); - cpu_freq = (u64)(((t2-t1)/LOOPS)*HZ); + /* + * KAF: Moved this to time.c where it's calculated relative to the TSC. + * Therefore works on machines with no local APIC. + */ + /*cpu_freq = (u64)(((t2-t1)/LOOPS)*HZ);*/ /* set up multipliers for accurate timer code */ bus_freq = result*HZ; diff --git a/xen/arch/i386/setup.c b/xen/arch/i386/setup.c index 059d296568..4cc63616a7 100644 --- a/xen/arch/i386/setup.c +++ b/xen/arch/i386/setup.c @@ -384,7 +384,11 @@ void __init start_of_day(void) #endif initialize_keytable(); /* call back handling for key codes */ - disable_pit(); /* not needed anymore */ + if ( cpu_has_apic ) + disable_pit(); + else if ( smp_num_cpus != 1 ) + panic("We really need local APICs on SMP machines!"); + ac_timer_init(); /* init accurate timers */ init_xeno_time(); /* initialise the time */ schedulers_start(); /* start scheduler for each CPU */ diff --git a/xen/arch/i386/time.c b/xen/arch/i386/time.c index 7d34bb4098..1797eb7d72 100644 --- a/xen/arch/i386/time.c +++ b/xen/arch/i386/time.c @@ -54,7 +54,8 @@ int timer_ack = 0; static unsigned int rdtsc_bitshift; /* Which 32 bits of TSC do we use? */ static unsigned long init_cmos_time; /* RTC time when system time == 0 */ -static u64 cpu_freqs[3]; /* Slow/correct/fast CPU freqs */ +static u64 cpu_freqs[3]; /* Slow/correct/fast CPU frequencies */ +static u64 cpu_freq; /* Currently-selected CPU frequency */ static u32 st_scale_f; /* Cycles -> ns, fractional part */ static u32 st_scale_i; /* Cycles -> ns, integer part */ static struct ac_timer update_timer; /* Periodic 'time update' function */ @@ -92,6 +93,7 @@ static inline void do_timer_interrupt( } #endif do_timer(regs); + do_ac_timer(); } /* @@ -501,6 +503,8 @@ void __init time_init(void) ticks_per_usec = ticks_per_frac / (1000000/CALIBRATE_FRAC); cpu_khz = ticks_per_frac / (1000/CALIBRATE_FRAC); + cpu_freq = (u64)ticks_per_frac * (u64)CALIBRATE_FRAC; + printk("Detected %lu.%03lu MHz processor.\n", cpu_khz / 1000, cpu_khz % 1000); diff --git a/xen/include/xeno/time.h b/xen/include/xeno/time.h index 51b8a3ecee..c30fe56140 100644 --- a/xen/include/xeno/time.h +++ b/xen/include/xeno/time.h @@ -37,12 +37,6 @@ */ extern int init_xeno_time(); -/* - * Cycle Counter Time (defined in asm/time.h) - */ - - -extern u64 cpu_freq; /* * System Time |