mirror of
https://github.com/ipxe/ipxe
synced 2026-01-11 16:08:34 +03:00
[timer] Rewrite the 8254 Programmable Interval Timer support
The 8254 timer code (used to implement udelay()) has an unknown provenance. Rewrite this code to avoid potential licensing uncertainty. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -27,7 +27,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||
|
||||
#include <assert.h>
|
||||
#include <ipxe/timer.h>
|
||||
#include <ipxe/timer2.h>
|
||||
#include <ipxe/pit8254.h>
|
||||
|
||||
/**
|
||||
* Number of TSC ticks per microsecond
|
||||
@@ -56,10 +56,10 @@ static void rdtsc_udelay ( unsigned long usecs ) {
|
||||
elapsed = ( currticks() - start );
|
||||
} while ( elapsed < ( usecs * rdtsc_ticks_per_usec ) );
|
||||
} else {
|
||||
/* Not yet calibrated; use timer2 and calibrate
|
||||
/* Not yet calibrated; use 8254 PIT and calibrate
|
||||
* based on result.
|
||||
*/
|
||||
timer2_udelay ( usecs );
|
||||
pit8254_udelay ( usecs );
|
||||
elapsed = ( currticks() - start );
|
||||
rdtsc_ticks_per_usec = ( elapsed / usecs );
|
||||
DBG ( "RDTSC timer calibrated: %ld ticks in %ld usecs "
|
||||
|
||||
Reference in New Issue
Block a user