diff options
Diffstat (limited to 'drivers/acpi/processor_core.c')
| -rw-r--r-- | drivers/acpi/processor_core.c | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index a496a863edea..53de55e6f6b1 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
| @@ -698,6 +698,90 @@ static int acpi_processor_get_info(struct acpi_device *device) | |||
| 698 | 698 | ||
| 699 | static DEFINE_PER_CPU(void *, processor_device_array); | 699 | static DEFINE_PER_CPU(void *, processor_device_array); |
| 700 | 700 | ||
| 701 | static void acpi_processor_notify(struct acpi_device *device, u32 event) | ||
| 702 | { | ||
| 703 | struct acpi_processor *pr = acpi_driver_data(device); | ||
| 704 | int saved; | ||
| 705 | |||
| 706 | if (!pr) | ||
| 707 | return; | ||
| 708 | |||
| 709 | switch (event) { | ||
| 710 | case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: | ||
| 711 | saved = pr->performance_platform_limit; | ||
| 712 | acpi_processor_ppc_has_changed(pr); | ||
| 713 | if (saved == pr->performance_platform_limit) | ||
| 714 | break; | ||
| 715 | acpi_bus_generate_proc_event(device, event, | ||
| 716 | pr->performance_platform_limit); | ||
| 717 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
| 718 | dev_name(&device->dev), event, | ||
| 719 | pr->performance_platform_limit); | ||
| 720 | break; | ||
| 721 | case ACPI_PROCESSOR_NOTIFY_POWER: | ||
| 722 | acpi_processor_cst_has_changed(pr); | ||
| 723 | acpi_bus_generate_proc_event(device, event, 0); | ||
| 724 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
| 725 | dev_name(&device->dev), event, 0); | ||
| 726 | break; | ||
| 727 | case ACPI_PROCESSOR_NOTIFY_THROTTLING: | ||
| 728 | acpi_processor_tstate_has_changed(pr); | ||
| 729 | acpi_bus_generate_proc_event(device, event, 0); | ||
| 730 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
| 731 | dev_name(&device->dev), event, 0); | ||
| 732 | default: | ||
| 733 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 734 | "Unsupported event [0x%x]\n", event)); | ||
| 735 | break; | ||
| 736 | } | ||
| 737 | |||
| 738 | return; | ||
| 739 | } | ||
| 740 | |||
| 741 | static int acpi_cpu_soft_notify(struct notifier_block *nfb, | ||
| 742 | unsigned long action, void *hcpu) | ||
| 743 | { | ||
| 744 | unsigned int cpu = (unsigned long)hcpu; | ||
| 745 | struct acpi_processor *pr = per_cpu(processors, cpu); | ||
| 746 | |||
| 747 | if (action == CPU_ONLINE && pr) { | ||
| 748 | acpi_processor_ppc_has_changed(pr); | ||
| 749 | acpi_processor_cst_has_changed(pr); | ||
| 750 | acpi_processor_tstate_has_changed(pr); | ||
| 751 | } | ||
| 752 | return NOTIFY_OK; | ||
| 753 | } | ||
| 754 | |||
| 755 | static struct notifier_block acpi_cpu_notifier = | ||
| 756 | { | ||
| 757 | .notifier_call = acpi_cpu_soft_notify, | ||
| 758 | }; | ||
| 759 | |||
| 760 | static int acpi_processor_add(struct acpi_device *device) | ||
| 761 | { | ||
| 762 | struct acpi_processor *pr = NULL; | ||
| 763 | |||
| 764 | |||
| 765 | if (!device) | ||
| 766 | return -EINVAL; | ||
| 767 | |||
| 768 | pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL); | ||
| 769 | if (!pr) | ||
| 770 | return -ENOMEM; | ||
| 771 | |||
| 772 | if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) { | ||
| 773 | kfree(pr); | ||
| 774 | return -ENOMEM; | ||
| 775 | } | ||
| 776 | |||
| 777 | pr->handle = device->handle; | ||
| 778 | strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME); | ||
| 779 | strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); | ||
| 780 | device->driver_data = pr; | ||
| 781 | |||
| 782 | return 0; | ||
| 783 | } | ||
| 784 | |||
| 701 | static int __cpuinit acpi_processor_start(struct acpi_device *device) | 785 | static int __cpuinit acpi_processor_start(struct acpi_device *device) |
| 702 | { | 786 | { |
| 703 | int result = 0; | 787 | int result = 0; |
| @@ -799,90 +883,6 @@ err_remove_fs: | |||
| 799 | return result; | 883 | return result; |
| 800 | } | 884 | } |
| 801 | 885 | ||
| 802 | static void acpi_processor_notify(struct acpi_device *device, u32 event) | ||
| 803 | { | ||
| 804 | struct acpi_processor *pr = acpi_driver_data(device); | ||
| 805 | int saved; | ||
| 806 | |||
| 807 | if (!pr) | ||
| 808 | return; | ||
| 809 | |||
| 810 | switch (event) { | ||
| 811 | case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: | ||
| 812 | saved = pr->performance_platform_limit; | ||
| 813 | acpi_processor_ppc_has_changed(pr); | ||
| 814 | if (saved == pr->performance_platform_limit) | ||
| 815 | break; | ||
| 816 | acpi_bus_generate_proc_event(device, event, | ||
| 817 | pr->performance_platform_limit); | ||
| 818 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
| 819 | dev_name(&device->dev), event, | ||
| 820 | pr->performance_platform_limit); | ||
| 821 | break; | ||
| 822 | case ACPI_PROCESSOR_NOTIFY_POWER: | ||
| 823 | acpi_processor_cst_has_changed(pr); | ||
| 824 | acpi_bus_generate_proc_event(device, event, 0); | ||
| 825 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
| 826 | dev_name(&device->dev), event, 0); | ||
| 827 | break; | ||
| 828 | case ACPI_PROCESSOR_NOTIFY_THROTTLING: | ||
| 829 | acpi_processor_tstate_has_changed(pr); | ||
| 830 | acpi_bus_generate_proc_event(device, event, 0); | ||
| 831 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
| 832 | dev_name(&device->dev), event, 0); | ||
| 833 | default: | ||
| 834 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 835 | "Unsupported event [0x%x]\n", event)); | ||
| 836 | break; | ||
| 837 | } | ||
| 838 | |||
| 839 | return; | ||
| 840 | } | ||
| 841 | |||
| 842 | static int acpi_cpu_soft_notify(struct notifier_block *nfb, | ||
| 843 | unsigned long action, void *hcpu) | ||
| 844 | { | ||
| 845 | unsigned int cpu = (unsigned long)hcpu; | ||
| 846 | struct acpi_processor *pr = per_cpu(processors, cpu); | ||
| 847 | |||
| 848 | if (action == CPU_ONLINE && pr) { | ||
| 849 | acpi_processor_ppc_has_changed(pr); | ||
| 850 | acpi_processor_cst_has_changed(pr); | ||
| 851 | acpi_processor_tstate_has_changed(pr); | ||
| 852 | } | ||
| 853 | return NOTIFY_OK; | ||
| 854 | } | ||
| 855 | |||
| 856 | static struct notifier_block acpi_cpu_notifier = | ||
| 857 | { | ||
| 858 | .notifier_call = acpi_cpu_soft_notify, | ||
| 859 | }; | ||
| 860 | |||
| 861 | static int acpi_processor_add(struct acpi_device *device) | ||
| 862 | { | ||
| 863 | struct acpi_processor *pr = NULL; | ||
| 864 | |||
| 865 | |||
| 866 | if (!device) | ||
| 867 | return -EINVAL; | ||
| 868 | |||
| 869 | pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL); | ||
| 870 | if (!pr) | ||
| 871 | return -ENOMEM; | ||
| 872 | |||
| 873 | if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) { | ||
| 874 | kfree(pr); | ||
| 875 | return -ENOMEM; | ||
| 876 | } | ||
| 877 | |||
| 878 | pr->handle = device->handle; | ||
| 879 | strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME); | ||
| 880 | strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); | ||
| 881 | device->driver_data = pr; | ||
| 882 | |||
| 883 | return 0; | ||
| 884 | } | ||
| 885 | |||
| 886 | static int acpi_processor_remove(struct acpi_device *device, int type) | 886 | static int acpi_processor_remove(struct acpi_device *device, int type) |
| 887 | { | 887 | { |
| 888 | struct acpi_processor *pr = NULL; | 888 | struct acpi_processor *pr = NULL; |
