[PATCH 3/3] bsps/aarch64: use SMC API in bspreset-arm-psci

Gedare Bloom gedare at rtems.org
Sat Oct 16 20:12:25 UTC 2021


---
 bsps/shared/start/bspreset-arm-psci.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/bsps/shared/start/bspreset-arm-psci.c b/bsps/shared/start/bspreset-arm-psci.c
index 215be5c9b5..bafdfe6299 100644
--- a/bsps/shared/start/bspreset-arm-psci.c
+++ b/bsps/shared/start/bspreset-arm-psci.c
@@ -37,9 +37,28 @@
 #include <bsp.h>
 #include <bsp/bootcard.h>
 
+#if defined( AARCH64_MULTILIB_ARCH_V8 ) || \
+  defined( AARCH64_MULTILIB_ARCH_V8_ILP32 )
+#include <rtems/score/aarch64-smc.h>
+#endif
+
 void bsp_reset(void)
 {
 	uint32_t PSCI_FN_SYSTEM_RESET = 0x84000009;
+#ifdef BSP_RESET_SMC
+  (void) _AArch64_SMC_Invoke(
+      PSCI_FN_SYSTEM_RESET,
+      0,
+      0,
+      0,
+      0,
+      0,
+      0,
+      0,
+      0,
+      NULL
+  );
+#else
 	__asm__ volatile(
 #if defined(AARCH64_MULTILIB_ARCH_V8) || defined(AARCH64_MULTILIB_ARCH_V8_ILP32)
 		"mov x0, %0\n"
@@ -53,4 +72,5 @@ void bsp_reset(void)
 #endif
 		: : "r" (PSCI_FN_SYSTEM_RESET)
 	);
+#endif
 }
-- 
2.25.1



More information about the devel mailing list