blob: 581f4116c9b8ee90b78d6341edbb320af5d0de84 [file] [log] [blame]
/*
* Copyright (c) 2021 Katsuhiro Suzuki
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief QEMU RISC-V virt machine hardware depended interface
*/
#include <zephyr/kernel.h>
#include <zephyr/arch/cpu.h>
#include <zephyr/sys/util.h>
/*
* Exit QEMU and tell error number.
* Higher 16bits: indicates error number.
* Lower 16bits : set FINISHER_FAIL
*/
#define FINISHER_FAIL 0x3333
/* Exit QEMU successfully */
#define FINISHER_EXIT 0x5555
/* Reboot machine */
#define FINISHER_REBOOT 0x7777
void sys_arch_reboot(int type)
{
volatile uint32_t *reg = (uint32_t *)SIFIVE_SYSCON_TEST;
*reg = FINISHER_REBOOT;
ARG_UNUSED(type);
}