feat(psci): add support for PSCI_SET_SUSPEND_MODE

This patch adds a PSCI_SET_SUSPEND_MODE handler that validates the
request per section 5.20.2 of the PSCI spec (DEN0022D.b), and updates
the suspend mode to the requested mode.

This is conditionally compiled into the build depending on the value of
the `PSCI_OS_INIT_MODE` build option.

Change-Id: Iebf65f5f7846aef6b8643ad6082db99b4dcc4bef
Signed-off-by: Wing Li <wingers@google.com>
This commit is contained in:
Wing Li 2022-09-14 13:18:15 -07:00
parent 64b4710b8d
commit b88a4416b5
6 changed files with 128 additions and 3 deletions

View file

@ -163,6 +163,16 @@ typedef struct cpu_pwr_domain_node {
spinlock_t cpu_lock;
} cpu_pd_node_t;
#if PSCI_OS_INIT_MODE
/*******************************************************************************
* The supported power state coordination modes that can be used in CPU_SUSPEND.
******************************************************************************/
typedef enum suspend_mode {
PLAT_COORD = 0,
OS_INIT = 1
} suspend_mode_t;
#endif
/*******************************************************************************
* The following are helpers and declarations of locks.
******************************************************************************/
@ -260,6 +270,9 @@ extern non_cpu_pd_node_t psci_non_cpu_pd_nodes[PSCI_NUM_NON_CPU_PWR_DOMAINS];
extern cpu_pd_node_t psci_cpu_pd_nodes[PLATFORM_CORE_COUNT];
extern unsigned int psci_caps;
extern unsigned int psci_plat_core_count;
#if PSCI_OS_INIT_MODE
extern suspend_mode_t psci_suspend_mode;
#endif
/*******************************************************************************
* SPD's power management hooks registered with PSCI