platform/generic/platform.c: Support qemu poweroff

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
This commit is contained in:
Guo Ren
2021-05-04 23:26:25 +08:00
committed by forum_service
parent 885df4577a
commit ba85a8ec52

View File

@@ -42,6 +42,7 @@ bool sbi_system_reset_supported(u32 reset_type, u32 reset_reason)
return FALSE; return FALSE;
} }
#include <sbi/riscv_io.h>
void __noreturn sbi_system_reset(u32 reset_type, u32 reset_reason) void __noreturn sbi_system_reset(u32 reset_type, u32 reset_reason)
{ {
ulong hbase = 0, hmask; ulong hbase = 0, hmask;
@@ -66,6 +67,8 @@ void __noreturn sbi_system_reset(u32 reset_type, u32 reset_reason)
reset_dev && reset_dev->system_reset) reset_dev && reset_dev->system_reset)
reset_dev->system_reset(reset_type, reset_reason); reset_dev->system_reset(reset_type, reset_reason);
writew(0x5555, (void *)0x100000); // qemu poweroff
/* If platform specific reset did not work then do sbi_exit() */ /* If platform specific reset did not work then do sbi_exit() */
sbi_exit(scratch); sbi_exit(scratch);
} }