If the HPET is not detected, it no longer needs to fail an assert,
as there is nothing inside the kernel that strictly relies on it.
---
 i386/i386/apic.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/i386/i386/apic.c b/i386/i386/apic.c
index 3852b9aa..a53992cd 100644
--- a/i386/i386/apic.c
+++ b/i386/i386/apic.c
@@ -423,7 +423,10 @@ hpet_init(void)
     uint32_t period;
     uint32_t val;
 
-    assert(hpet_addr != 0);
+    if (hpet_addr == 0) {
+        printf("HPET not available\n");
+        return;
+    }
 
     /* Find out how often the HPET ticks in nanoseconds */
     period = HPET32(HPET_CAP_PERIOD);
@@ -484,12 +487,11 @@ hpet_mdelay(uint32_t ms)
 uint32_t
 hpclock_read_counter(void)
 {
-    /* We assume the APIC machines have HPET.  */
 #ifdef APIC
-    return HPET32(HPET_COUNTER);
-#else
-    return 0;
+    if (hpet_addr)
+        return HPET32(HPET_COUNTER);
 #endif
+    return 0;
 }
 
 uint32_t
-- 
2.51.0



Reply via email to