From: deraadt Date: Wed, 16 Feb 2022 06:41:27 +0000 (+0000) Subject: change MD gosleep() and sleep_finish() to return int, the MI code will be X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4a9a38d55a6d5b6f52bfcbce33d8ce80b61369ca;p=openbsd change MD gosleep() and sleep_finish() to return int, the MI code will be able to react to this suitably. --- diff --git a/sys/arch/arm64/dev/apm.c b/sys/arch/arm64/dev/apm.c index a77aa7f8e54..0a8152a570c 100644 --- a/sys/arch/arm64/dev/apm.c +++ b/sys/arch/arm64/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.15 2022/02/15 21:17:12 deraadt Exp $ */ +/* $OpenBSD: apm.c,v 1.16 2022/02/16 06:41:27 deraadt Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -373,10 +373,10 @@ sleep_setstate(void *v) return 0; } -void +int gosleep(void *v) { - // XXX + return EOPNOTSUPP; } void @@ -390,7 +390,7 @@ sleep_resume(void *v) return 0; } -void +int suspend_finish(void *v) { #if 0 @@ -405,7 +405,7 @@ suspend_finish(void *v) if (acpibtn_numopenlids() == 0 && lid_action != 0) acpi_addtask(sc, acpi_sleep_task, sc, sc->sc_state); #endif + return 0; } #endif /* SUSPEND */ - diff --git a/sys/arch/macppc/dev/apm.c b/sys/arch/macppc/dev/apm.c index 3cfa6c8fcd8..a50d2140c79 100644 --- a/sys/arch/macppc/dev/apm.c +++ b/sys/arch/macppc/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.31 2022/02/15 21:17:12 deraadt Exp $ */ +/* $OpenBSD: apm.c,v 1.32 2022/02/16 06:41:27 deraadt Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -377,14 +377,16 @@ sleep_resume(void *v) return 0; } -void +int gosleep(void *v) { + return EOPNOTSUPP; } -void +int suspend_finish(void *v) { + return 0; } #endif /* SUSPEND */ diff --git a/sys/dev/acpi/acpi_x86.c b/sys/dev/acpi/acpi_x86.c index b46ac7e9784..295912dc224 100644 --- a/sys/dev/acpi/acpi_x86.c +++ b/sys/dev/acpi/acpi_x86.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_x86.c,v 1.7 2022/02/15 21:17:12 deraadt Exp $ */ +/* $OpenBSD: acpi_x86.c,v 1.8 2022/02/16 06:41:27 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -113,10 +113,11 @@ sleep_setstate(void *v) return 0; } -void +int gosleep(void *v) { struct acpi_softc *sc = v; + int ret; /* Clear fixed event status */ acpi_write_pmreg(sc, ACPIREG_PM1_STS, 0, ACPI_PM1_ALL_STS); @@ -125,12 +126,11 @@ gosleep(void *v) acpi_disable_allgpes(sc); acpi_enable_wakegpes(sc, sc->sc_state); - /* Sleep */ - acpi_sleep_cpu(sc, sc->sc_state); - /* Resume */ - + ret = acpi_sleep_cpu(sc, sc->sc_state); acpi_resume_cpu(sc, sc->sc_state); sc->sc_state = ACPI_STATE_S0; + + return ret; } void @@ -155,7 +155,7 @@ sleep_resume(void *v) return 0; } -void +int suspend_finish(void *v) { struct acpi_softc *sc = v; @@ -167,4 +167,5 @@ suspend_finish(void *v) /* If we woke up but all the lids are closed, go back to sleep */ if (acpibtn_numopenlids() == 0 && lid_action != 0) acpi_addtask(sc, acpi_sleep_task, sc, sc->sc_state); + return 0; } diff --git a/sys/kern/subr_suspend.c b/sys/kern/subr_suspend.c index af6d19a6557..32df53fa4d0 100644 --- a/sys/kern/subr_suspend.c +++ b/sys/kern/subr_suspend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_suspend.c,v 1.7 2022/02/15 21:17:12 deraadt Exp $ */ +/* $OpenBSD: subr_suspend.c,v 1.8 2022/02/16 06:41:27 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -132,7 +132,7 @@ sleep_state(void *v, int sleepmode) boothowto &= ~RB_POWERDOWN; } - gosleep(v); + error = gosleep(v); #ifdef HIBERNATE if (sleepmode == SLEEP_HIBERNATE) { diff --git a/sys/sys/device.h b/sys/sys/device.h index d10fd080a54..1ac19bb65a7 100644 --- a/sys/sys/device.h +++ b/sys/sys/device.h @@ -1,4 +1,4 @@ -/* $OpenBSD: device.h,v 1.61 2022/02/15 21:17:12 deraadt Exp $ */ +/* $OpenBSD: device.h,v 1.62 2022/02/16 06:41:27 deraadt Exp $ */ /* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */ /* @@ -208,8 +208,8 @@ int sleep_showstate(void *v, int sleepmode); int sleep_setstate(void *v); int sleep_resume(void *v); void sleep_abort(void *v); -void gosleep(void *v); -void suspend_finish(void *v); +int gosleep(void *v); +int suspend_finish(void *v); struct device *device_mainbus(void); struct device *device_mpath(void);