aboutsummaryrefslogtreecommitdiff
path: root/hw/slw.c
diff options
context:
space:
mode:
authorAkshay Adiga <akshay.adiga@linux.vnet.ibm.com>2018-01-04 16:58:03 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2018-01-14 21:05:51 -0600
commita523298bc1e34466bfc4477e4d9aa4352703298a (patch)
tree35f813d5ebb4f099f99e62959c5edc1ea78b943d /hw/slw.c
parent35c66b8ce5a27ad3312806e8bde9148a5e5b5df8 (diff)
downloadskiboot-a523298bc1e34466bfc4477e4d9aa4352703298a.zip
skiboot-a523298bc1e34466bfc4477e4d9aa4352703298a.tar.gz
skiboot-a523298bc1e34466bfc4477e4d9aa4352703298a.tar.bz2
SLW: Detect if deep states are enabled
Patch adds a global variable which indicates if the deep states are enabled through stop-enabled-bits. Only applies to POWER9. Signed-off-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/slw.c')
-rw-r--r--hw/slw.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/hw/slw.c b/hw/slw.c
index 8dd7b93..fba452e 100644
--- a/hw/slw.c
+++ b/hw/slw.c
@@ -41,6 +41,7 @@ static uint32_t slw_saved_reset[MAX_RESET_PATCH_SIZE];
static bool slw_current_le = false;
enum wakeup_engine_states wakeup_engine_state = WAKEUP_ENGINE_NOT_PRESENT;
+bool has_deep_states = false;
/* SLW timer related stuff */
static bool slw_has_timer;
@@ -908,8 +909,21 @@ void add_cpu_idle_state_properties(void)
has_stop_inst = true;
stop_levels = dt_prop_get_u32_def(power_mgt,
"ibm,enabled-stop-levels", 0);
- if (!stop_levels)
+ if (!stop_levels) {
prerror("SLW: No stop levels available. Power saving is disabled!\n");
+ has_deep_states = false;
+ } else {
+ /* Iterate to see if we have deep states enabled */
+ for (i = 0; i < nr_states; i++) {
+ u32 level = 31 - (states[i].pm_ctrl_reg_val &
+ OPAL_PM_PSSCR_RL_MASK);
+
+ if ((stop_levels & (1ul << level)) &&
+ (states[i].flags & OPAL_PM_STOP_INST_DEEP))
+ has_deep_states = true;
+ }
+ }
+
} else if (chip->type == PROC_CHIP_P8_MURANO ||
chip->type == PROC_CHIP_P8_VENICE ||
chip->type == PROC_CHIP_P8_NAPLES) {