AArch64 has support for PSCI. This is especially useful for SMP because PSCI is used to power on the secordary cores. When the PSCI driver was introduced in Zephyr it was designed to rely on a very PSCI-centric subsystem / interface. There are two kinds of problems with this choice: 1. PSCI is only defined for the non-secure world and it is designed to boot CPU cores into non-secure state (that means that PSCI is only supposed to work if Zephyr is running in non-secure state) 2. There can be other ways or standards used to start / stop a core different from PSCI This patch is trying to fix the original wrong assumption by making the interface / subsystem a generic one, called 'pm_cpu_ops', and using PSCI only as an actual driver that is a user of this new interface / subsystem. For now the new subsystem is only exposing two methods: cpu_on and cpu_off, others will probably follow according to the needs. Signed-off-by: Carlo Caione <ccaione@baylibre.com>
64 lines
1.3 KiB
C
64 lines
1.3 KiB
C
/*
|
|
* Copyright 2021 Carlo Caione <ccaione@baylibre.com>
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef ZEPHYR_INCLUDE_DRIVERS_PM_CPU_OPS_H_
|
|
#define ZEPHYR_INCLUDE_DRIVERS_PM_CPU_OPS_H_
|
|
|
|
/**
|
|
* @file
|
|
* @brief Public API for CPU Power Management
|
|
*/
|
|
|
|
#include <zephyr/types.h>
|
|
#include <stddef.h>
|
|
#include <device.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @defgroup power_management_cpu_api CPU Power Management
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
* @brief Power down the calling core
|
|
*
|
|
* This call is intended for use in hotplug. A core that is powered down by
|
|
* cpu_off can only be powered up again in response to a cpu_on
|
|
*
|
|
* @retval The call does not return when successful
|
|
* @retval -ENOTSUP If the operation is not supported
|
|
*/
|
|
int pm_cpu_off(void);
|
|
|
|
/**
|
|
* @brief Power up a core
|
|
*
|
|
* This call is used to power up cores that either have not yet been booted
|
|
* into the calling supervisory software or have been previously powered down
|
|
* with a cpu_off call
|
|
*
|
|
* @param cpuid CPU id to power on
|
|
* @param entry_point Address at which the core must commence execution
|
|
*
|
|
* @retval 0 on success, a negative errno otherwise
|
|
* @retval -ENOTSUP If the operation is not supported
|
|
*/
|
|
int pm_cpu_on(unsigned long cpuid, uintptr_t entry_point);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* @}
|
|
*/
|
|
|
|
#endif /* ZEPHYR_INCLUDE_DRIVERS_PM_CPU_OPS_H_ */
|