diff options
author | Marvin Borner | 2020-09-06 19:37:58 +0200 |
---|---|---|
committer | Marvin Borner | 2020-09-06 19:37:58 +0200 |
commit | 586d58192b2c576393077c3944338b582c873f45 (patch) | |
tree | 7f93d4f5168266118541ffdbcefd32696ce0b281 /kernel/drivers/acpi.c | |
parent | 2876d92663be7f1b46d72217e79b9f83d1756fd8 (diff) |
Finished switch to hpet timer
Diffstat (limited to 'kernel/drivers/acpi.c')
-rw-r--r-- | kernel/drivers/acpi.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/drivers/acpi.c b/kernel/drivers/acpi.c index 999c0ed..15007d7 100644 --- a/kernel/drivers/acpi.c +++ b/kernel/drivers/acpi.c @@ -74,15 +74,18 @@ void acpi_install() hpet = find_sdt(rsdt, HPET_MAGIC); } -void hpet_install() +void hpet_install(int period) { if (hpet && hpet->legacy_replacement && hpet->comparator_count > 0) { struct hpet_registers *r = (struct hpet_registers *)hpet->address.phys; - printf("HPET tick period: %dns\n", r->features.tick_period / 1000000); - printf("Periodic support: %d\n", r->timer.periodic_support); - r->config.enable = 1; - r->config.legacy_replacement = 1; - r->timer.enable = 1; + printf("HPET tick period: %dns\n", r->tick_period / 1000000); + if ((r->timer0 & hpet_periodic_support) == hpet_periodic_support) { + r->config |= hpet_enable; + r->config |= hpet_legacy_replacement; + r->timer0 |= hpet_periodic | hpet_set_accumulator | hpet_enable_timer; + r->timer_comparator0 = r->tick_period + period; + r->timer_comparator0 = period; + } } else { hpet = NULL; } |