stos/amd64: hpet: Enable the main counter

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
Chloe M.
2026-06-27 06:43:22 +00:00
parent 6f09c21c90
commit 096ebd9325
+9 -2
View File
@@ -36,7 +36,7 @@ HpetWriteq(UCHAR Register, UQUAD Value)
} }
RegBase = PTR_OFFSET(MMIOBase, Register); RegBase = PTR_OFFSET(MMIOBase, Register);
MMIOWrite64(MMIOBase, Value); MMIOWrite64(RegBase, Value);
} }
/* /*
@@ -61,7 +61,7 @@ VOID
MdHpetInit(VOID) MdHpetInit(VOID)
{ {
ACPI_HPET *Hpet; ACPI_HPET *Hpet;
UQUAD GeneralCap; UQUAD GeneralCap, GeneralConf;
ULONG ClkPeriod; ULONG ClkPeriod;
UCHAR RevId; UCHAR RevId;
const ACPI_GAS *Gas; const ACPI_GAS *Gas;
@@ -96,4 +96,11 @@ MdHpetInit(VOID)
KeKnot(KNOT_MISC, "hpet: bad counter clk period\n"); KeKnot(KNOT_MISC, "hpet: bad counter clk period\n");
if (RevId == 0) if (RevId == 0)
KeKnot(KNOT_MISC, "hpet: bad revision id, must not be zero\n"); KeKnot(KNOT_MISC, "hpet: bad revision id, must not be zero\n");
HpetWriteq(HPET_MAIN_COUNTER, 0);
/* Enable the counter */
GeneralConf = HpetReadq(HPET_GENERAL_CONF);
GeneralConf |= HPET_GCONF_EN;
HpetWriteq(HPET_GENERAL_CONF, GeneralConf);
} }