Module Name: src Committed By: jmcneill Date: Sun Dec 8 20:55:19 UTC 2024
Modified Files: src/sys/arch/arm/acpi: acpi_platform.c src/sys/arch/arm/fdt: acpi_fdt.c Log Message: acpi: Try PSCI before UEFI RT for shutdown/reset. BSA says that an OS can use either UEFI RT or PSCI, and that the RT implementation should just call PSCI. Given the amount of implementation issues with UEFI RT, let's try PSCI first, because it's nice to be able to reboot and poweroff even with buggy firmware. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/arch/arm/acpi/acpi_platform.c cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/fdt/acpi_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/acpi/acpi_platform.c diff -u src/sys/arch/arm/acpi/acpi_platform.c:1.37 src/sys/arch/arm/acpi/acpi_platform.c:1.38 --- src/sys/arch/arm/acpi/acpi_platform.c:1.37 Sun Jun 30 17:58:08 2024 +++ src/sys/arch/arm/acpi/acpi_platform.c Sun Dec 8 20:55:18 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_platform.c,v 1.37 2024/06/30 17:58:08 jmcneill Exp $ */ +/* $NetBSD: acpi_platform.c,v 1.38 2024/12/08 20:55:18 jmcneill Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include "opt_multiprocessor.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.37 2024/06/30 17:58:08 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.38 2024/12/08 20:55:18 jmcneill Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -402,12 +402,13 @@ acpi_platform_device_register_post_confi static void acpi_platform_reset(void) { + if (psci_available()) { + psci_system_reset(); + } + #ifdef EFI_RUNTIME - if (arm_efirt_reset(EFI_RESET_COLD) == 0) - return; + arm_efirt_reset(EFI_RESET_COLD); #endif - if (psci_available()) - psci_system_reset(); } static u_int Index: src/sys/arch/arm/fdt/acpi_fdt.c diff -u src/sys/arch/arm/fdt/acpi_fdt.c:1.24 src/sys/arch/arm/fdt/acpi_fdt.c:1.25 --- src/sys/arch/arm/fdt/acpi_fdt.c:1.24 Fri Nov 25 22:17:20 2022 +++ src/sys/arch/arm/fdt/acpi_fdt.c Sun Dec 8 20:55:18 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_fdt.c,v 1.24 2022/11/25 22:17:20 mrg Exp $ */ +/* $NetBSD: acpi_fdt.c,v 1.25 2024/12/08 20:55:18 jmcneill Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill <jmcne...@invisible.ca> @@ -30,7 +30,7 @@ #include "opt_efi.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.24 2022/11/25 22:17:20 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.25 2024/12/08 20:55:18 jmcneill Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -128,12 +128,14 @@ static void acpi_fdt_poweroff(device_t dev) { delay(500000); + + if (psci_available()) { + psci_system_off(); + } + #ifdef EFI_RUNTIME - if (arm_efirt_reset(EFI_RESET_SHUTDOWN) == 0) - return; + arm_efirt_reset(EFI_RESET_SHUTDOWN); #endif - if (psci_available()) - psci_system_off(); } static int