blob: b1eef69f75d3e11c0b72a078e4d69221b44ae04e [file] [log] [blame]
Soby Mathewb48349e2015-06-29 16:30:12 +01001/*
Soby Mathew4067dc32015-05-05 16:33:16 +01002 * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
Soby Mathewb48349e2015-06-29 16:30:12 +01003 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * Neither the name of ARM nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <arch.h>
32#include <arch_helpers.h>
33#include <assert.h>
34#include <bl_common.h>
35#include <context.h>
36#include <context_mgmt.h>
37#include <platform.h>
38#include <stddef.h>
39#include "psci_private.h"
40
41/*******************************************************************************
42 * Per cpu non-secure contexts used to program the architectural state prior
43 * return to the normal world.
44 * TODO: Use the memory allocator to set aside memory for the contexts instead
Soby Mathew4067dc32015-05-05 16:33:16 +010045 * of relying on platform defined constants. Using PSCI_NUM_PWR_DOMAINS will be
46 * an overkill.
Soby Mathewb48349e2015-06-29 16:30:12 +010047 ******************************************************************************/
48static cpu_context_t psci_ns_context[PLATFORM_CORE_COUNT];
49
50/*******************************************************************************
Soby Mathew4067dc32015-05-05 16:33:16 +010051 * In a system, a certain number of power domain instances are present at a
52 * power level. The cumulative number of instances across all levels are
53 * stored in 'psci_pwr_domain_map'. The topology tree has been flattenned into
54 * this array. To retrieve nodes, information about the extents of each power
55 * level i.e. start index and end index needs to be present.
56 * 'psci_pwr_lvl_limits' stores this information.
Soby Mathewb48349e2015-06-29 16:30:12 +010057 ******************************************************************************/
Soby Mathew4067dc32015-05-05 16:33:16 +010058pwr_lvl_limits_node_t psci_pwr_lvl_limits[MPIDR_MAX_AFFLVL + 1];
Soby Mathewb48349e2015-06-29 16:30:12 +010059
60/******************************************************************************
61 * Define the psci capability variable.
62 *****************************************************************************/
63uint32_t psci_caps;
64
65
66/*******************************************************************************
Soby Mathew4067dc32015-05-05 16:33:16 +010067 * Routines for retrieving the node corresponding to a power domain instance
Soby Mathewb48349e2015-06-29 16:30:12 +010068 * in the mpidr. The first one uses binary search to find the node corresponding
Soby Mathew4067dc32015-05-05 16:33:16 +010069 * to the mpidr (key) at a particular power level. The second routine decides
70 * extents of the binary search at each power level.
Soby Mathewb48349e2015-06-29 16:30:12 +010071 ******************************************************************************/
Soby Mathew4067dc32015-05-05 16:33:16 +010072static int psci_pwr_domain_map_get_idx(unsigned long key,
Soby Mathewb48349e2015-06-29 16:30:12 +010073 int min_idx,
74 int max_idx)
75{
76 int mid;
77
78 /*
79 * Terminating condition: If the max and min indices have crossed paths
80 * during the binary search then the key has not been found.
81 */
82 if (max_idx < min_idx)
83 return PSCI_E_INVALID_PARAMS;
84
85 /*
86 * Make sure we are within array limits.
87 */
Soby Mathew4067dc32015-05-05 16:33:16 +010088 assert(min_idx >= 0 && max_idx < PSCI_NUM_PWR_DOMAINS);
Soby Mathewb48349e2015-06-29 16:30:12 +010089
90 /*
91 * Bisect the array around 'mid' and then recurse into the array chunk
92 * where the key is likely to be found. The mpidrs in each node in the
Soby Mathew4067dc32015-05-05 16:33:16 +010093 * 'psci_pwr_domain_map' for a given power level are stored in an
94 * ascending order which makes the binary search possible.
Soby Mathewb48349e2015-06-29 16:30:12 +010095 */
96 mid = min_idx + ((max_idx - min_idx) >> 1); /* Divide by 2 */
97
Soby Mathew4067dc32015-05-05 16:33:16 +010098 if (psci_pwr_domain_map[mid].mpidr > key)
99 return psci_pwr_domain_map_get_idx(key, min_idx, mid - 1);
100 else if (psci_pwr_domain_map[mid].mpidr < key)
101 return psci_pwr_domain_map_get_idx(key, mid + 1, max_idx);
Soby Mathewb48349e2015-06-29 16:30:12 +0100102 else
103 return mid;
104}
105
Soby Mathew4067dc32015-05-05 16:33:16 +0100106pwr_map_node_t *psci_get_pwr_map_node(unsigned long mpidr, int pwr_lvl)
Soby Mathewb48349e2015-06-29 16:30:12 +0100107{
108 int rc;
109
Soby Mathew4067dc32015-05-05 16:33:16 +0100110 if (pwr_lvl > PLAT_MAX_PWR_LVL)
Soby Mathewb48349e2015-06-29 16:30:12 +0100111 return NULL;
112
Soby Mathew4067dc32015-05-05 16:33:16 +0100113 /* Right shift the mpidr to the required power level */
114 mpidr = mpidr_mask_lower_afflvls(mpidr, pwr_lvl);
Soby Mathewb48349e2015-06-29 16:30:12 +0100115
Soby Mathew4067dc32015-05-05 16:33:16 +0100116 rc = psci_pwr_domain_map_get_idx(mpidr,
117 psci_pwr_lvl_limits[pwr_lvl].min,
118 psci_pwr_lvl_limits[pwr_lvl].max);
Soby Mathewb48349e2015-06-29 16:30:12 +0100119 if (rc >= 0)
Soby Mathew4067dc32015-05-05 16:33:16 +0100120 return &psci_pwr_domain_map[rc];
Soby Mathewb48349e2015-06-29 16:30:12 +0100121 else
122 return NULL;
123}
124
125/*******************************************************************************
126 * This function populates an array with nodes corresponding to a given range of
Soby Mathew4067dc32015-05-05 16:33:16 +0100127 * power levels in an mpidr. It returns successfully only when the power
128 * levels are correct, the mpidr is valid i.e. no power level is absent from
129 * the topology tree & the power domain instance at level 0 is not absent.
Soby Mathewb48349e2015-06-29 16:30:12 +0100130 ******************************************************************************/
Soby Mathew4067dc32015-05-05 16:33:16 +0100131int psci_get_pwr_map_nodes(unsigned long mpidr,
132 int start_pwrlvl,
133 int end_pwrlvl,
134 pwr_map_node_t *mpidr_nodes[])
Soby Mathewb48349e2015-06-29 16:30:12 +0100135{
136 int rc = PSCI_E_INVALID_PARAMS, level;
Soby Mathew4067dc32015-05-05 16:33:16 +0100137 pwr_map_node_t *node;
Soby Mathewb48349e2015-06-29 16:30:12 +0100138
Soby Mathew4067dc32015-05-05 16:33:16 +0100139 rc = psci_check_pwrlvl_range(start_pwrlvl, end_pwrlvl);
Soby Mathewb48349e2015-06-29 16:30:12 +0100140 if (rc != PSCI_E_SUCCESS)
141 return rc;
142
Soby Mathew4067dc32015-05-05 16:33:16 +0100143 for (level = start_pwrlvl; level <= end_pwrlvl; level++) {
Soby Mathewb48349e2015-06-29 16:30:12 +0100144
145 /*
Soby Mathew4067dc32015-05-05 16:33:16 +0100146 * Grab the node for each power level. No power level
Soby Mathewb48349e2015-06-29 16:30:12 +0100147 * can be missing as that would mean that the topology tree
148 * is corrupted.
149 */
Soby Mathew4067dc32015-05-05 16:33:16 +0100150 node = psci_get_pwr_map_node(mpidr, level);
Soby Mathewb48349e2015-06-29 16:30:12 +0100151 if (node == NULL) {
152 rc = PSCI_E_INVALID_PARAMS;
153 break;
154 }
155
156 /*
Soby Mathew4067dc32015-05-05 16:33:16 +0100157 * Skip absent power levels unless it's power level 0.
Soby Mathewb48349e2015-06-29 16:30:12 +0100158 * An absent cpu means that the mpidr is invalid. Save the
Soby Mathew4067dc32015-05-05 16:33:16 +0100159 * pointer to the node for the present power level
Soby Mathewb48349e2015-06-29 16:30:12 +0100160 */
Soby Mathew4067dc32015-05-05 16:33:16 +0100161 if (!(node->state & PSCI_PWR_DOMAIN_PRESENT)) {
Soby Mathewb48349e2015-06-29 16:30:12 +0100162 if (level == MPIDR_AFFLVL0) {
163 rc = PSCI_E_INVALID_PARAMS;
164 break;
165 }
166
167 mpidr_nodes[level] = NULL;
168 } else
169 mpidr_nodes[level] = node;
170 }
171
172 return rc;
173}
174
175/*******************************************************************************
Soby Mathew4067dc32015-05-05 16:33:16 +0100176 * Function which initializes the 'pwr_map_node' corresponding to a power
177 * domain instance. Each node has a unique mpidr, level and bakery lock.
Soby Mathewb48349e2015-06-29 16:30:12 +0100178 ******************************************************************************/
Soby Mathew4067dc32015-05-05 16:33:16 +0100179static void psci_init_pwr_map_node(unsigned long mpidr,
Soby Mathewb48349e2015-06-29 16:30:12 +0100180 int level,
181 unsigned int idx)
182{
183 unsigned char state;
184 uint32_t linear_id;
Soby Mathew4067dc32015-05-05 16:33:16 +0100185 psci_pwr_domain_map[idx].mpidr = mpidr;
186 psci_pwr_domain_map[idx].level = level;
187 psci_lock_init(psci_pwr_domain_map, idx);
Soby Mathewb48349e2015-06-29 16:30:12 +0100188
189 /*
Soby Mathew4067dc32015-05-05 16:33:16 +0100190 * If an power domain instance is present then mark it as OFF
191 * to begin with.
Soby Mathewb48349e2015-06-29 16:30:12 +0100192 */
Soby Mathew4067dc32015-05-05 16:33:16 +0100193 state = plat_get_pwr_domain_state(level, mpidr);
194 psci_pwr_domain_map[idx].state = state;
Soby Mathewb48349e2015-06-29 16:30:12 +0100195
Soby Mathew12d0d002015-04-09 13:40:55 +0100196 /*
197 * Check if this is a CPU node and is present in which case certain
198 * other initialisations are required.
199 */
200 if (level != MPIDR_AFFLVL0)
201 return;
Soby Mathewb48349e2015-06-29 16:30:12 +0100202
Soby Mathew12d0d002015-04-09 13:40:55 +0100203 if (!(state & PSCI_PWR_DOMAIN_PRESENT))
204 return;
Soby Mathewb48349e2015-06-29 16:30:12 +0100205
Soby Mathew12d0d002015-04-09 13:40:55 +0100206 /*
207 * Mark the cpu as OFF. Higher power level reference counts
208 * have already been memset to 0
209 */
210 psci_set_state(&psci_pwr_domain_map[idx], PSCI_STATE_OFF);
Soby Mathewb48349e2015-06-29 16:30:12 +0100211
Soby Mathew12d0d002015-04-09 13:40:55 +0100212 /*
213 * Associate a non-secure context with this power
214 * instance through the context management library.
215 */
216 linear_id = plat_core_pos_by_mpidr(mpidr);
217 assert(linear_id < PLATFORM_CORE_COUNT);
Soby Mathewb48349e2015-06-29 16:30:12 +0100218
Soby Mathew12d0d002015-04-09 13:40:55 +0100219 /* Invalidate the suspend context for the node */
220 set_cpu_data_by_index(linear_id,
221 psci_svc_cpu_data.power_state,
222 PSCI_INVALID_DATA);
Soby Mathewb48349e2015-06-29 16:30:12 +0100223
Soby Mathew12d0d002015-04-09 13:40:55 +0100224 flush_cpu_data_by_index(linear_id, psci_svc_cpu_data);
Soby Mathewb48349e2015-06-29 16:30:12 +0100225
Soby Mathew12d0d002015-04-09 13:40:55 +0100226 cm_set_context_by_index(linear_id,
227 (void *) &psci_ns_context[linear_id],
228 NON_SECURE);
Soby Mathewb48349e2015-06-29 16:30:12 +0100229}
230
231/*******************************************************************************
232 * Core routine used by the Breadth-First-Search algorithm to populate the
Soby Mathew4067dc32015-05-05 16:33:16 +0100233 * power domain tree. Each level in the tree corresponds to a power level. This
234 * routine's aim is to traverse to the target power level and populate nodes
235 * in the 'psci_pwr_domain_map' for all the siblings at that level. It uses the
236 * current power level to keep track of how many levels from the root of the
237 * tree have been traversed. If the current power level != target power level,
Soby Mathewb48349e2015-06-29 16:30:12 +0100238 * then the platform is asked to return the number of children that each
Soby Mathew4067dc32015-05-05 16:33:16 +0100239 * power domain instance has at the current power level. Traversal is then done
240 * for each child at the next lower level i.e. current power level - 1.
Soby Mathewb48349e2015-06-29 16:30:12 +0100241 *
Soby Mathew4067dc32015-05-05 16:33:16 +0100242 * CAUTION: This routine assumes that power domain instance ids are allocated
243 * in a monotonically increasing manner at each power level in a mpidr starting
Soby Mathewb48349e2015-06-29 16:30:12 +0100244 * from 0. If the platform breaks this assumption then this code will have to
245 * be reworked accordingly.
246 ******************************************************************************/
Soby Mathew4067dc32015-05-05 16:33:16 +0100247static unsigned int psci_init_pwr_map(unsigned long mpidr,
248 unsigned int pwrmap_idx,
249 int cur_pwrlvl,
250 int tgt_pwrlvl)
Soby Mathewb48349e2015-06-29 16:30:12 +0100251{
Soby Mathew4067dc32015-05-05 16:33:16 +0100252 unsigned int ctr, pwr_inst_count;
Soby Mathewb48349e2015-06-29 16:30:12 +0100253
Soby Mathew4067dc32015-05-05 16:33:16 +0100254 assert(cur_pwrlvl >= tgt_pwrlvl);
Soby Mathewb48349e2015-06-29 16:30:12 +0100255
256 /*
Soby Mathew4067dc32015-05-05 16:33:16 +0100257 * Find the number of siblings at the current power level &
Soby Mathewb48349e2015-06-29 16:30:12 +0100258 * assert if there are none 'cause then we have been invoked with
259 * an invalid mpidr.
260 */
Soby Mathew4067dc32015-05-05 16:33:16 +0100261 pwr_inst_count = plat_get_pwr_domain_count(cur_pwrlvl, mpidr);
262 assert(pwr_inst_count);
Soby Mathewb48349e2015-06-29 16:30:12 +0100263
Soby Mathew4067dc32015-05-05 16:33:16 +0100264 if (tgt_pwrlvl < cur_pwrlvl) {
265 for (ctr = 0; ctr < pwr_inst_count; ctr++) {
266 mpidr = mpidr_set_pwr_domain_inst(mpidr, ctr,
267 cur_pwrlvl);
268 pwrmap_idx = psci_init_pwr_map(mpidr,
269 pwrmap_idx,
270 cur_pwrlvl - 1,
271 tgt_pwrlvl);
Soby Mathewb48349e2015-06-29 16:30:12 +0100272 }
273 } else {
Soby Mathew4067dc32015-05-05 16:33:16 +0100274 for (ctr = 0; ctr < pwr_inst_count; ctr++, pwrmap_idx++) {
275 mpidr = mpidr_set_pwr_domain_inst(mpidr, ctr,
276 cur_pwrlvl);
277 psci_init_pwr_map_node(mpidr, cur_pwrlvl, pwrmap_idx);
Soby Mathewb48349e2015-06-29 16:30:12 +0100278 }
279
Soby Mathew4067dc32015-05-05 16:33:16 +0100280 /* pwrmap_idx is 1 greater than the max index of cur_pwrlvl */
281 psci_pwr_lvl_limits[cur_pwrlvl].max = pwrmap_idx - 1;
Soby Mathewb48349e2015-06-29 16:30:12 +0100282 }
283
Soby Mathew4067dc32015-05-05 16:33:16 +0100284 return pwrmap_idx;
Soby Mathewb48349e2015-06-29 16:30:12 +0100285}
286
287/*******************************************************************************
288 * This function initializes the topology tree by querying the platform. To do
Soby Mathew4067dc32015-05-05 16:33:16 +0100289 * so, it's helper routines implement a Breadth-First-Search. At each power
290 * level the platform conveys the number of power domain instances that exist
291 * i.e. the power instance count. The algorithm populates the
292 * psci_pwr_domain_map* recursively using this information. On a platform that
293 * implements two clusters of 4 cpus each, the populated pwr_map_array would
294 * look like this:
Soby Mathewb48349e2015-06-29 16:30:12 +0100295 *
296 * <- cpus cluster0 -><- cpus cluster1 ->
297 * ---------------------------------------------------
298 * | 0 | 1 | 0 | 1 | 2 | 3 | 0 | 1 | 2 | 3 |
299 * ---------------------------------------------------
300 * ^ ^
301 * cluster __| cpu __|
302 * limit limit
303 *
304 * The first 2 entries are of the cluster nodes. The next 4 entries are of cpus
305 * within cluster 0. The last 4 entries are of cpus within cluster 1.
Soby Mathew4067dc32015-05-05 16:33:16 +0100306 * The 'psci_pwr_lvl_limits' array contains the max & min index of each power
307 * level within the 'psci_pwr_domain_map' array. This allows restricting search
308 * of a node at a power level between the indices in the limits array.
Soby Mathewb48349e2015-06-29 16:30:12 +0100309 ******************************************************************************/
310int32_t psci_setup(void)
311{
312 unsigned long mpidr = read_mpidr();
Soby Mathew4067dc32015-05-05 16:33:16 +0100313 int pwrlvl, pwrmap_idx, max_pwrlvl;
314 pwr_map_node_t *node;
Soby Mathewb48349e2015-06-29 16:30:12 +0100315
316 psci_plat_pm_ops = NULL;
317
Soby Mathew4067dc32015-05-05 16:33:16 +0100318 /* Find out the maximum power level that the platform implements */
319 max_pwrlvl = PLAT_MAX_PWR_LVL;
320 assert(max_pwrlvl <= MPIDR_MAX_AFFLVL);
Soby Mathewb48349e2015-06-29 16:30:12 +0100321
322 /*
323 * This call traverses the topology tree with help from the platform and
Soby Mathew4067dc32015-05-05 16:33:16 +0100324 * populates the power map using a breadth-first-search recursively.
325 * We assume that the platform allocates power domain instance ids from
326 * 0 onwards at each power level in the mpidr. FIRST_MPIDR = 0.0.0.0
Soby Mathewb48349e2015-06-29 16:30:12 +0100327 */
Soby Mathew4067dc32015-05-05 16:33:16 +0100328 pwrmap_idx = 0;
329 for (pwrlvl = max_pwrlvl; pwrlvl >= MPIDR_AFFLVL0; pwrlvl--) {
330 pwrmap_idx = psci_init_pwr_map(FIRST_MPIDR,
331 pwrmap_idx,
332 max_pwrlvl,
333 pwrlvl);
Soby Mathewb48349e2015-06-29 16:30:12 +0100334 }
335
336#if !USE_COHERENT_MEM
337 /*
Soby Mathew4067dc32015-05-05 16:33:16 +0100338 * The psci_pwr_domain_map only needs flushing when it's not allocated
339 * in coherent memory.
Soby Mathewb48349e2015-06-29 16:30:12 +0100340 */
Soby Mathew4067dc32015-05-05 16:33:16 +0100341 flush_dcache_range((uint64_t) &psci_pwr_domain_map,
342 sizeof(psci_pwr_domain_map));
Soby Mathewb48349e2015-06-29 16:30:12 +0100343#endif
344
345 /*
Soby Mathew4067dc32015-05-05 16:33:16 +0100346 * Set the bounds for number of instances of each level in the map. Also
Soby Mathewb48349e2015-06-29 16:30:12 +0100347 * flush out the entire array so that it's visible to subsequent power
Soby Mathew4067dc32015-05-05 16:33:16 +0100348 * management operations. The 'psci_pwr_lvl_limits' array is allocated
349 * in normal memory. It will be accessed when the mmu is off e.g. after
Soby Mathewb48349e2015-06-29 16:30:12 +0100350 * reset. Hence it needs to be flushed.
351 */
Soby Mathew4067dc32015-05-05 16:33:16 +0100352 for (pwrlvl = MPIDR_AFFLVL0; pwrlvl < max_pwrlvl; pwrlvl++) {
353 psci_pwr_lvl_limits[pwrlvl].min =
354 psci_pwr_lvl_limits[pwrlvl + 1].max + 1;
Soby Mathewb48349e2015-06-29 16:30:12 +0100355 }
356
Soby Mathew4067dc32015-05-05 16:33:16 +0100357 flush_dcache_range((unsigned long) psci_pwr_lvl_limits,
358 sizeof(psci_pwr_lvl_limits));
Soby Mathewb48349e2015-06-29 16:30:12 +0100359
360 /*
Soby Mathew4067dc32015-05-05 16:33:16 +0100361 * Mark the power domain instances in our mpidr as ON. No need to lock
362 * as this is the primary cpu.
Soby Mathewb48349e2015-06-29 16:30:12 +0100363 */
364 mpidr &= MPIDR_AFFINITY_MASK;
Soby Mathew4067dc32015-05-05 16:33:16 +0100365 for (pwrlvl = MPIDR_AFFLVL0; pwrlvl <= max_pwrlvl; pwrlvl++) {
Soby Mathewb48349e2015-06-29 16:30:12 +0100366
Soby Mathew4067dc32015-05-05 16:33:16 +0100367 node = psci_get_pwr_map_node(mpidr, pwrlvl);
Soby Mathewb48349e2015-06-29 16:30:12 +0100368 assert(node);
369
370 /* Mark each present node as ON. */
Soby Mathew4067dc32015-05-05 16:33:16 +0100371 if (node->state & PSCI_PWR_DOMAIN_PRESENT)
Soby Mathewb48349e2015-06-29 16:30:12 +0100372 psci_set_state(node, PSCI_STATE_ON);
373 }
374
375 platform_setup_pm(&psci_plat_pm_ops);
376 assert(psci_plat_pm_ops);
377
378 /* Initialize the psci capability */
379 psci_caps = PSCI_GENERIC_CAP;
380
Soby Mathew4067dc32015-05-05 16:33:16 +0100381 if (psci_plat_pm_ops->pwr_domain_off)
Soby Mathewb48349e2015-06-29 16:30:12 +0100382 psci_caps |= define_psci_cap(PSCI_CPU_OFF);
Soby Mathew4067dc32015-05-05 16:33:16 +0100383 if (psci_plat_pm_ops->pwr_domain_on &&
384 psci_plat_pm_ops->pwr_domain_on_finish)
Soby Mathewb48349e2015-06-29 16:30:12 +0100385 psci_caps |= define_psci_cap(PSCI_CPU_ON_AARCH64);
Soby Mathew4067dc32015-05-05 16:33:16 +0100386 if (psci_plat_pm_ops->pwr_domain_suspend &&
387 psci_plat_pm_ops->pwr_domain_suspend_finish) {
Soby Mathewb48349e2015-06-29 16:30:12 +0100388 psci_caps |= define_psci_cap(PSCI_CPU_SUSPEND_AARCH64);
389 if (psci_plat_pm_ops->get_sys_suspend_power_state)
390 psci_caps |= define_psci_cap(PSCI_SYSTEM_SUSPEND_AARCH64);
391 }
392 if (psci_plat_pm_ops->system_off)
393 psci_caps |= define_psci_cap(PSCI_SYSTEM_OFF);
394 if (psci_plat_pm_ops->system_reset)
395 psci_caps |= define_psci_cap(PSCI_SYSTEM_RESET);
396
397 return 0;
398}