summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/psci.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/cpu/psci.c')
-rw-r--r--arch/arm/cpu/psci.c119
1 files changed, 3 insertions, 116 deletions
diff --git a/arch/arm/cpu/psci.c b/arch/arm/cpu/psci.c
index 22ce1dfd0e..70c97e03a5 100644
--- a/arch/arm/cpu/psci.c
+++ b/arch/arm/cpu/psci.c
@@ -1,13 +1,4 @@
-/*
- * 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.
- *
- * 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.
- */
+// SPDX-License-Identifier: GPL-2.0-only
#define pr_fmt(fmt) "psci: " fmt
@@ -98,7 +89,7 @@ static unsigned long psci_cpu_suspend(u32 power_state, unsigned long entry,
{
psci_printf("%s\n", __func__);
- if (psci_ops->cpu_off)
+ if (psci_ops->cpu_suspend)
return psci_ops->cpu_suspend(power_state, entry, context_id);
return ARM_PSCI_RET_NOT_SUPPORTED;
@@ -198,7 +189,7 @@ static int of_psci_do_fixup(struct device_node *root, void *unused)
if (bootm_arm_security_state() < ARM_STATE_NONSECURE)
return 0;
- return of_psci_fixup(root, ARM_PSCI_VER_1_0);
+ return of_psci_fixup(root, ARM_PSCI_VER_1_0, "smc");
}
int psci_cpu_entry_c(void)
@@ -228,107 +219,3 @@ static int armv7_psci_init(void)
}
device_initcall(armv7_psci_init);
-#ifdef CONFIG_ARM_PSCI_DEBUG
-
-#include <command.h>
-#include <getopt.h>
-#include "mmu.h"
-
-void second_entry(void)
-{
- struct arm_smccc_res res;
-
- psci_printf("2nd CPU online, now turn off again\n");
-
- arm_smccc_smc(ARM_PSCI_0_2_FN_CPU_OFF,
- 0, 0, 0, 0, 0, 0, 0, &res);
-
- psci_printf("2nd CPU still alive?\n");
-
- while (1);
-}
-
-static const char *psci_xlate_str(long err)
-{
- static char errno_string[sizeof "error 0x123456789ABCDEF0"];
-
- switch(err)
- {
- case ARM_PSCI_RET_SUCCESS:
- return "Success";
- case ARM_PSCI_RET_NOT_SUPPORTED:
- return "Operation not supported";
- case ARM_PSCI_RET_INVAL:
- return "Invalid argument";
- case ARM_PSCI_RET_DENIED:
- return "Operation not permitted";
- case ARM_PSCI_RET_ALREADY_ON:
- return "CPU already on";
- case ARM_PSCI_RET_ON_PENDING:
- return "CPU_ON in progress";
- case ARM_PSCI_RET_INTERNAL_FAILURE:
- return "Internal failure";
- case ARM_PSCI_RET_NOT_PRESENT:
- return "Trusted OS not present on core";
- case ARM_PSCI_RET_DISABLED:
- return "CPU is disabled";
- case ARM_PSCI_RET_INVALID_ADDRESS:
- return "Bad address";
- }
-
- sprintf(errno_string, "error 0x%lx", err);
- return errno_string;
-}
-
-static int do_smc(int argc, char *argv[])
-{
- long ret;
- int opt;
- struct arm_smccc_res res = {
- .a0 = 0xdeadbee0,
- .a1 = 0xdeadbee1,
- .a2 = 0xdeadbee2,
- .a3 = 0xdeadbee3,
- };
-
- if (argc < 2)
- return COMMAND_ERROR_USAGE;
-
- while ((opt = getopt(argc, argv, "nic")) > 0) {
- switch (opt) {
- case 'n':
- armv7_secure_monitor_install();
- break;
- case 'i':
- arm_smccc_smc(ARM_PSCI_0_2_FN_PSCI_VERSION,
- 0, 0, 0, 0, 0, 0, 0, &res);
- printf("found psci version %ld.%ld\n", res.a0 >> 16, res.a0 & 0xffff);
- break;
- case 'c':
- arm_smccc_smc(ARM_PSCI_0_2_FN_CPU_ON,
- 1, (unsigned long)second_entry, 0, 0, 0, 0, 0, &res);
- ret = (long)res.a0;
- printf("CPU_ON returns with: %s\n", psci_xlate_str(ret));
- if (ret)
- return COMMAND_ERROR;
- }
- }
-
-
- return 0;
-}
-BAREBOX_CMD_HELP_START(smc)
-BAREBOX_CMD_HELP_TEXT("Secure monitor code test command")
-BAREBOX_CMD_HELP_TEXT("")
-BAREBOX_CMD_HELP_TEXT("Options:")
-BAREBOX_CMD_HELP_OPT ("-n", "Install secure monitor and switch to nonsecure mode")
-BAREBOX_CMD_HELP_OPT ("-i", "Show information about installed PSCI version")
-BAREBOX_CMD_HELP_OPT ("-c", "Start secondary CPU core")
-BAREBOX_CMD_HELP_END
-
-BAREBOX_CMD_START(smc)
- .cmd = do_smc,
- BAREBOX_CMD_DESC("secure monitor test command")
- BAREBOX_CMD_GROUP(CMD_GRP_MISC)
-BAREBOX_CMD_END
-#endif