Commit 24bfa950 authored by Len Brown's avatar Len Brown

intel_idle: allow sparse sub-state numbering, for Bay Trail

Like acpi_idle, intel_idle compared sub-state numbers
to the number of supported sub-states -- discarding
sub-states numbers that were numbered >= the number of states.

But some Bay Trail SOCs use sparse sub-state numbers,
so we can't make such a comparison if we are going
to access those states.

So now we simply check that _some_ sub-states are
supported for the given state, and assume that the
sub-state number in our driver is valid.

In practice, the driver is correct, and even if it were not,
the hardware clips invalid sub-state requests to valid ones.

No entries in the driver require this change,
but Bay Trail will need it.
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 2194324d
...@@ -584,7 +584,7 @@ static int __init intel_idle_cpuidle_driver_init(void) ...@@ -584,7 +584,7 @@ static int __init intel_idle_cpuidle_driver_init(void)
drv->state_count = 1; drv->state_count = 1;
for (cstate = 0; cstate < CPUIDLE_STATE_MAX; ++cstate) { for (cstate = 0; cstate < CPUIDLE_STATE_MAX; ++cstate) {
int num_substates, mwait_hint, mwait_cstate, mwait_substate; int num_substates, mwait_hint, mwait_cstate;
if (cpuidle_state_table[cstate].enter == NULL) if (cpuidle_state_table[cstate].enter == NULL)
break; break;
...@@ -597,14 +597,13 @@ static int __init intel_idle_cpuidle_driver_init(void) ...@@ -597,14 +597,13 @@ static int __init intel_idle_cpuidle_driver_init(void)
mwait_hint = flg2MWAIT(cpuidle_state_table[cstate].flags); mwait_hint = flg2MWAIT(cpuidle_state_table[cstate].flags);
mwait_cstate = MWAIT_HINT2CSTATE(mwait_hint); mwait_cstate = MWAIT_HINT2CSTATE(mwait_hint);
mwait_substate = MWAIT_HINT2SUBSTATE(mwait_hint);
/* does the state exist in CPUID.MWAIT? */ /* number of sub-states for this state in CPUID.MWAIT */
num_substates = (mwait_substates >> ((mwait_cstate + 1) * 4)) num_substates = (mwait_substates >> ((mwait_cstate + 1) * 4))
& MWAIT_SUBSTATE_MASK; & MWAIT_SUBSTATE_MASK;
/* if sub-state in table is not enumerated by CPUID */ /* if NO sub-states for this state in CPUID, skip it */
if ((mwait_substate + 1) > num_substates) if (num_substates == 0)
continue; continue;
if (((mwait_cstate + 1) > 2) && if (((mwait_cstate + 1) > 2) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment