diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 289c1ff8e5..986fbd8c9d 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -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), diff --git a/arch/arm64/src/common/arm64_cpu_psci.c b/arch/arm64/src/common/arm64_cpu_psci.c index 52773389ad..50c47656b0 100644 --- a/arch/arm64/src/common/arm64_cpu_psci.c +++ b/arch/arm64/src/common/arm64_cpu_psci.c @@ -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; diff --git a/arch/arm64/src/common/arm64_cpu_psci.h b/arch/arm64/src/common/arm64_cpu_psci.h index 66e6e7445e..8fe2a4cedf 100644 --- a/arch/arm64/src/common/arm64_cpu_psci.h +++ b/arch/arm64/src/common/arm64_cpu_psci.h @@ -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 */