Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 1 | /* |
Chandni Cherukuri | 346a7cc | 2019-02-27 13:59:11 +0530 | [diff] [blame] | 2 | * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Antonio Nino Diaz | bd7b740 | 2019-01-25 14:30:04 +0000 | [diff] [blame] | 7 | #include <plat/arm/common/plat_arm.h> |
Ambroise Vincent | b237bca | 2019-02-13 15:58:00 +0000 | [diff] [blame] | 8 | #include <plat/common/platform.h> |
Antonio Nino Diaz | bd7b740 | 2019-01-25 14:30:04 +0000 | [diff] [blame] | 9 | |
Chandni Cherukuri | 0612a88 | 2018-10-16 14:15:31 +0530 | [diff] [blame] | 10 | #include <sgi_variant.h> |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 11 | |
| 12 | /* Topology */ |
| 13 | /* |
| 14 | * The power domain tree descriptor. The cluster power domains are |
| 15 | * arranged so that when the PSCI generic code creates the power domain tree, |
| 16 | * the indices of the CPU power domain nodes it allocates match the linear |
| 17 | * indices returned by plat_core_pos_by_mpidr(). |
| 18 | */ |
| 19 | const unsigned char sgi_pd_tree_desc[] = { |
| 20 | PLAT_ARM_CLUSTER_COUNT, |
Vishwanatha HG | 64f0b6f | 2018-05-08 17:15:37 +0530 | [diff] [blame] | 21 | CSS_SGI_MAX_CPUS_PER_CLUSTER, |
| 22 | CSS_SGI_MAX_CPUS_PER_CLUSTER |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 23 | }; |
| 24 | |
Chandni Cherukuri | 346a7cc | 2019-02-27 13:59:11 +0530 | [diff] [blame] | 25 | /* RD-E1-Edge platform consists of 16 physical CPUS and 32 threads */ |
| 26 | const unsigned char rd_e1_edge_pd_tree_desc[] = { |
Chandni Cherukuri | 0612a88 | 2018-10-16 14:15:31 +0530 | [diff] [blame] | 27 | PLAT_ARM_CLUSTER_COUNT, |
| 28 | CSS_SGI_MAX_CPUS_PER_CLUSTER, |
| 29 | CSS_SGI_MAX_CPUS_PER_CLUSTER, |
| 30 | CSS_SGI_MAX_PE_PER_CPU, |
| 31 | CSS_SGI_MAX_PE_PER_CPU, |
| 32 | CSS_SGI_MAX_PE_PER_CPU, |
| 33 | CSS_SGI_MAX_PE_PER_CPU, |
| 34 | CSS_SGI_MAX_PE_PER_CPU, |
| 35 | CSS_SGI_MAX_PE_PER_CPU, |
| 36 | CSS_SGI_MAX_PE_PER_CPU, |
| 37 | CSS_SGI_MAX_PE_PER_CPU, |
| 38 | CSS_SGI_MAX_PE_PER_CPU, |
| 39 | CSS_SGI_MAX_PE_PER_CPU, |
| 40 | CSS_SGI_MAX_PE_PER_CPU, |
| 41 | CSS_SGI_MAX_PE_PER_CPU, |
| 42 | CSS_SGI_MAX_PE_PER_CPU, |
| 43 | CSS_SGI_MAX_PE_PER_CPU, |
| 44 | CSS_SGI_MAX_PE_PER_CPU, |
| 45 | CSS_SGI_MAX_PE_PER_CPU |
| 46 | }; |
| 47 | |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 48 | /******************************************************************************* |
| 49 | * This function returns the topology tree information. |
| 50 | ******************************************************************************/ |
| 51 | const unsigned char *plat_get_power_domain_tree_desc(void) |
| 52 | { |
Chandni Cherukuri | 346a7cc | 2019-02-27 13:59:11 +0530 | [diff] [blame] | 53 | if (sgi_plat_info.platform_id == RD_N1E1_EDGE_SID_VER_PART_NUM && |
| 54 | sgi_plat_info.config_id == RD_E1_EDGE_CONFIG_ID) |
| 55 | return rd_e1_edge_pd_tree_desc; |
Chandni Cherukuri | 0612a88 | 2018-10-16 14:15:31 +0530 | [diff] [blame] | 56 | else |
| 57 | return sgi_pd_tree_desc; |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | /******************************************************************************* |
| 61 | * This function returns the core count within the cluster corresponding to |
| 62 | * `mpidr`. |
| 63 | ******************************************************************************/ |
| 64 | unsigned int plat_arm_get_cluster_core_count(u_register_t mpidr) |
| 65 | { |
Chandni Cherukuri | a5d44ec | 2018-08-14 15:25:34 +0530 | [diff] [blame] | 66 | return CSS_SGI_MAX_CPUS_PER_CLUSTER; |
Nariman Poushin | 0ece80f | 2018-02-26 06:52:04 +0000 | [diff] [blame] | 67 | } |
Chandni Cherukuri | d61a705 | 2018-08-01 15:58:48 +0530 | [diff] [blame] | 68 | |
| 69 | /******************************************************************************* |
| 70 | * The array mapping platform core position (implemented by plat_my_core_pos()) |
| 71 | * to the SCMI power domain ID implemented by SCP. |
| 72 | ******************************************************************************/ |
| 73 | const uint32_t plat_css_core_pos_to_scmi_dmn_id_map[32] = { |
| 74 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \ |
| 75 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 |
| 76 | }; |
Chandni Cherukuri | 449db45 | 2018-08-16 13:45:17 +0530 | [diff] [blame] | 77 | |
| 78 | /****************************************************************************** |
| 79 | * Return the number of PE's supported by the CPU. |
| 80 | *****************************************************************************/ |
| 81 | unsigned int plat_arm_get_cpu_pe_count(u_register_t mpidr) |
| 82 | { |
| 83 | return CSS_SGI_MAX_PE_PER_CPU; |
| 84 | } |