arm64: add sys_arch_reboot() support
If PSCI is enabled, it will leverage psci reset API to achieve system reboot, otherwise a weak dump reboot API is provided, and platform can override these APIs if platform specified implementation provided. Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
This commit is contained in:
parent
a55bb955af
commit
002ed73ff4
2 changed files with 36 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ zephyr_library_sources(
|
|||
irq_init.c
|
||||
irq_manage.c
|
||||
prep_c.c
|
||||
reboot.c
|
||||
reset.S
|
||||
reset.c
|
||||
switch.S
|
||||
|
|
|
|||
35
arch/arm64/core/reboot.c
Normal file
35
arch/arm64/core/reboot.c
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright 2024 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/sys/reboot.h>
|
||||
#include <zephyr/drivers/pm_cpu_ops.h>
|
||||
|
||||
LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);
|
||||
|
||||
#ifdef CONFIG_PM_CPU_OPS_PSCI
|
||||
void __weak sys_arch_reboot(int type)
|
||||
{
|
||||
unsigned char reset_type;
|
||||
|
||||
if (type == SYS_REBOOT_COLD) {
|
||||
reset_type = SYS_COLD_RESET;
|
||||
} else if (type == SYS_REBOOT_WARM) {
|
||||
reset_type = SYS_WARM_RESET;
|
||||
} else {
|
||||
LOG_ERR("Invalid reboot type");
|
||||
return;
|
||||
}
|
||||
pm_system_reset(reset_type);
|
||||
}
|
||||
#else
|
||||
void __weak sys_arch_reboot(int type)
|
||||
{
|
||||
LOG_WRN("%s is not implemented", __func__);
|
||||
ARG_UNUSED(type);
|
||||
}
|
||||
#endif
|
||||
Loading…
Reference in a new issue