summaryrefslogtreecommitdiff
path: root/i386/i386at/model_dep.c
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2023-03-06 07:05:03 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-03-07 01:03:08 +0100
commit29564c619f33702033ecf0a86caac7a294f1887f (patch)
treef1a496e5893996ffd4ef30536cdcc14562b769de /i386/i386at/model_dep.c
parentdac167f036465e9d7cca10c52d8345773d2e6c3f (diff)
lapic timer: Calibrate via mach timer not PIT
Previously the lapic timer was calibrated by one-shot PIT timer2. This method can be buggy and generally unused in emulation environments. This patch reworks the timer calibration to use a mach timer based on regular PIT interrupts to remapped IOAPIC pin. This also changes the primary clock source to use PIT timer0 remapped to an IOAPIC pin when APIC mode is enabled, instead of a periodic lapic timer. Message-Id: <20230306070452.292697-1-damien@zamaudio.com>
Diffstat (limited to 'i386/i386at/model_dep.c')
-rw-r--r--i386/i386at/model_dep.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index baff8da1..e8462ba3 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -171,7 +171,7 @@ void machine_init(void)
#if defined(APIC)
ioapic_configure();
#endif
- startrtclock();
+ clkstart();
#if defined(APIC)
#warning FIXME: Rather unmask them from their respective drivers
@@ -593,7 +593,11 @@ void
startrtclock(void)
{
#ifdef APIC
- lapic_enable_timer();
+ unmask_irq(timer_pin);
+ calibrate_lapic_timer();
+ if (cpu_number() != 0) {
+ lapic_enable_timer();
+ }
#else
clkstart();
unmask_irq(0);