diff options
author | Ian Moffett <ian@osmora.org> | 2024-02-18 10:24:54 -0500 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-02-18 10:29:16 -0500 |
commit | 6eaeab88e1c0af3f7c2dd0738a5ef6b30d7ac3ed (patch) | |
tree | f176e5be08c0d8c44a4febb6508041e6a838dbab /sys/arch/amd64/amd64 | |
parent | 22fb72c9e3fe6722136a2b8f9e96f68a1876427c (diff) |
kernel/amd64: hpet: Use hint_spinwait()
This commit completes a TODO in the HPET driver
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/arch/amd64/amd64')
-rw-r--r-- | sys/arch/amd64/amd64/hpet.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/sys/arch/amd64/amd64/hpet.c b/sys/arch/amd64/amd64/hpet.c index 9835d6c..9b40db9 100644 --- a/sys/arch/amd64/amd64/hpet.c +++ b/sys/arch/amd64/amd64/hpet.c @@ -28,6 +28,7 @@ */ #include <machine/hpet.h> +#include <machine/cpu.h> #include <firmware/acpi/acpi.h> #include <sys/panic.h> #include <sys/cdefs.h> @@ -50,19 +51,6 @@ __KERNEL_META("$Hyra$: hpet.c, Ian Marco Moffett, " #define CAP_VENDOR_ID(caps) __SHIFTOUT(caps, 0xFFFF << 16) #define CAP_CLK_PERIOD(caps) (caps >> 32) -/* - * TODO: Use some sort of helper function that - * uses PAUSE or some similar instruction - * for the current architecture. It is - * *not* a good idea to spin for a prolonged - * amount of time without it. For now we'll - * just use PAUSE on x86_64 like this. - */ -#if defined(__x86_64__) -#define spinwait_hint() __ASMV("pause") -#else -#define spinwait_hint() __nothing -#endif /* defined(__x86_64__) */ static struct timer timer = { 0 }; static struct hpet *acpi_hpet = NULL; @@ -118,7 +106,7 @@ hpet_sleep(uint64_t n, uint64_t units) ticks = counter_val + (n * (units / period)); while (hpet_read(HPET_REG_MAIN_COUNTER) < ticks) { - spinwait_hint(); + hint_spinwait(); } return EXIT_SUCCESS; |