riscv/virt: M-mode poweroff support
This adds poweroff support to `rv-virt/nsh` and `rv-virt/nsh64`. Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
This commit is contained in:
parent
5b3ef20629
commit
ef15b5296d
@ -31,4 +31,6 @@
|
|||||||
#define QEMU_RV_ACLINT_BASE 0x02f00000
|
#define QEMU_RV_ACLINT_BASE 0x02f00000
|
||||||
#define QEMU_RV_PLIC_BASE 0x0c000000
|
#define QEMU_RV_PLIC_BASE 0x0c000000
|
||||||
|
|
||||||
|
#define QEMU_RV_RESET_BASE 0x100000
|
||||||
|
|
||||||
#endif /* __ARCH_RISCV_SRC_QEMU_RV_HARDWARE_QEMU_RV_MEMORYMAP_H */
|
#endif /* __ARCH_RISCV_SRC_QEMU_RV_HARDWARE_QEMU_RV_MEMORYMAP_H */
|
||||||
|
@ -39,4 +39,12 @@
|
|||||||
#define QEMU_RV_IDLESTACK_BASE _ebss
|
#define QEMU_RV_IDLESTACK_BASE _ebss
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_BUILD_KERNEL
|
||||||
|
/* QEMU reset chocies */
|
||||||
|
|
||||||
|
#define QEMU_RV_RESET_DONE 0x5555
|
||||||
|
#define QEMU_RV_RESET_FAIL 0x3333
|
||||||
|
#define QEMU_RV_RESET_REBOOT 0x7777
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __ARCH_RISCV_SRC_QEMU_RV_QEMU_RV_MEMORYMAP_H */
|
#endif /* __ARCH_RISCV_SRC_QEMU_RV_QEMU_RV_MEMORYMAP_H */
|
||||||
|
@ -26,6 +26,7 @@ CONFIG_ARCH_CHIP_QEMU_RV_ISA_M=y
|
|||||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
CONFIG_ARCH_RISCV=y
|
CONFIG_ARCH_RISCV=y
|
||||||
CONFIG_ARCH_STACKDUMP=y
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_BOARDCTL_POWEROFF=y
|
||||||
CONFIG_BOARD_LOOPSPERMSEC=6366
|
CONFIG_BOARD_LOOPSPERMSEC=6366
|
||||||
CONFIG_BUILTIN=y
|
CONFIG_BUILTIN=y
|
||||||
CONFIG_DEBUG_FULLOPT=y
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
@ -37,7 +38,6 @@ CONFIG_FS_HOSTFS=y
|
|||||||
CONFIG_FS_PROCFS=y
|
CONFIG_FS_PROCFS=y
|
||||||
CONFIG_IDLETHREAD_STACKSIZE=2048
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
CONFIG_INTELHEX_BINARY=y
|
|
||||||
CONFIG_LIBC_ENVPATH=y
|
CONFIG_LIBC_ENVPATH=y
|
||||||
CONFIG_LIBC_EXECFUNCS=y
|
CONFIG_LIBC_EXECFUNCS=y
|
||||||
CONFIG_LIBC_PERROR_STDOUT=y
|
CONFIG_LIBC_PERROR_STDOUT=y
|
||||||
|
@ -27,6 +27,7 @@ CONFIG_ARCH_INTERRUPTSTACK=2048
|
|||||||
CONFIG_ARCH_RISCV=y
|
CONFIG_ARCH_RISCV=y
|
||||||
CONFIG_ARCH_STACKDUMP=y
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
CONFIG_BCH=y
|
CONFIG_BCH=y
|
||||||
|
CONFIG_BOARDCTL_POWEROFF=y
|
||||||
CONFIG_BOARD_LOOPSPERMSEC=6366
|
CONFIG_BOARD_LOOPSPERMSEC=6366
|
||||||
CONFIG_BUILTIN=y
|
CONFIG_BUILTIN=y
|
||||||
CONFIG_DEBUG_FULLOPT=y
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
@ -40,7 +41,6 @@ CONFIG_FS_PROCFS=y
|
|||||||
CONFIG_IDLETHREAD_STACKSIZE=2048
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
CONFIG_INIT_STACKSIZE=3072
|
CONFIG_INIT_STACKSIZE=3072
|
||||||
CONFIG_INTELHEX_BINARY=y
|
|
||||||
CONFIG_LIBC_ENVPATH=y
|
CONFIG_LIBC_ENVPATH=y
|
||||||
CONFIG_LIBC_EXECFUNCS=y
|
CONFIG_LIBC_EXECFUNCS=y
|
||||||
CONFIG_LIBC_PERROR_STDOUT=y
|
CONFIG_LIBC_PERROR_STDOUT=y
|
||||||
|
@ -36,6 +36,10 @@
|
|||||||
|
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
|
|
||||||
|
#ifndef CONFIG_BUILD_KERNEL
|
||||||
|
#include "hardware/qemu_rv_memorymap.h"
|
||||||
|
#include "qemu_rv_memorymap.h"
|
||||||
|
#endif
|
||||||
#include "riscv_internal.h"
|
#include "riscv_internal.h"
|
||||||
#include "romfs.h"
|
#include "romfs.h"
|
||||||
|
|
||||||
@ -185,7 +189,7 @@ int board_power_off(int status)
|
|||||||
#ifdef CONFIG_BUILD_KERNEL
|
#ifdef CONFIG_BUILD_KERNEL
|
||||||
riscv_sbi_system_reset(SBI_SRST_TYPE_SHUTDOWN, SBI_SRST_REASON_NONE);
|
riscv_sbi_system_reset(SBI_SRST_TYPE_SHUTDOWN, SBI_SRST_REASON_NONE);
|
||||||
#else
|
#else
|
||||||
#warning "to be done"
|
*(FAR volatile uint32_t *)QEMU_RV_RESET_BASE = QEMU_RV_RESET_DONE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UNUSED(status);
|
UNUSED(status);
|
||||||
|
Loading…
Reference in New Issue
Block a user