[PATCH v2 3/3] bsps/aarch64: use SMC API in bspreset-arm-psci
Gedare Bloom
gedare at rtems.org
Sat Dec 11 16:16:04 UTC 2021
---
bsps/shared/start/bspreset-arm-psci.c | 41 +++++++++++++++++++++------
1 file changed, 33 insertions(+), 8 deletions(-)
diff --git a/bsps/shared/start/bspreset-arm-psci.c b/bsps/shared/start/bspreset-arm-psci.c
index 215be5c9b5..aa039b7816 100644
--- a/bsps/shared/start/bspreset-arm-psci.c
+++ b/bsps/shared/start/bspreset-arm-psci.c
@@ -37,20 +37,45 @@
#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;
- __asm__ volatile(
+ uint32_t PSCI_FN_SYSTEM_RESET = 0x84000009;
#if defined(AARCH64_MULTILIB_ARCH_V8) || defined(AARCH64_MULTILIB_ARCH_V8_ILP32)
- "mov x0, %0\n"
+#ifdef BSP_RESET_SMC
+ (void) _AArch64_SMC_Invoke(
+ PSCI_FN_SYSTEM_RESET,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ NULL
+ );
#else
- "mov r0, %0\n"
+ /* _AArch64_HVC_Invoke */
+ __asm__ volatile(
+ "mov x0, %0\n"
+ "hvc #0\n"
+ : : "r" (PSCI_FN_SYSTEM_RESET)
+ );
#endif
+#else
+ /* _AArch32 */
+ __asm__ volatile(
+ "mov r0, %0\n"
#ifdef BSP_RESET_SMC
- "smc #0\n"
+ "smc #0\n"
#else
- "hvc #0\n"
+ "hvc #0\n"
+#endif
+ : : "r" (PSCI_FN_SYSTEM_RESET)
+ );
#endif
- : : "r" (PSCI_FN_SYSTEM_RESET)
- );
}
--
2.25.1
More information about the devel
mailing list