Chandni Cherukuri | 8624474 | 2018-11-13 16:16:54 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <platform.h> |
| 8 | #include <psci.h> |
| 9 | |
| 10 | /* State IDs for local power states on SGI platforms. */ |
| 11 | #define SGI_PS_RUN_STATE_ID 0 /* Valid for CPUs and Clusters */ |
| 12 | #define SGI_PS_RETENTION_STATE_ID 1 /* Valid for only CPUs */ |
| 13 | #define SGI_PS_OFF_STATE_ID 2 /* Valid for CPUs and Clusters */ |
| 14 | |
| 15 | /* Suspend depth definitions for each power state */ |
| 16 | #define SGI_PS_RUN_DEPTH 0 |
| 17 | #define SGI_PS_RETENTION_DEPTH 1 |
| 18 | #define SGI_PS_OFF_DEPTH 2 |
| 19 | |
| 20 | /* The state property array with details of idle state possible for the core */ |
| 21 | static const plat_state_prop_t core_state_prop[] = { |
| 22 | {SGI_PS_RETENTION_DEPTH, SGI_PS_RETENTION_STATE_ID, |
| 23 | PSTATE_TYPE_STANDBY}, |
| 24 | {SGI_PS_OFF_DEPTH, SGI_PS_OFF_STATE_ID, PSTATE_TYPE_POWERDOWN}, |
| 25 | {0}, |
| 26 | }; |
| 27 | |
| 28 | /* The state property array with details of idle state possible for the cluster */ |
| 29 | static const plat_state_prop_t cluster_state_prop[] = { |
| 30 | {SGI_PS_OFF_DEPTH, SGI_PS_OFF_STATE_ID, PSTATE_TYPE_POWERDOWN}, |
| 31 | {0}, |
| 32 | }; |
| 33 | |
| 34 | const plat_state_prop_t *plat_get_state_prop(unsigned int level) |
| 35 | { |
| 36 | switch (level) { |
| 37 | case MPIDR_AFFLVL0: |
| 38 | return core_state_prop; |
| 39 | case MPIDR_AFFLVL1: |
| 40 | return cluster_state_prop; |
| 41 | default: |
| 42 | return NULL; |
| 43 | } |
| 44 | } |