arm64: implement arch_system_halt
When PSCI is enabled, implement `arch_system_halt` using PSCI_SHUTDOWN. Signed-off-by: Henri Xavier <datacomos@huawei.com>
This commit is contained in:
parent
7668bd3b7c
commit
b54ba9877f
3 changed files with 42 additions and 1 deletions
|
@ -13,9 +13,10 @@
|
||||||
* exceptions
|
* exceptions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <zephyr/drivers/pm_cpu_ops.h>
|
||||||
|
#include <zephyr/exc_handle.h>
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
#include <zephyr/exc_handle.h>
|
|
||||||
|
|
||||||
LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);
|
LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);
|
||||||
|
|
||||||
|
@ -278,3 +279,17 @@ FUNC_NORETURN void arch_syscall_oops(void *ssf_ptr)
|
||||||
CODE_UNREACHABLE;
|
CODE_UNREACHABLE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_PM_CPU_OPS_PSCI)
|
||||||
|
FUNC_NORETURN void arch_system_halt(unsigned int reason)
|
||||||
|
{
|
||||||
|
ARG_UNUSED(reason);
|
||||||
|
|
||||||
|
(void)arch_irq_lock();
|
||||||
|
(void)pm_system_off();
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
/* Spin endlessly as fallback */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -66,6 +66,20 @@ int pm_cpu_on(unsigned long cpuid,
|
||||||
return psci_to_dev_err(ret);
|
return psci_to_dev_err(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pm_system_off(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (psci_data.conduit == SMCCC_CONDUIT_NONE) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* A compliant PSCI implementation will never return from this call */
|
||||||
|
ret = psci_data.invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
|
||||||
|
|
||||||
|
return psci_to_dev_err(ret);
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned long __invoke_psci_fn_hvc(unsigned long function_id,
|
static unsigned long __invoke_psci_fn_hvc(unsigned long function_id,
|
||||||
unsigned long arg0,
|
unsigned long arg0,
|
||||||
unsigned long arg1,
|
unsigned long arg1,
|
||||||
|
|
|
@ -51,6 +51,18 @@ int pm_cpu_off(void);
|
||||||
*/
|
*/
|
||||||
int pm_cpu_on(unsigned long cpuid, uintptr_t entry_point);
|
int pm_cpu_on(unsigned long cpuid, uintptr_t entry_point);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Power down the system
|
||||||
|
*
|
||||||
|
* This call is used to power down the whole system.
|
||||||
|
*
|
||||||
|
* A compliant PSCI implementation will never return, but some real-world
|
||||||
|
* implementations do return errors in some cases.
|
||||||
|
*
|
||||||
|
* @retval does not return on success, a negative errno otherwise
|
||||||
|
* @retval -ENOTSUP If the operation is not supported
|
||||||
|
*/
|
||||||
|
int pm_system_off(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue