Skip to content

Commit 653f68b

Browse files
yu-chen-surfrafaeljw
authored andcommitted
ACPI: processor: Print more information when acpi_processor_evaluate_cst() fails
Some platforms have bogus _CST which might cause unexpectd behavior in the CPU idle driver. Some bogus _CST might be unable to be disassembled by acpica-tools due to broken format. Print extra log if the _CST extraction/verification failes. This can be used to help narrow down why the CPU idle driver fails to behave as expected. Suggested-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Chen Yu <yu.c.chen@intel.com> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 1170433 commit 653f68b

1 file changed

Lines changed: 28 additions & 6 deletions

File tree

drivers/acpi/acpi_processor.c

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -798,22 +798,34 @@ int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu,
798798
memset(&cx, 0, sizeof(cx));
799799

800800
element = &cst->package.elements[i];
801-
if (element->type != ACPI_TYPE_PACKAGE)
801+
if (element->type != ACPI_TYPE_PACKAGE) {
802+
acpi_handle_info(handle, "_CST C%d type(%x) is not package, skip...\n",
803+
i, element->type);
802804
continue;
805+
}
803806

804-
if (element->package.count != 4)
807+
if (element->package.count != 4) {
808+
acpi_handle_info(handle, "_CST C%d package count(%d) is not 4, skip...\n",
809+
i, element->package.count);
805810
continue;
811+
}
806812

807813
obj = &element->package.elements[0];
808814

809-
if (obj->type != ACPI_TYPE_BUFFER)
815+
if (obj->type != ACPI_TYPE_BUFFER) {
816+
acpi_handle_info(handle, "_CST C%d package element[0] type(%x) is not buffer, skip...\n",
817+
i, obj->type);
810818
continue;
819+
}
811820

812821
reg = (struct acpi_power_register *)obj->buffer.pointer;
813822

814823
obj = &element->package.elements[1];
815-
if (obj->type != ACPI_TYPE_INTEGER)
824+
if (obj->type != ACPI_TYPE_INTEGER) {
825+
acpi_handle_info(handle, "_CST C[%d] package element[1] type(%x) is not integer, skip...\n",
826+
i, obj->type);
816827
continue;
828+
}
817829

818830
cx.type = obj->integer.value;
819831
/*
@@ -850,28 +862,38 @@ int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu,
850862
cx.entry_method = ACPI_CSTATE_HALT;
851863
snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI HLT");
852864
} else {
865+
acpi_handle_info(handle, "_CST C%d declares FIXED_HARDWARE C-state but not supported in hardware, skip...\n",
866+
i);
853867
continue;
854868
}
855869
} else if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
856870
cx.entry_method = ACPI_CSTATE_SYSTEMIO;
857871
snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI IOPORT 0x%x",
858872
cx.address);
859873
} else {
874+
acpi_handle_info(handle, "_CST C%d space_id(%x) neither FIXED_HARDWARE nor SYSTEM_IO, skip...\n",
875+
i, reg->space_id);
860876
continue;
861877
}
862878

863879
if (cx.type == ACPI_STATE_C1)
864880
cx.valid = 1;
865881

866882
obj = &element->package.elements[2];
867-
if (obj->type != ACPI_TYPE_INTEGER)
883+
if (obj->type != ACPI_TYPE_INTEGER) {
884+
acpi_handle_info(handle, "_CST C%d package element[2] type(%x) not integer, skip...\n",
885+
i, obj->type);
868886
continue;
887+
}
869888

870889
cx.latency = obj->integer.value;
871890

872891
obj = &element->package.elements[3];
873-
if (obj->type != ACPI_TYPE_INTEGER)
892+
if (obj->type != ACPI_TYPE_INTEGER) {
893+
acpi_handle_info(handle, "_CST C%d package element[3] type(%x) not integer, skip...\n",
894+
i, obj->type);
874895
continue;
896+
}
875897

876898
memcpy(&info->states[++last_index], &cx, sizeof(cx));
877899
}

0 commit comments

Comments
 (0)