/shark/trunk/oslib/kl/event.c |
---|
229,9 → 229,11 |
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 |
setup_APIC_LVTT(0xFFFFFFFF); |
} else { |
set_APIC_timer(0xFFFFFFFF); |
enable_APIC_timer(); |
} |
} else { |
t = l->tick; |
/* Translate the tick value in usec into a suitable time constant */ |
258,9 → 260,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; |
setup_APIC_LVTT(tnext); |
set_APIC_timer(tnext); |
} |
} |
} |
199,7 → 199,7 |
pit_setconstant(0, tnext); |
} else { |
tnext = (signed long long)(tnext) * apic_clk_per_msec / 1000; |
setup_APIC_LVTT(tnext); |
set_APIC_timer(tnext); |
} |
activeEvent = 0; |
} else { |
206,7 → 206,7 |
if (!use_apic) { |
pit_setconstant(0, 0xFFFF); |
} else { |
setup_APIC_LVTT(0xFFFFFFFF); |
set_APIC_timer(0xFFFFFFFF); |
} |
} |
} |
243,7 → 243,7 |
if (!use_apic) { |
pit_setconstant(0, 0xFFFF); |
} else { |
setup_APIC_LVTT(0xFFFFFFFF); |
set_APIC_timer(0xFFFFFFFF); |
} |
} else { |
if (firstdeleted) { |
260,7 → 260,7 |
pit_setconstant(0, tnext); |
} else { |
tnext = (signed long long)(tnext) * apic_clk_per_msec / 1000; |
setup_APIC_LVTT(tnext); |
set_APIC_timer(tnext); |
} |
} |
} |
/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 = 0; //Enable the APIC for P6 only |
unsigned char use_apic = 1; //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,6 → 52,7 |
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; |
493,7 → 494,8 |
#define LOCAL_TIMER_VECTOR 0x66 |
/* Set APIC Timer... from Linux kernel */ void setup_APIC_LVTT(unsigned int clocks) |
/* Set APIC Timer... from Linux kernel */ |
void setup_APIC_timer() |
{ |
unsigned int lvtt1_value, tmp_value; |
509,10 → 511,13 |
& ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE)) |
| APIC_TDR_DIV_1); |
apic_write_around(APIC_TMICT, clocks); |
apic_write_around(APIC_TMICT, 0xFFFFFFFF); |
disable_APIC_timer(); |
} |
#define APIC_LIMIT 0xFF000000 |
#define APIC_SET_LIMIT 10 |
void ll_calibrate_apic(void) |
{ |
553,6 → 558,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); |
587,6 → 593,8 |
setup_local_APIC(); |
setup_APIC_timer(); |
} |
if (use_cmos) { |
/shark/trunk/oslib/ll/i386/apic.h |
---|
127,6 → 127,21 |
#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) |
{ |
/* |
140,11 → 155,7 |
apic_write_around(APIC_EOI, 0); |
} |
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); |
extern void enable_APIC_timer(void); |
extern void disable_APIC_timer (void); |
#endif |