ia64/xen-unstable

changeset 689:10503d29b5f6

bitkeeper revision 1.403 (3f575ebaoJ7dB2rgSY4sqPbfOQLFxA)

time.h, time.c, setup.c, apic.c:
Fixes for machines with no local APIC.
author kaf24@scramble.cl.cam.ac.uk
date Thu Sep 04 15:48:10 2003 +0000 (2003-09-04)
parents 3837ca245e1e
children cf5bddb3603e
files xen/arch/i386/apic.c xen/arch/i386/setup.c xen/arch/i386/time.c xen/include/xeno/time.h
line diff
     1.1 --- a/xen/arch/i386/apic.c	Thu Sep 04 14:32:07 2003 +0000
     1.2 +++ b/xen/arch/i386/apic.c	Thu Sep 04 15:48:10 2003 +0000
     1.3 @@ -486,7 +486,6 @@ void __init init_apic_mappings(void)
     1.4  static unsigned int bus_freq;
     1.5  static u32          bus_cycle;   /* length of one bus cycle in pico-seconds */
     1.6  static u32          bus_scale;   /* scaling factor convert ns to bus cycles */
     1.7 -u64 cpu_freq;
     1.8  
     1.9  /*
    1.10   * The timer chip is already set up at HZ interrupts per second here,
    1.11 @@ -616,7 +615,11 @@ int __init calibrate_APIC_clock(void)
    1.12             result / (1000000/HZ), 
    1.13             result % (1000000/HZ));
    1.14  
    1.15 -    cpu_freq = (u64)(((t2-t1)/LOOPS)*HZ);
    1.16 +    /*
    1.17 +     * KAF: Moved this to time.c where it's calculated relative to the TSC. 
    1.18 +     * Therefore works on machines with no local APIC.
    1.19 +     */
    1.20 +    /*cpu_freq = (u64)(((t2-t1)/LOOPS)*HZ);*/
    1.21  
    1.22      /* set up multipliers for accurate timer code */
    1.23      bus_freq   = result*HZ;
     2.1 --- a/xen/arch/i386/setup.c	Thu Sep 04 14:32:07 2003 +0000
     2.2 +++ b/xen/arch/i386/setup.c	Thu Sep 04 15:48:10 2003 +0000
     2.3 @@ -384,7 +384,11 @@ void __init start_of_day(void)
     2.4  #endif
     2.5      initialize_keytable(); /* call back handling for key codes      */
     2.6  
     2.7 -    disable_pit();		/* not needed anymore */
     2.8 +    if ( cpu_has_apic )
     2.9 +        disable_pit();
    2.10 +    else if ( smp_num_cpus != 1 )
    2.11 +        panic("We really need local APICs on SMP machines!");
    2.12 +
    2.13      ac_timer_init();    /* init accurate timers */
    2.14      init_xeno_time();	/* initialise the time */
    2.15      schedulers_start(); /* start scheduler for each CPU */
     3.1 --- a/xen/arch/i386/time.c	Thu Sep 04 14:32:07 2003 +0000
     3.2 +++ b/xen/arch/i386/time.c	Thu Sep 04 15:48:10 2003 +0000
     3.3 @@ -54,7 +54,8 @@ int timer_ack = 0;
     3.4  
     3.5  static unsigned int    rdtsc_bitshift;  /* Which 32 bits of TSC do we use?   */
     3.6  static unsigned long   init_cmos_time;  /* RTC time when system time == 0    */
     3.7 -static u64             cpu_freqs[3];    /* Slow/correct/fast CPU freqs       */
     3.8 +static u64             cpu_freqs[3];    /* Slow/correct/fast CPU frequencies */
     3.9 +static u64             cpu_freq;        /* Currently-selected CPU frequency  */
    3.10  static u32             st_scale_f;      /* Cycles -> ns, fractional part     */
    3.11  static u32             st_scale_i;      /* Cycles -> ns, integer part        */
    3.12  static struct ac_timer update_timer;    /* Periodic 'time update' function   */
    3.13 @@ -92,6 +93,7 @@ static inline void do_timer_interrupt(
    3.14      }
    3.15  #endif
    3.16      do_timer(regs);
    3.17 +    do_ac_timer();
    3.18  }
    3.19  
    3.20  /*
    3.21 @@ -501,6 +503,8 @@ void __init time_init(void)
    3.22      ticks_per_usec = ticks_per_frac / (1000000/CALIBRATE_FRAC);
    3.23      cpu_khz = ticks_per_frac / (1000/CALIBRATE_FRAC);
    3.24  
    3.25 +    cpu_freq = (u64)ticks_per_frac * (u64)CALIBRATE_FRAC;
    3.26 +
    3.27      printk("Detected %lu.%03lu MHz processor.\n", 
    3.28             cpu_khz / 1000, cpu_khz % 1000);
    3.29  
     4.1 --- a/xen/include/xeno/time.h	Thu Sep 04 14:32:07 2003 +0000
     4.2 +++ b/xen/include/xeno/time.h	Thu Sep 04 15:48:10 2003 +0000
     4.3 @@ -37,12 +37,6 @@
     4.4   */
     4.5  extern int init_xeno_time();
     4.6  
     4.7 -/*
     4.8 - * Cycle Counter Time (defined in asm/time.h)
     4.9 - */
    4.10 -
    4.11 -
    4.12 -extern u64	cpu_freq;
    4.13  
    4.14  /*
    4.15   * System Time