From: Kamala Narasimhan Date: Mon, 23 Feb 2009 19:53:49 +0000 (-0500) Subject: OEMs could optionally provide methods to enable/disable event data block. Call them... X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=677458d32f107ebd33b6ffdea8b11ed41b4908d5;p=xenclient%2Fkernel.git OEMs could optionally provide methods to enable/disable event data block. Call them as appropriate. This patch is based on an upstream patch but modified to fit our design. Original patch signed off by - Signed-off-by: Matthew Garrett Signed-off-by: Carlos Corbacho --- diff --git a/drivers/acpi/wmi.c b/drivers/acpi/wmi.c index e468108c..13d44881 100644 --- a/drivers/acpi/wmi.c +++ b/drivers/acpi/wmi.c @@ -112,6 +112,40 @@ static bool find_guid(const char *guid_string, struct wmi_block **out) return 0; } +static acpi_status wmi_enable_event_data_blocks(int enable) +{ + struct list_head *p; + struct guid_block *gblock; + struct wmi_block *wblock; + char method[5]; + struct acpi_object_list input; + union acpi_object params[1]; + acpi_status status; + + list_for_each(p, &wmi_blocks.list) { + wblock = list_entry(p, struct wmi_block, list); + gblock = &wblock->gblock; + + if (gblock->flags & ACPI_WMI_EVENT) { + input.count = 1; + input.pointer = params; + params[0].type = ACPI_TYPE_INTEGER; + params[0].integer.value = enable; + + snprintf(method, 5, "WE%02X", gblock->notify_id); + status = acpi_evaluate_object(wblock->handle, method, &input, NULL); + + if (status != AE_OK && status != AE_NOT_FOUND) { + printk(KERN_INFO PREFIX "Event block %s enable failed\n", method); + return status; + } else + return AE_OK; + } + } + + return AE_OK; /* if we don't have a wmi block (though odd), just return success */ +} + /* * Exported WMI functions */ @@ -461,6 +495,7 @@ static int acpi_wmi_remove(struct acpi_device *device, int type) acpi_remove_address_space_handler(device->handle, ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler); + wmi_enable_event_data_blocks(0); return 0; } @@ -480,15 +515,21 @@ static int __init acpi_wmi_add(struct acpi_device *device) ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler, NULL, NULL); - if (ACPI_FAILURE(status)) + if (ACPI_FAILURE(status)) { + printk(KERN_ERR PREFIX "Error installing EC region handler\n"); return -ENODEV; + } status = parse_wdg(device->handle); if (ACPI_FAILURE(status)) { - printk(KERN_ERR PREFIX "Error installing EC region handler\n"); + printk(KERN_ERR PREFIX "parse_wdg failed!\n"); return -ENODEV; } + /* No need to check and fail if wmi_enable_event_data_blocks should fail. + * wmi_enable_event_data_blocks will print an error message. + */ + wmi_enable_event_data_blocks(1); return result; }