From b6552dcdb2a7974ee29716429d51abdf77ba934c Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 11 Feb 2022 01:55:13 +0000 Subject: the sleep_clocks() hook is not needed because the architectures which need to do this can do it a few moments later in a different hook --- sys/arch/amd64/amd64/acpi_machdep.c | 18 ++++++------------ sys/arch/arm64/dev/apm.c | 7 +------ sys/arch/i386/i386/acpi_machdep.c | 19 +++++++------------ sys/arch/macppc/dev/apm.c | 7 +------ sys/kern/subr_suspend.c | 3 +-- sys/sys/device.h | 3 +-- 6 files changed, 17 insertions(+), 40 deletions(-) diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c index c0cd38c7558..26f9991f091 100644 --- a/sys/arch/amd64/amd64/acpi_machdep.c +++ b/sys/arch/amd64/amd64/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.97 2022/02/10 16:41:51 deraadt Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.98 2022/02/11 01:55:12 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * @@ -375,17 +375,6 @@ acpi_attach_machdep(struct acpi_softc *sc) } #ifndef SMALL_KERNEL - -void -sleep_clocks(void *v) -{ - rtcstop(); - -#if NLAPIC > 0 - lapic_disable(); -#endif -} - /* * This function may not have local variables due to a bug between * acpi_savecpu() and the resume path. @@ -393,6 +382,11 @@ sleep_clocks(void *v) int acpi_sleep_cpu(struct acpi_softc *sc, int state) { + rtcstop(); +#if NLAPIC > 0 + lapic_disable(); +#endif + /* * ACPI defines two wakeup vectors. One is used for ACPI 1.0 * implementations - it's in the FACS table as wakeup_vector and diff --git a/sys/arch/arm64/dev/apm.c b/sys/arch/arm64/dev/apm.c index b3fd675b3f1..4e809bea00b 100644 --- a/sys/arch/arm64/dev/apm.c +++ b/sys/arch/arm64/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.11 2022/02/11 00:43:27 deraadt Exp $ */ +/* $OpenBSD: apm.c,v 1.12 2022/02/11 01:55:12 deraadt Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -350,11 +350,6 @@ apm_record_event(u_int event, const char *src, const char *msg) #ifdef SUSPEND -void -sleep_clocks(void *v) -{ -} - #ifdef MULTIPROCESSOR void diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c index bf415cd46bc..331a94d1ab1 100644 --- a/sys/arch/i386/i386/acpi_machdep.c +++ b/sys/arch/i386/i386/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.79 2022/02/10 16:41:53 deraadt Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.80 2022/02/11 01:55:12 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * @@ -334,17 +334,6 @@ acpi_attach_machdep(struct acpi_softc *sc) int save_lapic_tpr; #endif -void -sleep_clocks(void *v) -{ - rtcstop(); - -#if NLAPIC > 0 - save_lapic_tpr = lapic_tpr; - lapic_disable(); -#endif -} - /* * This function may not have local variables due to a bug between * acpi_savecpu() and the resume path. @@ -352,6 +341,12 @@ sleep_clocks(void *v) int acpi_sleep_cpu(struct acpi_softc *sc, int state) { + rtcstop(); +#if NLAPIC > 0 + save_lapic_tpr = lapic_tpr; + lapic_disable(); +#endif + /* i386 does lazy pmap_activate: switch to kernel memory view */ pmap_activate(curproc); diff --git a/sys/arch/macppc/dev/apm.c b/sys/arch/macppc/dev/apm.c index 79459718840..e90aa44f3d1 100644 --- a/sys/arch/macppc/dev/apm.c +++ b/sys/arch/macppc/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.25 2022/02/10 05:48:02 gkoehler Exp $ */ +/* $OpenBSD: apm.c,v 1.26 2022/02/11 01:55:12 deraadt Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -336,11 +336,6 @@ apmkqfilter(dev_t dev, struct knote *kn) } #ifdef SUSPEND -void -sleep_clocks(void *v) -{ -} - int sleep_showstate(void *v, int sleepmode) { diff --git a/sys/kern/subr_suspend.c b/sys/kern/subr_suspend.c index 84ea1b7412c..2ff35524698 100644 --- a/sys/kern/subr_suspend.c +++ b/sys/kern/subr_suspend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_suspend.c,v 1.2 2022/02/10 16:41:53 deraadt Exp $ */ +/* $OpenBSD: subr_suspend.c,v 1.3 2022/02/11 01:55:12 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -103,7 +103,6 @@ sleep_state(void *v, int sleepmode) if (config_suspend_all(DVACT_SUSPEND) != 0) goto fail_suspend; - sleep_clocks(v); suspend_randomness(); diff --git a/sys/sys/device.h b/sys/sys/device.h index ec5e2b9e6b1..ad4e449c28d 100644 --- a/sys/sys/device.h +++ b/sys/sys/device.h @@ -1,4 +1,4 @@ -/* $OpenBSD: device.h,v 1.57 2022/02/08 17:25:12 deraadt Exp $ */ +/* $OpenBSD: device.h,v 1.58 2022/02/11 01:55:12 deraadt Exp $ */ /* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */ /* @@ -202,7 +202,6 @@ void config_process_deferred_mountroot(void); int sleep_state(void *, int); #define SLEEP_SUSPEND 0x01 #define SLEEP_HIBERNATE 0x02 -void sleep_clocks(void *); void sleep_mp(void); void resume_mp(void); int sleep_showstate(void *v, int sleepmode); -- cgit v1.2.3