summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/timer/hpet.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/timer/hpet.c b/sys/dev/timer/hpet.c
index 1089096..d276456 100644
--- a/sys/dev/timer/hpet.c
+++ b/sys/dev/timer/hpet.c
@@ -95,7 +95,7 @@ hpet_write(uint32_t reg, uint64_t val)
mmio_write64(addr, val);
}
-void
+int
hpet_msleep(size_t ms)
{
uint64_t caps;
@@ -103,6 +103,11 @@ hpet_msleep(size_t ms)
uint64_t counter_val;
volatile size_t ticks;
+ /* Don't even try if faulty, would probably cause deadlock */
+ if (is_faulty) {
+ return 1;
+ }
+
caps = hpet_read(HPET_REG_CAPS);
period = CAP_CLK_PERIOD(caps);
counter_val = hpet_read(HPET_REG_MAIN_COUNTER);
@@ -112,6 +117,8 @@ hpet_msleep(size_t ms)
while (hpet_read(HPET_REG_MAIN_COUNTER) < ticks) {
spinwait_hint();
}
+
+ return 0;
}
int