apic: fix lapic timer divider (fixes wrong lapic frequency on boot)
loading the divider before programming one shot mode *sometimes* gives the wrong frequency. (X200s got 192Mhz vs. 266Mhz, after 5 boot attempts) also reload the divider after programming periodic mode. (from http://wiki.osdev.org/APIC_timer)
This commit is contained in:
parent
a59b0bd6a8
commit
3487653524
1 changed files with 7 additions and 1 deletions
|
@ -124,6 +124,12 @@ lapiconline(void)
|
||||||
lapicw(LapicTICR, lapictimer.max);
|
lapicw(LapicTICR, lapictimer.max);
|
||||||
lapicw(LapicTIMER, LapicCLKIN|LapicPERIODIC|(VectorPIC+IrqTIMER));
|
lapicw(LapicTIMER, LapicCLKIN|LapicPERIODIC|(VectorPIC+IrqTIMER));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* not strickly neccesary, but reported (osdev.org) to be
|
||||||
|
* required for some machines.
|
||||||
|
*/
|
||||||
|
lapicw(LapicTDCR, lapictdxtab[lapictimer.tdx]);
|
||||||
|
|
||||||
lapicw(LapicTPR, 0);
|
lapicw(LapicTPR, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,8 +140,8 @@ static void
|
||||||
lapictimerinit(void)
|
lapictimerinit(void)
|
||||||
{
|
{
|
||||||
Retry:
|
Retry:
|
||||||
lapicw(LapicTDCR, lapictdxtab[lapictimer.tdx]);
|
|
||||||
lapicw(LapicTIMER, ApicIMASK|LapicCLKIN|LapicONESHOT|(VectorPIC+IrqTIMER));
|
lapicw(LapicTIMER, ApicIMASK|LapicCLKIN|LapicONESHOT|(VectorPIC+IrqTIMER));
|
||||||
|
lapicw(LapicTDCR, lapictdxtab[lapictimer.tdx]);
|
||||||
|
|
||||||
if(lapictimer.hz == 0ULL){
|
if(lapictimer.hz == 0ULL){
|
||||||
uvlong x, v, hz;
|
uvlong x, v, hz;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue