diff options
| author | Toshi Kani <toshi.kani@hp.com> | 2012-03-19 15:08:02 -0400 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2012-03-30 03:06:51 -0400 |
| commit | 9f324bda970c599ca35f7be89d9d1bcb96d6053c (patch) | |
| tree | 79cd2b9d07e6b8b43e7346b34150bf1a2559d3fe | |
| parent | c16fa4f2ad19908a47c63d8fa436a1178438c7e7 (diff) | |
ACPI: Add CPU hotplug support for processor device objects
acpi_processor_install_hotplug_notify() registers processor objects to
receive ACPI CPU hotplug event notifications. This patch additionally
registers processor device objects (ACPI0007) to receive the notifications
as well.
Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Len Brown <len.brown@intel.com>
| -rw-r--r-- | drivers/acpi/processor_driver.c | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index 8ae05ce18500..50be27739fe8 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
| @@ -68,6 +68,7 @@ | |||
| 68 | #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80 | 68 | #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80 |
| 69 | #define ACPI_PROCESSOR_NOTIFY_POWER 0x81 | 69 | #define ACPI_PROCESSOR_NOTIFY_POWER 0x81 |
| 70 | #define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82 | 70 | #define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82 |
| 71 | #define ACPI_PROCESSOR_DEVICE_HID "ACPI0007" | ||
| 71 | 72 | ||
| 72 | #define ACPI_PROCESSOR_LIMIT_USER 0 | 73 | #define ACPI_PROCESSOR_LIMIT_USER 0 |
| 73 | #define ACPI_PROCESSOR_LIMIT_THERMAL 1 | 74 | #define ACPI_PROCESSOR_LIMIT_THERMAL 1 |
| @@ -88,7 +89,7 @@ static int acpi_processor_start(struct acpi_processor *pr); | |||
| 88 | 89 | ||
| 89 | static const struct acpi_device_id processor_device_ids[] = { | 90 | static const struct acpi_device_id processor_device_ids[] = { |
| 90 | {ACPI_PROCESSOR_OBJECT_HID, 0}, | 91 | {ACPI_PROCESSOR_OBJECT_HID, 0}, |
| 91 | {"ACPI0007", 0}, | 92 | {ACPI_PROCESSOR_DEVICE_HID, 0}, |
| 92 | {"", 0}, | 93 | {"", 0}, |
| 93 | }; | 94 | }; |
| 94 | MODULE_DEVICE_TABLE(acpi, processor_device_ids); | 95 | MODULE_DEVICE_TABLE(acpi, processor_device_ids); |
| @@ -741,20 +742,46 @@ static void acpi_processor_hotplug_notify(acpi_handle handle, | |||
| 741 | return; | 742 | return; |
| 742 | } | 743 | } |
| 743 | 744 | ||
| 745 | static acpi_status is_processor_device(acpi_handle handle) | ||
| 746 | { | ||
| 747 | struct acpi_device_info *info; | ||
| 748 | char *hid; | ||
| 749 | acpi_status status; | ||
| 750 | |||
| 751 | status = acpi_get_object_info(handle, &info); | ||
| 752 | if (ACPI_FAILURE(status)) | ||
| 753 | return status; | ||
| 754 | |||
| 755 | if (info->type == ACPI_TYPE_PROCESSOR) { | ||
| 756 | kfree(info); | ||
| 757 | return AE_OK; /* found a processor object */ | ||
| 758 | } | ||
| 759 | |||
| 760 | if (!(info->valid & ACPI_VALID_HID)) { | ||
| 761 | kfree(info); | ||
| 762 | return AE_ERROR; | ||
| 763 | } | ||
| 764 | |||
| 765 | hid = info->hardware_id.string; | ||
| 766 | if ((hid == NULL) || strcmp(hid, ACPI_PROCESSOR_DEVICE_HID)) { | ||
| 767 | kfree(info); | ||
| 768 | return AE_ERROR; | ||
| 769 | } | ||
| 770 | |||
| 771 | kfree(info); | ||
| 772 | return AE_OK; /* found a processor device object */ | ||
| 773 | } | ||
| 774 | |||
| 744 | static acpi_status | 775 | static acpi_status |
| 745 | processor_walk_namespace_cb(acpi_handle handle, | 776 | processor_walk_namespace_cb(acpi_handle handle, |
| 746 | u32 lvl, void *context, void **rv) | 777 | u32 lvl, void *context, void **rv) |
| 747 | { | 778 | { |
| 748 | acpi_status status; | 779 | acpi_status status; |
| 749 | int *action = context; | 780 | int *action = context; |
| 750 | acpi_object_type type = 0; | ||
| 751 | 781 | ||
| 752 | status = acpi_get_type(handle, &type); | 782 | status = is_processor_device(handle); |
| 753 | if (ACPI_FAILURE(status)) | 783 | if (ACPI_FAILURE(status)) |
| 754 | return (AE_OK); | 784 | return AE_OK; /* not a processor; continue to walk */ |
| 755 | |||
| 756 | if (type != ACPI_TYPE_PROCESSOR) | ||
| 757 | return (AE_OK); | ||
| 758 | 785 | ||
| 759 | switch (*action) { | 786 | switch (*action) { |
| 760 | case INSTALL_NOTIFY_HANDLER: | 787 | case INSTALL_NOTIFY_HANDLER: |
| @@ -772,7 +799,8 @@ processor_walk_namespace_cb(acpi_handle handle, | |||
| 772 | break; | 799 | break; |
| 773 | } | 800 | } |
| 774 | 801 | ||
| 775 | return (AE_OK); | 802 | /* found a processor; skip walking underneath */ |
| 803 | return AE_CTRL_DEPTH; | ||
| 776 | } | 804 | } |
| 777 | 805 | ||
| 778 | static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr) | 806 | static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr) |
| @@ -830,7 +858,7 @@ void acpi_processor_install_hotplug_notify(void) | |||
| 830 | { | 858 | { |
| 831 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | 859 | #ifdef CONFIG_ACPI_HOTPLUG_CPU |
| 832 | int action = INSTALL_NOTIFY_HANDLER; | 860 | int action = INSTALL_NOTIFY_HANDLER; |
| 833 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, | 861 | acpi_walk_namespace(ACPI_TYPE_ANY, |
| 834 | ACPI_ROOT_OBJECT, | 862 | ACPI_ROOT_OBJECT, |
| 835 | ACPI_UINT32_MAX, | 863 | ACPI_UINT32_MAX, |
| 836 | processor_walk_namespace_cb, NULL, &action, NULL); | 864 | processor_walk_namespace_cb, NULL, &action, NULL); |
| @@ -843,7 +871,7 @@ void acpi_processor_uninstall_hotplug_notify(void) | |||
| 843 | { | 871 | { |
| 844 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | 872 | #ifdef CONFIG_ACPI_HOTPLUG_CPU |
| 845 | int action = UNINSTALL_NOTIFY_HANDLER; | 873 | int action = UNINSTALL_NOTIFY_HANDLER; |
| 846 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, | 874 | acpi_walk_namespace(ACPI_TYPE_ANY, |
| 847 | ACPI_ROOT_OBJECT, | 875 | ACPI_ROOT_OBJECT, |
| 848 | ACPI_UINT32_MAX, | 876 | ACPI_UINT32_MAX, |
| 849 | processor_walk_namespace_cb, NULL, &action, NULL); | 877 | processor_walk_namespace_cb, NULL, &action, NULL); |
