From 170fb93dec97568eec426148019b1670c0b17e7d Mon Sep 17 00:00:00 2001 From: Yatharth Kochar Date: Mon, 9 May 2016 18:26:35 +0100 Subject: Add optional PSCI STAT residency & count functions This patch adds following optional PSCI STAT functions: - PSCI_STAT_RESIDENCY: This call returns the amount of time spent in power_state in microseconds, by the node represented by the `target_cpu` and the highest level of `power_state`. - PSCI_STAT_COUNT: This call returns the number of times a `power_state` has been used by the node represented by the `target_cpu` and the highest power level of `power_state`. These APIs provides residency statistics for power states that has been used by the platform. They are implemented according to v1.0 of the PSCI specification. By default this optional feature is disabled in the PSCI implementation. To enable it, set the boolean flag `ENABLE_PSCI_STAT` to 1. This also sets `ENABLE_PMF` to 1. Change-Id: Ie62e9d37d6d416ccb1813acd7f616d1ddd3e8aff --- include/bl31/services/psci.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/bl31') diff --git a/include/bl31/services/psci.h b/include/bl31/services/psci.h index 95e77809..20aa52e9 100644 --- a/include/bl31/services/psci.h +++ b/include/bl31/services/psci.h @@ -80,6 +80,10 @@ #define PSCI_FEATURES 0x8400000A #define PSCI_SYSTEM_SUSPEND_AARCH32 0x8400000E #define PSCI_SYSTEM_SUSPEND_AARCH64 0xc400000E +#define PSCI_STAT_RESIDENCY_AARCH32 0x84000010 +#define PSCI_STAT_RESIDENCY_AARCH64 0xc4000010 +#define PSCI_STAT_COUNT_AARCH32 0x84000011 +#define PSCI_STAT_COUNT_AARCH64 0xc4000011 /* Macro to help build the psci capabilities bitfield */ #define define_psci_cap(x) (1 << (x & 0x1f)) @@ -87,7 +91,11 @@ /* * Number of PSCI calls (above) implemented */ +#if ENABLE_PSCI_STAT +#define PSCI_NUM_CALLS 22 +#else #define PSCI_NUM_CALLS 18 +#endif /******************************************************************************* * PSCI Migrate and friends @@ -274,6 +282,11 @@ typedef struct plat_psci_ops { int (*validate_ns_entrypoint)(uintptr_t ns_entrypoint); void (*get_sys_suspend_power_state)( psci_power_state_t *req_state); + int (*get_pwr_lvl_state_idx)(plat_local_state_t pwr_domain_state, + int pwrlvl); + int (*translate_power_state_by_mpidr)(u_register_t mpidr, + unsigned int power_state, + psci_power_state_t *output_state); } plat_psci_ops_t; /******************************************************************************* -- cgit v1.2.3