diff --git a/paw/stos/arch/amd64/platform/hpet.c b/paw/stos/arch/amd64/platform/hpet.c index b707a7d..ad7f08e 100644 --- a/paw/stos/arch/amd64/platform/hpet.c +++ b/paw/stos/arch/amd64/platform/hpet.c @@ -36,7 +36,7 @@ HpetWriteq(UCHAR Register, UQUAD Value) } RegBase = PTR_OFFSET(MMIOBase, Register); - MMIOWrite64(MMIOBase, Value); + MMIOWrite64(RegBase, Value); } /* @@ -61,7 +61,7 @@ VOID MdHpetInit(VOID) { ACPI_HPET *Hpet; - UQUAD GeneralCap; + UQUAD GeneralCap, GeneralConf; ULONG ClkPeriod; UCHAR RevId; const ACPI_GAS *Gas; @@ -96,4 +96,11 @@ MdHpetInit(VOID) KeKnot(KNOT_MISC, "hpet: bad counter clk period\n"); if (RevId == 0) 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); }