1 /* 2 * Copyright 2024 NXP 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/kernel.h> 8 #include <zephyr/logging/log.h> 9 #include <zephyr/sys/reboot.h> 10 #include <zephyr/drivers/pm_cpu_ops.h> 11 12 LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); 13 14 #ifdef CONFIG_PM_CPU_OPS_PSCI sys_arch_reboot(int type)15void __weak sys_arch_reboot(int type) 16 { 17 unsigned char reset_type; 18 19 if (type == SYS_REBOOT_COLD) { 20 reset_type = SYS_COLD_RESET; 21 } else if (type == SYS_REBOOT_WARM) { 22 reset_type = SYS_WARM_RESET; 23 } else { 24 LOG_ERR("Invalid reboot type"); 25 return; 26 } 27 pm_system_reset(reset_type); 28 } 29 #else sys_arch_reboot(int type)30void __weak sys_arch_reboot(int type) 31 { 32 LOG_WRN("%s is not implemented", __func__); 33 ARG_UNUSED(type); 34 } 35 #endif 36