1 /*
2  * Copyright 2021 Carlo Caione <ccaione@baylibre.com>
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_INCLUDE_DRIVERS_PM_CPU_OPS_H_
8 #define ZEPHYR_INCLUDE_DRIVERS_PM_CPU_OPS_H_
9 
10 /**
11  * @file
12  * @brief Public API for CPU Power Management
13  */
14 
15 #include <zephyr/types.h>
16 #include <stddef.h>
17 #include <zephyr/device.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 /* System reset types. */
24 #define SYS_WARM_RESET 0
25 #define SYS_COLD_RESET 1
26 /**
27  * @defgroup power_management_cpu_api CPU Power Management
28  * @ingroup subsys_pm
29  * @{
30  */
31 
32 /**
33  * @brief Power down the calling core
34  *
35  * This call is intended for use in hotplug. A core that is powered down by
36  * cpu_off can only be powered up again in response to a cpu_on
37  *
38  * @retval The call does not return when successful
39  * @retval -ENOTSUP If the operation is not supported
40  */
41 int pm_cpu_off(void);
42 
43 /**
44  * @brief Power up a core
45  *
46  * This call is used to power up cores that either have not yet been booted
47  * into the calling supervisory software or have been previously powered down
48  * with a cpu_off call
49  *
50  * @param cpuid CPU id to power on
51  * @param entry_point Address at which the core must commence execution
52  *
53  * @retval 0 on success, a negative errno otherwise
54  * @retval -ENOTSUP If the operation is not supported
55  */
56 int pm_cpu_on(unsigned long cpuid, uintptr_t entry_point);
57 
58 /**
59  * @brief System reset
60  *
61  * This function provides a method for performing a system cold or warm reset.
62  *
63  * @param reset system reset type, cold or warm.
64  *
65  * @retval 0 on success, a negative errno otherwise
66  */
67 int pm_system_reset(unsigned char reset);
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 /**
74  * @}
75  */
76 
77 #endif /* ZEPHYR_INCLUDE_DRIVERS_PM_CPU_OPS_H_ */
78