mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/7] misc: psci: translate PSCI error codes in smc command
@ 2019-11-06  7:10 Ahmad Fatoum
  2019-11-06  7:10 ` [PATCH 2/7] ARM: psci: use CONFIG_ARM_PSCI_DEBUG for " Ahmad Fatoum
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2019-11-06  7:10 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

For more usability, translate CPU_ON error codes into the error
descriptions found in the PSCI Platform Design Document[1].

[1]: http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/cpu/psci.c | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/psci.c b/arch/arm/cpu/psci.c
index a976ddbb5c65..b02e83986af8 100644
--- a/arch/arm/cpu/psci.c
+++ b/arch/arm/cpu/psci.c
@@ -248,8 +248,41 @@ void second_entry(void)
 	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,
@@ -271,7 +304,10 @@ static int do_smc(int argc, char *argv[])
 		case 'c':
 			arm_smccc_smc(ARM_PSCI_0_2_FN_CPU_ON,
 				      1, (unsigned long)second_entry, 0, 0, 0, 0, 0, &res);
-			break;
+			ret = (long)res.a0;
+			printf("CPU_ON returns with: %s\n", psci_xlate_str(ret));
+			if (ret)
+				return COMMAND_ERROR;
 		}
 	}
 
-- 
2.24.0.rc1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-11-06  9:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06  7:10 [PATCH 1/7] misc: psci: translate PSCI error codes in smc command Ahmad Fatoum
2019-11-06  7:10 ` [PATCH 2/7] ARM: psci: use CONFIG_ARM_PSCI_DEBUG for " Ahmad Fatoum
2019-11-06  7:10 ` [PATCH 3/7] psci: wire in smc command help Ahmad Fatoum
2019-11-06  7:10 ` [PATCH 4/7] misc: implement PSCI client driver Ahmad Fatoum
2019-11-06  7:10 ` [PATCH 5/7] misc: implement PSCI system reset driver Ahmad Fatoum
2019-11-06  9:32   ` Sascha Hauer
2019-11-06  7:10 ` [PATCH 6/7] ARM: stm32mp: select ARM_USE_COMPRESSED_DTB for the whole arch Ahmad Fatoum
2019-11-06  7:10 ` [PATCH 7/7] ARM: dts: stm32mp: report psci v0.2 at least Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox