Skip to content

Commit c712bb5

Browse files
Lv Zhengrafaeljw
authored andcommitted
ACPI / EC: Add support to skip boot stage DSDT probe
We prepared _INI/_STA methods for \_SB, \_SB.PCI0, \_SB.LID0 and \_SB.EC, _HID(PNP0C09)/_CRS/_GPE for \_SB.EC to poke Windows behavior with qemu, we got the following execution sequence: \_SB._INI \_SB.PCI0._STA \_SB.LID0._STA \_SB.EC._STA \_SB.PCI0._INI \_SB.LID0._INI \_SB.EC._INI There is no extra DSDT EC device enumeration process occurring before the main ACPI device enumeration process. That means acpi_ec_dsdt_probe() is not Windows-compatible. Tracking back, it was added by the following commit: Commit: c5279de Subject: ACPI: EC: Add some basic check for ECDT data but that commit was misguided. Why we shouldn't enumerate DSDT EC before the main ACPI device enumeration? The only way to know if the DSDT EC is valid would be to evaluate its _STA control method, but it's not safe to evaluate this control method that early and out of the ACPI enumeration process, because _STA may refer to entities (such as resources or ACPI device objects) that may not have been initialized before OSPM starts to enumerate them via the main ACPI device enumeration. But after we had reverted back to the expected behavior, a regression was reported. On that platform, there is no ECDT, but the platform control methods access EC operation region earlier than Linux expects causing some ACPI method execution errors. For this reason, we just go back to old behavior to still probe DSDT EC as the boot EC. However, that turns out to lead to yet another functional breakage and in order to work around all of the problems, we skip boot stage DSDT probe when the ECDT exists so that a later quirk can always use correct ECDT GPE setting. Link: http://bugzilla.kernel.org/show_bug.cgi?id=11880 Link: http://bugzilla.kernel.org/show_bug.cgi?id=119261 Link: http://bugzilla.kernel.org/show_bug.cgi?id=195651 Tested-by: Daniel Drake <[email protected]> Signed-off-by: Lv Zheng <[email protected]> [ rjw: Changelog & comments massage ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent ae56c9f commit c712bb5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/acpi/ec.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,12 +1668,26 @@ static const struct acpi_device_id ec_device_ids[] = {
16681668
{"", 0},
16691669
};
16701670

1671+
/*
1672+
* This function is not Windows-compatible as Windows never enumerates the
1673+
* namespace EC before the main ACPI device enumeration process. It is
1674+
* retained for historical reason and will be deprecated in the future.
1675+
*/
16711676
int __init acpi_ec_dsdt_probe(void)
16721677
{
16731678
acpi_status status;
16741679
struct acpi_ec *ec;
16751680
int ret;
16761681

1682+
/*
1683+
* If a platform has ECDT, there is no need to proceed as the
1684+
* following probe is not a part of the ACPI device enumeration,
1685+
* executing _STA is not safe, and thus this probe may risk of
1686+
* picking up an invalid EC device.
1687+
*/
1688+
if (boot_ec)
1689+
return -ENODEV;
1690+
16771691
ec = acpi_ec_alloc();
16781692
if (!ec)
16791693
return -ENOMEM;

0 commit comments

Comments
 (0)