arm64: support reboot / poweroff for qemu virt arm64

Signed-off-by: Shanmin Zhang <zhangshanmin@xiaomi.com>
This commit is contained in:
Shanmin Zhang 2023-08-14 11:04:44 +08:00 committed by Xiang Xiao
parent 75e591ae4f
commit e8550a02b9
3 changed files with 35 additions and 1 deletions

View File

@ -51,6 +51,8 @@ config ARCH_CHIP_QEMU
select ARCH_HAVE_ADDRENV
select ARCH_HAVE_PSCI
select ARCH_NEED_ADDRENV_MAPPING
select ARCH_HAVE_POWEROFF
select ARCH_HAVE_RESET
---help---
QEMU virt platform (ARMv8a)
@ -62,6 +64,8 @@ config ARCH_CHIP_GOLDFISH
select ARMV8A_HAVE_GICv2
select ARCH_HAVE_ADDRENV
select ARCH_HAVE_IRQTRIGGER
select ARCH_HAVE_POWEROFF
select ARCH_HAVE_RESET
select ARCH_NEED_ADDRENV_MAPPING
---help---
Android GoldFish platform for NuttX (ARMv8a),

View File

@ -193,7 +193,35 @@ int psci_cpu_on(unsigned long cpuid, uintptr_t entry_point)
return psci_to_dev_err(ret);
}
int arm64_psci_init(const char *method)
int psci_sys_reset(void)
{
int ret;
if (psci_data.conduit == SMCCC_CONDUIT_NONE)
{
return -EINVAL;
}
ret = psci_data.invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
return psci_to_dev_err(ret);
}
int psci_sys_poweroff(void)
{
int ret;
if (psci_data.conduit == SMCCC_CONDUIT_NONE)
{
return -EINVAL;
}
ret = psci_data.invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
return psci_to_dev_err(ret);
}
int arm64_psci_init(const char * method)
{
psci_data.conduit = SMCCC_CONDUIT_NONE;

View File

@ -101,5 +101,7 @@ uint32_t psci_version(void);
int psci_cpu_off(void);
int psci_cpu_reset(void);
int psci_cpu_on(unsigned long cpuid, uintptr_t entry_point);
int psci_sys_poweroff(void);
int psci_sys_reset(void);
#endif /* __ARCH_ARM64_SRC_COMMON_ARM64_CPU_PSCI_H */