diff options
Diffstat (limited to 'drivers/acpi')
| -rw-r--r-- | drivers/acpi/Kconfig | 3 | ||||
| -rw-r--r-- | drivers/acpi/Makefile | 2 | ||||
| -rw-r--r-- | drivers/acpi/acpica/tbutils.c | 7 | ||||
| -rw-r--r-- | drivers/acpi/acpica/uteval.c | 21 | ||||
| -rw-r--r-- | drivers/acpi/container.c | 5 | ||||
| -rw-r--r-- | drivers/acpi/dock.c | 14 | ||||
| -rw-r--r-- | drivers/acpi/ec.c | 73 | ||||
| -rw-r--r-- | drivers/acpi/glue.c | 8 | ||||
| -rw-r--r-- | drivers/acpi/osl.c | 54 | ||||
| -rw-r--r-- | drivers/acpi/pci_link.c | 2 | ||||
| -rw-r--r-- | drivers/acpi/processor_idle.c | 667 | ||||
| -rw-r--r-- | drivers/acpi/processor_perflib.c | 105 | ||||
| -rw-r--r-- | drivers/acpi/sleep.c (renamed from drivers/acpi/main.c) | 53 | ||||
| -rw-r--r-- | drivers/acpi/tables.c | 7 | ||||
| -rw-r--r-- | drivers/acpi/thermal.c | 16 | ||||
| -rw-r--r-- | drivers/acpi/video.c | 16 |
16 files changed, 180 insertions, 873 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index d7f9839ba264..a7799a99f2d9 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
| @@ -9,6 +9,7 @@ menuconfig ACPI | |||
| 9 | depends on PCI | 9 | depends on PCI |
| 10 | depends on PM | 10 | depends on PM |
| 11 | select PNP | 11 | select PNP |
| 12 | select CPU_IDLE | ||
| 12 | default y | 13 | default y |
| 13 | ---help--- | 14 | ---help--- |
| 14 | Advanced Configuration and Power Interface (ACPI) support for | 15 | Advanced Configuration and Power Interface (ACPI) support for |
| @@ -287,7 +288,7 @@ config ACPI_CONTAINER | |||
| 287 | support physical cpu/memory hot-plug. | 288 | support physical cpu/memory hot-plug. |
| 288 | 289 | ||
| 289 | If one selects "m", this driver can be loaded with | 290 | If one selects "m", this driver can be loaded with |
| 290 | "modprobe acpi_container". | 291 | "modprobe container". |
| 291 | 292 | ||
| 292 | config ACPI_HOTPLUG_MEMORY | 293 | config ACPI_HOTPLUG_MEMORY |
| 293 | tristate "Memory Hotplug" | 294 | tristate "Memory Hotplug" |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index d80f4cc2e0da..65d90c720b5a 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
| @@ -19,7 +19,7 @@ obj-y += osl.o utils.o reboot.o\ | |||
| 19 | 19 | ||
| 20 | # sleep related files | 20 | # sleep related files |
| 21 | obj-y += wakeup.o | 21 | obj-y += wakeup.o |
| 22 | obj-y += main.o | 22 | obj-y += sleep.o |
| 23 | obj-$(CONFIG_ACPI_SLEEP) += proc.o | 23 | obj-$(CONFIG_ACPI_SLEEP) += proc.o |
| 24 | 24 | ||
| 25 | 25 | ||
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index 9684cc827930..22ce48985720 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c | |||
| @@ -538,10 +538,9 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) | |||
| 538 | if (ACPI_FAILURE(status)) { | 538 | if (ACPI_FAILURE(status)) { |
| 539 | ACPI_WARNING((AE_INFO, | 539 | ACPI_WARNING((AE_INFO, |
| 540 | "Truncating %u table entries!", | 540 | "Truncating %u table entries!", |
| 541 | (unsigned) | 541 | (unsigned) (table_count - |
| 542 | (acpi_gbl_root_table_list.size - | 542 | (acpi_gbl_root_table_list. |
| 543 | acpi_gbl_root_table_list. | 543 | count - 2)))); |
| 544 | count))); | ||
| 545 | break; | 544 | break; |
| 546 | } | 545 | } |
| 547 | } | 546 | } |
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c index da9450bc60f7..9c9897dbe907 100644 --- a/drivers/acpi/acpica/uteval.c +++ b/drivers/acpi/acpica/uteval.c | |||
| @@ -116,9 +116,9 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
| 116 | return_ACPI_STATUS(AE_NO_MEMORY); | 116 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | /* Default return value is SUPPORTED */ | 119 | /* Default return value is 0, NOT-SUPPORTED */ |
| 120 | 120 | ||
| 121 | return_desc->integer.value = ACPI_UINT32_MAX; | 121 | return_desc->integer.value = 0; |
| 122 | walk_state->return_desc = return_desc; | 122 | walk_state->return_desc = return_desc; |
| 123 | 123 | ||
| 124 | /* Compare input string to static table of supported interfaces */ | 124 | /* Compare input string to static table of supported interfaces */ |
| @@ -127,10 +127,8 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
| 127 | if (!ACPI_STRCMP | 127 | if (!ACPI_STRCMP |
| 128 | (string_desc->string.pointer, | 128 | (string_desc->string.pointer, |
| 129 | acpi_interfaces_supported[i])) { | 129 | acpi_interfaces_supported[i])) { |
| 130 | 130 | return_desc->integer.value = ACPI_UINT32_MAX; | |
| 131 | /* The interface is supported */ | 131 | goto done; |
| 132 | |||
| 133 | return_ACPI_STATUS(AE_OK); | ||
| 134 | } | 132 | } |
| 135 | } | 133 | } |
| 136 | 134 | ||
| @@ -141,15 +139,14 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
| 141 | */ | 139 | */ |
| 142 | status = acpi_os_validate_interface(string_desc->string.pointer); | 140 | status = acpi_os_validate_interface(string_desc->string.pointer); |
| 143 | if (ACPI_SUCCESS(status)) { | 141 | if (ACPI_SUCCESS(status)) { |
| 144 | 142 | return_desc->integer.value = ACPI_UINT32_MAX; | |
| 145 | /* The interface is supported */ | ||
| 146 | |||
| 147 | return_ACPI_STATUS(AE_OK); | ||
| 148 | } | 143 | } |
| 149 | 144 | ||
| 150 | /* The interface is not supported */ | 145 | done: |
| 146 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, "ACPI: BIOS _OSI(%s) %ssupported\n", | ||
| 147 | string_desc->string.pointer, | ||
| 148 | return_desc->integer.value == 0 ? "not-" : "")); | ||
| 151 | 149 | ||
| 152 | return_desc->integer.value = 0; | ||
| 153 | return_ACPI_STATUS(AE_OK); | 150 | return_ACPI_STATUS(AE_OK); |
| 154 | } | 151 | } |
| 155 | 152 | ||
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 17020c12623c..fe0cdf83641a 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
| @@ -163,7 +163,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) | |||
| 163 | case ACPI_NOTIFY_BUS_CHECK: | 163 | case ACPI_NOTIFY_BUS_CHECK: |
| 164 | /* Fall through */ | 164 | /* Fall through */ |
| 165 | case ACPI_NOTIFY_DEVICE_CHECK: | 165 | case ACPI_NOTIFY_DEVICE_CHECK: |
| 166 | printk("Container driver received %s event\n", | 166 | printk(KERN_WARNING "Container driver received %s event\n", |
| 167 | (type == ACPI_NOTIFY_BUS_CHECK) ? | 167 | (type == ACPI_NOTIFY_BUS_CHECK) ? |
| 168 | "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); | 168 | "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); |
| 169 | status = acpi_bus_get_device(handle, &device); | 169 | status = acpi_bus_get_device(handle, &device); |
| @@ -174,7 +174,8 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) | |||
| 174 | kobject_uevent(&device->dev.kobj, | 174 | kobject_uevent(&device->dev.kobj, |
| 175 | KOBJ_ONLINE); | 175 | KOBJ_ONLINE); |
| 176 | else | 176 | else |
| 177 | printk("Failed to add container\n"); | 177 | printk(KERN_WARNING |
| 178 | "Failed to add container\n"); | ||
| 178 | } | 179 | } |
| 179 | } else { | 180 | } else { |
| 180 | if (ACPI_SUCCESS(status)) { | 181 | if (ACPI_SUCCESS(status)) { |
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 5b30b8d91d71..35094f230b1e 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
| @@ -855,10 +855,14 @@ fdd_out: | |||
| 855 | static ssize_t show_docked(struct device *dev, | 855 | static ssize_t show_docked(struct device *dev, |
| 856 | struct device_attribute *attr, char *buf) | 856 | struct device_attribute *attr, char *buf) |
| 857 | { | 857 | { |
| 858 | struct acpi_device *tmp; | ||
| 859 | |||
| 858 | struct dock_station *dock_station = *((struct dock_station **) | 860 | struct dock_station *dock_station = *((struct dock_station **) |
| 859 | dev->platform_data); | 861 | dev->platform_data); |
| 860 | return snprintf(buf, PAGE_SIZE, "%d\n", dock_present(dock_station)); | ||
| 861 | 862 | ||
| 863 | if (ACPI_SUCCESS(acpi_bus_get_device(dock_station->handle, &tmp))) | ||
| 864 | return snprintf(buf, PAGE_SIZE, "1\n"); | ||
| 865 | return snprintf(buf, PAGE_SIZE, "0\n"); | ||
| 862 | } | 866 | } |
| 863 | static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL); | 867 | static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL); |
| 864 | 868 | ||
| @@ -984,7 +988,7 @@ static int dock_add(acpi_handle handle) | |||
| 984 | 988 | ||
| 985 | ret = device_create_file(&dock_device->dev, &dev_attr_docked); | 989 | ret = device_create_file(&dock_device->dev, &dev_attr_docked); |
| 986 | if (ret) { | 990 | if (ret) { |
| 987 | printk("Error %d adding sysfs file\n", ret); | 991 | printk(KERN_ERR "Error %d adding sysfs file\n", ret); |
| 988 | platform_device_unregister(dock_device); | 992 | platform_device_unregister(dock_device); |
| 989 | kfree(dock_station); | 993 | kfree(dock_station); |
| 990 | dock_station = NULL; | 994 | dock_station = NULL; |
| @@ -992,7 +996,7 @@ static int dock_add(acpi_handle handle) | |||
| 992 | } | 996 | } |
| 993 | ret = device_create_file(&dock_device->dev, &dev_attr_undock); | 997 | ret = device_create_file(&dock_device->dev, &dev_attr_undock); |
| 994 | if (ret) { | 998 | if (ret) { |
| 995 | printk("Error %d adding sysfs file\n", ret); | 999 | printk(KERN_ERR "Error %d adding sysfs file\n", ret); |
| 996 | device_remove_file(&dock_device->dev, &dev_attr_docked); | 1000 | device_remove_file(&dock_device->dev, &dev_attr_docked); |
| 997 | platform_device_unregister(dock_device); | 1001 | platform_device_unregister(dock_device); |
| 998 | kfree(dock_station); | 1002 | kfree(dock_station); |
| @@ -1001,7 +1005,7 @@ static int dock_add(acpi_handle handle) | |||
| 1001 | } | 1005 | } |
| 1002 | ret = device_create_file(&dock_device->dev, &dev_attr_uid); | 1006 | ret = device_create_file(&dock_device->dev, &dev_attr_uid); |
| 1003 | if (ret) { | 1007 | if (ret) { |
| 1004 | printk("Error %d adding sysfs file\n", ret); | 1008 | printk(KERN_ERR "Error %d adding sysfs file\n", ret); |
| 1005 | device_remove_file(&dock_device->dev, &dev_attr_docked); | 1009 | device_remove_file(&dock_device->dev, &dev_attr_docked); |
| 1006 | device_remove_file(&dock_device->dev, &dev_attr_undock); | 1010 | device_remove_file(&dock_device->dev, &dev_attr_undock); |
| 1007 | platform_device_unregister(dock_device); | 1011 | platform_device_unregister(dock_device); |
| @@ -1011,7 +1015,7 @@ static int dock_add(acpi_handle handle) | |||
| 1011 | } | 1015 | } |
| 1012 | ret = device_create_file(&dock_device->dev, &dev_attr_flags); | 1016 | ret = device_create_file(&dock_device->dev, &dev_attr_flags); |
| 1013 | if (ret) { | 1017 | if (ret) { |
| 1014 | printk("Error %d adding sysfs file\n", ret); | 1018 | printk(KERN_ERR "Error %d adding sysfs file\n", ret); |
| 1015 | device_remove_file(&dock_device->dev, &dev_attr_docked); | 1019 | device_remove_file(&dock_device->dev, &dev_attr_docked); |
| 1016 | device_remove_file(&dock_device->dev, &dev_attr_undock); | 1020 | device_remove_file(&dock_device->dev, &dev_attr_undock); |
| 1017 | device_remove_file(&dock_device->dev, &dev_attr_uid); | 1021 | device_remove_file(&dock_device->dev, &dev_attr_uid); |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 8dfcbb8aff73..5c2f5d343be6 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
| @@ -120,31 +120,6 @@ static struct acpi_ec { | |||
| 120 | spinlock_t curr_lock; | 120 | spinlock_t curr_lock; |
| 121 | } *boot_ec, *first_ec; | 121 | } *boot_ec, *first_ec; |
| 122 | 122 | ||
| 123 | /* | ||
| 124 | * Some Asus system have exchanged ECDT data/command IO addresses. | ||
| 125 | */ | ||
| 126 | static int print_ecdt_error(const struct dmi_system_id *id) | ||
| 127 | { | ||
| 128 | printk(KERN_NOTICE PREFIX "%s detected - " | ||
| 129 | "ECDT has exchanged control/data I/O address\n", | ||
| 130 | id->ident); | ||
| 131 | return 0; | ||
| 132 | } | ||
| 133 | |||
| 134 | static struct dmi_system_id __cpuinitdata ec_dmi_table[] = { | ||
| 135 | { | ||
| 136 | print_ecdt_error, "Asus L4R", { | ||
| 137 | DMI_MATCH(DMI_BIOS_VERSION, "1008.006"), | ||
| 138 | DMI_MATCH(DMI_PRODUCT_NAME, "L4R"), | ||
| 139 | DMI_MATCH(DMI_BOARD_NAME, "L4R") }, NULL}, | ||
| 140 | { | ||
| 141 | print_ecdt_error, "Asus M6R", { | ||
| 142 | DMI_MATCH(DMI_BIOS_VERSION, "0207"), | ||
| 143 | DMI_MATCH(DMI_PRODUCT_NAME, "M6R"), | ||
| 144 | DMI_MATCH(DMI_BOARD_NAME, "M6R") }, NULL}, | ||
| 145 | {}, | ||
| 146 | }; | ||
| 147 | |||
| 148 | /* -------------------------------------------------------------------------- | 123 | /* -------------------------------------------------------------------------- |
| 149 | Transaction Management | 124 | Transaction Management |
| 150 | -------------------------------------------------------------------------- */ | 125 | -------------------------------------------------------------------------- */ |
| @@ -983,8 +958,8 @@ static const struct acpi_device_id ec_device_ids[] = { | |||
| 983 | int __init acpi_ec_ecdt_probe(void) | 958 | int __init acpi_ec_ecdt_probe(void) |
| 984 | { | 959 | { |
| 985 | acpi_status status; | 960 | acpi_status status; |
| 961 | struct acpi_ec *saved_ec = NULL; | ||
| 986 | struct acpi_table_ecdt *ecdt_ptr; | 962 | struct acpi_table_ecdt *ecdt_ptr; |
| 987 | acpi_handle dummy; | ||
| 988 | 963 | ||
| 989 | boot_ec = make_acpi_ec(); | 964 | boot_ec = make_acpi_ec(); |
| 990 | if (!boot_ec) | 965 | if (!boot_ec) |
| @@ -998,21 +973,16 @@ int __init acpi_ec_ecdt_probe(void) | |||
| 998 | pr_info(PREFIX "EC description table is found, configuring boot EC\n"); | 973 | pr_info(PREFIX "EC description table is found, configuring boot EC\n"); |
| 999 | boot_ec->command_addr = ecdt_ptr->control.address; | 974 | boot_ec->command_addr = ecdt_ptr->control.address; |
| 1000 | boot_ec->data_addr = ecdt_ptr->data.address; | 975 | boot_ec->data_addr = ecdt_ptr->data.address; |
| 1001 | if (dmi_check_system(ec_dmi_table)) { | ||
| 1002 | /* | ||
| 1003 | * If the board falls into ec_dmi_table, it means | ||
| 1004 | * that ECDT table gives the incorrect command/status | ||
| 1005 | * & data I/O address. Just fix it. | ||
| 1006 | */ | ||
| 1007 | boot_ec->data_addr = ecdt_ptr->control.address; | ||
| 1008 | boot_ec->command_addr = ecdt_ptr->data.address; | ||
| 1009 | } | ||
| 1010 | boot_ec->gpe = ecdt_ptr->gpe; | 976 | boot_ec->gpe = ecdt_ptr->gpe; |
| 1011 | boot_ec->handle = ACPI_ROOT_OBJECT; | 977 | boot_ec->handle = ACPI_ROOT_OBJECT; |
| 1012 | acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); | 978 | acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); |
| 1013 | /* Add some basic check against completely broken table */ | 979 | /* Don't trust ECDT, which comes from ASUSTek */ |
| 1014 | if (boot_ec->data_addr != boot_ec->command_addr) | 980 | if (!dmi_name_in_vendors("ASUS")) |
| 1015 | goto install; | 981 | goto install; |
| 982 | saved_ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); | ||
| 983 | if (!saved_ec) | ||
| 984 | return -ENOMEM; | ||
| 985 | memcpy(saved_ec, boot_ec, sizeof(*saved_ec)); | ||
| 1016 | /* fall through */ | 986 | /* fall through */ |
| 1017 | } | 987 | } |
| 1018 | /* This workaround is needed only on some broken machines, | 988 | /* This workaround is needed only on some broken machines, |
| @@ -1023,12 +993,29 @@ int __init acpi_ec_ecdt_probe(void) | |||
| 1023 | /* Check that acpi_get_devices actually find something */ | 993 | /* Check that acpi_get_devices actually find something */ |
| 1024 | if (ACPI_FAILURE(status) || !boot_ec->handle) | 994 | if (ACPI_FAILURE(status) || !boot_ec->handle) |
| 1025 | goto error; | 995 | goto error; |
| 1026 | /* We really need to limit this workaround, the only ASUS, | 996 | if (saved_ec) { |
| 1027 | * which needs it, has fake EC._INI method, so use it as flag. | 997 | /* try to find good ECDT from ASUSTek */ |
| 1028 | * Keep boot_ec struct as it will be needed soon. | 998 | if (saved_ec->command_addr != boot_ec->command_addr || |
| 1029 | */ | 999 | saved_ec->data_addr != boot_ec->data_addr || |
| 1030 | if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &dummy))) | 1000 | saved_ec->gpe != boot_ec->gpe || |
| 1031 | return -ENODEV; | 1001 | saved_ec->handle != boot_ec->handle) |
| 1002 | pr_info(PREFIX "ASUSTek keeps feeding us with broken " | ||
| 1003 | "ECDT tables, which are very hard to workaround. " | ||
| 1004 | "Trying to use DSDT EC info instead. Please send " | ||
| 1005 | "output of acpidump to linux-acpi@vger.kernel.org\n"); | ||
| 1006 | kfree(saved_ec); | ||
| 1007 | saved_ec = NULL; | ||
| 1008 | } else { | ||
| 1009 | /* We really need to limit this workaround, the only ASUS, | ||
| 1010 | * which needs it, has fake EC._INI method, so use it as flag. | ||
| 1011 | * Keep boot_ec struct as it will be needed soon. | ||
| 1012 | */ | ||
| 1013 | acpi_handle dummy; | ||
| 1014 | if (!dmi_name_in_vendors("ASUS") || | ||
| 1015 | ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", | ||
| 1016 | &dummy))) | ||
| 1017 | return -ENODEV; | ||
| 1018 | } | ||
| 1032 | install: | 1019 | install: |
| 1033 | if (!ec_install_handlers(boot_ec)) { | 1020 | if (!ec_install_handlers(boot_ec)) { |
| 1034 | first_ec = boot_ec; | 1021 | first_ec = boot_ec; |
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index adec3d15810a..5479b9f42513 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
| @@ -255,12 +255,12 @@ static int acpi_platform_notify(struct device *dev) | |||
| 255 | } | 255 | } |
| 256 | type = acpi_get_bus_type(dev->bus); | 256 | type = acpi_get_bus_type(dev->bus); |
| 257 | if (!type) { | 257 | if (!type) { |
| 258 | DBG("No ACPI bus support for %s\n", dev->bus_id); | 258 | DBG("No ACPI bus support for %s\n", dev_name(dev)); |
| 259 | ret = -EINVAL; | 259 | ret = -EINVAL; |
| 260 | goto end; | 260 | goto end; |
| 261 | } | 261 | } |
| 262 | if ((ret = type->find_device(dev, &handle)) != 0) | 262 | if ((ret = type->find_device(dev, &handle)) != 0) |
| 263 | DBG("Can't get handler for %s\n", dev->bus_id); | 263 | DBG("Can't get handler for %s\n", dev_name(dev)); |
| 264 | end: | 264 | end: |
| 265 | if (!ret) | 265 | if (!ret) |
| 266 | acpi_bind_one(dev, handle); | 266 | acpi_bind_one(dev, handle); |
| @@ -271,10 +271,10 @@ static int acpi_platform_notify(struct device *dev) | |||
| 271 | 271 | ||
| 272 | acpi_get_name(dev->archdata.acpi_handle, | 272 | acpi_get_name(dev->archdata.acpi_handle, |
| 273 | ACPI_FULL_PATHNAME, &buffer); | 273 | ACPI_FULL_PATHNAME, &buffer); |
| 274 | DBG("Device %s -> %s\n", dev->bus_id, (char *)buffer.pointer); | 274 | DBG("Device %s -> %s\n", dev_name(dev), (char *)buffer.pointer); |
| 275 | kfree(buffer.pointer); | 275 | kfree(buffer.pointer); |
| 276 | } else | 276 | } else |
| 277 | DBG("Device %s -> No ACPI support\n", dev->bus_id); | 277 | DBG("Device %s -> No ACPI support\n", dev_name(dev)); |
| 278 | #endif | 278 | #endif |
| 279 | 279 | ||
| 280 | return ret; | 280 | return ret; |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 6729a4992f2b..b3193ec0a2ef 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
| @@ -228,10 +228,10 @@ void acpi_os_vprintf(const char *fmt, va_list args) | |||
| 228 | if (acpi_in_debugger) { | 228 | if (acpi_in_debugger) { |
| 229 | kdb_printf("%s", buffer); | 229 | kdb_printf("%s", buffer); |
| 230 | } else { | 230 | } else { |
| 231 | printk("%s", buffer); | 231 | printk(KERN_CONT "%s", buffer); |
| 232 | } | 232 | } |
| 233 | #else | 233 | #else |
| 234 | printk("%s", buffer); | 234 | printk(KERN_CONT "%s", buffer); |
| 235 | #endif | 235 | #endif |
| 236 | } | 236 | } |
| 237 | 237 | ||
| @@ -1317,6 +1317,54 @@ acpi_os_validate_interface (char *interface) | |||
| 1317 | return AE_SUPPORT; | 1317 | return AE_SUPPORT; |
| 1318 | } | 1318 | } |
| 1319 | 1319 | ||
| 1320 | #ifdef CONFIG_X86 | ||
| 1321 | |||
| 1322 | struct aml_port_desc { | ||
| 1323 | uint start; | ||
| 1324 | uint end; | ||
| 1325 | char* name; | ||
| 1326 | char warned; | ||
| 1327 | }; | ||
| 1328 | |||
| 1329 | static struct aml_port_desc aml_invalid_port_list[] = { | ||
| 1330 | {0x20, 0x21, "PIC0", 0}, | ||
| 1331 | {0xA0, 0xA1, "PIC1", 0}, | ||
| 1332 | {0x4D0, 0x4D1, "ELCR", 0} | ||
| 1333 | }; | ||
| 1334 | |||
| 1335 | /* | ||
| 1336 | * valid_aml_io_address() | ||
| 1337 | * | ||
| 1338 | * if valid, return true | ||
| 1339 | * else invalid, warn once, return false | ||
| 1340 | */ | ||
| 1341 | static bool valid_aml_io_address(uint address, uint length) | ||
| 1342 | { | ||
| 1343 | int i; | ||
| 1344 | int entries = sizeof(aml_invalid_port_list) / sizeof(struct aml_port_desc); | ||
| 1345 | |||
| 1346 | for (i = 0; i < entries; ++i) { | ||
| 1347 | if ((address >= aml_invalid_port_list[i].start && | ||
| 1348 | address <= aml_invalid_port_list[i].end) || | ||
| 1349 | (address + length >= aml_invalid_port_list[i].start && | ||
| 1350 | address + length <= aml_invalid_port_list[i].end)) | ||
| 1351 | { | ||
| 1352 | if (!aml_invalid_port_list[i].warned) | ||
| 1353 | { | ||
| 1354 | printk(KERN_ERR "ACPI: Denied BIOS AML access" | ||
| 1355 | " to invalid port 0x%x+0x%x (%s)\n", | ||
| 1356 | address, length, | ||
| 1357 | aml_invalid_port_list[i].name); | ||
| 1358 | aml_invalid_port_list[i].warned = 1; | ||
| 1359 | } | ||
| 1360 | return false; /* invalid */ | ||
| 1361 | } | ||
| 1362 | } | ||
| 1363 | return true; /* valid */ | ||
| 1364 | } | ||
| 1365 | #else | ||
| 1366 | static inline bool valid_aml_io_address(uint address, uint length) { return true; } | ||
| 1367 | #endif | ||
| 1320 | /****************************************************************************** | 1368 | /****************************************************************************** |
| 1321 | * | 1369 | * |
| 1322 | * FUNCTION: acpi_os_validate_address | 1370 | * FUNCTION: acpi_os_validate_address |
| @@ -1346,6 +1394,8 @@ acpi_os_validate_address ( | |||
| 1346 | 1394 | ||
| 1347 | switch (space_id) { | 1395 | switch (space_id) { |
| 1348 | case ACPI_ADR_SPACE_SYSTEM_IO: | 1396 | case ACPI_ADR_SPACE_SYSTEM_IO: |
| 1397 | if (!valid_aml_io_address(address, length)) | ||
| 1398 | return AE_AML_ILLEGAL_ADDRESS; | ||
| 1349 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | 1399 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: |
| 1350 | /* Only interference checks against SystemIO and SytemMemory | 1400 | /* Only interference checks against SystemIO and SytemMemory |
| 1351 | are needed */ | 1401 | are needed */ |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 1c6e73c7865e..6c772ca76bd1 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
| @@ -593,7 +593,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
| 593 | return -ENODEV; | 593 | return -ENODEV; |
| 594 | } else { | 594 | } else { |
| 595 | acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; | 595 | acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; |
| 596 | printk(PREFIX "%s [%s] enabled at IRQ %d\n", | 596 | printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n", |
| 597 | acpi_device_name(link->device), | 597 | acpi_device_name(link->device), |
| 598 | acpi_device_bid(link->device), link->irq.active); | 598 | acpi_device_bid(link->device), link->irq.active); |
| 599 | } | 599 | } |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 66a9d8145562..7bc22a471fe3 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
| @@ -66,43 +66,17 @@ ACPI_MODULE_NAME("processor_idle"); | |||
| 66 | #define ACPI_PROCESSOR_FILE_POWER "power" | 66 | #define ACPI_PROCESSOR_FILE_POWER "power" |
| 67 | #define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) | 67 | #define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) |
| 68 | #define PM_TIMER_TICK_NS (1000000000ULL/PM_TIMER_FREQUENCY) | 68 | #define PM_TIMER_TICK_NS (1000000000ULL/PM_TIMER_FREQUENCY) |
| 69 | #ifndef CONFIG_CPU_IDLE | ||
| 70 | #define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ | ||
| 71 | #define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ | ||
| 72 | static void (*pm_idle_save) (void) __read_mostly; | ||
| 73 | #else | ||
| 74 | #define C2_OVERHEAD 1 /* 1us */ | 69 | #define C2_OVERHEAD 1 /* 1us */ |
| 75 | #define C3_OVERHEAD 1 /* 1us */ | 70 | #define C3_OVERHEAD 1 /* 1us */ |
| 76 | #endif | ||
| 77 | #define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000)) | 71 | #define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000)) |
| 78 | 72 | ||
| 79 | static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; | 73 | static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; |
| 80 | #ifdef CONFIG_CPU_IDLE | ||
| 81 | module_param(max_cstate, uint, 0000); | 74 | module_param(max_cstate, uint, 0000); |
| 82 | #else | ||
| 83 | module_param(max_cstate, uint, 0644); | ||
| 84 | #endif | ||
| 85 | static unsigned int nocst __read_mostly; | 75 | static unsigned int nocst __read_mostly; |
| 86 | module_param(nocst, uint, 0000); | 76 | module_param(nocst, uint, 0000); |
| 87 | 77 | ||
| 88 | #ifndef CONFIG_CPU_IDLE | ||
| 89 | /* | ||
| 90 | * bm_history -- bit-mask with a bit per jiffy of bus-master activity | ||
| 91 | * 1000 HZ: 0xFFFFFFFF: 32 jiffies = 32ms | ||
| 92 | * 800 HZ: 0xFFFFFFFF: 32 jiffies = 40ms | ||
| 93 | * 100 HZ: 0x0000000F: 4 jiffies = 40ms | ||
| 94 | * reduce history for more aggressive entry into C3 | ||
| 95 | */ | ||
| 96 | static unsigned int bm_history __read_mostly = | ||
| 97 | (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1)); | ||
| 98 | module_param(bm_history, uint, 0644); | ||
| 99 | |||
| 100 | static int acpi_processor_set_power_policy(struct acpi_processor *pr); | ||
| 101 | |||
| 102 | #else /* CONFIG_CPU_IDLE */ | ||
| 103 | static unsigned int latency_factor __read_mostly = 2; | 78 | static unsigned int latency_factor __read_mostly = 2; |
| 104 | module_param(latency_factor, uint, 0644); | 79 | module_param(latency_factor, uint, 0644); |
| 105 | #endif | ||
| 106 | 80 | ||
| 107 | /* | 81 | /* |
| 108 | * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3. | 82 | * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3. |
| @@ -224,71 +198,6 @@ static void acpi_safe_halt(void) | |||
| 224 | current_thread_info()->status |= TS_POLLING; | 198 | current_thread_info()->status |= TS_POLLING; |
| 225 | } | 199 | } |
| 226 | 200 | ||
| 227 | #ifndef CONFIG_CPU_IDLE | ||
| 228 | |||
| 229 | static void | ||
| 230 | acpi_processor_power_activate(struct acpi_processor *pr, | ||
| 231 | struct acpi_processor_cx *new) | ||
| 232 | { | ||
| 233 | struct acpi_processor_cx *old; | ||
| 234 | |||
| 235 | if (!pr || !new) | ||
| 236 | return; | ||
| 237 | |||
| 238 | old = pr->power.state; | ||
| 239 | |||
| 240 | if (old) | ||
| 241 | old->promotion.count = 0; | ||
| 242 | new->demotion.count = 0; | ||
| 243 | |||
| 244 | /* Cleanup from old state. */ | ||
| 245 | if (old) { | ||
| 246 | switch (old->type) { | ||
| 247 | case ACPI_STATE_C3: | ||
| 248 | /* Disable bus master reload */ | ||
| 249 | if (new->type != ACPI_STATE_C3 && pr->flags.bm_check) | ||
| 250 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0); | ||
| 251 | break; | ||
| 252 | } | ||
| 253 | } | ||
| 254 | |||
| 255 | /* Prepare to use new state. */ | ||
| 256 | switch (new->type) { | ||
| 257 | case ACPI_STATE_C3: | ||
| 258 | /* Enable bus master reload */ | ||
| 259 | if (old->type != ACPI_STATE_C3 && pr->flags.bm_check) | ||
| 260 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1); | ||
| 261 | break; | ||
| 262 | } | ||
| 263 | |||
| 264 | pr->power.state = new; | ||
| 265 | |||
| 266 | return; | ||
| 267 | } | ||
| 268 | |||
| 269 | static atomic_t c3_cpu_count; | ||
| 270 | |||
| 271 | /* Common C-state entry for C2, C3, .. */ | ||
| 272 | static void acpi_cstate_enter(struct acpi_processor_cx *cstate) | ||
| 273 | { | ||
| 274 | /* Don't trace irqs off for idle */ | ||
| 275 | stop_critical_timings(); | ||
| 276 | if (cstate->entry_method == ACPI_CSTATE_FFH) { | ||
| 277 | /* Call into architectural FFH based C-state */ | ||
| 278 | acpi_processor_ffh_cstate_enter(cstate); | ||
| 279 | } else { | ||
| 280 | int unused; | ||
| 281 | /* IO port based C-state */ | ||
| 282 | inb(cstate->address); | ||
| 283 | /* Dummy wait op - must do something useless after P_LVL2 read | ||
| 284 | because chipsets cannot guarantee that STPCLK# signal | ||
| 285 | gets asserted in time to freeze execution properly. */ | ||
| 286 | unused = inl(acpi_gbl_FADT.xpm_timer_block.address); | ||
| 287 | } | ||
| 288 | start_critical_timings(); | ||
| 289 | } | ||
| 290 | #endif /* !CONFIG_CPU_IDLE */ | ||
| 291 | |||
| 292 | #ifdef ARCH_APICTIMER_STOPS_ON_C3 | 201 | #ifdef ARCH_APICTIMER_STOPS_ON_C3 |
| 293 | 202 | ||
| 294 | /* | 203 | /* |
| @@ -390,421 +299,6 @@ static int tsc_halts_in_c(int state) | |||
| 390 | } | 299 | } |
| 391 | #endif | 300 | #endif |
| 392 | 301 | ||
| 393 | #ifndef CONFIG_CPU_IDLE | ||
| 394 | static void acpi_processor_idle(void) | ||
| 395 | { | ||
| 396 | struct acpi_processor *pr = NULL; | ||
| 397 | struct acpi_processor_cx *cx = NULL; | ||
| 398 | struct acpi_processor_cx *next_state = NULL; | ||
| 399 | int sleep_ticks = 0; | ||
| 400 | u32 t1, t2 = 0; | ||
| 401 | |||
| 402 | /* | ||
| 403 | * Interrupts must be disabled during bus mastering calculations and | ||
| 404 | * for C2/C3 transitions. | ||
| 405 | */ | ||
| 406 | local_irq_disable(); | ||
| 407 | |||
| 408 | pr = __get_cpu_var(processors); | ||
| 409 | if (!pr) { | ||
| 410 | local_irq_enable(); | ||
| 411 | return; | ||
| 412 | } | ||
| 413 | |||
| 414 | /* | ||
| 415 | * Check whether we truly need to go idle, or should | ||
| 416 | * reschedule: | ||
| 417 | */ | ||
| 418 | if (unlikely(need_resched())) { | ||
| 419 | local_irq_enable(); | ||
| 420 | return; | ||
| 421 | } | ||
| 422 | |||
| 423 | cx = pr->power.state; | ||
| 424 | if (!cx || acpi_idle_suspend) { | ||
| 425 | if (pm_idle_save) { | ||
| 426 | pm_idle_save(); /* enables IRQs */ | ||
| 427 | } else { | ||
| 428 | acpi_safe_halt(); | ||
| 429 | local_irq_enable(); | ||
| 430 | } | ||
| 431 | |||
| 432 | return; | ||
| 433 | } | ||
| 434 | |||
| 435 | /* | ||
| 436 | * Check BM Activity | ||
| 437 | * ----------------- | ||
| 438 | * Check for bus mastering activity (if required), record, and check | ||
| 439 | * for demotion. | ||
| 440 | */ | ||
| 441 | if (pr->flags.bm_check) { | ||
| 442 | u32 bm_status = 0; | ||
| 443 | unsigned long diff = jiffies - pr->power.bm_check_timestamp; | ||
| 444 | |||
| 445 | if (diff > 31) | ||
| 446 | diff = 31; | ||
| 447 | |||
| 448 | pr->power.bm_activity <<= diff; | ||
| 449 | |||
| 450 | acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status); | ||
| 451 | if (bm_status) { | ||
| 452 | pr->power.bm_activity |= 0x1; | ||
| 453 | acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1); | ||
| 454 | } | ||
| 455 | /* | ||
| 456 | * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect | ||
| 457 | * the true state of bus mastering activity; forcing us to | ||
| 458 | * manually check the BMIDEA bit of each IDE channel. | ||
| 459 | */ | ||
| 460 | else if (errata.piix4.bmisx) { | ||
| 461 | if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01) | ||
| 462 | || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01)) | ||
| 463 | pr->power.bm_activity |= 0x1; | ||
| 464 | } | ||
| 465 | |||
| 466 | pr->power.bm_check_timestamp = jiffies; | ||
| 467 | |||
| 468 | /* | ||
| 469 | * If bus mastering is or was active this jiffy, demote | ||
| 470 | * to avoid a faulty transition. Note that the processor | ||
| 471 | * won't enter a low-power state during this call (to this | ||
| 472 | * function) but should upon the next. | ||
| 473 | * | ||
| 474 | * TBD: A better policy might be to fallback to the demotion | ||
| 475 | * state (use it for this quantum only) istead of | ||
| 476 | * demoting -- and rely on duration as our sole demotion | ||
| 477 | * qualification. This may, however, introduce DMA | ||
| 478 | * issues (e.g. floppy DMA transfer overrun/underrun). | ||
| 479 | */ | ||
| 480 | if ((pr->power.bm_activity & 0x1) && | ||
| 481 | cx->demotion.threshold.bm) { | ||
| 482 | local_irq_enable(); | ||
| 483 | next_state = cx->demotion.state; | ||
| 484 | goto end; | ||
| 485 | } | ||
| 486 | } | ||
| 487 | |||
| 488 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 489 | /* | ||
| 490 | * Check for P_LVL2_UP flag before entering C2 and above on | ||
| 491 | * an SMP system. We do it here instead of doing it at _CST/P_LVL | ||
| 492 | * detection phase, to work cleanly with logical CPU hotplug. | ||
| 493 | */ | ||
| 494 | if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && | ||
| 495 | !pr->flags.has_cst && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) | ||
| 496 | cx = &pr->power.states[ACPI_STATE_C1]; | ||
| 497 | #endif | ||
| 498 | |||
| 499 | /* | ||
| 500 | * Sleep: | ||
| 501 | * ------ | ||
| 502 | * Invoke the current Cx state to put the processor to sleep. | ||
| 503 | */ | ||
| 504 | if (cx->type == ACPI_STATE_C2 || cx->type == ACPI_STATE_C3) { | ||
| 505 | current_thread_info()->status &= ~TS_POLLING; | ||
| 506 | /* | ||
| 507 | * TS_POLLING-cleared state must be visible before we | ||
| 508 | * test NEED_RESCHED: | ||
| 509 | */ | ||
| 510 | smp_mb(); | ||
| 511 | if (need_resched()) { | ||
| 512 | current_thread_info()->status |= TS_POLLING; | ||
| 513 | local_irq_enable(); | ||
| 514 | return; | ||
| 515 | } | ||
| 516 | } | ||
| 517 | |||
| 518 | switch (cx->type) { | ||
| 519 | |||
| 520 | case ACPI_STATE_C1: | ||
| 521 | /* | ||
| 522 | * Invoke C1. | ||
| 523 | * Use the appropriate idle routine, the one that would | ||
| 524 | * be used without acpi C-states. | ||
| 525 | */ | ||
| 526 | if (pm_idle_save) { | ||
| 527 | pm_idle_save(); /* enables IRQs */ | ||
| 528 | } else { | ||
| 529 | acpi_safe_halt(); | ||
| 530 | local_irq_enable(); | ||
| 531 | } | ||
| 532 | |||
| 533 | /* | ||
| 534 | * TBD: Can't get time duration while in C1, as resumes | ||
| 535 | * go to an ISR rather than here. Need to instrument | ||
| 536 | * base interrupt handler. | ||
| 537 | * | ||
| 538 | * Note: the TSC better not stop in C1, sched_clock() will | ||
| 539 | * skew otherwise. | ||
| 540 | */ | ||
| 541 | sleep_ticks = 0xFFFFFFFF; | ||
| 542 | |||
| 543 | break; | ||
| 544 | |||
| 545 | case ACPI_STATE_C2: | ||
| 546 | /* Get start time (ticks) */ | ||
| 547 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | ||
| 548 | /* Tell the scheduler that we are going deep-idle: */ | ||
| 549 | sched_clock_idle_sleep_event(); | ||
| 550 | /* Invoke C2 */ | ||
| 551 | acpi_state_timer_broadcast(pr, cx, 1); | ||
| 552 | acpi_cstate_enter(cx); | ||
| 553 | /* Get end time (ticks) */ | ||
| 554 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | ||
| 555 | |||
| 556 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) | ||
| 557 | /* TSC halts in C2, so notify users */ | ||
| 558 | if (tsc_halts_in_c(ACPI_STATE_C2)) | ||
| 559 | mark_tsc_unstable("possible TSC halt in C2"); | ||
| 560 | #endif | ||
| 561 | /* Compute time (ticks) that we were actually asleep */ | ||
| 562 | sleep_ticks = ticks_elapsed(t1, t2); | ||
| 563 | |||
| 564 | /* Tell the scheduler how much we idled: */ | ||
| 565 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | ||
| 566 | |||
| 567 | /* Re-enable interrupts */ | ||
| 568 | local_irq_enable(); | ||
| 569 | /* Do not account our idle-switching overhead: */ | ||
| 570 | sleep_ticks -= cx->latency_ticks + C2_OVERHEAD; | ||
| 571 | |||
| 572 | current_thread_info()->status |= TS_POLLING; | ||
| 573 | acpi_state_timer_broadcast(pr, cx, 0); | ||
| 574 | break; | ||
| 575 | |||
| 576 | case ACPI_STATE_C3: | ||
| 577 | acpi_unlazy_tlb(smp_processor_id()); | ||
| 578 | /* | ||
| 579 | * Must be done before busmaster disable as we might | ||
| 580 | * need to access HPET ! | ||
| 581 | */ | ||
| 582 | acpi_state_timer_broadcast(pr, cx, 1); | ||
| 583 | /* | ||
| 584 | * disable bus master | ||
| 585 | * bm_check implies we need ARB_DIS | ||
| 586 | * !bm_check implies we need cache flush | ||
| 587 | * bm_control implies whether we can do ARB_DIS | ||
| 588 | * | ||
| 589 | * That leaves a case where bm_check is set and bm_control is | ||
| 590 | * not set. In that case we cannot do much, we enter C3 | ||
| 591 | * without doing anything. | ||
| 592 | */ | ||
| 593 | if (pr->flags.bm_check && pr->flags.bm_control) { | ||
| 594 | if (atomic_inc_return(&c3_cpu_count) == | ||
| 595 | num_online_cpus()) { | ||
| 596 | /* | ||
| 597 | * All CPUs are trying to go to C3 | ||
| 598 | * Disable bus master arbitration | ||
| 599 | */ | ||
| 600 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); | ||
| 601 | } | ||
| 602 | } else if (!pr->flags.bm_check) { | ||
| 603 | /* SMP with no shared cache... Invalidate cache */ | ||
| 604 | ACPI_FLUSH_CPU_CACHE(); | ||
| 605 | } | ||
| 606 | |||
| 607 | /* Get start time (ticks) */ | ||
| 608 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | ||
| 609 | /* Invoke C3 */ | ||
| 610 | /* Tell the scheduler that we are going deep-idle: */ | ||
| 611 | sched_clock_idle_sleep_event(); | ||
| 612 | acpi_cstate_enter(cx); | ||
| 613 | /* Get end time (ticks) */ | ||
| 614 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | ||
| 615 | if (pr->flags.bm_check && pr->flags.bm_control) { | ||
| 616 | /* Enable bus master arbitration */ | ||
| 617 | atomic_dec(&c3_cpu_count); | ||
| 618 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); | ||
| 619 | } | ||
| 620 | |||
| 621 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) | ||
| 622 | /* TSC halts in C3, so notify users */ | ||
| 623 | if (tsc_halts_in_c(ACPI_STATE_C3)) | ||
| 624 | mark_tsc_unstable("TSC halts in C3"); | ||
| 625 | #endif | ||
| 626 | /* Compute time (ticks) that we were actually asleep */ | ||
| 627 | sleep_ticks = ticks_elapsed(t1, t2); | ||
| 628 | /* Tell the scheduler how much we idled: */ | ||
| 629 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | ||
| 630 | |||
| 631 | /* Re-enable interrupts */ | ||
| 632 | local_irq_enable(); | ||
| 633 | /* Do not account our idle-switching overhead: */ | ||
| 634 | sleep_ticks -= cx->latency_ticks + C3_OVERHEAD; | ||
| 635 | |||
| 636 | current_thread_info()->status |= TS_POLLING; | ||
| 637 | acpi_state_timer_broadcast(pr, cx, 0); | ||
| 638 | break; | ||
| 639 | |||
| 640 | default: | ||
| 641 | local_irq_enable(); | ||
| 642 | return; | ||
| 643 | } | ||
| 644 | cx->usage++; | ||
| 645 | if ((cx->type != ACPI_STATE_C1) && (sleep_ticks > 0)) | ||
| 646 | cx->time += sleep_ticks; | ||
| 647 | |||
| 648 | next_state = pr->power.state; | ||
| 649 | |||
| 650 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 651 | /* Don't do promotion/demotion */ | ||
| 652 | if ((cx->type == ACPI_STATE_C1) && (num_online_cpus() > 1) && | ||
| 653 | !pr->flags.has_cst && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) { | ||
| 654 | next_state = cx; | ||
| 655 | goto end; | ||
| 656 | } | ||
| 657 | #endif | ||
| 658 | |||
| 659 | /* | ||
| 660 | * Promotion? | ||
| 661 | * ---------- | ||
| 662 | * Track the number of longs (time asleep is greater than threshold) | ||
| 663 | * and promote when the count threshold is reached. Note that bus | ||
| 664 | * mastering activity may prevent promotions. | ||
| 665 | * Do not promote above max_cstate. | ||
| 666 | */ | ||
| 667 | if (cx->promotion.state && | ||
| 668 | ((cx->promotion.state - pr->power.states) <= max_cstate)) { | ||
| 669 | if (sleep_ticks > cx->promotion.threshold.ticks && | ||
| 670 | cx->promotion.state->latency <= | ||
| 671 | pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)) { | ||
| 672 | cx->promotion.count++; | ||
| 673 | cx->demotion.count = 0; | ||
| 674 | if (cx->promotion.count >= | ||
| 675 | cx->promotion.threshold.count) { | ||
| 676 | if (pr->flags.bm_check) { | ||
| 677 | if (! | ||
| 678 | (pr->power.bm_activity & cx-> | ||
| 679 | promotion.threshold.bm)) { | ||
| 680 | next_state = | ||
| 681 | cx->promotion.state; | ||
| 682 | goto end; | ||
| 683 | } | ||
| 684 | } else { | ||
| 685 | next_state = cx->promotion.state; | ||
| 686 | goto end; | ||
| 687 | } | ||
| 688 | } | ||
| 689 | } | ||
| 690 | } | ||
| 691 | |||
| 692 | /* | ||
| 693 | * Demotion? | ||
| 694 | * --------- | ||
| 695 | * Track the number of shorts (time asleep is less than time threshold) | ||
| 696 | * and demote when the usage threshold is reached. | ||
| 697 | */ | ||
| 698 | if (cx->demotion.state) { | ||
| 699 | if (sleep_ticks < cx->demotion.threshold.ticks) { | ||
| 700 | cx->demotion.count++; | ||
| 701 | cx->promotion.count = 0; | ||
| 702 | if (cx->demotion.count >= cx->demotion.threshold.count) { | ||
| 703 | next_state = cx->demotion.state; | ||
| 704 | goto end; | ||
| 705 | } | ||
| 706 | } | ||
| 707 | } | ||
| 708 | |||
| 709 | end: | ||
| 710 | /* | ||
| 711 | * Demote if current state exceeds max_cstate | ||
| 712 | * or if the latency of the current state is unacceptable | ||
| 713 | */ | ||
| 714 | if ((pr->power.state - pr->power.states) > max_cstate || | ||
| 715 | pr->power.state->latency > | ||
| 716 | pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)) { | ||
| 717 | if (cx->demotion.state) | ||
| 718 | next_state = cx->demotion.state; | ||
| 719 | } | ||
| 720 | |||
| 721 | /* | ||
| 722 | * New Cx State? | ||
| 723 | * ------------- | ||
| 724 | * If we're going to start using a new Cx state we must clean up | ||
| 725 | * from the previous and prepare to use the new. | ||
| 726 | */ | ||
| 727 | if (next_state != pr->power.state) | ||
| 728 | acpi_processor_power_activate(pr, next_state); | ||
| 729 | } | ||
| 730 | |||
| 731 | static int acpi_processor_set_power_policy(struct acpi_processor *pr) | ||
| 732 | { | ||
| 733 | unsigned int i; | ||
| 734 | unsigned int state_is_set = 0; | ||
| 735 | struct acpi_processor_cx *lower = NULL; | ||
| 736 | struct acpi_processor_cx *higher = NULL; | ||
| 737 | struct acpi_processor_cx *cx; | ||
| 738 | |||
| 739 | |||
| 740 | if (!pr) | ||
| 741 | return -EINVAL; | ||
| 742 | |||
| 743 | /* | ||
| 744 | * This function sets the default Cx state policy (OS idle handler). | ||
| 745 | * Our scheme is to promote quickly to C2 but more conservatively | ||
| 746 | * to C3. We're favoring C2 for its characteristics of low latency | ||
| 747 | * (quick response), good power savings, and ability to allow bus | ||
| 748 | * mastering activity. Note that the Cx state policy is completely | ||
| 749 | * customizable and can be altered dynamically. | ||
| 750 | */ | ||
| 751 | |||
| 752 | /* startup state */ | ||
| 753 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { | ||
| 754 | cx = &pr->power.states[i]; | ||
| 755 | if (!cx->valid) | ||
| 756 | continue; | ||
| 757 | |||
| 758 | if (!state_is_set) | ||
| 759 | pr->power.state = cx; | ||
| 760 | state_is_set++; | ||
| 761 | break; | ||
| 762 | } | ||
| 763 | |||
| 764 | if (!state_is_set) | ||
| 765 | return -ENODEV; | ||
| 766 | |||
| 767 | /* demotion */ | ||
| 768 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { | ||
| 769 | cx = &pr->power.states[i]; | ||
| 770 | if (!cx->valid) | ||
| 771 | continue; | ||
| 772 | |||
| 773 | if (lower) { | ||
| 774 | cx->demotion.state = lower; | ||
| 775 | cx->demotion.threshold.ticks = cx->latency_ticks; | ||
| 776 | cx->demotion.threshold.count = 1; | ||
| 777 | if (cx->type == ACPI_STATE_C3) | ||
| 778 | cx->demotion.threshold.bm = bm_history; | ||
| 779 | } | ||
| 780 | |||
| 781 | lower = cx; | ||
| 782 | } | ||
| 783 | |||
| 784 | /* promotion */ | ||
| 785 | for (i = (ACPI_PROCESSOR_MAX_POWER - 1); i > 0; i--) { | ||
| 786 | cx = &pr->power.states[i]; | ||
| 787 | if (!cx->valid) | ||
| 788 | continue; | ||
| 789 | |||
| 790 | if (higher) { | ||
| 791 | cx->promotion.state = higher; | ||
| 792 | cx->promotion.threshold.ticks = cx->latency_ticks; | ||
| 793 | if (cx->type >= ACPI_STATE_C2) | ||
| 794 | cx->promotion.threshold.count = 4; | ||
| 795 | else | ||
| 796 | cx->promotion.threshold.count = 10; | ||
| 797 | if (higher->type == ACPI_STATE_C3) | ||
| 798 | cx->promotion.threshold.bm = bm_history; | ||
| 799 | } | ||
| 800 | |||
| 801 | higher = cx; | ||
| 802 | } | ||
| 803 | |||
| 804 | return 0; | ||
| 805 | } | ||
| 806 | #endif /* !CONFIG_CPU_IDLE */ | ||
| 807 | |||
| 808 | static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) | 302 | static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) |
| 809 | { | 303 | { |
| 810 | 304 | ||
| @@ -1047,11 +541,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) | |||
| 1047 | */ | 541 | */ |
| 1048 | cx->valid = 1; | 542 | cx->valid = 1; |
| 1049 | 543 | ||
| 1050 | #ifndef CONFIG_CPU_IDLE | ||
| 1051 | cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); | ||
| 1052 | #else | ||
| 1053 | cx->latency_ticks = cx->latency; | 544 | cx->latency_ticks = cx->latency; |
| 1054 | #endif | ||
| 1055 | 545 | ||
| 1056 | return; | 546 | return; |
| 1057 | } | 547 | } |
| @@ -1121,7 +611,6 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | |||
| 1121 | " for C3 to be enabled on SMP systems\n")); | 611 | " for C3 to be enabled on SMP systems\n")); |
| 1122 | return; | 612 | return; |
| 1123 | } | 613 | } |
| 1124 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0); | ||
| 1125 | } | 614 | } |
| 1126 | 615 | ||
| 1127 | /* | 616 | /* |
| @@ -1132,11 +621,16 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | |||
| 1132 | */ | 621 | */ |
| 1133 | cx->valid = 1; | 622 | cx->valid = 1; |
| 1134 | 623 | ||
| 1135 | #ifndef CONFIG_CPU_IDLE | ||
| 1136 | cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); | ||
| 1137 | #else | ||
| 1138 | cx->latency_ticks = cx->latency; | 624 | cx->latency_ticks = cx->latency; |
| 1139 | #endif | 625 | /* |
| 626 | * On older chipsets, BM_RLD needs to be set | ||
| 627 | * in order for Bus Master activity to wake the | ||
| 628 | * system from C3. Newer chipsets handle DMA | ||
| 629 | * during C3 automatically and BM_RLD is a NOP. | ||
| 630 | * In either case, the proper way to | ||
| 631 | * handle BM_RLD is to set it and leave it set. | ||
| 632 | */ | ||
| 633 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1); | ||
| 1140 | 634 | ||
| 1141 | return; | 635 | return; |
| 1142 | } | 636 | } |
| @@ -1201,20 +695,6 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) | |||
| 1201 | 695 | ||
| 1202 | pr->power.count = acpi_processor_power_verify(pr); | 696 | pr->power.count = acpi_processor_power_verify(pr); |
| 1203 | 697 | ||
| 1204 | #ifndef CONFIG_CPU_IDLE | ||
| 1205 | /* | ||
| 1206 | * Set Default Policy | ||
| 1207 | * ------------------ | ||
| 1208 | * Now that we know which states are supported, set the default | ||
| 1209 | * policy. Note that this policy can be changed dynamically | ||
| 1210 | * (e.g. encourage deeper sleeps to conserve battery life when | ||
| 1211 | * not on AC). | ||
| 1212 | */ | ||
| 1213 | result = acpi_processor_set_power_policy(pr); | ||
| 1214 | if (result) | ||
| 1215 | return result; | ||
| 1216 | #endif | ||
| 1217 | |||
| 1218 | /* | 698 | /* |
| 1219 | * if one state of type C2 or C3 is available, mark this | 699 | * if one state of type C2 or C3 is available, mark this |
| 1220 | * CPU as being "idle manageable" | 700 | * CPU as being "idle manageable" |
| @@ -1312,69 +792,6 @@ static const struct file_operations acpi_processor_power_fops = { | |||
| 1312 | .release = single_release, | 792 | .release = single_release, |
| 1313 | }; | 793 | }; |
| 1314 | 794 | ||
| 1315 | #ifndef CONFIG_CPU_IDLE | ||
| 1316 | |||
| 1317 | int acpi_processor_cst_has_changed(struct acpi_processor *pr) | ||
| 1318 | { | ||
| 1319 | int result = 0; | ||
| 1320 | |||
| 1321 | if (boot_option_idle_override) | ||
| 1322 | return 0; | ||
| 1323 | |||
| 1324 | if (!pr) | ||
| 1325 | return -EINVAL; | ||
| 1326 | |||
| 1327 | if (nocst) { | ||
| 1328 | return -ENODEV; | ||
| 1329 | } | ||
| 1330 | |||
| 1331 | if (!pr->flags.power_setup_done) | ||
| 1332 | return -ENODEV; | ||
| 1333 | |||
| 1334 | /* | ||
| 1335 | * Fall back to the default idle loop, when pm_idle_save had | ||
| 1336 | * been initialized. | ||
| 1337 | */ | ||
| 1338 | if (pm_idle_save) { | ||
| 1339 | pm_idle = pm_idle_save; | ||
| 1340 | /* Relies on interrupts forcing exit from idle. */ | ||
| 1341 | synchronize_sched(); | ||
| 1342 | } | ||
| 1343 | |||
| 1344 | pr->flags.power = 0; | ||
| 1345 | result = acpi_processor_get_power_info(pr); | ||
| 1346 | if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) | ||
| 1347 | pm_idle = acpi_processor_idle; | ||
| 1348 | |||
| 1349 | return result; | ||
| 1350 | } | ||
| 1351 | |||
| 1352 | #ifdef CONFIG_SMP | ||
| 1353 | static void smp_callback(void *v) | ||
| 1354 | { | ||
| 1355 | /* we already woke the CPU up, nothing more to do */ | ||
| 1356 | } | ||
| 1357 | |||
| 1358 | /* | ||
| 1359 | * This function gets called when a part of the kernel has a new latency | ||
| 1360 | * requirement. This means we need to get all processors out of their C-state, | ||
| 1361 | * and then recalculate a new suitable C-state. Just do a cross-cpu IPI; that | ||
| 1362 | * wakes them all right up. | ||
| 1363 | */ | ||
| 1364 | static int acpi_processor_latency_notify(struct notifier_block *b, | ||
| 1365 | unsigned long l, void *v) | ||
| 1366 | { | ||
| 1367 | smp_call_function(smp_callback, NULL, 1); | ||
| 1368 | return NOTIFY_OK; | ||
| 1369 | } | ||
| 1370 | |||
| 1371 | static struct notifier_block acpi_processor_latency_notifier = { | ||
| 1372 | .notifier_call = acpi_processor_latency_notify, | ||
| 1373 | }; | ||
| 1374 | |||
| 1375 | #endif | ||
| 1376 | |||
| 1377 | #else /* CONFIG_CPU_IDLE */ | ||
| 1378 | 795 | ||
| 1379 | /** | 796 | /** |
| 1380 | * acpi_idle_bm_check - checks if bus master activity was detected | 797 | * acpi_idle_bm_check - checks if bus master activity was detected |
| @@ -1383,7 +800,7 @@ static int acpi_idle_bm_check(void) | |||
| 1383 | { | 800 | { |
| 1384 | u32 bm_status = 0; | 801 | u32 bm_status = 0; |
| 1385 | 802 | ||
| 1386 | acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status); | 803 | acpi_get_register_unlocked(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status); |
| 1387 | if (bm_status) | 804 | if (bm_status) |
| 1388 | acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1); | 805 | acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1); |
| 1389 | /* | 806 | /* |
| @@ -1400,25 +817,6 @@ static int acpi_idle_bm_check(void) | |||
| 1400 | } | 817 | } |
| 1401 | 818 | ||
| 1402 | /** | 819 | /** |
| 1403 | * acpi_idle_update_bm_rld - updates the BM_RLD bit depending on target state | ||
| 1404 | * @pr: the processor | ||
| 1405 | * @target: the new target state | ||
| 1406 | */ | ||
| 1407 | static inline void acpi_idle_update_bm_rld(struct acpi_processor *pr, | ||
| 1408 | struct acpi_processor_cx *target) | ||
| 1409 | { | ||
| 1410 | if (pr->flags.bm_rld_set && target->type != ACPI_STATE_C3) { | ||
| 1411 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0); | ||
| 1412 | pr->flags.bm_rld_set = 0; | ||
| 1413 | } | ||
| 1414 | |||
| 1415 | if (!pr->flags.bm_rld_set && target->type == ACPI_STATE_C3) { | ||
| 1416 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1); | ||
| 1417 | pr->flags.bm_rld_set = 1; | ||
| 1418 | } | ||
| 1419 | } | ||
| 1420 | |||
| 1421 | /** | ||
| 1422 | * acpi_idle_do_entry - a helper function that does C2 and C3 type entry | 820 | * acpi_idle_do_entry - a helper function that does C2 and C3 type entry |
| 1423 | * @cx: cstate data | 821 | * @cx: cstate data |
| 1424 | * | 822 | * |
| @@ -1473,9 +871,6 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
| 1473 | return 0; | 871 | return 0; |
| 1474 | } | 872 | } |
| 1475 | 873 | ||
| 1476 | if (pr->flags.bm_check) | ||
| 1477 | acpi_idle_update_bm_rld(pr, cx); | ||
| 1478 | |||
| 1479 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 874 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
| 1480 | acpi_idle_do_entry(cx); | 875 | acpi_idle_do_entry(cx); |
| 1481 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 876 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
| @@ -1527,9 +922,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
| 1527 | */ | 922 | */ |
| 1528 | acpi_state_timer_broadcast(pr, cx, 1); | 923 | acpi_state_timer_broadcast(pr, cx, 1); |
| 1529 | 924 | ||
| 1530 | if (pr->flags.bm_check) | ||
| 1531 | acpi_idle_update_bm_rld(pr, cx); | ||
| 1532 | |||
| 1533 | if (cx->type == ACPI_STATE_C3) | 925 | if (cx->type == ACPI_STATE_C3) |
| 1534 | ACPI_FLUSH_CPU_CACHE(); | 926 | ACPI_FLUSH_CPU_CACHE(); |
| 1535 | 927 | ||
| @@ -1621,8 +1013,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
| 1621 | */ | 1013 | */ |
| 1622 | acpi_state_timer_broadcast(pr, cx, 1); | 1014 | acpi_state_timer_broadcast(pr, cx, 1); |
| 1623 | 1015 | ||
| 1624 | acpi_idle_update_bm_rld(pr, cx); | ||
| 1625 | |||
| 1626 | /* | 1016 | /* |
| 1627 | * disable bus master | 1017 | * disable bus master |
| 1628 | * bm_check implies we need ARB_DIS | 1018 | * bm_check implies we need ARB_DIS |
| @@ -1795,8 +1185,6 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
| 1795 | return ret; | 1185 | return ret; |
| 1796 | } | 1186 | } |
| 1797 | 1187 | ||
| 1798 | #endif /* CONFIG_CPU_IDLE */ | ||
| 1799 | |||
| 1800 | int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | 1188 | int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, |
| 1801 | struct acpi_device *device) | 1189 | struct acpi_device *device) |
| 1802 | { | 1190 | { |
| @@ -1825,10 +1213,6 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | |||
| 1825 | "ACPI: processor limited to max C-state %d\n", | 1213 | "ACPI: processor limited to max C-state %d\n", |
| 1826 | max_cstate); | 1214 | max_cstate); |
| 1827 | first_run++; | 1215 | first_run++; |
| 1828 | #if !defined(CONFIG_CPU_IDLE) && defined(CONFIG_SMP) | ||
| 1829 | pm_qos_add_notifier(PM_QOS_CPU_DMA_LATENCY, | ||
| 1830 | &acpi_processor_latency_notifier); | ||
| 1831 | #endif | ||
| 1832 | } | 1216 | } |
| 1833 | 1217 | ||
| 1834 | if (!pr) | 1218 | if (!pr) |
| @@ -1852,11 +1236,9 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | |||
| 1852 | * platforms that only support C1. | 1236 | * platforms that only support C1. |
| 1853 | */ | 1237 | */ |
| 1854 | if (pr->flags.power) { | 1238 | if (pr->flags.power) { |
| 1855 | #ifdef CONFIG_CPU_IDLE | ||
| 1856 | acpi_processor_setup_cpuidle(pr); | 1239 | acpi_processor_setup_cpuidle(pr); |
| 1857 | if (cpuidle_register_device(&pr->power.dev)) | 1240 | if (cpuidle_register_device(&pr->power.dev)) |
| 1858 | return -EIO; | 1241 | return -EIO; |
| 1859 | #endif | ||
| 1860 | 1242 | ||
| 1861 | printk(KERN_INFO PREFIX "CPU%d (power states:", pr->id); | 1243 | printk(KERN_INFO PREFIX "CPU%d (power states:", pr->id); |
| 1862 | for (i = 1; i <= pr->power.count; i++) | 1244 | for (i = 1; i <= pr->power.count; i++) |
| @@ -1864,13 +1246,6 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | |||
| 1864 | printk(" C%d[C%d]", i, | 1246 | printk(" C%d[C%d]", i, |
| 1865 | pr->power.states[i].type); | 1247 | pr->power.states[i].type); |
| 1866 | printk(")\n"); | 1248 | printk(")\n"); |
| 1867 | |||
| 1868 | #ifndef CONFIG_CPU_IDLE | ||
| 1869 | if (pr->id == 0) { | ||
| 1870 | pm_idle_save = pm_idle; | ||
| 1871 | pm_idle = acpi_processor_idle; | ||
| 1872 | } | ||
| 1873 | #endif | ||
| 1874 | } | 1249 | } |
| 1875 | 1250 | ||
| 1876 | /* 'power' [R] */ | 1251 | /* 'power' [R] */ |
| @@ -1889,34 +1264,12 @@ int acpi_processor_power_exit(struct acpi_processor *pr, | |||
| 1889 | if (boot_option_idle_override) | 1264 | if (boot_option_idle_override) |
| 1890 | return 0; | 1265 | return 0; |
| 1891 | 1266 | ||
| 1892 | #ifdef CONFIG_CPU_IDLE | ||
| 1893 | cpuidle_unregister_device(&pr->power.dev); | 1267 | cpuidle_unregister_device(&pr->power.dev); |
| 1894 | #endif | ||
| 1895 | pr->flags.power_setup_done = 0; | 1268 | pr->flags.power_setup_done = 0; |
| 1896 | 1269 | ||
| 1897 | if (acpi_device_dir(device)) | 1270 | if (acpi_device_dir(device)) |
| 1898 | remove_proc_entry(ACPI_PROCESSOR_FILE_POWER, | 1271 | remove_proc_entry(ACPI_PROCESSOR_FILE_POWER, |
| 1899 | acpi_device_dir(device)); | 1272 | acpi_device_dir(device)); |
| 1900 | 1273 | ||
| 1901 | #ifndef CONFIG_CPU_IDLE | ||
| 1902 | |||
| 1903 | /* Unregister the idle handler when processor #0 is removed. */ | ||
| 1904 | if (pr->id == 0) { | ||
| 1905 | if (pm_idle_save) | ||
| 1906 | pm_idle = pm_idle_save; | ||
| 1907 | |||
| 1908 | /* | ||
| 1909 | * We are about to unload the current idle thread pm callback | ||
| 1910 | * (pm_idle), Wait for all processors to update cached/local | ||
| 1911 | * copies of pm_idle before proceeding. | ||
| 1912 | */ | ||
| 1913 | cpu_idle_wait(); | ||
| 1914 | #ifdef CONFIG_SMP | ||
| 1915 | pm_qos_remove_notifier(PM_QOS_CPU_DMA_LATENCY, | ||
| 1916 | &acpi_processor_latency_notifier); | ||
| 1917 | #endif | ||
| 1918 | } | ||
| 1919 | #endif | ||
| 1920 | |||
| 1921 | return 0; | 1274 | return 0; |
| 1922 | } | 1275 | } |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 846e227592d4..9cc769b587ff 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
| @@ -31,14 +31,6 @@ | |||
| 31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
| 32 | #include <linux/cpufreq.h> | 32 | #include <linux/cpufreq.h> |
| 33 | 33 | ||
| 34 | #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF | ||
| 35 | #include <linux/proc_fs.h> | ||
| 36 | #include <linux/seq_file.h> | ||
| 37 | #include <linux/mutex.h> | ||
| 38 | |||
| 39 | #include <asm/uaccess.h> | ||
| 40 | #endif | ||
| 41 | |||
| 42 | #ifdef CONFIG_X86 | 34 | #ifdef CONFIG_X86 |
| 43 | #include <asm/cpufeature.h> | 35 | #include <asm/cpufeature.h> |
| 44 | #endif | 36 | #endif |
| @@ -434,96 +426,6 @@ int acpi_processor_notify_smm(struct module *calling_module) | |||
| 434 | 426 | ||
| 435 | EXPORT_SYMBOL(acpi_processor_notify_smm); | 427 | EXPORT_SYMBOL(acpi_processor_notify_smm); |
| 436 | 428 | ||
| 437 | #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF | ||
| 438 | /* /proc/acpi/processor/../performance interface (DEPRECATED) */ | ||
| 439 | |||
| 440 | static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file); | ||
| 441 | static struct file_operations acpi_processor_perf_fops = { | ||
| 442 | .owner = THIS_MODULE, | ||
| 443 | .open = acpi_processor_perf_open_fs, | ||
| 444 | .read = seq_read, | ||
| 445 | .llseek = seq_lseek, | ||
| 446 | .release = single_release, | ||
| 447 | }; | ||
| 448 | |||
| 449 | static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset) | ||
| 450 | { | ||
| 451 | struct acpi_processor *pr = seq->private; | ||
| 452 | int i; | ||
| 453 | |||
| 454 | |||
| 455 | if (!pr) | ||
| 456 | goto end; | ||
| 457 | |||
| 458 | if (!pr->performance) { | ||
| 459 | seq_puts(seq, "<not supported>\n"); | ||
| 460 | goto end; | ||
| 461 | } | ||
| 462 | |||
| 463 | seq_printf(seq, "state count: %d\n" | ||
| 464 | "active state: P%d\n", | ||
| 465 | pr->performance->state_count, pr->performance->state); | ||
| 466 | |||
| 467 | seq_puts(seq, "states:\n"); | ||
| 468 | for (i = 0; i < pr->performance->state_count; i++) | ||
| 469 | seq_printf(seq, | ||
| 470 | " %cP%d: %d MHz, %d mW, %d uS\n", | ||
| 471 | (i == pr->performance->state ? '*' : ' '), i, | ||
| 472 | (u32) pr->performance->states[i].core_frequency, | ||
| 473 | (u32) pr->performance->states[i].power, | ||
| 474 | (u32) pr->performance->states[i].transition_latency); | ||
| 475 | |||
| 476 | end: | ||
| 477 | return 0; | ||
| 478 | } | ||
| 479 | |||
| 480 | static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) | ||
| 481 | { | ||
| 482 | return single_open(file, acpi_processor_perf_seq_show, | ||
| 483 | PDE(inode)->data); | ||
| 484 | } | ||
| 485 | |||
| 486 | static void acpi_cpufreq_add_file(struct acpi_processor *pr) | ||
| 487 | { | ||
| 488 | struct acpi_device *device = NULL; | ||
| 489 | |||
| 490 | |||
| 491 | if (acpi_bus_get_device(pr->handle, &device)) | ||
| 492 | return; | ||
| 493 | |||
| 494 | /* add file 'performance' [R/W] */ | ||
| 495 | proc_create_data(ACPI_PROCESSOR_FILE_PERFORMANCE, S_IFREG | S_IRUGO, | ||
| 496 | acpi_device_dir(device), | ||
| 497 | &acpi_processor_perf_fops, acpi_driver_data(device)); | ||
| 498 | return; | ||
| 499 | } | ||
| 500 | |||
| 501 | static void acpi_cpufreq_remove_file(struct acpi_processor *pr) | ||
| 502 | { | ||
| 503 | struct acpi_device *device = NULL; | ||
| 504 | |||
| 505 | |||
| 506 | if (acpi_bus_get_device(pr->handle, &device)) | ||
| 507 | return; | ||
| 508 | |||
| 509 | /* remove file 'performance' */ | ||
| 510 | remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, | ||
| 511 | acpi_device_dir(device)); | ||
| 512 | |||
| 513 | return; | ||
| 514 | } | ||
| 515 | |||
| 516 | #else | ||
| 517 | static void acpi_cpufreq_add_file(struct acpi_processor *pr) | ||
| 518 | { | ||
| 519 | return; | ||
| 520 | } | ||
| 521 | static void acpi_cpufreq_remove_file(struct acpi_processor *pr) | ||
| 522 | { | ||
| 523 | return; | ||
| 524 | } | ||
| 525 | #endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ | ||
| 526 | |||
| 527 | static int acpi_processor_get_psd(struct acpi_processor *pr) | 429 | static int acpi_processor_get_psd(struct acpi_processor *pr) |
| 528 | { | 430 | { |
| 529 | int result = 0; | 431 | int result = 0; |
| @@ -747,14 +649,12 @@ err_ret: | |||
| 747 | } | 649 | } |
| 748 | EXPORT_SYMBOL(acpi_processor_preregister_performance); | 650 | EXPORT_SYMBOL(acpi_processor_preregister_performance); |
| 749 | 651 | ||
| 750 | |||
| 751 | int | 652 | int |
| 752 | acpi_processor_register_performance(struct acpi_processor_performance | 653 | acpi_processor_register_performance(struct acpi_processor_performance |
| 753 | *performance, unsigned int cpu) | 654 | *performance, unsigned int cpu) |
| 754 | { | 655 | { |
| 755 | struct acpi_processor *pr; | 656 | struct acpi_processor *pr; |
| 756 | 657 | ||
| 757 | |||
| 758 | if (!(acpi_processor_ppc_status & PPC_REGISTERED)) | 658 | if (!(acpi_processor_ppc_status & PPC_REGISTERED)) |
| 759 | return -EINVAL; | 659 | return -EINVAL; |
| 760 | 660 | ||
| @@ -781,8 +681,6 @@ acpi_processor_register_performance(struct acpi_processor_performance | |||
| 781 | return -EIO; | 681 | return -EIO; |
| 782 | } | 682 | } |
| 783 | 683 | ||
| 784 | acpi_cpufreq_add_file(pr); | ||
| 785 | |||
| 786 | mutex_unlock(&performance_mutex); | 684 | mutex_unlock(&performance_mutex); |
| 787 | return 0; | 685 | return 0; |
| 788 | } | 686 | } |
| @@ -795,7 +693,6 @@ acpi_processor_unregister_performance(struct acpi_processor_performance | |||
| 795 | { | 693 | { |
| 796 | struct acpi_processor *pr; | 694 | struct acpi_processor *pr; |
| 797 | 695 | ||
| 798 | |||
| 799 | mutex_lock(&performance_mutex); | 696 | mutex_lock(&performance_mutex); |
| 800 | 697 | ||
| 801 | pr = per_cpu(processors, cpu); | 698 | pr = per_cpu(processors, cpu); |
| @@ -808,8 +705,6 @@ acpi_processor_unregister_performance(struct acpi_processor_performance | |||
| 808 | kfree(pr->performance->states); | 705 | kfree(pr->performance->states); |
| 809 | pr->performance = NULL; | 706 | pr->performance = NULL; |
| 810 | 707 | ||
| 811 | acpi_cpufreq_remove_file(pr); | ||
| 812 | |||
| 813 | mutex_unlock(&performance_mutex); | 708 | mutex_unlock(&performance_mutex); |
| 814 | 709 | ||
| 815 | return; | 710 | return; |
diff --git a/drivers/acpi/main.c b/drivers/acpi/sleep.c index 7e3c609cbef2..519266654f06 100644 --- a/drivers/acpi/main.c +++ b/drivers/acpi/sleep.c | |||
| @@ -90,31 +90,6 @@ void __init acpi_old_suspend_ordering(void) | |||
| 90 | old_suspend_ordering = true; | 90 | old_suspend_ordering = true; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | /* | ||
| 94 | * According to the ACPI specification the BIOS should make sure that ACPI is | ||
| 95 | * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states. Still, | ||
| 96 | * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI | ||
| 97 | * on such systems during resume. Unfortunately that doesn't help in | ||
| 98 | * particularly pathological cases in which SCI_EN has to be set directly on | ||
| 99 | * resume, although the specification states very clearly that this flag is | ||
| 100 | * owned by the hardware. The set_sci_en_on_resume variable will be set in such | ||
| 101 | * cases. | ||
| 102 | */ | ||
| 103 | static bool set_sci_en_on_resume; | ||
| 104 | /* | ||
| 105 | * The ACPI specification wants us to save NVS memory regions during hibernation | ||
| 106 | * and to restore them during the subsequent resume. However, it is not certain | ||
| 107 | * if this mechanism is going to work on all machines, so we allow the user to | ||
| 108 | * disable this mechanism using the 'acpi_sleep=s4_nonvs' kernel command line | ||
| 109 | * option. | ||
| 110 | */ | ||
| 111 | static bool s4_no_nvs; | ||
| 112 | |||
| 113 | void __init acpi_s4_no_nvs(void) | ||
| 114 | { | ||
| 115 | s4_no_nvs = true; | ||
| 116 | } | ||
| 117 | |||
| 118 | /** | 93 | /** |
| 119 | * acpi_pm_disable_gpes - Disable the GPEs. | 94 | * acpi_pm_disable_gpes - Disable the GPEs. |
| 120 | */ | 95 | */ |
| @@ -193,6 +168,18 @@ static void acpi_pm_end(void) | |||
| 193 | #endif /* CONFIG_ACPI_SLEEP */ | 168 | #endif /* CONFIG_ACPI_SLEEP */ |
| 194 | 169 | ||
| 195 | #ifdef CONFIG_SUSPEND | 170 | #ifdef CONFIG_SUSPEND |
| 171 | /* | ||
| 172 | * According to the ACPI specification the BIOS should make sure that ACPI is | ||
| 173 | * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states. Still, | ||
| 174 | * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI | ||
| 175 | * on such systems during resume. Unfortunately that doesn't help in | ||
| 176 | * particularly pathological cases in which SCI_EN has to be set directly on | ||
| 177 | * resume, although the specification states very clearly that this flag is | ||
| 178 | * owned by the hardware. The set_sci_en_on_resume variable will be set in such | ||
| 179 | * cases. | ||
| 180 | */ | ||
| 181 | static bool set_sci_en_on_resume; | ||
| 182 | |||
| 196 | extern void do_suspend_lowlevel(void); | 183 | extern void do_suspend_lowlevel(void); |
| 197 | 184 | ||
| 198 | static u32 acpi_suspend_states[] = { | 185 | static u32 acpi_suspend_states[] = { |
| @@ -396,6 +383,20 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | |||
| 396 | #endif /* CONFIG_SUSPEND */ | 383 | #endif /* CONFIG_SUSPEND */ |
| 397 | 384 | ||
| 398 | #ifdef CONFIG_HIBERNATION | 385 | #ifdef CONFIG_HIBERNATION |
| 386 | /* | ||
| 387 | * The ACPI specification wants us to save NVS memory regions during hibernation | ||
| 388 | * and to restore them during the subsequent resume. However, it is not certain | ||
| 389 | * if this mechanism is going to work on all machines, so we allow the user to | ||
| 390 | * disable this mechanism using the 'acpi_sleep=s4_nonvs' kernel command line | ||
| 391 | * option. | ||
| 392 | */ | ||
| 393 | static bool s4_no_nvs; | ||
| 394 | |||
| 395 | void __init acpi_s4_no_nvs(void) | ||
| 396 | { | ||
| 397 | s4_no_nvs = true; | ||
| 398 | } | ||
| 399 | |||
| 399 | static unsigned long s4_hardware_signature; | 400 | static unsigned long s4_hardware_signature; |
| 400 | static struct acpi_table_facs *facs; | 401 | static struct acpi_table_facs *facs; |
| 401 | static bool nosigcheck; | 402 | static bool nosigcheck; |
| @@ -679,7 +680,7 @@ static void acpi_power_off_prepare(void) | |||
| 679 | static void acpi_power_off(void) | 680 | static void acpi_power_off(void) |
| 680 | { | 681 | { |
| 681 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ | 682 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ |
| 682 | printk("%s called\n", __func__); | 683 | printk(KERN_DEBUG "%s called\n", __func__); |
| 683 | local_irq_disable(); | 684 | local_irq_disable(); |
| 684 | acpi_enable_wakeup_device(ACPI_STATE_S5); | 685 | acpi_enable_wakeup_device(ACPI_STATE_S5); |
| 685 | acpi_enter_sleep_state(ACPI_STATE_S5); | 686 | acpi_enter_sleep_state(ACPI_STATE_S5); |
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index 775c97a282bd..a8852952fac4 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
| @@ -293,7 +293,12 @@ static void __init check_multiple_madt(void) | |||
| 293 | 293 | ||
| 294 | int __init acpi_table_init(void) | 294 | int __init acpi_table_init(void) |
| 295 | { | 295 | { |
| 296 | acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); | 296 | acpi_status status; |
| 297 | |||
| 298 | status = acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); | ||
| 299 | if (ACPI_FAILURE(status)) | ||
| 300 | return 1; | ||
| 301 | |||
| 297 | check_multiple_madt(); | 302 | check_multiple_madt(); |
| 298 | return 0; | 303 | return 0; |
| 299 | } | 304 | } |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 073ff09218a9..99e6f1f8ea45 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
| @@ -416,7 +416,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
| 416 | } | 416 | } |
| 417 | 417 | ||
| 418 | /* Passive (optional) */ | 418 | /* Passive (optional) */ |
| 419 | if (flag & ACPI_TRIPS_PASSIVE) { | 419 | if (((flag & ACPI_TRIPS_PASSIVE) && tz->trips.passive.flags.valid) || |
| 420 | (flag == ACPI_TRIPS_INIT)) { | ||
| 420 | valid = tz->trips.passive.flags.valid; | 421 | valid = tz->trips.passive.flags.valid; |
| 421 | if (psv == -1) { | 422 | if (psv == -1) { |
| 422 | status = AE_SUPPORT; | 423 | status = AE_SUPPORT; |
| @@ -462,8 +463,11 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
| 462 | memset(&devices, 0, sizeof(struct acpi_handle_list)); | 463 | memset(&devices, 0, sizeof(struct acpi_handle_list)); |
| 463 | status = acpi_evaluate_reference(tz->device->handle, "_PSL", | 464 | status = acpi_evaluate_reference(tz->device->handle, "_PSL", |
| 464 | NULL, &devices); | 465 | NULL, &devices); |
| 465 | if (ACPI_FAILURE(status)) | 466 | if (ACPI_FAILURE(status)) { |
| 467 | printk(KERN_WARNING PREFIX | ||
| 468 | "Invalid passive threshold\n"); | ||
| 466 | tz->trips.passive.flags.valid = 0; | 469 | tz->trips.passive.flags.valid = 0; |
| 470 | } | ||
| 467 | else | 471 | else |
| 468 | tz->trips.passive.flags.valid = 1; | 472 | tz->trips.passive.flags.valid = 1; |
| 469 | 473 | ||
| @@ -487,7 +491,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
| 487 | if (act == -1) | 491 | if (act == -1) |
| 488 | break; /* disable all active trip points */ | 492 | break; /* disable all active trip points */ |
| 489 | 493 | ||
| 490 | if (flag & ACPI_TRIPS_ACTIVE) { | 494 | if ((flag == ACPI_TRIPS_INIT) || ((flag & ACPI_TRIPS_ACTIVE) && |
| 495 | tz->trips.active[i].flags.valid)) { | ||
| 491 | status = acpi_evaluate_integer(tz->device->handle, | 496 | status = acpi_evaluate_integer(tz->device->handle, |
| 492 | name, NULL, &tmp); | 497 | name, NULL, &tmp); |
| 493 | if (ACPI_FAILURE(status)) { | 498 | if (ACPI_FAILURE(status)) { |
| @@ -521,8 +526,11 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
| 521 | memset(&devices, 0, sizeof(struct acpi_handle_list)); | 526 | memset(&devices, 0, sizeof(struct acpi_handle_list)); |
| 522 | status = acpi_evaluate_reference(tz->device->handle, | 527 | status = acpi_evaluate_reference(tz->device->handle, |
| 523 | name, NULL, &devices); | 528 | name, NULL, &devices); |
| 524 | if (ACPI_FAILURE(status)) | 529 | if (ACPI_FAILURE(status)) { |
| 530 | printk(KERN_WARNING PREFIX | ||
| 531 | "Invalid active%d threshold\n", i); | ||
| 525 | tz->trips.active[i].flags.valid = 0; | 532 | tz->trips.active[i].flags.valid = 0; |
| 533 | } | ||
| 526 | else | 534 | else |
| 527 | tz->trips.active[i].flags.valid = 1; | 535 | tz->trips.active[i].flags.valid = 1; |
| 528 | 536 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index f261737636da..bb5ed059114a 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -1020,7 +1020,7 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset) | |||
| 1020 | } | 1020 | } |
| 1021 | 1021 | ||
| 1022 | seq_printf(seq, "levels: "); | 1022 | seq_printf(seq, "levels: "); |
| 1023 | for (i = 0; i < dev->brightness->count; i++) | 1023 | for (i = 2; i < dev->brightness->count; i++) |
| 1024 | seq_printf(seq, " %d", dev->brightness->levels[i]); | 1024 | seq_printf(seq, " %d", dev->brightness->levels[i]); |
| 1025 | seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr); | 1025 | seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr); |
| 1026 | 1026 | ||
| @@ -1059,7 +1059,7 @@ acpi_video_device_write_brightness(struct file *file, | |||
| 1059 | return -EFAULT; | 1059 | return -EFAULT; |
| 1060 | 1060 | ||
| 1061 | /* validate through the list of available levels */ | 1061 | /* validate through the list of available levels */ |
| 1062 | for (i = 0; i < dev->brightness->count; i++) | 1062 | for (i = 2; i < dev->brightness->count; i++) |
| 1063 | if (level == dev->brightness->levels[i]) { | 1063 | if (level == dev->brightness->levels[i]) { |
| 1064 | if (ACPI_SUCCESS | 1064 | if (ACPI_SUCCESS |
| 1065 | (acpi_video_device_lcd_set_level(dev, level))) | 1065 | (acpi_video_device_lcd_set_level(dev, level))) |
| @@ -1260,7 +1260,7 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) | |||
| 1260 | printk(KERN_WARNING PREFIX | 1260 | printk(KERN_WARNING PREFIX |
| 1261 | "This indicates a BIOS bug. Please contact the manufacturer.\n"); | 1261 | "This indicates a BIOS bug. Please contact the manufacturer.\n"); |
| 1262 | } | 1262 | } |
| 1263 | printk("%llx\n", options); | 1263 | printk(KERN_WARNING "%llx\n", options); |
| 1264 | seq_printf(seq, "can POST: <integrated video>"); | 1264 | seq_printf(seq, "can POST: <integrated video>"); |
| 1265 | if (options & 2) | 1265 | if (options & 2) |
| 1266 | seq_printf(seq, " <PCI video>"); | 1266 | seq_printf(seq, " <PCI video>"); |
| @@ -1712,7 +1712,7 @@ acpi_video_get_next_level(struct acpi_video_device *device, | |||
| 1712 | max = max_below = 0; | 1712 | max = max_below = 0; |
| 1713 | min = min_above = 255; | 1713 | min = min_above = 255; |
| 1714 | /* Find closest level to level_current */ | 1714 | /* Find closest level to level_current */ |
| 1715 | for (i = 0; i < device->brightness->count; i++) { | 1715 | for (i = 2; i < device->brightness->count; i++) { |
| 1716 | l = device->brightness->levels[i]; | 1716 | l = device->brightness->levels[i]; |
| 1717 | if (abs(l - level_current) < abs(delta)) { | 1717 | if (abs(l - level_current) < abs(delta)) { |
| 1718 | delta = l - level_current; | 1718 | delta = l - level_current; |
| @@ -1722,7 +1722,7 @@ acpi_video_get_next_level(struct acpi_video_device *device, | |||
| 1722 | } | 1722 | } |
| 1723 | /* Ajust level_current to closest available level */ | 1723 | /* Ajust level_current to closest available level */ |
| 1724 | level_current += delta; | 1724 | level_current += delta; |
| 1725 | for (i = 0; i < device->brightness->count; i++) { | 1725 | for (i = 2; i < device->brightness->count; i++) { |
| 1726 | l = device->brightness->levels[i]; | 1726 | l = device->brightness->levels[i]; |
| 1727 | if (l < min) | 1727 | if (l < min) |
| 1728 | min = l; | 1728 | min = l; |
| @@ -2006,6 +2006,12 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
| 2006 | device->pnp.bus_id[3] = '0' + instance; | 2006 | device->pnp.bus_id[3] = '0' + instance; |
| 2007 | instance ++; | 2007 | instance ++; |
| 2008 | } | 2008 | } |
| 2009 | /* a hack to fix the duplicate name "VGA" problem on Pa 3553 */ | ||
| 2010 | if (!strcmp(device->pnp.bus_id, "VGA")) { | ||
| 2011 | if (instance) | ||
| 2012 | device->pnp.bus_id[3] = '0' + instance; | ||
| 2013 | instance++; | ||
| 2014 | } | ||
| 2009 | 2015 | ||
| 2010 | video->device = device; | 2016 | video->device = device; |
| 2011 | strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME); | 2017 | strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME); |
