1 /* 2 * Arm SCP/MCP Software 3 * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 #ifndef PERF_CONTROLLER_H_ 8 #define PERF_CONTROLLER_H_ 9 10 #include <mod_perf_controller.h> 11 12 #include <fwk_id.h> 13 14 /*! 15 * \brief Performance controller core context. 16 * 17 * \details The performance controller core context is responsible for storing 18 * the power limit for a corresponding core. 19 */ 20 struct mod_perf_controller_core_ctx { 21 uint32_t power_limit; 22 }; 23 24 /*! 25 * \brief Performance controller cluster context. 26 * 27 * \details The performance controller cluster is responsible for storing the 28 * aggregate information about the cores. 29 */ 30 struct mod_perf_controller_cluster_ctx { 31 /*! Power model that converts from a power quantity to performance level. */ 32 const struct mod_perf_controller_power_model_api *power_model_api; 33 34 /*! Performance driver API. */ 35 const struct mod_perf_controller_drv_api *perf_driver_api; 36 37 /*! Performance limit for the cluster. */ 38 uint32_t performance_limit; 39 40 /*! Requested performance details for the cluster. */ 41 struct { 42 /*! Requested performance level. */ 43 uint32_t level; 44 /*! Cookie assosiated with the request. */ 45 uintptr_t cookie; 46 } performance_request_details; 47 48 /*! Cluster configuration. */ 49 const struct mod_perf_controller_cluster_config *config; 50 51 /*! Context table of cores. */ 52 struct mod_perf_controller_core_ctx *core_ctx_table; 53 54 /*! Number of cores in the cluster. */ 55 unsigned int core_count; 56 }; 57 58 /*! 59 * \brief Performance controller module list of internal functions pointers. 60 * 61 * \details Internal functions are used via a function pointer call to make the 62 * unit testing of each function easier. 63 */ 64 struct mod_perf_controller_internal_api { 65 /*! Memeber function to return minimum power limit. */ 66 uint32_t (*get_cores_min_power_limit)( 67 struct mod_perf_controller_cluster_ctx *); 68 69 /*! Memeber function to apply performance granted to the cluster. */ 70 int (*cluster_apply_performance_granted)( 71 struct mod_perf_controller_cluster_ctx *cluster_ctx); 72 }; 73 74 /*! 75 * \brief Module context 76 */ 77 struct mod_perf_controller_ctx { 78 /*! Context table of clusters. */ 79 struct mod_perf_controller_cluster_ctx *cluster_ctx_table; 80 81 /*! Number of clusters in the module. */ 82 unsigned int cluster_count; 83 }; 84 85 #endif /* PERF_CONTROLLER_H_ */ 86