Module Name:    src
Committed By:   jmcneill
Date:           Mon Dec 30 19:09:49 UTC 2024

Modified Files:
        src/sys/arch/arm/arm: psci.c psci.h

Log Message:
psci: Add support for PSCI_CPU_SUSPEND


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/arm/psci.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/arm/psci.h

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/arm/psci.c
diff -u src/sys/arch/arm/arm/psci.c:1.7 src/sys/arch/arm/arm/psci.c:1.8
--- src/sys/arch/arm/arm/psci.c:1.7	Sat Aug  7 21:20:14 2021
+++ src/sys/arch/arm/arm/psci.c	Mon Dec 30 19:09:49 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: psci.c,v 1.7 2021/08/07 21:20:14 jmcneill Exp $ */
+/* $NetBSD: psci.c,v 1.8 2024/12/30 19:09:49 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.7 2021/08/07 21:20:14 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.8 2024/12/30 19:09:49 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -41,8 +41,10 @@ __KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.7
 #define	PSCI_SYSTEM_OFF		0x84000008
 #define	PSCI_SYSTEM_RESET	0x84000009
 #if defined(__aarch64__)
+#define	PSCI_CPU_SUSPEND	0xc4000001
 #define	PSCI_CPU_ON		0xc4000003
 #else
+#define	PSCI_CPU_SUSPEND	0x84000001
 #define	PSCI_CPU_ON		0x84000003
 #endif
 #define	PSCI_FEATURES		0x8400000a
@@ -53,6 +55,7 @@ static uint32_t psci_functions[PSCI_FUNC
         [PSCI_FUNC_VERSION] = PSCI_VERSION,
         [PSCI_FUNC_SYSTEM_OFF] = PSCI_SYSTEM_OFF,
 	[PSCI_FUNC_SYSTEM_RESET] = PSCI_SYSTEM_RESET,
+	[PSCI_FUNC_CPU_SUSPEND] = PSCI_CPU_SUSPEND,
 	[PSCI_FUNC_CPU_ON] = PSCI_CPU_ON,
 	[PSCI_FUNC_FEATURES] = PSCI_FEATURES,
 };
@@ -100,6 +103,13 @@ psci_cpu_on(register_t target_cpu, regis
 	    entry_point_address, context_id);
 }
 
+int
+psci_cpu_suspend(uint32_t power_state)
+{
+	return psci_call(psci_functions[PSCI_FUNC_CPU_SUSPEND], power_state,
+	    0, 0);
+}
+
 void
 psci_system_off(void)
 {

Index: src/sys/arch/arm/arm/psci.h
diff -u src/sys/arch/arm/arm/psci.h:1.4 src/sys/arch/arm/arm/psci.h:1.5
--- src/sys/arch/arm/arm/psci.h:1.4	Sat Aug  7 21:20:14 2021
+++ src/sys/arch/arm/arm/psci.h	Mon Dec 30 19:09:49 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: psci.h,v 1.4 2021/08/07 21:20:14 jmcneill Exp $ */
+/* $NetBSD: psci.h,v 1.5 2024/12/30 19:09:49 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcne...@invisible.ca>
@@ -34,6 +34,7 @@
  */
 enum psci_function {
 	PSCI_FUNC_VERSION,
+	PSCI_FUNC_CPU_SUSPEND,
 	PSCI_FUNC_CPU_ON,
 	PSCI_FUNC_SYSTEM_OFF,
 	PSCI_FUNC_SYSTEM_RESET,
@@ -114,6 +115,11 @@ uint32_t	psci_version(void);
 int	psci_cpu_on(register_t, register_t, register_t);
 
 /*
+ * Suspend a core. Args: power_state
+ */
+int	psci_cpu_suspend(uint32_t);
+
+/*
  * Shut down the system.
  */
 void	psci_system_off(void);

Reply via email to