diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/Makefile | 27 | ||||
-rw-r--r-- | drivers/acpi/acpica/aclocal.h | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwsleep.c | 43 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwvalid.c | 86 | ||||
-rw-r--r-- | drivers/acpi/acpica/rscalc.c | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/rscreate.c | 27 | ||||
-rw-r--r-- | drivers/acpi/bus.c | 2 | ||||
-rw-r--r-- | drivers/acpi/button.c | 140 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 1 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 4 | ||||
-rw-r--r-- | drivers/acpi/processor_idle.c | 60 | ||||
-rw-r--r-- | drivers/acpi/processor_throttling.c | 25 | ||||
-rw-r--r-- | drivers/acpi/sleep.c | 27 | ||||
-rw-r--r-- | drivers/acpi/system.c | 11 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 2 | ||||
-rw-r--r-- | drivers/acpi/video.c | 92 |
16 files changed, 346 insertions, 215 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 17e50824a6f1..72ac28da14e3 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
@@ -5,40 +5,43 @@ | |||
5 | ccflags-y := -Os | 5 | ccflags-y := -Os |
6 | ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT | 6 | ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT |
7 | 7 | ||
8 | obj-y := dsfield.o dsmthdat.o dsopcode.o dswexec.o dswscope.o \ | 8 | # use acpi.o to put all files here into acpi.o modparam namespace |
9 | obj-y += acpi.o | ||
10 | |||
11 | acpi-y := dsfield.o dsmthdat.o dsopcode.o dswexec.o dswscope.o \ | ||
9 | dsmethod.o dsobject.o dsutils.o dswload.o dswstate.o \ | 12 | dsmethod.o dsobject.o dsutils.o dswload.o dswstate.o \ |
10 | dsinit.o | 13 | dsinit.o |
11 | 14 | ||
12 | obj-y += evevent.o evregion.o evsci.o evxfevnt.o \ | 15 | acpi-y += evevent.o evregion.o evsci.o evxfevnt.o \ |
13 | evmisc.o evrgnini.o evxface.o evxfregn.o \ | 16 | evmisc.o evrgnini.o evxface.o evxfregn.o \ |
14 | evgpe.o evgpeblk.o | 17 | evgpe.o evgpeblk.o |
15 | 18 | ||
16 | obj-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\ | 19 | acpi-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\ |
17 | exconvrt.o exfldio.o exoparg1.o exprep.o exresop.o exsystem.o\ | 20 | exconvrt.o exfldio.o exoparg1.o exprep.o exresop.o exsystem.o\ |
18 | excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ | 21 | excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ |
19 | exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o | 22 | exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o |
20 | 23 | ||
21 | obj-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o | 24 | acpi-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o |
22 | 25 | ||
23 | obj-$(ACPI_FUTURE_USAGE) += hwtimer.o | 26 | acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o |
24 | 27 | ||
25 | obj-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \ | 28 | acpi-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \ |
26 | nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ | 29 | nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ |
27 | nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \ | 30 | nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \ |
28 | nsparse.o nspredef.o | 31 | nsparse.o nspredef.o |
29 | 32 | ||
30 | obj-$(ACPI_FUTURE_USAGE) += nsdumpdv.o | 33 | acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o |
31 | 34 | ||
32 | obj-y += psargs.o psparse.o psloop.o pstree.o pswalk.o \ | 35 | acpi-y += psargs.o psparse.o psloop.o pstree.o pswalk.o \ |
33 | psopcode.o psscope.o psutils.o psxface.o | 36 | psopcode.o psscope.o psutils.o psxface.o |
34 | 37 | ||
35 | obj-y += rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \ | 38 | acpi-y += rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \ |
36 | rscalc.o rsirq.o rsmemory.o rsutils.o | 39 | rscalc.o rsirq.o rsmemory.o rsutils.o |
37 | 40 | ||
38 | obj-$(ACPI_FUTURE_USAGE) += rsdump.o | 41 | acpi-$(ACPI_FUTURE_USAGE) += rsdump.o |
39 | 42 | ||
40 | obj-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o | 43 | acpi-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o |
41 | 44 | ||
42 | obj-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ | 45 | acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ |
43 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ | 46 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ |
44 | utstate.o utmutex.o utobject.o utresrc.o utlock.o | 47 | utstate.o utmutex.o utobject.o utresrc.o utlock.o |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 772ee5c4ccca..2ec394a328e9 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -787,7 +787,12 @@ struct acpi_bit_register_info { | |||
787 | 787 | ||
788 | /* For control registers, both ignored and reserved bits must be preserved */ | 788 | /* For control registers, both ignored and reserved bits must be preserved */ |
789 | 789 | ||
790 | #define ACPI_PM1_CONTROL_IGNORED_BITS 0x0201 /* Bits 9, 0(SCI_EN) */ | 790 | /* |
791 | * The ACPI spec says to ignore PM1_CTL.SCI_EN (bit 0) | ||
792 | * but we need to be able to write ACPI_BITREG_SCI_ENABLE directly | ||
793 | * as a BIOS workaround on some machines. | ||
794 | */ | ||
795 | #define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bits 9 */ | ||
791 | #define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */ | 796 | #define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */ |
792 | #define ACPI_PM1_CONTROL_PRESERVED_BITS \ | 797 | #define ACPI_PM1_CONTROL_PRESERVED_BITS \ |
793 | (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS) | 798 | (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS) |
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index baa5fc05e124..db307a356f08 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c | |||
@@ -211,6 +211,12 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) | |||
211 | 211 | ||
212 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) | 212 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) |
213 | 213 | ||
214 | static unsigned int gts, bfs; | ||
215 | module_param(gts, uint, 0644); | ||
216 | module_param(bfs, uint, 0644); | ||
217 | MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); | ||
218 | MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); | ||
219 | |||
214 | /******************************************************************************* | 220 | /******************************************************************************* |
215 | * | 221 | * |
216 | * FUNCTION: acpi_enter_sleep_state | 222 | * FUNCTION: acpi_enter_sleep_state |
@@ -278,16 +284,18 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) | |||
278 | return_ACPI_STATUS(status); | 284 | return_ACPI_STATUS(status); |
279 | } | 285 | } |
280 | 286 | ||
281 | /* Execute the _GTS method */ | 287 | if (gts) { |
288 | /* Execute the _GTS method */ | ||
282 | 289 | ||
283 | arg_list.count = 1; | 290 | arg_list.count = 1; |
284 | arg_list.pointer = &arg; | 291 | arg_list.pointer = &arg; |
285 | arg.type = ACPI_TYPE_INTEGER; | 292 | arg.type = ACPI_TYPE_INTEGER; |
286 | arg.integer.value = sleep_state; | 293 | arg.integer.value = sleep_state; |
287 | 294 | ||
288 | status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL); | 295 | status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL); |
289 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 296 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { |
290 | return_ACPI_STATUS(status); | 297 | return_ACPI_STATUS(status); |
298 | } | ||
291 | } | 299 | } |
292 | 300 | ||
293 | /* Get current value of PM1A control */ | 301 | /* Get current value of PM1A control */ |
@@ -513,18 +521,19 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state) | |||
513 | } | 521 | } |
514 | } | 522 | } |
515 | 523 | ||
516 | /* Execute the _BFS method */ | 524 | if (bfs) { |
525 | /* Execute the _BFS method */ | ||
517 | 526 | ||
518 | arg_list.count = 1; | 527 | arg_list.count = 1; |
519 | arg_list.pointer = &arg; | 528 | arg_list.pointer = &arg; |
520 | arg.type = ACPI_TYPE_INTEGER; | 529 | arg.type = ACPI_TYPE_INTEGER; |
521 | arg.integer.value = sleep_state; | 530 | arg.integer.value = sleep_state; |
522 | 531 | ||
523 | status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL); | 532 | status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL); |
524 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 533 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { |
525 | ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS")); | 534 | ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS")); |
535 | } | ||
526 | } | 536 | } |
527 | |||
528 | return_ACPI_STATUS(status); | 537 | return_ACPI_STATUS(status); |
529 | } | 538 | } |
530 | 539 | ||
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c index 7737afb157c3..ec33f270c5b7 100644 --- a/drivers/acpi/acpica/hwvalid.c +++ b/drivers/acpi/acpica/hwvalid.c | |||
@@ -90,6 +90,7 @@ static const struct acpi_port_info acpi_protected_ports[] = { | |||
90 | {"PIT2", 0x0048, 0x004B, ACPI_OSI_WIN_XP}, | 90 | {"PIT2", 0x0048, 0x004B, ACPI_OSI_WIN_XP}, |
91 | {"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP}, | 91 | {"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP}, |
92 | {"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP}, | 92 | {"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP}, |
93 | {"DMA1", 0x0081, 0x0083, ACPI_OSI_WIN_XP}, | ||
93 | {"DMA1L", 0x0087, 0x0087, ACPI_OSI_WIN_XP}, | 94 | {"DMA1L", 0x0087, 0x0087, ACPI_OSI_WIN_XP}, |
94 | {"DMA2", 0x0089, 0x008B, ACPI_OSI_WIN_XP}, | 95 | {"DMA2", 0x0089, 0x008B, ACPI_OSI_WIN_XP}, |
95 | {"DMA2L", 0x008F, 0x008F, ACPI_OSI_WIN_XP}, | 96 | {"DMA2L", 0x008F, 0x008F, ACPI_OSI_WIN_XP}, |
@@ -151,7 +152,7 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) | |||
151 | ACPI_ERROR((AE_INFO, | 152 | ACPI_ERROR((AE_INFO, |
152 | "Illegal I/O port address/length above 64K: 0x%p/%X", | 153 | "Illegal I/O port address/length above 64K: 0x%p/%X", |
153 | ACPI_CAST_PTR(void, address), byte_width)); | 154 | ACPI_CAST_PTR(void, address), byte_width)); |
154 | return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS); | 155 | return_ACPI_STATUS(AE_LIMIT); |
155 | } | 156 | } |
156 | 157 | ||
157 | /* Exit if requested address is not within the protected port table */ | 158 | /* Exit if requested address is not within the protected port table */ |
@@ -178,11 +179,12 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) | |||
178 | /* Port illegality may depend on the _OSI calls made by the BIOS */ | 179 | /* Port illegality may depend on the _OSI calls made by the BIOS */ |
179 | 180 | ||
180 | if (acpi_gbl_osi_data >= port_info->osi_dependency) { | 181 | if (acpi_gbl_osi_data >= port_info->osi_dependency) { |
181 | ACPI_ERROR((AE_INFO, | 182 | ACPI_DEBUG_PRINT((ACPI_DB_IO, |
182 | "Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)", | 183 | "Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)", |
183 | ACPI_CAST_PTR(void, address), | 184 | ACPI_CAST_PTR(void, address), |
184 | byte_width, port_info->name, | 185 | byte_width, port_info->name, |
185 | port_info->start, port_info->end)); | 186 | port_info->start, |
187 | port_info->end)); | ||
186 | 188 | ||
187 | return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS); | 189 | return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS); |
188 | } | 190 | } |
@@ -206,7 +208,7 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) | |||
206 | * Value Where value is placed | 208 | * Value Where value is placed |
207 | * Width Number of bits | 209 | * Width Number of bits |
208 | * | 210 | * |
209 | * RETURN: Value read from port | 211 | * RETURN: Status and value read from port |
210 | * | 212 | * |
211 | * DESCRIPTION: Read data from an I/O port or register. This is a front-end | 213 | * DESCRIPTION: Read data from an I/O port or register. This is a front-end |
212 | * to acpi_os_read_port that performs validation on both the port | 214 | * to acpi_os_read_port that performs validation on both the port |
@@ -217,14 +219,43 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) | |||
217 | acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width) | 219 | acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width) |
218 | { | 220 | { |
219 | acpi_status status; | 221 | acpi_status status; |
222 | u32 one_byte; | ||
223 | u32 i; | ||
224 | |||
225 | /* Validate the entire request and perform the I/O */ | ||
220 | 226 | ||
221 | status = acpi_hw_validate_io_request(address, width); | 227 | status = acpi_hw_validate_io_request(address, width); |
222 | if (ACPI_FAILURE(status)) { | 228 | if (ACPI_SUCCESS(status)) { |
229 | status = acpi_os_read_port(address, value, width); | ||
223 | return status; | 230 | return status; |
224 | } | 231 | } |
225 | 232 | ||
226 | status = acpi_os_read_port(address, value, width); | 233 | if (status != AE_AML_ILLEGAL_ADDRESS) { |
227 | return status; | 234 | return status; |
235 | } | ||
236 | |||
237 | /* | ||
238 | * There has been a protection violation within the request. Fall | ||
239 | * back to byte granularity port I/O and ignore the failing bytes. | ||
240 | * This provides Windows compatibility. | ||
241 | */ | ||
242 | for (i = 0, *value = 0; i < width; i += 8) { | ||
243 | |||
244 | /* Validate and read one byte */ | ||
245 | |||
246 | if (acpi_hw_validate_io_request(address, 8) == AE_OK) { | ||
247 | status = acpi_os_read_port(address, &one_byte, 8); | ||
248 | if (ACPI_FAILURE(status)) { | ||
249 | return status; | ||
250 | } | ||
251 | |||
252 | *value |= (one_byte << i); | ||
253 | } | ||
254 | |||
255 | address++; | ||
256 | } | ||
257 | |||
258 | return AE_OK; | ||
228 | } | 259 | } |
229 | 260 | ||
230 | /****************************************************************************** | 261 | /****************************************************************************** |
@@ -235,7 +266,7 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width) | |||
235 | * Value Value to write | 266 | * Value Value to write |
236 | * Width Number of bits | 267 | * Width Number of bits |
237 | * | 268 | * |
238 | * RETURN: None | 269 | * RETURN: Status |
239 | * | 270 | * |
240 | * DESCRIPTION: Write data to an I/O port or register. This is a front-end | 271 | * DESCRIPTION: Write data to an I/O port or register. This is a front-end |
241 | * to acpi_os_write_port that performs validation on both the port | 272 | * to acpi_os_write_port that performs validation on both the port |
@@ -246,12 +277,39 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width) | |||
246 | acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width) | 277 | acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width) |
247 | { | 278 | { |
248 | acpi_status status; | 279 | acpi_status status; |
280 | u32 i; | ||
281 | |||
282 | /* Validate the entire request and perform the I/O */ | ||
249 | 283 | ||
250 | status = acpi_hw_validate_io_request(address, width); | 284 | status = acpi_hw_validate_io_request(address, width); |
251 | if (ACPI_FAILURE(status)) { | 285 | if (ACPI_SUCCESS(status)) { |
286 | status = acpi_os_write_port(address, value, width); | ||
252 | return status; | 287 | return status; |
253 | } | 288 | } |
254 | 289 | ||
255 | status = acpi_os_write_port(address, value, width); | 290 | if (status != AE_AML_ILLEGAL_ADDRESS) { |
256 | return status; | 291 | return status; |
292 | } | ||
293 | |||
294 | /* | ||
295 | * There has been a protection violation within the request. Fall | ||
296 | * back to byte granularity port I/O and ignore the failing bytes. | ||
297 | * This provides Windows compatibility. | ||
298 | */ | ||
299 | for (i = 0; i < width; i += 8) { | ||
300 | |||
301 | /* Validate and write one byte */ | ||
302 | |||
303 | if (acpi_hw_validate_io_request(address, 8) == AE_OK) { | ||
304 | status = | ||
305 | acpi_os_write_port(address, (value >> i) & 0xFF, 8); | ||
306 | if (ACPI_FAILURE(status)) { | ||
307 | return status; | ||
308 | } | ||
309 | } | ||
310 | |||
311 | address++; | ||
312 | } | ||
313 | |||
314 | return AE_OK; | ||
257 | } | 315 | } |
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c index b6667ff059e5..88b5a2c4814d 100644 --- a/drivers/acpi/acpica/rscalc.c +++ b/drivers/acpi/acpica/rscalc.c | |||
@@ -543,6 +543,13 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
543 | 543 | ||
544 | package_element = *top_object_list; | 544 | package_element = *top_object_list; |
545 | 545 | ||
546 | /* We must have a valid Package object */ | ||
547 | |||
548 | if (!package_element || | ||
549 | (package_element->common.type != ACPI_TYPE_PACKAGE)) { | ||
550 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | ||
551 | } | ||
552 | |||
546 | /* | 553 | /* |
547 | * The sub_object_list will now point to an array of the | 554 | * The sub_object_list will now point to an array of the |
548 | * four IRQ elements: Address, Pin, Source and source_index | 555 | * four IRQ elements: Address, Pin, Source and source_index |
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index 663f692fffcf..a3c23d686d5f 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c | |||
@@ -191,8 +191,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
191 | user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); | 191 | user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); |
192 | 192 | ||
193 | for (index = 0; index < number_of_elements; index++) { | 193 | for (index = 0; index < number_of_elements; index++) { |
194 | int source_name_index = 2; | ||
195 | int source_index_index = 3; | ||
196 | 194 | ||
197 | /* | 195 | /* |
198 | * Point user_prt past this current structure | 196 | * Point user_prt past this current structure |
@@ -261,27 +259,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
261 | return_ACPI_STATUS(AE_BAD_DATA); | 259 | return_ACPI_STATUS(AE_BAD_DATA); |
262 | } | 260 | } |
263 | 261 | ||
264 | /* | ||
265 | * If BIOS erroneously reversed the _PRT source_name and source_index, | ||
266 | * then reverse them back. | ||
267 | */ | ||
268 | if ((sub_object_list[3])->common.type != | ||
269 | ACPI_TYPE_INTEGER) { | ||
270 | if (acpi_gbl_enable_interpreter_slack) { | ||
271 | source_name_index = 3; | ||
272 | source_index_index = 2; | ||
273 | printk(KERN_WARNING | ||
274 | "ACPI: Handling Garbled _PRT entry\n"); | ||
275 | } else { | ||
276 | ACPI_ERROR((AE_INFO, | ||
277 | "(PRT[%X].source_index) Need Integer, found %s", | ||
278 | index, | ||
279 | acpi_ut_get_object_type_name | ||
280 | (sub_object_list[3]))); | ||
281 | return_ACPI_STATUS(AE_BAD_DATA); | ||
282 | } | ||
283 | } | ||
284 | |||
285 | user_prt->pin = (u32) obj_desc->integer.value; | 262 | user_prt->pin = (u32) obj_desc->integer.value; |
286 | 263 | ||
287 | /* | 264 | /* |
@@ -304,7 +281,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
304 | * 3) Third subobject: Dereference the PRT.source_name | 281 | * 3) Third subobject: Dereference the PRT.source_name |
305 | * The name may be unresolved (slack mode), so allow a null object | 282 | * The name may be unresolved (slack mode), so allow a null object |
306 | */ | 283 | */ |
307 | obj_desc = sub_object_list[source_name_index]; | 284 | obj_desc = sub_object_list[2]; |
308 | if (obj_desc) { | 285 | if (obj_desc) { |
309 | switch (obj_desc->common.type) { | 286 | switch (obj_desc->common.type) { |
310 | case ACPI_TYPE_LOCAL_REFERENCE: | 287 | case ACPI_TYPE_LOCAL_REFERENCE: |
@@ -378,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
378 | 355 | ||
379 | /* 4) Fourth subobject: Dereference the PRT.source_index */ | 356 | /* 4) Fourth subobject: Dereference the PRT.source_index */ |
380 | 357 | ||
381 | obj_desc = sub_object_list[source_index_index]; | 358 | obj_desc = sub_object_list[3]; |
382 | if (obj_desc->common.type != ACPI_TYPE_INTEGER) { | 359 | if (obj_desc->common.type != ACPI_TYPE_INTEGER) { |
383 | ACPI_ERROR((AE_INFO, | 360 | ACPI_ERROR((AE_INFO, |
384 | "(PRT[%X].SourceIndex) Need Integer, found %s", | 361 | "(PRT[%X].SourceIndex) Need Integer, found %s", |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index e8f7b64e92da..ae862f1798dc 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -312,7 +312,7 @@ int acpi_bus_set_power(acpi_handle handle, int state) | |||
312 | end: | 312 | end: |
313 | if (result) | 313 | if (result) |
314 | printk(KERN_WARNING PREFIX | 314 | printk(KERN_WARNING PREFIX |
315 | "Transitioning device [%s] to D%d\n", | 315 | "Device [%s] failed to transition to D%d\n", |
316 | device->pnp.bus_id, state); | 316 | device->pnp.bus_id, state); |
317 | else { | 317 | else { |
318 | device->power.state = state; | 318 | device->power.state = state; |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index d73c94b8441d..9195deba9d94 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * acpi_button.c - ACPI Button Driver ($Revision: 30 $) | 2 | * button.c - ACPI Button Driver |
3 | * | 3 | * |
4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | 4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> |
5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | 5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
@@ -41,17 +41,13 @@ | |||
41 | 41 | ||
42 | #define ACPI_BUTTON_SUBCLASS_POWER "power" | 42 | #define ACPI_BUTTON_SUBCLASS_POWER "power" |
43 | #define ACPI_BUTTON_HID_POWER "PNP0C0C" | 43 | #define ACPI_BUTTON_HID_POWER "PNP0C0C" |
44 | #define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button (CM)" | 44 | #define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button" |
45 | #define ACPI_BUTTON_DEVICE_NAME_POWERF "Power Button (FF)" | ||
46 | #define ACPI_BUTTON_TYPE_POWER 0x01 | 45 | #define ACPI_BUTTON_TYPE_POWER 0x01 |
47 | #define ACPI_BUTTON_TYPE_POWERF 0x02 | ||
48 | 46 | ||
49 | #define ACPI_BUTTON_SUBCLASS_SLEEP "sleep" | 47 | #define ACPI_BUTTON_SUBCLASS_SLEEP "sleep" |
50 | #define ACPI_BUTTON_HID_SLEEP "PNP0C0E" | 48 | #define ACPI_BUTTON_HID_SLEEP "PNP0C0E" |
51 | #define ACPI_BUTTON_DEVICE_NAME_SLEEP "Sleep Button (CM)" | 49 | #define ACPI_BUTTON_DEVICE_NAME_SLEEP "Sleep Button" |
52 | #define ACPI_BUTTON_DEVICE_NAME_SLEEPF "Sleep Button (FF)" | ||
53 | #define ACPI_BUTTON_TYPE_SLEEP 0x03 | 50 | #define ACPI_BUTTON_TYPE_SLEEP 0x03 |
54 | #define ACPI_BUTTON_TYPE_SLEEPF 0x04 | ||
55 | 51 | ||
56 | #define ACPI_BUTTON_SUBCLASS_LID "lid" | 52 | #define ACPI_BUTTON_SUBCLASS_LID "lid" |
57 | #define ACPI_BUTTON_HID_LID "PNP0C0D" | 53 | #define ACPI_BUTTON_HID_LID "PNP0C0D" |
@@ -95,7 +91,6 @@ static struct acpi_driver acpi_button_driver = { | |||
95 | }; | 91 | }; |
96 | 92 | ||
97 | struct acpi_button { | 93 | struct acpi_button { |
98 | struct acpi_device *device; /* Fixed button kludge */ | ||
99 | unsigned int type; | 94 | unsigned int type; |
100 | struct input_dev *input; | 95 | struct input_dev *input; |
101 | char phys[32]; /* for input device */ | 96 | char phys[32]; /* for input device */ |
@@ -126,14 +121,10 @@ static struct proc_dir_entry *acpi_button_dir; | |||
126 | 121 | ||
127 | static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) | 122 | static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) |
128 | { | 123 | { |
129 | struct acpi_button *button = seq->private; | 124 | struct acpi_device *device = seq->private; |
130 | |||
131 | if (!button || !button->device) | ||
132 | return 0; | ||
133 | 125 | ||
134 | seq_printf(seq, "type: %s\n", | 126 | seq_printf(seq, "type: %s\n", |
135 | acpi_device_name(button->device)); | 127 | acpi_device_name(device)); |
136 | |||
137 | return 0; | 128 | return 0; |
138 | } | 129 | } |
139 | 130 | ||
@@ -144,14 +135,11 @@ static int acpi_button_info_open_fs(struct inode *inode, struct file *file) | |||
144 | 135 | ||
145 | static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) | 136 | static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) |
146 | { | 137 | { |
147 | struct acpi_button *button = seq->private; | 138 | struct acpi_device *device = seq->private; |
148 | acpi_status status; | 139 | acpi_status status; |
149 | unsigned long long state; | 140 | unsigned long long state; |
150 | 141 | ||
151 | if (!button || !button->device) | 142 | status = acpi_evaluate_integer(device->handle, "_LID", NULL, &state); |
152 | return 0; | ||
153 | |||
154 | status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, &state); | ||
155 | seq_printf(seq, "state: %s\n", | 143 | seq_printf(seq, "state: %s\n", |
156 | ACPI_FAILURE(status) ? "unsupported" : | 144 | ACPI_FAILURE(status) ? "unsupported" : |
157 | (state ? "open" : "closed")); | 145 | (state ? "open" : "closed")); |
@@ -169,24 +157,17 @@ static struct proc_dir_entry *acpi_lid_dir; | |||
169 | 157 | ||
170 | static int acpi_button_add_fs(struct acpi_device *device) | 158 | static int acpi_button_add_fs(struct acpi_device *device) |
171 | { | 159 | { |
160 | struct acpi_button *button = acpi_driver_data(device); | ||
172 | struct proc_dir_entry *entry = NULL; | 161 | struct proc_dir_entry *entry = NULL; |
173 | struct acpi_button *button; | ||
174 | |||
175 | if (!device || !acpi_driver_data(device)) | ||
176 | return -EINVAL; | ||
177 | |||
178 | button = acpi_driver_data(device); | ||
179 | 162 | ||
180 | switch (button->type) { | 163 | switch (button->type) { |
181 | case ACPI_BUTTON_TYPE_POWER: | 164 | case ACPI_BUTTON_TYPE_POWER: |
182 | case ACPI_BUTTON_TYPE_POWERF: | ||
183 | if (!acpi_power_dir) | 165 | if (!acpi_power_dir) |
184 | acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, | 166 | acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, |
185 | acpi_button_dir); | 167 | acpi_button_dir); |
186 | entry = acpi_power_dir; | 168 | entry = acpi_power_dir; |
187 | break; | 169 | break; |
188 | case ACPI_BUTTON_TYPE_SLEEP: | 170 | case ACPI_BUTTON_TYPE_SLEEP: |
189 | case ACPI_BUTTON_TYPE_SLEEPF: | ||
190 | if (!acpi_sleep_dir) | 171 | if (!acpi_sleep_dir) |
191 | acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, | 172 | acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, |
192 | acpi_button_dir); | 173 | acpi_button_dir); |
@@ -210,8 +191,7 @@ static int acpi_button_add_fs(struct acpi_device *device) | |||
210 | /* 'info' [R] */ | 191 | /* 'info' [R] */ |
211 | entry = proc_create_data(ACPI_BUTTON_FILE_INFO, | 192 | entry = proc_create_data(ACPI_BUTTON_FILE_INFO, |
212 | S_IRUGO, acpi_device_dir(device), | 193 | S_IRUGO, acpi_device_dir(device), |
213 | &acpi_button_info_fops, | 194 | &acpi_button_info_fops, device); |
214 | acpi_driver_data(device)); | ||
215 | if (!entry) | 195 | if (!entry) |
216 | return -ENODEV; | 196 | return -ENODEV; |
217 | 197 | ||
@@ -219,8 +199,7 @@ static int acpi_button_add_fs(struct acpi_device *device) | |||
219 | if (button->type == ACPI_BUTTON_TYPE_LID) { | 199 | if (button->type == ACPI_BUTTON_TYPE_LID) { |
220 | entry = proc_create_data(ACPI_BUTTON_FILE_STATE, | 200 | entry = proc_create_data(ACPI_BUTTON_FILE_STATE, |
221 | S_IRUGO, acpi_device_dir(device), | 201 | S_IRUGO, acpi_device_dir(device), |
222 | &acpi_button_state_fops, | 202 | &acpi_button_state_fops, device); |
223 | acpi_driver_data(device)); | ||
224 | if (!entry) | 203 | if (!entry) |
225 | return -ENODEV; | 204 | return -ENODEV; |
226 | } | 205 | } |
@@ -250,15 +229,16 @@ static int acpi_button_remove_fs(struct acpi_device *device) | |||
250 | /* -------------------------------------------------------------------------- | 229 | /* -------------------------------------------------------------------------- |
251 | Driver Interface | 230 | Driver Interface |
252 | -------------------------------------------------------------------------- */ | 231 | -------------------------------------------------------------------------- */ |
253 | static int acpi_lid_send_state(struct acpi_button *button) | 232 | static int acpi_lid_send_state(struct acpi_device *device) |
254 | { | 233 | { |
234 | struct acpi_button *button = acpi_driver_data(device); | ||
255 | unsigned long long state; | 235 | unsigned long long state; |
256 | acpi_status status; | 236 | acpi_status status; |
257 | 237 | ||
258 | status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, | 238 | status = acpi_evaluate_integer(device->handle, "_LID", NULL, &state); |
259 | &state); | ||
260 | if (ACPI_FAILURE(status)) | 239 | if (ACPI_FAILURE(status)) |
261 | return -ENODEV; | 240 | return -ENODEV; |
241 | |||
262 | /* input layer checks if event is redundant */ | 242 | /* input layer checks if event is redundant */ |
263 | input_report_switch(button->input, SW_LID, !state); | 243 | input_report_switch(button->input, SW_LID, !state); |
264 | input_sync(button->input); | 244 | input_sync(button->input); |
@@ -270,9 +250,6 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) | |||
270 | struct acpi_button *button = acpi_driver_data(device); | 250 | struct acpi_button *button = acpi_driver_data(device); |
271 | struct input_dev *input; | 251 | struct input_dev *input; |
272 | 252 | ||
273 | if (!button || !button->device) | ||
274 | return; | ||
275 | |||
276 | switch (event) { | 253 | switch (event) { |
277 | case ACPI_FIXED_HARDWARE_EVENT: | 254 | case ACPI_FIXED_HARDWARE_EVENT: |
278 | event = ACPI_BUTTON_NOTIFY_STATUS; | 255 | event = ACPI_BUTTON_NOTIFY_STATUS; |
@@ -280,7 +257,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) | |||
280 | case ACPI_BUTTON_NOTIFY_STATUS: | 257 | case ACPI_BUTTON_NOTIFY_STATUS: |
281 | input = button->input; | 258 | input = button->input; |
282 | if (button->type == ACPI_BUTTON_TYPE_LID) { | 259 | if (button->type == ACPI_BUTTON_TYPE_LID) { |
283 | acpi_lid_send_state(button); | 260 | acpi_lid_send_state(device); |
284 | } else { | 261 | } else { |
285 | int keycode = test_bit(KEY_SLEEP, input->keybit) ? | 262 | int keycode = test_bit(KEY_SLEEP, input->keybit) ? |
286 | KEY_SLEEP : KEY_POWER; | 263 | KEY_SLEEP : KEY_POWER; |
@@ -291,43 +268,35 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) | |||
291 | input_sync(input); | 268 | input_sync(input); |
292 | } | 269 | } |
293 | 270 | ||
294 | acpi_bus_generate_proc_event(button->device, event, | 271 | acpi_bus_generate_proc_event(device, event, ++button->pushed); |
295 | ++button->pushed); | ||
296 | break; | 272 | break; |
297 | default: | 273 | default: |
298 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 274 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
299 | "Unsupported event [0x%x]\n", event)); | 275 | "Unsupported event [0x%x]\n", event)); |
300 | break; | 276 | break; |
301 | } | 277 | } |
302 | |||
303 | return; | ||
304 | } | 278 | } |
305 | 279 | ||
306 | static int acpi_button_resume(struct acpi_device *device) | 280 | static int acpi_button_resume(struct acpi_device *device) |
307 | { | 281 | { |
308 | struct acpi_button *button; | 282 | struct acpi_button *button = acpi_driver_data(device); |
309 | if (!device) | 283 | |
310 | return -EINVAL; | 284 | if (button->type == ACPI_BUTTON_TYPE_LID) |
311 | button = acpi_driver_data(device); | 285 | return acpi_lid_send_state(device); |
312 | if (button && button->type == ACPI_BUTTON_TYPE_LID) | ||
313 | return acpi_lid_send_state(button); | ||
314 | return 0; | 286 | return 0; |
315 | } | 287 | } |
316 | 288 | ||
317 | static int acpi_button_add(struct acpi_device *device) | 289 | static int acpi_button_add(struct acpi_device *device) |
318 | { | 290 | { |
319 | int error; | ||
320 | struct acpi_button *button; | 291 | struct acpi_button *button; |
321 | struct input_dev *input; | 292 | struct input_dev *input; |
322 | 293 | char *hid, *name, *class; | |
323 | if (!device) | 294 | int error; |
324 | return -EINVAL; | ||
325 | 295 | ||
326 | button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); | 296 | button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); |
327 | if (!button) | 297 | if (!button) |
328 | return -ENOMEM; | 298 | return -ENOMEM; |
329 | 299 | ||
330 | button->device = device; | ||
331 | device->driver_data = button; | 300 | device->driver_data = button; |
332 | 301 | ||
333 | button->input = input = input_allocate_device(); | 302 | button->input = input = input_allocate_device(); |
@@ -336,40 +305,29 @@ static int acpi_button_add(struct acpi_device *device) | |||
336 | goto err_free_button; | 305 | goto err_free_button; |
337 | } | 306 | } |
338 | 307 | ||
339 | /* | 308 | hid = acpi_device_hid(device); |
340 | * Determine the button type (via hid), as fixed-feature buttons | 309 | name = acpi_device_name(device); |
341 | * need to be handled a bit differently than generic-space. | 310 | class = acpi_device_class(device); |
342 | */ | 311 | |
343 | if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) { | 312 | if (!strcmp(hid, ACPI_BUTTON_HID_POWER) || |
313 | !strcmp(hid, ACPI_BUTTON_HID_POWERF)) { | ||
344 | button->type = ACPI_BUTTON_TYPE_POWER; | 314 | button->type = ACPI_BUTTON_TYPE_POWER; |
345 | strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_POWER); | 315 | strcpy(name, ACPI_BUTTON_DEVICE_NAME_POWER); |
346 | sprintf(acpi_device_class(device), "%s/%s", | 316 | sprintf(class, "%s/%s", |
347 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); | ||
348 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) { | ||
349 | button->type = ACPI_BUTTON_TYPE_POWERF; | ||
350 | strcpy(acpi_device_name(device), | ||
351 | ACPI_BUTTON_DEVICE_NAME_POWERF); | ||
352 | sprintf(acpi_device_class(device), "%s/%s", | ||
353 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); | 317 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); |
354 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) { | 318 | } else if (!strcmp(hid, ACPI_BUTTON_HID_SLEEP) || |
319 | !strcmp(hid, ACPI_BUTTON_HID_SLEEPF)) { | ||
355 | button->type = ACPI_BUTTON_TYPE_SLEEP; | 320 | button->type = ACPI_BUTTON_TYPE_SLEEP; |
356 | strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_SLEEP); | 321 | strcpy(name, ACPI_BUTTON_DEVICE_NAME_SLEEP); |
357 | sprintf(acpi_device_class(device), "%s/%s", | 322 | sprintf(class, "%s/%s", |
358 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); | ||
359 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) { | ||
360 | button->type = ACPI_BUTTON_TYPE_SLEEPF; | ||
361 | strcpy(acpi_device_name(device), | ||
362 | ACPI_BUTTON_DEVICE_NAME_SLEEPF); | ||
363 | sprintf(acpi_device_class(device), "%s/%s", | ||
364 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); | 323 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); |
365 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) { | 324 | } else if (!strcmp(hid, ACPI_BUTTON_HID_LID)) { |
366 | button->type = ACPI_BUTTON_TYPE_LID; | 325 | button->type = ACPI_BUTTON_TYPE_LID; |
367 | strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_LID); | 326 | strcpy(name, ACPI_BUTTON_DEVICE_NAME_LID); |
368 | sprintf(acpi_device_class(device), "%s/%s", | 327 | sprintf(class, "%s/%s", |
369 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); | 328 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); |
370 | } else { | 329 | } else { |
371 | printk(KERN_ERR PREFIX "Unsupported hid [%s]\n", | 330 | printk(KERN_ERR PREFIX "Unsupported hid [%s]\n", hid); |
372 | acpi_device_hid(device)); | ||
373 | error = -ENODEV; | 331 | error = -ENODEV; |
374 | goto err_free_input; | 332 | goto err_free_input; |
375 | } | 333 | } |
@@ -378,10 +336,9 @@ static int acpi_button_add(struct acpi_device *device) | |||
378 | if (error) | 336 | if (error) |
379 | goto err_free_input; | 337 | goto err_free_input; |
380 | 338 | ||
381 | snprintf(button->phys, sizeof(button->phys), | 339 | snprintf(button->phys, sizeof(button->phys), "%s/button/input0", hid); |
382 | "%s/button/input0", acpi_device_hid(device)); | ||
383 | 340 | ||
384 | input->name = acpi_device_name(device); | 341 | input->name = name; |
385 | input->phys = button->phys; | 342 | input->phys = button->phys; |
386 | input->id.bustype = BUS_HOST; | 343 | input->id.bustype = BUS_HOST; |
387 | input->id.product = button->type; | 344 | input->id.product = button->type; |
@@ -389,13 +346,11 @@ static int acpi_button_add(struct acpi_device *device) | |||
389 | 346 | ||
390 | switch (button->type) { | 347 | switch (button->type) { |
391 | case ACPI_BUTTON_TYPE_POWER: | 348 | case ACPI_BUTTON_TYPE_POWER: |
392 | case ACPI_BUTTON_TYPE_POWERF: | ||
393 | input->evbit[0] = BIT_MASK(EV_KEY); | 349 | input->evbit[0] = BIT_MASK(EV_KEY); |
394 | set_bit(KEY_POWER, input->keybit); | 350 | set_bit(KEY_POWER, input->keybit); |
395 | break; | 351 | break; |
396 | 352 | ||
397 | case ACPI_BUTTON_TYPE_SLEEP: | 353 | case ACPI_BUTTON_TYPE_SLEEP: |
398 | case ACPI_BUTTON_TYPE_SLEEPF: | ||
399 | input->evbit[0] = BIT_MASK(EV_KEY); | 354 | input->evbit[0] = BIT_MASK(EV_KEY); |
400 | set_bit(KEY_SLEEP, input->keybit); | 355 | set_bit(KEY_SLEEP, input->keybit); |
401 | break; | 356 | break; |
@@ -410,7 +365,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
410 | if (error) | 365 | if (error) |
411 | goto err_remove_fs; | 366 | goto err_remove_fs; |
412 | if (button->type == ACPI_BUTTON_TYPE_LID) | 367 | if (button->type == ACPI_BUTTON_TYPE_LID) |
413 | acpi_lid_send_state(button); | 368 | acpi_lid_send_state(device); |
414 | 369 | ||
415 | if (device->wakeup.flags.valid) { | 370 | if (device->wakeup.flags.valid) { |
416 | /* Button's GPE is run-wake GPE */ | 371 | /* Button's GPE is run-wake GPE */ |
@@ -422,9 +377,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
422 | device->wakeup.state.enabled = 1; | 377 | device->wakeup.state.enabled = 1; |
423 | } | 378 | } |
424 | 379 | ||
425 | printk(KERN_INFO PREFIX "%s [%s]\n", | 380 | printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device)); |
426 | acpi_device_name(device), acpi_device_bid(device)); | ||
427 | |||
428 | return 0; | 381 | return 0; |
429 | 382 | ||
430 | err_remove_fs: | 383 | err_remove_fs: |
@@ -438,17 +391,11 @@ static int acpi_button_add(struct acpi_device *device) | |||
438 | 391 | ||
439 | static int acpi_button_remove(struct acpi_device *device, int type) | 392 | static int acpi_button_remove(struct acpi_device *device, int type) |
440 | { | 393 | { |
441 | struct acpi_button *button; | 394 | struct acpi_button *button = acpi_driver_data(device); |
442 | |||
443 | if (!device || !acpi_driver_data(device)) | ||
444 | return -EINVAL; | ||
445 | |||
446 | button = acpi_driver_data(device); | ||
447 | 395 | ||
448 | acpi_button_remove_fs(device); | 396 | acpi_button_remove_fs(device); |
449 | input_unregister_device(button->input); | 397 | input_unregister_device(button->input); |
450 | kfree(button); | 398 | kfree(button); |
451 | |||
452 | return 0; | 399 | return 0; |
453 | } | 400 | } |
454 | 401 | ||
@@ -459,6 +406,7 @@ static int __init acpi_button_init(void) | |||
459 | acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); | 406 | acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); |
460 | if (!acpi_button_dir) | 407 | if (!acpi_button_dir) |
461 | return -ENODEV; | 408 | return -ENODEV; |
409 | |||
462 | result = acpi_bus_register_driver(&acpi_button_driver); | 410 | result = acpi_bus_register_driver(&acpi_button_driver); |
463 | if (result < 0) { | 411 | if (result < 0) { |
464 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); | 412 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 04e90443eff7..391f331674c7 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -1065,6 +1065,7 @@ static int acpi_ec_resume(struct acpi_device *device) | |||
1065 | struct acpi_ec *ec = acpi_driver_data(device); | 1065 | struct acpi_ec *ec = acpi_driver_data(device); |
1066 | /* Enable use of GPE back */ | 1066 | /* Enable use of GPE back */ |
1067 | clear_bit(EC_FLAGS_NO_GPE, &ec->flags); | 1067 | clear_bit(EC_FLAGS_NO_GPE, &ec->flags); |
1068 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); | ||
1068 | acpi_enable_gpe(NULL, ec->gpe); | 1069 | acpi_enable_gpe(NULL, ec->gpe); |
1069 | return 0; | 1070 | return 0; |
1070 | } | 1071 | } |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index d59f08ecaf16..d916bea729f1 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -353,8 +353,10 @@ static irqreturn_t acpi_irq(int irq, void *dev_id) | |||
353 | if (handled) { | 353 | if (handled) { |
354 | acpi_irq_handled++; | 354 | acpi_irq_handled++; |
355 | return IRQ_HANDLED; | 355 | return IRQ_HANDLED; |
356 | } else | 356 | } else { |
357 | acpi_irq_not_handled++; | ||
357 | return IRQ_NONE; | 358 | return IRQ_NONE; |
359 | } | ||
358 | } | 360 | } |
359 | 361 | ||
360 | acpi_status | 362 | acpi_status |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 6fe121434ffb..72069ba5f1ed 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -202,21 +202,44 @@ static void acpi_state_timer_broadcast(struct acpi_processor *pr, | |||
202 | * Suspend / resume control | 202 | * Suspend / resume control |
203 | */ | 203 | */ |
204 | static int acpi_idle_suspend; | 204 | static int acpi_idle_suspend; |
205 | static u32 saved_bm_rld; | ||
206 | |||
207 | static void acpi_idle_bm_rld_save(void) | ||
208 | { | ||
209 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld); | ||
210 | } | ||
211 | static void acpi_idle_bm_rld_restore(void) | ||
212 | { | ||
213 | u32 resumed_bm_rld; | ||
214 | |||
215 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld); | ||
216 | |||
217 | if (resumed_bm_rld != saved_bm_rld) | ||
218 | acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld); | ||
219 | } | ||
205 | 220 | ||
206 | int acpi_processor_suspend(struct acpi_device * device, pm_message_t state) | 221 | int acpi_processor_suspend(struct acpi_device * device, pm_message_t state) |
207 | { | 222 | { |
223 | if (acpi_idle_suspend == 1) | ||
224 | return 0; | ||
225 | |||
226 | acpi_idle_bm_rld_save(); | ||
208 | acpi_idle_suspend = 1; | 227 | acpi_idle_suspend = 1; |
209 | return 0; | 228 | return 0; |
210 | } | 229 | } |
211 | 230 | ||
212 | int acpi_processor_resume(struct acpi_device * device) | 231 | int acpi_processor_resume(struct acpi_device * device) |
213 | { | 232 | { |
233 | if (acpi_idle_suspend == 0) | ||
234 | return 0; | ||
235 | |||
236 | acpi_idle_bm_rld_restore(); | ||
214 | acpi_idle_suspend = 0; | 237 | acpi_idle_suspend = 0; |
215 | return 0; | 238 | return 0; |
216 | } | 239 | } |
217 | 240 | ||
218 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) | 241 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) |
219 | static int tsc_halts_in_c(int state) | 242 | static void tsc_check_state(int state) |
220 | { | 243 | { |
221 | switch (boot_cpu_data.x86_vendor) { | 244 | switch (boot_cpu_data.x86_vendor) { |
222 | case X86_VENDOR_AMD: | 245 | case X86_VENDOR_AMD: |
@@ -226,13 +249,17 @@ static int tsc_halts_in_c(int state) | |||
226 | * C/P/S0/S1 states when this bit is set. | 249 | * C/P/S0/S1 states when this bit is set. |
227 | */ | 250 | */ |
228 | if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) | 251 | if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) |
229 | return 0; | 252 | return; |
230 | 253 | ||
231 | /*FALL THROUGH*/ | 254 | /*FALL THROUGH*/ |
232 | default: | 255 | default: |
233 | return state > ACPI_STATE_C1; | 256 | /* TSC could halt in idle, so notify users */ |
257 | if (state > ACPI_STATE_C1) | ||
258 | mark_tsc_unstable("TSC halts in idle"); | ||
234 | } | 259 | } |
235 | } | 260 | } |
261 | #else | ||
262 | static void tsc_check_state(int state) { return; } | ||
236 | #endif | 263 | #endif |
237 | 264 | ||
238 | static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) | 265 | static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) |
@@ -578,7 +605,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
578 | 605 | ||
579 | pr->power.timer_broadcast_on_state = INT_MAX; | 606 | pr->power.timer_broadcast_on_state = INT_MAX; |
580 | 607 | ||
581 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { | 608 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) { |
582 | struct acpi_processor_cx *cx = &pr->power.states[i]; | 609 | struct acpi_processor_cx *cx = &pr->power.states[i]; |
583 | 610 | ||
584 | switch (cx->type) { | 611 | switch (cx->type) { |
@@ -598,6 +625,8 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
598 | acpi_timer_check_state(i, pr, cx); | 625 | acpi_timer_check_state(i, pr, cx); |
599 | break; | 626 | break; |
600 | } | 627 | } |
628 | if (cx->valid) | ||
629 | tsc_check_state(cx->type); | ||
601 | 630 | ||
602 | if (cx->valid) | 631 | if (cx->valid) |
603 | working++; | 632 | working++; |
@@ -657,11 +686,9 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) | |||
657 | 686 | ||
658 | seq_printf(seq, "active state: C%zd\n" | 687 | seq_printf(seq, "active state: C%zd\n" |
659 | "max_cstate: C%d\n" | 688 | "max_cstate: C%d\n" |
660 | "bus master activity: %08x\n" | ||
661 | "maximum allowed latency: %d usec\n", | 689 | "maximum allowed latency: %d usec\n", |
662 | pr->power.state ? pr->power.state - pr->power.states : 0, | 690 | pr->power.state ? pr->power.state - pr->power.states : 0, |
663 | max_cstate, (unsigned)pr->power.bm_activity, | 691 | max_cstate, pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)); |
664 | pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)); | ||
665 | 692 | ||
666 | seq_puts(seq, "states:\n"); | 693 | seq_puts(seq, "states:\n"); |
667 | 694 | ||
@@ -871,11 +898,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
871 | kt2 = ktime_get_real(); | 898 | kt2 = ktime_get_real(); |
872 | idle_time = ktime_to_us(ktime_sub(kt2, kt1)); | 899 | idle_time = ktime_to_us(ktime_sub(kt2, kt1)); |
873 | 900 | ||
874 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) | ||
875 | /* TSC could halt in idle, so notify users */ | ||
876 | if (tsc_halts_in_c(cx->type)) | ||
877 | mark_tsc_unstable("TSC halts in idle");; | ||
878 | #endif | ||
879 | sleep_ticks = us_to_pm_timer_ticks(idle_time); | 901 | sleep_ticks = us_to_pm_timer_ticks(idle_time); |
880 | 902 | ||
881 | /* Tell the scheduler how much we idled: */ | 903 | /* Tell the scheduler how much we idled: */ |
@@ -955,6 +977,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
955 | */ | 977 | */ |
956 | acpi_state_timer_broadcast(pr, cx, 1); | 978 | acpi_state_timer_broadcast(pr, cx, 1); |
957 | 979 | ||
980 | kt1 = ktime_get_real(); | ||
958 | /* | 981 | /* |
959 | * disable bus master | 982 | * disable bus master |
960 | * bm_check implies we need ARB_DIS | 983 | * bm_check implies we need ARB_DIS |
@@ -976,10 +999,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
976 | ACPI_FLUSH_CPU_CACHE(); | 999 | ACPI_FLUSH_CPU_CACHE(); |
977 | } | 1000 | } |
978 | 1001 | ||
979 | kt1 = ktime_get_real(); | ||
980 | acpi_idle_do_entry(cx); | 1002 | acpi_idle_do_entry(cx); |
981 | kt2 = ktime_get_real(); | ||
982 | idle_time = ktime_to_us(ktime_sub(kt2, kt1)); | ||
983 | 1003 | ||
984 | /* Re-enable bus master arbitration */ | 1004 | /* Re-enable bus master arbitration */ |
985 | if (pr->flags.bm_check && pr->flags.bm_control) { | 1005 | if (pr->flags.bm_check && pr->flags.bm_control) { |
@@ -988,12 +1008,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
988 | c3_cpu_count--; | 1008 | c3_cpu_count--; |
989 | spin_unlock(&c3_lock); | 1009 | spin_unlock(&c3_lock); |
990 | } | 1010 | } |
1011 | kt2 = ktime_get_real(); | ||
1012 | idle_time = ktime_to_us(ktime_sub(kt2, kt1)); | ||
991 | 1013 | ||
992 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) | ||
993 | /* TSC could halt in idle, so notify users */ | ||
994 | if (tsc_halts_in_c(ACPI_STATE_C3)) | ||
995 | mark_tsc_unstable("TSC halts in idle"); | ||
996 | #endif | ||
997 | sleep_ticks = us_to_pm_timer_ticks(idle_time); | 1014 | sleep_ticks = us_to_pm_timer_ticks(idle_time); |
998 | /* Tell the scheduler how much we idled: */ | 1015 | /* Tell the scheduler how much we idled: */ |
999 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | 1016 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); |
@@ -1037,6 +1054,9 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) | |||
1037 | dev->states[i].desc[0] = '\0'; | 1054 | dev->states[i].desc[0] = '\0'; |
1038 | } | 1055 | } |
1039 | 1056 | ||
1057 | if (max_cstate == 0) | ||
1058 | max_cstate = 1; | ||
1059 | |||
1040 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) { | 1060 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) { |
1041 | cx = &pr->power.states[i]; | 1061 | cx = &pr->power.states[i]; |
1042 | state = &dev->states[count]; | 1062 | state = &dev->states[count]; |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index d0d1f4d50434..7f16f5f8e7d3 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -45,6 +45,14 @@ | |||
45 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 45 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
46 | ACPI_MODULE_NAME("processor_throttling"); | 46 | ACPI_MODULE_NAME("processor_throttling"); |
47 | 47 | ||
48 | /* ignore_tpc: | ||
49 | * 0 -> acpi processor driver doesn't ignore _TPC values | ||
50 | * 1 -> acpi processor driver ignores _TPC values | ||
51 | */ | ||
52 | static int ignore_tpc; | ||
53 | module_param(ignore_tpc, int, 0644); | ||
54 | MODULE_PARM_DESC(ignore_tpc, "Disable broken BIOS _TPC throttling support"); | ||
55 | |||
48 | struct throttling_tstate { | 56 | struct throttling_tstate { |
49 | unsigned int cpu; /* cpu nr */ | 57 | unsigned int cpu; /* cpu nr */ |
50 | int target_state; /* target T-state */ | 58 | int target_state; /* target T-state */ |
@@ -283,6 +291,10 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) | |||
283 | 291 | ||
284 | if (!pr) | 292 | if (!pr) |
285 | return -EINVAL; | 293 | return -EINVAL; |
294 | |||
295 | if (ignore_tpc) | ||
296 | goto end; | ||
297 | |||
286 | status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc); | 298 | status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc); |
287 | if (ACPI_FAILURE(status)) { | 299 | if (ACPI_FAILURE(status)) { |
288 | if (status != AE_NOT_FOUND) { | 300 | if (status != AE_NOT_FOUND) { |
@@ -290,6 +302,8 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) | |||
290 | } | 302 | } |
291 | return -ENODEV; | 303 | return -ENODEV; |
292 | } | 304 | } |
305 | |||
306 | end: | ||
293 | pr->throttling_platform_limit = (int)tpc; | 307 | pr->throttling_platform_limit = (int)tpc; |
294 | return 0; | 308 | return 0; |
295 | } | 309 | } |
@@ -302,6 +316,9 @@ int acpi_processor_tstate_has_changed(struct acpi_processor *pr) | |||
302 | struct acpi_processor_limit *limit; | 316 | struct acpi_processor_limit *limit; |
303 | int target_state; | 317 | int target_state; |
304 | 318 | ||
319 | if (ignore_tpc) | ||
320 | return 0; | ||
321 | |||
305 | result = acpi_processor_get_platform_limit(pr); | 322 | result = acpi_processor_get_platform_limit(pr); |
306 | if (result) { | 323 | if (result) { |
307 | /* Throttling Limit is unsupported */ | 324 | /* Throttling Limit is unsupported */ |
@@ -821,6 +838,14 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | |||
821 | ret = acpi_read_throttling_status(pr, &value); | 838 | ret = acpi_read_throttling_status(pr, &value); |
822 | if (ret >= 0) { | 839 | if (ret >= 0) { |
823 | state = acpi_get_throttling_state(pr, value); | 840 | state = acpi_get_throttling_state(pr, value); |
841 | if (state == -1) { | ||
842 | ACPI_WARNING((AE_INFO, | ||
843 | "Invalid throttling state, reset\n")); | ||
844 | state = 0; | ||
845 | ret = acpi_processor_set_throttling(pr, state); | ||
846 | if (ret) | ||
847 | return ret; | ||
848 | } | ||
824 | pr->throttling.state = state; | 849 | pr->throttling.state = state; |
825 | } | 850 | } |
826 | 851 | ||
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index d060e6fd7fd5..01574a066534 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -713,6 +713,32 @@ static void acpi_power_off(void) | |||
713 | acpi_enter_sleep_state(ACPI_STATE_S5); | 713 | acpi_enter_sleep_state(ACPI_STATE_S5); |
714 | } | 714 | } |
715 | 715 | ||
716 | /* | ||
717 | * ACPI 2.0 created the optional _GTS and _BFS, | ||
718 | * but industry adoption has been neither rapid nor broad. | ||
719 | * | ||
720 | * Linux gets into trouble when it executes poorly validated | ||
721 | * paths through the BIOS, so disable _GTS and _BFS by default, | ||
722 | * but do speak up and offer the option to enable them. | ||
723 | */ | ||
724 | void __init acpi_gts_bfs_check(void) | ||
725 | { | ||
726 | acpi_handle dummy; | ||
727 | |||
728 | if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_NAME__GTS, &dummy))) | ||
729 | { | ||
730 | printk(KERN_NOTICE PREFIX "BIOS offers _GTS\n"); | ||
731 | printk(KERN_NOTICE PREFIX "If \"acpi.gts=1\" improves suspend, " | ||
732 | "please notify linux-acpi@vger.kernel.org\n"); | ||
733 | } | ||
734 | if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_NAME__BFS, &dummy))) | ||
735 | { | ||
736 | printk(KERN_NOTICE PREFIX "BIOS offers _BFS\n"); | ||
737 | printk(KERN_NOTICE PREFIX "If \"acpi.bfs=1\" improves resume, " | ||
738 | "please notify linux-acpi@vger.kernel.org\n"); | ||
739 | } | ||
740 | } | ||
741 | |||
716 | int __init acpi_sleep_init(void) | 742 | int __init acpi_sleep_init(void) |
717 | { | 743 | { |
718 | acpi_status status; | 744 | acpi_status status; |
@@ -771,5 +797,6 @@ int __init acpi_sleep_init(void) | |||
771 | * object can also be evaluated when the system enters S5. | 797 | * object can also be evaluated when the system enters S5. |
772 | */ | 798 | */ |
773 | register_reboot_notifier(&tts_notifier); | 799 | register_reboot_notifier(&tts_notifier); |
800 | acpi_gts_bfs_check(); | ||
774 | return 0; | 801 | return 0; |
775 | } | 802 | } |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index da51f05ef8d8..0944daec064f 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -38,6 +38,7 @@ ACPI_MODULE_NAME("system"); | |||
38 | #define ACPI_SYSTEM_DEVICE_NAME "System" | 38 | #define ACPI_SYSTEM_DEVICE_NAME "System" |
39 | 39 | ||
40 | u32 acpi_irq_handled; | 40 | u32 acpi_irq_handled; |
41 | u32 acpi_irq_not_handled; | ||
41 | 42 | ||
42 | /* | 43 | /* |
43 | * Make ACPICA version work as module param | 44 | * Make ACPICA version work as module param |
@@ -214,8 +215,9 @@ err: | |||
214 | 215 | ||
215 | #define COUNT_GPE 0 | 216 | #define COUNT_GPE 0 |
216 | #define COUNT_SCI 1 /* acpi_irq_handled */ | 217 | #define COUNT_SCI 1 /* acpi_irq_handled */ |
217 | #define COUNT_ERROR 2 /* other */ | 218 | #define COUNT_SCI_NOT 2 /* acpi_irq_not_handled */ |
218 | #define NUM_COUNTERS_EXTRA 3 | 219 | #define COUNT_ERROR 3 /* other */ |
220 | #define NUM_COUNTERS_EXTRA 4 | ||
219 | 221 | ||
220 | struct event_counter { | 222 | struct event_counter { |
221 | u32 count; | 223 | u32 count; |
@@ -317,6 +319,8 @@ static ssize_t counter_show(struct kobject *kobj, | |||
317 | 319 | ||
318 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI].count = | 320 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI].count = |
319 | acpi_irq_handled; | 321 | acpi_irq_handled; |
322 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI_NOT].count = | ||
323 | acpi_irq_not_handled; | ||
320 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = | 324 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = |
321 | acpi_gpe_count; | 325 | acpi_gpe_count; |
322 | 326 | ||
@@ -363,6 +367,7 @@ static ssize_t counter_set(struct kobject *kobj, | |||
363 | all_counters[i].count = 0; | 367 | all_counters[i].count = 0; |
364 | acpi_gpe_count = 0; | 368 | acpi_gpe_count = 0; |
365 | acpi_irq_handled = 0; | 369 | acpi_irq_handled = 0; |
370 | acpi_irq_not_handled = 0; | ||
366 | goto end; | 371 | goto end; |
367 | } | 372 | } |
368 | 373 | ||
@@ -456,6 +461,8 @@ void acpi_irq_stats_init(void) | |||
456 | sprintf(buffer, "gpe_all"); | 461 | sprintf(buffer, "gpe_all"); |
457 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) | 462 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) |
458 | sprintf(buffer, "sci"); | 463 | sprintf(buffer, "sci"); |
464 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI_NOT) | ||
465 | sprintf(buffer, "sci_not"); | ||
459 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR) | 466 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR) |
460 | sprintf(buffer, "error"); | 467 | sprintf(buffer, "error"); |
461 | else | 468 | else |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 9cd15e8c8932..564ea1424288 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -909,7 +909,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | |||
909 | thermal_zone_device_register("acpitz", trips, tz, | 909 | thermal_zone_device_register("acpitz", trips, tz, |
910 | &acpi_thermal_zone_ops, | 910 | &acpi_thermal_zone_ops, |
911 | 0, 0, 0, | 911 | 0, 0, 0, |
912 | tz->polling_frequency); | 912 | tz->polling_frequency*100); |
913 | if (IS_ERR(tz->thermal_zone)) | 913 | if (IS_ERR(tz->thermal_zone)) |
914 | return -ENODEV; | 914 | return -ENODEV; |
915 | 915 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index cd4fb7543a90..810cca90ca7f 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -538,6 +538,41 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) | |||
538 | return -EINVAL; | 538 | return -EINVAL; |
539 | } | 539 | } |
540 | 540 | ||
541 | /* | ||
542 | * For some buggy _BQC methods, we need to add a constant value to | ||
543 | * the _BQC return value to get the actual current brightness level | ||
544 | */ | ||
545 | |||
546 | static int bqc_offset_aml_bug_workaround; | ||
547 | static int __init video_set_bqc_offset(const struct dmi_system_id *d) | ||
548 | { | ||
549 | bqc_offset_aml_bug_workaround = 9; | ||
550 | return 0; | ||
551 | } | ||
552 | |||
553 | static struct dmi_system_id video_dmi_table[] __initdata = { | ||
554 | /* | ||
555 | * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 | ||
556 | */ | ||
557 | { | ||
558 | .callback = video_set_bqc_offset, | ||
559 | .ident = "Acer Aspire 5720", | ||
560 | .matches = { | ||
561 | DMI_MATCH(DMI_BOARD_VENDOR, "Acer"), | ||
562 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"), | ||
563 | }, | ||
564 | }, | ||
565 | { | ||
566 | .callback = video_set_bqc_offset, | ||
567 | .ident = "Acer Aspire 5710Z", | ||
568 | .matches = { | ||
569 | DMI_MATCH(DMI_BOARD_VENDOR, "Acer"), | ||
570 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5710Z"), | ||
571 | }, | ||
572 | }, | ||
573 | {} | ||
574 | }; | ||
575 | |||
541 | static int | 576 | static int |
542 | acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, | 577 | acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, |
543 | unsigned long long *level) | 578 | unsigned long long *level) |
@@ -557,6 +592,7 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, | |||
557 | *level = device->brightness->levels[*level + 2]; | 592 | *level = device->brightness->levels[*level + 2]; |
558 | 593 | ||
559 | } | 594 | } |
595 | *level += bqc_offset_aml_bug_workaround; | ||
560 | device->brightness->curr = *level; | 596 | device->brightness->curr = *level; |
561 | return 0; | 597 | return 0; |
562 | } else { | 598 | } else { |
@@ -770,10 +806,12 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
770 | * In this case, the first two elements in _BCL packages | 806 | * In this case, the first two elements in _BCL packages |
771 | * are also supported brightness levels that OS should take care of. | 807 | * are also supported brightness levels that OS should take care of. |
772 | */ | 808 | */ |
773 | for (i = 2; i < count; i++) | 809 | for (i = 2; i < count; i++) { |
774 | if (br->levels[i] == br->levels[0] || | 810 | if (br->levels[i] == br->levels[0]) |
775 | br->levels[i] == br->levels[1]) | 811 | level_ac_battery++; |
812 | if (br->levels[i] == br->levels[1]) | ||
776 | level_ac_battery++; | 813 | level_ac_battery++; |
814 | } | ||
777 | 815 | ||
778 | if (level_ac_battery < 2) { | 816 | if (level_ac_battery < 2) { |
779 | level_ac_battery = 2 - level_ac_battery; | 817 | level_ac_battery = 2 - level_ac_battery; |
@@ -807,12 +845,19 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
807 | br->flags._BCM_use_index = br->flags._BCL_use_index; | 845 | br->flags._BCM_use_index = br->flags._BCL_use_index; |
808 | 846 | ||
809 | /* _BQC uses INDEX while _BCL uses VALUE in some laptops */ | 847 | /* _BQC uses INDEX while _BCL uses VALUE in some laptops */ |
810 | br->curr = max_level; | 848 | br->curr = level_old = max_level; |
849 | |||
850 | if (!device->cap._BQC) | ||
851 | goto set_level; | ||
852 | |||
811 | result = acpi_video_device_lcd_get_level_current(device, &level_old); | 853 | result = acpi_video_device_lcd_get_level_current(device, &level_old); |
812 | if (result) | 854 | if (result) |
813 | goto out_free_levels; | 855 | goto out_free_levels; |
814 | 856 | ||
815 | result = acpi_video_device_lcd_set_level(device, br->curr); | 857 | /* |
858 | * Set the level to maximum and check if _BQC uses indexed value | ||
859 | */ | ||
860 | result = acpi_video_device_lcd_set_level(device, max_level); | ||
816 | if (result) | 861 | if (result) |
817 | goto out_free_levels; | 862 | goto out_free_levels; |
818 | 863 | ||
@@ -820,25 +865,19 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
820 | if (result) | 865 | if (result) |
821 | goto out_free_levels; | 866 | goto out_free_levels; |
822 | 867 | ||
823 | if ((level != level_old) && !br->flags._BCM_use_index) { | 868 | br->flags._BQC_use_index = (level == max_level ? 0 : 1); |
824 | /* Note: | 869 | |
825 | * This piece of code does not work correctly if the current | 870 | if (!br->flags._BQC_use_index) |
826 | * brightness levels is 0. | 871 | goto set_level; |
827 | * But I guess boxes that boot with such a dark screen are rare | 872 | |
828 | * and no more code is needed to cover this specifial case. | 873 | if (br->flags._BCL_reversed) |
829 | */ | 874 | level_old = (br->count - 1) - level_old; |
830 | 875 | level_old = br->levels[level_old]; | |
831 | if (level_ac_battery != 2) { | 876 | |
832 | /* | 877 | set_level: |
833 | * For now, we don't support the _BCL like this: | 878 | result = acpi_video_device_lcd_set_level(device, level_old); |
834 | * 16, 15, 0, 1, 2, 3, ..., 14, 15, 16 | 879 | if (result) |
835 | * because we may mess up the index returned by _BQC. | 880 | goto out_free_levels; |
836 | * Plus: we have not got a box like this. | ||
837 | */ | ||
838 | ACPI_ERROR((AE_INFO, "_BCL not supported\n")); | ||
839 | } | ||
840 | br->flags._BQC_use_index = 1; | ||
841 | } | ||
842 | 881 | ||
843 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 882 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
844 | "found %d brightness levels\n", count - 2)); | 883 | "found %d brightness levels\n", count - 2)); |
@@ -2287,13 +2326,15 @@ EXPORT_SYMBOL(acpi_video_register); | |||
2287 | 2326 | ||
2288 | static int __init acpi_video_init(void) | 2327 | static int __init acpi_video_init(void) |
2289 | { | 2328 | { |
2329 | dmi_check_system(video_dmi_table); | ||
2330 | |||
2290 | if (intel_opregion_present()) | 2331 | if (intel_opregion_present()) |
2291 | return 0; | 2332 | return 0; |
2292 | 2333 | ||
2293 | return acpi_video_register(); | 2334 | return acpi_video_register(); |
2294 | } | 2335 | } |
2295 | 2336 | ||
2296 | static void __exit acpi_video_exit(void) | 2337 | void __exit acpi_video_exit(void) |
2297 | { | 2338 | { |
2298 | 2339 | ||
2299 | acpi_bus_unregister_driver(&acpi_video_bus); | 2340 | acpi_bus_unregister_driver(&acpi_video_bus); |
@@ -2302,6 +2343,7 @@ static void __exit acpi_video_exit(void) | |||
2302 | 2343 | ||
2303 | return; | 2344 | return; |
2304 | } | 2345 | } |
2346 | EXPORT_SYMBOL(acpi_video_exit); | ||
2305 | 2347 | ||
2306 | module_init(acpi_video_init); | 2348 | module_init(acpi_video_init); |
2307 | module_exit(acpi_video_exit); | 2349 | module_exit(acpi_video_exit); |