Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 1 | /* |
Rohit Mathew | b5154bc | 2024-02-15 11:32:56 +0000 | [diff] [blame] | 2 | * Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved. |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <platform.h> |
| 8 | #include <psci.h> |
| 9 | |
Rohit Mathew | b5154bc | 2024-02-15 11:32:56 +0000 | [diff] [blame] | 10 | /* State IDs for local power states on TC platform. */ |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 11 | #define TC_PS_RUN_STATE_ID 0 /* Valid for CPUs and Clusters */ |
| 12 | #define TC_PS_RETENTION_STATE_ID 1 /* Valid for only CPUs */ |
| 13 | #define TC_PS_OFF_STATE_ID 2 /* Valid for CPUs and Clusters */ |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 14 | |
| 15 | /* Suspend depth definitions for each power state */ |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 16 | #define TC_PS_RUN_DEPTH 0 |
| 17 | #define TC_PS_RETENTION_DEPTH 1 |
| 18 | #define TC_PS_OFF_DEPTH 2 |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 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[] = { |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 22 | {TC_PS_RETENTION_DEPTH, TC_PS_RETENTION_STATE_ID, |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 23 | PSTATE_TYPE_STANDBY}, |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 24 | {TC_PS_OFF_DEPTH, TC_PS_OFF_STATE_ID, PSTATE_TYPE_POWERDOWN}, |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 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[] = { |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 30 | {TC_PS_OFF_DEPTH, TC_PS_OFF_STATE_ID, PSTATE_TYPE_POWERDOWN}, |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 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 | } |