aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/psci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firmware/psci.c')
-rw-r--r--drivers/firmware/psci.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
index d24f35d74b27..f25cd79c8a79 100644
--- a/drivers/firmware/psci.c
+++ b/drivers/firmware/psci.c
@@ -13,6 +13,7 @@
13 13
14#define pr_fmt(fmt) "psci: " fmt 14#define pr_fmt(fmt) "psci: " fmt
15 15
16#include <linux/arm-smccc.h>
16#include <linux/errno.h> 17#include <linux/errno.h>
17#include <linux/linkage.h> 18#include <linux/linkage.h>
18#include <linux/of.h> 19#include <linux/of.h>
@@ -58,8 +59,6 @@ struct psci_operations psci_ops;
58 59
59typedef unsigned long (psci_fn)(unsigned long, unsigned long, 60typedef unsigned long (psci_fn)(unsigned long, unsigned long,
60 unsigned long, unsigned long); 61 unsigned long, unsigned long);
61asmlinkage psci_fn __invoke_psci_fn_hvc;
62asmlinkage psci_fn __invoke_psci_fn_smc;
63static psci_fn *invoke_psci_fn; 62static psci_fn *invoke_psci_fn;
64 63
65enum psci_function { 64enum psci_function {
@@ -107,6 +106,26 @@ bool psci_power_state_is_valid(u32 state)
107 return !(state & ~valid_mask); 106 return !(state & ~valid_mask);
108} 107}
109 108
109static unsigned long __invoke_psci_fn_hvc(unsigned long function_id,
110 unsigned long arg0, unsigned long arg1,
111 unsigned long arg2)
112{
113 struct arm_smccc_res res;
114
115 arm_smccc_hvc(function_id, arg0, arg1, arg2, 0, 0, 0, 0, &res);
116 return res.a0;
117}
118
119static unsigned long __invoke_psci_fn_smc(unsigned long function_id,
120 unsigned long arg0, unsigned long arg1,
121 unsigned long arg2)
122{
123 struct arm_smccc_res res;
124
125 arm_smccc_smc(function_id, arg0, arg1, arg2, 0, 0, 0, 0, &res);
126 return res.a0;
127}
128
110static int psci_to_linux_errno(int errno) 129static int psci_to_linux_errno(int errno)
111{ 130{
112 switch (errno) { 131 switch (errno) {