/shark/trunk/oslib/kl/advtimer.c |
---|
37,7 → 37,7 |
unsigned char use_tsc = 1; //Enable the TSC counter mode |
unsigned char use_cmos = 0; //Enable the RTC correction |
unsigned char use_apic = 1; //Enable the APIC for P6 only |
unsigned char use_apic = 0; //Enable the APIC for P6 only |
//Max single delta_clk_per_msec increment = clk_per_msec / MAX_DIV_INK; |
#define MAX_DIV_INK 30000 |
52,7 → 52,6 |
signed long long * ptr_clk_per_msec = &clk_per_msec; |
signed long long apic_clk_per_msec; |
unsigned int apic_set_limit; |
signed long last_delta_clk_per_msec; |
signed long total_delta_clk_per_msec; |
494,8 → 493,7 |
#define LOCAL_TIMER_VECTOR 0x66 |
/* Set APIC Timer... from Linux kernel */ |
void setup_APIC_timer() |
/* Set APIC Timer... from Linux kernel */ void setup_APIC_LVTT(unsigned int clocks) |
{ |
unsigned int lvtt1_value, tmp_value; |
510,14 → 508,11 |
apic_write_around(APIC_TDCR, (tmp_value |
& ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE)) |
| APIC_TDR_DIV_1); |
apic_write_around(APIC_TMICT, 0xFFFFFFFF); |
disable_APIC_timer(); |
apic_write_around(APIC_TMICT, clocks); |
} |
#define APIC_LIMIT 0xFF000000 |
#define APIC_SET_LIMIT 10 |
void ll_calibrate_apic(void) |
{ |
558,8 → 553,7 |
dapic = apic_start - apic_end; |
apic_clk_per_msec = clk_per_msec * (signed long long)(dapic) / dtsc; |
apic_set_limit = ((apic_clk_per_msec / 100) == 0) ? (apic_clk_per_msec/100) : APIC_SET_LIMIT; |
message("Calibrated APIC Clk/msec = %10ld\n",(long)apic_clk_per_msec); |
} |
592,8 → 586,6 |
ll_calibrate_apic(); |
setup_local_APIC(); |
setup_APIC_timer(); |
} |
/shark/trunk/oslib/kl/event.c |
---|
229,10 → 229,8 |
if (!use_apic) { |
/* Mode: Binary/Mode 4/16 bit Time_const/Counter 0 */ |
pit_init(0, TMR_MD4, 0xFFFF); /* Timer 0, Mode 4, constant 0xFFFF */ |
} else { |
set_APIC_timer(0xFFFFFFFF); |
enable_APIC_timer(); |
} |
} else |
setup_APIC_LVTT(0xFFFFFFFF); |
} else { |
t = l->tick; |
260,9 → 258,9 |
} else { |
apic_clk = (signed long long)(t) * apic_clk_per_msec / 1000; |
set_APIC_timer(apic_clk); |
enable_APIC_timer(); |
setup_APIC_LVTT(apic_clk); |
} |
} |
timermode = l->mode; |
/shark/trunk/oslib/kl/event1.c |
---|
113,7 → 113,7 |
pit_setconstant(0, tnext); |
} else { |
tnext = (signed long long)(tnext) * apic_clk_per_msec / 1000; |
set_APIC_timer(tnext); |
setup_APIC_LVTT(tnext); |
} |
} |
} |
199,7 → 199,7 |
pit_setconstant(0, tnext); |
} else { |
tnext = (signed long long)(tnext) * apic_clk_per_msec / 1000; |
set_APIC_timer(tnext); |
setup_APIC_LVTT(tnext); |
} |
activeEvent = 0; |
} else { |
206,7 → 206,7 |
if (!use_apic) { |
pit_setconstant(0, 0xFFFF); |
} else { |
set_APIC_timer(0xFFFFFFFF); |
setup_APIC_LVTT(0xFFFFFFFF); |
} |
} |
} |
243,7 → 243,7 |
if (!use_apic) { |
pit_setconstant(0, 0xFFFF); |
} else { |
set_APIC_timer(0xFFFFFFFF); |
setup_APIC_LVTT(0xFFFFFFFF); |
} |
} else { |
if (firstdeleted) { |
260,7 → 260,7 |
pit_setconstant(0, tnext); |
} else { |
tnext = (signed long long)(tnext) * apic_clk_per_msec / 1000; |
set_APIC_timer(tnext); |
setup_APIC_LVTT(tnext); |
} |
} |
} |
/shark/trunk/oslib/ll/i386/apic.h |
---|
127,21 → 127,6 |
#define apic_read_around(x) |
#define apic_write_around(x,y) apic_write((x),(y)) |
static __inline__ void set_APIC_timer(unsigned int clocks) |
{ |
unsigned int tmp_value; |
extern unsigned int apic_set_limit; |
if (clocks < apic_set_limit) clocks = apic_set_limit; |
tmp_value = apic_read(APIC_TDCR); |
apic_write_around(APIC_TDCR, (tmp_value |
& ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE)) |
| APIC_TDR_DIV_1); |
apic_write_around(APIC_TMICT, clocks); |
} |
static __inline__ void ack_APIC_irq(void) |
{ |
/* |
155,7 → 140,11 |
apic_write_around(APIC_EOI, 0); |
} |
extern void enable_APIC_timer(void); |
extern void disable_APIC_timer (void); |
extern int get_maxlvt(void); |
extern void clear_local_APIC(void); |
extern void connect_bsp_APIC (void); |
extern void disconnect_bsp_APIC (void); |
extern void disable_local_APIC (void); |
extern void setup_APIC_LVTT(unsigned int clocks); |
#endif |