From 6eaeab88e1c0af3f7c2dd0738a5ef6b30d7ac3ed Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 18 Feb 2024 10:24:54 -0500 Subject: kernel/amd64: hpet: Use hint_spinwait() This commit completes a TODO in the HPET driver Signed-off-by: Ian Moffett --- sys/arch/amd64/amd64/hpet.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'sys/arch') 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 +#include #include #include #include @@ -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; -- cgit v1.2.3