summaryrefslogtreecommitdiff
path: root/src/arch/arm64/include
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-09-19 15:52:31 -0500
committerPatrick Georgi <pgeorgi@google.com>2015-03-28 08:44:50 +0100
commitbda3577d0c9f9e3ceb896f25cf06be69d614eed9 (patch)
tree2496793a344b86ee6df753c30059c33f39c115f6 /src/arch/arm64/include
parent93eea8822d6c5932bb77d91fac35101ab2274490 (diff)
arm64: add psci support to secmon
The PSCI functionality initially includes CPU_ON and CPU_OFF functions. Upon entering secmon if the parameters are non-NULL then a PSCI CPU_ON action is done for the current CPU. BUG=chrome-os-partner:32112 BRANCH=None TEST=Booted kernel with PSCI support. Brought up all CPUs in kernel using PSCI. Turned CPUs on and off. Change-Id: I256fa45a1c9889ff9d7990eb1898df1ec241c117 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 689ba03e313e7e52e9b74aa774897b55cbd52748 Original-Change-Id: I943826b7dbcc8e3f6c8c4b66344af8fac12ba94e Original-Signed-off-by: Aaron Durbin <adurbin@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/218923 Original-Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: http://review.coreboot.org/9097 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/arch/arm64/include')
-rw-r--r--src/arch/arm64/include/arch/psci.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/src/arch/arm64/include/arch/psci.h b/src/arch/arm64/include/arch/psci.h
new file mode 100644
index 0000000000..c39f13a088
--- /dev/null
+++ b/src/arch/arm64/include/arch/psci.h
@@ -0,0 +1,115 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2014 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ */
+
+#ifndef __ARCH_PSCI_H__
+#define __ARCH_PSCI_H__
+
+#include <arch/smc.h>
+
+/* Return Values */
+enum {
+ PSCI_RET_SUCCESS = 0,
+ PSCI_RET_NOT_SUPPORTED = -1,
+ PSCI_RET_INVALID_PARAMETERS = -2,
+ PSCI_RET_DENIED = -3,
+ PSCI_RET_ALREADY_ON = -4,
+ PSCI_RET_ON_PENDING = -5,
+ PSCI_RET_INTERNAL_FAILURE = -6,
+ PSCI_RET_NOT_PRESENT = -7,
+ PSCI_RET_DISABLED = -8,
+};
+
+/* PSCI Functions. */
+enum {
+ /* 32-bit System level functions. */
+ PSCI_VERSION = SMC_FUNC_FAST32(0x4, 0x0),
+ PSCI_SYSTEM_OFF = SMC_FUNC_FAST32(0x4, 0x8),
+ PSCI_SYSTEM_RESET = SMC_FUNC_FAST32(0x4, 0x9),
+
+ /* 32-bit CPU support functions. */
+ PSCI_CPU_SUSPEND32 = SMC_FUNC_FAST32(0x4, 0x1),
+ PSCI_CPU_OFF32 = SMC_FUNC_FAST32(0x4, 0x2),
+ PSCI_CPU_ON32 = SMC_FUNC_FAST32(0x4, 0x3),
+
+ /* 64-bit CPU support functions. */
+ PSCI_CPU_SUSPEND64 = SMC_FUNC_FAST64(0x4, 0x1),
+ PSCI_CPU_OFF64 = SMC_FUNC_FAST64(0x4, 0x2),
+ PSCI_CPU_ON64 = SMC_FUNC_FAST64(0x4, 0x3),
+};
+
+/* Parameter arguments. */
+enum {
+ PSCI_PARAM_0 = 1,
+ PSCI_PARAM_1,
+ PSCI_PARAM_2,
+ PSCI_PARAM_3,
+ PSCI_RETURN_0 = 1,
+ PSCI_RETURN_1,
+ PSCI_RETURN_2,
+ PSCI_RETURN_3,
+};
+
+struct psci_func {
+ uint32_t id;
+ struct smc_call *smc;
+};
+
+static inline void psci_func_init(struct psci_func *pf, struct smc_call *smc)
+{
+ pf->id = smc_function_id(smc);
+ pf->smc = smc;
+}
+
+static inline uint64_t psci64_arg(struct psci_func *pf, unsigned i)
+{
+ return smc64_arg(pf->smc, i);
+}
+
+static inline uint32_t psci32_arg(struct psci_func *pf, unsigned i)
+{
+ return psci64_arg(pf, i);
+}
+
+static inline void psci64_result(struct psci_func *pf, unsigned i, uint64_t v)
+{
+ smc64_result(pf->smc, i, v);
+}
+
+static inline void psci32_result(struct psci_func *pf, unsigned i, uint32_t v)
+{
+ uint64_t v64 = v;
+ psci64_result(pf, i, v64);
+}
+
+static inline void psci32_return(struct psci_func *pf, int32_t val)
+{
+ psci32_result(pf, 0, val);
+}
+
+static inline void psci64_return(struct psci_func *pf, int64_t val)
+{
+ psci64_result(pf, 0, val);
+}
+
+void psci_init(void);
+
+/* Turn on the current CPU within the PSCI subsystem. */
+void psci_turn_on_self(void *entry, void *arg);
+
+#endif /* __ARCH_PSCI_H__ */