1 /* 2 * Copyright (c) 2021 Katsuhiro Suzuki 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief QEMU RISC-V virt machine hardware depended interface 10 */ 11 12 #include <zephyr/kernel.h> 13 #include <zephyr/arch/cpu.h> 14 #include <zephyr/sys/util.h> 15 16 /* 17 * Exit QEMU and tell error number. 18 * Higher 16bits: indicates error number. 19 * Lower 16bits : set FINISHER_FAIL 20 */ 21 #define FINISHER_FAIL 0x3333 22 23 /* Exit QEMU successfully */ 24 #define FINISHER_EXIT 0x5555 25 26 /* Reboot machine */ 27 #define FINISHER_REBOOT 0x7777 28 sys_arch_reboot(int type)29void sys_arch_reboot(int type) 30 { 31 volatile uint32_t *reg = (uint32_t *)SIFIVE_SYSCON_TEST; 32 33 *reg = FINISHER_REBOOT; 34 35 ARG_UNUSED(type); 36 } 37