git: e177e6429455 - stable/14 - ACPI: Implement power button on !x86
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 03 Nov 2024 16:02:22 UTC
The branch stable/14 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=e177e64294556bdece642442d6691523a4294b67 commit e177e64294556bdece642442d6691523a4294b67 Author: Colin Percival <cperciva@FreeBSD.org> AuthorDate: 2024-10-12 17:27:39 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2024-11-03 16:01:27 +0000 ACPI: Implement power button on !x86 ACPI sleep states are only implemented on x86 systems, so having the ACPI power button attempt to enter "S5" (or other state as configured via the hw.acpi.power_button_state sysctl) is not useful. On non-x86 systems, implement the power button with a call to shutdown_nice(RB_POWEROFF) to shut down the system. Reviewed by: Andrew Tested on: Graviton 2 MFC after: 2 weeks Sponsored by: Amazon Differential Revision: https://reviews.freebsd.org/D47094 (cherry picked from commit f41ef9d80b3d272e08dd9e2ea3c1d8d3f2818066) --- sys/dev/acpica/acpi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 71b19067707b..c2bfe5f2fa5d 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -3858,13 +3858,22 @@ acpi_invoke_wake_eventhandler(void *context) UINT32 acpi_event_power_button_sleep(void *context) { +#if defined(__amd64__) || defined(__i386__) struct acpi_softc *sc = (struct acpi_softc *)context; +#else + (void)context; +#endif ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); +#if defined(__amd64__) || defined(__i386__) if (ACPI_FAILURE(AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_invoke_sleep_eventhandler, &sc->acpi_power_button_sx))) return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); +#else + shutdown_nice(RB_POWEROFF); +#endif + return_VALUE (ACPI_INTERRUPT_HANDLED); }