ACPI: EC: Add some basic check for ECDT data
One more ASUS comes with empty ECDT, add a guard for it... http://bugzilla.kernel.org/show_bug.cgi?id=11880 Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
committed by
Len Brown
parent
ed313489ba
commit
c5279dee26
@@ -977,7 +977,6 @@ static const struct acpi_device_id ec_device_ids[] = {
|
|||||||
|
|
||||||
int __init acpi_ec_ecdt_probe(void)
|
int __init acpi_ec_ecdt_probe(void)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_table_ecdt *ecdt_ptr;
|
struct acpi_table_ecdt *ecdt_ptr;
|
||||||
|
|
||||||
@@ -1005,30 +1004,32 @@ int __init acpi_ec_ecdt_probe(void)
|
|||||||
boot_ec->gpe = ecdt_ptr->gpe;
|
boot_ec->gpe = ecdt_ptr->gpe;
|
||||||
boot_ec->handle = ACPI_ROOT_OBJECT;
|
boot_ec->handle = ACPI_ROOT_OBJECT;
|
||||||
acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle);
|
acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle);
|
||||||
} else {
|
/* Add some basic check against completely broken table */
|
||||||
/* This workaround is needed only on some broken machines,
|
if (boot_ec->data_addr != boot_ec->command_addr)
|
||||||
* which require early EC, but fail to provide ECDT */
|
goto install;
|
||||||
acpi_handle x;
|
/* fall through */
|
||||||
printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
|
|
||||||
status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
|
|
||||||
boot_ec, NULL);
|
|
||||||
/* Check that acpi_get_devices actually find something */
|
|
||||||
if (ACPI_FAILURE(status) || !boot_ec->handle)
|
|
||||||
goto error;
|
|
||||||
/* We really need to limit this workaround, the only ASUS,
|
|
||||||
* which needs it, has fake EC._INI method, so use it as flag.
|
|
||||||
* Keep boot_ec struct as it will be needed soon.
|
|
||||||
*/
|
|
||||||
if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x)))
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
}
|
||||||
|
/* This workaround is needed only on some broken machines,
|
||||||
ret = ec_install_handlers(boot_ec);
|
* which require early EC, but fail to provide ECDT */
|
||||||
if (!ret) {
|
acpi_handle x;
|
||||||
|
printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
|
||||||
|
status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
|
||||||
|
boot_ec, NULL);
|
||||||
|
/* Check that acpi_get_devices actually find something */
|
||||||
|
if (ACPI_FAILURE(status) || !boot_ec->handle)
|
||||||
|
goto error;
|
||||||
|
/* We really need to limit this workaround, the only ASUS,
|
||||||
|
* which needs it, has fake EC._INI method, so use it as flag.
|
||||||
|
* Keep boot_ec struct as it will be needed soon.
|
||||||
|
*/
|
||||||
|
if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x)))
|
||||||
|
return -ENODEV;
|
||||||
|
install:
|
||||||
|
if (!ec_install_handlers(boot_ec)) {
|
||||||
first_ec = boot_ec;
|
first_ec = boot_ec;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
error:
|
error:
|
||||||
kfree(boot_ec);
|
kfree(boot_ec);
|
||||||
boot_ec = NULL;
|
boot_ec = NULL;
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
Reference in New Issue
Block a user