blob: ed29fbe3a951a4f5e19f4957df0a93c10a1784c5 [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Dan Handleye83b0ca2014-01-14 18:17:09 +00002 * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
Achin Gupta4f6ad662013-10-25 09:08:21 +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
Dan Handley2bd4ef22014-04-09 13:14:54 +010031#include <arch.h>
Achin Gupta4f6ad662013-10-25 09:08:21 +010032#include <arch_helpers.h>
Dan Handley2bd4ef22014-04-09 13:14:54 +010033#include <assert.h>
34#include <bl_common.h>
35#include <context.h>
Jeenu Viswambharancaa84932014-02-06 10:36:15 +000036#include <context_mgmt.h>
Dan Handley714a0d22014-04-09 13:13:04 +010037#include <debug.h>
Dan Handleyed6ff952014-05-14 17:44:19 +010038#include <platform.h>
Andrew Thoelke4e126072014-06-04 21:10:52 +010039#include <string.h>
Dan Handley714a0d22014-04-09 13:13:04 +010040#include "psci_private.h"
Achin Gupta4f6ad662013-10-25 09:08:21 +010041
Achin Gupta607084e2014-02-09 18:24:19 +000042/*
Jeenu Viswambharan7f366602014-02-20 17:11:00 +000043 * SPD power management operations, expected to be supplied by the registered
44 * SPD on successful SP initialization
Achin Gupta607084e2014-02-09 18:24:19 +000045 */
Dan Handleye2712bc2014-04-10 15:37:22 +010046const spd_pm_ops_t *psci_spd_pm;
Achin Gupta607084e2014-02-09 18:24:19 +000047
Achin Gupta4f6ad662013-10-25 09:08:21 +010048/*******************************************************************************
Achin Gupta4f6ad662013-10-25 09:08:21 +010049 * Grand array that holds the platform's topology information for state
50 * management of affinity instances. Each node (aff_map_node) in the array
51 * corresponds to an affinity instance e.g. cluster, cpu within an mpidr
52 ******************************************************************************/
Dan Handleye2712bc2014-04-10 15:37:22 +010053aff_map_node_t psci_aff_map[PSCI_NUM_AFFS]
Achin Gupta4f6ad662013-10-25 09:08:21 +010054__attribute__ ((section("tzfw_coherent_mem")));
55
56/*******************************************************************************
Achin Gupta4f6ad662013-10-25 09:08:21 +010057 * Pointer to functions exported by the platform to complete power mgmt. ops
58 ******************************************************************************/
Dan Handleya4cb68e2014-04-23 13:47:06 +010059const plat_pm_ops_t *psci_plat_pm_ops;
Achin Gupta4f6ad662013-10-25 09:08:21 +010060
61/*******************************************************************************
Achin Guptaa45e3972013-12-05 15:10:48 +000062 * Routine to return the maximum affinity level to traverse to after a cpu has
63 * been physically powered up. It is expected to be called immediately after
64 * reset from assembler code. It has to find its 'aff_map_node' instead of
65 * getting it as an argument.
66 * TODO: Calling psci_get_aff_map_node() with the MMU disabled is slow. Add
67 * support to allow faster access to the target affinity level.
68 ******************************************************************************/
69int get_power_on_target_afflvl(unsigned long mpidr)
70{
Dan Handleye2712bc2014-04-10 15:37:22 +010071 aff_map_node_t *node;
Achin Guptaa45e3972013-12-05 15:10:48 +000072 unsigned int state;
Vikram Kanigirif100f412014-04-01 19:26:26 +010073 int afflvl;
Achin Guptaa45e3972013-12-05 15:10:48 +000074
75 /* Retrieve our node from the topology tree */
Jeenu Viswambharancaa84932014-02-06 10:36:15 +000076 node = psci_get_aff_map_node(mpidr & MPIDR_AFFINITY_MASK,
77 MPIDR_AFFLVL0);
Achin Guptaa45e3972013-12-05 15:10:48 +000078 assert(node);
79
80 /*
81 * Return the maximum supported affinity level if this cpu was off.
82 * Call the handler in the suspend code if this cpu had been suspended.
83 * Any other state is invalid.
84 */
Achin Gupta75f73672013-12-05 16:33:10 +000085 state = psci_get_state(node);
Achin Guptaa45e3972013-12-05 15:10:48 +000086 if (state == PSCI_STATE_ON_PENDING)
87 return get_max_afflvl();
88
Vikram Kanigirif100f412014-04-01 19:26:26 +010089 if (state == PSCI_STATE_SUSPEND) {
90 afflvl = psci_get_aff_map_node_suspend_afflvl(node);
91 assert(afflvl != PSCI_INVALID_DATA);
92 return afflvl;
93 }
Achin Guptaa45e3972013-12-05 15:10:48 +000094 return PSCI_E_INVALID_PARAMS;
95}
96
97/*******************************************************************************
Achin Gupta4f6ad662013-10-25 09:08:21 +010098 * Simple routine to retrieve the maximum affinity level supported by the
99 * platform and check that it makes sense.
100 ******************************************************************************/
Juan Castillo2d552402014-06-13 17:05:10 +0100101int get_max_afflvl(void)
Achin Gupta4f6ad662013-10-25 09:08:21 +0100102{
103 int aff_lvl;
104
105 aff_lvl = plat_get_max_afflvl();
106 assert(aff_lvl <= MPIDR_MAX_AFFLVL && aff_lvl >= MPIDR_AFFLVL0);
107
108 return aff_lvl;
109}
110
111/*******************************************************************************
112 * Simple routine to set the id of an affinity instance at a given level in the
113 * mpidr.
114 ******************************************************************************/
115unsigned long mpidr_set_aff_inst(unsigned long mpidr,
116 unsigned char aff_inst,
117 int aff_lvl)
118{
119 unsigned long aff_shift;
120
121 assert(aff_lvl <= MPIDR_AFFLVL3);
122
123 /*
124 * Decide the number of bits to shift by depending upon
125 * the affinity level
126 */
127 aff_shift = get_afflvl_shift(aff_lvl);
128
129 /* Clear the existing affinity instance & set the new one*/
130 mpidr &= ~(MPIDR_AFFLVL_MASK << aff_shift);
131 mpidr |= aff_inst << aff_shift;
132
133 return mpidr;
134}
135
136/*******************************************************************************
Achin Gupta0959db52013-12-02 17:33:04 +0000137 * This function sanity checks a range of affinity levels.
138 ******************************************************************************/
139int psci_check_afflvl_range(int start_afflvl, int end_afflvl)
140{
141 /* Sanity check the parameters passed */
142 if (end_afflvl > MPIDR_MAX_AFFLVL)
143 return PSCI_E_INVALID_PARAMS;
144
145 if (start_afflvl < MPIDR_AFFLVL0)
146 return PSCI_E_INVALID_PARAMS;
147
148 if (end_afflvl < start_afflvl)
149 return PSCI_E_INVALID_PARAMS;
150
151 return PSCI_E_SUCCESS;
152}
153
154/*******************************************************************************
155 * This function is passed an array of pointers to affinity level nodes in the
156 * topology tree for an mpidr. It picks up locks for each affinity level bottom
157 * up in the range specified.
158 ******************************************************************************/
159void psci_acquire_afflvl_locks(unsigned long mpidr,
160 int start_afflvl,
161 int end_afflvl,
Dan Handleye2712bc2014-04-10 15:37:22 +0100162 mpidr_aff_map_nodes_t mpidr_nodes)
Achin Gupta0959db52013-12-02 17:33:04 +0000163{
164 int level;
165
166 for (level = start_afflvl; level <= end_afflvl; level++) {
167 if (mpidr_nodes[level] == NULL)
168 continue;
Andrew Thoelke958cc022014-06-09 12:54:15 +0100169 bakery_lock_get(&mpidr_nodes[level]->lock);
Achin Gupta0959db52013-12-02 17:33:04 +0000170 }
171}
172
173/*******************************************************************************
174 * This function is passed an array of pointers to affinity level nodes in the
175 * topology tree for an mpidr. It releases the lock for each affinity level top
176 * down in the range specified.
177 ******************************************************************************/
178void psci_release_afflvl_locks(unsigned long mpidr,
179 int start_afflvl,
180 int end_afflvl,
Dan Handleye2712bc2014-04-10 15:37:22 +0100181 mpidr_aff_map_nodes_t mpidr_nodes)
Achin Gupta0959db52013-12-02 17:33:04 +0000182{
183 int level;
184
185 for (level = end_afflvl; level >= start_afflvl; level--) {
186 if (mpidr_nodes[level] == NULL)
187 continue;
Andrew Thoelke958cc022014-06-09 12:54:15 +0100188 bakery_lock_release(&mpidr_nodes[level]->lock);
Achin Gupta0959db52013-12-02 17:33:04 +0000189 }
190}
191
192/*******************************************************************************
Achin Gupta4f6ad662013-10-25 09:08:21 +0100193 * Simple routine to determine whether an affinity instance at a given level
194 * in an mpidr exists or not.
195 ******************************************************************************/
196int psci_validate_mpidr(unsigned long mpidr, int level)
197{
Dan Handleye2712bc2014-04-10 15:37:22 +0100198 aff_map_node_t *node;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100199
200 node = psci_get_aff_map_node(mpidr, level);
201 if (node && (node->state & PSCI_AFF_PRESENT))
202 return PSCI_E_SUCCESS;
203 else
204 return PSCI_E_INVALID_PARAMS;
205}
206
207/*******************************************************************************
Andrew Thoelke4e126072014-06-04 21:10:52 +0100208 * This function determines the full entrypoint information for the requested
209 * PSCI entrypoint on power on/resume and saves this in the non-secure CPU
210 * cpu_context, ready for when the core boots.
Achin Gupta4f6ad662013-10-25 09:08:21 +0100211 ******************************************************************************/
Andrew Thoelke4e126072014-06-04 21:10:52 +0100212int psci_save_ns_entry(uint64_t mpidr,
213 uint64_t entrypoint, uint64_t context_id,
214 uint32_t ns_scr_el3, uint32_t ns_sctlr_el1)
Achin Gupta4f6ad662013-10-25 09:08:21 +0100215{
Andrew Thoelke4e126072014-06-04 21:10:52 +0100216 uint32_t ep_attr, mode, sctlr, daif, ee;
217 entry_point_info_t ep;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100218
Andrew Thoelke4e126072014-06-04 21:10:52 +0100219 sctlr = ns_scr_el3 & SCR_HCE_BIT ? read_sctlr_el2() : ns_sctlr_el1;
220 ee = 0;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100221
Andrew Thoelke4e126072014-06-04 21:10:52 +0100222 ep_attr = NON_SECURE | EP_ST_DISABLE;
223 if (sctlr & SCTLR_EE_BIT) {
224 ep_attr |= EP_EE_BIG;
225 ee = 1;
226 }
227 SET_PARAM_HEAD(&ep, PARAM_EP, VERSION_1, ep_attr);
Achin Gupta4f6ad662013-10-25 09:08:21 +0100228
Andrew Thoelke4e126072014-06-04 21:10:52 +0100229 ep.pc = entrypoint;
230 memset(&ep.args, 0, sizeof(ep.args));
231 ep.args.arg0 = context_id;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100232
233 /*
234 * Figure out whether the cpu enters the non-secure address space
235 * in aarch32 or aarch64
236 */
Andrew Thoelke4e126072014-06-04 21:10:52 +0100237 if (ns_scr_el3 & SCR_RW_BIT) {
Achin Gupta4f6ad662013-10-25 09:08:21 +0100238
239 /*
240 * Check whether a Thumb entry point has been provided for an
241 * aarch64 EL
242 */
243 if (entrypoint & 0x1)
244 return PSCI_E_INVALID_PARAMS;
245
Andrew Thoelke4e126072014-06-04 21:10:52 +0100246 mode = ns_scr_el3 & SCR_HCE_BIT ? MODE_EL2 : MODE_EL1;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100247
Andrew Thoelke4e126072014-06-04 21:10:52 +0100248 ep.spsr = SPSR_64(mode, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS);
Achin Gupta4f6ad662013-10-25 09:08:21 +0100249 } else {
250
Andrew Thoelke4e126072014-06-04 21:10:52 +0100251 mode = ns_scr_el3 & SCR_HCE_BIT ? MODE32_hyp : MODE32_svc;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100252
253 /*
254 * TODO: Choose async. exception bits if HYP mode is not
255 * implemented according to the values of SCR.{AW, FW} bits
256 */
Vikram Kanigiri9851e422014-05-13 14:42:08 +0100257 daif = DAIF_ABT_BIT | DAIF_IRQ_BIT | DAIF_FIQ_BIT;
258
Andrew Thoelke4e126072014-06-04 21:10:52 +0100259 ep.spsr = SPSR_MODE32(mode, entrypoint & 0x1, ee, daif);
Achin Gupta4f6ad662013-10-25 09:08:21 +0100260 }
261
Andrew Thoelke4e126072014-06-04 21:10:52 +0100262 /* initialise an entrypoint to set up the CPU context */
263 cm_init_context(mpidr, &ep);
Achin Gupta4f6ad662013-10-25 09:08:21 +0100264
Andrew Thoelke4e126072014-06-04 21:10:52 +0100265 return PSCI_E_SUCCESS;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100266}
267
268/*******************************************************************************
Achin Gupta75f73672013-12-05 16:33:10 +0000269 * This function takes a pointer to an affinity node in the topology tree and
270 * returns its state. State of a non-leaf node needs to be calculated.
271 ******************************************************************************/
Dan Handleye2712bc2014-04-10 15:37:22 +0100272unsigned short psci_get_state(aff_map_node_t *node)
Achin Gupta75f73672013-12-05 16:33:10 +0000273{
274 assert(node->level >= MPIDR_AFFLVL0 && node->level <= MPIDR_MAX_AFFLVL);
275
276 /* A cpu node just contains the state which can be directly returned */
277 if (node->level == MPIDR_AFFLVL0)
278 return (node->state >> PSCI_STATE_SHIFT) & PSCI_STATE_MASK;
279
280 /*
281 * For an affinity level higher than a cpu, the state has to be
282 * calculated. It depends upon the value of the reference count
283 * which is managed by each node at the next lower affinity level
284 * e.g. for a cluster, each cpu increments/decrements the reference
285 * count. If the reference count is 0 then the affinity level is
286 * OFF else ON.
287 */
288 if (node->ref_count)
289 return PSCI_STATE_ON;
290 else
291 return PSCI_STATE_OFF;
292}
293
294/*******************************************************************************
295 * This function takes a pointer to an affinity node in the topology tree and
296 * a target state. State of a non-leaf node needs to be converted to a reference
297 * count. State of a leaf node can be set directly.
298 ******************************************************************************/
Dan Handleye2712bc2014-04-10 15:37:22 +0100299void psci_set_state(aff_map_node_t *node, unsigned short state)
Achin Gupta75f73672013-12-05 16:33:10 +0000300{
301 assert(node->level >= MPIDR_AFFLVL0 && node->level <= MPIDR_MAX_AFFLVL);
302
303 /*
304 * For an affinity level higher than a cpu, the state is used
305 * to decide whether the reference count is incremented or
306 * decremented. Entry into the ON_PENDING state does not have
307 * effect.
308 */
309 if (node->level > MPIDR_AFFLVL0) {
310 switch (state) {
311 case PSCI_STATE_ON:
312 node->ref_count++;
313 break;
314 case PSCI_STATE_OFF:
315 case PSCI_STATE_SUSPEND:
316 node->ref_count--;
317 break;
318 case PSCI_STATE_ON_PENDING:
319 /*
320 * An affinity level higher than a cpu will not undergo
321 * a state change when it is about to be turned on
322 */
323 return;
324 default:
325 assert(0);
326 }
327 } else {
328 node->state &= ~(PSCI_STATE_MASK << PSCI_STATE_SHIFT);
329 node->state |= (state & PSCI_STATE_MASK) << PSCI_STATE_SHIFT;
330 }
331}
332
333/*******************************************************************************
Achin Gupta4f6ad662013-10-25 09:08:21 +0100334 * An affinity level could be on, on_pending, suspended or off. These are the
Achin Gupta3140a9e2013-12-02 16:23:12 +0000335 * logical states it can be in. Physically either it is off or on. When it is in
336 * the state on_pending then it is about to be turned on. It is not possible to
Achin Gupta4f6ad662013-10-25 09:08:21 +0100337 * tell whether that's actually happenned or not. So we err on the side of
338 * caution & treat the affinity level as being turned off.
339 ******************************************************************************/
Dan Handleye2712bc2014-04-10 15:37:22 +0100340unsigned short psci_get_phys_state(aff_map_node_t *node)
Achin Gupta4f6ad662013-10-25 09:08:21 +0100341{
Achin Gupta75f73672013-12-05 16:33:10 +0000342 unsigned int state;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100343
Achin Gupta75f73672013-12-05 16:33:10 +0000344 state = psci_get_state(node);
345 return get_phys_state(state);
Achin Gupta4f6ad662013-10-25 09:08:21 +0100346}
347
348/*******************************************************************************
Achin Gupta0959db52013-12-02 17:33:04 +0000349 * This function takes an array of pointers to affinity instance nodes in the
350 * topology tree and calls the physical power on handler for the corresponding
351 * affinity levels
352 ******************************************************************************/
Dan Handleye2712bc2014-04-10 15:37:22 +0100353static int psci_call_power_on_handlers(mpidr_aff_map_nodes_t mpidr_nodes,
Achin Gupta0959db52013-12-02 17:33:04 +0000354 int start_afflvl,
355 int end_afflvl,
Dan Handleye2712bc2014-04-10 15:37:22 +0100356 afflvl_power_on_finisher_t *pon_handlers,
Achin Gupta0959db52013-12-02 17:33:04 +0000357 unsigned long mpidr)
358{
359 int rc = PSCI_E_INVALID_PARAMS, level;
Dan Handleye2712bc2014-04-10 15:37:22 +0100360 aff_map_node_t *node;
Achin Gupta0959db52013-12-02 17:33:04 +0000361
362 for (level = end_afflvl; level >= start_afflvl; level--) {
363 node = mpidr_nodes[level];
364 if (node == NULL)
365 continue;
366
367 /*
368 * If we run into any trouble while powering up an
369 * affinity instance, then there is no recovery path
370 * so simply return an error and let the caller take
371 * care of the situation.
372 */
373 rc = pon_handlers[level](mpidr, node);
374 if (rc != PSCI_E_SUCCESS)
375 break;
376 }
377
378 return rc;
379}
380
381/*******************************************************************************
Achin Gupta4f6ad662013-10-25 09:08:21 +0100382 * Generic handler which is called when a cpu is physically powered on. It
Achin Gupta0959db52013-12-02 17:33:04 +0000383 * traverses through all the affinity levels performing generic, architectural,
Achin Gupta4f6ad662013-10-25 09:08:21 +0100384 * platform setup and state management e.g. for a cluster that's been powered
385 * on, it will call the platform specific code which will enable coherency at
386 * the interconnect level. For a cpu it could mean turning on the MMU etc.
387 *
Achin Gupta0959db52013-12-02 17:33:04 +0000388 * The state of all the relevant affinity levels is changed after calling the
389 * affinity level specific handlers as their actions would depend upon the state
390 * the affinity level is exiting from.
391 *
392 * The affinity level specific handlers are called in descending order i.e. from
393 * the highest to the lowest affinity level implemented by the platform because
394 * to turn on affinity level X it is neccesary to turn on affinity level X + 1
395 * first.
Achin Gupta4f6ad662013-10-25 09:08:21 +0100396 *
397 * CAUTION: This function is called with coherent stacks so that coherency and
398 * the mmu can be turned on safely.
399 ******************************************************************************/
Achin Gupta0959db52013-12-02 17:33:04 +0000400void psci_afflvl_power_on_finish(unsigned long mpidr,
401 int start_afflvl,
402 int end_afflvl,
Dan Handleye2712bc2014-04-10 15:37:22 +0100403 afflvl_power_on_finisher_t *pon_handlers)
Achin Gupta4f6ad662013-10-25 09:08:21 +0100404{
Dan Handleye2712bc2014-04-10 15:37:22 +0100405 mpidr_aff_map_nodes_t mpidr_nodes;
Achin Gupta0959db52013-12-02 17:33:04 +0000406 int rc;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100407
Jeenu Viswambharancaa84932014-02-06 10:36:15 +0000408 mpidr &= MPIDR_AFFINITY_MASK;
Achin Gupta4f6ad662013-10-25 09:08:21 +0100409
410 /*
Achin Gupta0959db52013-12-02 17:33:04 +0000411 * Collect the pointers to the nodes in the topology tree for
412 * each affinity instance in the mpidr. If this function does
413 * not return successfully then either the mpidr or the affinity
414 * levels are incorrect. Either case is an irrecoverable error.
Achin Gupta4f6ad662013-10-25 09:08:21 +0100415 */
Achin Gupta0959db52013-12-02 17:33:04 +0000416 rc = psci_get_aff_map_nodes(mpidr,
417 start_afflvl,
418 end_afflvl,
419 mpidr_nodes);
James Morrissey40a6f642014-02-10 14:24:36 +0000420 if (rc != PSCI_E_SUCCESS)
421 panic();
Achin Gupta4f6ad662013-10-25 09:08:21 +0100422
423 /*
Achin Gupta0959db52013-12-02 17:33:04 +0000424 * This function acquires the lock corresponding to each affinity
425 * level so that by the time all locks are taken, the system topology
426 * is snapshot and state management can be done safely.
Achin Gupta4f6ad662013-10-25 09:08:21 +0100427 */
Achin Gupta0959db52013-12-02 17:33:04 +0000428 psci_acquire_afflvl_locks(mpidr,
429 start_afflvl,
430 end_afflvl,
431 mpidr_nodes);
Achin Gupta4f6ad662013-10-25 09:08:21 +0100432
433 /* Perform generic, architecture and platform specific handling */
Achin Gupta0959db52013-12-02 17:33:04 +0000434 rc = psci_call_power_on_handlers(mpidr_nodes,
435 start_afflvl,
436 end_afflvl,
437 pon_handlers,
438 mpidr);
James Morrissey40a6f642014-02-10 14:24:36 +0000439 if (rc != PSCI_E_SUCCESS)
440 panic();
Achin Gupta4f6ad662013-10-25 09:08:21 +0100441
442 /*
Achin Gupta0959db52013-12-02 17:33:04 +0000443 * This loop releases the lock corresponding to each affinity level
444 * in the reverse order to which they were acquired.
445 */
446 psci_release_afflvl_locks(mpidr,
447 start_afflvl,
448 end_afflvl,
449 mpidr_nodes);
Achin Gupta4f6ad662013-10-25 09:08:21 +0100450}
Jeenu Viswambharan7f366602014-02-20 17:11:00 +0000451
452/*******************************************************************************
453 * This function initializes the set of hooks that PSCI invokes as part of power
454 * management operation. The power management hooks are expected to be provided
455 * by the SPD, after it finishes all its initialization
456 ******************************************************************************/
Dan Handleye2712bc2014-04-10 15:37:22 +0100457void psci_register_spd_pm_hook(const spd_pm_ops_t *pm)
Jeenu Viswambharan7f366602014-02-20 17:11:00 +0000458{
459 psci_spd_pm = pm;
460}