summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/amd64/machdep.c18
-rw-r--r--sys/arch/amd64/include/cpu.h3
2 files changed, 16 insertions, 5 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index b733ce6575f..06acb920ebe 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.282 2022/10/30 17:43:39 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.283 2022/11/08 14:46:51 cheloha Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -2073,12 +2073,22 @@ check_context(const struct reg *regs, struct trapframe *tf)
return 0;
}
+int amd64_delay_quality;
+
void
delay_init(void(*fn)(int), int fn_quality)
{
- static int cur_quality = 0;
- if (fn_quality > cur_quality) {
+ if (fn_quality > amd64_delay_quality) {
delay_func = fn;
- cur_quality = fn_quality;
+ amd64_delay_quality = fn_quality;
+ }
+}
+
+void
+delay_fini(void (*fn)(int))
+{
+ if (fn == delay_func) {
+ delay_func = i8254_delay;
+ amd64_delay_quality = 0;
}
}
diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h
index 1a8c6ddb7b9..d5ce2f5d717 100644
--- a/sys/arch/amd64/include/cpu.h
+++ b/sys/arch/amd64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.151 2022/09/20 14:28:27 robert Exp $ */
+/* $OpenBSD: cpu.h,v 1.152 2022/11/08 14:46:51 cheloha Exp $ */
/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
/*-
@@ -360,6 +360,7 @@ void signotify(struct proc *);
* We need a machine-independent name for this.
*/
extern void (*delay_func)(int);
+void delay_fini(void (*)(int));
void delay_init(void (*)(int), int);
struct timeval;