diff options
author | Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> | 2016-04-15 22:42:10 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-06-27 17:28:28 +1000 |
commit | ced5d0f6218b4d88a5a49966ed3c6d84ef47d3ea (patch) | |
tree | f9cb1eda72215b761cce61d9a3b41ecf63a7fa99 | |
parent | d4a965643ee8b8829bce401049c9f7ca92ba85e1 (diff) | |
download | skiboot-ced5d0f6218b4d88a5a49966ed3c6d84ef47d3ea.zip skiboot-ced5d0f6218b4d88a5a49966ed3c6d84ef47d3ea.tar.gz skiboot-ced5d0f6218b4d88a5a49966ed3c6d84ef47d3ea.tar.bz2 |
occ: Filter out entries from Pmin to Pmax in pstate table
Parse the entire pstate table provided by OCC and filter out the
entries that are outside the Pmax and Pmin limits. This can
occur when turbo mode is disabled and OCC limits the Pmax to
nominal pstate, but includes turbo pstates in the pstate table.
We end up with wrong pstates in such cases if we do not parse
the pstate table to filter out the correct range.
Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
Acked-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
(cherry picked from commit eca02ee2e62cee115d921a01cea061782ce47cc7)
-rw-r--r-- | hw/occ.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -155,7 +155,7 @@ static bool add_cpu_pstate_properties(s8 *pstate_nom) u8 *dt_vdd, *dt_vcs; s8 *dt_core_max = NULL; bool rc, ultra_turbo_en; - int i; + int i, j; prlog(PR_DEBUG, "OCC: CPU pstate state device tree init\n"); @@ -243,11 +243,15 @@ static bool add_cpu_pstate_properties(s8 *pstate_nom) dt_core_max[i] = occ_data->core_max[i]; } - for( i=0; i < nr_pstates; i++) { - dt_id[i] = occ_data->pstates[i].id; - dt_freq[i] = occ_data->pstates[i].freq_khz/1000; - dt_vdd[i] = occ_data->pstates[i].vdd; - dt_vcs[i] = occ_data->pstates[i].vcs; + for (i = 0, j = 0; i < MAX_PSTATES && j < nr_pstates; i++) { + if (occ_data->pstates[i].id > pmax || + occ_data->pstates[i].id < occ_data->pstate_min) + continue; + dt_id[j] = occ_data->pstates[i].id; + dt_freq[j] = occ_data->pstates[i].freq_khz / 1000; + dt_vdd[j] = occ_data->pstates[i].vdd; + dt_vcs[j] = occ_data->pstates[i].vcs; + j++; } /* Add the device-tree entries */ |