diff options
Diffstat (limited to 'drivers/acpi')
33 files changed, 561 insertions, 268 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index f4f63291750..b0243fd55ac 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
| @@ -312,9 +312,13 @@ config ACPI_DEBUG | |||
| 312 | bool "Debug Statements" | 312 | bool "Debug Statements" |
| 313 | default n | 313 | default n |
| 314 | help | 314 | help |
| 315 | The ACPI driver can optionally report errors with a great deal | 315 | The ACPI subsystem can produce debug output. Saying Y enables this |
| 316 | of verbosity. Saying Y enables these statements. This will increase | 316 | output and increases the kernel size by around 50K. |
| 317 | your kernel size by around 50K. | 317 | |
| 318 | Use the acpi.debug_layer and acpi.debug_level kernel command-line | ||
| 319 | parameters documented in Documentation/acpi/debug.txt and | ||
| 320 | Documentation/kernel-parameters.txt to control the type and | ||
| 321 | amount of debug output. | ||
| 318 | 322 | ||
| 319 | config ACPI_DEBUG_FUNC_TRACE | 323 | config ACPI_DEBUG_FUNC_TRACE |
| 320 | bool "Additionally enable ACPI function tracing" | 324 | bool "Additionally enable ACPI function tracing" |
| @@ -324,14 +328,6 @@ config ACPI_DEBUG_FUNC_TRACE | |||
| 324 | ACPI Debug Statements slow down ACPI processing. Function trace | 328 | ACPI Debug Statements slow down ACPI processing. Function trace |
| 325 | is about half of the penalty and is rarely useful. | 329 | is about half of the penalty and is rarely useful. |
| 326 | 330 | ||
| 327 | config ACPI_EC | ||
| 328 | bool | ||
| 329 | default y | ||
| 330 | help | ||
| 331 | This driver is required on some systems for the proper operation of | ||
| 332 | the battery and thermal drivers. If you are compiling for a | ||
| 333 | mobile system, say Y. | ||
| 334 | |||
| 335 | config ACPI_PCI_SLOT | 331 | config ACPI_PCI_SLOT |
| 336 | tristate "PCI slot detection driver" | 332 | tristate "PCI slot detection driver" |
| 337 | default n | 333 | default n |
| @@ -341,10 +337,6 @@ config ACPI_PCI_SLOT | |||
| 341 | help you correlate PCI bus addresses with the physical geography | 337 | help you correlate PCI bus addresses with the physical geography |
| 342 | of your slots. If you are unsure, say N. | 338 | of your slots. If you are unsure, say N. |
| 343 | 339 | ||
| 344 | config ACPI_POWER | ||
| 345 | bool | ||
| 346 | default y | ||
| 347 | |||
| 348 | config ACPI_SYSTEM | 340 | config ACPI_SYSTEM |
| 349 | bool | 341 | bool |
| 350 | default y | 342 | default y |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index d91c027ece8..3c0c93300f1 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
| @@ -39,19 +39,23 @@ obj-y += sleep/ | |||
| 39 | obj-y += bus.o glue.o | 39 | obj-y += bus.o glue.o |
| 40 | obj-y += scan.o | 40 | obj-y += scan.o |
| 41 | # Keep EC driver first. Initialization of others depend on it. | 41 | # Keep EC driver first. Initialization of others depend on it. |
| 42 | obj-$(CONFIG_ACPI_EC) += ec.o | 42 | obj-y += ec.o |
| 43 | obj-$(CONFIG_ACPI_AC) += ac.o | 43 | obj-$(CONFIG_ACPI_AC) += ac.o |
| 44 | obj-$(CONFIG_ACPI_BATTERY) += battery.o | 44 | obj-$(CONFIG_ACPI_BATTERY) += battery.o |
| 45 | obj-$(CONFIG_ACPI_BUTTON) += button.o | 45 | obj-$(CONFIG_ACPI_BUTTON) += button.o |
| 46 | obj-$(CONFIG_ACPI_FAN) += fan.o | 46 | obj-$(CONFIG_ACPI_FAN) += fan.o |
| 47 | obj-$(CONFIG_ACPI_DOCK) += dock.o | 47 | obj-$(CONFIG_ACPI_DOCK) += dock.o |
| 48 | obj-$(CONFIG_ACPI_VIDEO) += video.o | 48 | obj-$(CONFIG_ACPI_VIDEO) += video.o |
| 49 | ifdef CONFIG_ACPI_VIDEO | ||
| 50 | obj-y += video_detect.o | ||
| 51 | endif | ||
| 52 | |||
| 49 | obj-y += pci_root.o pci_link.o pci_irq.o pci_bind.o | 53 | obj-y += pci_root.o pci_link.o pci_irq.o pci_bind.o |
| 50 | obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o | 54 | obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o |
| 51 | obj-$(CONFIG_ACPI_PROCESSOR) += processor.o | 55 | obj-$(CONFIG_ACPI_PROCESSOR) += processor.o |
| 52 | obj-$(CONFIG_ACPI_CONTAINER) += container.o | 56 | obj-$(CONFIG_ACPI_CONTAINER) += container.o |
| 53 | obj-$(CONFIG_ACPI_THERMAL) += thermal.o | 57 | obj-$(CONFIG_ACPI_THERMAL) += thermal.o |
| 54 | obj-$(CONFIG_ACPI_POWER) += power.o | 58 | obj-y += power.o |
| 55 | obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o | 59 | obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o |
| 56 | obj-$(CONFIG_ACPI_DEBUG) += debug.o | 60 | obj-$(CONFIG_ACPI_DEBUG) += debug.o |
| 57 | obj-$(CONFIG_ACPI_NUMA) += numa.o | 61 | obj-$(CONFIG_ACPI_NUMA) += numa.o |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index d72a1b6c8a9..9b917dac773 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
| @@ -37,7 +37,6 @@ | |||
| 37 | #include <acpi/acpi_bus.h> | 37 | #include <acpi/acpi_bus.h> |
| 38 | #include <acpi/acpi_drivers.h> | 38 | #include <acpi/acpi_drivers.h> |
| 39 | 39 | ||
| 40 | #define ACPI_AC_COMPONENT 0x00020000 | ||
| 41 | #define ACPI_AC_CLASS "ac_adapter" | 40 | #define ACPI_AC_CLASS "ac_adapter" |
| 42 | #define ACPI_AC_DEVICE_NAME "AC Adapter" | 41 | #define ACPI_AC_DEVICE_NAME "AC Adapter" |
| 43 | #define ACPI_AC_FILE_STATE "state" | 42 | #define ACPI_AC_FILE_STATE "state" |
| @@ -242,7 +241,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) | |||
| 242 | acpi_ac_get_state(ac); | 241 | acpi_ac_get_state(ac); |
| 243 | acpi_bus_generate_proc_event(device, event, (u32) ac->state); | 242 | acpi_bus_generate_proc_event(device, event, (u32) ac->state); |
| 244 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 243 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
| 245 | device->dev.bus_id, event, | 244 | dev_name(&device->dev), event, |
| 246 | (u32) ac->state); | 245 | (u32) ac->state); |
| 247 | #ifdef CONFIG_ACPI_SYSFS_POWER | 246 | #ifdef CONFIG_ACPI_SYSFS_POWER |
| 248 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); | 247 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); |
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 71d21c51c45..63a17b55b39 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
| @@ -32,7 +32,6 @@ | |||
| 32 | #include <linux/memory_hotplug.h> | 32 | #include <linux/memory_hotplug.h> |
| 33 | #include <acpi/acpi_drivers.h> | 33 | #include <acpi/acpi_drivers.h> |
| 34 | 34 | ||
| 35 | #define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000UL | ||
| 36 | #define ACPI_MEMORY_DEVICE_CLASS "memory" | 35 | #define ACPI_MEMORY_DEVICE_CLASS "memory" |
| 37 | #define ACPI_MEMORY_DEVICE_HID "PNP0C80" | 36 | #define ACPI_MEMORY_DEVICE_HID "PNP0C80" |
| 38 | #define ACPI_MEMORY_DEVICE_NAME "Hotplug Mem Device" | 37 | #define ACPI_MEMORY_DEVICE_NAME "Hotplug Mem Device" |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index b2133e89ad9..1423b0c0cd2 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
| @@ -46,7 +46,6 @@ | |||
| 46 | 46 | ||
| 47 | #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF | 47 | #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF |
| 48 | 48 | ||
| 49 | #define ACPI_BATTERY_COMPONENT 0x00040000 | ||
| 50 | #define ACPI_BATTERY_CLASS "battery" | 49 | #define ACPI_BATTERY_CLASS "battery" |
| 51 | #define ACPI_BATTERY_DEVICE_NAME "Battery" | 50 | #define ACPI_BATTERY_DEVICE_NAME "Battery" |
| 52 | #define ACPI_BATTERY_NOTIFY_STATUS 0x80 | 51 | #define ACPI_BATTERY_NOTIFY_STATUS 0x80 |
| @@ -782,7 +781,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) | |||
| 782 | acpi_bus_generate_proc_event(device, event, | 781 | acpi_bus_generate_proc_event(device, event, |
| 783 | acpi_battery_present(battery)); | 782 | acpi_battery_present(battery)); |
| 784 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 783 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
| 785 | device->dev.bus_id, event, | 784 | dev_name(&device->dev), event, |
| 786 | acpi_battery_present(battery)); | 785 | acpi_battery_present(battery)); |
| 787 | #ifdef CONFIG_ACPI_SYSFS_POWER | 786 | #ifdef CONFIG_ACPI_SYSFS_POWER |
| 788 | /* acpi_batter_update could remove power_supply object */ | 787 | /* acpi_batter_update could remove power_supply object */ |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index c797c6473f3..7edf6d913c1 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
| @@ -688,6 +688,14 @@ void __init acpi_early_init(void) | |||
| 688 | if (acpi_disabled) | 688 | if (acpi_disabled) |
| 689 | return; | 689 | return; |
| 690 | 690 | ||
| 691 | /* | ||
| 692 | * ACPI CA initializes acpi_dbg_level to non-zero, which means | ||
| 693 | * we get debug output merely by turning on CONFIG_ACPI_DEBUG. | ||
| 694 | * Turn it off so we don't get output unless the user specifies | ||
| 695 | * acpi.debug_level. | ||
| 696 | */ | ||
| 697 | acpi_dbg_level = 0; | ||
| 698 | |||
| 691 | printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); | 699 | printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); |
| 692 | 700 | ||
| 693 | /* enable workarounds, unless strict ACPI spec. compliance */ | 701 | /* enable workarounds, unless strict ACPI spec. compliance */ |
| @@ -774,7 +782,7 @@ static int __init acpi_bus_init(void) | |||
| 774 | "Unable to initialize ACPI OS objects\n"); | 782 | "Unable to initialize ACPI OS objects\n"); |
| 775 | goto error1; | 783 | goto error1; |
| 776 | } | 784 | } |
| 777 | #ifdef CONFIG_ACPI_EC | 785 | |
| 778 | /* | 786 | /* |
| 779 | * ACPI 2.0 requires the EC driver to be loaded and work before | 787 | * ACPI 2.0 requires the EC driver to be loaded and work before |
| 780 | * the EC device is found in the namespace (i.e. before acpi_initialize_objects() | 788 | * the EC device is found in the namespace (i.e. before acpi_initialize_objects() |
| @@ -785,7 +793,6 @@ static int __init acpi_bus_init(void) | |||
| 785 | */ | 793 | */ |
| 786 | status = acpi_ec_ecdt_probe(); | 794 | status = acpi_ec_ecdt_probe(); |
| 787 | /* Ignore result. Not having an ECDT is not fatal. */ | 795 | /* Ignore result. Not having an ECDT is not fatal. */ |
| 788 | #endif | ||
| 789 | 796 | ||
| 790 | status = acpi_initialize_objects(ACPI_FULL_INITIALIZATION); | 797 | status = acpi_initialize_objects(ACPI_FULL_INITIALIZATION); |
| 791 | if (ACPI_FAILURE(status)) { | 798 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index cb046c3fc3f..171fd914f43 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | #include <acpi/acpi_bus.h> | 33 | #include <acpi/acpi_bus.h> |
| 34 | #include <acpi/acpi_drivers.h> | 34 | #include <acpi/acpi_drivers.h> |
| 35 | 35 | ||
| 36 | #define ACPI_BUTTON_COMPONENT 0x00080000 | ||
| 37 | #define ACPI_BUTTON_CLASS "button" | 36 | #define ACPI_BUTTON_CLASS "button" |
| 38 | #define ACPI_BUTTON_FILE_INFO "info" | 37 | #define ACPI_BUTTON_FILE_INFO "info" |
| 39 | #define ACPI_BUTTON_FILE_STATE "state" | 38 | #define ACPI_BUTTON_FILE_STATE "state" |
| @@ -479,7 +478,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
| 479 | device->wakeup.gpe_number, | 478 | device->wakeup.gpe_number, |
| 480 | ACPI_GPE_TYPE_WAKE_RUN); | 479 | ACPI_GPE_TYPE_WAKE_RUN); |
| 481 | acpi_enable_gpe(device->wakeup.gpe_device, | 480 | acpi_enable_gpe(device->wakeup.gpe_device, |
| 482 | device->wakeup.gpe_number, ACPI_NOT_ISR); | 481 | device->wakeup.gpe_number); |
| 483 | device->wakeup.state.enabled = 1; | 482 | device->wakeup.state.enabled = 1; |
| 484 | } | 483 | } |
| 485 | 484 | ||
diff --git a/drivers/acpi/cm_sbs.c b/drivers/acpi/cm_sbs.c index 4441e84b28a..307963bd104 100644 --- a/drivers/acpi/cm_sbs.c +++ b/drivers/acpi/cm_sbs.c | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | ACPI_MODULE_NAME("cm_sbs"); | 34 | ACPI_MODULE_NAME("cm_sbs"); |
| 35 | #define ACPI_AC_CLASS "ac_adapter" | 35 | #define ACPI_AC_CLASS "ac_adapter" |
| 36 | #define ACPI_BATTERY_CLASS "battery" | 36 | #define ACPI_BATTERY_CLASS "battery" |
| 37 | #define ACPI_SBS_COMPONENT 0x00080000 | ||
| 38 | #define _COMPONENT ACPI_SBS_COMPONENT | 37 | #define _COMPONENT ACPI_SBS_COMPONENT |
| 39 | static struct proc_dir_entry *acpi_ac_dir; | 38 | static struct proc_dir_entry *acpi_ac_dir; |
| 40 | static struct proc_dir_entry *acpi_battery_dir; | 39 | static struct proc_dir_entry *acpi_battery_dir; |
| @@ -105,9 +104,3 @@ void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir_param) | |||
| 105 | return; | 104 | return; |
| 106 | } | 105 | } |
| 107 | EXPORT_SYMBOL(acpi_unlock_battery_dir); | 106 | EXPORT_SYMBOL(acpi_unlock_battery_dir); |
| 108 | |||
| 109 | static int __init acpi_cm_sbs_init(void) | ||
| 110 | { | ||
| 111 | return 0; | ||
| 112 | } | ||
| 113 | subsys_initcall(acpi_cm_sbs_init); | ||
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 134818b265a..17020c12623 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
| @@ -41,7 +41,6 @@ | |||
| 41 | #define INSTALL_NOTIFY_HANDLER 1 | 41 | #define INSTALL_NOTIFY_HANDLER 1 |
| 42 | #define UNINSTALL_NOTIFY_HANDLER 2 | 42 | #define UNINSTALL_NOTIFY_HANDLER 2 |
| 43 | 43 | ||
| 44 | #define ACPI_CONTAINER_COMPONENT 0x01000000 | ||
| 45 | #define _COMPONENT ACPI_CONTAINER_COMPONENT | 44 | #define _COMPONENT ACPI_CONTAINER_COMPONENT |
| 46 | ACPI_MODULE_NAME("container"); | 45 | ACPI_MODULE_NAME("container"); |
| 47 | 46 | ||
diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c index abf36b4b1d1..c4839689200 100644 --- a/drivers/acpi/debug.c +++ b/drivers/acpi/debug.c | |||
| @@ -44,6 +44,21 @@ static const struct acpi_dlayer acpi_debug_layers[] = { | |||
| 44 | ACPI_DEBUG_INIT(ACPI_CA_DISASSEMBLER), | 44 | ACPI_DEBUG_INIT(ACPI_CA_DISASSEMBLER), |
| 45 | ACPI_DEBUG_INIT(ACPI_COMPILER), | 45 | ACPI_DEBUG_INIT(ACPI_COMPILER), |
| 46 | ACPI_DEBUG_INIT(ACPI_TOOLS), | 46 | ACPI_DEBUG_INIT(ACPI_TOOLS), |
| 47 | |||
| 48 | ACPI_DEBUG_INIT(ACPI_BUS_COMPONENT), | ||
| 49 | ACPI_DEBUG_INIT(ACPI_AC_COMPONENT), | ||
| 50 | ACPI_DEBUG_INIT(ACPI_BATTERY_COMPONENT), | ||
| 51 | ACPI_DEBUG_INIT(ACPI_BUTTON_COMPONENT), | ||
| 52 | ACPI_DEBUG_INIT(ACPI_SBS_COMPONENT), | ||
| 53 | ACPI_DEBUG_INIT(ACPI_FAN_COMPONENT), | ||
| 54 | ACPI_DEBUG_INIT(ACPI_PCI_COMPONENT), | ||
| 55 | ACPI_DEBUG_INIT(ACPI_POWER_COMPONENT), | ||
| 56 | ACPI_DEBUG_INIT(ACPI_CONTAINER_COMPONENT), | ||
| 57 | ACPI_DEBUG_INIT(ACPI_SYSTEM_COMPONENT), | ||
| 58 | ACPI_DEBUG_INIT(ACPI_THERMAL_COMPONENT), | ||
| 59 | ACPI_DEBUG_INIT(ACPI_MEMORY_DEVICE_COMPONENT), | ||
| 60 | ACPI_DEBUG_INIT(ACPI_VIDEO_COMPONENT), | ||
| 61 | ACPI_DEBUG_INIT(ACPI_PROCESSOR_COMPONENT), | ||
| 47 | }; | 62 | }; |
| 48 | 63 | ||
| 49 | static const struct acpi_dlevel acpi_debug_levels[] = { | 64 | static const struct acpi_dlevel acpi_debug_levels[] = { |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index ef42316f89f..cf41f9fc24a 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
| @@ -70,7 +70,7 @@ enum ec_command { | |||
| 70 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ | 70 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ |
| 71 | #define ACPI_EC_UDELAY 100 /* Wait 100us before polling EC again */ | 71 | #define ACPI_EC_UDELAY 100 /* Wait 100us before polling EC again */ |
| 72 | 72 | ||
| 73 | #define ACPI_EC_STORM_THRESHOLD 20 /* number of false interrupts | 73 | #define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts |
| 74 | per one transaction */ | 74 | per one transaction */ |
| 75 | 75 | ||
| 76 | enum { | 76 | enum { |
| @@ -100,8 +100,11 @@ struct transaction { | |||
| 100 | u8 *rdata; | 100 | u8 *rdata; |
| 101 | unsigned short irq_count; | 101 | unsigned short irq_count; |
| 102 | u8 command; | 102 | u8 command; |
| 103 | u8 wi; | ||
| 104 | u8 ri; | ||
| 103 | u8 wlen; | 105 | u8 wlen; |
| 104 | u8 rlen; | 106 | u8 rlen; |
| 107 | bool done; | ||
| 105 | }; | 108 | }; |
| 106 | 109 | ||
| 107 | static struct acpi_ec { | 110 | static struct acpi_ec { |
| @@ -178,34 +181,45 @@ static int ec_transaction_done(struct acpi_ec *ec) | |||
| 178 | unsigned long flags; | 181 | unsigned long flags; |
| 179 | int ret = 0; | 182 | int ret = 0; |
| 180 | spin_lock_irqsave(&ec->curr_lock, flags); | 183 | spin_lock_irqsave(&ec->curr_lock, flags); |
| 181 | if (!ec->curr || (!ec->curr->wlen && !ec->curr->rlen)) | 184 | if (!ec->curr || ec->curr->done) |
| 182 | ret = 1; | 185 | ret = 1; |
| 183 | spin_unlock_irqrestore(&ec->curr_lock, flags); | 186 | spin_unlock_irqrestore(&ec->curr_lock, flags); |
| 184 | return ret; | 187 | return ret; |
| 185 | } | 188 | } |
| 186 | 189 | ||
| 190 | static void start_transaction(struct acpi_ec *ec) | ||
| 191 | { | ||
| 192 | ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0; | ||
| 193 | ec->curr->done = false; | ||
| 194 | acpi_ec_write_cmd(ec, ec->curr->command); | ||
| 195 | } | ||
| 196 | |||
| 187 | static void gpe_transaction(struct acpi_ec *ec, u8 status) | 197 | static void gpe_transaction(struct acpi_ec *ec, u8 status) |
| 188 | { | 198 | { |
| 189 | unsigned long flags; | 199 | unsigned long flags; |
| 190 | spin_lock_irqsave(&ec->curr_lock, flags); | 200 | spin_lock_irqsave(&ec->curr_lock, flags); |
| 191 | if (!ec->curr) | 201 | if (!ec->curr) |
| 192 | goto unlock; | 202 | goto unlock; |
| 193 | if (ec->curr->wlen > 0) { | 203 | if (ec->curr->wlen > ec->curr->wi) { |
| 194 | if ((status & ACPI_EC_FLAG_IBF) == 0) { | 204 | if ((status & ACPI_EC_FLAG_IBF) == 0) |
| 195 | acpi_ec_write_data(ec, *(ec->curr->wdata++)); | 205 | acpi_ec_write_data(ec, |
| 196 | --ec->curr->wlen; | 206 | ec->curr->wdata[ec->curr->wi++]); |
| 197 | } else | 207 | else |
| 198 | /* false interrupt, state didn't change */ | 208 | goto err; |
| 199 | ++ec->curr->irq_count; | 209 | } else if (ec->curr->rlen > ec->curr->ri) { |
| 200 | |||
| 201 | } else if (ec->curr->rlen > 0) { | ||
| 202 | if ((status & ACPI_EC_FLAG_OBF) == 1) { | 210 | if ((status & ACPI_EC_FLAG_OBF) == 1) { |
| 203 | *(ec->curr->rdata++) = acpi_ec_read_data(ec); | 211 | ec->curr->rdata[ec->curr->ri++] = acpi_ec_read_data(ec); |
| 204 | --ec->curr->rlen; | 212 | if (ec->curr->rlen == ec->curr->ri) |
| 213 | ec->curr->done = true; | ||
| 205 | } else | 214 | } else |
| 206 | /* false interrupt, state didn't change */ | 215 | goto err; |
| 207 | ++ec->curr->irq_count; | 216 | } else if (ec->curr->wlen == ec->curr->wi && |
| 208 | } | 217 | (status & ACPI_EC_FLAG_IBF) == 0) |
| 218 | ec->curr->done = true; | ||
| 219 | goto unlock; | ||
| 220 | err: | ||
| 221 | /* false interrupt, state didn't change */ | ||
| 222 | ++ec->curr->irq_count; | ||
| 209 | unlock: | 223 | unlock: |
| 210 | spin_unlock_irqrestore(&ec->curr_lock, flags); | 224 | spin_unlock_irqrestore(&ec->curr_lock, flags); |
| 211 | } | 225 | } |
| @@ -215,6 +229,15 @@ static int acpi_ec_wait(struct acpi_ec *ec) | |||
| 215 | if (wait_event_timeout(ec->wait, ec_transaction_done(ec), | 229 | if (wait_event_timeout(ec->wait, ec_transaction_done(ec), |
| 216 | msecs_to_jiffies(ACPI_EC_DELAY))) | 230 | msecs_to_jiffies(ACPI_EC_DELAY))) |
| 217 | return 0; | 231 | return 0; |
| 232 | /* try restart command if we get any false interrupts */ | ||
| 233 | if (ec->curr->irq_count && | ||
| 234 | (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) { | ||
| 235 | pr_debug(PREFIX "controller reset, restart transaction\n"); | ||
| 236 | start_transaction(ec); | ||
| 237 | if (wait_event_timeout(ec->wait, ec_transaction_done(ec), | ||
| 238 | msecs_to_jiffies(ACPI_EC_DELAY))) | ||
| 239 | return 0; | ||
| 240 | } | ||
| 218 | /* missing GPEs, switch back to poll mode */ | 241 | /* missing GPEs, switch back to poll mode */ |
| 219 | if (printk_ratelimit()) | 242 | if (printk_ratelimit()) |
| 220 | pr_info(PREFIX "missing confirmations, " | 243 | pr_info(PREFIX "missing confirmations, " |
| @@ -239,10 +262,10 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state) | |||
| 239 | static int ec_poll(struct acpi_ec *ec) | 262 | static int ec_poll(struct acpi_ec *ec) |
| 240 | { | 263 | { |
| 241 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); | 264 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); |
| 242 | msleep(1); | 265 | udelay(ACPI_EC_UDELAY); |
| 243 | while (time_before(jiffies, delay)) { | 266 | while (time_before(jiffies, delay)) { |
| 244 | gpe_transaction(ec, acpi_ec_read_status(ec)); | 267 | gpe_transaction(ec, acpi_ec_read_status(ec)); |
| 245 | msleep(1); | 268 | udelay(ACPI_EC_UDELAY); |
| 246 | if (ec_transaction_done(ec)) | 269 | if (ec_transaction_done(ec)) |
| 247 | return 0; | 270 | return 0; |
| 248 | } | 271 | } |
| @@ -259,14 +282,13 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
| 259 | /* disable GPE during transaction if storm is detected */ | 282 | /* disable GPE during transaction if storm is detected */ |
| 260 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | 283 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { |
| 261 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 284 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
| 262 | acpi_disable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | 285 | acpi_disable_gpe(NULL, ec->gpe); |
| 263 | } | 286 | } |
| 264 | /* start transaction */ | 287 | /* start transaction */ |
| 265 | spin_lock_irqsave(&ec->curr_lock, tmp); | 288 | spin_lock_irqsave(&ec->curr_lock, tmp); |
| 266 | /* following two actions should be kept atomic */ | 289 | /* following two actions should be kept atomic */ |
| 267 | t->irq_count = 0; | ||
| 268 | ec->curr = t; | 290 | ec->curr = t; |
| 269 | acpi_ec_write_cmd(ec, ec->curr->command); | 291 | start_transaction(ec); |
| 270 | if (ec->curr->command == ACPI_EC_COMMAND_QUERY) | 292 | if (ec->curr->command == ACPI_EC_COMMAND_QUERY) |
| 271 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | 293 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
| 272 | spin_unlock_irqrestore(&ec->curr_lock, tmp); | 294 | spin_unlock_irqrestore(&ec->curr_lock, tmp); |
| @@ -283,10 +305,11 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
| 283 | /* check if we received SCI during transaction */ | 305 | /* check if we received SCI during transaction */ |
| 284 | ec_check_sci(ec, acpi_ec_read_status(ec)); | 306 | ec_check_sci(ec, acpi_ec_read_status(ec)); |
| 285 | /* it is safe to enable GPE outside of transaction */ | 307 | /* it is safe to enable GPE outside of transaction */ |
| 286 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | 308 | acpi_enable_gpe(NULL, ec->gpe); |
| 287 | } else if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags) && | 309 | } else if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags) && |
| 288 | t->irq_count > ACPI_EC_STORM_THRESHOLD) { | 310 | t->irq_count > ACPI_EC_STORM_THRESHOLD) { |
| 289 | pr_debug(PREFIX "GPE storm detected\n"); | 311 | pr_info(PREFIX "GPE storm detected, " |
| 312 | "transactions will use polling mode\n"); | ||
| 290 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); | 313 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); |
| 291 | } | 314 | } |
| 292 | return ret; | 315 | return ret; |
| @@ -558,17 +581,26 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
| 558 | pr_debug(PREFIX "~~~> interrupt\n"); | 581 | pr_debug(PREFIX "~~~> interrupt\n"); |
| 559 | status = acpi_ec_read_status(ec); | 582 | status = acpi_ec_read_status(ec); |
| 560 | 583 | ||
| 561 | gpe_transaction(ec, status); | 584 | if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) { |
| 562 | if (ec_transaction_done(ec) && (status & ACPI_EC_FLAG_IBF) == 0) | 585 | gpe_transaction(ec, status); |
| 563 | wake_up(&ec->wait); | 586 | if (ec_transaction_done(ec) && |
| 587 | (status & ACPI_EC_FLAG_IBF) == 0) | ||
| 588 | wake_up(&ec->wait); | ||
| 589 | } | ||
| 564 | 590 | ||
| 565 | ec_check_sci(ec, status); | 591 | ec_check_sci(ec, status); |
| 566 | if (!test_bit(EC_FLAGS_GPE_MODE, &ec->flags) && | 592 | if (!test_bit(EC_FLAGS_GPE_MODE, &ec->flags) && |
| 567 | !test_bit(EC_FLAGS_NO_GPE, &ec->flags)) { | 593 | !test_bit(EC_FLAGS_NO_GPE, &ec->flags)) { |
| 568 | /* this is non-query, must be confirmation */ | 594 | /* this is non-query, must be confirmation */ |
| 569 | if (printk_ratelimit()) | 595 | if (!test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { |
| 570 | pr_info(PREFIX "non-query interrupt received," | 596 | if (printk_ratelimit()) |
| 597 | pr_info(PREFIX "non-query interrupt received," | ||
| 598 | " switching to interrupt mode\n"); | ||
| 599 | } else { | ||
| 600 | /* hush, STORM switches the mode every transaction */ | ||
| 601 | pr_debug(PREFIX "non-query interrupt received," | ||
| 571 | " switching to interrupt mode\n"); | 602 | " switching to interrupt mode\n"); |
| 603 | } | ||
| 572 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 604 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
| 573 | } | 605 | } |
| 574 | return ACPI_INTERRUPT_HANDLED; | 606 | return ACPI_INTERRUPT_HANDLED; |
| @@ -736,7 +768,7 @@ static acpi_status | |||
| 736 | ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) | 768 | ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) |
| 737 | { | 769 | { |
| 738 | acpi_status status; | 770 | acpi_status status; |
| 739 | unsigned long long tmp; | 771 | unsigned long long tmp = 0; |
| 740 | 772 | ||
| 741 | struct acpi_ec *ec = context; | 773 | struct acpi_ec *ec = context; |
| 742 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | 774 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, |
| @@ -751,6 +783,7 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) | |||
| 751 | return status; | 783 | return status; |
| 752 | ec->gpe = tmp; | 784 | ec->gpe = tmp; |
| 753 | /* Use the global lock for all EC transactions? */ | 785 | /* Use the global lock for all EC transactions? */ |
| 786 | tmp = 0; | ||
| 754 | acpi_evaluate_integer(handle, "_GLK", NULL, &tmp); | 787 | acpi_evaluate_integer(handle, "_GLK", NULL, &tmp); |
| 755 | ec->global_lock = tmp; | 788 | ec->global_lock = tmp; |
| 756 | ec->handle = handle; | 789 | ec->handle = handle; |
| @@ -868,7 +901,7 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
| 868 | if (ACPI_FAILURE(status)) | 901 | if (ACPI_FAILURE(status)) |
| 869 | return -ENODEV; | 902 | return -ENODEV; |
| 870 | acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | 903 | acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); |
| 871 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | 904 | acpi_enable_gpe(NULL, ec->gpe); |
| 872 | status = acpi_install_address_space_handler(ec->handle, | 905 | status = acpi_install_address_space_handler(ec->handle, |
| 873 | ACPI_ADR_SPACE_EC, | 906 | ACPI_ADR_SPACE_EC, |
| 874 | &acpi_ec_space_handler, | 907 | &acpi_ec_space_handler, |
| @@ -1007,7 +1040,7 @@ static int acpi_ec_suspend(struct acpi_device *device, pm_message_t state) | |||
| 1007 | /* Stop using GPE */ | 1040 | /* Stop using GPE */ |
| 1008 | set_bit(EC_FLAGS_NO_GPE, &ec->flags); | 1041 | set_bit(EC_FLAGS_NO_GPE, &ec->flags); |
| 1009 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 1042 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
| 1010 | acpi_disable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | 1043 | acpi_disable_gpe(NULL, ec->gpe); |
| 1011 | return 0; | 1044 | return 0; |
| 1012 | } | 1045 | } |
| 1013 | 1046 | ||
| @@ -1016,7 +1049,7 @@ static int acpi_ec_resume(struct acpi_device *device) | |||
| 1016 | struct acpi_ec *ec = acpi_driver_data(device); | 1049 | struct acpi_ec *ec = acpi_driver_data(device); |
| 1017 | /* Enable use of GPE back */ | 1050 | /* Enable use of GPE back */ |
| 1018 | clear_bit(EC_FLAGS_NO_GPE, &ec->flags); | 1051 | clear_bit(EC_FLAGS_NO_GPE, &ec->flags); |
| 1019 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | 1052 | acpi_enable_gpe(NULL, ec->gpe); |
| 1020 | return 0; | 1053 | return 0; |
| 1021 | } | 1054 | } |
| 1022 | 1055 | ||
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index c5e53aae86f..f45c74fe745 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c | |||
| @@ -289,8 +289,6 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
| 289 | */ | 289 | */ |
| 290 | status = acpi_hw_low_disable_gpe(gpe_event_info); | 290 | status = acpi_hw_low_disable_gpe(gpe_event_info); |
| 291 | return_ACPI_STATUS(status); | 291 | return_ACPI_STATUS(status); |
| 292 | |||
| 293 | return_ACPI_STATUS(AE_OK); | ||
| 294 | } | 292 | } |
| 295 | 293 | ||
| 296 | /******************************************************************************* | 294 | /******************************************************************************* |
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index 73bfd6bf962..41554f736b6 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
| @@ -248,21 +248,15 @@ ACPI_EXPORT_SYMBOL(acpi_set_gpe_type) | |||
| 248 | * DESCRIPTION: Enable an ACPI event (general purpose) | 248 | * DESCRIPTION: Enable an ACPI event (general purpose) |
| 249 | * | 249 | * |
| 250 | ******************************************************************************/ | 250 | ******************************************************************************/ |
| 251 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | 251 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number) |
| 252 | { | 252 | { |
| 253 | acpi_status status = AE_OK; | 253 | acpi_status status = AE_OK; |
| 254 | acpi_cpu_flags flags; | ||
| 254 | struct acpi_gpe_event_info *gpe_event_info; | 255 | struct acpi_gpe_event_info *gpe_event_info; |
| 255 | 256 | ||
| 256 | ACPI_FUNCTION_TRACE(acpi_enable_gpe); | 257 | ACPI_FUNCTION_TRACE(acpi_enable_gpe); |
| 257 | 258 | ||
| 258 | /* Use semaphore lock if not executing at interrupt level */ | 259 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
| 259 | |||
| 260 | if (flags & ACPI_NOT_ISR) { | ||
| 261 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | ||
| 262 | if (ACPI_FAILURE(status)) { | ||
| 263 | return_ACPI_STATUS(status); | ||
| 264 | } | ||
| 265 | } | ||
| 266 | 260 | ||
| 267 | /* Ensure that we have a valid GPE number */ | 261 | /* Ensure that we have a valid GPE number */ |
| 268 | 262 | ||
| @@ -277,9 +271,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
| 277 | status = acpi_ev_enable_gpe(gpe_event_info, TRUE); | 271 | status = acpi_ev_enable_gpe(gpe_event_info, TRUE); |
| 278 | 272 | ||
| 279 | unlock_and_exit: | 273 | unlock_and_exit: |
| 280 | if (flags & ACPI_NOT_ISR) { | 274 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
| 281 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | ||
| 282 | } | ||
| 283 | return_ACPI_STATUS(status); | 275 | return_ACPI_STATUS(status); |
| 284 | } | 276 | } |
| 285 | 277 | ||
| @@ -299,22 +291,15 @@ ACPI_EXPORT_SYMBOL(acpi_enable_gpe) | |||
| 299 | * DESCRIPTION: Disable an ACPI event (general purpose) | 291 | * DESCRIPTION: Disable an ACPI event (general purpose) |
| 300 | * | 292 | * |
| 301 | ******************************************************************************/ | 293 | ******************************************************************************/ |
| 302 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | 294 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number) |
| 303 | { | 295 | { |
| 304 | acpi_status status = AE_OK; | 296 | acpi_status status = AE_OK; |
| 297 | acpi_cpu_flags flags; | ||
| 305 | struct acpi_gpe_event_info *gpe_event_info; | 298 | struct acpi_gpe_event_info *gpe_event_info; |
| 306 | 299 | ||
| 307 | ACPI_FUNCTION_TRACE(acpi_disable_gpe); | 300 | ACPI_FUNCTION_TRACE(acpi_disable_gpe); |
| 308 | 301 | ||
| 309 | /* Use semaphore lock if not executing at interrupt level */ | 302 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
| 310 | |||
| 311 | if (flags & ACPI_NOT_ISR) { | ||
| 312 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | ||
| 313 | if (ACPI_FAILURE(status)) { | ||
| 314 | return_ACPI_STATUS(status); | ||
| 315 | } | ||
| 316 | } | ||
| 317 | |||
| 318 | /* Ensure that we have a valid GPE number */ | 303 | /* Ensure that we have a valid GPE number */ |
| 319 | 304 | ||
| 320 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); | 305 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
| @@ -325,10 +310,8 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
| 325 | 310 | ||
| 326 | status = acpi_ev_disable_gpe(gpe_event_info); | 311 | status = acpi_ev_disable_gpe(gpe_event_info); |
| 327 | 312 | ||
| 328 | unlock_and_exit: | 313 | unlock_and_exit: |
| 329 | if (flags & ACPI_NOT_ISR) { | 314 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
| 330 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | ||
| 331 | } | ||
| 332 | return_ACPI_STATUS(status); | 315 | return_ACPI_STATUS(status); |
| 333 | } | 316 | } |
| 334 | 317 | ||
| @@ -521,6 +504,9 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) | |||
| 521 | if (value) | 504 | if (value) |
| 522 | *event_status |= ACPI_EVENT_FLAG_SET; | 505 | *event_status |= ACPI_EVENT_FLAG_SET; |
| 523 | 506 | ||
| 507 | if (acpi_gbl_fixed_event_handlers[event].handler) | ||
| 508 | *event_status |= ACPI_EVENT_FLAG_HANDLE; | ||
| 509 | |||
| 524 | return_ACPI_STATUS(status); | 510 | return_ACPI_STATUS(status); |
| 525 | } | 511 | } |
| 526 | 512 | ||
| @@ -571,6 +557,9 @@ acpi_get_gpe_status(acpi_handle gpe_device, | |||
| 571 | 557 | ||
| 572 | status = acpi_hw_get_gpe_status(gpe_event_info, event_status); | 558 | status = acpi_hw_get_gpe_status(gpe_event_info, event_status); |
| 573 | 559 | ||
| 560 | if (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) | ||
| 561 | *event_status |= ACPI_EVENT_FLAG_HANDLE; | ||
| 562 | |||
| 574 | unlock_and_exit: | 563 | unlock_and_exit: |
| 575 | if (flags & ACPI_NOT_ISR) { | 564 | if (flags & ACPI_NOT_ISR) { |
| 576 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 565 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 60d54d1f6b1..eaaee1660bd 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | #include <acpi/acpi_bus.h> | 34 | #include <acpi/acpi_bus.h> |
| 35 | #include <acpi/acpi_drivers.h> | 35 | #include <acpi/acpi_drivers.h> |
| 36 | 36 | ||
| 37 | #define ACPI_FAN_COMPONENT 0x00200000 | ||
| 38 | #define ACPI_FAN_CLASS "fan" | 37 | #define ACPI_FAN_CLASS "fan" |
| 39 | #define ACPI_FAN_FILE_STATE "state" | 38 | #define ACPI_FAN_FILE_STATE "state" |
| 40 | 39 | ||
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 24649ada08d..adec3d15810 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
| @@ -140,6 +140,46 @@ struct device *acpi_get_physical_device(acpi_handle handle) | |||
| 140 | 140 | ||
| 141 | EXPORT_SYMBOL(acpi_get_physical_device); | 141 | EXPORT_SYMBOL(acpi_get_physical_device); |
| 142 | 142 | ||
| 143 | /* ToDo: When a PCI bridge is found, return the PCI device behind the bridge | ||
| 144 | * This should work in general, but did not on a Lenovo T61 for the | ||
| 145 | * graphics card. But this must be fixed when the PCI device is | ||
| 146 | * bound and the kernel device struct is attached to the acpi device | ||
| 147 | * Note: A success call will increase reference count by one | ||
| 148 | * Do call put_device(dev) on the returned device then | ||
| 149 | */ | ||
| 150 | struct device *acpi_get_physical_pci_device(acpi_handle handle) | ||
| 151 | { | ||
| 152 | struct device *dev; | ||
| 153 | long long device_id; | ||
| 154 | acpi_status status; | ||
| 155 | |||
| 156 | status = | ||
| 157 | acpi_evaluate_integer(handle, "_ADR", NULL, &device_id); | ||
| 158 | |||
| 159 | if (ACPI_FAILURE(status)) | ||
| 160 | return NULL; | ||
| 161 | |||
| 162 | /* We need to attempt to determine whether the _ADR refers to a | ||
| 163 | PCI device or not. There's no terribly good way to do this, | ||
| 164 | so the best we can hope for is to assume that there'll never | ||
| 165 | be a device in the host bridge */ | ||
| 166 | if (device_id >= 0x10000) { | ||
| 167 | /* It looks like a PCI device. Does it exist? */ | ||
| 168 | dev = acpi_get_physical_device(handle); | ||
| 169 | } else { | ||
| 170 | /* It doesn't look like a PCI device. Does its parent | ||
| 171 | exist? */ | ||
| 172 | acpi_handle phandle; | ||
| 173 | if (acpi_get_parent(handle, &phandle)) | ||
| 174 | return NULL; | ||
| 175 | dev = acpi_get_physical_device(phandle); | ||
| 176 | } | ||
| 177 | if (!dev) | ||
| 178 | return NULL; | ||
| 179 | return dev; | ||
| 180 | } | ||
| 181 | EXPORT_SYMBOL(acpi_get_physical_pci_device); | ||
| 182 | |||
| 143 | static int acpi_bind_one(struct device *dev, acpi_handle handle) | 183 | static int acpi_bind_one(struct device *dev, acpi_handle handle) |
| 144 | { | 184 | { |
| 145 | struct acpi_device *acpi_dev; | 185 | struct acpi_device *acpi_dev; |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index fcfdef7b4fd..e52ad91ce2d 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
| @@ -531,7 +531,7 @@ int __init acpi_irq_penalty_init(void) | |||
| 531 | return 0; | 531 | return 0; |
| 532 | } | 532 | } |
| 533 | 533 | ||
| 534 | static int acpi_irq_balance; /* 0: static, 1: balance */ | 534 | static int acpi_irq_balance = -1; /* 0: static, 1: balance */ |
| 535 | 535 | ||
| 536 | static int acpi_pci_link_allocate(struct acpi_pci_link *link) | 536 | static int acpi_pci_link_allocate(struct acpi_pci_link *link) |
| 537 | { | 537 | { |
| @@ -950,10 +950,17 @@ device_initcall(irqrouter_init_sysfs); | |||
| 950 | 950 | ||
| 951 | static int __init acpi_pci_link_init(void) | 951 | static int __init acpi_pci_link_init(void) |
| 952 | { | 952 | { |
| 953 | |||
| 954 | if (acpi_noirq) | 953 | if (acpi_noirq) |
| 955 | return 0; | 954 | return 0; |
| 956 | 955 | ||
| 956 | if (acpi_irq_balance == -1) { | ||
| 957 | /* no command line switch: enable balancing in IOAPIC mode */ | ||
| 958 | if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) | ||
| 959 | acpi_irq_balance = 1; | ||
| 960 | else | ||
| 961 | acpi_irq_balance = 0; | ||
| 962 | } | ||
| 963 | |||
| 957 | acpi_link.count = 0; | 964 | acpi_link.count = 0; |
| 958 | INIT_LIST_HEAD(&acpi_link.entries); | 965 | INIT_LIST_HEAD(&acpi_link.entries); |
| 959 | 966 | ||
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 1b8f67d21d5..642554b1b60 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
| @@ -376,15 +376,9 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type) | |||
| 376 | 376 | ||
| 377 | static int __init acpi_pci_root_init(void) | 377 | static int __init acpi_pci_root_init(void) |
| 378 | { | 378 | { |
| 379 | |||
| 380 | if (acpi_pci_disabled) | 379 | if (acpi_pci_disabled) |
| 381 | return 0; | 380 | return 0; |
| 382 | 381 | ||
| 383 | /* DEBUG: | ||
| 384 | acpi_dbg_layer = ACPI_PCI_COMPONENT; | ||
| 385 | acpi_dbg_level = 0xFFFFFFFF; | ||
| 386 | */ | ||
| 387 | |||
| 388 | if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) | 382 | if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) |
| 389 | return -ENODEV; | 383 | return -ENODEV; |
| 390 | 384 | ||
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index a1718e56103..bb7d50dd281 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
| @@ -44,9 +44,8 @@ | |||
| 44 | #include <acpi/acpi_bus.h> | 44 | #include <acpi/acpi_bus.h> |
| 45 | #include <acpi/acpi_drivers.h> | 45 | #include <acpi/acpi_drivers.h> |
| 46 | 46 | ||
| 47 | #define _COMPONENT ACPI_POWER_COMPONENT | 47 | #define _COMPONENT ACPI_POWER_COMPONENT |
| 48 | ACPI_MODULE_NAME("power"); | 48 | ACPI_MODULE_NAME("power"); |
| 49 | #define ACPI_POWER_COMPONENT 0x00800000 | ||
| 50 | #define ACPI_POWER_CLASS "power_resource" | 49 | #define ACPI_POWER_CLASS "power_resource" |
| 51 | #define ACPI_POWER_DEVICE_NAME "Power Resource" | 50 | #define ACPI_POWER_DEVICE_NAME "Power Resource" |
| 52 | #define ACPI_POWER_FILE_INFO "info" | 51 | #define ACPI_POWER_FILE_INFO "info" |
| @@ -153,7 +152,8 @@ static int acpi_power_get_state(acpi_handle handle, int *state) | |||
| 153 | ACPI_POWER_RESOURCE_STATE_OFF; | 152 | ACPI_POWER_RESOURCE_STATE_OFF; |
| 154 | 153 | ||
| 155 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", | 154 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", |
| 156 | acpi_ut_get_node_name(handle), state ? "on" : "off")); | 155 | acpi_ut_get_node_name(handle), |
| 156 | *state ? "on" : "off")); | ||
| 157 | 157 | ||
| 158 | return 0; | 158 | return 0; |
| 159 | } | 159 | } |
| @@ -516,11 +516,6 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
| 516 | cl = &device->power.states[device->power.state].resources; | 516 | cl = &device->power.states[device->power.state].resources; |
| 517 | tl = &device->power.states[state].resources; | 517 | tl = &device->power.states[state].resources; |
| 518 | 518 | ||
| 519 | if (!cl->count && !tl->count) { | ||
| 520 | result = -ENODEV; | ||
| 521 | goto end; | ||
| 522 | } | ||
| 523 | |||
| 524 | /* TBD: Resources must be ordered. */ | 519 | /* TBD: Resources must be ordered. */ |
| 525 | 520 | ||
| 526 | /* | 521 | /* |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 24a362f8034..34948362f41 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
| @@ -59,7 +59,6 @@ | |||
| 59 | #include <acpi/acpi_drivers.h> | 59 | #include <acpi/acpi_drivers.h> |
| 60 | #include <acpi/processor.h> | 60 | #include <acpi/processor.h> |
| 61 | 61 | ||
| 62 | #define ACPI_PROCESSOR_COMPONENT 0x01000000 | ||
| 63 | #define ACPI_PROCESSOR_CLASS "processor" | 62 | #define ACPI_PROCESSOR_CLASS "processor" |
| 64 | #define ACPI_PROCESSOR_DEVICE_NAME "Processor" | 63 | #define ACPI_PROCESSOR_DEVICE_NAME "Processor" |
| 65 | #define ACPI_PROCESSOR_FILE_INFO "info" | 64 | #define ACPI_PROCESSOR_FILE_INFO "info" |
| @@ -89,6 +88,7 @@ static int acpi_processor_handle_eject(struct acpi_processor *pr); | |||
| 89 | 88 | ||
| 90 | 89 | ||
| 91 | static const struct acpi_device_id processor_device_ids[] = { | 90 | static const struct acpi_device_id processor_device_ids[] = { |
| 91 | {ACPI_PROCESSOR_OBJECT_HID, 0}, | ||
| 92 | {ACPI_PROCESSOR_HID, 0}, | 92 | {ACPI_PROCESSOR_HID, 0}, |
| 93 | {"", 0}, | 93 | {"", 0}, |
| 94 | }; | 94 | }; |
| @@ -409,7 +409,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device) | |||
| 409 | /* Use the acpiid in MADT to map cpus in case of SMP */ | 409 | /* Use the acpiid in MADT to map cpus in case of SMP */ |
| 410 | 410 | ||
| 411 | #ifndef CONFIG_SMP | 411 | #ifndef CONFIG_SMP |
| 412 | static int get_cpu_id(acpi_handle handle, u32 acpi_id) {return -1;} | 412 | static int get_cpu_id(acpi_handle handle, int type, u32 acpi_id) { return -1; } |
| 413 | #else | 413 | #else |
| 414 | 414 | ||
| 415 | static struct acpi_table_madt *madt; | 415 | static struct acpi_table_madt *madt; |
| @@ -428,27 +428,35 @@ static int map_lapic_id(struct acpi_subtable_header *entry, | |||
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | static int map_lsapic_id(struct acpi_subtable_header *entry, | 430 | static int map_lsapic_id(struct acpi_subtable_header *entry, |
| 431 | u32 acpi_id, int *apic_id) | 431 | int device_declaration, u32 acpi_id, int *apic_id) |
| 432 | { | 432 | { |
| 433 | struct acpi_madt_local_sapic *lsapic = | 433 | struct acpi_madt_local_sapic *lsapic = |
| 434 | (struct acpi_madt_local_sapic *)entry; | 434 | (struct acpi_madt_local_sapic *)entry; |
| 435 | u32 tmp = (lsapic->id << 8) | lsapic->eid; | ||
| 436 | |||
| 435 | /* Only check enabled APICs*/ | 437 | /* Only check enabled APICs*/ |
| 436 | if (lsapic->lapic_flags & ACPI_MADT_ENABLED) { | 438 | if (!(lsapic->lapic_flags & ACPI_MADT_ENABLED)) |
| 437 | /* First check against id */ | 439 | return 0; |
| 438 | if (lsapic->processor_id == acpi_id) { | 440 | |
| 439 | *apic_id = (lsapic->id << 8) | lsapic->eid; | 441 | /* Device statement declaration type */ |
| 440 | return 1; | 442 | if (device_declaration) { |
| 441 | /* Check against optional uid */ | 443 | if (entry->length < 16) |
| 442 | } else if (entry->length >= 16 && | 444 | printk(KERN_ERR PREFIX |
| 443 | lsapic->uid == acpi_id) { | 445 | "Invalid LSAPIC with Device type processor (SAPIC ID %#x)\n", |
| 444 | *apic_id = lsapic->uid; | 446 | tmp); |
| 445 | return 1; | 447 | else if (lsapic->uid == acpi_id) |
| 446 | } | 448 | goto found; |
| 447 | } | 449 | /* Processor statement declaration type */ |
| 450 | } else if (lsapic->processor_id == acpi_id) | ||
| 451 | goto found; | ||
| 452 | |||
| 448 | return 0; | 453 | return 0; |
| 454 | found: | ||
| 455 | *apic_id = tmp; | ||
| 456 | return 1; | ||
| 449 | } | 457 | } |
| 450 | 458 | ||
| 451 | static int map_madt_entry(u32 acpi_id) | 459 | static int map_madt_entry(int type, u32 acpi_id) |
| 452 | { | 460 | { |
| 453 | unsigned long madt_end, entry; | 461 | unsigned long madt_end, entry; |
| 454 | int apic_id = -1; | 462 | int apic_id = -1; |
| @@ -469,7 +477,7 @@ static int map_madt_entry(u32 acpi_id) | |||
| 469 | if (map_lapic_id(header, acpi_id, &apic_id)) | 477 | if (map_lapic_id(header, acpi_id, &apic_id)) |
| 470 | break; | 478 | break; |
| 471 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { | 479 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { |
| 472 | if (map_lsapic_id(header, acpi_id, &apic_id)) | 480 | if (map_lsapic_id(header, type, acpi_id, &apic_id)) |
| 473 | break; | 481 | break; |
| 474 | } | 482 | } |
| 475 | entry += header->length; | 483 | entry += header->length; |
| @@ -477,7 +485,7 @@ static int map_madt_entry(u32 acpi_id) | |||
| 477 | return apic_id; | 485 | return apic_id; |
| 478 | } | 486 | } |
| 479 | 487 | ||
| 480 | static int map_mat_entry(acpi_handle handle, u32 acpi_id) | 488 | static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) |
| 481 | { | 489 | { |
| 482 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 490 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
| 483 | union acpi_object *obj; | 491 | union acpi_object *obj; |
| @@ -500,7 +508,7 @@ static int map_mat_entry(acpi_handle handle, u32 acpi_id) | |||
| 500 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { | 508 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { |
| 501 | map_lapic_id(header, acpi_id, &apic_id); | 509 | map_lapic_id(header, acpi_id, &apic_id); |
| 502 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { | 510 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { |
| 503 | map_lsapic_id(header, acpi_id, &apic_id); | 511 | map_lsapic_id(header, type, acpi_id, &apic_id); |
| 504 | } | 512 | } |
| 505 | 513 | ||
| 506 | exit: | 514 | exit: |
| @@ -509,14 +517,14 @@ exit: | |||
| 509 | return apic_id; | 517 | return apic_id; |
| 510 | } | 518 | } |
| 511 | 519 | ||
| 512 | static int get_cpu_id(acpi_handle handle, u32 acpi_id) | 520 | static int get_cpu_id(acpi_handle handle, int type, u32 acpi_id) |
| 513 | { | 521 | { |
| 514 | int i; | 522 | int i; |
| 515 | int apic_id = -1; | 523 | int apic_id = -1; |
| 516 | 524 | ||
| 517 | apic_id = map_mat_entry(handle, acpi_id); | 525 | apic_id = map_mat_entry(handle, type, acpi_id); |
| 518 | if (apic_id == -1) | 526 | if (apic_id == -1) |
| 519 | apic_id = map_madt_entry(acpi_id); | 527 | apic_id = map_madt_entry(type, acpi_id); |
| 520 | if (apic_id == -1) | 528 | if (apic_id == -1) |
| 521 | return apic_id; | 529 | return apic_id; |
| 522 | 530 | ||
| @@ -532,15 +540,16 @@ static int get_cpu_id(acpi_handle handle, u32 acpi_id) | |||
| 532 | Driver Interface | 540 | Driver Interface |
| 533 | -------------------------------------------------------------------------- */ | 541 | -------------------------------------------------------------------------- */ |
| 534 | 542 | ||
| 535 | static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid) | 543 | static int acpi_processor_get_info(struct acpi_device *device) |
| 536 | { | 544 | { |
| 537 | acpi_status status = 0; | 545 | acpi_status status = 0; |
| 538 | union acpi_object object = { 0 }; | 546 | union acpi_object object = { 0 }; |
| 539 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; | 547 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; |
| 540 | int cpu_index; | 548 | struct acpi_processor *pr; |
| 549 | int cpu_index, device_declaration = 0; | ||
| 541 | static int cpu0_initialized; | 550 | static int cpu0_initialized; |
| 542 | 551 | ||
| 543 | 552 | pr = acpi_driver_data(device); | |
| 544 | if (!pr) | 553 | if (!pr) |
| 545 | return -EINVAL; | 554 | return -EINVAL; |
| 546 | 555 | ||
| @@ -561,22 +570,23 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid) | |||
| 561 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 570 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 562 | "No bus mastering arbitration control\n")); | 571 | "No bus mastering arbitration control\n")); |
| 563 | 572 | ||
| 564 | /* Check if it is a Device with HID and UID */ | 573 | if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_HID)) { |
| 565 | if (has_uid) { | 574 | /* |
| 575 | * Declared with "Device" statement; match _UID. | ||
| 576 | * Note that we don't handle string _UIDs yet. | ||
| 577 | */ | ||
| 566 | unsigned long long value; | 578 | unsigned long long value; |
| 567 | status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID, | 579 | status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID, |
| 568 | NULL, &value); | 580 | NULL, &value); |
| 569 | if (ACPI_FAILURE(status)) { | 581 | if (ACPI_FAILURE(status)) { |
| 570 | printk(KERN_ERR PREFIX "Evaluating processor _UID\n"); | 582 | printk(KERN_ERR PREFIX |
| 583 | "Evaluating processor _UID [%#x]\n", status); | ||
| 571 | return -ENODEV; | 584 | return -ENODEV; |
| 572 | } | 585 | } |
| 586 | device_declaration = 1; | ||
| 573 | pr->acpi_id = value; | 587 | pr->acpi_id = value; |
| 574 | } else { | 588 | } else { |
| 575 | /* | 589 | /* Declared with "Processor" statement; match ProcessorID */ |
| 576 | * Evalute the processor object. Note that it is common on SMP to | ||
| 577 | * have the first (boot) processor with a valid PBLK address while | ||
| 578 | * all others have a NULL address. | ||
| 579 | */ | ||
| 580 | status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); | 590 | status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); |
| 581 | if (ACPI_FAILURE(status)) { | 591 | if (ACPI_FAILURE(status)) { |
| 582 | printk(KERN_ERR PREFIX "Evaluating processor object\n"); | 592 | printk(KERN_ERR PREFIX "Evaluating processor object\n"); |
| @@ -584,12 +594,13 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid) | |||
| 584 | } | 594 | } |
| 585 | 595 | ||
| 586 | /* | 596 | /* |
| 587 | * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. | 597 | * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. |
| 588 | * >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c | 598 | * >>> 'acpi_get_processor_id(acpi_id, &id)' in |
| 589 | */ | 599 | * arch/xxx/acpi.c |
| 600 | */ | ||
| 590 | pr->acpi_id = object.processor.proc_id; | 601 | pr->acpi_id = object.processor.proc_id; |
| 591 | } | 602 | } |
| 592 | cpu_index = get_cpu_id(pr->handle, pr->acpi_id); | 603 | cpu_index = get_cpu_id(pr->handle, device_declaration, pr->acpi_id); |
| 593 | 604 | ||
| 594 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ | 605 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ |
| 595 | if (!cpu0_initialized && (cpu_index == -1) && | 606 | if (!cpu0_initialized && (cpu_index == -1) && |
| @@ -661,7 +672,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
| 661 | 672 | ||
| 662 | pr = acpi_driver_data(device); | 673 | pr = acpi_driver_data(device); |
| 663 | 674 | ||
| 664 | result = acpi_processor_get_info(pr, device->flags.unique_id); | 675 | result = acpi_processor_get_info(device); |
| 665 | if (result) { | 676 | if (result) { |
| 666 | /* Processor is physically not present */ | 677 | /* Processor is physically not present */ |
| 667 | return 0; | 678 | return 0; |
| @@ -761,20 +772,20 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) | |||
| 761 | acpi_bus_generate_proc_event(device, event, | 772 | acpi_bus_generate_proc_event(device, event, |
| 762 | pr->performance_platform_limit); | 773 | pr->performance_platform_limit); |
| 763 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 774 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
| 764 | device->dev.bus_id, event, | 775 | dev_name(&device->dev), event, |
| 765 | pr->performance_platform_limit); | 776 | pr->performance_platform_limit); |
| 766 | break; | 777 | break; |
| 767 | case ACPI_PROCESSOR_NOTIFY_POWER: | 778 | case ACPI_PROCESSOR_NOTIFY_POWER: |
| 768 | acpi_processor_cst_has_changed(pr); | 779 | acpi_processor_cst_has_changed(pr); |
| 769 | acpi_bus_generate_proc_event(device, event, 0); | 780 | acpi_bus_generate_proc_event(device, event, 0); |
| 770 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 781 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
| 771 | device->dev.bus_id, event, 0); | 782 | dev_name(&device->dev), event, 0); |
| 772 | break; | 783 | break; |
| 773 | case ACPI_PROCESSOR_NOTIFY_THROTTLING: | 784 | case ACPI_PROCESSOR_NOTIFY_THROTTLING: |
| 774 | acpi_processor_tstate_has_changed(pr); | 785 | acpi_processor_tstate_has_changed(pr); |
| 775 | acpi_bus_generate_proc_event(device, event, 0); | 786 | acpi_bus_generate_proc_event(device, event, 0); |
| 776 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 787 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
| 777 | device->dev.bus_id, event, 0); | 788 | dev_name(&device->dev), event, 0); |
| 778 | default: | 789 | default: |
| 779 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 790 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 780 | "Unsupported event [0x%x]\n", event)); | 791 | "Unsupported event [0x%x]\n", event)); |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 81b40ed5379..5f8d746a9b8 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
| @@ -59,7 +59,6 @@ | |||
| 59 | #include <acpi/processor.h> | 59 | #include <acpi/processor.h> |
| 60 | #include <asm/processor.h> | 60 | #include <asm/processor.h> |
| 61 | 61 | ||
| 62 | #define ACPI_PROCESSOR_COMPONENT 0x01000000 | ||
| 63 | #define ACPI_PROCESSOR_CLASS "processor" | 62 | #define ACPI_PROCESSOR_CLASS "processor" |
| 64 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 63 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
| 65 | ACPI_MODULE_NAME("processor_idle"); | 64 | ACPI_MODULE_NAME("processor_idle"); |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index dbcf260ea93..0d7b772bef5 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
| @@ -44,9 +44,9 @@ | |||
| 44 | #endif | 44 | #endif |
| 45 | 45 | ||
| 46 | #include <acpi/acpi_bus.h> | 46 | #include <acpi/acpi_bus.h> |
| 47 | #include <acpi/acpi_drivers.h> | ||
| 47 | #include <acpi/processor.h> | 48 | #include <acpi/processor.h> |
| 48 | 49 | ||
| 49 | #define ACPI_PROCESSOR_COMPONENT 0x01000000 | ||
| 50 | #define ACPI_PROCESSOR_CLASS "processor" | 50 | #define ACPI_PROCESSOR_CLASS "processor" |
| 51 | #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance" | 51 | #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance" |
| 52 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 52 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index ef34b18f95c..b1eb376fae4 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c | |||
| @@ -40,7 +40,6 @@ | |||
| 40 | #include <acpi/processor.h> | 40 | #include <acpi/processor.h> |
| 41 | #include <acpi/acpi_drivers.h> | 41 | #include <acpi/acpi_drivers.h> |
| 42 | 42 | ||
| 43 | #define ACPI_PROCESSOR_COMPONENT 0x01000000 | ||
| 44 | #define ACPI_PROCESSOR_CLASS "processor" | 43 | #define ACPI_PROCESSOR_CLASS "processor" |
| 45 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 44 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
| 46 | ACPI_MODULE_NAME("processor_thermal"); | 45 | ACPI_MODULE_NAME("processor_thermal"); |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 3da2df93d92..a0c38c94a8a 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
| @@ -38,9 +38,9 @@ | |||
| 38 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
| 39 | 39 | ||
| 40 | #include <acpi/acpi_bus.h> | 40 | #include <acpi/acpi_bus.h> |
| 41 | #include <acpi/acpi_drivers.h> | ||
| 41 | #include <acpi/processor.h> | 42 | #include <acpi/processor.h> |
| 42 | 43 | ||
| 43 | #define ACPI_PROCESSOR_COMPONENT 0x01000000 | ||
| 44 | #define ACPI_PROCESSOR_CLASS "processor" | 44 | #define ACPI_PROCESSOR_CLASS "processor" |
| 45 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 45 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
| 46 | ACPI_MODULE_NAME("processor_throttling"); | 46 | ACPI_MODULE_NAME("processor_throttling"); |
diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c index 755baf2ca70..a6b662c00b6 100644 --- a/drivers/acpi/reboot.c +++ b/drivers/acpi/reboot.c | |||
| @@ -15,28 +15,9 @@ void acpi_reboot(void) | |||
| 15 | 15 | ||
| 16 | rr = &acpi_gbl_FADT.reset_register; | 16 | rr = &acpi_gbl_FADT.reset_register; |
| 17 | 17 | ||
| 18 | /* | 18 | /* Is the reset register supported? */ |
| 19 | * Is the ACPI reset register supported? | 19 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) || |
| 20 | * | 20 | rr->bit_width != 8 || rr->bit_offset != 0) |
| 21 | * According to ACPI 3.0, FADT.flags.RESET_REG_SUP indicates | ||
| 22 | * whether the ACPI reset mechanism is supported. | ||
| 23 | * | ||
| 24 | * However, some boxes have this bit clear, yet a valid | ||
| 25 | * ACPI_RESET_REG & RESET_VALUE, and ACPI reboot is the only | ||
| 26 | * mechanism that works for them after S3. | ||
| 27 | * | ||
| 28 | * This suggests that other operating systems may not be checking | ||
| 29 | * the RESET_REG_SUP bit, and are using other means to decide | ||
| 30 | * whether to use the ACPI reboot mechanism or not. | ||
| 31 | * | ||
| 32 | * So when acpi reboot is requested, | ||
| 33 | * only the reset_register is checked. If the following | ||
| 34 | * conditions are met, it indicates that the reset register is supported. | ||
| 35 | * a. reset_register is not zero | ||
| 36 | * b. the access width is eight | ||
| 37 | * c. the bit_offset is zero | ||
| 38 | */ | ||
| 39 | if (!(rr->address) || rr->bit_width != 8 || rr->bit_offset != 0) | ||
| 40 | return; | 21 | return; |
| 41 | 22 | ||
| 42 | reset_value = acpi_gbl_FADT.reset_value; | 23 | reset_value = acpi_gbl_FADT.reset_value; |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index a9dda8e0f9f..bd5253ee5c8 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -109,8 +109,7 @@ static int acpi_bus_hot_remove_device(void *context) | |||
| 109 | return 0; | 109 | return 0; |
| 110 | 110 | ||
| 111 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 111 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 112 | "Hot-removing device %s...\n", device->dev.bus_id)); | 112 | "Hot-removing device %s...\n", dev_name(&device->dev))); |
| 113 | |||
| 114 | 113 | ||
| 115 | if (acpi_bus_trim(device, 1)) { | 114 | if (acpi_bus_trim(device, 1)) { |
| 116 | printk(KERN_ERR PREFIX | 115 | printk(KERN_ERR PREFIX |
| @@ -460,7 +459,7 @@ static int acpi_device_register(struct acpi_device *device, | |||
| 460 | acpi_device_bus_id->instance_no = 0; | 459 | acpi_device_bus_id->instance_no = 0; |
| 461 | list_add_tail(&acpi_device_bus_id->node, &acpi_bus_id_list); | 460 | list_add_tail(&acpi_device_bus_id->node, &acpi_bus_id_list); |
| 462 | } | 461 | } |
| 463 | sprintf(device->dev.bus_id, "%s:%02x", acpi_device_bus_id->bus_id, acpi_device_bus_id->instance_no); | 462 | dev_set_name(&device->dev, "%s:%02x", acpi_device_bus_id->bus_id, acpi_device_bus_id->instance_no); |
| 464 | 463 | ||
| 465 | if (device->parent) { | 464 | if (device->parent) { |
| 466 | list_add_tail(&device->node, &device->parent->children); | 465 | list_add_tail(&device->node, &device->parent->children); |
| @@ -484,7 +483,8 @@ static int acpi_device_register(struct acpi_device *device, | |||
| 484 | 483 | ||
| 485 | result = acpi_device_setup_files(device); | 484 | result = acpi_device_setup_files(device); |
| 486 | if(result) | 485 | if(result) |
| 487 | printk(KERN_ERR PREFIX "Error creating sysfs interface for device %s\n", device->dev.bus_id); | 486 | printk(KERN_ERR PREFIX "Error creating sysfs interface for device %s\n", |
| 487 | dev_name(&device->dev)); | ||
| 488 | 488 | ||
| 489 | device->removal_type = ACPI_BUS_REMOVAL_NORMAL; | 489 | device->removal_type = ACPI_BUS_REMOVAL_NORMAL; |
| 490 | return 0; | 490 | return 0; |
| @@ -919,36 +919,6 @@ static void acpi_device_get_busid(struct acpi_device *device, | |||
| 919 | } | 919 | } |
| 920 | } | 920 | } |
| 921 | 921 | ||
| 922 | static int | ||
| 923 | acpi_video_bus_match(struct acpi_device *device) | ||
| 924 | { | ||
| 925 | acpi_handle h_dummy; | ||
| 926 | |||
| 927 | if (!device) | ||
| 928 | return -EINVAL; | ||
| 929 | |||
| 930 | /* Since there is no HID, CID for ACPI Video drivers, we have | ||
| 931 | * to check well known required nodes for each feature we support. | ||
| 932 | */ | ||
| 933 | |||
| 934 | /* Does this device able to support video switching ? */ | ||
| 935 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) && | ||
| 936 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy))) | ||
| 937 | return 0; | ||
| 938 | |||
| 939 | /* Does this device able to retrieve a video ROM ? */ | ||
| 940 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) | ||
| 941 | return 0; | ||
| 942 | |||
| 943 | /* Does this device able to configure which video head to be POSTed ? */ | ||
| 944 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy)) && | ||
| 945 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy)) && | ||
| 946 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy))) | ||
| 947 | return 0; | ||
| 948 | |||
| 949 | return -ENODEV; | ||
| 950 | } | ||
| 951 | |||
| 952 | /* | 922 | /* |
| 953 | * acpi_bay_match - see if a device is an ejectable driver bay | 923 | * acpi_bay_match - see if a device is an ejectable driver bay |
| 954 | * | 924 | * |
| @@ -1031,7 +1001,7 @@ static void acpi_device_set_id(struct acpi_device *device, | |||
| 1031 | will get autoloaded and the device might still match | 1001 | will get autoloaded and the device might still match |
| 1032 | against another driver. | 1002 | against another driver. |
| 1033 | */ | 1003 | */ |
| 1034 | if (ACPI_SUCCESS(acpi_video_bus_match(device))) | 1004 | if (acpi_is_video_device(device)) |
| 1035 | cid_add = ACPI_VIDEO_HID; | 1005 | cid_add = ACPI_VIDEO_HID; |
| 1036 | else if (ACPI_SUCCESS(acpi_bay_match(device))) | 1006 | else if (ACPI_SUCCESS(acpi_bay_match(device))) |
| 1037 | cid_add = ACPI_BAY_HID; | 1007 | cid_add = ACPI_BAY_HID; |
| @@ -1043,7 +1013,7 @@ static void acpi_device_set_id(struct acpi_device *device, | |||
| 1043 | hid = ACPI_POWER_HID; | 1013 | hid = ACPI_POWER_HID; |
| 1044 | break; | 1014 | break; |
| 1045 | case ACPI_BUS_TYPE_PROCESSOR: | 1015 | case ACPI_BUS_TYPE_PROCESSOR: |
| 1046 | hid = ACPI_PROCESSOR_HID; | 1016 | hid = ACPI_PROCESSOR_OBJECT_HID; |
| 1047 | break; | 1017 | break; |
| 1048 | case ACPI_BUS_TYPE_SYSTEM: | 1018 | case ACPI_BUS_TYPE_SYSTEM: |
| 1049 | hid = ACPI_SYSTEM_HID; | 1019 | hid = ACPI_SYSTEM_HID; |
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c index 631ee2ee2ca..4dbc2271acf 100644 --- a/drivers/acpi/sleep/proc.c +++ b/drivers/acpi/sleep/proc.c | |||
| @@ -367,7 +367,7 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
| 367 | if (ldev) | 367 | if (ldev) |
| 368 | seq_printf(seq, "%s:%s", | 368 | seq_printf(seq, "%s:%s", |
| 369 | ldev->bus ? ldev->bus->name : "no-bus", | 369 | ldev->bus ? ldev->bus->name : "no-bus", |
| 370 | ldev->bus_id); | 370 | dev_name(ldev)); |
| 371 | seq_printf(seq, "\n"); | 371 | seq_printf(seq, "\n"); |
| 372 | put_device(ldev); | 372 | put_device(ldev); |
| 373 | 373 | ||
diff --git a/drivers/acpi/sleep/wakeup.c b/drivers/acpi/sleep/wakeup.c index 38655eb132d..dea4c23df76 100644 --- a/drivers/acpi/sleep/wakeup.c +++ b/drivers/acpi/sleep/wakeup.c | |||
| @@ -88,7 +88,7 @@ void acpi_enable_wakeup_device(u8 sleep_state) | |||
| 88 | spin_unlock(&acpi_device_lock); | 88 | spin_unlock(&acpi_device_lock); |
| 89 | if (!dev->wakeup.flags.run_wake) | 89 | if (!dev->wakeup.flags.run_wake) |
| 90 | acpi_enable_gpe(dev->wakeup.gpe_device, | 90 | acpi_enable_gpe(dev->wakeup.gpe_device, |
| 91 | dev->wakeup.gpe_number, ACPI_ISR); | 91 | dev->wakeup.gpe_number); |
| 92 | spin_lock(&acpi_device_lock); | 92 | spin_lock(&acpi_device_lock); |
| 93 | } | 93 | } |
| 94 | spin_unlock(&acpi_device_lock); | 94 | spin_unlock(&acpi_device_lock); |
| @@ -122,7 +122,7 @@ void acpi_disable_wakeup_device(u8 sleep_state) | |||
| 122 | ACPI_GPE_TYPE_WAKE_RUN); | 122 | ACPI_GPE_TYPE_WAKE_RUN); |
| 123 | /* Re-enable it, since set_gpe_type will disable it */ | 123 | /* Re-enable it, since set_gpe_type will disable it */ |
| 124 | acpi_enable_gpe(dev->wakeup.gpe_device, | 124 | acpi_enable_gpe(dev->wakeup.gpe_device, |
| 125 | dev->wakeup.gpe_number, ACPI_NOT_ISR); | 125 | dev->wakeup.gpe_number); |
| 126 | spin_lock(&acpi_device_lock); | 126 | spin_lock(&acpi_device_lock); |
| 127 | } | 127 | } |
| 128 | continue; | 128 | continue; |
| @@ -133,7 +133,7 @@ void acpi_disable_wakeup_device(u8 sleep_state) | |||
| 133 | /* Never disable run-wake GPE */ | 133 | /* Never disable run-wake GPE */ |
| 134 | if (!dev->wakeup.flags.run_wake) { | 134 | if (!dev->wakeup.flags.run_wake) { |
| 135 | acpi_disable_gpe(dev->wakeup.gpe_device, | 135 | acpi_disable_gpe(dev->wakeup.gpe_device, |
| 136 | dev->wakeup.gpe_number, ACPI_NOT_ISR); | 136 | dev->wakeup.gpe_number); |
| 137 | acpi_clear_gpe(dev->wakeup.gpe_device, | 137 | acpi_clear_gpe(dev->wakeup.gpe_device, |
| 138 | dev->wakeup.gpe_number, ACPI_NOT_ISR); | 138 | dev->wakeup.gpe_number, ACPI_NOT_ISR); |
| 139 | } | 139 | } |
| @@ -162,7 +162,7 @@ static int __init acpi_wakeup_device_init(void) | |||
| 162 | dev->wakeup.gpe_number, | 162 | dev->wakeup.gpe_number, |
| 163 | ACPI_GPE_TYPE_WAKE_RUN); | 163 | ACPI_GPE_TYPE_WAKE_RUN); |
| 164 | acpi_enable_gpe(dev->wakeup.gpe_device, | 164 | acpi_enable_gpe(dev->wakeup.gpe_device, |
| 165 | dev->wakeup.gpe_number, ACPI_NOT_ISR); | 165 | dev->wakeup.gpe_number); |
| 166 | dev->wakeup.state.enabled = 1; | 166 | dev->wakeup.state.enabled = 1; |
| 167 | spin_lock(&acpi_device_lock); | 167 | spin_lock(&acpi_device_lock); |
| 168 | } | 168 | } |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 1d74171b794..6e4107f8240 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
| @@ -78,9 +78,15 @@ static ssize_t acpi_table_show(struct kobject *kobj, | |||
| 78 | container_of(bin_attr, struct acpi_table_attr, attr); | 78 | container_of(bin_attr, struct acpi_table_attr, attr); |
| 79 | struct acpi_table_header *table_header = NULL; | 79 | struct acpi_table_header *table_header = NULL; |
| 80 | acpi_status status; | 80 | acpi_status status; |
| 81 | char name[ACPI_NAME_SIZE]; | ||
| 82 | |||
| 83 | if (strncmp(table_attr->name, "NULL", 4)) | ||
| 84 | memcpy(name, table_attr->name, ACPI_NAME_SIZE); | ||
| 85 | else | ||
| 86 | memcpy(name, "\0\0\0\0", 4); | ||
| 81 | 87 | ||
| 82 | status = | 88 | status = |
| 83 | acpi_get_table(table_attr->name, table_attr->instance, | 89 | acpi_get_table(name, table_attr->instance, |
| 84 | &table_header); | 90 | &table_header); |
| 85 | if (ACPI_FAILURE(status)) | 91 | if (ACPI_FAILURE(status)) |
| 86 | return -ENODEV; | 92 | return -ENODEV; |
| @@ -95,21 +101,24 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr, | |||
| 95 | struct acpi_table_header *header = NULL; | 101 | struct acpi_table_header *header = NULL; |
| 96 | struct acpi_table_attr *attr = NULL; | 102 | struct acpi_table_attr *attr = NULL; |
| 97 | 103 | ||
| 98 | memcpy(table_attr->name, table_header->signature, ACPI_NAME_SIZE); | 104 | if (table_header->signature[0] != '\0') |
| 105 | memcpy(table_attr->name, table_header->signature, | ||
| 106 | ACPI_NAME_SIZE); | ||
| 107 | else | ||
| 108 | memcpy(table_attr->name, "NULL", 4); | ||
| 99 | 109 | ||
| 100 | list_for_each_entry(attr, &acpi_table_attr_list, node) { | 110 | list_for_each_entry(attr, &acpi_table_attr_list, node) { |
| 101 | if (!memcmp(table_header->signature, attr->name, | 111 | if (!memcmp(table_attr->name, attr->name, ACPI_NAME_SIZE)) |
| 102 | ACPI_NAME_SIZE)) | ||
| 103 | if (table_attr->instance < attr->instance) | 112 | if (table_attr->instance < attr->instance) |
| 104 | table_attr->instance = attr->instance; | 113 | table_attr->instance = attr->instance; |
| 105 | } | 114 | } |
| 106 | table_attr->instance++; | 115 | table_attr->instance++; |
| 107 | 116 | ||
| 108 | if (table_attr->instance > 1 || (table_attr->instance == 1 && | 117 | if (table_attr->instance > 1 || (table_attr->instance == 1 && |
| 109 | !acpi_get_table(table_header-> | 118 | !acpi_get_table |
| 110 | signature, 2, | 119 | (table_header->signature, 2, &header))) |
| 111 | &header))) | 120 | sprintf(table_attr->name + ACPI_NAME_SIZE, "%d", |
| 112 | sprintf(table_attr->name + 4, "%d", table_attr->instance); | 121 | table_attr->instance); |
| 113 | 122 | ||
| 114 | table_attr->attr.size = 0; | 123 | table_attr->attr.size = 0; |
| 115 | table_attr->attr.read = acpi_table_show; | 124 | table_attr->attr.read = acpi_table_show; |
| @@ -167,7 +176,6 @@ static int acpi_system_sysfs_init(void) | |||
| 167 | #define COUNT_ERROR 2 /* other */ | 176 | #define COUNT_ERROR 2 /* other */ |
| 168 | #define NUM_COUNTERS_EXTRA 3 | 177 | #define NUM_COUNTERS_EXTRA 3 |
| 169 | 178 | ||
| 170 | #define ACPI_EVENT_VALID 0x01 | ||
| 171 | struct event_counter { | 179 | struct event_counter { |
| 172 | u32 count; | 180 | u32 count; |
| 173 | u32 flags; | 181 | u32 flags; |
| @@ -312,12 +320,6 @@ static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle) | |||
| 312 | } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS)) | 320 | } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS)) |
| 313 | result = acpi_get_event_status(index - num_gpes, status); | 321 | result = acpi_get_event_status(index - num_gpes, status); |
| 314 | 322 | ||
| 315 | /* | ||
| 316 | * sleep/power button GPE/Fixed Event is enabled after acpi_system_init, | ||
| 317 | * check the status at runtime and mark it as valid once it's enabled | ||
| 318 | */ | ||
| 319 | if (!result && (*status & ACPI_EVENT_FLAG_ENABLED)) | ||
| 320 | all_counters[index].flags |= ACPI_EVENT_VALID; | ||
| 321 | end: | 323 | end: |
| 322 | return result; | 324 | return result; |
| 323 | } | 325 | } |
| @@ -346,12 +348,14 @@ static ssize_t counter_show(struct kobject *kobj, | |||
| 346 | if (result) | 348 | if (result) |
| 347 | goto end; | 349 | goto end; |
| 348 | 350 | ||
| 349 | if (!(all_counters[index].flags & ACPI_EVENT_VALID)) | 351 | if (!(status & ACPI_EVENT_FLAG_HANDLE)) |
| 350 | size += sprintf(buf + size, " invalid"); | 352 | size += sprintf(buf + size, " invalid"); |
| 351 | else if (status & ACPI_EVENT_FLAG_ENABLED) | 353 | else if (status & ACPI_EVENT_FLAG_ENABLED) |
| 352 | size += sprintf(buf + size, " enable"); | 354 | size += sprintf(buf + size, " enabled"); |
| 355 | else if (status & ACPI_EVENT_FLAG_WAKE_ENABLED) | ||
| 356 | size += sprintf(buf + size, " wake_enabled"); | ||
| 353 | else | 357 | else |
| 354 | size += sprintf(buf + size, " disable"); | 358 | size += sprintf(buf + size, " disabled"); |
| 355 | 359 | ||
| 356 | end: | 360 | end: |
| 357 | size += sprintf(buf + size, "\n"); | 361 | size += sprintf(buf + size, "\n"); |
| @@ -385,7 +389,7 @@ static ssize_t counter_set(struct kobject *kobj, | |||
| 385 | if (result) | 389 | if (result) |
| 386 | goto end; | 390 | goto end; |
| 387 | 391 | ||
| 388 | if (!(all_counters[index].flags & ACPI_EVENT_VALID)) { | 392 | if (!(status & ACPI_EVENT_FLAG_HANDLE)) { |
| 389 | printk(KERN_WARNING PREFIX | 393 | printk(KERN_WARNING PREFIX |
| 390 | "Can not change Invalid GPE/Fixed Event status\n"); | 394 | "Can not change Invalid GPE/Fixed Event status\n"); |
| 391 | return -EINVAL; | 395 | return -EINVAL; |
| @@ -394,10 +398,10 @@ static ssize_t counter_set(struct kobject *kobj, | |||
| 394 | if (index < num_gpes) { | 398 | if (index < num_gpes) { |
| 395 | if (!strcmp(buf, "disable\n") && | 399 | if (!strcmp(buf, "disable\n") && |
| 396 | (status & ACPI_EVENT_FLAG_ENABLED)) | 400 | (status & ACPI_EVENT_FLAG_ENABLED)) |
| 397 | result = acpi_disable_gpe(handle, index, ACPI_NOT_ISR); | 401 | result = acpi_disable_gpe(handle, index); |
| 398 | else if (!strcmp(buf, "enable\n") && | 402 | else if (!strcmp(buf, "enable\n") && |
| 399 | !(status & ACPI_EVENT_FLAG_ENABLED)) | 403 | !(status & ACPI_EVENT_FLAG_ENABLED)) |
| 400 | result = acpi_enable_gpe(handle, index, ACPI_NOT_ISR); | 404 | result = acpi_enable_gpe(handle, index); |
| 401 | else if (!strcmp(buf, "clear\n") && | 405 | else if (!strcmp(buf, "clear\n") && |
| 402 | (status & ACPI_EVENT_FLAG_SET)) | 406 | (status & ACPI_EVENT_FLAG_SET)) |
| 403 | result = acpi_clear_gpe(handle, index, ACPI_NOT_ISR); | 407 | result = acpi_clear_gpe(handle, index, ACPI_NOT_ISR); |
diff --git a/drivers/acpi/tables/tbfadt.c b/drivers/acpi/tables/tbfadt.c index 2c7885e7ffb..2817158fb6a 100644 --- a/drivers/acpi/tables/tbfadt.c +++ b/drivers/acpi/tables/tbfadt.c | |||
| @@ -304,7 +304,7 @@ static void acpi_tb_convert_fadt(void) | |||
| 304 | * The ACPI 1.0 reserved fields that will be zeroed are the bytes located at | 304 | * The ACPI 1.0 reserved fields that will be zeroed are the bytes located at |
| 305 | * offset 45, 55, 95, and the word located at offset 109, 110. | 305 | * offset 45, 55, 95, and the word located at offset 109, 110. |
| 306 | */ | 306 | */ |
| 307 | if (acpi_gbl_FADT.header.revision < 3) { | 307 | if (acpi_gbl_FADT.header.revision < FADT2_REVISION_ID) { |
| 308 | acpi_gbl_FADT.preferred_profile = 0; | 308 | acpi_gbl_FADT.preferred_profile = 0; |
| 309 | acpi_gbl_FADT.pstate_control = 0; | 309 | acpi_gbl_FADT.pstate_control = 0; |
| 310 | acpi_gbl_FADT.cst_control = 0; | 310 | acpi_gbl_FADT.cst_control = 0; |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index ad6cae938f0..073ff09218a 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
| @@ -47,7 +47,6 @@ | |||
| 47 | #include <acpi/acpi_bus.h> | 47 | #include <acpi/acpi_bus.h> |
| 48 | #include <acpi/acpi_drivers.h> | 48 | #include <acpi/acpi_drivers.h> |
| 49 | 49 | ||
| 50 | #define ACPI_THERMAL_COMPONENT 0x04000000 | ||
| 51 | #define ACPI_THERMAL_CLASS "thermal_zone" | 50 | #define ACPI_THERMAL_CLASS "thermal_zone" |
| 52 | #define ACPI_THERMAL_DEVICE_NAME "Thermal Zone" | 51 | #define ACPI_THERMAL_DEVICE_NAME "Thermal Zone" |
| 53 | #define ACPI_THERMAL_FILE_STATE "state" | 52 | #define ACPI_THERMAL_FILE_STATE "state" |
| @@ -576,7 +575,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) | |||
| 576 | acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, | 575 | acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, |
| 577 | tz->trips.critical.flags.enabled); | 576 | tz->trips.critical.flags.enabled); |
| 578 | acpi_bus_generate_netlink_event(tz->device->pnp.device_class, | 577 | acpi_bus_generate_netlink_event(tz->device->pnp.device_class, |
| 579 | tz->device->dev.bus_id, | 578 | dev_name(&tz->device->dev), |
| 580 | ACPI_THERMAL_NOTIFY_CRITICAL, | 579 | ACPI_THERMAL_NOTIFY_CRITICAL, |
| 581 | tz->trips.critical.flags.enabled); | 580 | tz->trips.critical.flags.enabled); |
| 582 | 581 | ||
| @@ -605,7 +604,7 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) | |||
| 605 | acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_HOT, | 604 | acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_HOT, |
| 606 | tz->trips.hot.flags.enabled); | 605 | tz->trips.hot.flags.enabled); |
| 607 | acpi_bus_generate_netlink_event(tz->device->pnp.device_class, | 606 | acpi_bus_generate_netlink_event(tz->device->pnp.device_class, |
| 608 | tz->device->dev.bus_id, | 607 | dev_name(&tz->device->dev), |
| 609 | ACPI_THERMAL_NOTIFY_HOT, | 608 | ACPI_THERMAL_NOTIFY_HOT, |
| 610 | tz->trips.hot.flags.enabled); | 609 | tz->trips.hot.flags.enabled); |
| 611 | 610 | ||
| @@ -1592,14 +1591,14 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) | |||
| 1592 | acpi_thermal_check(tz); | 1591 | acpi_thermal_check(tz); |
| 1593 | acpi_bus_generate_proc_event(device, event, 0); | 1592 | acpi_bus_generate_proc_event(device, event, 0); |
| 1594 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 1593 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
| 1595 | device->dev.bus_id, event, 0); | 1594 | dev_name(&device->dev), event, 0); |
| 1596 | break; | 1595 | break; |
| 1597 | case ACPI_THERMAL_NOTIFY_DEVICES: | 1596 | case ACPI_THERMAL_NOTIFY_DEVICES: |
| 1598 | acpi_thermal_trips_update(tz, ACPI_TRIPS_REFRESH_DEVICES); | 1597 | acpi_thermal_trips_update(tz, ACPI_TRIPS_REFRESH_DEVICES); |
| 1599 | acpi_thermal_check(tz); | 1598 | acpi_thermal_check(tz); |
| 1600 | acpi_bus_generate_proc_event(device, event, 0); | 1599 | acpi_bus_generate_proc_event(device, event, 0); |
| 1601 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 1600 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
| 1602 | device->dev.bus_id, event, 0); | 1601 | dev_name(&device->dev), event, 0); |
| 1603 | break; | 1602 | break; |
| 1604 | default: | 1603 | default: |
| 1605 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 1604 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index a29b0ccac65..baa44192972 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -41,7 +41,6 @@ | |||
| 41 | #include <acpi/acpi_bus.h> | 41 | #include <acpi/acpi_bus.h> |
| 42 | #include <acpi/acpi_drivers.h> | 42 | #include <acpi/acpi_drivers.h> |
| 43 | 43 | ||
| 44 | #define ACPI_VIDEO_COMPONENT 0x08000000 | ||
| 45 | #define ACPI_VIDEO_CLASS "video" | 44 | #define ACPI_VIDEO_CLASS "video" |
| 46 | #define ACPI_VIDEO_BUS_NAME "Video Bus" | 45 | #define ACPI_VIDEO_BUS_NAME "Video Bus" |
| 47 | #define ACPI_VIDEO_DEVICE_NAME "Video Device" | 46 | #define ACPI_VIDEO_DEVICE_NAME "Video Device" |
| @@ -739,7 +738,8 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
| 739 | device->cap._DSS = 1; | 738 | device->cap._DSS = 1; |
| 740 | } | 739 | } |
| 741 | 740 | ||
| 742 | max_level = acpi_video_init_brightness(device); | 741 | if (acpi_video_backlight_support()) |
| 742 | max_level = acpi_video_init_brightness(device); | ||
| 743 | 743 | ||
| 744 | if (device->cap._BCL && device->cap._BCM && max_level > 0) { | 744 | if (device->cap._BCL && device->cap._BCM && max_level > 0) { |
| 745 | int result; | 745 | int result; |
| @@ -785,18 +785,21 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
| 785 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | 785 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
| 786 | 786 | ||
| 787 | } | 787 | } |
| 788 | if (device->cap._DCS && device->cap._DSS){ | 788 | |
| 789 | static int count = 0; | 789 | if (acpi_video_display_switch_support()) { |
| 790 | char *name; | 790 | |
| 791 | name = kzalloc(MAX_NAME_LEN, GFP_KERNEL); | 791 | if (device->cap._DCS && device->cap._DSS) { |
| 792 | if (!name) | 792 | static int count; |
| 793 | return; | 793 | char *name; |
| 794 | sprintf(name, "acpi_video%d", count++); | 794 | name = kzalloc(MAX_NAME_LEN, GFP_KERNEL); |
| 795 | device->output_dev = video_output_register(name, | 795 | if (!name) |
| 796 | NULL, device, &acpi_output_properties); | 796 | return; |
| 797 | kfree(name); | 797 | sprintf(name, "acpi_video%d", count++); |
| 798 | device->output_dev = video_output_register(name, | ||
| 799 | NULL, device, &acpi_output_properties); | ||
| 800 | kfree(name); | ||
| 801 | } | ||
| 798 | } | 802 | } |
| 799 | return; | ||
| 800 | } | 803 | } |
| 801 | 804 | ||
| 802 | /* | 805 | /* |
| @@ -842,11 +845,16 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video) | |||
| 842 | static int acpi_video_bus_check(struct acpi_video_bus *video) | 845 | static int acpi_video_bus_check(struct acpi_video_bus *video) |
| 843 | { | 846 | { |
| 844 | acpi_status status = -ENOENT; | 847 | acpi_status status = -ENOENT; |
| 845 | 848 | struct device *dev; | |
| 846 | 849 | ||
| 847 | if (!video) | 850 | if (!video) |
| 848 | return -EINVAL; | 851 | return -EINVAL; |
| 849 | 852 | ||
| 853 | dev = acpi_get_physical_pci_device(video->device->handle); | ||
| 854 | if (!dev) | ||
| 855 | return -ENODEV; | ||
| 856 | put_device(dev); | ||
| 857 | |||
| 850 | /* Since there is no HID, CID and so on for VGA driver, we have | 858 | /* Since there is no HID, CID and so on for VGA driver, we have |
| 851 | * to check well known required nodes. | 859 | * to check well known required nodes. |
| 852 | */ | 860 | */ |
| @@ -2094,12 +2102,6 @@ static int __init acpi_video_init(void) | |||
| 2094 | { | 2102 | { |
| 2095 | int result = 0; | 2103 | int result = 0; |
| 2096 | 2104 | ||
| 2097 | |||
| 2098 | /* | ||
| 2099 | acpi_dbg_level = 0xFFFFFFFF; | ||
| 2100 | acpi_dbg_layer = 0x08000000; | ||
| 2101 | */ | ||
| 2102 | |||
| 2103 | acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); | 2105 | acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); |
| 2104 | if (!acpi_video_dir) | 2106 | if (!acpi_video_dir) |
| 2105 | return -ENODEV; | 2107 | return -ENODEV; |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c new file mode 100644 index 00000000000..f022eb6f563 --- /dev/null +++ b/drivers/acpi/video_detect.c | |||
| @@ -0,0 +1,267 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2008 SuSE Linux Products GmbH | ||
| 3 | * Thomas Renninger <trenn@suse.de> | ||
| 4 | * | ||
| 5 | * May be copied or modified under the terms of the GNU General Public License | ||
| 6 | * | ||
| 7 | * video_detect.c: | ||
| 8 | * Provides acpi_is_video_device() for early scanning of ACPI devices in scan.c | ||
| 9 | * There a Linux specific (Spec does not provide a HID for video devices) is | ||
| 10 | * assinged | ||
| 11 | * | ||
| 12 | * After PCI devices are glued with ACPI devices | ||
| 13 | * acpi_get_physical_pci_device() can be called to identify ACPI graphics | ||
| 14 | * devices for which a real graphics card is plugged in | ||
| 15 | * | ||
| 16 | * Now acpi_video_get_capabilities() can be called to check which | ||
| 17 | * capabilities the graphics cards plugged in support. The check for general | ||
| 18 | * video capabilities will be triggered by the first caller of | ||
| 19 | * acpi_video_get_capabilities(NULL); which will happen when the first | ||
| 20 | * backlight (or display output) switching supporting driver calls: | ||
| 21 | * acpi_video_backlight_support(); | ||
| 22 | * | ||
| 23 | * Depending on whether ACPI graphics extensions (cmp. ACPI spec Appendix B) | ||
| 24 | * are available, video.ko should be used to handle the device. | ||
| 25 | * | ||
| 26 | * Otherwise vendor specific drivers like thinkpad_acpi, asus_acpi, | ||
| 27 | * sony_acpi,... can take care about backlight brightness and display output | ||
| 28 | * switching. | ||
| 29 | * | ||
| 30 | * If CONFIG_ACPI_VIDEO is neither set as "compiled in" (y) nor as a module (m) | ||
| 31 | * this file will not be compiled, acpi_video_get_capabilities() and | ||
| 32 | * acpi_video_backlight_support() will always return 0 and vendor specific | ||
| 33 | * drivers always can handle backlight. | ||
| 34 | * | ||
| 35 | */ | ||
| 36 | |||
| 37 | #include <linux/acpi.h> | ||
| 38 | #include <linux/dmi.h> | ||
| 39 | |||
| 40 | ACPI_MODULE_NAME("video"); | ||
| 41 | #define _COMPONENT ACPI_VIDEO_COMPONENT | ||
| 42 | |||
| 43 | static long acpi_video_support; | ||
| 44 | static bool acpi_video_caps_checked; | ||
| 45 | |||
| 46 | static acpi_status | ||
| 47 | acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context, | ||
| 48 | void **retyurn_value) | ||
| 49 | { | ||
| 50 | long *cap = context; | ||
| 51 | acpi_handle h_dummy; | ||
| 52 | |||
| 53 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_BCM", &h_dummy)) && | ||
| 54 | ACPI_SUCCESS(acpi_get_handle(handle, "_BCL", &h_dummy))) { | ||
| 55 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight " | ||
| 56 | "support\n")); | ||
| 57 | *cap |= ACPI_VIDEO_BACKLIGHT; | ||
| 58 | /* We have backlight support, no need to scan further */ | ||
| 59 | return AE_CTRL_TERMINATE; | ||
| 60 | } | ||
| 61 | return 0; | ||
| 62 | } | ||
| 63 | |||
| 64 | /* Returns true if the device is a video device which can be handled by | ||
| 65 | * video.ko. | ||
| 66 | * The device will get a Linux specific CID added in scan.c to | ||
| 67 | * identify the device as an ACPI graphics device | ||
| 68 | * Be aware that the graphics device may not be physically present | ||
| 69 | * Use acpi_video_get_capabilities() to detect general ACPI video | ||
| 70 | * capabilities of present cards | ||
| 71 | */ | ||
| 72 | long acpi_is_video_device(struct acpi_device *device) | ||
| 73 | { | ||
| 74 | acpi_handle h_dummy; | ||
| 75 | long video_caps = 0; | ||
| 76 | |||
| 77 | if (!device) | ||
| 78 | return 0; | ||
| 79 | |||
| 80 | /* Does this device able to support video switching ? */ | ||
| 81 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) && | ||
| 82 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy))) | ||
| 83 | video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; | ||
| 84 | |||
| 85 | /* Does this device able to retrieve a video ROM ? */ | ||
| 86 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) | ||
| 87 | video_caps |= ACPI_VIDEO_ROM_AVAILABLE; | ||
| 88 | |||
| 89 | /* Does this device able to configure which video head to be POSTed ? */ | ||
| 90 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy)) && | ||
| 91 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy)) && | ||
| 92 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy))) | ||
| 93 | video_caps |= ACPI_VIDEO_DEVICE_POSTING; | ||
| 94 | |||
| 95 | /* Only check for backlight functionality if one of the above hit. */ | ||
| 96 | if (video_caps) | ||
| 97 | acpi_walk_namespace(ACPI_TYPE_DEVICE, device->handle, | ||
| 98 | ACPI_UINT32_MAX, acpi_backlight_cap_match, | ||
| 99 | &video_caps, NULL); | ||
| 100 | |||
| 101 | return video_caps; | ||
| 102 | } | ||
| 103 | EXPORT_SYMBOL(acpi_is_video_device); | ||
| 104 | |||
| 105 | static acpi_status | ||
| 106 | find_video(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
| 107 | { | ||
| 108 | long *cap = context; | ||
| 109 | struct device *dev; | ||
| 110 | struct acpi_device *acpi_dev; | ||
| 111 | |||
| 112 | const struct acpi_device_id video_ids[] = { | ||
| 113 | {ACPI_VIDEO_HID, 0}, | ||
| 114 | {"", 0}, | ||
| 115 | }; | ||
| 116 | if (acpi_bus_get_device(handle, &acpi_dev)) | ||
| 117 | return AE_OK; | ||
| 118 | |||
| 119 | if (!acpi_match_device_ids(acpi_dev, video_ids)) { | ||
| 120 | dev = acpi_get_physical_pci_device(handle); | ||
| 121 | if (!dev) | ||
| 122 | return AE_OK; | ||
| 123 | put_device(dev); | ||
| 124 | *cap |= acpi_is_video_device(acpi_dev); | ||
| 125 | } | ||
| 126 | return AE_OK; | ||
| 127 | } | ||
| 128 | |||
| 129 | /* | ||
| 130 | * Returns the video capabilities of a specific ACPI graphics device | ||
| 131 | * | ||
| 132 | * if NULL is passed as argument all ACPI devices are enumerated and | ||
| 133 | * all graphics capabilities of physically present devices are | ||
| 134 | * summerized and returned. This is cached and done only once. | ||
| 135 | */ | ||
| 136 | long acpi_video_get_capabilities(acpi_handle graphics_handle) | ||
| 137 | { | ||
| 138 | long caps = 0; | ||
| 139 | struct acpi_device *tmp_dev; | ||
| 140 | acpi_status status; | ||
| 141 | |||
| 142 | if (acpi_video_caps_checked && graphics_handle == NULL) | ||
| 143 | return acpi_video_support; | ||
| 144 | |||
| 145 | if (!graphics_handle) { | ||
| 146 | /* Only do the global walk through all graphics devices once */ | ||
| 147 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | ||
| 148 | ACPI_UINT32_MAX, find_video, | ||
| 149 | &caps, NULL); | ||
| 150 | /* There might be boot param flags set already... */ | ||
| 151 | acpi_video_support |= caps; | ||
| 152 | acpi_video_caps_checked = 1; | ||
| 153 | /* Add blacklists here. Be careful to use the right *DMI* bits | ||
| 154 | * to still be able to override logic via boot params, e.g.: | ||
| 155 | * | ||
| 156 | * if (dmi_name_in_vendors("XY")) { | ||
| 157 | * acpi_video_support |= | ||
| 158 | * ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR; | ||
| 159 | * acpi_video_support |= | ||
| 160 | * ACPI_VIDEO_BACKLIGHT_DMI_VENDOR; | ||
| 161 | *} | ||
| 162 | */ | ||
| 163 | } else { | ||
| 164 | status = acpi_bus_get_device(graphics_handle, &tmp_dev); | ||
| 165 | if (ACPI_FAILURE(status)) { | ||
| 166 | ACPI_EXCEPTION((AE_INFO, status, "Invalid device")); | ||
| 167 | return 0; | ||
| 168 | } | ||
| 169 | acpi_walk_namespace(ACPI_TYPE_DEVICE, graphics_handle, | ||
| 170 | ACPI_UINT32_MAX, find_video, | ||
| 171 | &caps, NULL); | ||
| 172 | } | ||
| 173 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "We have 0x%lX video support %s %s\n", | ||
| 174 | graphics_handle ? caps : acpi_video_support, | ||
| 175 | graphics_handle ? "on device " : "in general", | ||
| 176 | graphics_handle ? acpi_device_bid(tmp_dev) : "")); | ||
| 177 | return caps; | ||
| 178 | } | ||
| 179 | EXPORT_SYMBOL(acpi_video_get_capabilities); | ||
| 180 | |||
| 181 | /* Returns true if video.ko can do backlight switching */ | ||
| 182 | int acpi_video_backlight_support(void) | ||
| 183 | { | ||
| 184 | /* | ||
| 185 | * We must check whether the ACPI graphics device is physically plugged | ||
| 186 | * in. Therefore this must be called after binding PCI and ACPI devices | ||
| 187 | */ | ||
| 188 | if (!acpi_video_caps_checked) | ||
| 189 | acpi_video_get_capabilities(NULL); | ||
| 190 | |||
| 191 | /* First check for boot param -> highest prio */ | ||
| 192 | if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR) | ||
| 193 | return 0; | ||
| 194 | else if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_FORCE_VIDEO) | ||
| 195 | return 1; | ||
| 196 | |||
| 197 | /* Then check for DMI blacklist -> second highest prio */ | ||
| 198 | if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_DMI_VENDOR) | ||
| 199 | return 0; | ||
| 200 | else if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_DMI_VIDEO) | ||
| 201 | return 1; | ||
| 202 | |||
| 203 | /* Then go the default way */ | ||
| 204 | return acpi_video_support & ACPI_VIDEO_BACKLIGHT; | ||
| 205 | } | ||
| 206 | EXPORT_SYMBOL(acpi_video_backlight_support); | ||
| 207 | |||
| 208 | /* | ||
| 209 | * Returns true if video.ko can do display output switching. | ||
| 210 | * This does not work well/at all with binary graphics drivers | ||
| 211 | * which disable system io ranges and do it on their own. | ||
| 212 | */ | ||
| 213 | int acpi_video_display_switch_support(void) | ||
| 214 | { | ||
| 215 | if (!acpi_video_caps_checked) | ||
| 216 | acpi_video_get_capabilities(NULL); | ||
| 217 | |||
| 218 | if (acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VENDOR) | ||
| 219 | return 0; | ||
| 220 | else if (acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO) | ||
| 221 | return 1; | ||
| 222 | |||
| 223 | if (acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR) | ||
| 224 | return 0; | ||
| 225 | else if (acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO) | ||
| 226 | return 1; | ||
| 227 | |||
| 228 | return acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING; | ||
| 229 | } | ||
| 230 | EXPORT_SYMBOL(acpi_video_display_switch_support); | ||
| 231 | |||
| 232 | /* | ||
| 233 | * Use acpi_display_output=vendor/video or acpi_backlight=vendor/video | ||
| 234 | * To force that backlight or display output switching is processed by vendor | ||
| 235 | * specific acpi drivers or video.ko driver. | ||
| 236 | */ | ||
| 237 | int __init acpi_backlight(char *str) | ||
| 238 | { | ||
| 239 | if (str == NULL || *str == '\0') | ||
| 240 | return 1; | ||
| 241 | else { | ||
| 242 | if (!strcmp("vendor", str)) | ||
| 243 | acpi_video_support |= | ||
| 244 | ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR; | ||
| 245 | if (!strcmp("video", str)) | ||
| 246 | acpi_video_support |= | ||
| 247 | ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO; | ||
| 248 | } | ||
| 249 | return 1; | ||
| 250 | } | ||
| 251 | __setup("acpi_backlight=", acpi_backlight); | ||
| 252 | |||
| 253 | int __init acpi_display_output(char *str) | ||
| 254 | { | ||
| 255 | if (str == NULL || *str == '\0') | ||
| 256 | return 1; | ||
| 257 | else { | ||
| 258 | if (!strcmp("vendor", str)) | ||
| 259 | acpi_video_support |= | ||
| 260 | ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VENDOR; | ||
| 261 | if (!strcmp("video", str)) | ||
| 262 | acpi_video_support |= | ||
| 263 | ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO; | ||
| 264 | } | ||
| 265 | return 1; | ||
| 266 | } | ||
| 267 | __setup("acpi_display_output=", acpi_display_output); | ||
diff --git a/drivers/acpi/wmi.c b/drivers/acpi/wmi.c index 47cd7baf9b1..8a8b377712c 100644 --- a/drivers/acpi/wmi.c +++ b/drivers/acpi/wmi.c | |||
| @@ -660,7 +660,7 @@ static void acpi_wmi_notify(acpi_handle handle, u32 event, void *data) | |||
| 660 | wblock->handler(event, wblock->handler_data); | 660 | wblock->handler(event, wblock->handler_data); |
| 661 | 661 | ||
| 662 | acpi_bus_generate_netlink_event( | 662 | acpi_bus_generate_netlink_event( |
| 663 | device->pnp.device_class, device->dev.bus_id, | 663 | device->pnp.device_class, dev_name(&device->dev), |
| 664 | event, 0); | 664 | event, 0); |
| 665 | break; | 665 | break; |
| 666 | } | 666 | } |
