[PATCH v2 2/2 gnumach] HPET: Make this hardware an optional component
Damien Zammit <[email protected]> Tue, 04 Aug 2026 04:08:40 +0000
| Newsgroups | gmane.os.hurd.bugs |
|---|---|
| Message-ID | <[email protected]> |
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;
=20
- assert(hpet_addr !=3D 0);
+ if (hpet_addr =3D=3D 0) {
+ printf("HPET not available\n");
+ return;
+ }
=20
/* Find out how often the HPET ticks in nanoseconds */
period =3D 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;
}
=20
uint32_t
--=20
2.51.0