aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-18 10:29:51 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-18 10:29:51 -0500
commit2203d6ed448ff3b777ee6bb614a53e686b483e5b (patch)
treeb7f540f808bde4febc304ad60b9af277ab0e7170 /drivers/acpi
parent2656c076e31a3ce3ab2a987a578e7122dc2af51d (diff)
Fix ACPI processor power block initialization
Properly clear the memory, and set "pr->flags.power" only if a C2 or deeper state is valid (to make the code match both the comment and previous behaviour). This fixes a boot-time lockup reported by Maneesh Soni when using "maxcpus=1". Acked-by: Maneesh Soni <maneesh@in.ibm.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/processor_idle.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 573b6a97bb1f..70d8a6ec0920 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -514,8 +514,6 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr)
514 514
515static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) 515static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
516{ 516{
517 int i;
518
519 ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_fadt"); 517 ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_fadt");
520 518
521 if (!pr) 519 if (!pr)
@@ -524,8 +522,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
524 if (!pr->pblk) 522 if (!pr->pblk)
525 return_VALUE(-ENODEV); 523 return_VALUE(-ENODEV);
526 524
527 for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) 525 memset(pr->power.states, 0, sizeof(pr->power.states));
528 memset(pr->power.states, 0, sizeof(struct acpi_processor_cx));
529 526
530 /* if info is obtained from pblk/fadt, type equals state */ 527 /* if info is obtained from pblk/fadt, type equals state */
531 pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; 528 pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;
@@ -555,13 +552,9 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
555 552
556static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) 553static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr)
557{ 554{
558 int i;
559
560 ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); 555 ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1");
561 556
562 for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) 557 memset(pr->power.states, 0, sizeof(pr->power.states));
563 memset(&(pr->power.states[i]), 0,
564 sizeof(struct acpi_processor_cx));
565 558
566 /* if info is obtained from pblk/fadt, type equals state */ 559 /* if info is obtained from pblk/fadt, type equals state */
567 pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; 560 pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;
@@ -873,7 +866,8 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
873 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { 866 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
874 if (pr->power.states[i].valid) { 867 if (pr->power.states[i].valid) {
875 pr->power.count = i; 868 pr->power.count = i;
876 pr->flags.power = 1; 869 if (pr->power.states[i].type >= ACPI_STATE_C2)
870 pr->flags.power = 1;
877 } 871 }
878 } 872 }
879 873