bsps: Assembly implementation for PSCI bsp_reset()

Avoid issues with potential dead code after the secure monitor or
hypervisor call.
This commit is contained in:
Sebastian Huber
2024-10-04 03:48:18 +02:00
parent a8d3efe4b0
commit 8db6a45009
8 changed files with 26 additions and 29 deletions

View File

@@ -44,6 +44,8 @@
#include <bspopts.h>
#define BSP_RESET_SMC
#ifndef ASM
#include <bsp/default-initial-extension.h>
@@ -60,8 +62,6 @@ extern "C" {
#define BSP_ARM_GIC_DIST_BASE 0xf9000000
#define BSP_ARM_GIC_REDIST_BASE 0xf9080000
#define BSP_RESET_SMC
/*
* DDRMC mapping
*/

View File

@@ -41,6 +41,10 @@
#define BSP_FEATURE_IRQ_EXTENSION
#define BSP_RESET_SMC
#define BSP_CPU_ON_USES_SMC
#ifndef ASM
#include <bsp/default-initial-extension.h>
@@ -79,9 +83,6 @@ LINKER_SYMBOL(bsp_r1_ram_end)
#define BSP_ARM_GIC_CPUIF_BASE 0xf9020000
#define BSP_ARM_GIC_DIST_BASE 0xf9010000
#define BSP_RESET_SMC
#define BSP_CPU_ON_USES_SMC
#define BSP_FDT_IS_SUPPORTED
extern unsigned int zynqmp_dtb_len;
extern unsigned char zynqmp_dtb[];

View File

@@ -5,10 +5,12 @@
*
* @ingroup RTEMSBSPsShared
*
* @brief PSCI-based BSP reset hook.
* @brief This source file contains the PSCI-based bsp_reset() implementation.
*/
/*
* Copyright (C) 2024 embedded brains GmbH & Co. KG
*
* Copyright (C) 2020 On-Line Applications Research Corporation (OAR)
* Written by Kinsey Moore <kinsey.moore@oarcorp.com>
*
@@ -35,25 +37,19 @@
*/
#include <bsp.h>
#include <bsp/bootcard.h>
void bsp_reset( rtems_fatal_source source, rtems_fatal_code code )
{
uint32_t PSCI_FN_SYSTEM_RESET = 0x84000009;
(void) source;
(void) code;
__asm__ volatile(
#if defined(AARCH64_MULTILIB_ARCH_V8) || defined(AARCH64_MULTILIB_ARCH_V8_ILP32)
"mov x0, %0\n"
#else
"mov r0, %0\n"
#endif
#include <rtems/asm.h>
FUNCTION_ENTRY(bsp_reset)
/* PSCI_FN_SYSTEM_RESET = 0x84000009 */
mov x0, 9
movk x0, 0x8400, lsl 16
#ifdef BSP_RESET_SMC
"smc #0\n"
smc #0
#else
"hvc #0\n"
hvc #0
#endif
: : "r" (PSCI_FN_SYSTEM_RESET)
);
RTEMS_UNREACHABLE();
}
FUNCTION_END(bsp_reset)