提交 cf824788 编写于 作者: J Janosch Machowinski 提交者: Len Brown

[ACPI] handle BIOS with implicit C1 in _CST

The ASUS M6Ne specifies C2, implying C1
but not explicitly specifying it.

http://bugzilla.kernel.org/show_bug.cgi?id=4485Signed-off-by: NJanosch Machowinski <jmachowinski@gmx.de>
Signed-off-by: NVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 4c033552
...@@ -532,18 +532,10 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) ...@@ -532,18 +532,10 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
if (!pr->pblk) if (!pr->pblk)
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
memset(pr->power.states, 0, sizeof(pr->power.states));
/* if info is obtained from pblk/fadt, type equals state */ /* if info is obtained from pblk/fadt, type equals state */
pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;
pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2;
pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3; pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3;
/* the C0 state only exists as a filler in our array,
* and all processors need to support C1 */
pr->power.states[ACPI_STATE_C0].valid = 1;
pr->power.states[ACPI_STATE_C1].valid = 1;
#ifndef CONFIG_HOTPLUG_CPU #ifndef CONFIG_HOTPLUG_CPU
/* /*
* Check for P_LVL2_UP flag before entering C2 and above on * Check for P_LVL2_UP flag before entering C2 and above on
...@@ -573,12 +565,11 @@ static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) ...@@ -573,12 +565,11 @@ static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr)
{ {
ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1");
/* Zero initialize all the C-states info. */
memset(pr->power.states, 0, sizeof(pr->power.states)); memset(pr->power.states, 0, sizeof(pr->power.states));
/* if info is obtained from pblk/fadt, type equals state */ /* set the first C-State to C1 */
pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;
pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2;
pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3;
/* the C0 state only exists as a filler in our array, /* the C0 state only exists as a filler in our array,
* and all processors need to support C1 */ * and all processors need to support C1 */
...@@ -592,6 +583,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) ...@@ -592,6 +583,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
{ {
acpi_status status = 0; acpi_status status = 0;
acpi_integer count; acpi_integer count;
int current_count;
int i; int i;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *cst; union acpi_object *cst;
...@@ -601,10 +593,12 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) ...@@ -601,10 +593,12 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
if (nocst) if (nocst)
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
pr->power.count = 0; current_count = 1;
for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++)
memset(&(pr->power.states[i]), 0, /* Zero initialize C2 onwards and prepare for fresh CST lookup */
sizeof(struct acpi_processor_cx)); for (i = 2; i < ACPI_PROCESSOR_MAX_POWER; i++)
memset(&(pr->power.states[i]), 0,
sizeof(struct acpi_processor_cx));
status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
...@@ -632,16 +626,6 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) ...@@ -632,16 +626,6 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
goto end; goto end;
} }
/* We support up to ACPI_PROCESSOR_MAX_POWER. */
if (count > ACPI_PROCESSOR_MAX_POWER) {
printk(KERN_WARNING
"Limiting number of power states to max (%d)\n",
ACPI_PROCESSOR_MAX_POWER);
printk(KERN_WARNING
"Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n");
count = ACPI_PROCESSOR_MAX_POWER;
}
/* Tell driver that at least _CST is supported. */ /* Tell driver that at least _CST is supported. */
pr->flags.has_cst = 1; pr->flags.has_cst = 1;
...@@ -685,7 +669,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) ...@@ -685,7 +669,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
(reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO))
continue; continue;
if ((cx.type < ACPI_STATE_C1) || (cx.type > ACPI_STATE_C3)) if ((cx.type < ACPI_STATE_C2) || (cx.type > ACPI_STATE_C3))
continue; continue;
obj = (union acpi_object *)&(element->package.elements[2]); obj = (union acpi_object *)&(element->package.elements[2]);
...@@ -700,15 +684,28 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) ...@@ -700,15 +684,28 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
cx.power = obj->integer.value; cx.power = obj->integer.value;
(pr->power.count)++; current_count++;
memcpy(&(pr->power.states[pr->power.count]), &cx, sizeof(cx)); memcpy(&(pr->power.states[current_count]), &cx, sizeof(cx));
/*
* We support total ACPI_PROCESSOR_MAX_POWER - 1
* (From 1 through ACPI_PROCESSOR_MAX_POWER - 1)
*/
if (current_count >= (ACPI_PROCESSOR_MAX_POWER - 1)) {
printk(KERN_WARNING
"Limiting number of power states to max (%d)\n",
ACPI_PROCESSOR_MAX_POWER);
printk(KERN_WARNING
"Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n");
break;
}
} }
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n",
pr->power.count)); current_count));
/* Validate number of power states discovered */ /* Validate number of power states discovered */
if (pr->power.count < 2) if (current_count < 2)
status = -EFAULT; status = -EFAULT;
end: end:
...@@ -859,12 +856,13 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) ...@@ -859,12 +856,13 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
/* NOTE: the idle thread may not be running while calling /* NOTE: the idle thread may not be running while calling
* this function */ * this function */
/* Adding C1 state */
acpi_processor_get_power_info_default_c1(pr);
result = acpi_processor_get_power_info_cst(pr); result = acpi_processor_get_power_info_cst(pr);
if (result == -ENODEV) if (result == -ENODEV)
result = acpi_processor_get_power_info_fadt(pr); acpi_processor_get_power_info_fadt(pr);
if ((result) || (acpi_processor_power_verify(pr) < 2)) pr->power.count = acpi_processor_power_verify(pr);
result = acpi_processor_get_power_info_default_c1(pr);
/* /*
* Set Default Policy * Set Default Policy
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册