@@ -34,6 +34,8 @@
#include <asm/smp_plat.h>
#include <asm/suspend.h>
+#include "psci.h"
+
/*
* While a 64-bit OS can make calls with SMC32 calling conventions, for some
* calls it is necessary to use SMC64 to pass or return 64-bit values.
@@ -96,7 +98,7 @@ static inline bool psci_has_ext_power_state(void)
PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK;
}
-static inline bool psci_has_osi_support(void)
+bool psci_has_osi_support(void)
{
return psci_cpu_suspend_feature & PSCI_1_0_OS_INITIATED;
}
@@ -161,6 +163,15 @@ static u32 psci_get_version(void)
return invoke_psci_fn(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0);
}
+int psci_set_osi_mode(void)
+{
+ int err;
+
+ err = invoke_psci_fn(PSCI_1_0_FN_SET_SUSPEND_MODE,
+ PSCI_1_0_SUSPEND_MODE_OSI, 0, 0);
+ return psci_to_linux_errno(err);
+}
+
static int psci_cpu_suspend(u32 state, unsigned long entry_point)
{
int err;
@@ -292,12 +303,12 @@ static inline u32 psci_get_domain_state(void)
return __this_cpu_read(domain_state);
}
-static inline void psci_set_domain_state(u32 state)
+void psci_set_domain_state(u32 state)
{
__this_cpu_write(domain_state, state);
}
-static int psci_dt_parse_state_node(struct device_node *np, u32 *state)
+int psci_dt_parse_state_node(struct device_node *np, u32 *state)
{
int err = of_property_read_u32(np, "arm,psci-suspend-param", state);
new file mode 100644
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __PSCI_H
+#define __PSCI_H
+
+struct device_node;
+
+int psci_set_osi_mode(void);
+bool psci_has_osi_support(void);
+
+#ifdef CONFIG_CPU_IDLE
+void psci_set_domain_state(u32 state);
+int psci_dt_parse_state_node(struct device_node *np, u32 *state);
+#endif
+
+#endif /* __PSCI_H */
Subsequent changes implements support for PM domains to PSCI. Those changes are mainly implemented in a new separate c-file, hence a couple of the internal PSCI functions needs to be shared to be accessible. Let's do that via adding a new PSCI header file. Moreover, to implement support for PM domains, switching the PSCI FW into the OS initiated mode is sometimes needed. Therefore, let's share a new function that implement this. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- Changes: - Convert psci_set_osi_mode() to return an int. - Don't share psci_get_domain_state() as that's no longer needed. - Update changelog. --- drivers/firmware/psci/psci.c | 17 ++++++++++++++--- drivers/firmware/psci/psci.h | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 drivers/firmware/psci/psci.h -- 2.17.1