Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/fdt Support poweroff via PSCI



details:   https://anonhg.NetBSD.org/src/rev/66c03823d7a0
branches:  trunk
changeset: 836354:66c03823d7a0
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Oct 13 00:15:10 2018 +0000

description:
Support poweroff via PSCI

diffstat:

 sys/arch/arm/fdt/acpi_fdt.c |  23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diffs (63 lines):

diff -r 8a815ece43cd -r 66c03823d7a0 sys/arch/arm/fdt/acpi_fdt.c
--- a/sys/arch/arm/fdt/acpi_fdt.c       Sat Oct 13 00:08:29 2018 +0000
+++ b/sys/arch/arm/fdt/acpi_fdt.c       Sat Oct 13 00:15:10 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_fdt.c,v 1.1 2018/10/12 22:20:48 jmcneill Exp $ */
+/* $NetBSD: acpi_fdt.c,v 1.2 2018/10/13 00:15:10 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.1 2018/10/12 22:20:48 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.2 2018/10/13 00:15:10 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -44,14 +44,22 @@
 #include <dev/acpi/acpivar.h>
 #include <dev/pci/pcivar.h>
 
+#include <arm/arm/psci.h>
+
 static int     acpi_fdt_match(device_t, cfdata_t, void *);
 static void    acpi_fdt_attach(device_t, device_t, void *);
 
+static void    acpi_fdt_poweroff(device_t);
+
 static const char * const compatible[] = {
        "netbsd,acpi",
        NULL
 };
 
+static const struct fdtbus_power_controller_func acpi_fdt_power_funcs = {
+       .poweroff = acpi_fdt_poweroff,
+};
+
 CFATTACH_DECL_NEW(acpi_fdt, 0, acpi_fdt_match, acpi_fdt_attach, NULL, NULL);
 
 static int
@@ -71,6 +79,9 @@
        aprint_naive("\n");
        aprint_normal(": ACPI Platform support\n");
 
+       fdtbus_register_power_controller(self, faa->faa_phandle,
+           &acpi_fdt_power_funcs);
+
        if (!acpi_probe())
                aprint_error_dev(self, "failed to probe ACPI\n");
 
@@ -88,3 +99,11 @@
 #endif
        config_found_ia(self, "acpibus", &aa, 0);
 }
+
+static void
+acpi_fdt_poweroff(device_t dev)
+{
+       delay(500000);
+       if (psci_available())
+               psci_system_off();
+}



Home | Main Index | Thread Index | Old Index