diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-07-18 16:00:54 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-18 16:00:54 -0400 |
commit | bb2c018b09b681d43f5e08124b83e362647ea82b (patch) | |
tree | d794902c78f9fdd04ed88a4b8d451ed6f9292ec0 /drivers/acpi | |
parent | 82638844d9a8581bbf33201cc209a14876eca167 (diff) | |
parent | 5b664cb235e97afbf34db9c4d77f08ebd725335e (diff) |
Merge branch 'linus' into cpus4096
Conflicts:
drivers/acpi/processor_throttling.c
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/acpi')
71 files changed, 1585 insertions, 707 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index bba867391a85..735f5ea17473 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -336,6 +336,15 @@ config ACPI_EC | |||
336 | the battery and thermal drivers. If you are compiling for a | 336 | the battery and thermal drivers. If you are compiling for a |
337 | mobile system, say Y. | 337 | mobile system, say Y. |
338 | 338 | ||
339 | config ACPI_PCI_SLOT | ||
340 | tristate "PCI slot detection driver" | ||
341 | default n | ||
342 | help | ||
343 | This driver will attempt to discover all PCI slots in your system, | ||
344 | and creates entries in /sys/bus/pci/slots/. This feature can | ||
345 | help you correlate PCI bus addresses with the physical geography | ||
346 | of your slots. If you are unsure, say N. | ||
347 | |||
339 | config ACPI_POWER | 348 | config ACPI_POWER |
340 | bool | 349 | bool |
341 | default y | 350 | default y |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 40b0fcae4c78..52a4cd4b81d0 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -21,7 +21,7 @@ obj-$(CONFIG_X86) += blacklist.o | |||
21 | # | 21 | # |
22 | # ACPI Core Subsystem (Interpreter) | 22 | # ACPI Core Subsystem (Interpreter) |
23 | # | 23 | # |
24 | obj-y += osl.o utils.o \ | 24 | obj-y += osl.o utils.o reboot.o\ |
25 | dispatcher/ events/ executer/ hardware/ \ | 25 | dispatcher/ events/ executer/ hardware/ \ |
26 | namespace/ parser/ resources/ tables/ \ | 26 | namespace/ parser/ resources/ tables/ \ |
27 | utilities/ | 27 | utilities/ |
@@ -48,6 +48,7 @@ obj-$(CONFIG_ACPI_DOCK) += dock.o | |||
48 | obj-$(CONFIG_ACPI_BAY) += bay.o | 48 | obj-$(CONFIG_ACPI_BAY) += bay.o |
49 | obj-$(CONFIG_ACPI_VIDEO) += video.o | 49 | obj-$(CONFIG_ACPI_VIDEO) += video.o |
50 | obj-y += pci_root.o pci_link.o pci_irq.o pci_bind.o | 50 | obj-y += pci_root.o pci_link.o pci_irq.o pci_bind.o |
51 | obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o | ||
51 | obj-$(CONFIG_ACPI_POWER) += power.o | 52 | obj-$(CONFIG_ACPI_POWER) += power.o |
52 | obj-$(CONFIG_ACPI_PROCESSOR) += processor.o | 53 | obj-$(CONFIG_ACPI_PROCESSOR) += processor.o |
53 | obj-$(CONFIG_ACPI_CONTAINER) += container.o | 54 | obj-$(CONFIG_ACPI_CONTAINER) += container.o |
diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c index 61b6c5beb2d3..e6caf5d42e0e 100644 --- a/drivers/acpi/bay.c +++ b/drivers/acpi/bay.c | |||
@@ -380,6 +380,9 @@ static int __init bay_init(void) | |||
380 | if (acpi_disabled) | 380 | if (acpi_disabled) |
381 | return -ENODEV; | 381 | return -ENODEV; |
382 | 382 | ||
383 | if (acpi_disabled) | ||
384 | return -ENODEV; | ||
385 | |||
383 | /* look for dockable drive bays */ | 386 | /* look for dockable drive bays */ |
384 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | 387 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
385 | ACPI_UINT32_MAX, find_bay, &bays, NULL); | 388 | ACPI_UINT32_MAX, find_bay, &bays, NULL); |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index a6dbcf4d9ef5..ccae305ee55d 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -295,6 +295,28 @@ int acpi_bus_set_power(acpi_handle handle, int state) | |||
295 | 295 | ||
296 | EXPORT_SYMBOL(acpi_bus_set_power); | 296 | EXPORT_SYMBOL(acpi_bus_set_power); |
297 | 297 | ||
298 | bool acpi_bus_power_manageable(acpi_handle handle) | ||
299 | { | ||
300 | struct acpi_device *device; | ||
301 | int result; | ||
302 | |||
303 | result = acpi_bus_get_device(handle, &device); | ||
304 | return result ? false : device->flags.power_manageable; | ||
305 | } | ||
306 | |||
307 | EXPORT_SYMBOL(acpi_bus_power_manageable); | ||
308 | |||
309 | bool acpi_bus_can_wakeup(acpi_handle handle) | ||
310 | { | ||
311 | struct acpi_device *device; | ||
312 | int result; | ||
313 | |||
314 | result = acpi_bus_get_device(handle, &device); | ||
315 | return result ? false : device->wakeup.flags.valid; | ||
316 | } | ||
317 | |||
318 | EXPORT_SYMBOL(acpi_bus_can_wakeup); | ||
319 | |||
298 | /* -------------------------------------------------------------------------- | 320 | /* -------------------------------------------------------------------------- |
299 | Event Management | 321 | Event Management |
300 | -------------------------------------------------------------------------- */ | 322 | -------------------------------------------------------------------------- */ |
@@ -612,7 +634,7 @@ static int __init acpi_bus_init_irq(void) | |||
612 | return 0; | 634 | return 0; |
613 | } | 635 | } |
614 | 636 | ||
615 | acpi_native_uint acpi_gbl_permanent_mmap; | 637 | u8 acpi_gbl_permanent_mmap; |
616 | 638 | ||
617 | 639 | ||
618 | void __init acpi_early_init(void) | 640 | void __init acpi_early_init(void) |
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index 610b1ee102b0..949f7c75029e 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c | |||
@@ -151,7 +151,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
151 | ******************************************************************************/ | 151 | ******************************************************************************/ |
152 | 152 | ||
153 | acpi_status | 153 | acpi_status |
154 | acpi_ds_initialize_objects(acpi_native_uint table_index, | 154 | acpi_ds_initialize_objects(u32 table_index, |
155 | struct acpi_namespace_node * start_node) | 155 | struct acpi_namespace_node * start_node) |
156 | { | 156 | { |
157 | acpi_status status; | 157 | acpi_status status; |
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 2509809a36cf..4613b9ca5792 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -377,7 +377,6 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
377 | } | 377 | } |
378 | 378 | ||
379 | info->parameters = &this_walk_state->operands[0]; | 379 | info->parameters = &this_walk_state->operands[0]; |
380 | info->parameter_type = ACPI_PARAM_ARGS; | ||
381 | 380 | ||
382 | status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, | 381 | status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, |
383 | obj_desc->method.aml_start, | 382 | obj_desc->method.aml_start, |
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index a818e0ddb996..6a81c4400edf 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c | |||
@@ -691,12 +691,6 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
691 | 691 | ||
692 | status = acpi_ex_resolve_operands(op->common.aml_opcode, | 692 | status = acpi_ex_resolve_operands(op->common.aml_opcode, |
693 | ACPI_WALK_OPERANDS, walk_state); | 693 | ACPI_WALK_OPERANDS, walk_state); |
694 | |||
695 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | ||
696 | acpi_ps_get_opcode_name(op->common.aml_opcode), | ||
697 | walk_state->num_operands, | ||
698 | "after AcpiExResolveOperands"); | ||
699 | |||
700 | if (ACPI_FAILURE(status)) { | 694 | if (ACPI_FAILURE(status)) { |
701 | ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", | 695 | ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", |
702 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 696 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
@@ -785,10 +779,6 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
785 | return_ACPI_STATUS(status); | 779 | return_ACPI_STATUS(status); |
786 | } | 780 | } |
787 | 781 | ||
788 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | ||
789 | acpi_ps_get_opcode_name(op->common.aml_opcode), | ||
790 | 1, "after AcpiExResolveOperands"); | ||
791 | |||
792 | obj_desc = acpi_ns_get_attached_object(node); | 782 | obj_desc = acpi_ns_get_attached_object(node); |
793 | if (!obj_desc) { | 783 | if (!obj_desc) { |
794 | return_ACPI_STATUS(AE_NOT_EXIST); | 784 | return_ACPI_STATUS(AE_NOT_EXIST); |
@@ -848,7 +838,7 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, | |||
848 | union acpi_operand_object **operand; | 838 | union acpi_operand_object **operand; |
849 | struct acpi_namespace_node *node; | 839 | struct acpi_namespace_node *node; |
850 | union acpi_parse_object *next_op; | 840 | union acpi_parse_object *next_op; |
851 | acpi_native_uint table_index; | 841 | u32 table_index; |
852 | struct acpi_table_header *table; | 842 | struct acpi_table_header *table; |
853 | 843 | ||
854 | ACPI_FUNCTION_TRACE_PTR(ds_eval_table_region_operands, op); | 844 | ACPI_FUNCTION_TRACE_PTR(ds_eval_table_region_operands, op); |
@@ -882,10 +872,6 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, | |||
882 | return_ACPI_STATUS(status); | 872 | return_ACPI_STATUS(status); |
883 | } | 873 | } |
884 | 874 | ||
885 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | ||
886 | acpi_ps_get_opcode_name(op->common.aml_opcode), | ||
887 | 1, "after AcpiExResolveOperands"); | ||
888 | |||
889 | operand = &walk_state->operands[0]; | 875 | operand = &walk_state->operands[0]; |
890 | 876 | ||
891 | /* Find the ACPI table */ | 877 | /* Find the ACPI table */ |
@@ -1091,10 +1077,8 @@ acpi_ds_eval_bank_field_operands(struct acpi_walk_state *walk_state, | |||
1091 | return_ACPI_STATUS(status); | 1077 | return_ACPI_STATUS(status); |
1092 | } | 1078 | } |
1093 | 1079 | ||
1094 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 1080 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, |
1095 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 1081 | acpi_ps_get_opcode_name(op->common.aml_opcode), 1); |
1096 | 1, "after AcpiExResolveOperands"); | ||
1097 | |||
1098 | /* | 1082 | /* |
1099 | * Get the bank_value operand and save it | 1083 | * Get the bank_value operand and save it |
1100 | * (at Top of stack) | 1084 | * (at Top of stack) |
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index b246b9657ead..b5072fa9c920 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c | |||
@@ -408,14 +408,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
408 | [walk_state-> | 408 | [walk_state-> |
409 | num_operands - 1]), | 409 | num_operands - 1]), |
410 | walk_state); | 410 | walk_state); |
411 | if (ACPI_SUCCESS(status)) { | ||
412 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, | ||
413 | ACPI_IMODE_EXECUTE, | ||
414 | acpi_ps_get_opcode_name | ||
415 | (walk_state->opcode), | ||
416 | walk_state->num_operands, | ||
417 | "after ExResolveOperands"); | ||
418 | } | ||
419 | } | 411 | } |
420 | 412 | ||
421 | if (ACPI_SUCCESS(status)) { | 413 | if (ACPI_SUCCESS(status)) { |
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index 1386ced332ec..b00d4af791aa 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c | |||
@@ -70,7 +70,7 @@ acpi_status | |||
70 | acpi_ds_result_pop(union acpi_operand_object **object, | 70 | acpi_ds_result_pop(union acpi_operand_object **object, |
71 | struct acpi_walk_state *walk_state) | 71 | struct acpi_walk_state *walk_state) |
72 | { | 72 | { |
73 | acpi_native_uint index; | 73 | u32 index; |
74 | union acpi_generic_state *state; | 74 | union acpi_generic_state *state; |
75 | acpi_status status; | 75 | acpi_status status; |
76 | 76 | ||
@@ -122,7 +122,7 @@ acpi_ds_result_pop(union acpi_operand_object **object, | |||
122 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 122 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
123 | "Obj=%p [%s] Index=%X State=%p Num=%X\n", *object, | 123 | "Obj=%p [%s] Index=%X State=%p Num=%X\n", *object, |
124 | acpi_ut_get_object_type_name(*object), | 124 | acpi_ut_get_object_type_name(*object), |
125 | (u32) index, walk_state, walk_state->result_count)); | 125 | index, walk_state, walk_state->result_count)); |
126 | 126 | ||
127 | return (AE_OK); | 127 | return (AE_OK); |
128 | } | 128 | } |
@@ -146,7 +146,7 @@ acpi_ds_result_push(union acpi_operand_object * object, | |||
146 | { | 146 | { |
147 | union acpi_generic_state *state; | 147 | union acpi_generic_state *state; |
148 | acpi_status status; | 148 | acpi_status status; |
149 | acpi_native_uint index; | 149 | u32 index; |
150 | 150 | ||
151 | ACPI_FUNCTION_NAME(ds_result_push); | 151 | ACPI_FUNCTION_NAME(ds_result_push); |
152 | 152 | ||
@@ -400,7 +400,7 @@ void | |||
400 | acpi_ds_obj_stack_pop_and_delete(u32 pop_count, | 400 | acpi_ds_obj_stack_pop_and_delete(u32 pop_count, |
401 | struct acpi_walk_state *walk_state) | 401 | struct acpi_walk_state *walk_state) |
402 | { | 402 | { |
403 | acpi_native_int i; | 403 | s32 i; |
404 | union acpi_operand_object *obj_desc; | 404 | union acpi_operand_object *obj_desc; |
405 | 405 | ||
406 | ACPI_FUNCTION_NAME(ds_obj_stack_pop_and_delete); | 406 | ACPI_FUNCTION_NAME(ds_obj_stack_pop_and_delete); |
@@ -409,7 +409,7 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, | |||
409 | return; | 409 | return; |
410 | } | 410 | } |
411 | 411 | ||
412 | for (i = (acpi_native_int) (pop_count - 1); i >= 0; i--) { | 412 | for (i = (s32) pop_count - 1; i >= 0; i--) { |
413 | if (walk_state->num_operands == 0) { | 413 | if (walk_state->num_operands == 0) { |
414 | return; | 414 | return; |
415 | } | 415 | } |
@@ -615,14 +615,8 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, | |||
615 | walk_state->pass_number = pass_number; | 615 | walk_state->pass_number = pass_number; |
616 | 616 | ||
617 | if (info) { | 617 | if (info) { |
618 | if (info->parameter_type == ACPI_PARAM_GPE) { | 618 | walk_state->params = info->parameters; |
619 | walk_state->gpe_event_info = | 619 | walk_state->caller_return_desc = &info->return_object; |
620 | ACPI_CAST_PTR(struct acpi_gpe_event_info, | ||
621 | info->parameters); | ||
622 | } else { | ||
623 | walk_state->params = info->parameters; | ||
624 | walk_state->caller_return_desc = &info->return_object; | ||
625 | } | ||
626 | } | 620 | } |
627 | 621 | ||
628 | status = acpi_ps_init_scope(&walk_state->parser_state, op); | 622 | status = acpi_ps_init_scope(&walk_state->parser_state, op); |
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index bb7c51f712bd..1e872e79db33 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -920,6 +920,9 @@ static int __init dock_init(void) | |||
920 | if (acpi_disabled) | 920 | if (acpi_disabled) |
921 | return 0; | 921 | return 0; |
922 | 922 | ||
923 | if (acpi_disabled) | ||
924 | return 0; | ||
925 | |||
923 | /* look for a dock station */ | 926 | /* look for a dock station */ |
924 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | 927 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
925 | ACPI_UINT32_MAX, find_dock, &num, NULL); | 928 | ACPI_UINT32_MAX, find_dock, &num, NULL); |
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index 5d30e5be1b1c..c56c5c6ea77b 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c | |||
@@ -188,7 +188,7 @@ acpi_status acpi_ev_install_xrupt_handlers(void) | |||
188 | 188 | ||
189 | static acpi_status acpi_ev_fixed_event_initialize(void) | 189 | static acpi_status acpi_ev_fixed_event_initialize(void) |
190 | { | 190 | { |
191 | acpi_native_uint i; | 191 | u32 i; |
192 | acpi_status status; | 192 | acpi_status status; |
193 | 193 | ||
194 | /* | 194 | /* |
@@ -231,7 +231,7 @@ u32 acpi_ev_fixed_event_detect(void) | |||
231 | u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; | 231 | u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; |
232 | u32 fixed_status; | 232 | u32 fixed_status; |
233 | u32 fixed_enable; | 233 | u32 fixed_enable; |
234 | acpi_native_uint i; | 234 | u32 i; |
235 | 235 | ||
236 | ACPI_FUNCTION_NAME(ev_fixed_event_detect); | 236 | ACPI_FUNCTION_NAME(ev_fixed_event_detect); |
237 | 237 | ||
@@ -260,7 +260,7 @@ u32 acpi_ev_fixed_event_detect(void) | |||
260 | 260 | ||
261 | /* Found an active (signalled) event */ | 261 | /* Found an active (signalled) event */ |
262 | acpi_os_fixed_event_count(i); | 262 | acpi_os_fixed_event_count(i); |
263 | int_status |= acpi_ev_fixed_event_dispatch((u32) i); | 263 | int_status |= acpi_ev_fixed_event_dispatch(i); |
264 | } | 264 | } |
265 | } | 265 | } |
266 | 266 | ||
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index 5354be44f876..c5e53aae86f7 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c | |||
@@ -256,7 +256,7 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
256 | return_ACPI_STATUS(status); | 256 | return_ACPI_STATUS(status); |
257 | } | 257 | } |
258 | 258 | ||
259 | /* Mark wake-disabled or HW disable, or both */ | 259 | /* Clear the appropriate enabled flags for this GPE */ |
260 | 260 | ||
261 | switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { | 261 | switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { |
262 | case ACPI_GPE_TYPE_WAKE: | 262 | case ACPI_GPE_TYPE_WAKE: |
@@ -273,13 +273,23 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
273 | /* Disable the requested runtime GPE */ | 273 | /* Disable the requested runtime GPE */ |
274 | 274 | ||
275 | ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); | 275 | ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); |
276 | 276 | break; | |
277 | /* fallthrough */ | ||
278 | 277 | ||
279 | default: | 278 | default: |
280 | acpi_hw_write_gpe_enable_reg(gpe_event_info); | 279 | break; |
281 | } | 280 | } |
282 | 281 | ||
282 | /* | ||
283 | * Even if we don't know the GPE type, make sure that we always | ||
284 | * disable it. low_disable_gpe will just clear the enable bit for this | ||
285 | * GPE and write it. It will not write out the current GPE enable mask, | ||
286 | * since this may inadvertently enable GPEs too early, if a rogue GPE has | ||
287 | * come in during ACPICA initialization - possibly as a result of AML or | ||
288 | * other code that has enabled the GPE. | ||
289 | */ | ||
290 | status = acpi_hw_low_disable_gpe(gpe_event_info); | ||
291 | return_ACPI_STATUS(status); | ||
292 | |||
283 | return_ACPI_STATUS(AE_OK); | 293 | return_ACPI_STATUS(AE_OK); |
284 | } | 294 | } |
285 | 295 | ||
@@ -305,7 +315,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, | |||
305 | { | 315 | { |
306 | union acpi_operand_object *obj_desc; | 316 | union acpi_operand_object *obj_desc; |
307 | struct acpi_gpe_block_info *gpe_block; | 317 | struct acpi_gpe_block_info *gpe_block; |
308 | acpi_native_uint i; | 318 | u32 i; |
309 | 319 | ||
310 | ACPI_FUNCTION_ENTRY(); | 320 | ACPI_FUNCTION_ENTRY(); |
311 | 321 | ||
@@ -379,8 +389,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
379 | u32 status_reg; | 389 | u32 status_reg; |
380 | u32 enable_reg; | 390 | u32 enable_reg; |
381 | acpi_cpu_flags flags; | 391 | acpi_cpu_flags flags; |
382 | acpi_native_uint i; | 392 | u32 i; |
383 | acpi_native_uint j; | 393 | u32 j; |
384 | 394 | ||
385 | ACPI_FUNCTION_NAME(ev_gpe_detect); | 395 | ACPI_FUNCTION_NAME(ev_gpe_detect); |
386 | 396 | ||
@@ -462,13 +472,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
462 | */ | 472 | */ |
463 | int_status |= | 473 | int_status |= |
464 | acpi_ev_gpe_dispatch(&gpe_block-> | 474 | acpi_ev_gpe_dispatch(&gpe_block-> |
465 | event_info[(i * | 475 | event_info[((acpi_size) i * ACPI_GPE_REGISTER_WIDTH) + j], j + gpe_register_info->base_gpe_number); |
466 | ACPI_GPE_REGISTER_WIDTH) | ||
467 | + | ||
468 | j], | ||
469 | (u32) j + | ||
470 | gpe_register_info-> | ||
471 | base_gpe_number); | ||
472 | } | 476 | } |
473 | } | 477 | } |
474 | } | 478 | } |
@@ -555,10 +559,6 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
555 | */ | 559 | */ |
556 | info->prefix_node = | 560 | info->prefix_node = |
557 | local_gpe_event_info.dispatch.method_node; | 561 | local_gpe_event_info.dispatch.method_node; |
558 | info->parameters = | ||
559 | ACPI_CAST_PTR(union acpi_operand_object *, | ||
560 | gpe_event_info); | ||
561 | info->parameter_type = ACPI_PARAM_GPE; | ||
562 | info->flags = ACPI_IGNORE_RETURN_VALUE; | 562 | info->flags = ACPI_IGNORE_RETURN_VALUE; |
563 | 563 | ||
564 | status = acpi_ns_evaluate(info); | 564 | status = acpi_ns_evaluate(info); |
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index e6c4d4c49e79..73c058e2f5c2 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c | |||
@@ -189,8 +189,8 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
189 | struct acpi_gpe_block_info *gpe_block) | 189 | struct acpi_gpe_block_info *gpe_block) |
190 | { | 190 | { |
191 | struct acpi_gpe_event_info *gpe_event_info; | 191 | struct acpi_gpe_event_info *gpe_event_info; |
192 | acpi_native_uint i; | 192 | u32 i; |
193 | acpi_native_uint j; | 193 | u32 j; |
194 | 194 | ||
195 | ACPI_FUNCTION_TRACE(ev_delete_gpe_handlers); | 195 | ACPI_FUNCTION_TRACE(ev_delete_gpe_handlers); |
196 | 196 | ||
@@ -203,7 +203,8 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
203 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { | 203 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { |
204 | gpe_event_info = | 204 | gpe_event_info = |
205 | &gpe_block-> | 205 | &gpe_block-> |
206 | event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; | 206 | event_info[((acpi_size) i * |
207 | ACPI_GPE_REGISTER_WIDTH) + j]; | ||
207 | 208 | ||
208 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 209 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
209 | ACPI_GPE_DISPATCH_HANDLER) { | 210 | ACPI_GPE_DISPATCH_HANDLER) { |
@@ -744,8 +745,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
744 | struct acpi_gpe_event_info *gpe_event_info = NULL; | 745 | struct acpi_gpe_event_info *gpe_event_info = NULL; |
745 | struct acpi_gpe_event_info *this_event; | 746 | struct acpi_gpe_event_info *this_event; |
746 | struct acpi_gpe_register_info *this_register; | 747 | struct acpi_gpe_register_info *this_register; |
747 | acpi_native_uint i; | 748 | u32 i; |
748 | acpi_native_uint j; | 749 | u32 j; |
749 | acpi_status status; | 750 | acpi_status status; |
750 | 751 | ||
751 | ACPI_FUNCTION_TRACE(ev_create_gpe_info_blocks); | 752 | ACPI_FUNCTION_TRACE(ev_create_gpe_info_blocks); |
@@ -983,8 +984,8 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
983 | struct acpi_gpe_walk_info gpe_info; | 984 | struct acpi_gpe_walk_info gpe_info; |
984 | u32 wake_gpe_count; | 985 | u32 wake_gpe_count; |
985 | u32 gpe_enabled_count; | 986 | u32 gpe_enabled_count; |
986 | acpi_native_uint i; | 987 | u32 i; |
987 | acpi_native_uint j; | 988 | u32 j; |
988 | 989 | ||
989 | ACPI_FUNCTION_TRACE(ev_initialize_gpe_block); | 990 | ACPI_FUNCTION_TRACE(ev_initialize_gpe_block); |
990 | 991 | ||
@@ -1033,7 +1034,8 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
1033 | 1034 | ||
1034 | gpe_event_info = | 1035 | gpe_event_info = |
1035 | &gpe_block-> | 1036 | &gpe_block-> |
1036 | event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; | 1037 | event_info[((acpi_size) i * |
1038 | ACPI_GPE_REGISTER_WIDTH) + j]; | ||
1037 | 1039 | ||
1038 | if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 1040 | if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
1039 | ACPI_GPE_DISPATCH_METHOD) | 1041 | ACPI_GPE_DISPATCH_METHOD) |
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 2113e58e2221..1d5670be729a 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -575,7 +575,7 @@ acpi_status acpi_ev_release_global_lock(void) | |||
575 | 575 | ||
576 | void acpi_ev_terminate(void) | 576 | void acpi_ev_terminate(void) |
577 | { | 577 | { |
578 | acpi_native_uint i; | 578 | u32 i; |
579 | acpi_status status; | 579 | acpi_status status; |
580 | 580 | ||
581 | ACPI_FUNCTION_TRACE(ev_terminate); | 581 | ACPI_FUNCTION_TRACE(ev_terminate); |
@@ -589,7 +589,7 @@ void acpi_ev_terminate(void) | |||
589 | /* Disable all fixed events */ | 589 | /* Disable all fixed events */ |
590 | 590 | ||
591 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { | 591 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { |
592 | status = acpi_disable_event((u32) i, 0); | 592 | status = acpi_disable_event(i, 0); |
593 | if (ACPI_FAILURE(status)) { | 593 | if (ACPI_FAILURE(status)) { |
594 | ACPI_ERROR((AE_INFO, | 594 | ACPI_ERROR((AE_INFO, |
595 | "Could not disable fixed event %d", | 595 | "Could not disable fixed event %d", |
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 1628f5934752..236fbd1ca438 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c | |||
@@ -81,7 +81,7 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
81 | acpi_status acpi_ev_install_region_handlers(void) | 81 | acpi_status acpi_ev_install_region_handlers(void) |
82 | { | 82 | { |
83 | acpi_status status; | 83 | acpi_status status; |
84 | acpi_native_uint i; | 84 | u32 i; |
85 | 85 | ||
86 | ACPI_FUNCTION_TRACE(ev_install_region_handlers); | 86 | ACPI_FUNCTION_TRACE(ev_install_region_handlers); |
87 | 87 | ||
@@ -151,7 +151,7 @@ acpi_status acpi_ev_install_region_handlers(void) | |||
151 | acpi_status acpi_ev_initialize_op_regions(void) | 151 | acpi_status acpi_ev_initialize_op_regions(void) |
152 | { | 152 | { |
153 | acpi_status status; | 153 | acpi_status status; |
154 | acpi_native_uint i; | 154 | u32 i; |
155 | 155 | ||
156 | ACPI_FUNCTION_TRACE(ev_initialize_op_regions); | 156 | ACPI_FUNCTION_TRACE(ev_initialize_op_regions); |
157 | 157 | ||
@@ -219,7 +219,6 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
219 | info->prefix_node = region_obj2->extra.method_REG; | 219 | info->prefix_node = region_obj2->extra.method_REG; |
220 | info->pathname = NULL; | 220 | info->pathname = NULL; |
221 | info->parameters = args; | 221 | info->parameters = args; |
222 | info->parameter_type = ACPI_PARAM_ARGS; | ||
223 | info->flags = ACPI_IGNORE_RETURN_VALUE; | 222 | info->flags = ACPI_IGNORE_RETURN_VALUE; |
224 | 223 | ||
225 | /* | 224 | /* |
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index 2e3d2c5e4f4d..6b94b38df07d 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c | |||
@@ -380,7 +380,7 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) | |||
380 | acpi_status status; | 380 | acpi_status status; |
381 | struct acpica_device_id hid; | 381 | struct acpica_device_id hid; |
382 | struct acpi_compatible_id_list *cid; | 382 | struct acpi_compatible_id_list *cid; |
383 | acpi_native_uint i; | 383 | u32 i; |
384 | 384 | ||
385 | /* | 385 | /* |
386 | * Get the _HID and check for a PCI Root Bridge | 386 | * Get the _HID and check for a PCI Root Bridge |
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index 99a7502e6a87..73bfd6bf962f 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
@@ -472,7 +472,6 @@ acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
472 | } | 472 | } |
473 | 473 | ||
474 | ACPI_EXPORT_SYMBOL(acpi_clear_gpe) | 474 | ACPI_EXPORT_SYMBOL(acpi_clear_gpe) |
475 | #ifdef ACPI_FUTURE_USAGE | ||
476 | /******************************************************************************* | 475 | /******************************************************************************* |
477 | * | 476 | * |
478 | * FUNCTION: acpi_get_event_status | 477 | * FUNCTION: acpi_get_event_status |
@@ -489,6 +488,7 @@ ACPI_EXPORT_SYMBOL(acpi_clear_gpe) | |||
489 | acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) | 488 | acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) |
490 | { | 489 | { |
491 | acpi_status status = AE_OK; | 490 | acpi_status status = AE_OK; |
491 | u32 value; | ||
492 | 492 | ||
493 | ACPI_FUNCTION_TRACE(acpi_get_event_status); | 493 | ACPI_FUNCTION_TRACE(acpi_get_event_status); |
494 | 494 | ||
@@ -506,7 +506,20 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) | |||
506 | 506 | ||
507 | status = | 507 | status = |
508 | acpi_get_register(acpi_gbl_fixed_event_info[event]. | 508 | acpi_get_register(acpi_gbl_fixed_event_info[event]. |
509 | status_register_id, event_status); | 509 | enable_register_id, &value); |
510 | if (ACPI_FAILURE(status)) | ||
511 | return_ACPI_STATUS(status); | ||
512 | |||
513 | *event_status = value; | ||
514 | |||
515 | status = | ||
516 | acpi_get_register(acpi_gbl_fixed_event_info[event]. | ||
517 | status_register_id, &value); | ||
518 | if (ACPI_FAILURE(status)) | ||
519 | return_ACPI_STATUS(status); | ||
520 | |||
521 | if (value) | ||
522 | *event_status |= ACPI_EVENT_FLAG_SET; | ||
510 | 523 | ||
511 | return_ACPI_STATUS(status); | 524 | return_ACPI_STATUS(status); |
512 | } | 525 | } |
@@ -566,7 +579,6 @@ acpi_get_gpe_status(acpi_handle gpe_device, | |||
566 | } | 579 | } |
567 | 580 | ||
568 | ACPI_EXPORT_SYMBOL(acpi_get_gpe_status) | 581 | ACPI_EXPORT_SYMBOL(acpi_get_gpe_status) |
569 | #endif /* ACPI_FUTURE_USAGE */ | ||
570 | /******************************************************************************* | 582 | /******************************************************************************* |
571 | * | 583 | * |
572 | * FUNCTION: acpi_install_gpe_block | 584 | * FUNCTION: acpi_install_gpe_block |
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 39d742190584..2a32c843cb4a 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -53,7 +53,7 @@ ACPI_MODULE_NAME("exconfig") | |||
53 | 53 | ||
54 | /* Local prototypes */ | 54 | /* Local prototypes */ |
55 | static acpi_status | 55 | static acpi_status |
56 | acpi_ex_add_table(acpi_native_uint table_index, | 56 | acpi_ex_add_table(u32 table_index, |
57 | struct acpi_namespace_node *parent_node, | 57 | struct acpi_namespace_node *parent_node, |
58 | union acpi_operand_object **ddb_handle); | 58 | union acpi_operand_object **ddb_handle); |
59 | 59 | ||
@@ -73,7 +73,7 @@ acpi_ex_add_table(acpi_native_uint table_index, | |||
73 | ******************************************************************************/ | 73 | ******************************************************************************/ |
74 | 74 | ||
75 | static acpi_status | 75 | static acpi_status |
76 | acpi_ex_add_table(acpi_native_uint table_index, | 76 | acpi_ex_add_table(u32 table_index, |
77 | struct acpi_namespace_node *parent_node, | 77 | struct acpi_namespace_node *parent_node, |
78 | union acpi_operand_object **ddb_handle) | 78 | union acpi_operand_object **ddb_handle) |
79 | { | 79 | { |
@@ -96,7 +96,8 @@ acpi_ex_add_table(acpi_native_uint table_index, | |||
96 | 96 | ||
97 | /* Install the new table into the local data structures */ | 97 | /* Install the new table into the local data structures */ |
98 | 98 | ||
99 | obj_desc->reference.object = ACPI_CAST_PTR(void, table_index); | 99 | obj_desc->reference.object = ACPI_CAST_PTR(void, |
100 | (unsigned long)table_index); | ||
100 | 101 | ||
101 | /* Add the table to the namespace */ | 102 | /* Add the table to the namespace */ |
102 | 103 | ||
@@ -128,12 +129,12 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
128 | { | 129 | { |
129 | acpi_status status; | 130 | acpi_status status; |
130 | union acpi_operand_object **operand = &walk_state->operands[0]; | 131 | union acpi_operand_object **operand = &walk_state->operands[0]; |
131 | acpi_native_uint table_index; | ||
132 | struct acpi_namespace_node *parent_node; | 132 | struct acpi_namespace_node *parent_node; |
133 | struct acpi_namespace_node *start_node; | 133 | struct acpi_namespace_node *start_node; |
134 | struct acpi_namespace_node *parameter_node = NULL; | 134 | struct acpi_namespace_node *parameter_node = NULL; |
135 | union acpi_operand_object *ddb_handle; | 135 | union acpi_operand_object *ddb_handle; |
136 | struct acpi_table_header *table; | 136 | struct acpi_table_header *table; |
137 | u32 table_index; | ||
137 | 138 | ||
138 | ACPI_FUNCTION_TRACE(ex_load_table_op); | 139 | ACPI_FUNCTION_TRACE(ex_load_table_op); |
139 | 140 | ||
@@ -280,7 +281,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
280 | { | 281 | { |
281 | union acpi_operand_object *ddb_handle; | 282 | union acpi_operand_object *ddb_handle; |
282 | struct acpi_table_desc table_desc; | 283 | struct acpi_table_desc table_desc; |
283 | acpi_native_uint table_index; | 284 | u32 table_index; |
284 | acpi_status status; | 285 | acpi_status status; |
285 | u32 length; | 286 | u32 length; |
286 | 287 | ||
@@ -437,7 +438,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
437 | { | 438 | { |
438 | acpi_status status = AE_OK; | 439 | acpi_status status = AE_OK; |
439 | union acpi_operand_object *table_desc = ddb_handle; | 440 | union acpi_operand_object *table_desc = ddb_handle; |
440 | acpi_native_uint table_index; | 441 | u32 table_index; |
441 | struct acpi_table_header *table; | 442 | struct acpi_table_header *table; |
442 | 443 | ||
443 | ACPI_FUNCTION_TRACE(ex_unload_table); | 444 | ACPI_FUNCTION_TRACE(ex_unload_table); |
@@ -454,9 +455,9 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
454 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 455 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
455 | } | 456 | } |
456 | 457 | ||
457 | /* Get the table index from the ddb_handle */ | 458 | /* Get the table index from the ddb_handle (acpi_size for 64-bit case) */ |
458 | 459 | ||
459 | table_index = (acpi_native_uint) table_desc->reference.object; | 460 | table_index = (u32) (acpi_size) table_desc->reference.object; |
460 | 461 | ||
461 | /* Invoke table handler if present */ | 462 | /* Invoke table handler if present */ |
462 | 463 | ||
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index fd954b4ed83d..261d97516d9b 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -288,11 +288,11 @@ acpi_ex_convert_to_ascii(acpi_integer integer, | |||
288 | u16 base, u8 * string, u8 data_width) | 288 | u16 base, u8 * string, u8 data_width) |
289 | { | 289 | { |
290 | acpi_integer digit; | 290 | acpi_integer digit; |
291 | acpi_native_uint i; | 291 | u32 i; |
292 | acpi_native_uint j; | 292 | u32 j; |
293 | acpi_native_uint k = 0; | 293 | u32 k = 0; |
294 | acpi_native_uint hex_length; | 294 | u32 hex_length; |
295 | acpi_native_uint decimal_length; | 295 | u32 decimal_length; |
296 | u32 remainder; | 296 | u32 remainder; |
297 | u8 supress_zeros; | 297 | u8 supress_zeros; |
298 | 298 | ||
@@ -348,7 +348,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer, | |||
348 | 348 | ||
349 | /* hex_length: 2 ascii hex chars per data byte */ | 349 | /* hex_length: 2 ascii hex chars per data byte */ |
350 | 350 | ||
351 | hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); | 351 | hex_length = ACPI_MUL_2(data_width); |
352 | for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { | 352 | for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { |
353 | 353 | ||
354 | /* Get one hex digit, most significant digits first */ | 354 | /* Get one hex digit, most significant digits first */ |
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 60e62c4f0577..ad09696d5069 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
@@ -45,8 +45,6 @@ | |||
45 | #include <acpi/acinterp.h> | 45 | #include <acpi/acinterp.h> |
46 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
47 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
48 | #include <acpi/acevents.h> | ||
49 | #include <acpi/actables.h> | ||
50 | 48 | ||
51 | #define _COMPONENT ACPI_EXECUTER | 49 | #define _COMPONENT ACPI_EXECUTER |
52 | ACPI_MODULE_NAME("excreate") | 50 | ACPI_MODULE_NAME("excreate") |
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 74f1b22601b3..2be2e2bf95bf 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -580,25 +580,22 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
580 | 580 | ||
581 | case ACPI_TYPE_BUFFER: | 581 | case ACPI_TYPE_BUFFER: |
582 | 582 | ||
583 | acpi_os_printf("Buffer len %X @ %p\n", | 583 | acpi_os_printf("Buffer length %.2X @ %p\n", |
584 | obj_desc->buffer.length, | 584 | obj_desc->buffer.length, |
585 | obj_desc->buffer.pointer); | 585 | obj_desc->buffer.pointer); |
586 | 586 | ||
587 | length = obj_desc->buffer.length; | ||
588 | if (length > 64) { | ||
589 | length = 64; | ||
590 | } | ||
591 | |||
592 | /* Debug only -- dump the buffer contents */ | 587 | /* Debug only -- dump the buffer contents */ |
593 | 588 | ||
594 | if (obj_desc->buffer.pointer) { | 589 | if (obj_desc->buffer.pointer) { |
595 | acpi_os_printf("Buffer Contents: "); | 590 | length = obj_desc->buffer.length; |
596 | 591 | if (length > 128) { | |
597 | for (index = 0; index < length; index++) { | 592 | length = 128; |
598 | acpi_os_printf(" %02x", | ||
599 | obj_desc->buffer.pointer[index]); | ||
600 | } | 593 | } |
601 | acpi_os_printf("\n"); | 594 | |
595 | acpi_os_printf | ||
596 | ("Buffer Contents: (displaying length 0x%.2X)\n", | ||
597 | length); | ||
598 | ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, length); | ||
602 | } | 599 | } |
603 | break; | 600 | break; |
604 | 601 | ||
@@ -756,54 +753,42 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
756 | * | 753 | * |
757 | * FUNCTION: acpi_ex_dump_operands | 754 | * FUNCTION: acpi_ex_dump_operands |
758 | * | 755 | * |
759 | * PARAMETERS: Operands - Operand list | 756 | * PARAMETERS: Operands - A list of Operand objects |
760 | * interpreter_mode - Load or Exec | 757 | * opcode_name - AML opcode name |
761 | * Ident - Identification | 758 | * num_operands - Operand count for this opcode |
762 | * num_levels - # of stack entries to dump above line | ||
763 | * Note - Output notation | ||
764 | * module_name - Caller's module name | ||
765 | * line_number - Caller's invocation line number | ||
766 | * | 759 | * |
767 | * DESCRIPTION: Dump the object stack | 760 | * DESCRIPTION: Dump the operands associated with the opcode |
768 | * | 761 | * |
769 | ******************************************************************************/ | 762 | ******************************************************************************/ |
770 | 763 | ||
771 | void | 764 | void |
772 | acpi_ex_dump_operands(union acpi_operand_object **operands, | 765 | acpi_ex_dump_operands(union acpi_operand_object **operands, |
773 | acpi_interpreter_mode interpreter_mode, | 766 | const char *opcode_name, u32 num_operands) |
774 | char *ident, | ||
775 | u32 num_levels, | ||
776 | char *note, char *module_name, u32 line_number) | ||
777 | { | 767 | { |
778 | acpi_native_uint i; | ||
779 | |||
780 | ACPI_FUNCTION_NAME(ex_dump_operands); | 768 | ACPI_FUNCTION_NAME(ex_dump_operands); |
781 | 769 | ||
782 | if (!ident) { | 770 | if (!opcode_name) { |
783 | ident = "?"; | 771 | opcode_name = "UNKNOWN"; |
784 | } | ||
785 | |||
786 | if (!note) { | ||
787 | note = "?"; | ||
788 | } | 772 | } |
789 | 773 | ||
790 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 774 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
791 | "************* Operand Stack Contents (Opcode [%s], %d Operands)\n", | 775 | "**** Start operand dump for opcode [%s], %d operands\n", |
792 | ident, num_levels)); | 776 | opcode_name, num_operands)); |
793 | 777 | ||
794 | if (num_levels == 0) { | 778 | if (num_operands == 0) { |
795 | num_levels = 1; | 779 | num_operands = 1; |
796 | } | 780 | } |
797 | 781 | ||
798 | /* Dump the operand stack starting at the top */ | 782 | /* Dump the individual operands */ |
799 | 783 | ||
800 | for (i = 0; num_levels > 0; i--, num_levels--) { | 784 | while (num_operands) { |
801 | acpi_ex_dump_operand(operands[i], 0); | 785 | acpi_ex_dump_operand(*operands, 0); |
786 | operands++; | ||
787 | num_operands--; | ||
802 | } | 788 | } |
803 | 789 | ||
804 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 790 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
805 | "************* Operand Stack dump from %s(%d), %s\n", | 791 | "**** End operand dump for [%s]\n", opcode_name)); |
806 | module_name, line_number, note)); | ||
807 | return; | 792 | return; |
808 | } | 793 | } |
809 | 794 | ||
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index e336b5dc7a50..9ff9d1f4615d 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c | |||
@@ -153,14 +153,15 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
153 | /* | 153 | /* |
154 | * Slack mode only: We will go ahead and allow access to this | 154 | * Slack mode only: We will go ahead and allow access to this |
155 | * field if it is within the region length rounded up to the next | 155 | * field if it is within the region length rounded up to the next |
156 | * access width boundary. | 156 | * access width boundary. acpi_size cast for 64-bit compile. |
157 | */ | 157 | */ |
158 | if (ACPI_ROUND_UP(rgn_desc->region.length, | 158 | if (ACPI_ROUND_UP(rgn_desc->region.length, |
159 | obj_desc->common_field. | 159 | obj_desc->common_field. |
160 | access_byte_width) >= | 160 | access_byte_width) >= |
161 | (obj_desc->common_field.base_byte_offset + | 161 | ((acpi_size) obj_desc->common_field. |
162 | (acpi_native_uint) obj_desc->common_field. | 162 | base_byte_offset + |
163 | access_byte_width + field_datum_byte_offset)) { | 163 | obj_desc->common_field.access_byte_width + |
164 | field_datum_byte_offset)) { | ||
164 | return_ACPI_STATUS(AE_OK); | 165 | return_ACPI_STATUS(AE_OK); |
165 | } | 166 | } |
166 | } | 167 | } |
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index cc956a5b5267..731414a581a6 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -329,8 +329,8 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
329 | 329 | ||
330 | /* Result of two Strings is a String */ | 330 | /* Result of two Strings is a String */ |
331 | 331 | ||
332 | return_desc = acpi_ut_create_string_object((acpi_size) | 332 | return_desc = acpi_ut_create_string_object(((acpi_size) |
333 | (operand0->string. | 333 | operand0->string. |
334 | length + | 334 | length + |
335 | local_operand1-> | 335 | local_operand1-> |
336 | string.length)); | 336 | string.length)); |
@@ -352,8 +352,8 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
352 | 352 | ||
353 | /* Result of two Buffers is a Buffer */ | 353 | /* Result of two Buffers is a Buffer */ |
354 | 354 | ||
355 | return_desc = acpi_ut_create_buffer_object((acpi_size) | 355 | return_desc = acpi_ut_create_buffer_object(((acpi_size) |
356 | (operand0->buffer. | 356 | operand0->buffer. |
357 | length + | 357 | length + |
358 | local_operand1-> | 358 | local_operand1-> |
359 | buffer.length)); | 359 | buffer.length)); |
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index 3a2f8cd4c62a..5d438c32989d 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c | |||
@@ -503,11 +503,11 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
503 | */ | 503 | */ |
504 | second_desc = obj_desc->common.next_object; | 504 | second_desc = obj_desc->common.next_object; |
505 | second_desc->extra.aml_start = | 505 | second_desc->extra.aml_start = |
506 | ((union acpi_parse_object *)(info->data_register_node))-> | 506 | ACPI_CAST_PTR(union acpi_parse_object, |
507 | named.data; | 507 | info->data_register_node)->named.data; |
508 | second_desc->extra.aml_length = | 508 | second_desc->extra.aml_length = |
509 | ((union acpi_parse_object *)(info->data_register_node))-> | 509 | ACPI_CAST_PTR(union acpi_parse_object, |
510 | named.length; | 510 | info->data_register_node)->named.length; |
511 | 511 | ||
512 | break; | 512 | break; |
513 | 513 | ||
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 7cd8bb54fa01..7a41c409ae4d 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c | |||
@@ -156,7 +156,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
156 | /* Create a new mapping starting at the address given */ | 156 | /* Create a new mapping starting at the address given */ |
157 | 157 | ||
158 | mem_info->mapped_logical_address = | 158 | mem_info->mapped_logical_address = |
159 | acpi_os_map_memory((acpi_native_uint) address, window_size); | 159 | acpi_os_map_memory((acpi_physical_address) address, window_size); |
160 | if (!mem_info->mapped_logical_address) { | 160 | if (!mem_info->mapped_logical_address) { |
161 | ACPI_ERROR((AE_INFO, | 161 | ACPI_ERROR((AE_INFO, |
162 | "Could not map memory at %8.8X%8.8X, size %X", | 162 | "Could not map memory at %8.8X%8.8X, size %X", |
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index 73e29e566a70..54085f16ec28 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c | |||
@@ -698,5 +698,9 @@ acpi_ex_resolve_operands(u16 opcode, | |||
698 | } | 698 | } |
699 | } | 699 | } |
700 | 700 | ||
701 | ACPI_DUMP_OPERANDS(walk_state->operands, | ||
702 | acpi_ps_get_opcode_name(opcode), | ||
703 | walk_state->num_operands); | ||
704 | |||
701 | return_ACPI_STATUS(status); | 705 | return_ACPI_STATUS(status); |
702 | } | 706 | } |
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index 76c875bc3154..38b55e352495 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c | |||
@@ -343,12 +343,6 @@ acpi_ex_store(union acpi_operand_object *source_desc, | |||
343 | acpi_ut_get_object_type_name(dest_desc), | 343 | acpi_ut_get_object_type_name(dest_desc), |
344 | dest_desc)); | 344 | dest_desc)); |
345 | 345 | ||
346 | ACPI_DUMP_STACK_ENTRY(source_desc); | ||
347 | ACPI_DUMP_STACK_ENTRY(dest_desc); | ||
348 | ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ExStore", | ||
349 | 2, | ||
350 | "Target is not a Reference or Constant object"); | ||
351 | |||
352 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | 346 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
353 | } | 347 | } |
354 | 348 | ||
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 6cf10cbc1eee..55c17afbe669 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -148,7 +148,7 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, | |||
148 | int result = 0; | 148 | int result = 0; |
149 | struct seq_file *m = file->private_data; | 149 | struct seq_file *m = file->private_data; |
150 | struct acpi_device *device = m->private; | 150 | struct acpi_device *device = m->private; |
151 | char state_string[12] = { '\0' }; | 151 | char state_string[3] = { '\0' }; |
152 | 152 | ||
153 | if (count > sizeof(state_string) - 1) | 153 | if (count > sizeof(state_string) - 1) |
154 | return -EINVAL; | 154 | return -EINVAL; |
@@ -157,6 +157,12 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, | |||
157 | return -EFAULT; | 157 | return -EFAULT; |
158 | 158 | ||
159 | state_string[count] = '\0'; | 159 | state_string[count] = '\0'; |
160 | if ((state_string[0] < '0') || (state_string[0] > '3')) | ||
161 | return -EINVAL; | ||
162 | if (state_string[1] == '\n') | ||
163 | state_string[1] = '\0'; | ||
164 | if (state_string[1] != '\0') | ||
165 | return -EINVAL; | ||
160 | 166 | ||
161 | result = acpi_bus_set_power(device->handle, | 167 | result = acpi_bus_set_power(device->handle, |
162 | simple_strtoul(state_string, NULL, 0)); | 168 | simple_strtoul(state_string, NULL, 0)); |
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 9b227d4dc9c9..0f2dd81736bd 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -166,6 +166,8 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
166 | "firmware_node"); | 166 | "firmware_node"); |
167 | ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, | 167 | ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, |
168 | "physical_node"); | 168 | "physical_node"); |
169 | if (acpi_dev->wakeup.flags.valid) | ||
170 | device_set_wakeup_capable(dev, true); | ||
169 | } | 171 | } |
170 | 172 | ||
171 | return 0; | 173 | return 0; |
@@ -336,6 +338,9 @@ static int __init acpi_rtc_init(void) | |||
336 | if (acpi_disabled) | 338 | if (acpi_disabled) |
337 | return 0; | 339 | return 0; |
338 | 340 | ||
341 | if (acpi_disabled) | ||
342 | return 0; | ||
343 | |||
339 | if (dev) { | 344 | if (dev) { |
340 | rtc_wake_setup(); | 345 | rtc_wake_setup(); |
341 | rtc_info.wake_on = rtc_wake_on; | 346 | rtc_info.wake_on = rtc_wake_on; |
diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c index 14bc4f456ae8..0b80db9d9197 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/hardware/hwgpe.c | |||
@@ -55,6 +55,54 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
55 | 55 | ||
56 | /****************************************************************************** | 56 | /****************************************************************************** |
57 | * | 57 | * |
58 | * FUNCTION: acpi_hw_low_disable_gpe | ||
59 | * | ||
60 | * PARAMETERS: gpe_event_info - Info block for the GPE to be disabled | ||
61 | * | ||
62 | * RETURN: Status | ||
63 | * | ||
64 | * DESCRIPTION: Disable a single GPE in the enable register. | ||
65 | * | ||
66 | ******************************************************************************/ | ||
67 | |||
68 | acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
69 | { | ||
70 | struct acpi_gpe_register_info *gpe_register_info; | ||
71 | acpi_status status; | ||
72 | u32 enable_mask; | ||
73 | |||
74 | /* Get the info block for the entire GPE register */ | ||
75 | |||
76 | gpe_register_info = gpe_event_info->register_info; | ||
77 | if (!gpe_register_info) { | ||
78 | return (AE_NOT_EXIST); | ||
79 | } | ||
80 | |||
81 | /* Get current value of the enable register that contains this GPE */ | ||
82 | |||
83 | status = acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH, &enable_mask, | ||
84 | &gpe_register_info->enable_address); | ||
85 | if (ACPI_FAILURE(status)) { | ||
86 | return (status); | ||
87 | } | ||
88 | |||
89 | /* Clear just the bit that corresponds to this GPE */ | ||
90 | |||
91 | ACPI_CLEAR_BIT(enable_mask, | ||
92 | ((u32) 1 << | ||
93 | (gpe_event_info->gpe_number - | ||
94 | gpe_register_info->base_gpe_number))); | ||
95 | |||
96 | /* Write the updated enable mask */ | ||
97 | |||
98 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, enable_mask, | ||
99 | &gpe_register_info->enable_address); | ||
100 | |||
101 | return (status); | ||
102 | } | ||
103 | |||
104 | /****************************************************************************** | ||
105 | * | ||
58 | * FUNCTION: acpi_hw_write_gpe_enable_reg | 106 | * FUNCTION: acpi_hw_write_gpe_enable_reg |
59 | * | 107 | * |
60 | * PARAMETERS: gpe_event_info - Info block for the GPE to be enabled | 108 | * PARAMETERS: gpe_event_info - Info block for the GPE to be enabled |
@@ -68,7 +116,7 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
68 | ******************************************************************************/ | 116 | ******************************************************************************/ |
69 | 117 | ||
70 | acpi_status | 118 | acpi_status |
71 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info) | 119 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) |
72 | { | 120 | { |
73 | struct acpi_gpe_register_info *gpe_register_info; | 121 | struct acpi_gpe_register_info *gpe_register_info; |
74 | acpi_status status; | 122 | acpi_status status; |
@@ -138,7 +186,6 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) | |||
138 | * | 186 | * |
139 | ******************************************************************************/ | 187 | ******************************************************************************/ |
140 | 188 | ||
141 | #ifdef ACPI_FUTURE_USAGE | ||
142 | acpi_status | 189 | acpi_status |
143 | acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | 190 | acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, |
144 | acpi_event_status * event_status) | 191 | acpi_event_status * event_status) |
@@ -198,7 +245,6 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
198 | unlock_and_exit: | 245 | unlock_and_exit: |
199 | return (status); | 246 | return (status); |
200 | } | 247 | } |
201 | #endif /* ACPI_FUTURE_USAGE */ | ||
202 | 248 | ||
203 | /****************************************************************************** | 249 | /****************************************************************************** |
204 | * | 250 | * |
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 5445751b8a3e..0ab22004728a 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c | |||
@@ -73,7 +73,7 @@ acpi_ns_dump_one_device(acpi_handle obj_handle, | |||
73 | 73 | ||
74 | void acpi_ns_print_pathname(u32 num_segments, char *pathname) | 74 | void acpi_ns_print_pathname(u32 num_segments, char *pathname) |
75 | { | 75 | { |
76 | acpi_native_uint i; | 76 | u32 i; |
77 | 77 | ||
78 | ACPI_FUNCTION_NAME(ns_print_pathname); | 78 | ACPI_FUNCTION_NAME(ns_print_pathname); |
79 | 79 | ||
@@ -515,12 +515,12 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
515 | 515 | ||
516 | if (obj_type > ACPI_TYPE_LOCAL_MAX) { | 516 | if (obj_type > ACPI_TYPE_LOCAL_MAX) { |
517 | acpi_os_printf | 517 | acpi_os_printf |
518 | ("(Ptr to ACPI Object type %X [UNKNOWN])\n", | 518 | ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n", |
519 | obj_type); | 519 | obj_type); |
520 | bytes_to_dump = 32; | 520 | bytes_to_dump = 32; |
521 | } else { | 521 | } else { |
522 | acpi_os_printf | 522 | acpi_os_printf |
523 | ("(Ptr to ACPI Object type %X [%s])\n", | 523 | ("(Pointer to ACPI Object type %.2X [%s])\n", |
524 | obj_type, acpi_ut_get_type_name(obj_type)); | 524 | obj_type, acpi_ut_get_type_name(obj_type)); |
525 | bytes_to_dump = | 525 | bytes_to_dump = |
526 | sizeof(union acpi_operand_object); | 526 | sizeof(union acpi_operand_object); |
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 14bdfa92bea0..d369164e00b0 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c | |||
@@ -138,6 +138,41 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) | |||
138 | return_ACPI_STATUS(AE_NULL_OBJECT); | 138 | return_ACPI_STATUS(AE_NULL_OBJECT); |
139 | } | 139 | } |
140 | 140 | ||
141 | /* | ||
142 | * Calculate the number of arguments being passed to the method | ||
143 | */ | ||
144 | |||
145 | info->param_count = 0; | ||
146 | if (info->parameters) { | ||
147 | while (info->parameters[info->param_count]) | ||
148 | info->param_count++; | ||
149 | } | ||
150 | |||
151 | /* Error if too few arguments were passed in */ | ||
152 | |||
153 | if (info->param_count < info->obj_desc->method.param_count) { | ||
154 | ACPI_ERROR((AE_INFO, | ||
155 | "Insufficient arguments - " | ||
156 | "method [%4.4s] needs %d, found %d", | ||
157 | acpi_ut_get_node_name(info->resolved_node), | ||
158 | info->obj_desc->method.param_count, | ||
159 | info->param_count)); | ||
160 | return_ACPI_STATUS(AE_MISSING_ARGUMENTS); | ||
161 | } | ||
162 | |||
163 | /* Just a warning if too many arguments */ | ||
164 | |||
165 | else if (info->param_count > | ||
166 | info->obj_desc->method.param_count) { | ||
167 | ACPI_WARNING((AE_INFO, | ||
168 | "Excess arguments - " | ||
169 | "method [%4.4s] needs %d, found %d", | ||
170 | acpi_ut_get_node_name(info-> | ||
171 | resolved_node), | ||
172 | info->obj_desc->method.param_count, | ||
173 | info->param_count)); | ||
174 | } | ||
175 | |||
141 | ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:", | 176 | ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:", |
142 | ACPI_LV_INFO, _COMPONENT); | 177 | ACPI_LV_INFO, _COMPONENT); |
143 | 178 | ||
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 6d6d930c8e18..e4c57510d798 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -542,7 +542,6 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
542 | info->prefix_node = device_node; | 542 | info->prefix_node = device_node; |
543 | info->pathname = METHOD_NAME__INI; | 543 | info->pathname = METHOD_NAME__INI; |
544 | info->parameters = NULL; | 544 | info->parameters = NULL; |
545 | info->parameter_type = ACPI_PARAM_ARGS; | ||
546 | info->flags = ACPI_IGNORE_RETURN_VALUE; | 545 | info->flags = ACPI_IGNORE_RETURN_VALUE; |
547 | 546 | ||
548 | /* | 547 | /* |
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 2c92f6cf5ce1..a4a412b7c029 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c | |||
@@ -71,8 +71,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle); | |||
71 | ******************************************************************************/ | 71 | ******************************************************************************/ |
72 | 72 | ||
73 | acpi_status | 73 | acpi_status |
74 | acpi_ns_load_table(acpi_native_uint table_index, | 74 | acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node) |
75 | struct acpi_namespace_node *node) | ||
76 | { | 75 | { |
77 | acpi_status status; | 76 | acpi_status status; |
78 | 77 | ||
diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index 46a79b0103b6..a82271a9dbb3 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c | |||
@@ -63,13 +63,13 @@ ACPI_MODULE_NAME("nsparse") | |||
63 | * | 63 | * |
64 | ******************************************************************************/ | 64 | ******************************************************************************/ |
65 | acpi_status | 65 | acpi_status |
66 | acpi_ns_one_complete_parse(acpi_native_uint pass_number, | 66 | acpi_ns_one_complete_parse(u32 pass_number, |
67 | acpi_native_uint table_index, | 67 | u32 table_index, |
68 | struct acpi_namespace_node * start_node) | 68 | struct acpi_namespace_node *start_node) |
69 | { | 69 | { |
70 | union acpi_parse_object *parse_root; | 70 | union acpi_parse_object *parse_root; |
71 | acpi_status status; | 71 | acpi_status status; |
72 | acpi_native_uint aml_length; | 72 | u32 aml_length; |
73 | u8 *aml_start; | 73 | u8 *aml_start; |
74 | struct acpi_walk_state *walk_state; | 74 | struct acpi_walk_state *walk_state; |
75 | struct acpi_table_header *table; | 75 | struct acpi_table_header *table; |
@@ -112,8 +112,8 @@ acpi_ns_one_complete_parse(acpi_native_uint pass_number, | |||
112 | aml_start = (u8 *) table + sizeof(struct acpi_table_header); | 112 | aml_start = (u8 *) table + sizeof(struct acpi_table_header); |
113 | aml_length = table->length - sizeof(struct acpi_table_header); | 113 | aml_length = table->length - sizeof(struct acpi_table_header); |
114 | status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL, | 114 | status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL, |
115 | aml_start, (u32) aml_length, | 115 | aml_start, aml_length, NULL, |
116 | NULL, (u8) pass_number); | 116 | (u8) pass_number); |
117 | } | 117 | } |
118 | 118 | ||
119 | if (ACPI_FAILURE(status)) { | 119 | if (ACPI_FAILURE(status)) { |
@@ -158,8 +158,7 @@ acpi_ns_one_complete_parse(acpi_native_uint pass_number, | |||
158 | ******************************************************************************/ | 158 | ******************************************************************************/ |
159 | 159 | ||
160 | acpi_status | 160 | acpi_status |
161 | acpi_ns_parse_table(acpi_native_uint table_index, | 161 | acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node) |
162 | struct acpi_namespace_node *start_node) | ||
163 | { | 162 | { |
164 | acpi_status status; | 163 | acpi_status status; |
165 | 164 | ||
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index 64c039843ed2..b0817e1127b1 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c | |||
@@ -73,9 +73,9 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); | |||
73 | ******************************************************************************/ | 73 | ******************************************************************************/ |
74 | 74 | ||
75 | void | 75 | void |
76 | acpi_ns_report_error(char *module_name, | 76 | acpi_ns_report_error(const char *module_name, |
77 | u32 line_number, | 77 | u32 line_number, |
78 | char *internal_name, acpi_status lookup_status) | 78 | const char *internal_name, acpi_status lookup_status) |
79 | { | 79 | { |
80 | acpi_status status; | 80 | acpi_status status; |
81 | u32 bad_name; | 81 | u32 bad_name; |
@@ -130,11 +130,11 @@ acpi_ns_report_error(char *module_name, | |||
130 | ******************************************************************************/ | 130 | ******************************************************************************/ |
131 | 131 | ||
132 | void | 132 | void |
133 | acpi_ns_report_method_error(char *module_name, | 133 | acpi_ns_report_method_error(const char *module_name, |
134 | u32 line_number, | 134 | u32 line_number, |
135 | char *message, | 135 | const char *message, |
136 | struct acpi_namespace_node *prefix_node, | 136 | struct acpi_namespace_node *prefix_node, |
137 | char *path, acpi_status method_status) | 137 | const char *path, acpi_status method_status) |
138 | { | 138 | { |
139 | acpi_status status; | 139 | acpi_status status; |
140 | struct acpi_namespace_node *node = prefix_node; | 140 | struct acpi_namespace_node *node = prefix_node; |
@@ -167,7 +167,8 @@ acpi_ns_report_method_error(char *module_name, | |||
167 | ******************************************************************************/ | 167 | ******************************************************************************/ |
168 | 168 | ||
169 | void | 169 | void |
170 | acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message) | 170 | acpi_ns_print_node_pathname(struct acpi_namespace_node *node, |
171 | const char *message) | ||
171 | { | 172 | { |
172 | struct acpi_buffer buffer; | 173 | struct acpi_buffer buffer; |
173 | acpi_status status; | 174 | acpi_status status; |
@@ -296,7 +297,7 @@ u32 acpi_ns_local(acpi_object_type type) | |||
296 | 297 | ||
297 | void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info) | 298 | void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info) |
298 | { | 299 | { |
299 | char *next_external_char; | 300 | const char *next_external_char; |
300 | u32 i; | 301 | u32 i; |
301 | 302 | ||
302 | ACPI_FUNCTION_ENTRY(); | 303 | ACPI_FUNCTION_ENTRY(); |
@@ -363,9 +364,9 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
363 | { | 364 | { |
364 | u32 num_segments = info->num_segments; | 365 | u32 num_segments = info->num_segments; |
365 | char *internal_name = info->internal_name; | 366 | char *internal_name = info->internal_name; |
366 | char *external_name = info->next_external_char; | 367 | const char *external_name = info->next_external_char; |
367 | char *result = NULL; | 368 | char *result = NULL; |
368 | acpi_native_uint i; | 369 | u32 i; |
369 | 370 | ||
370 | ACPI_FUNCTION_TRACE(ns_build_internal_name); | 371 | ACPI_FUNCTION_TRACE(ns_build_internal_name); |
371 | 372 | ||
@@ -400,12 +401,11 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
400 | result = &internal_name[i]; | 401 | result = &internal_name[i]; |
401 | } else if (num_segments == 2) { | 402 | } else if (num_segments == 2) { |
402 | internal_name[i] = AML_DUAL_NAME_PREFIX; | 403 | internal_name[i] = AML_DUAL_NAME_PREFIX; |
403 | result = &internal_name[(acpi_native_uint) (i + 1)]; | 404 | result = &internal_name[(acpi_size) i + 1]; |
404 | } else { | 405 | } else { |
405 | internal_name[i] = AML_MULTI_NAME_PREFIX_OP; | 406 | internal_name[i] = AML_MULTI_NAME_PREFIX_OP; |
406 | internal_name[(acpi_native_uint) (i + 1)] = | 407 | internal_name[(acpi_size) i + 1] = (char)num_segments; |
407 | (char)num_segments; | 408 | result = &internal_name[(acpi_size) i + 2]; |
408 | result = &internal_name[(acpi_native_uint) (i + 2)]; | ||
409 | } | 409 | } |
410 | } | 410 | } |
411 | 411 | ||
@@ -472,7 +472,8 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
472 | * | 472 | * |
473 | *******************************************************************************/ | 473 | *******************************************************************************/ |
474 | 474 | ||
475 | acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) | 475 | acpi_status |
476 | acpi_ns_internalize_name(const char *external_name, char **converted_name) | ||
476 | { | 477 | { |
477 | char *internal_name; | 478 | char *internal_name; |
478 | struct acpi_namestring_info info; | 479 | struct acpi_namestring_info info; |
@@ -528,15 +529,15 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) | |||
528 | 529 | ||
529 | acpi_status | 530 | acpi_status |
530 | acpi_ns_externalize_name(u32 internal_name_length, | 531 | acpi_ns_externalize_name(u32 internal_name_length, |
531 | char *internal_name, | 532 | const char *internal_name, |
532 | u32 * converted_name_length, char **converted_name) | 533 | u32 * converted_name_length, char **converted_name) |
533 | { | 534 | { |
534 | acpi_native_uint names_index = 0; | 535 | u32 names_index = 0; |
535 | acpi_native_uint num_segments = 0; | 536 | u32 num_segments = 0; |
536 | acpi_native_uint required_length; | 537 | u32 required_length; |
537 | acpi_native_uint prefix_length = 0; | 538 | u32 prefix_length = 0; |
538 | acpi_native_uint i = 0; | 539 | u32 i = 0; |
539 | acpi_native_uint j = 0; | 540 | u32 j = 0; |
540 | 541 | ||
541 | ACPI_FUNCTION_TRACE(ns_externalize_name); | 542 | ACPI_FUNCTION_TRACE(ns_externalize_name); |
542 | 543 | ||
@@ -582,9 +583,8 @@ acpi_ns_externalize_name(u32 internal_name_length, | |||
582 | /* <count> 4-byte names */ | 583 | /* <count> 4-byte names */ |
583 | 584 | ||
584 | names_index = prefix_length + 2; | 585 | names_index = prefix_length + 2; |
585 | num_segments = (acpi_native_uint) (u8) | 586 | num_segments = (u8) |
586 | internal_name[(acpi_native_uint) | 587 | internal_name[(acpi_size) prefix_length + 1]; |
587 | (prefix_length + 1)]; | ||
588 | break; | 588 | break; |
589 | 589 | ||
590 | case AML_DUAL_NAME_PREFIX: | 590 | case AML_DUAL_NAME_PREFIX: |
@@ -823,7 +823,7 @@ u32 acpi_ns_opens_scope(acpi_object_type type) | |||
823 | 823 | ||
824 | acpi_status | 824 | acpi_status |
825 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, | 825 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, |
826 | char *pathname, | 826 | const char *pathname, |
827 | u32 flags, struct acpi_namespace_node **return_node) | 827 | u32 flags, struct acpi_namespace_node **return_node) |
828 | { | 828 | { |
829 | union acpi_generic_state scope_info; | 829 | union acpi_generic_state scope_info; |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index a8d549187c84..38be5865d95d 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -182,7 +182,6 @@ acpi_evaluate_object(acpi_handle handle, | |||
182 | } | 182 | } |
183 | 183 | ||
184 | info->pathname = pathname; | 184 | info->pathname = pathname; |
185 | info->parameter_type = ACPI_PARAM_ARGS; | ||
186 | 185 | ||
187 | /* Convert and validate the device handle */ | 186 | /* Convert and validate the device handle */ |
188 | 187 | ||
@@ -442,7 +441,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
442 | u32 flags; | 441 | u32 flags; |
443 | struct acpica_device_id hid; | 442 | struct acpica_device_id hid; |
444 | struct acpi_compatible_id_list *cid; | 443 | struct acpi_compatible_id_list *cid; |
445 | acpi_native_uint i; | 444 | u32 i; |
446 | int found; | 445 | int found; |
447 | 446 | ||
448 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 447 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 658e5f3abae0..cb9864e39bae 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c | |||
@@ -120,10 +120,10 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header) | |||
120 | struct acpi_srat_mem_affinity *p = | 120 | struct acpi_srat_mem_affinity *p = |
121 | (struct acpi_srat_mem_affinity *)header; | 121 | (struct acpi_srat_mem_affinity *)header; |
122 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 122 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
123 | "SRAT Memory (0x%lx length 0x%lx type 0x%x) in proximity domain %d %s%s\n", | 123 | "SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s\n", |
124 | (unsigned long)p->base_address, | 124 | (unsigned long)p->base_address, |
125 | (unsigned long)p->length, | 125 | (unsigned long)p->length, |
126 | p->memory_type, p->proximity_domain, | 126 | p->proximity_domain, |
127 | (p->flags & ACPI_SRAT_MEM_ENABLED)? | 127 | (p->flags & ACPI_SRAT_MEM_ENABLED)? |
128 | "enabled" : "disabled", | 128 | "enabled" : "disabled", |
129 | (p->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)? | 129 | (p->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)? |
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index e94463778845..d830b29b85b1 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c | |||
@@ -76,7 +76,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) | |||
76 | { | 76 | { |
77 | u8 *aml = parser_state->aml; | 77 | u8 *aml = parser_state->aml; |
78 | u32 package_length = 0; | 78 | u32 package_length = 0; |
79 | acpi_native_uint byte_count; | 79 | u32 byte_count; |
80 | u8 byte_zero_mask = 0x3F; /* Default [0:5] */ | 80 | u8 byte_zero_mask = 0x3F; /* Default [0:5] */ |
81 | 81 | ||
82 | ACPI_FUNCTION_TRACE(ps_get_next_package_length); | 82 | ACPI_FUNCTION_TRACE(ps_get_next_package_length); |
@@ -86,7 +86,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) | |||
86 | * used to encode the package length, either 0,1,2, or 3 | 86 | * used to encode the package length, either 0,1,2, or 3 |
87 | */ | 87 | */ |
88 | byte_count = (aml[0] >> 6); | 88 | byte_count = (aml[0] >> 6); |
89 | parser_state->aml += (byte_count + 1); | 89 | parser_state->aml += ((acpi_size) byte_count + 1); |
90 | 90 | ||
91 | /* Get bytes 3, 2, 1 as needed */ | 91 | /* Get bytes 3, 2, 1 as needed */ |
92 | 92 | ||
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 52581454c47c..270469aae842 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c | |||
@@ -333,9 +333,9 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) | |||
333 | static void | 333 | static void |
334 | acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action) | 334 | acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action) |
335 | { | 335 | { |
336 | acpi_native_uint i; | 336 | u32 i; |
337 | 337 | ||
338 | if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) { | 338 | if (info->parameters) { |
339 | 339 | ||
340 | /* Update reference count for each parameter */ | 340 | /* Update reference count for each parameter */ |
341 | 341 | ||
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 89022a74faee..11acaee14d66 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -162,7 +162,7 @@ do_prt_fixups(struct acpi_prt_entry *entry, struct acpi_pci_routing_table *prt) | |||
162 | !strcmp(prt->source, quirk->source) && | 162 | !strcmp(prt->source, quirk->source) && |
163 | strlen(prt->source) >= strlen(quirk->actual_source)) { | 163 | strlen(prt->source) >= strlen(quirk->actual_source)) { |
164 | printk(KERN_WARNING PREFIX "firmware reports " | 164 | printk(KERN_WARNING PREFIX "firmware reports " |
165 | "%04x:%02x:%02x[%c] connected to %s; " | 165 | "%04x:%02x:%02x PCI INT %c connected to %s; " |
166 | "changing to %s\n", | 166 | "changing to %s\n", |
167 | entry->id.segment, entry->id.bus, | 167 | entry->id.segment, entry->id.bus, |
168 | entry->id.device, 'A' + entry->pin, | 168 | entry->id.device, 'A' + entry->pin, |
@@ -429,7 +429,7 @@ acpi_pci_irq_derive(struct pci_dev *dev, | |||
429 | { | 429 | { |
430 | struct pci_dev *bridge = dev; | 430 | struct pci_dev *bridge = dev; |
431 | int irq = -1; | 431 | int irq = -1; |
432 | u8 bridge_pin = 0; | 432 | u8 bridge_pin = 0, orig_pin = pin; |
433 | 433 | ||
434 | 434 | ||
435 | if (!dev) | 435 | if (!dev) |
@@ -463,8 +463,8 @@ acpi_pci_irq_derive(struct pci_dev *dev, | |||
463 | } | 463 | } |
464 | 464 | ||
465 | if (irq < 0) { | 465 | if (irq < 0) { |
466 | printk(KERN_WARNING PREFIX "Unable to derive IRQ for device %s\n", | 466 | dev_warn(&dev->dev, "can't derive routing for PCI INT %c\n", |
467 | pci_name(dev)); | 467 | 'A' + orig_pin); |
468 | return -1; | 468 | return -1; |
469 | } | 469 | } |
470 | 470 | ||
@@ -487,6 +487,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
487 | int triggering = ACPI_LEVEL_SENSITIVE; | 487 | int triggering = ACPI_LEVEL_SENSITIVE; |
488 | int polarity = ACPI_ACTIVE_LOW; | 488 | int polarity = ACPI_ACTIVE_LOW; |
489 | char *link = NULL; | 489 | char *link = NULL; |
490 | char link_desc[16]; | ||
490 | int rc; | 491 | int rc; |
491 | 492 | ||
492 | 493 | ||
@@ -503,7 +504,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
503 | pin--; | 504 | pin--; |
504 | 505 | ||
505 | if (!dev->bus) { | 506 | if (!dev->bus) { |
506 | printk(KERN_ERR PREFIX "Invalid (NULL) 'bus' field\n"); | 507 | dev_err(&dev->dev, "invalid (NULL) 'bus' field\n"); |
507 | return -ENODEV; | 508 | return -ENODEV; |
508 | } | 509 | } |
509 | 510 | ||
@@ -538,8 +539,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
538 | * driver reported one, then use it. Exit in any case. | 539 | * driver reported one, then use it. Exit in any case. |
539 | */ | 540 | */ |
540 | if (irq < 0) { | 541 | if (irq < 0) { |
541 | printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI", | 542 | dev_warn(&dev->dev, "PCI INT %c: no GSI", 'A' + pin); |
542 | pci_name(dev), ('A' + pin)); | ||
543 | /* Interrupt Line values above 0xF are forbidden */ | 543 | /* Interrupt Line values above 0xF are forbidden */ |
544 | if (dev->irq > 0 && (dev->irq <= 0xF)) { | 544 | if (dev->irq > 0 && (dev->irq <= 0xF)) { |
545 | printk(" - using IRQ %d\n", dev->irq); | 545 | printk(" - using IRQ %d\n", dev->irq); |
@@ -554,21 +554,21 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
554 | 554 | ||
555 | rc = acpi_register_gsi(irq, triggering, polarity); | 555 | rc = acpi_register_gsi(irq, triggering, polarity); |
556 | if (rc < 0) { | 556 | if (rc < 0) { |
557 | printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed " | 557 | dev_warn(&dev->dev, "PCI INT %c: failed to register GSI\n", |
558 | "to register GSI\n", pci_name(dev), ('A' + pin)); | 558 | 'A' + pin); |
559 | return rc; | 559 | return rc; |
560 | } | 560 | } |
561 | dev->irq = rc; | 561 | dev->irq = rc; |
562 | 562 | ||
563 | printk(KERN_INFO PREFIX "PCI Interrupt %s[%c] -> ", | ||
564 | pci_name(dev), 'A' + pin); | ||
565 | |||
566 | if (link) | 563 | if (link) |
567 | printk("Link [%s] -> ", link); | 564 | snprintf(link_desc, sizeof(link_desc), " -> Link[%s]", link); |
565 | else | ||
566 | link_desc[0] = '\0'; | ||
568 | 567 | ||
569 | printk("GSI %u (%s, %s) -> IRQ %d\n", irq, | 568 | dev_info(&dev->dev, "PCI INT %c%s -> GSI %u (%s, %s) -> IRQ %d\n", |
570 | (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", | 569 | 'A' + pin, link_desc, irq, |
571 | (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); | 570 | (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", |
571 | (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); | ||
572 | 572 | ||
573 | return 0; | 573 | return 0; |
574 | } | 574 | } |
@@ -616,10 +616,6 @@ void acpi_pci_irq_disable(struct pci_dev *dev) | |||
616 | * (e.g. PCI_UNDEFINED_IRQ). | 616 | * (e.g. PCI_UNDEFINED_IRQ). |
617 | */ | 617 | */ |
618 | 618 | ||
619 | printk(KERN_INFO PREFIX "PCI interrupt for device %s disabled\n", | 619 | dev_info(&dev->dev, "PCI INT %c disabled\n", 'A' + pin); |
620 | pci_name(dev)); | ||
621 | |||
622 | acpi_unregister_gsi(gsi); | 620 | acpi_unregister_gsi(gsi); |
623 | |||
624 | return; | ||
625 | } | 621 | } |
diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c new file mode 100644 index 000000000000..b9ab030a52d5 --- /dev/null +++ b/drivers/acpi/pci_slot.c | |||
@@ -0,0 +1,368 @@ | |||
1 | /* | ||
2 | * pci_slot.c - ACPI PCI Slot Driver | ||
3 | * | ||
4 | * The code here is heavily leveraged from the acpiphp module. | ||
5 | * Thanks to Matthew Wilcox <matthew@wil.cx> for much guidance. | ||
6 | * Thanks to Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> for code | ||
7 | * review and fixes. | ||
8 | * | ||
9 | * Copyright (C) 2007 Alex Chiang <achiang@hp.com> | ||
10 | * Copyright (C) 2007 Hewlett-Packard Development Company, L.P. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms and conditions of the GNU General Public License, | ||
14 | * version 2, as published by the Free Software Foundation. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, but | ||
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
19 | * General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License along | ||
22 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
23 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
24 | */ | ||
25 | |||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <linux/init.h> | ||
29 | #include <linux/types.h> | ||
30 | #include <linux/pci.h> | ||
31 | #include <linux/acpi.h> | ||
32 | #include <acpi/acpi_bus.h> | ||
33 | #include <acpi/acpi_drivers.h> | ||
34 | |||
35 | static int debug; | ||
36 | static int check_sta_before_sun; | ||
37 | |||
38 | #define DRIVER_VERSION "0.1" | ||
39 | #define DRIVER_AUTHOR "Alex Chiang <achiang@hp.com>" | ||
40 | #define DRIVER_DESC "ACPI PCI Slot Detection Driver" | ||
41 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
42 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
43 | MODULE_LICENSE("GPL"); | ||
44 | MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); | ||
45 | module_param(debug, bool, 0644); | ||
46 | |||
47 | #define _COMPONENT ACPI_PCI_COMPONENT | ||
48 | ACPI_MODULE_NAME("pci_slot"); | ||
49 | |||
50 | #define MY_NAME "pci_slot" | ||
51 | #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) | ||
52 | #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) | ||
53 | #define dbg(format, arg...) \ | ||
54 | do { \ | ||
55 | if (debug) \ | ||
56 | printk(KERN_DEBUG "%s: " format, \ | ||
57 | MY_NAME , ## arg); \ | ||
58 | } while (0) | ||
59 | |||
60 | #define SLOT_NAME_SIZE 20 /* Inspired by #define in acpiphp.h */ | ||
61 | |||
62 | struct acpi_pci_slot { | ||
63 | acpi_handle root_handle; /* handle of the root bridge */ | ||
64 | struct pci_slot *pci_slot; /* corresponding pci_slot */ | ||
65 | struct list_head list; /* node in the list of slots */ | ||
66 | }; | ||
67 | |||
68 | static int acpi_pci_slot_add(acpi_handle handle); | ||
69 | static void acpi_pci_slot_remove(acpi_handle handle); | ||
70 | |||
71 | static LIST_HEAD(slot_list); | ||
72 | static DEFINE_MUTEX(slot_list_lock); | ||
73 | static struct acpi_pci_driver acpi_pci_slot_driver = { | ||
74 | .add = acpi_pci_slot_add, | ||
75 | .remove = acpi_pci_slot_remove, | ||
76 | }; | ||
77 | |||
78 | static int | ||
79 | check_slot(acpi_handle handle, int *device, unsigned long *sun) | ||
80 | { | ||
81 | int retval = 0; | ||
82 | unsigned long adr, sta; | ||
83 | acpi_status status; | ||
84 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
85 | |||
86 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | ||
87 | dbg("Checking slot on path: %s\n", (char *)buffer.pointer); | ||
88 | |||
89 | if (check_sta_before_sun) { | ||
90 | /* If SxFy doesn't have _STA, we just assume it's there */ | ||
91 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); | ||
92 | if (ACPI_SUCCESS(status) && !(sta & ACPI_STA_DEVICE_PRESENT)) { | ||
93 | retval = -1; | ||
94 | goto out; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr); | ||
99 | if (ACPI_FAILURE(status)) { | ||
100 | dbg("_ADR returned %d on %s\n", status, (char *)buffer.pointer); | ||
101 | retval = -1; | ||
102 | goto out; | ||
103 | } | ||
104 | |||
105 | *device = (adr >> 16) & 0xffff; | ||
106 | |||
107 | /* No _SUN == not a slot == bail */ | ||
108 | status = acpi_evaluate_integer(handle, "_SUN", NULL, sun); | ||
109 | if (ACPI_FAILURE(status)) { | ||
110 | dbg("_SUN returned %d on %s\n", status, (char *)buffer.pointer); | ||
111 | retval = -1; | ||
112 | goto out; | ||
113 | } | ||
114 | |||
115 | out: | ||
116 | kfree(buffer.pointer); | ||
117 | return retval; | ||
118 | } | ||
119 | |||
120 | struct callback_args { | ||
121 | acpi_walk_callback user_function; /* only for walk_p2p_bridge */ | ||
122 | struct pci_bus *pci_bus; | ||
123 | acpi_handle root_handle; | ||
124 | }; | ||
125 | |||
126 | /* | ||
127 | * register_slot | ||
128 | * | ||
129 | * Called once for each SxFy object in the namespace. Don't worry about | ||
130 | * calling pci_create_slot multiple times for the same pci_bus:device, | ||
131 | * since each subsequent call simply bumps the refcount on the pci_slot. | ||
132 | * | ||
133 | * The number of calls to pci_destroy_slot from unregister_slot is | ||
134 | * symmetrical. | ||
135 | */ | ||
136 | static acpi_status | ||
137 | register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
138 | { | ||
139 | int device; | ||
140 | unsigned long sun; | ||
141 | char name[SLOT_NAME_SIZE]; | ||
142 | struct acpi_pci_slot *slot; | ||
143 | struct pci_slot *pci_slot; | ||
144 | struct callback_args *parent_context = context; | ||
145 | struct pci_bus *pci_bus = parent_context->pci_bus; | ||
146 | |||
147 | if (check_slot(handle, &device, &sun)) | ||
148 | return AE_OK; | ||
149 | |||
150 | slot = kmalloc(sizeof(*slot), GFP_KERNEL); | ||
151 | if (!slot) { | ||
152 | err("%s: cannot allocate memory\n", __func__); | ||
153 | return AE_OK; | ||
154 | } | ||
155 | |||
156 | snprintf(name, sizeof(name), "%u", (u32)sun); | ||
157 | pci_slot = pci_create_slot(pci_bus, device, name); | ||
158 | if (IS_ERR(pci_slot)) { | ||
159 | err("pci_create_slot returned %ld\n", PTR_ERR(pci_slot)); | ||
160 | kfree(slot); | ||
161 | } | ||
162 | |||
163 | slot->root_handle = parent_context->root_handle; | ||
164 | slot->pci_slot = pci_slot; | ||
165 | INIT_LIST_HEAD(&slot->list); | ||
166 | mutex_lock(&slot_list_lock); | ||
167 | list_add(&slot->list, &slot_list); | ||
168 | mutex_unlock(&slot_list_lock); | ||
169 | |||
170 | dbg("pci_slot: %p, pci_bus: %x, device: %d, name: %s\n", | ||
171 | pci_slot, pci_bus->number, device, name); | ||
172 | |||
173 | return AE_OK; | ||
174 | } | ||
175 | |||
176 | /* | ||
177 | * walk_p2p_bridge - discover and walk p2p bridges | ||
178 | * @handle: points to an acpi_pci_root | ||
179 | * @context: p2p_bridge_context pointer | ||
180 | * | ||
181 | * Note that when we call ourselves recursively, we pass a different | ||
182 | * value of pci_bus in the child_context. | ||
183 | */ | ||
184 | static acpi_status | ||
185 | walk_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
186 | { | ||
187 | int device, function; | ||
188 | unsigned long adr; | ||
189 | acpi_status status; | ||
190 | acpi_handle dummy_handle; | ||
191 | acpi_walk_callback user_function; | ||
192 | |||
193 | struct pci_dev *dev; | ||
194 | struct pci_bus *pci_bus; | ||
195 | struct callback_args child_context; | ||
196 | struct callback_args *parent_context = context; | ||
197 | |||
198 | pci_bus = parent_context->pci_bus; | ||
199 | user_function = parent_context->user_function; | ||
200 | |||
201 | status = acpi_get_handle(handle, "_ADR", &dummy_handle); | ||
202 | if (ACPI_FAILURE(status)) | ||
203 | return AE_OK; | ||
204 | |||
205 | status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr); | ||
206 | if (ACPI_FAILURE(status)) | ||
207 | return AE_OK; | ||
208 | |||
209 | device = (adr >> 16) & 0xffff; | ||
210 | function = adr & 0xffff; | ||
211 | |||
212 | dev = pci_get_slot(pci_bus, PCI_DEVFN(device, function)); | ||
213 | if (!dev || !dev->subordinate) | ||
214 | goto out; | ||
215 | |||
216 | child_context.pci_bus = dev->subordinate; | ||
217 | child_context.user_function = user_function; | ||
218 | child_context.root_handle = parent_context->root_handle; | ||
219 | |||
220 | dbg("p2p bridge walk, pci_bus = %x\n", dev->subordinate->number); | ||
221 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, | ||
222 | user_function, &child_context, NULL); | ||
223 | if (ACPI_FAILURE(status)) | ||
224 | goto out; | ||
225 | |||
226 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, | ||
227 | walk_p2p_bridge, &child_context, NULL); | ||
228 | out: | ||
229 | pci_dev_put(dev); | ||
230 | return AE_OK; | ||
231 | } | ||
232 | |||
233 | /* | ||
234 | * walk_root_bridge - generic root bridge walker | ||
235 | * @handle: points to an acpi_pci_root | ||
236 | * @user_function: user callback for slot objects | ||
237 | * | ||
238 | * Call user_function for all objects underneath this root bridge. | ||
239 | * Walk p2p bridges underneath us and call user_function on those too. | ||
240 | */ | ||
241 | static int | ||
242 | walk_root_bridge(acpi_handle handle, acpi_walk_callback user_function) | ||
243 | { | ||
244 | int seg, bus; | ||
245 | unsigned long tmp; | ||
246 | acpi_status status; | ||
247 | acpi_handle dummy_handle; | ||
248 | struct pci_bus *pci_bus; | ||
249 | struct callback_args context; | ||
250 | |||
251 | /* If the bridge doesn't have _STA, we assume it is always there */ | ||
252 | status = acpi_get_handle(handle, "_STA", &dummy_handle); | ||
253 | if (ACPI_SUCCESS(status)) { | ||
254 | status = acpi_evaluate_integer(handle, "_STA", NULL, &tmp); | ||
255 | if (ACPI_FAILURE(status)) { | ||
256 | info("%s: _STA evaluation failure\n", __func__); | ||
257 | return 0; | ||
258 | } | ||
259 | if ((tmp & ACPI_STA_DEVICE_FUNCTIONING) == 0) | ||
260 | /* don't register this object */ | ||
261 | return 0; | ||
262 | } | ||
263 | |||
264 | status = acpi_evaluate_integer(handle, "_SEG", NULL, &tmp); | ||
265 | seg = ACPI_SUCCESS(status) ? tmp : 0; | ||
266 | |||
267 | status = acpi_evaluate_integer(handle, "_BBN", NULL, &tmp); | ||
268 | bus = ACPI_SUCCESS(status) ? tmp : 0; | ||
269 | |||
270 | pci_bus = pci_find_bus(seg, bus); | ||
271 | if (!pci_bus) | ||
272 | return 0; | ||
273 | |||
274 | context.pci_bus = pci_bus; | ||
275 | context.user_function = user_function; | ||
276 | context.root_handle = handle; | ||
277 | |||
278 | dbg("root bridge walk, pci_bus = %x\n", pci_bus->number); | ||
279 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, | ||
280 | user_function, &context, NULL); | ||
281 | if (ACPI_FAILURE(status)) | ||
282 | return status; | ||
283 | |||
284 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1, | ||
285 | walk_p2p_bridge, &context, NULL); | ||
286 | if (ACPI_FAILURE(status)) | ||
287 | err("%s: walk_p2p_bridge failure - %d\n", __func__, status); | ||
288 | |||
289 | return status; | ||
290 | } | ||
291 | |||
292 | /* | ||
293 | * acpi_pci_slot_add | ||
294 | * @handle: points to an acpi_pci_root | ||
295 | */ | ||
296 | static int | ||
297 | acpi_pci_slot_add(acpi_handle handle) | ||
298 | { | ||
299 | acpi_status status; | ||
300 | |||
301 | status = walk_root_bridge(handle, register_slot); | ||
302 | if (ACPI_FAILURE(status)) | ||
303 | err("%s: register_slot failure - %d\n", __func__, status); | ||
304 | |||
305 | return status; | ||
306 | } | ||
307 | |||
308 | /* | ||
309 | * acpi_pci_slot_remove | ||
310 | * @handle: points to an acpi_pci_root | ||
311 | */ | ||
312 | static void | ||
313 | acpi_pci_slot_remove(acpi_handle handle) | ||
314 | { | ||
315 | struct acpi_pci_slot *slot, *tmp; | ||
316 | |||
317 | mutex_lock(&slot_list_lock); | ||
318 | list_for_each_entry_safe(slot, tmp, &slot_list, list) { | ||
319 | if (slot->root_handle == handle) { | ||
320 | list_del(&slot->list); | ||
321 | pci_destroy_slot(slot->pci_slot); | ||
322 | kfree(slot); | ||
323 | } | ||
324 | } | ||
325 | mutex_unlock(&slot_list_lock); | ||
326 | } | ||
327 | |||
328 | static int do_sta_before_sun(const struct dmi_system_id *d) | ||
329 | { | ||
330 | info("%s detected: will evaluate _STA before calling _SUN\n", d->ident); | ||
331 | check_sta_before_sun = 1; | ||
332 | return 0; | ||
333 | } | ||
334 | |||
335 | static struct dmi_system_id acpi_pci_slot_dmi_table[] __initdata = { | ||
336 | /* | ||
337 | * Fujitsu Primequest machines will return 1023 to indicate an | ||
338 | * error if the _SUN method is evaluated on SxFy objects that | ||
339 | * are not present (as indicated by _STA), so for those machines, | ||
340 | * we want to check _STA before evaluating _SUN. | ||
341 | */ | ||
342 | { | ||
343 | .callback = do_sta_before_sun, | ||
344 | .ident = "Fujitsu PRIMEQUEST", | ||
345 | .matches = { | ||
346 | DMI_MATCH(DMI_BIOS_VENDOR, "FUJITSU LIMITED"), | ||
347 | DMI_MATCH(DMI_BIOS_VERSION, "PRIMEQUEST"), | ||
348 | }, | ||
349 | }, | ||
350 | {} | ||
351 | }; | ||
352 | |||
353 | static int __init | ||
354 | acpi_pci_slot_init(void) | ||
355 | { | ||
356 | dmi_check_system(acpi_pci_slot_dmi_table); | ||
357 | acpi_pci_register_driver(&acpi_pci_slot_driver); | ||
358 | return 0; | ||
359 | } | ||
360 | |||
361 | static void __exit | ||
362 | acpi_pci_slot_exit(void) | ||
363 | { | ||
364 | acpi_pci_unregister_driver(&acpi_pci_slot_driver); | ||
365 | } | ||
366 | |||
367 | module_init(acpi_pci_slot_init); | ||
368 | module_exit(acpi_pci_slot_exit); | ||
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 81e4f081a4ae..4ab21cb1c8c7 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -292,69 +292,135 @@ static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev) | |||
292 | return 0; | 292 | return 0; |
293 | } | 293 | } |
294 | 294 | ||
295 | /** | ||
296 | * acpi_device_sleep_wake - execute _DSW (Device Sleep Wake) or (deprecated in | ||
297 | * ACPI 3.0) _PSW (Power State Wake) | ||
298 | * @dev: Device to handle. | ||
299 | * @enable: 0 - disable, 1 - enable the wake capabilities of the device. | ||
300 | * @sleep_state: Target sleep state of the system. | ||
301 | * @dev_state: Target power state of the device. | ||
302 | * | ||
303 | * Execute _DSW (Device Sleep Wake) or (deprecated in ACPI 3.0) _PSW (Power | ||
304 | * State Wake) for the device, if present. On failure reset the device's | ||
305 | * wakeup.flags.valid flag. | ||
306 | * | ||
307 | * RETURN VALUE: | ||
308 | * 0 if either _DSW or _PSW has been successfully executed | ||
309 | * 0 if neither _DSW nor _PSW has been found | ||
310 | * -ENODEV if the execution of either _DSW or _PSW has failed | ||
311 | */ | ||
312 | int acpi_device_sleep_wake(struct acpi_device *dev, | ||
313 | int enable, int sleep_state, int dev_state) | ||
314 | { | ||
315 | union acpi_object in_arg[3]; | ||
316 | struct acpi_object_list arg_list = { 3, in_arg }; | ||
317 | acpi_status status = AE_OK; | ||
318 | |||
319 | /* | ||
320 | * Try to execute _DSW first. | ||
321 | * | ||
322 | * Three agruments are needed for the _DSW object: | ||
323 | * Argument 0: enable/disable the wake capabilities | ||
324 | * Argument 1: target system state | ||
325 | * Argument 2: target device state | ||
326 | * When _DSW object is called to disable the wake capabilities, maybe | ||
327 | * the first argument is filled. The values of the other two agruments | ||
328 | * are meaningless. | ||
329 | */ | ||
330 | in_arg[0].type = ACPI_TYPE_INTEGER; | ||
331 | in_arg[0].integer.value = enable; | ||
332 | in_arg[1].type = ACPI_TYPE_INTEGER; | ||
333 | in_arg[1].integer.value = sleep_state; | ||
334 | in_arg[2].type = ACPI_TYPE_INTEGER; | ||
335 | in_arg[2].integer.value = dev_state; | ||
336 | status = acpi_evaluate_object(dev->handle, "_DSW", &arg_list, NULL); | ||
337 | if (ACPI_SUCCESS(status)) { | ||
338 | return 0; | ||
339 | } else if (status != AE_NOT_FOUND) { | ||
340 | printk(KERN_ERR PREFIX "_DSW execution failed\n"); | ||
341 | dev->wakeup.flags.valid = 0; | ||
342 | return -ENODEV; | ||
343 | } | ||
344 | |||
345 | /* Execute _PSW */ | ||
346 | arg_list.count = 1; | ||
347 | in_arg[0].integer.value = enable; | ||
348 | status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); | ||
349 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { | ||
350 | printk(KERN_ERR PREFIX "_PSW execution failed\n"); | ||
351 | dev->wakeup.flags.valid = 0; | ||
352 | return -ENODEV; | ||
353 | } | ||
354 | |||
355 | return 0; | ||
356 | } | ||
357 | |||
295 | /* | 358 | /* |
296 | * Prepare a wakeup device, two steps (Ref ACPI 2.0:P229): | 359 | * Prepare a wakeup device, two steps (Ref ACPI 2.0:P229): |
297 | * 1. Power on the power resources required for the wakeup device | 360 | * 1. Power on the power resources required for the wakeup device |
298 | * 2. Enable _PSW (power state wake) for the device if present | 361 | * 2. Execute _DSW (Device Sleep Wake) or (deprecated in ACPI 3.0) _PSW (Power |
362 | * State Wake) for the device, if present | ||
299 | */ | 363 | */ |
300 | int acpi_enable_wakeup_device_power(struct acpi_device *dev) | 364 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state) |
301 | { | 365 | { |
302 | union acpi_object arg = { ACPI_TYPE_INTEGER }; | 366 | int i, err; |
303 | struct acpi_object_list arg_list = { 1, &arg }; | ||
304 | acpi_status status = AE_OK; | ||
305 | int i; | ||
306 | int ret = 0; | ||
307 | 367 | ||
308 | if (!dev || !dev->wakeup.flags.valid) | 368 | if (!dev || !dev->wakeup.flags.valid) |
309 | return -1; | 369 | return -EINVAL; |
370 | |||
371 | /* | ||
372 | * Do not execute the code below twice in a row without calling | ||
373 | * acpi_disable_wakeup_device_power() in between for the same device | ||
374 | */ | ||
375 | if (dev->wakeup.flags.prepared) | ||
376 | return 0; | ||
310 | 377 | ||
311 | arg.integer.value = 1; | ||
312 | /* Open power resource */ | 378 | /* Open power resource */ |
313 | for (i = 0; i < dev->wakeup.resources.count; i++) { | 379 | for (i = 0; i < dev->wakeup.resources.count; i++) { |
314 | ret = acpi_power_on(dev->wakeup.resources.handles[i], dev); | 380 | int ret = acpi_power_on(dev->wakeup.resources.handles[i], dev); |
315 | if (ret) { | 381 | if (ret) { |
316 | printk(KERN_ERR PREFIX "Transition power state\n"); | 382 | printk(KERN_ERR PREFIX "Transition power state\n"); |
317 | dev->wakeup.flags.valid = 0; | 383 | dev->wakeup.flags.valid = 0; |
318 | return -1; | 384 | return -ENODEV; |
319 | } | 385 | } |
320 | } | 386 | } |
321 | 387 | ||
322 | /* Execute PSW */ | 388 | /* |
323 | status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); | 389 | * Passing 3 as the third argument below means the device may be placed |
324 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { | 390 | * in arbitrary power state afterwards. |
325 | printk(KERN_ERR PREFIX "Evaluate _PSW\n"); | 391 | */ |
326 | dev->wakeup.flags.valid = 0; | 392 | err = acpi_device_sleep_wake(dev, 1, sleep_state, 3); |
327 | ret = -1; | 393 | if (!err) |
328 | } | 394 | dev->wakeup.flags.prepared = 1; |
329 | 395 | ||
330 | return ret; | 396 | return err; |
331 | } | 397 | } |
332 | 398 | ||
333 | /* | 399 | /* |
334 | * Shutdown a wakeup device, counterpart of above method | 400 | * Shutdown a wakeup device, counterpart of above method |
335 | * 1. Disable _PSW (power state wake) | 401 | * 1. Execute _DSW (Device Sleep Wake) or (deprecated in ACPI 3.0) _PSW (Power |
402 | * State Wake) for the device, if present | ||
336 | * 2. Shutdown down the power resources | 403 | * 2. Shutdown down the power resources |
337 | */ | 404 | */ |
338 | int acpi_disable_wakeup_device_power(struct acpi_device *dev) | 405 | int acpi_disable_wakeup_device_power(struct acpi_device *dev) |
339 | { | 406 | { |
340 | union acpi_object arg = { ACPI_TYPE_INTEGER }; | 407 | int i, ret; |
341 | struct acpi_object_list arg_list = { 1, &arg }; | ||
342 | acpi_status status = AE_OK; | ||
343 | int i; | ||
344 | int ret = 0; | ||
345 | |||
346 | 408 | ||
347 | if (!dev || !dev->wakeup.flags.valid) | 409 | if (!dev || !dev->wakeup.flags.valid) |
348 | return -1; | 410 | return -EINVAL; |
349 | 411 | ||
350 | arg.integer.value = 0; | 412 | /* |
351 | /* Execute PSW */ | 413 | * Do not execute the code below twice in a row without calling |
352 | status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); | 414 | * acpi_enable_wakeup_device_power() in between for the same device |
353 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { | 415 | */ |
354 | printk(KERN_ERR PREFIX "Evaluate _PSW\n"); | 416 | if (!dev->wakeup.flags.prepared) |
355 | dev->wakeup.flags.valid = 0; | 417 | return 0; |
356 | return -1; | 418 | |
357 | } | 419 | dev->wakeup.flags.prepared = 0; |
420 | |||
421 | ret = acpi_device_sleep_wake(dev, 0, 0, 0); | ||
422 | if (ret) | ||
423 | return ret; | ||
358 | 424 | ||
359 | /* Close power resource */ | 425 | /* Close power resource */ |
360 | for (i = 0; i < dev->wakeup.resources.count; i++) { | 426 | for (i = 0; i < dev->wakeup.resources.count; i++) { |
@@ -362,7 +428,7 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) | |||
362 | if (ret) { | 428 | if (ret) { |
363 | printk(KERN_ERR PREFIX "Transition power state\n"); | 429 | printk(KERN_ERR PREFIX "Transition power state\n"); |
364 | dev->wakeup.flags.valid = 0; | 430 | dev->wakeup.flags.valid = 0; |
365 | return -1; | 431 | return -ENODEV; |
366 | } | 432 | } |
367 | } | 433 | } |
368 | 434 | ||
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 9dd0fa93b9e1..ec0f2d581ece 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -118,8 +118,31 @@ static const struct file_operations acpi_processor_info_fops = { | |||
118 | .release = single_release, | 118 | .release = single_release, |
119 | }; | 119 | }; |
120 | 120 | ||
121 | struct acpi_processor *processors[NR_CPUS]; | 121 | DEFINE_PER_CPU(struct acpi_processor *, processors); |
122 | struct acpi_processor_errata errata __read_mostly; | 122 | struct acpi_processor_errata errata __read_mostly; |
123 | static int set_no_mwait(const struct dmi_system_id *id) | ||
124 | { | ||
125 | printk(KERN_NOTICE PREFIX "%s detected - " | ||
126 | "disable mwait for CPU C-stetes\n", id->ident); | ||
127 | idle_nomwait = 1; | ||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = { | ||
132 | { | ||
133 | set_no_mwait, "IFL91 board", { | ||
134 | DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"), | ||
135 | DMI_MATCH(DMI_SYS_VENDOR, "ZEPTO"), | ||
136 | DMI_MATCH(DMI_PRODUCT_VERSION, "3215W"), | ||
137 | DMI_MATCH(DMI_BOARD_NAME, "IFL91") }, NULL}, | ||
138 | { | ||
139 | set_no_mwait, "Extensa 5220", { | ||
140 | DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), | ||
141 | DMI_MATCH(DMI_SYS_VENDOR, "ACER"), | ||
142 | DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), | ||
143 | DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL}, | ||
144 | {}, | ||
145 | }; | ||
123 | 146 | ||
124 | /* -------------------------------------------------------------------------- | 147 | /* -------------------------------------------------------------------------- |
125 | Errata Handling | 148 | Errata Handling |
@@ -265,7 +288,20 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr) | |||
265 | 288 | ||
266 | if (!pdc_in) | 289 | if (!pdc_in) |
267 | return status; | 290 | return status; |
291 | if (idle_nomwait) { | ||
292 | /* | ||
293 | * If mwait is disabled for CPU C-states, the C2C3_FFH access | ||
294 | * mode will be disabled in the parameter of _PDC object. | ||
295 | * Of course C1_FFH access mode will also be disabled. | ||
296 | */ | ||
297 | union acpi_object *obj; | ||
298 | u32 *buffer = NULL; | ||
268 | 299 | ||
300 | obj = pdc_in->pointer; | ||
301 | buffer = (u32 *)(obj->buffer.pointer); | ||
302 | buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH); | ||
303 | |||
304 | } | ||
269 | status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL); | 305 | status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL); |
270 | 306 | ||
271 | if (ACPI_FAILURE(status)) | 307 | if (ACPI_FAILURE(status)) |
@@ -614,14 +650,14 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid) | |||
614 | return 0; | 650 | return 0; |
615 | } | 651 | } |
616 | 652 | ||
617 | static void *processor_device_array[NR_CPUS]; | 653 | static DEFINE_PER_CPU(void *, processor_device_array); |
618 | 654 | ||
619 | static int __cpuinit acpi_processor_start(struct acpi_device *device) | 655 | static int __cpuinit acpi_processor_start(struct acpi_device *device) |
620 | { | 656 | { |
621 | int result = 0; | 657 | int result = 0; |
622 | acpi_status status = AE_OK; | 658 | acpi_status status = AE_OK; |
623 | struct acpi_processor *pr; | 659 | struct acpi_processor *pr; |
624 | 660 | struct sys_device *sysdev; | |
625 | 661 | ||
626 | pr = acpi_driver_data(device); | 662 | pr = acpi_driver_data(device); |
627 | 663 | ||
@@ -638,20 +674,24 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
638 | * ACPI id of processors can be reported wrongly by the BIOS. | 674 | * ACPI id of processors can be reported wrongly by the BIOS. |
639 | * Don't trust it blindly | 675 | * Don't trust it blindly |
640 | */ | 676 | */ |
641 | if (processor_device_array[pr->id] != NULL && | 677 | if (per_cpu(processor_device_array, pr->id) != NULL && |
642 | processor_device_array[pr->id] != device) { | 678 | per_cpu(processor_device_array, pr->id) != device) { |
643 | printk(KERN_WARNING "BIOS reported wrong ACPI id " | 679 | printk(KERN_WARNING "BIOS reported wrong ACPI id " |
644 | "for the processor\n"); | 680 | "for the processor\n"); |
645 | return -ENODEV; | 681 | return -ENODEV; |
646 | } | 682 | } |
647 | processor_device_array[pr->id] = device; | 683 | per_cpu(processor_device_array, pr->id) = device; |
648 | 684 | ||
649 | processors[pr->id] = pr; | 685 | per_cpu(processors, pr->id) = pr; |
650 | 686 | ||
651 | result = acpi_processor_add_fs(device); | 687 | result = acpi_processor_add_fs(device); |
652 | if (result) | 688 | if (result) |
653 | goto end; | 689 | goto end; |
654 | 690 | ||
691 | sysdev = get_cpu_sysdev(pr->id); | ||
692 | if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) | ||
693 | return -EFAULT; | ||
694 | |||
655 | status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, | 695 | status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, |
656 | acpi_processor_notify, pr); | 696 | acpi_processor_notify, pr); |
657 | 697 | ||
@@ -749,7 +789,7 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb, | |||
749 | unsigned long action, void *hcpu) | 789 | unsigned long action, void *hcpu) |
750 | { | 790 | { |
751 | unsigned int cpu = (unsigned long)hcpu; | 791 | unsigned int cpu = (unsigned long)hcpu; |
752 | struct acpi_processor *pr = processors[cpu]; | 792 | struct acpi_processor *pr = per_cpu(processors, cpu); |
753 | 793 | ||
754 | if (action == CPU_ONLINE && pr) { | 794 | if (action == CPU_ONLINE && pr) { |
755 | acpi_processor_ppc_has_changed(pr); | 795 | acpi_processor_ppc_has_changed(pr); |
@@ -810,6 +850,8 @@ static int acpi_processor_remove(struct acpi_device *device, int type) | |||
810 | status = acpi_remove_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, | 850 | status = acpi_remove_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, |
811 | acpi_processor_notify); | 851 | acpi_processor_notify); |
812 | 852 | ||
853 | sysfs_remove_link(&device->dev.kobj, "sysdev"); | ||
854 | |||
813 | acpi_processor_remove_fs(device); | 855 | acpi_processor_remove_fs(device); |
814 | 856 | ||
815 | if (pr->cdev) { | 857 | if (pr->cdev) { |
@@ -819,8 +861,8 @@ static int acpi_processor_remove(struct acpi_device *device, int type) | |||
819 | pr->cdev = NULL; | 861 | pr->cdev = NULL; |
820 | } | 862 | } |
821 | 863 | ||
822 | processors[pr->id] = NULL; | 864 | per_cpu(processors, pr->id) = NULL; |
823 | processor_device_array[pr->id] = NULL; | 865 | per_cpu(processor_device_array, pr->id) = NULL; |
824 | kfree(pr); | 866 | kfree(pr); |
825 | 867 | ||
826 | return 0; | 868 | return 0; |
@@ -1014,9 +1056,9 @@ static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu) | |||
1014 | 1056 | ||
1015 | static int acpi_processor_handle_eject(struct acpi_processor *pr) | 1057 | static int acpi_processor_handle_eject(struct acpi_processor *pr) |
1016 | { | 1058 | { |
1017 | if (cpu_online(pr->id)) { | 1059 | if (cpu_online(pr->id)) |
1018 | return (-EINVAL); | 1060 | cpu_down(pr->id); |
1019 | } | 1061 | |
1020 | arch_unregister_cpu(pr->id); | 1062 | arch_unregister_cpu(pr->id); |
1021 | acpi_unmap_lsapic(pr->id); | 1063 | acpi_unmap_lsapic(pr->id); |
1022 | return (0); | 1064 | return (0); |
@@ -1068,8 +1110,6 @@ static int __init acpi_processor_init(void) | |||
1068 | { | 1110 | { |
1069 | int result = 0; | 1111 | int result = 0; |
1070 | 1112 | ||
1071 | |||
1072 | memset(&processors, 0, sizeof(processors)); | ||
1073 | memset(&errata, 0, sizeof(errata)); | 1113 | memset(&errata, 0, sizeof(errata)); |
1074 | 1114 | ||
1075 | #ifdef CONFIG_SMP | 1115 | #ifdef CONFIG_SMP |
@@ -1083,6 +1123,11 @@ static int __init acpi_processor_init(void) | |||
1083 | return -ENOMEM; | 1123 | return -ENOMEM; |
1084 | acpi_processor_dir->owner = THIS_MODULE; | 1124 | acpi_processor_dir->owner = THIS_MODULE; |
1085 | 1125 | ||
1126 | /* | ||
1127 | * Check whether the system is DMI table. If yes, OSPM | ||
1128 | * should not use mwait for CPU-states. | ||
1129 | */ | ||
1130 | dmi_check_system(processor_idle_dmi_table); | ||
1086 | result = cpuidle_register_driver(&acpi_idle_driver); | 1131 | result = cpuidle_register_driver(&acpi_idle_driver); |
1087 | if (result < 0) | 1132 | if (result < 0) |
1088 | goto out_proc; | 1133 | goto out_proc; |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 4976e5db2b3f..d592dbb1d12a 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/pm_qos_params.h> | 41 | #include <linux/pm_qos_params.h> |
42 | #include <linux/clockchips.h> | 42 | #include <linux/clockchips.h> |
43 | #include <linux/cpuidle.h> | 43 | #include <linux/cpuidle.h> |
44 | #include <linux/cpuidle.h> | ||
44 | 45 | ||
45 | /* | 46 | /* |
46 | * Include the apic definitions for x86 to have the APIC timer related defines | 47 | * Include the apic definitions for x86 to have the APIC timer related defines |
@@ -57,6 +58,7 @@ | |||
57 | 58 | ||
58 | #include <acpi/acpi_bus.h> | 59 | #include <acpi/acpi_bus.h> |
59 | #include <acpi/processor.h> | 60 | #include <acpi/processor.h> |
61 | #include <asm/processor.h> | ||
60 | 62 | ||
61 | #define ACPI_PROCESSOR_COMPONENT 0x01000000 | 63 | #define ACPI_PROCESSOR_COMPONENT 0x01000000 |
62 | #define ACPI_PROCESSOR_CLASS "processor" | 64 | #define ACPI_PROCESSOR_CLASS "processor" |
@@ -401,7 +403,7 @@ static void acpi_processor_idle(void) | |||
401 | */ | 403 | */ |
402 | local_irq_disable(); | 404 | local_irq_disable(); |
403 | 405 | ||
404 | pr = processors[smp_processor_id()]; | 406 | pr = __get_cpu_var(processors); |
405 | if (!pr) { | 407 | if (!pr) { |
406 | local_irq_enable(); | 408 | local_irq_enable(); |
407 | return; | 409 | return; |
@@ -955,6 +957,21 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
955 | } else { | 957 | } else { |
956 | continue; | 958 | continue; |
957 | } | 959 | } |
960 | if (cx.type == ACPI_STATE_C1 && | ||
961 | (idle_halt || idle_nomwait)) { | ||
962 | /* | ||
963 | * In most cases the C1 space_id obtained from | ||
964 | * _CST object is FIXED_HARDWARE access mode. | ||
965 | * But when the option of idle=halt is added, | ||
966 | * the entry_method type should be changed from | ||
967 | * CSTATE_FFH to CSTATE_HALT. | ||
968 | * When the option of idle=nomwait is added, | ||
969 | * the C1 entry_method type should be | ||
970 | * CSTATE_HALT. | ||
971 | */ | ||
972 | cx.entry_method = ACPI_CSTATE_HALT; | ||
973 | snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI HLT"); | ||
974 | } | ||
958 | } else { | 975 | } else { |
959 | snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI IOPORT 0x%x", | 976 | snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI IOPORT 0x%x", |
960 | cx.address); | 977 | cx.address); |
@@ -1431,7 +1448,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
1431 | struct acpi_processor *pr; | 1448 | struct acpi_processor *pr; |
1432 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); | 1449 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); |
1433 | 1450 | ||
1434 | pr = processors[smp_processor_id()]; | 1451 | pr = __get_cpu_var(processors); |
1435 | 1452 | ||
1436 | if (unlikely(!pr)) | 1453 | if (unlikely(!pr)) |
1437 | return 0; | 1454 | return 0; |
@@ -1471,7 +1488,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1471 | u32 t1, t2; | 1488 | u32 t1, t2; |
1472 | int sleep_ticks = 0; | 1489 | int sleep_ticks = 0; |
1473 | 1490 | ||
1474 | pr = processors[smp_processor_id()]; | 1491 | pr = __get_cpu_var(processors); |
1475 | 1492 | ||
1476 | if (unlikely(!pr)) | 1493 | if (unlikely(!pr)) |
1477 | return 0; | 1494 | return 0; |
@@ -1549,7 +1566,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1549 | u32 t1, t2; | 1566 | u32 t1, t2; |
1550 | int sleep_ticks = 0; | 1567 | int sleep_ticks = 0; |
1551 | 1568 | ||
1552 | pr = processors[smp_processor_id()]; | 1569 | pr = __get_cpu_var(processors); |
1553 | 1570 | ||
1554 | if (unlikely(!pr)) | 1571 | if (unlikely(!pr)) |
1555 | return 0; | 1572 | return 0; |
@@ -1780,6 +1797,15 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | |||
1780 | return 0; | 1797 | return 0; |
1781 | 1798 | ||
1782 | if (!first_run) { | 1799 | if (!first_run) { |
1800 | if (idle_halt) { | ||
1801 | /* | ||
1802 | * When the boot option of "idle=halt" is added, halt | ||
1803 | * is used for CPU IDLE. | ||
1804 | * In such case C2/C3 is meaningless. So the max_cstate | ||
1805 | * is set to one. | ||
1806 | */ | ||
1807 | max_cstate = 1; | ||
1808 | } | ||
1783 | dmi_check_system(processor_power_dmi_table); | 1809 | dmi_check_system(processor_power_dmi_table); |
1784 | max_cstate = acpi_processor_cstate_check(max_cstate); | 1810 | max_cstate = acpi_processor_cstate_check(max_cstate); |
1785 | if (max_cstate < ACPI_C_STATES_MAX) | 1811 | if (max_cstate < ACPI_C_STATES_MAX) |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index d80b2d1441af..b4749969c6b4 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -89,7 +89,7 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb, | |||
89 | if (event != CPUFREQ_INCOMPATIBLE) | 89 | if (event != CPUFREQ_INCOMPATIBLE) |
90 | goto out; | 90 | goto out; |
91 | 91 | ||
92 | pr = processors[policy->cpu]; | 92 | pr = per_cpu(processors, policy->cpu); |
93 | if (!pr || !pr->performance) | 93 | if (!pr || !pr->performance) |
94 | goto out; | 94 | goto out; |
95 | 95 | ||
@@ -572,7 +572,7 @@ int acpi_processor_preregister_performance( | |||
572 | 572 | ||
573 | /* Call _PSD for all CPUs */ | 573 | /* Call _PSD for all CPUs */ |
574 | for_each_possible_cpu(i) { | 574 | for_each_possible_cpu(i) { |
575 | pr = processors[i]; | 575 | pr = per_cpu(processors, i); |
576 | if (!pr) { | 576 | if (!pr) { |
577 | /* Look only at processors in ACPI namespace */ | 577 | /* Look only at processors in ACPI namespace */ |
578 | continue; | 578 | continue; |
@@ -603,7 +603,7 @@ int acpi_processor_preregister_performance( | |||
603 | * domain info. | 603 | * domain info. |
604 | */ | 604 | */ |
605 | for_each_possible_cpu(i) { | 605 | for_each_possible_cpu(i) { |
606 | pr = processors[i]; | 606 | pr = per_cpu(processors, i); |
607 | if (!pr) | 607 | if (!pr) |
608 | continue; | 608 | continue; |
609 | 609 | ||
@@ -624,7 +624,7 @@ int acpi_processor_preregister_performance( | |||
624 | 624 | ||
625 | cpus_clear(covered_cpus); | 625 | cpus_clear(covered_cpus); |
626 | for_each_possible_cpu(i) { | 626 | for_each_possible_cpu(i) { |
627 | pr = processors[i]; | 627 | pr = per_cpu(processors, i); |
628 | if (!pr) | 628 | if (!pr) |
629 | continue; | 629 | continue; |
630 | 630 | ||
@@ -651,7 +651,7 @@ int acpi_processor_preregister_performance( | |||
651 | if (i == j) | 651 | if (i == j) |
652 | continue; | 652 | continue; |
653 | 653 | ||
654 | match_pr = processors[j]; | 654 | match_pr = per_cpu(processors, j); |
655 | if (!match_pr) | 655 | if (!match_pr) |
656 | continue; | 656 | continue; |
657 | 657 | ||
@@ -680,7 +680,7 @@ int acpi_processor_preregister_performance( | |||
680 | if (i == j) | 680 | if (i == j) |
681 | continue; | 681 | continue; |
682 | 682 | ||
683 | match_pr = processors[j]; | 683 | match_pr = per_cpu(processors, j); |
684 | if (!match_pr) | 684 | if (!match_pr) |
685 | continue; | 685 | continue; |
686 | 686 | ||
@@ -697,7 +697,7 @@ int acpi_processor_preregister_performance( | |||
697 | 697 | ||
698 | err_ret: | 698 | err_ret: |
699 | for_each_possible_cpu(i) { | 699 | for_each_possible_cpu(i) { |
700 | pr = processors[i]; | 700 | pr = per_cpu(processors, i); |
701 | if (!pr || !pr->performance) | 701 | if (!pr || !pr->performance) |
702 | continue; | 702 | continue; |
703 | 703 | ||
@@ -728,7 +728,7 @@ acpi_processor_register_performance(struct acpi_processor_performance | |||
728 | 728 | ||
729 | mutex_lock(&performance_mutex); | 729 | mutex_lock(&performance_mutex); |
730 | 730 | ||
731 | pr = processors[cpu]; | 731 | pr = per_cpu(processors, cpu); |
732 | if (!pr) { | 732 | if (!pr) { |
733 | mutex_unlock(&performance_mutex); | 733 | mutex_unlock(&performance_mutex); |
734 | return -ENODEV; | 734 | return -ENODEV; |
@@ -766,7 +766,7 @@ acpi_processor_unregister_performance(struct acpi_processor_performance | |||
766 | 766 | ||
767 | mutex_lock(&performance_mutex); | 767 | mutex_lock(&performance_mutex); |
768 | 768 | ||
769 | pr = processors[cpu]; | 769 | pr = per_cpu(processors, cpu); |
770 | if (!pr) { | 770 | if (!pr) { |
771 | mutex_unlock(&performance_mutex); | 771 | mutex_unlock(&performance_mutex); |
772 | return; | 772 | return; |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 28509fbba6f9..a56fc6c4394b 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -71,7 +71,7 @@ static int acpi_processor_update_tsd_coord(void) | |||
71 | * coordination between all CPUs. | 71 | * coordination between all CPUs. |
72 | */ | 72 | */ |
73 | for_each_possible_cpu(i) { | 73 | for_each_possible_cpu(i) { |
74 | pr = processors[i]; | 74 | pr = per_cpu(processors, i); |
75 | if (!pr) | 75 | if (!pr) |
76 | continue; | 76 | continue; |
77 | 77 | ||
@@ -93,7 +93,7 @@ static int acpi_processor_update_tsd_coord(void) | |||
93 | 93 | ||
94 | cpus_clear(covered_cpus); | 94 | cpus_clear(covered_cpus); |
95 | for_each_possible_cpu(i) { | 95 | for_each_possible_cpu(i) { |
96 | pr = processors[i]; | 96 | pr = per_cpu(processors, i); |
97 | if (!pr) | 97 | if (!pr) |
98 | continue; | 98 | continue; |
99 | 99 | ||
@@ -119,7 +119,7 @@ static int acpi_processor_update_tsd_coord(void) | |||
119 | if (i == j) | 119 | if (i == j) |
120 | continue; | 120 | continue; |
121 | 121 | ||
122 | match_pr = processors[j]; | 122 | match_pr = per_cpu(processors, j); |
123 | if (!match_pr) | 123 | if (!match_pr) |
124 | continue; | 124 | continue; |
125 | 125 | ||
@@ -152,7 +152,7 @@ static int acpi_processor_update_tsd_coord(void) | |||
152 | if (i == j) | 152 | if (i == j) |
153 | continue; | 153 | continue; |
154 | 154 | ||
155 | match_pr = processors[j]; | 155 | match_pr = per_cpu(processors, j); |
156 | if (!match_pr) | 156 | if (!match_pr) |
157 | continue; | 157 | continue; |
158 | 158 | ||
@@ -172,7 +172,7 @@ static int acpi_processor_update_tsd_coord(void) | |||
172 | 172 | ||
173 | err_ret: | 173 | err_ret: |
174 | for_each_possible_cpu(i) { | 174 | for_each_possible_cpu(i) { |
175 | pr = processors[i]; | 175 | pr = per_cpu(processors, i); |
176 | if (!pr) | 176 | if (!pr) |
177 | continue; | 177 | continue; |
178 | 178 | ||
@@ -214,7 +214,7 @@ static int acpi_processor_throttling_notifier(unsigned long event, void *data) | |||
214 | struct acpi_processor_throttling *p_throttling; | 214 | struct acpi_processor_throttling *p_throttling; |
215 | 215 | ||
216 | cpu = p_tstate->cpu; | 216 | cpu = p_tstate->cpu; |
217 | pr = processors[cpu]; | 217 | pr = per_cpu(processors, cpu); |
218 | if (!pr) { | 218 | if (!pr) { |
219 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid pr pointer\n")); | 219 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid pr pointer\n")); |
220 | return 0; | 220 | return 0; |
@@ -1035,7 +1035,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
1035 | * cpus. | 1035 | * cpus. |
1036 | */ | 1036 | */ |
1037 | for_each_cpu_mask_nr(i, online_throttling_cpus) { | 1037 | for_each_cpu_mask_nr(i, online_throttling_cpus) { |
1038 | match_pr = processors[i]; | 1038 | match_pr = per_cpu(processors, i); |
1039 | /* | 1039 | /* |
1040 | * If the pointer is invalid, we will report the | 1040 | * If the pointer is invalid, we will report the |
1041 | * error message and continue. | 1041 | * error message and continue. |
@@ -1232,7 +1232,10 @@ static ssize_t acpi_processor_write_throttling(struct file *file, | |||
1232 | int result = 0; | 1232 | int result = 0; |
1233 | struct seq_file *m = file->private_data; | 1233 | struct seq_file *m = file->private_data; |
1234 | struct acpi_processor *pr = m->private; | 1234 | struct acpi_processor *pr = m->private; |
1235 | char state_string[12] = { '\0' }; | 1235 | char state_string[5] = ""; |
1236 | char *charp = NULL; | ||
1237 | size_t state_val = 0; | ||
1238 | char tmpbuf[5] = ""; | ||
1236 | 1239 | ||
1237 | if (!pr || (count > sizeof(state_string) - 1)) | 1240 | if (!pr || (count > sizeof(state_string) - 1)) |
1238 | return -EINVAL; | 1241 | return -EINVAL; |
@@ -1241,10 +1244,23 @@ static ssize_t acpi_processor_write_throttling(struct file *file, | |||
1241 | return -EFAULT; | 1244 | return -EFAULT; |
1242 | 1245 | ||
1243 | state_string[count] = '\0'; | 1246 | state_string[count] = '\0'; |
1247 | if ((count > 0) && (state_string[count-1] == '\n')) | ||
1248 | state_string[count-1] = '\0'; | ||
1244 | 1249 | ||
1245 | result = acpi_processor_set_throttling(pr, | 1250 | charp = state_string; |
1246 | simple_strtoul(state_string, | 1251 | if ((state_string[0] == 't') || (state_string[0] == 'T')) |
1247 | NULL, 0)); | 1252 | charp++; |
1253 | |||
1254 | state_val = simple_strtoul(charp, NULL, 0); | ||
1255 | if (state_val >= pr->throttling.state_count) | ||
1256 | return -EINVAL; | ||
1257 | |||
1258 | snprintf(tmpbuf, 5, "%zu", state_val); | ||
1259 | |||
1260 | if (strcmp(tmpbuf, charp) != 0) | ||
1261 | return -EINVAL; | ||
1262 | |||
1263 | result = acpi_processor_set_throttling(pr, state_val); | ||
1248 | if (result) | 1264 | if (result) |
1249 | return result; | 1265 | return result; |
1250 | 1266 | ||
diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c new file mode 100644 index 000000000000..a6b662c00b67 --- /dev/null +++ b/drivers/acpi/reboot.c | |||
@@ -0,0 +1,50 @@ | |||
1 | |||
2 | #include <linux/pci.h> | ||
3 | #include <linux/acpi.h> | ||
4 | #include <acpi/reboot.h> | ||
5 | |||
6 | void acpi_reboot(void) | ||
7 | { | ||
8 | struct acpi_generic_address *rr; | ||
9 | struct pci_bus *bus0; | ||
10 | u8 reset_value; | ||
11 | unsigned int devfn; | ||
12 | |||
13 | if (acpi_disabled) | ||
14 | return; | ||
15 | |||
16 | rr = &acpi_gbl_FADT.reset_register; | ||
17 | |||
18 | /* Is the reset register supported? */ | ||
19 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) || | ||
20 | rr->bit_width != 8 || rr->bit_offset != 0) | ||
21 | return; | ||
22 | |||
23 | reset_value = acpi_gbl_FADT.reset_value; | ||
24 | |||
25 | /* The reset register can only exist in I/O, Memory or PCI config space | ||
26 | * on a device on bus 0. */ | ||
27 | switch (rr->space_id) { | ||
28 | case ACPI_ADR_SPACE_PCI_CONFIG: | ||
29 | /* The reset register can only live on bus 0. */ | ||
30 | bus0 = pci_find_bus(0, 0); | ||
31 | if (!bus0) | ||
32 | return; | ||
33 | /* Form PCI device/function pair. */ | ||
34 | devfn = PCI_DEVFN((rr->address >> 32) & 0xffff, | ||
35 | (rr->address >> 16) & 0xffff); | ||
36 | printk(KERN_DEBUG "Resetting with ACPI PCI RESET_REG."); | ||
37 | /* Write the value that resets us. */ | ||
38 | pci_bus_write_config_byte(bus0, devfn, | ||
39 | (rr->address & 0xffff), reset_value); | ||
40 | break; | ||
41 | |||
42 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | ||
43 | case ACPI_ADR_SPACE_SYSTEM_IO: | ||
44 | printk(KERN_DEBUG "ACPI MEMORY or I/O RESET_REG.\n"); | ||
45 | acpi_hw_low_level_write(8, reset_value, rr); | ||
46 | break; | ||
47 | } | ||
48 | /* Wait ten seconds */ | ||
49 | acpi_os_stall(10000000); | ||
50 | } | ||
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 8a112d11d491..f61ebc679e66 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c | |||
@@ -73,7 +73,7 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length); | |||
73 | 73 | ||
74 | static u8 acpi_rs_count_set_bits(u16 bit_field) | 74 | static u8 acpi_rs_count_set_bits(u16 bit_field) |
75 | { | 75 | { |
76 | acpi_native_uint bits_set; | 76 | u8 bits_set; |
77 | 77 | ||
78 | ACPI_FUNCTION_ENTRY(); | 78 | ACPI_FUNCTION_ENTRY(); |
79 | 79 | ||
@@ -84,7 +84,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) | |||
84 | bit_field &= (u16) (bit_field - 1); | 84 | bit_field &= (u16) (bit_field - 1); |
85 | } | 85 | } |
86 | 86 | ||
87 | return ((u8) bits_set); | 87 | return bits_set; |
88 | } | 88 | } |
89 | 89 | ||
90 | /******************************************************************************* | 90 | /******************************************************************************* |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index faddaee1bc07..7804a8c40e7a 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -181,9 +181,9 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
181 | } | 181 | } |
182 | 182 | ||
183 | /* | 183 | /* |
184 | * Loop through the ACPI_INTERNAL_OBJECTS - Each object | 184 | * Loop through the ACPI_INTERNAL_OBJECTS - Each object should be a |
185 | * should be a package that in turn contains an | 185 | * package that in turn contains an acpi_integer Address, a u8 Pin, |
186 | * acpi_integer Address, a u8 Pin, a Name and a u8 source_index. | 186 | * a Name, and a u8 source_index. |
187 | */ | 187 | */ |
188 | top_object_list = package_object->package.elements; | 188 | top_object_list = package_object->package.elements; |
189 | number_of_elements = package_object->package.count; | 189 | number_of_elements = package_object->package.count; |
@@ -240,9 +240,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
240 | /* 1) First subobject: Dereference the PRT.Address */ | 240 | /* 1) First subobject: Dereference the PRT.Address */ |
241 | 241 | ||
242 | obj_desc = sub_object_list[0]; | 242 | obj_desc = sub_object_list[0]; |
243 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 243 | if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER) { |
244 | user_prt->address = obj_desc->integer.value; | ||
245 | } else { | ||
246 | ACPI_ERROR((AE_INFO, | 244 | ACPI_ERROR((AE_INFO, |
247 | "(PRT[%X].Address) Need Integer, found %s", | 245 | "(PRT[%X].Address) Need Integer, found %s", |
248 | index, | 246 | index, |
@@ -250,12 +248,12 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
250 | return_ACPI_STATUS(AE_BAD_DATA); | 248 | return_ACPI_STATUS(AE_BAD_DATA); |
251 | } | 249 | } |
252 | 250 | ||
251 | user_prt->address = obj_desc->integer.value; | ||
252 | |||
253 | /* 2) Second subobject: Dereference the PRT.Pin */ | 253 | /* 2) Second subobject: Dereference the PRT.Pin */ |
254 | 254 | ||
255 | obj_desc = sub_object_list[1]; | 255 | obj_desc = sub_object_list[1]; |
256 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 256 | if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER) { |
257 | user_prt->pin = (u32) obj_desc->integer.value; | ||
258 | } else { | ||
259 | ACPI_ERROR((AE_INFO, | 257 | ACPI_ERROR((AE_INFO, |
260 | "(PRT[%X].Pin) Need Integer, found %s", | 258 | "(PRT[%X].Pin) Need Integer, found %s", |
261 | index, | 259 | index, |
@@ -284,6 +282,25 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
284 | } | 282 | } |
285 | } | 283 | } |
286 | 284 | ||
285 | user_prt->pin = (u32) obj_desc->integer.value; | ||
286 | |||
287 | /* | ||
288 | * If the BIOS has erroneously reversed the _PRT source_name (index 2) | ||
289 | * and the source_index (index 3), fix it. _PRT is important enough to | ||
290 | * workaround this BIOS error. This also provides compatibility with | ||
291 | * other ACPI implementations. | ||
292 | */ | ||
293 | obj_desc = sub_object_list[3]; | ||
294 | if (!obj_desc | ||
295 | || (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) { | ||
296 | sub_object_list[3] = sub_object_list[2]; | ||
297 | sub_object_list[2] = obj_desc; | ||
298 | |||
299 | ACPI_WARNING((AE_INFO, | ||
300 | "(PRT[%X].Source) SourceName and SourceIndex are reversed, fixed", | ||
301 | index)); | ||
302 | } | ||
303 | |||
287 | /* | 304 | /* |
288 | * 3) Third subobject: Dereference the PRT.source_name | 305 | * 3) Third subobject: Dereference the PRT.source_name |
289 | * The name may be unresolved (slack mode), so allow a null object | 306 | * The name may be unresolved (slack mode), so allow a null object |
@@ -364,9 +381,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
364 | /* 4) Fourth subobject: Dereference the PRT.source_index */ | 381 | /* 4) Fourth subobject: Dereference the PRT.source_index */ |
365 | 382 | ||
366 | obj_desc = sub_object_list[source_index_index]; | 383 | obj_desc = sub_object_list[source_index_index]; |
367 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 384 | if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER) { |
368 | user_prt->source_index = (u32) obj_desc->integer.value; | ||
369 | } else { | ||
370 | ACPI_ERROR((AE_INFO, | 385 | ACPI_ERROR((AE_INFO, |
371 | "(PRT[%X].SourceIndex) Need Integer, found %s", | 386 | "(PRT[%X].SourceIndex) Need Integer, found %s", |
372 | index, | 387 | index, |
@@ -374,6 +389,8 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
374 | return_ACPI_STATUS(AE_BAD_DATA); | 389 | return_ACPI_STATUS(AE_BAD_DATA); |
375 | } | 390 | } |
376 | 391 | ||
392 | user_prt->source_index = (u32) obj_desc->integer.value; | ||
393 | |||
377 | /* Point to the next union acpi_operand_object in the top level package */ | 394 | /* Point to the next union acpi_operand_object in the top level package */ |
378 | 395 | ||
379 | top_object_list++; | 396 | top_object_list++; |
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index de1ac3881b22..96a6c0353255 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c | |||
@@ -82,7 +82,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
82 | 82 | ||
83 | ACPI_FUNCTION_TRACE(rs_convert_aml_to_resource); | 83 | ACPI_FUNCTION_TRACE(rs_convert_aml_to_resource); |
84 | 84 | ||
85 | if (((acpi_native_uint) resource) & 0x3) { | 85 | if (((acpi_size) resource) & 0x3) { |
86 | 86 | ||
87 | /* Each internal resource struct is expected to be 32-bit aligned */ | 87 | /* Each internal resource struct is expected to be 32-bit aligned */ |
88 | 88 | ||
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index befe2302f41b..f7b3bcd59ba7 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c | |||
@@ -62,7 +62,7 @@ ACPI_MODULE_NAME("rsutils") | |||
62 | ******************************************************************************/ | 62 | ******************************************************************************/ |
63 | u8 acpi_rs_decode_bitmask(u16 mask, u8 * list) | 63 | u8 acpi_rs_decode_bitmask(u16 mask, u8 * list) |
64 | { | 64 | { |
65 | acpi_native_uint i; | 65 | u8 i; |
66 | u8 bit_count; | 66 | u8 bit_count; |
67 | 67 | ||
68 | ACPI_FUNCTION_ENTRY(); | 68 | ACPI_FUNCTION_ENTRY(); |
@@ -71,7 +71,7 @@ u8 acpi_rs_decode_bitmask(u16 mask, u8 * list) | |||
71 | 71 | ||
72 | for (i = 0, bit_count = 0; mask; i++) { | 72 | for (i = 0, bit_count = 0; mask; i++) { |
73 | if (mask & 0x0001) { | 73 | if (mask & 0x0001) { |
74 | list[bit_count] = (u8) i; | 74 | list[bit_count] = i; |
75 | bit_count++; | 75 | bit_count++; |
76 | } | 76 | } |
77 | 77 | ||
@@ -96,8 +96,8 @@ u8 acpi_rs_decode_bitmask(u16 mask, u8 * list) | |||
96 | 96 | ||
97 | u16 acpi_rs_encode_bitmask(u8 * list, u8 count) | 97 | u16 acpi_rs_encode_bitmask(u8 * list, u8 count) |
98 | { | 98 | { |
99 | acpi_native_uint i; | 99 | u32 i; |
100 | acpi_native_uint mask; | 100 | u16 mask; |
101 | 101 | ||
102 | ACPI_FUNCTION_ENTRY(); | 102 | ACPI_FUNCTION_ENTRY(); |
103 | 103 | ||
@@ -107,7 +107,7 @@ u16 acpi_rs_encode_bitmask(u8 * list, u8 count) | |||
107 | mask |= (0x1 << list[i]); | 107 | mask |= (0x1 << list[i]); |
108 | } | 108 | } |
109 | 109 | ||
110 | return ((u16) mask); | 110 | return mask; |
111 | } | 111 | } |
112 | 112 | ||
113 | /******************************************************************************* | 113 | /******************************************************************************* |
@@ -130,7 +130,7 @@ u16 acpi_rs_encode_bitmask(u8 * list, u8 count) | |||
130 | void | 130 | void |
131 | acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) | 131 | acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) |
132 | { | 132 | { |
133 | acpi_native_uint i; | 133 | u32 i; |
134 | 134 | ||
135 | ACPI_FUNCTION_ENTRY(); | 135 | ACPI_FUNCTION_ENTRY(); |
136 | 136 | ||
@@ -679,7 +679,6 @@ acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, | |||
679 | info->prefix_node = node; | 679 | info->prefix_node = node; |
680 | info->pathname = METHOD_NAME__SRS; | 680 | info->pathname = METHOD_NAME__SRS; |
681 | info->parameters = args; | 681 | info->parameters = args; |
682 | info->parameter_type = ACPI_PARAM_ARGS; | ||
683 | info->flags = ACPI_IGNORE_RETURN_VALUE; | 682 | info->flags = ACPI_IGNORE_RETURN_VALUE; |
684 | 683 | ||
685 | /* | 684 | /* |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 6d85289f1c12..f3132aa47a69 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -6,6 +6,8 @@ | |||
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
8 | #include <linux/acpi.h> | 8 | #include <linux/acpi.h> |
9 | #include <linux/signal.h> | ||
10 | #include <linux/kthread.h> | ||
9 | 11 | ||
10 | #include <acpi/acpi_drivers.h> | 12 | #include <acpi/acpi_drivers.h> |
11 | #include <acpi/acinterp.h> /* for acpi_ex_eisa_id_to_string() */ | 13 | #include <acpi/acinterp.h> /* for acpi_ex_eisa_id_to_string() */ |
@@ -92,17 +94,37 @@ acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, cha | |||
92 | } | 94 | } |
93 | static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); | 95 | static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); |
94 | 96 | ||
95 | static int acpi_eject_operation(acpi_handle handle, int lockable) | 97 | static int acpi_bus_hot_remove_device(void *context) |
96 | { | 98 | { |
99 | struct acpi_device *device; | ||
100 | acpi_handle handle = context; | ||
97 | struct acpi_object_list arg_list; | 101 | struct acpi_object_list arg_list; |
98 | union acpi_object arg; | 102 | union acpi_object arg; |
99 | acpi_status status = AE_OK; | 103 | acpi_status status = AE_OK; |
100 | 104 | ||
101 | /* | 105 | if (acpi_bus_get_device(handle, &device)) |
102 | * TBD: evaluate _PS3? | 106 | return 0; |
103 | */ | 107 | |
108 | if (!device) | ||
109 | return 0; | ||
110 | |||
111 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
112 | "Hot-removing device %s...\n", device->dev.bus_id)); | ||
113 | |||
104 | 114 | ||
105 | if (lockable) { | 115 | if (acpi_bus_trim(device, 1)) { |
116 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
117 | "Removing device failed\n")); | ||
118 | return -1; | ||
119 | } | ||
120 | |||
121 | /* power off device */ | ||
122 | status = acpi_evaluate_object(handle, "_PS3", NULL, NULL); | ||
123 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) | ||
124 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | ||
125 | "Power-off device failed\n")); | ||
126 | |||
127 | if (device->flags.lockable) { | ||
106 | arg_list.count = 1; | 128 | arg_list.count = 1; |
107 | arg_list.pointer = &arg; | 129 | arg_list.pointer = &arg; |
108 | arg.type = ACPI_TYPE_INTEGER; | 130 | arg.type = ACPI_TYPE_INTEGER; |
@@ -118,26 +140,22 @@ static int acpi_eject_operation(acpi_handle handle, int lockable) | |||
118 | /* | 140 | /* |
119 | * TBD: _EJD support. | 141 | * TBD: _EJD support. |
120 | */ | 142 | */ |
121 | |||
122 | status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); | 143 | status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); |
123 | if (ACPI_FAILURE(status)) { | 144 | if (ACPI_FAILURE(status)) |
124 | return (-ENODEV); | 145 | return -ENODEV; |
125 | } | ||
126 | 146 | ||
127 | return (0); | 147 | return 0; |
128 | } | 148 | } |
129 | 149 | ||
130 | static ssize_t | 150 | static ssize_t |
131 | acpi_eject_store(struct device *d, struct device_attribute *attr, | 151 | acpi_eject_store(struct device *d, struct device_attribute *attr, |
132 | const char *buf, size_t count) | 152 | const char *buf, size_t count) |
133 | { | 153 | { |
134 | int result; | ||
135 | int ret = count; | 154 | int ret = count; |
136 | int islockable; | ||
137 | acpi_status status; | 155 | acpi_status status; |
138 | acpi_handle handle; | ||
139 | acpi_object_type type = 0; | 156 | acpi_object_type type = 0; |
140 | struct acpi_device *acpi_device = to_acpi_device(d); | 157 | struct acpi_device *acpi_device = to_acpi_device(d); |
158 | struct task_struct *task; | ||
141 | 159 | ||
142 | if ((!count) || (buf[0] != '1')) { | 160 | if ((!count) || (buf[0] != '1')) { |
143 | return -EINVAL; | 161 | return -EINVAL; |
@@ -154,18 +172,12 @@ acpi_eject_store(struct device *d, struct device_attribute *attr, | |||
154 | goto err; | 172 | goto err; |
155 | } | 173 | } |
156 | 174 | ||
157 | islockable = acpi_device->flags.lockable; | 175 | /* remove the device in another thread to fix the deadlock issue */ |
158 | handle = acpi_device->handle; | 176 | task = kthread_run(acpi_bus_hot_remove_device, |
159 | 177 | acpi_device->handle, "acpi_hot_remove_device"); | |
160 | result = acpi_bus_trim(acpi_device, 1); | 178 | if (IS_ERR(task)) |
161 | 179 | ret = PTR_ERR(task); | |
162 | if (!result) | 180 | err: |
163 | result = acpi_eject_operation(handle, islockable); | ||
164 | |||
165 | if (result) { | ||
166 | ret = -EBUSY; | ||
167 | } | ||
168 | err: | ||
169 | return ret; | 181 | return ret; |
170 | } | 182 | } |
171 | 183 | ||
@@ -691,9 +703,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
691 | acpi_status status = 0; | 703 | acpi_status status = 0; |
692 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 704 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
693 | union acpi_object *package = NULL; | 705 | union acpi_object *package = NULL; |
694 | union acpi_object in_arg[3]; | 706 | int psw_error; |
695 | struct acpi_object_list arg_list = { 3, in_arg }; | ||
696 | acpi_status psw_status = AE_OK; | ||
697 | 707 | ||
698 | struct acpi_device_id button_device_ids[] = { | 708 | struct acpi_device_id button_device_ids[] = { |
699 | {"PNP0C0D", 0}, | 709 | {"PNP0C0D", 0}, |
@@ -725,39 +735,11 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
725 | * So it is necessary to call _DSW object first. Only when it is not | 735 | * So it is necessary to call _DSW object first. Only when it is not |
726 | * present will the _PSW object used. | 736 | * present will the _PSW object used. |
727 | */ | 737 | */ |
728 | /* | 738 | psw_error = acpi_device_sleep_wake(device, 0, 0, 0); |
729 | * Three agruments are needed for the _DSW object. | 739 | if (psw_error) |
730 | * Argument 0: enable/disable the wake capabilities | 740 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
731 | * When _DSW object is called to disable the wake capabilities, maybe | 741 | "error in _DSW or _PSW evaluation\n")); |
732 | * the first argument is filled. The value of the other two agruments | 742 | |
733 | * is meaningless. | ||
734 | */ | ||
735 | in_arg[0].type = ACPI_TYPE_INTEGER; | ||
736 | in_arg[0].integer.value = 0; | ||
737 | in_arg[1].type = ACPI_TYPE_INTEGER; | ||
738 | in_arg[1].integer.value = 0; | ||
739 | in_arg[2].type = ACPI_TYPE_INTEGER; | ||
740 | in_arg[2].integer.value = 0; | ||
741 | psw_status = acpi_evaluate_object(device->handle, "_DSW", | ||
742 | &arg_list, NULL); | ||
743 | if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND)) | ||
744 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in evaluate _DSW\n")); | ||
745 | /* | ||
746 | * When the _DSW object is not present, OSPM will call _PSW object. | ||
747 | */ | ||
748 | if (psw_status == AE_NOT_FOUND) { | ||
749 | /* | ||
750 | * Only one agruments is required for the _PSW object. | ||
751 | * agrument 0: enable/disable the wake capabilities | ||
752 | */ | ||
753 | arg_list.count = 1; | ||
754 | in_arg[0].integer.value = 0; | ||
755 | psw_status = acpi_evaluate_object(device->handle, "_PSW", | ||
756 | &arg_list, NULL); | ||
757 | if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND)) | ||
758 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in " | ||
759 | "evaluate _PSW\n")); | ||
760 | } | ||
761 | /* Power button, Lid switch always enable wakeup */ | 743 | /* Power button, Lid switch always enable wakeup */ |
762 | if (!acpi_match_device_ids(device, button_device_ids)) | 744 | if (!acpi_match_device_ids(device, button_device_ids)) |
763 | device->wakeup.flags.run_wake = 1; | 745 | device->wakeup.flags.run_wake = 1; |
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 495c63a3e0af..0489a7d1d42c 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -24,10 +24,6 @@ | |||
24 | 24 | ||
25 | u8 sleep_states[ACPI_S_STATE_COUNT]; | 25 | u8 sleep_states[ACPI_S_STATE_COUNT]; |
26 | 26 | ||
27 | #ifdef CONFIG_PM_SLEEP | ||
28 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; | ||
29 | #endif | ||
30 | |||
31 | static int acpi_sleep_prepare(u32 acpi_state) | 27 | static int acpi_sleep_prepare(u32 acpi_state) |
32 | { | 28 | { |
33 | #ifdef CONFIG_ACPI_SLEEP | 29 | #ifdef CONFIG_ACPI_SLEEP |
@@ -49,9 +45,96 @@ static int acpi_sleep_prepare(u32 acpi_state) | |||
49 | return 0; | 45 | return 0; |
50 | } | 46 | } |
51 | 47 | ||
52 | #ifdef CONFIG_SUSPEND | 48 | #ifdef CONFIG_PM_SLEEP |
53 | static struct platform_suspend_ops acpi_suspend_ops; | 49 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; |
50 | |||
51 | /* | ||
52 | * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the | ||
53 | * user to request that behavior by using the 'acpi_old_suspend_ordering' | ||
54 | * kernel command line option that causes the following variable to be set. | ||
55 | */ | ||
56 | static bool old_suspend_ordering; | ||
54 | 57 | ||
58 | void __init acpi_old_suspend_ordering(void) | ||
59 | { | ||
60 | old_suspend_ordering = true; | ||
61 | } | ||
62 | |||
63 | /** | ||
64 | * acpi_pm_disable_gpes - Disable the GPEs. | ||
65 | */ | ||
66 | static int acpi_pm_disable_gpes(void) | ||
67 | { | ||
68 | acpi_hw_disable_all_gpes(); | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | /** | ||
73 | * __acpi_pm_prepare - Prepare the platform to enter the target state. | ||
74 | * | ||
75 | * If necessary, set the firmware waking vector and do arch-specific | ||
76 | * nastiness to get the wakeup code to the waking vector. | ||
77 | */ | ||
78 | static int __acpi_pm_prepare(void) | ||
79 | { | ||
80 | int error = acpi_sleep_prepare(acpi_target_sleep_state); | ||
81 | |||
82 | if (error) | ||
83 | acpi_target_sleep_state = ACPI_STATE_S0; | ||
84 | return error; | ||
85 | } | ||
86 | |||
87 | /** | ||
88 | * acpi_pm_prepare - Prepare the platform to enter the target sleep | ||
89 | * state and disable the GPEs. | ||
90 | */ | ||
91 | static int acpi_pm_prepare(void) | ||
92 | { | ||
93 | int error = __acpi_pm_prepare(); | ||
94 | |||
95 | if (!error) | ||
96 | acpi_hw_disable_all_gpes(); | ||
97 | return error; | ||
98 | } | ||
99 | |||
100 | /** | ||
101 | * acpi_pm_finish - Instruct the platform to leave a sleep state. | ||
102 | * | ||
103 | * This is called after we wake back up (or if entering the sleep state | ||
104 | * failed). | ||
105 | */ | ||
106 | static void acpi_pm_finish(void) | ||
107 | { | ||
108 | u32 acpi_state = acpi_target_sleep_state; | ||
109 | |||
110 | if (acpi_state == ACPI_STATE_S0) | ||
111 | return; | ||
112 | |||
113 | printk(KERN_INFO PREFIX "Waking up from system sleep state S%d\n", | ||
114 | acpi_state); | ||
115 | acpi_disable_wakeup_device(acpi_state); | ||
116 | acpi_leave_sleep_state(acpi_state); | ||
117 | |||
118 | /* reset firmware waking vector */ | ||
119 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); | ||
120 | |||
121 | acpi_target_sleep_state = ACPI_STATE_S0; | ||
122 | } | ||
123 | |||
124 | /** | ||
125 | * acpi_pm_end - Finish up suspend sequence. | ||
126 | */ | ||
127 | static void acpi_pm_end(void) | ||
128 | { | ||
129 | /* | ||
130 | * This is necessary in case acpi_pm_finish() is not called during a | ||
131 | * failing transition to a sleep state. | ||
132 | */ | ||
133 | acpi_target_sleep_state = ACPI_STATE_S0; | ||
134 | } | ||
135 | #endif /* CONFIG_PM_SLEEP */ | ||
136 | |||
137 | #ifdef CONFIG_SUSPEND | ||
55 | extern void do_suspend_lowlevel(void); | 138 | extern void do_suspend_lowlevel(void); |
56 | 139 | ||
57 | static u32 acpi_suspend_states[] = { | 140 | static u32 acpi_suspend_states[] = { |
@@ -61,13 +144,10 @@ static u32 acpi_suspend_states[] = { | |||
61 | [PM_SUSPEND_MAX] = ACPI_STATE_S5 | 144 | [PM_SUSPEND_MAX] = ACPI_STATE_S5 |
62 | }; | 145 | }; |
63 | 146 | ||
64 | static int init_8259A_after_S1; | ||
65 | |||
66 | /** | 147 | /** |
67 | * acpi_suspend_begin - Set the target system sleep state to the state | 148 | * acpi_suspend_begin - Set the target system sleep state to the state |
68 | * associated with given @pm_state, if supported. | 149 | * associated with given @pm_state, if supported. |
69 | */ | 150 | */ |
70 | |||
71 | static int acpi_suspend_begin(suspend_state_t pm_state) | 151 | static int acpi_suspend_begin(suspend_state_t pm_state) |
72 | { | 152 | { |
73 | u32 acpi_state = acpi_suspend_states[pm_state]; | 153 | u32 acpi_state = acpi_suspend_states[pm_state]; |
@@ -84,25 +164,6 @@ static int acpi_suspend_begin(suspend_state_t pm_state) | |||
84 | } | 164 | } |
85 | 165 | ||
86 | /** | 166 | /** |
87 | * acpi_suspend_prepare - Do preliminary suspend work. | ||
88 | * | ||
89 | * If necessary, set the firmware waking vector and do arch-specific | ||
90 | * nastiness to get the wakeup code to the waking vector. | ||
91 | */ | ||
92 | |||
93 | static int acpi_suspend_prepare(void) | ||
94 | { | ||
95 | int error = acpi_sleep_prepare(acpi_target_sleep_state); | ||
96 | |||
97 | if (error) { | ||
98 | acpi_target_sleep_state = ACPI_STATE_S0; | ||
99 | return error; | ||
100 | } | ||
101 | |||
102 | return ACPI_SUCCESS(acpi_hw_disable_all_gpes()) ? 0 : -EFAULT; | ||
103 | } | ||
104 | |||
105 | /** | ||
106 | * acpi_suspend_enter - Actually enter a sleep state. | 167 | * acpi_suspend_enter - Actually enter a sleep state. |
107 | * @pm_state: ignored | 168 | * @pm_state: ignored |
108 | * | 169 | * |
@@ -110,7 +171,6 @@ static int acpi_suspend_prepare(void) | |||
110 | * assembly, which in turn call acpi_enter_sleep_state(). | 171 | * assembly, which in turn call acpi_enter_sleep_state(). |
111 | * It's unfortunate, but it works. Please fix if you're feeling frisky. | 172 | * It's unfortunate, but it works. Please fix if you're feeling frisky. |
112 | */ | 173 | */ |
113 | |||
114 | static int acpi_suspend_enter(suspend_state_t pm_state) | 174 | static int acpi_suspend_enter(suspend_state_t pm_state) |
115 | { | 175 | { |
116 | acpi_status status = AE_OK; | 176 | acpi_status status = AE_OK; |
@@ -167,46 +227,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
167 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | 227 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
168 | } | 228 | } |
169 | 229 | ||
170 | /** | ||
171 | * acpi_suspend_finish - Instruct the platform to leave a sleep state. | ||
172 | * | ||
173 | * This is called after we wake back up (or if entering the sleep state | ||
174 | * failed). | ||
175 | */ | ||
176 | |||
177 | static void acpi_suspend_finish(void) | ||
178 | { | ||
179 | u32 acpi_state = acpi_target_sleep_state; | ||
180 | |||
181 | acpi_disable_wakeup_device(acpi_state); | ||
182 | acpi_leave_sleep_state(acpi_state); | ||
183 | |||
184 | /* reset firmware waking vector */ | ||
185 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); | ||
186 | |||
187 | acpi_target_sleep_state = ACPI_STATE_S0; | ||
188 | |||
189 | #ifdef CONFIG_X86 | ||
190 | if (init_8259A_after_S1) { | ||
191 | printk("Broken toshiba laptop -> kicking interrupts\n"); | ||
192 | init_8259A(0); | ||
193 | } | ||
194 | #endif | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * acpi_suspend_end - Finish up suspend sequence. | ||
199 | */ | ||
200 | |||
201 | static void acpi_suspend_end(void) | ||
202 | { | ||
203 | /* | ||
204 | * This is necessary in case acpi_suspend_finish() is not called during a | ||
205 | * failing transition to a sleep state. | ||
206 | */ | ||
207 | acpi_target_sleep_state = ACPI_STATE_S0; | ||
208 | } | ||
209 | |||
210 | static int acpi_suspend_state_valid(suspend_state_t pm_state) | 230 | static int acpi_suspend_state_valid(suspend_state_t pm_state) |
211 | { | 231 | { |
212 | u32 acpi_state; | 232 | u32 acpi_state; |
@@ -226,30 +246,39 @@ static int acpi_suspend_state_valid(suspend_state_t pm_state) | |||
226 | static struct platform_suspend_ops acpi_suspend_ops = { | 246 | static struct platform_suspend_ops acpi_suspend_ops = { |
227 | .valid = acpi_suspend_state_valid, | 247 | .valid = acpi_suspend_state_valid, |
228 | .begin = acpi_suspend_begin, | 248 | .begin = acpi_suspend_begin, |
229 | .prepare = acpi_suspend_prepare, | 249 | .prepare = acpi_pm_prepare, |
230 | .enter = acpi_suspend_enter, | 250 | .enter = acpi_suspend_enter, |
231 | .finish = acpi_suspend_finish, | 251 | .finish = acpi_pm_finish, |
232 | .end = acpi_suspend_end, | 252 | .end = acpi_pm_end, |
233 | }; | 253 | }; |
234 | 254 | ||
235 | /* | 255 | /** |
236 | * Toshiba fails to preserve interrupts over S1, reinitialization | 256 | * acpi_suspend_begin_old - Set the target system sleep state to the |
237 | * of 8259 is needed after S1 resume. | 257 | * state associated with given @pm_state, if supported, and |
258 | * execute the _PTS control method. This function is used if the | ||
259 | * pre-ACPI 2.0 suspend ordering has been requested. | ||
238 | */ | 260 | */ |
239 | static int __init init_ints_after_s1(const struct dmi_system_id *d) | 261 | static int acpi_suspend_begin_old(suspend_state_t pm_state) |
240 | { | 262 | { |
241 | printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident); | 263 | int error = acpi_suspend_begin(pm_state); |
242 | init_8259A_after_S1 = 1; | 264 | |
243 | return 0; | 265 | if (!error) |
266 | error = __acpi_pm_prepare(); | ||
267 | return error; | ||
244 | } | 268 | } |
245 | 269 | ||
246 | static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | 270 | /* |
247 | { | 271 | * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has |
248 | .callback = init_ints_after_s1, | 272 | * been requested. |
249 | .ident = "Toshiba Satellite 4030cdt", | 273 | */ |
250 | .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),}, | 274 | static struct platform_suspend_ops acpi_suspend_ops_old = { |
251 | }, | 275 | .valid = acpi_suspend_state_valid, |
252 | {}, | 276 | .begin = acpi_suspend_begin_old, |
277 | .prepare = acpi_pm_disable_gpes, | ||
278 | .enter = acpi_suspend_enter, | ||
279 | .finish = acpi_pm_finish, | ||
280 | .end = acpi_pm_end, | ||
281 | .recover = acpi_pm_finish, | ||
253 | }; | 282 | }; |
254 | #endif /* CONFIG_SUSPEND */ | 283 | #endif /* CONFIG_SUSPEND */ |
255 | 284 | ||
@@ -257,22 +286,9 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | |||
257 | static int acpi_hibernation_begin(void) | 286 | static int acpi_hibernation_begin(void) |
258 | { | 287 | { |
259 | acpi_target_sleep_state = ACPI_STATE_S4; | 288 | acpi_target_sleep_state = ACPI_STATE_S4; |
260 | |||
261 | return 0; | 289 | return 0; |
262 | } | 290 | } |
263 | 291 | ||
264 | static int acpi_hibernation_prepare(void) | ||
265 | { | ||
266 | int error = acpi_sleep_prepare(ACPI_STATE_S4); | ||
267 | |||
268 | if (error) { | ||
269 | acpi_target_sleep_state = ACPI_STATE_S0; | ||
270 | return error; | ||
271 | } | ||
272 | |||
273 | return ACPI_SUCCESS(acpi_hw_disable_all_gpes()) ? 0 : -EFAULT; | ||
274 | } | ||
275 | |||
276 | static int acpi_hibernation_enter(void) | 292 | static int acpi_hibernation_enter(void) |
277 | { | 293 | { |
278 | acpi_status status = AE_OK; | 294 | acpi_status status = AE_OK; |
@@ -302,52 +318,55 @@ static void acpi_hibernation_leave(void) | |||
302 | acpi_leave_sleep_state_prep(ACPI_STATE_S4); | 318 | acpi_leave_sleep_state_prep(ACPI_STATE_S4); |
303 | } | 319 | } |
304 | 320 | ||
305 | static void acpi_hibernation_finish(void) | 321 | static void acpi_pm_enable_gpes(void) |
306 | { | 322 | { |
307 | acpi_disable_wakeup_device(ACPI_STATE_S4); | 323 | acpi_hw_enable_all_runtime_gpes(); |
308 | acpi_leave_sleep_state(ACPI_STATE_S4); | ||
309 | |||
310 | /* reset firmware waking vector */ | ||
311 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); | ||
312 | |||
313 | acpi_target_sleep_state = ACPI_STATE_S0; | ||
314 | } | 324 | } |
315 | 325 | ||
316 | static void acpi_hibernation_end(void) | 326 | static struct platform_hibernation_ops acpi_hibernation_ops = { |
317 | { | 327 | .begin = acpi_hibernation_begin, |
318 | /* | 328 | .end = acpi_pm_end, |
319 | * This is necessary in case acpi_hibernation_finish() is not called | 329 | .pre_snapshot = acpi_pm_prepare, |
320 | * during a failing transition to the sleep state. | 330 | .finish = acpi_pm_finish, |
321 | */ | 331 | .prepare = acpi_pm_prepare, |
322 | acpi_target_sleep_state = ACPI_STATE_S0; | 332 | .enter = acpi_hibernation_enter, |
323 | } | 333 | .leave = acpi_hibernation_leave, |
334 | .pre_restore = acpi_pm_disable_gpes, | ||
335 | .restore_cleanup = acpi_pm_enable_gpes, | ||
336 | }; | ||
324 | 337 | ||
325 | static int acpi_hibernation_pre_restore(void) | 338 | /** |
339 | * acpi_hibernation_begin_old - Set the target system sleep state to | ||
340 | * ACPI_STATE_S4 and execute the _PTS control method. This | ||
341 | * function is used if the pre-ACPI 2.0 suspend ordering has been | ||
342 | * requested. | ||
343 | */ | ||
344 | static int acpi_hibernation_begin_old(void) | ||
326 | { | 345 | { |
327 | acpi_status status; | 346 | int error = acpi_sleep_prepare(ACPI_STATE_S4); |
328 | |||
329 | status = acpi_hw_disable_all_gpes(); | ||
330 | |||
331 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | ||
332 | } | ||
333 | 347 | ||
334 | static void acpi_hibernation_restore_cleanup(void) | 348 | if (!error) |
335 | { | 349 | acpi_target_sleep_state = ACPI_STATE_S4; |
336 | acpi_hw_enable_all_runtime_gpes(); | 350 | return error; |
337 | } | 351 | } |
338 | 352 | ||
339 | static struct platform_hibernation_ops acpi_hibernation_ops = { | 353 | /* |
340 | .begin = acpi_hibernation_begin, | 354 | * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has |
341 | .end = acpi_hibernation_end, | 355 | * been requested. |
342 | .pre_snapshot = acpi_hibernation_prepare, | 356 | */ |
343 | .finish = acpi_hibernation_finish, | 357 | static struct platform_hibernation_ops acpi_hibernation_ops_old = { |
344 | .prepare = acpi_hibernation_prepare, | 358 | .begin = acpi_hibernation_begin_old, |
359 | .end = acpi_pm_end, | ||
360 | .pre_snapshot = acpi_pm_disable_gpes, | ||
361 | .finish = acpi_pm_finish, | ||
362 | .prepare = acpi_pm_disable_gpes, | ||
345 | .enter = acpi_hibernation_enter, | 363 | .enter = acpi_hibernation_enter, |
346 | .leave = acpi_hibernation_leave, | 364 | .leave = acpi_hibernation_leave, |
347 | .pre_restore = acpi_hibernation_pre_restore, | 365 | .pre_restore = acpi_pm_disable_gpes, |
348 | .restore_cleanup = acpi_hibernation_restore_cleanup, | 366 | .restore_cleanup = acpi_pm_enable_gpes, |
367 | .recover = acpi_pm_finish, | ||
349 | }; | 368 | }; |
350 | #endif /* CONFIG_HIBERNATION */ | 369 | #endif /* CONFIG_HIBERNATION */ |
351 | 370 | ||
352 | int acpi_suspend(u32 acpi_state) | 371 | int acpi_suspend(u32 acpi_state) |
353 | { | 372 | { |
@@ -368,8 +387,8 @@ int acpi_suspend(u32 acpi_state) | |||
368 | /** | 387 | /** |
369 | * acpi_pm_device_sleep_state - return preferred power state of ACPI device | 388 | * acpi_pm_device_sleep_state - return preferred power state of ACPI device |
370 | * in the system sleep state given by %acpi_target_sleep_state | 389 | * in the system sleep state given by %acpi_target_sleep_state |
371 | * @dev: device to examine | 390 | * @dev: device to examine; its driver model wakeup flags control |
372 | * @wake: if set, the device should be able to wake up the system | 391 | * whether it should be able to wake up the system |
373 | * @d_min_p: used to store the upper limit of allowed states range | 392 | * @d_min_p: used to store the upper limit of allowed states range |
374 | * Return value: preferred power state of the device on success, -ENODEV on | 393 | * Return value: preferred power state of the device on success, -ENODEV on |
375 | * failure (ie. if there's no 'struct acpi_device' for @dev) | 394 | * failure (ie. if there's no 'struct acpi_device' for @dev) |
@@ -387,7 +406,7 @@ int acpi_suspend(u32 acpi_state) | |||
387 | * via @wake. | 406 | * via @wake. |
388 | */ | 407 | */ |
389 | 408 | ||
390 | int acpi_pm_device_sleep_state(struct device *dev, int wake, int *d_min_p) | 409 | int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p) |
391 | { | 410 | { |
392 | acpi_handle handle = DEVICE_ACPI_HANDLE(dev); | 411 | acpi_handle handle = DEVICE_ACPI_HANDLE(dev); |
393 | struct acpi_device *adev; | 412 | struct acpi_device *adev; |
@@ -426,7 +445,7 @@ int acpi_pm_device_sleep_state(struct device *dev, int wake, int *d_min_p) | |||
426 | * can wake the system. _S0W may be valid, too. | 445 | * can wake the system. _S0W may be valid, too. |
427 | */ | 446 | */ |
428 | if (acpi_target_sleep_state == ACPI_STATE_S0 || | 447 | if (acpi_target_sleep_state == ACPI_STATE_S0 || |
429 | (wake && adev->wakeup.state.enabled && | 448 | (device_may_wakeup(dev) && adev->wakeup.state.enabled && |
430 | adev->wakeup.sleep_state <= acpi_target_sleep_state)) { | 449 | adev->wakeup.sleep_state <= acpi_target_sleep_state)) { |
431 | acpi_status status; | 450 | acpi_status status; |
432 | 451 | ||
@@ -448,6 +467,31 @@ int acpi_pm_device_sleep_state(struct device *dev, int wake, int *d_min_p) | |||
448 | *d_min_p = d_min; | 467 | *d_min_p = d_min; |
449 | return d_max; | 468 | return d_max; |
450 | } | 469 | } |
470 | |||
471 | /** | ||
472 | * acpi_pm_device_sleep_wake - enable or disable the system wake-up | ||
473 | * capability of given device | ||
474 | * @dev: device to handle | ||
475 | * @enable: 'true' - enable, 'false' - disable the wake-up capability | ||
476 | */ | ||
477 | int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | ||
478 | { | ||
479 | acpi_handle handle; | ||
480 | struct acpi_device *adev; | ||
481 | |||
482 | if (!device_may_wakeup(dev)) | ||
483 | return -EINVAL; | ||
484 | |||
485 | handle = DEVICE_ACPI_HANDLE(dev); | ||
486 | if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { | ||
487 | printk(KERN_DEBUG "ACPI handle has no context!\n"); | ||
488 | return -ENODEV; | ||
489 | } | ||
490 | |||
491 | return enable ? | ||
492 | acpi_enable_wakeup_device_power(adev, acpi_target_sleep_state) : | ||
493 | acpi_disable_wakeup_device_power(adev); | ||
494 | } | ||
451 | #endif | 495 | #endif |
452 | 496 | ||
453 | static void acpi_power_off_prepare(void) | 497 | static void acpi_power_off_prepare(void) |
@@ -472,8 +516,6 @@ int __init acpi_sleep_init(void) | |||
472 | u8 type_a, type_b; | 516 | u8 type_a, type_b; |
473 | #ifdef CONFIG_SUSPEND | 517 | #ifdef CONFIG_SUSPEND |
474 | int i = 0; | 518 | int i = 0; |
475 | |||
476 | dmi_check_system(acpisleep_dmi_table); | ||
477 | #endif | 519 | #endif |
478 | 520 | ||
479 | if (acpi_disabled) | 521 | if (acpi_disabled) |
@@ -491,13 +533,15 @@ int __init acpi_sleep_init(void) | |||
491 | } | 533 | } |
492 | } | 534 | } |
493 | 535 | ||
494 | suspend_set_ops(&acpi_suspend_ops); | 536 | suspend_set_ops(old_suspend_ordering ? |
537 | &acpi_suspend_ops_old : &acpi_suspend_ops); | ||
495 | #endif | 538 | #endif |
496 | 539 | ||
497 | #ifdef CONFIG_HIBERNATION | 540 | #ifdef CONFIG_HIBERNATION |
498 | status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b); | 541 | status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b); |
499 | if (ACPI_SUCCESS(status)) { | 542 | if (ACPI_SUCCESS(status)) { |
500 | hibernation_set_ops(&acpi_hibernation_ops); | 543 | hibernation_set_ops(old_suspend_ordering ? |
544 | &acpi_hibernation_ops_old : &acpi_hibernation_ops); | ||
501 | sleep_states[ACPI_STATE_S4] = 1; | 545 | sleep_states[ACPI_STATE_S4] = 1; |
502 | printk(" S4"); | 546 | printk(" S4"); |
503 | } | 547 | } |
diff --git a/drivers/acpi/sleep/wakeup.c b/drivers/acpi/sleep/wakeup.c index ed8e41becf0c..38655eb132dc 100644 --- a/drivers/acpi/sleep/wakeup.c +++ b/drivers/acpi/sleep/wakeup.c | |||
@@ -42,7 +42,7 @@ void acpi_enable_wakeup_device_prep(u8 sleep_state) | |||
42 | continue; | 42 | continue; |
43 | 43 | ||
44 | spin_unlock(&acpi_device_lock); | 44 | spin_unlock(&acpi_device_lock); |
45 | acpi_enable_wakeup_device_power(dev); | 45 | acpi_enable_wakeup_device_power(dev, sleep_state); |
46 | spin_lock(&acpi_device_lock); | 46 | spin_lock(&acpi_device_lock); |
47 | } | 47 | } |
48 | spin_unlock(&acpi_device_lock); | 48 | spin_unlock(&acpi_device_lock); |
@@ -66,13 +66,15 @@ void acpi_enable_wakeup_device(u8 sleep_state) | |||
66 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 66 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
67 | struct acpi_device *dev = | 67 | struct acpi_device *dev = |
68 | container_of(node, struct acpi_device, wakeup_list); | 68 | container_of(node, struct acpi_device, wakeup_list); |
69 | |||
69 | if (!dev->wakeup.flags.valid) | 70 | if (!dev->wakeup.flags.valid) |
70 | continue; | 71 | continue; |
72 | |||
71 | /* If users want to disable run-wake GPE, | 73 | /* If users want to disable run-wake GPE, |
72 | * we only disable it for wake and leave it for runtime | 74 | * we only disable it for wake and leave it for runtime |
73 | */ | 75 | */ |
74 | if (!dev->wakeup.state.enabled || | 76 | if ((!dev->wakeup.state.enabled && !dev->wakeup.flags.prepared) |
75 | sleep_state > (u32) dev->wakeup.sleep_state) { | 77 | || sleep_state > (u32) dev->wakeup.sleep_state) { |
76 | if (dev->wakeup.flags.run_wake) { | 78 | if (dev->wakeup.flags.run_wake) { |
77 | spin_unlock(&acpi_device_lock); | 79 | spin_unlock(&acpi_device_lock); |
78 | /* set_gpe_type will disable GPE, leave it like that */ | 80 | /* set_gpe_type will disable GPE, leave it like that */ |
@@ -110,8 +112,9 @@ void acpi_disable_wakeup_device(u8 sleep_state) | |||
110 | 112 | ||
111 | if (!dev->wakeup.flags.valid) | 113 | if (!dev->wakeup.flags.valid) |
112 | continue; | 114 | continue; |
113 | if (!dev->wakeup.state.enabled || | 115 | |
114 | sleep_state > (u32) dev->wakeup.sleep_state) { | 116 | if ((!dev->wakeup.state.enabled && !dev->wakeup.flags.prepared) |
117 | || sleep_state > (u32) dev->wakeup.sleep_state) { | ||
115 | if (dev->wakeup.flags.run_wake) { | 118 | if (dev->wakeup.flags.run_wake) { |
116 | spin_unlock(&acpi_device_lock); | 119 | spin_unlock(&acpi_device_lock); |
117 | acpi_set_gpe_type(dev->wakeup.gpe_device, | 120 | acpi_set_gpe_type(dev->wakeup.gpe_device, |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 5bd2dec9a7ac..d8e3f153b295 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -167,7 +167,13 @@ static int acpi_system_sysfs_init(void) | |||
167 | #define COUNT_ERROR 2 /* other */ | 167 | #define COUNT_ERROR 2 /* other */ |
168 | #define NUM_COUNTERS_EXTRA 3 | 168 | #define NUM_COUNTERS_EXTRA 3 |
169 | 169 | ||
170 | static u32 *all_counters; | 170 | #define ACPI_EVENT_VALID 0x01 |
171 | struct event_counter { | ||
172 | u32 count; | ||
173 | u32 flags; | ||
174 | }; | ||
175 | |||
176 | static struct event_counter *all_counters; | ||
171 | static u32 num_gpes; | 177 | static u32 num_gpes; |
172 | static u32 num_counters; | 178 | static u32 num_counters; |
173 | static struct attribute **all_attrs; | 179 | static struct attribute **all_attrs; |
@@ -202,9 +208,44 @@ static int count_num_gpes(void) | |||
202 | return count; | 208 | return count; |
203 | } | 209 | } |
204 | 210 | ||
211 | static int get_gpe_device(int index, acpi_handle *handle) | ||
212 | { | ||
213 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | ||
214 | struct acpi_gpe_block_info *gpe_block; | ||
215 | acpi_cpu_flags flags; | ||
216 | struct acpi_namespace_node *node; | ||
217 | |||
218 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | ||
219 | |||
220 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; | ||
221 | while (gpe_xrupt_info) { | ||
222 | gpe_block = gpe_xrupt_info->gpe_block_list_head; | ||
223 | node = gpe_block->node; | ||
224 | while (gpe_block) { | ||
225 | index -= gpe_block->register_count * | ||
226 | ACPI_GPE_REGISTER_WIDTH; | ||
227 | if (index < 0) { | ||
228 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
229 | /* return NULL if it's FADT GPE */ | ||
230 | if (node->type != ACPI_TYPE_DEVICE) | ||
231 | *handle = NULL; | ||
232 | else | ||
233 | *handle = node; | ||
234 | return 0; | ||
235 | } | ||
236 | node = gpe_block->node; | ||
237 | gpe_block = gpe_block->next; | ||
238 | } | ||
239 | gpe_xrupt_info = gpe_xrupt_info->next; | ||
240 | } | ||
241 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
242 | |||
243 | return -ENODEV; | ||
244 | } | ||
245 | |||
205 | static void delete_gpe_attr_array(void) | 246 | static void delete_gpe_attr_array(void) |
206 | { | 247 | { |
207 | u32 *tmp = all_counters; | 248 | struct event_counter *tmp = all_counters; |
208 | 249 | ||
209 | all_counters = NULL; | 250 | all_counters = NULL; |
210 | kfree(tmp); | 251 | kfree(tmp); |
@@ -230,9 +271,10 @@ void acpi_os_gpe_count(u32 gpe_number) | |||
230 | return; | 271 | return; |
231 | 272 | ||
232 | if (gpe_number < num_gpes) | 273 | if (gpe_number < num_gpes) |
233 | all_counters[gpe_number]++; | 274 | all_counters[gpe_number].count++; |
234 | else | 275 | else |
235 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR]++; | 276 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR]. |
277 | count++; | ||
236 | 278 | ||
237 | return; | 279 | return; |
238 | } | 280 | } |
@@ -243,44 +285,144 @@ void acpi_os_fixed_event_count(u32 event_number) | |||
243 | return; | 285 | return; |
244 | 286 | ||
245 | if (event_number < ACPI_NUM_FIXED_EVENTS) | 287 | if (event_number < ACPI_NUM_FIXED_EVENTS) |
246 | all_counters[num_gpes + event_number]++; | 288 | all_counters[num_gpes + event_number].count++; |
247 | else | 289 | else |
248 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR]++; | 290 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR]. |
291 | count++; | ||
249 | 292 | ||
250 | return; | 293 | return; |
251 | } | 294 | } |
252 | 295 | ||
296 | static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle) | ||
297 | { | ||
298 | int result = 0; | ||
299 | |||
300 | if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS) | ||
301 | goto end; | ||
302 | |||
303 | if (index < num_gpes) { | ||
304 | result = get_gpe_device(index, handle); | ||
305 | if (result) { | ||
306 | ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, | ||
307 | "Invalid GPE 0x%x\n", index)); | ||
308 | goto end; | ||
309 | } | ||
310 | result = acpi_get_gpe_status(*handle, index, | ||
311 | ACPI_NOT_ISR, status); | ||
312 | } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS)) | ||
313 | result = acpi_get_event_status(index - num_gpes, status); | ||
314 | |||
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: | ||
322 | return result; | ||
323 | } | ||
324 | |||
253 | static ssize_t counter_show(struct kobject *kobj, | 325 | static ssize_t counter_show(struct kobject *kobj, |
254 | struct kobj_attribute *attr, char *buf) | 326 | struct kobj_attribute *attr, char *buf) |
255 | { | 327 | { |
256 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI] = | 328 | int index = attr - counter_attrs; |
329 | int size; | ||
330 | acpi_handle handle; | ||
331 | acpi_event_status status; | ||
332 | int result = 0; | ||
333 | |||
334 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI].count = | ||
257 | acpi_irq_handled; | 335 | acpi_irq_handled; |
258 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE] = | 336 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = |
259 | acpi_gpe_count; | 337 | acpi_gpe_count; |
260 | 338 | ||
261 | return sprintf(buf, "%d\n", all_counters[attr - counter_attrs]); | 339 | size = sprintf(buf, "%8d", all_counters[index].count); |
340 | |||
341 | /* "gpe_all" or "sci" */ | ||
342 | if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS) | ||
343 | goto end; | ||
344 | |||
345 | result = get_status(index, &status, &handle); | ||
346 | if (result) | ||
347 | goto end; | ||
348 | |||
349 | if (!(all_counters[index].flags & ACPI_EVENT_VALID)) | ||
350 | size += sprintf(buf + size, " invalid"); | ||
351 | else if (status & ACPI_EVENT_FLAG_ENABLED) | ||
352 | size += sprintf(buf + size, " enable"); | ||
353 | else | ||
354 | size += sprintf(buf + size, " disable"); | ||
355 | |||
356 | end: | ||
357 | size += sprintf(buf + size, "\n"); | ||
358 | return result ? result : size; | ||
262 | } | 359 | } |
263 | 360 | ||
264 | /* | 361 | /* |
265 | * counter_set() sets the specified counter. | 362 | * counter_set() sets the specified counter. |
266 | * setting the total "sci" file to any value clears all counters. | 363 | * setting the total "sci" file to any value clears all counters. |
364 | * enable/disable/clear a gpe/fixed event in user space. | ||
267 | */ | 365 | */ |
268 | static ssize_t counter_set(struct kobject *kobj, | 366 | static ssize_t counter_set(struct kobject *kobj, |
269 | struct kobj_attribute *attr, const char *buf, size_t size) | 367 | struct kobj_attribute *attr, const char *buf, size_t size) |
270 | { | 368 | { |
271 | int index = attr - counter_attrs; | 369 | int index = attr - counter_attrs; |
370 | acpi_event_status status; | ||
371 | acpi_handle handle; | ||
372 | int result = 0; | ||
272 | 373 | ||
273 | if (index == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) { | 374 | if (index == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) { |
274 | int i; | 375 | int i; |
275 | for (i = 0; i < num_counters; ++i) | 376 | for (i = 0; i < num_counters; ++i) |
276 | all_counters[i] = 0; | 377 | all_counters[i].count = 0; |
277 | acpi_gpe_count = 0; | 378 | acpi_gpe_count = 0; |
278 | acpi_irq_handled = 0; | 379 | acpi_irq_handled = 0; |
380 | goto end; | ||
381 | } | ||
279 | 382 | ||
383 | /* show the event status for both GPEs and Fixed Events */ | ||
384 | result = get_status(index, &status, &handle); | ||
385 | if (result) | ||
386 | goto end; | ||
387 | |||
388 | if (!(all_counters[index].flags & ACPI_EVENT_VALID)) { | ||
389 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | ||
390 | "Can not change Invalid GPE/Fixed Event status\n")); | ||
391 | return -EINVAL; | ||
392 | } | ||
393 | |||
394 | if (index < num_gpes) { | ||
395 | if (!strcmp(buf, "disable\n") && | ||
396 | (status & ACPI_EVENT_FLAG_ENABLED)) | ||
397 | result = acpi_disable_gpe(handle, index, ACPI_NOT_ISR); | ||
398 | else if (!strcmp(buf, "enable\n") && | ||
399 | !(status & ACPI_EVENT_FLAG_ENABLED)) | ||
400 | result = acpi_enable_gpe(handle, index, ACPI_NOT_ISR); | ||
401 | else if (!strcmp(buf, "clear\n") && | ||
402 | (status & ACPI_EVENT_FLAG_SET)) | ||
403 | result = acpi_clear_gpe(handle, index, ACPI_NOT_ISR); | ||
404 | else | ||
405 | all_counters[index].count = strtoul(buf, NULL, 0); | ||
406 | } else if (index < num_gpes + ACPI_NUM_FIXED_EVENTS) { | ||
407 | int event = index - num_gpes; | ||
408 | if (!strcmp(buf, "disable\n") && | ||
409 | (status & ACPI_EVENT_FLAG_ENABLED)) | ||
410 | result = acpi_disable_event(event, ACPI_NOT_ISR); | ||
411 | else if (!strcmp(buf, "enable\n") && | ||
412 | !(status & ACPI_EVENT_FLAG_ENABLED)) | ||
413 | result = acpi_enable_event(event, ACPI_NOT_ISR); | ||
414 | else if (!strcmp(buf, "clear\n") && | ||
415 | (status & ACPI_EVENT_FLAG_SET)) | ||
416 | result = acpi_clear_event(event); | ||
417 | else | ||
418 | all_counters[index].count = strtoul(buf, NULL, 0); | ||
280 | } else | 419 | } else |
281 | all_counters[index] = strtoul(buf, NULL, 0); | 420 | all_counters[index].count = strtoul(buf, NULL, 0); |
282 | 421 | ||
283 | return size; | 422 | if (ACPI_FAILURE(result)) |
423 | result = -EINVAL; | ||
424 | end: | ||
425 | return result ? result : size; | ||
284 | } | 426 | } |
285 | 427 | ||
286 | void acpi_irq_stats_init(void) | 428 | void acpi_irq_stats_init(void) |
@@ -298,7 +440,8 @@ void acpi_irq_stats_init(void) | |||
298 | if (all_attrs == NULL) | 440 | if (all_attrs == NULL) |
299 | return; | 441 | return; |
300 | 442 | ||
301 | all_counters = kzalloc(sizeof(u32) * (num_counters), GFP_KERNEL); | 443 | all_counters = kzalloc(sizeof(struct event_counter) * (num_counters), |
444 | GFP_KERNEL); | ||
302 | if (all_counters == NULL) | 445 | if (all_counters == NULL) |
303 | goto fail; | 446 | goto fail; |
304 | 447 | ||
diff --git a/drivers/acpi/tables/tbfadt.c b/drivers/acpi/tables/tbfadt.c index 949d4114eb9f..ccb5b64bbef3 100644 --- a/drivers/acpi/tables/tbfadt.c +++ b/drivers/acpi/tables/tbfadt.c | |||
@@ -124,7 +124,7 @@ static struct acpi_fadt_info fadt_info_table[] = { | |||
124 | 124 | ||
125 | static void inline | 125 | static void inline |
126 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | 126 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, |
127 | u8 bit_width, u64 address) | 127 | u8 byte_width, u64 address) |
128 | { | 128 | { |
129 | 129 | ||
130 | /* | 130 | /* |
@@ -136,7 +136,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | |||
136 | /* All other fields are byte-wide */ | 136 | /* All other fields are byte-wide */ |
137 | 137 | ||
138 | generic_address->space_id = ACPI_ADR_SPACE_SYSTEM_IO; | 138 | generic_address->space_id = ACPI_ADR_SPACE_SYSTEM_IO; |
139 | generic_address->bit_width = bit_width; | 139 | generic_address->bit_width = byte_width << 3; |
140 | generic_address->bit_offset = 0; | 140 | generic_address->bit_offset = 0; |
141 | generic_address->access_width = 0; | 141 | generic_address->access_width = 0; |
142 | } | 142 | } |
@@ -155,7 +155,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | |||
155 | * | 155 | * |
156 | ******************************************************************************/ | 156 | ******************************************************************************/ |
157 | 157 | ||
158 | void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags) | 158 | void acpi_tb_parse_fadt(u32 table_index, u8 flags) |
159 | { | 159 | { |
160 | u32 length; | 160 | u32 length; |
161 | struct acpi_table_header *table; | 161 | struct acpi_table_header *table; |
@@ -280,7 +280,7 @@ static void acpi_tb_convert_fadt(void) | |||
280 | { | 280 | { |
281 | u8 pm1_register_length; | 281 | u8 pm1_register_length; |
282 | struct acpi_generic_address *target; | 282 | struct acpi_generic_address *target; |
283 | acpi_native_uint i; | 283 | u32 i; |
284 | 284 | ||
285 | /* Update the local FADT table header length */ | 285 | /* Update the local FADT table header length */ |
286 | 286 | ||
@@ -343,9 +343,11 @@ static void acpi_tb_convert_fadt(void) | |||
343 | * | 343 | * |
344 | * The PM event blocks are split into two register blocks, first is the | 344 | * The PM event blocks are split into two register blocks, first is the |
345 | * PM Status Register block, followed immediately by the PM Enable Register | 345 | * PM Status Register block, followed immediately by the PM Enable Register |
346 | * block. Each is of length (pm1_event_length/2) | 346 | * block. Each is of length (xpm1x_event_block.bit_width/2) |
347 | */ | 347 | */ |
348 | pm1_register_length = (u8) ACPI_DIV_2(acpi_gbl_FADT.pm1_event_length); | 348 | WARN_ON(ACPI_MOD_16(acpi_gbl_FADT.xpm1a_event_block.bit_width)); |
349 | pm1_register_length = (u8) ACPI_DIV_16(acpi_gbl_FADT | ||
350 | .xpm1a_event_block.bit_width); | ||
349 | 351 | ||
350 | /* The PM1A register block is required */ | 352 | /* The PM1A register block is required */ |
351 | 353 | ||
@@ -360,14 +362,17 @@ static void acpi_tb_convert_fadt(void) | |||
360 | /* The PM1B register block is optional, ignore if not present */ | 362 | /* The PM1B register block is optional, ignore if not present */ |
361 | 363 | ||
362 | if (acpi_gbl_FADT.xpm1b_event_block.address) { | 364 | if (acpi_gbl_FADT.xpm1b_event_block.address) { |
365 | WARN_ON(ACPI_MOD_16(acpi_gbl_FADT.xpm1b_event_block.bit_width)); | ||
366 | pm1_register_length = (u8) ACPI_DIV_16(acpi_gbl_FADT | ||
367 | .xpm1b_event_block | ||
368 | .bit_width); | ||
363 | acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable, | 369 | acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable, |
364 | pm1_register_length, | 370 | pm1_register_length, |
365 | (acpi_gbl_FADT.xpm1b_event_block. | 371 | (acpi_gbl_FADT.xpm1b_event_block. |
366 | address + pm1_register_length)); | 372 | address + pm1_register_length)); |
367 | /* Don't forget to copy space_id of the GAS */ | 373 | /* Don't forget to copy space_id of the GAS */ |
368 | acpi_gbl_xpm1b_enable.space_id = | 374 | acpi_gbl_xpm1b_enable.space_id = |
369 | acpi_gbl_FADT.xpm1a_event_block.space_id; | 375 | acpi_gbl_FADT.xpm1b_event_block.space_id; |
370 | |||
371 | } | 376 | } |
372 | } | 377 | } |
373 | 378 | ||
@@ -396,7 +401,7 @@ static void acpi_tb_validate_fadt(void) | |||
396 | u32 *address32; | 401 | u32 *address32; |
397 | struct acpi_generic_address *address64; | 402 | struct acpi_generic_address *address64; |
398 | u8 length; | 403 | u8 length; |
399 | acpi_native_uint i; | 404 | u32 i; |
400 | 405 | ||
401 | /* Examine all of the 64-bit extended address fields (X fields) */ | 406 | /* Examine all of the 64-bit extended address fields (X fields) */ |
402 | 407 | ||
diff --git a/drivers/acpi/tables/tbfind.c b/drivers/acpi/tables/tbfind.c index 9ca3afc98c80..531584defbb8 100644 --- a/drivers/acpi/tables/tbfind.c +++ b/drivers/acpi/tables/tbfind.c | |||
@@ -65,10 +65,9 @@ ACPI_MODULE_NAME("tbfind") | |||
65 | ******************************************************************************/ | 65 | ******************************************************************************/ |
66 | acpi_status | 66 | acpi_status |
67 | acpi_tb_find_table(char *signature, | 67 | acpi_tb_find_table(char *signature, |
68 | char *oem_id, | 68 | char *oem_id, char *oem_table_id, u32 *table_index) |
69 | char *oem_table_id, acpi_native_uint * table_index) | ||
70 | { | 69 | { |
71 | acpi_native_uint i; | 70 | u32 i; |
72 | acpi_status status; | 71 | acpi_status status; |
73 | struct acpi_table_header header; | 72 | struct acpi_table_header header; |
74 | 73 | ||
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 5336ce88f89f..b22185f55a16 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c | |||
@@ -107,11 +107,10 @@ acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc) | |||
107 | ******************************************************************************/ | 107 | ******************************************************************************/ |
108 | 108 | ||
109 | acpi_status | 109 | acpi_status |
110 | acpi_tb_add_table(struct acpi_table_desc *table_desc, | 110 | acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) |
111 | acpi_native_uint * table_index) | ||
112 | { | 111 | { |
113 | acpi_native_uint i; | 112 | u32 i; |
114 | acpi_native_uint length; | 113 | u32 length; |
115 | acpi_status status = AE_OK; | 114 | acpi_status status = AE_OK; |
116 | 115 | ||
117 | ACPI_FUNCTION_TRACE(tb_add_table); | 116 | ACPI_FUNCTION_TRACE(tb_add_table); |
@@ -207,8 +206,8 @@ acpi_status acpi_tb_resize_root_table_list(void) | |||
207 | 206 | ||
208 | /* Increase the Table Array size */ | 207 | /* Increase the Table Array size */ |
209 | 208 | ||
210 | tables = ACPI_ALLOCATE_ZEROED((acpi_gbl_root_table_list.size + | 209 | tables = ACPI_ALLOCATE_ZEROED(((acpi_size) acpi_gbl_root_table_list. |
211 | ACPI_ROOT_TABLE_SIZE_INCREMENT) | 210 | size + ACPI_ROOT_TABLE_SIZE_INCREMENT) |
212 | * sizeof(struct acpi_table_desc)); | 211 | * sizeof(struct acpi_table_desc)); |
213 | if (!tables) { | 212 | if (!tables) { |
214 | ACPI_ERROR((AE_INFO, | 213 | ACPI_ERROR((AE_INFO, |
@@ -220,7 +219,7 @@ acpi_status acpi_tb_resize_root_table_list(void) | |||
220 | 219 | ||
221 | if (acpi_gbl_root_table_list.tables) { | 220 | if (acpi_gbl_root_table_list.tables) { |
222 | ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, | 221 | ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, |
223 | acpi_gbl_root_table_list.size * | 222 | (acpi_size) acpi_gbl_root_table_list.size * |
224 | sizeof(struct acpi_table_desc)); | 223 | sizeof(struct acpi_table_desc)); |
225 | 224 | ||
226 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { | 225 | if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { |
@@ -253,7 +252,7 @@ acpi_status acpi_tb_resize_root_table_list(void) | |||
253 | acpi_status | 252 | acpi_status |
254 | acpi_tb_store_table(acpi_physical_address address, | 253 | acpi_tb_store_table(acpi_physical_address address, |
255 | struct acpi_table_header *table, | 254 | struct acpi_table_header *table, |
256 | u32 length, u8 flags, acpi_native_uint * table_index) | 255 | u32 length, u8 flags, u32 *table_index) |
257 | { | 256 | { |
258 | acpi_status status = AE_OK; | 257 | acpi_status status = AE_OK; |
259 | 258 | ||
@@ -334,7 +333,7 @@ void acpi_tb_delete_table(struct acpi_table_desc *table_desc) | |||
334 | 333 | ||
335 | void acpi_tb_terminate(void) | 334 | void acpi_tb_terminate(void) |
336 | { | 335 | { |
337 | acpi_native_uint i; | 336 | u32 i; |
338 | 337 | ||
339 | ACPI_FUNCTION_TRACE(tb_terminate); | 338 | ACPI_FUNCTION_TRACE(tb_terminate); |
340 | 339 | ||
@@ -374,7 +373,7 @@ void acpi_tb_terminate(void) | |||
374 | * | 373 | * |
375 | ******************************************************************************/ | 374 | ******************************************************************************/ |
376 | 375 | ||
377 | void acpi_tb_delete_namespace_by_owner(acpi_native_uint table_index) | 376 | void acpi_tb_delete_namespace_by_owner(u32 table_index) |
378 | { | 377 | { |
379 | acpi_owner_id owner_id; | 378 | acpi_owner_id owner_id; |
380 | 379 | ||
@@ -403,7 +402,7 @@ void acpi_tb_delete_namespace_by_owner(acpi_native_uint table_index) | |||
403 | * | 402 | * |
404 | ******************************************************************************/ | 403 | ******************************************************************************/ |
405 | 404 | ||
406 | acpi_status acpi_tb_allocate_owner_id(acpi_native_uint table_index) | 405 | acpi_status acpi_tb_allocate_owner_id(u32 table_index) |
407 | { | 406 | { |
408 | acpi_status status = AE_BAD_PARAMETER; | 407 | acpi_status status = AE_BAD_PARAMETER; |
409 | 408 | ||
@@ -431,7 +430,7 @@ acpi_status acpi_tb_allocate_owner_id(acpi_native_uint table_index) | |||
431 | * | 430 | * |
432 | ******************************************************************************/ | 431 | ******************************************************************************/ |
433 | 432 | ||
434 | acpi_status acpi_tb_release_owner_id(acpi_native_uint table_index) | 433 | acpi_status acpi_tb_release_owner_id(u32 table_index) |
435 | { | 434 | { |
436 | acpi_status status = AE_BAD_PARAMETER; | 435 | acpi_status status = AE_BAD_PARAMETER; |
437 | 436 | ||
@@ -462,8 +461,7 @@ acpi_status acpi_tb_release_owner_id(acpi_native_uint table_index) | |||
462 | * | 461 | * |
463 | ******************************************************************************/ | 462 | ******************************************************************************/ |
464 | 463 | ||
465 | acpi_status | 464 | acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id) |
466 | acpi_tb_get_owner_id(acpi_native_uint table_index, acpi_owner_id * owner_id) | ||
467 | { | 465 | { |
468 | acpi_status status = AE_BAD_PARAMETER; | 466 | acpi_status status = AE_BAD_PARAMETER; |
469 | 467 | ||
@@ -490,7 +488,7 @@ acpi_tb_get_owner_id(acpi_native_uint table_index, acpi_owner_id * owner_id) | |||
490 | * | 488 | * |
491 | ******************************************************************************/ | 489 | ******************************************************************************/ |
492 | 490 | ||
493 | u8 acpi_tb_is_table_loaded(acpi_native_uint table_index) | 491 | u8 acpi_tb_is_table_loaded(u32 table_index) |
494 | { | 492 | { |
495 | u8 is_loaded = FALSE; | 493 | u8 is_loaded = FALSE; |
496 | 494 | ||
@@ -518,7 +516,7 @@ u8 acpi_tb_is_table_loaded(acpi_native_uint table_index) | |||
518 | * | 516 | * |
519 | ******************************************************************************/ | 517 | ******************************************************************************/ |
520 | 518 | ||
521 | void acpi_tb_set_table_loaded_flag(acpi_native_uint table_index, u8 is_loaded) | 519 | void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded) |
522 | { | 520 | { |
523 | 521 | ||
524 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | 522 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index bc019b9b6a68..0cc92ef5236f 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -49,8 +49,8 @@ ACPI_MODULE_NAME("tbutils") | |||
49 | 49 | ||
50 | /* Local prototypes */ | 50 | /* Local prototypes */ |
51 | static acpi_physical_address | 51 | static acpi_physical_address |
52 | acpi_tb_get_root_table_entry(u8 * table_entry, | 52 | acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size); |
53 | acpi_native_uint table_entry_size); | 53 | |
54 | /******************************************************************************* | 54 | /******************************************************************************* |
55 | * | 55 | * |
56 | * FUNCTION: acpi_tb_check_xsdt | 56 | * FUNCTION: acpi_tb_check_xsdt |
@@ -238,7 +238,7 @@ acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length) | |||
238 | * | 238 | * |
239 | ******************************************************************************/ | 239 | ******************************************************************************/ |
240 | 240 | ||
241 | u8 acpi_tb_checksum(u8 * buffer, acpi_native_uint length) | 241 | u8 acpi_tb_checksum(u8 *buffer, u32 length) |
242 | { | 242 | { |
243 | u8 sum = 0; | 243 | u8 sum = 0; |
244 | u8 *end = buffer + length; | 244 | u8 *end = buffer + length; |
@@ -268,7 +268,7 @@ u8 acpi_tb_checksum(u8 * buffer, acpi_native_uint length) | |||
268 | 268 | ||
269 | void | 269 | void |
270 | acpi_tb_install_table(acpi_physical_address address, | 270 | acpi_tb_install_table(acpi_physical_address address, |
271 | u8 flags, char *signature, acpi_native_uint table_index) | 271 | u8 flags, char *signature, u32 table_index) |
272 | { | 272 | { |
273 | struct acpi_table_header *table; | 273 | struct acpi_table_header *table; |
274 | 274 | ||
@@ -336,8 +336,7 @@ acpi_tb_install_table(acpi_physical_address address, | |||
336 | ******************************************************************************/ | 336 | ******************************************************************************/ |
337 | 337 | ||
338 | static acpi_physical_address | 338 | static acpi_physical_address |
339 | acpi_tb_get_root_table_entry(u8 * table_entry, | 339 | acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size) |
340 | acpi_native_uint table_entry_size) | ||
341 | { | 340 | { |
342 | u64 address64; | 341 | u64 address64; |
343 | 342 | ||
@@ -395,8 +394,8 @@ acpi_status __init | |||
395 | acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) | 394 | acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) |
396 | { | 395 | { |
397 | struct acpi_table_rsdp *rsdp; | 396 | struct acpi_table_rsdp *rsdp; |
398 | acpi_native_uint table_entry_size; | 397 | u32 table_entry_size; |
399 | acpi_native_uint i; | 398 | u32 i; |
400 | u32 table_count; | 399 | u32 table_count; |
401 | struct acpi_table_header *table; | 400 | struct acpi_table_header *table; |
402 | acpi_physical_address address; | 401 | acpi_physical_address address; |
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 0e319604d3e7..fd7770aa1061 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c | |||
@@ -125,7 +125,7 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array, | |||
125 | /* Root Table Array has been statically allocated by the host */ | 125 | /* Root Table Array has been statically allocated by the host */ |
126 | 126 | ||
127 | ACPI_MEMSET(initial_table_array, 0, | 127 | ACPI_MEMSET(initial_table_array, 0, |
128 | initial_table_count * | 128 | (acpi_size) initial_table_count * |
129 | sizeof(struct acpi_table_desc)); | 129 | sizeof(struct acpi_table_desc)); |
130 | 130 | ||
131 | acpi_gbl_root_table_list.tables = initial_table_array; | 131 | acpi_gbl_root_table_list.tables = initial_table_array; |
@@ -183,9 +183,9 @@ acpi_status acpi_reallocate_root_table(void) | |||
183 | return_ACPI_STATUS(AE_SUPPORT); | 183 | return_ACPI_STATUS(AE_SUPPORT); |
184 | } | 184 | } |
185 | 185 | ||
186 | new_size = | 186 | new_size = ((acpi_size) acpi_gbl_root_table_list.count + |
187 | (acpi_gbl_root_table_list.count + | 187 | ACPI_ROOT_TABLE_SIZE_INCREMENT) * |
188 | ACPI_ROOT_TABLE_SIZE_INCREMENT) * sizeof(struct acpi_table_desc); | 188 | sizeof(struct acpi_table_desc); |
189 | 189 | ||
190 | /* Create new array and copy the old array */ | 190 | /* Create new array and copy the old array */ |
191 | 191 | ||
@@ -222,7 +222,7 @@ acpi_status acpi_reallocate_root_table(void) | |||
222 | acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | 222 | acpi_status acpi_load_table(struct acpi_table_header *table_ptr) |
223 | { | 223 | { |
224 | acpi_status status; | 224 | acpi_status status; |
225 | acpi_native_uint table_index; | 225 | u32 table_index; |
226 | struct acpi_table_desc table_desc; | 226 | struct acpi_table_desc table_desc; |
227 | 227 | ||
228 | if (!table_ptr) | 228 | if (!table_ptr) |
@@ -264,11 +264,10 @@ ACPI_EXPORT_SYMBOL(acpi_load_table) | |||
264 | *****************************************************************************/ | 264 | *****************************************************************************/ |
265 | acpi_status | 265 | acpi_status |
266 | acpi_get_table_header(char *signature, | 266 | acpi_get_table_header(char *signature, |
267 | acpi_native_uint instance, | 267 | u32 instance, struct acpi_table_header *out_table_header) |
268 | struct acpi_table_header * out_table_header) | ||
269 | { | 268 | { |
270 | acpi_native_uint i; | 269 | u32 i; |
271 | acpi_native_uint j; | 270 | u32 j; |
272 | struct acpi_table_header *header; | 271 | struct acpi_table_header *header; |
273 | 272 | ||
274 | /* Parameter validation */ | 273 | /* Parameter validation */ |
@@ -378,10 +377,10 @@ ACPI_EXPORT_SYMBOL(acpi_unload_table_id) | |||
378 | *****************************************************************************/ | 377 | *****************************************************************************/ |
379 | acpi_status | 378 | acpi_status |
380 | acpi_get_table(char *signature, | 379 | acpi_get_table(char *signature, |
381 | acpi_native_uint instance, struct acpi_table_header **out_table) | 380 | u32 instance, struct acpi_table_header **out_table) |
382 | { | 381 | { |
383 | acpi_native_uint i; | 382 | u32 i; |
384 | acpi_native_uint j; | 383 | u32 j; |
385 | acpi_status status; | 384 | acpi_status status; |
386 | 385 | ||
387 | /* Parameter validation */ | 386 | /* Parameter validation */ |
@@ -435,8 +434,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_table) | |||
435 | * | 434 | * |
436 | ******************************************************************************/ | 435 | ******************************************************************************/ |
437 | acpi_status | 436 | acpi_status |
438 | acpi_get_table_by_index(acpi_native_uint table_index, | 437 | acpi_get_table_by_index(u32 table_index, struct acpi_table_header **table) |
439 | struct acpi_table_header ** table) | ||
440 | { | 438 | { |
441 | acpi_status status; | 439 | acpi_status status; |
442 | 440 | ||
@@ -493,7 +491,7 @@ static acpi_status acpi_tb_load_namespace(void) | |||
493 | { | 491 | { |
494 | acpi_status status; | 492 | acpi_status status; |
495 | struct acpi_table_header *table; | 493 | struct acpi_table_header *table; |
496 | acpi_native_uint i; | 494 | u32 i; |
497 | 495 | ||
498 | ACPI_FUNCTION_TRACE(tb_load_namespace); | 496 | ACPI_FUNCTION_TRACE(tb_load_namespace); |
499 | 497 | ||
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index b8c0dfa084f6..2d157e0f98d2 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c | |||
@@ -118,7 +118,7 @@ static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp) | |||
118 | * | 118 | * |
119 | ******************************************************************************/ | 119 | ******************************************************************************/ |
120 | 120 | ||
121 | acpi_status acpi_find_root_pointer(acpi_native_uint * table_address) | 121 | acpi_status acpi_find_root_pointer(acpi_size *table_address) |
122 | { | 122 | { |
123 | u8 *table_ptr; | 123 | u8 *table_ptr; |
124 | u8 *mem_rover; | 124 | u8 *mem_rover; |
@@ -153,7 +153,7 @@ acpi_status acpi_find_root_pointer(acpi_native_uint * table_address) | |||
153 | * 1b) Search EBDA paragraphs (EBDA is required to be a | 153 | * 1b) Search EBDA paragraphs (EBDA is required to be a |
154 | * minimum of 1_k length) | 154 | * minimum of 1_k length) |
155 | */ | 155 | */ |
156 | table_ptr = acpi_os_map_memory((acpi_native_uint) | 156 | table_ptr = acpi_os_map_memory((acpi_physical_address) |
157 | physical_address, | 157 | physical_address, |
158 | ACPI_EBDA_WINDOW_SIZE); | 158 | ACPI_EBDA_WINDOW_SIZE); |
159 | if (!table_ptr) { | 159 | if (!table_ptr) { |
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index ede084829a70..3dfb8a442b26 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -309,7 +309,8 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, | |||
309 | * | 309 | * |
310 | ******************************************************************************/ | 310 | ******************************************************************************/ |
311 | 311 | ||
312 | void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | 312 | void *acpi_ut_allocate(acpi_size size, |
313 | u32 component, const char *module, u32 line) | ||
313 | { | 314 | { |
314 | void *allocation; | 315 | void *allocation; |
315 | 316 | ||
@@ -353,7 +354,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
353 | ******************************************************************************/ | 354 | ******************************************************************************/ |
354 | 355 | ||
355 | void *acpi_ut_allocate_zeroed(acpi_size size, | 356 | void *acpi_ut_allocate_zeroed(acpi_size size, |
356 | u32 component, char *module, u32 line) | 357 | u32 component, const char *module, u32 line) |
357 | { | 358 | { |
358 | void *allocation; | 359 | void *allocation; |
359 | 360 | ||
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 655c290aca7b..53499ac90988 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c | |||
@@ -572,7 +572,7 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object, | |||
572 | acpi_status status = AE_OK; | 572 | acpi_status status = AE_OK; |
573 | union acpi_operand_object *package_object; | 573 | union acpi_operand_object *package_object; |
574 | union acpi_operand_object **package_elements; | 574 | union acpi_operand_object **package_elements; |
575 | acpi_native_uint i; | 575 | u32 i; |
576 | 576 | ||
577 | ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage); | 577 | ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage); |
578 | 578 | ||
@@ -599,7 +599,7 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object, | |||
599 | 599 | ||
600 | /* Truncate package and delete it */ | 600 | /* Truncate package and delete it */ |
601 | 601 | ||
602 | package_object->package.count = (u32) i; | 602 | package_object->package.count = i; |
603 | package_elements[i] = NULL; | 603 | package_elements[i] = NULL; |
604 | acpi_ut_remove_reference(package_object); | 604 | acpi_ut_remove_reference(package_object); |
605 | return_ACPI_STATUS(status); | 605 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index f938f465efa4..fd66ecb6741e 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c | |||
@@ -157,7 +157,8 @@ void ACPI_INTERNAL_VAR_XFACE | |||
157 | acpi_ut_debug_print(u32 requested_debug_level, | 157 | acpi_ut_debug_print(u32 requested_debug_level, |
158 | u32 line_number, | 158 | u32 line_number, |
159 | const char *function_name, | 159 | const char *function_name, |
160 | char *module_name, u32 component_id, char *format, ...) | 160 | const char *module_name, |
161 | u32 component_id, const char *format, ...) | ||
161 | { | 162 | { |
162 | acpi_thread_id thread_id; | 163 | acpi_thread_id thread_id; |
163 | va_list args; | 164 | va_list args; |
@@ -228,7 +229,8 @@ void ACPI_INTERNAL_VAR_XFACE | |||
228 | acpi_ut_debug_print_raw(u32 requested_debug_level, | 229 | acpi_ut_debug_print_raw(u32 requested_debug_level, |
229 | u32 line_number, | 230 | u32 line_number, |
230 | const char *function_name, | 231 | const char *function_name, |
231 | char *module_name, u32 component_id, char *format, ...) | 232 | const char *module_name, |
233 | u32 component_id, const char *format, ...) | ||
232 | { | 234 | { |
233 | va_list args; | 235 | va_list args; |
234 | 236 | ||
@@ -261,7 +263,8 @@ ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw) | |||
261 | ******************************************************************************/ | 263 | ******************************************************************************/ |
262 | void | 264 | void |
263 | acpi_ut_trace(u32 line_number, | 265 | acpi_ut_trace(u32 line_number, |
264 | const char *function_name, char *module_name, u32 component_id) | 266 | const char *function_name, |
267 | const char *module_name, u32 component_id) | ||
265 | { | 268 | { |
266 | 269 | ||
267 | acpi_gbl_nesting_level++; | 270 | acpi_gbl_nesting_level++; |
@@ -293,7 +296,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_trace) | |||
293 | void | 296 | void |
294 | acpi_ut_trace_ptr(u32 line_number, | 297 | acpi_ut_trace_ptr(u32 line_number, |
295 | const char *function_name, | 298 | const char *function_name, |
296 | char *module_name, u32 component_id, void *pointer) | 299 | const char *module_name, u32 component_id, void *pointer) |
297 | { | 300 | { |
298 | acpi_gbl_nesting_level++; | 301 | acpi_gbl_nesting_level++; |
299 | acpi_ut_track_stack_ptr(); | 302 | acpi_ut_track_stack_ptr(); |
@@ -324,7 +327,7 @@ acpi_ut_trace_ptr(u32 line_number, | |||
324 | void | 327 | void |
325 | acpi_ut_trace_str(u32 line_number, | 328 | acpi_ut_trace_str(u32 line_number, |
326 | const char *function_name, | 329 | const char *function_name, |
327 | char *module_name, u32 component_id, char *string) | 330 | const char *module_name, u32 component_id, char *string) |
328 | { | 331 | { |
329 | 332 | ||
330 | acpi_gbl_nesting_level++; | 333 | acpi_gbl_nesting_level++; |
@@ -356,7 +359,7 @@ acpi_ut_trace_str(u32 line_number, | |||
356 | void | 359 | void |
357 | acpi_ut_trace_u32(u32 line_number, | 360 | acpi_ut_trace_u32(u32 line_number, |
358 | const char *function_name, | 361 | const char *function_name, |
359 | char *module_name, u32 component_id, u32 integer) | 362 | const char *module_name, u32 component_id, u32 integer) |
360 | { | 363 | { |
361 | 364 | ||
362 | acpi_gbl_nesting_level++; | 365 | acpi_gbl_nesting_level++; |
@@ -386,7 +389,8 @@ acpi_ut_trace_u32(u32 line_number, | |||
386 | 389 | ||
387 | void | 390 | void |
388 | acpi_ut_exit(u32 line_number, | 391 | acpi_ut_exit(u32 line_number, |
389 | const char *function_name, char *module_name, u32 component_id) | 392 | const char *function_name, |
393 | const char *module_name, u32 component_id) | ||
390 | { | 394 | { |
391 | 395 | ||
392 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, | 396 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, |
@@ -417,7 +421,8 @@ ACPI_EXPORT_SYMBOL(acpi_ut_exit) | |||
417 | void | 421 | void |
418 | acpi_ut_status_exit(u32 line_number, | 422 | acpi_ut_status_exit(u32 line_number, |
419 | const char *function_name, | 423 | const char *function_name, |
420 | char *module_name, u32 component_id, acpi_status status) | 424 | const char *module_name, |
425 | u32 component_id, acpi_status status) | ||
421 | { | 426 | { |
422 | 427 | ||
423 | if (ACPI_SUCCESS(status)) { | 428 | if (ACPI_SUCCESS(status)) { |
@@ -458,7 +463,8 @@ ACPI_EXPORT_SYMBOL(acpi_ut_status_exit) | |||
458 | void | 463 | void |
459 | acpi_ut_value_exit(u32 line_number, | 464 | acpi_ut_value_exit(u32 line_number, |
460 | const char *function_name, | 465 | const char *function_name, |
461 | char *module_name, u32 component_id, acpi_integer value) | 466 | const char *module_name, |
467 | u32 component_id, acpi_integer value) | ||
462 | { | 468 | { |
463 | 469 | ||
464 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, | 470 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, |
@@ -490,7 +496,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_value_exit) | |||
490 | void | 496 | void |
491 | acpi_ut_ptr_exit(u32 line_number, | 497 | acpi_ut_ptr_exit(u32 line_number, |
492 | const char *function_name, | 498 | const char *function_name, |
493 | char *module_name, u32 component_id, u8 * ptr) | 499 | const char *module_name, u32 component_id, u8 *ptr) |
494 | { | 500 | { |
495 | 501 | ||
496 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, | 502 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, |
@@ -519,8 +525,8 @@ acpi_ut_ptr_exit(u32 line_number, | |||
519 | 525 | ||
520 | void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) | 526 | void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) |
521 | { | 527 | { |
522 | acpi_native_uint i = 0; | 528 | u32 i = 0; |
523 | acpi_native_uint j; | 529 | u32 j; |
524 | u32 temp32; | 530 | u32 temp32; |
525 | u8 buf_char; | 531 | u8 buf_char; |
526 | 532 | ||
@@ -539,7 +545,7 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) | |||
539 | 545 | ||
540 | /* Print current offset */ | 546 | /* Print current offset */ |
541 | 547 | ||
542 | acpi_os_printf("%6.4X: ", (u32) i); | 548 | acpi_os_printf("%6.4X: ", i); |
543 | 549 | ||
544 | /* Print 16 hex chars */ | 550 | /* Print 16 hex chars */ |
545 | 551 | ||
@@ -549,7 +555,7 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) | |||
549 | /* Dump fill spaces */ | 555 | /* Dump fill spaces */ |
550 | 556 | ||
551 | acpi_os_printf("%*s", ((display * 2) + 1), " "); | 557 | acpi_os_printf("%*s", ((display * 2) + 1), " "); |
552 | j += (acpi_native_uint) display; | 558 | j += display; |
553 | continue; | 559 | continue; |
554 | } | 560 | } |
555 | 561 | ||
@@ -557,32 +563,38 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) | |||
557 | case DB_BYTE_DISPLAY: | 563 | case DB_BYTE_DISPLAY: |
558 | default: /* Default is BYTE display */ | 564 | default: /* Default is BYTE display */ |
559 | 565 | ||
560 | acpi_os_printf("%02X ", buffer[i + j]); | 566 | acpi_os_printf("%02X ", |
567 | buffer[(acpi_size) i + j]); | ||
561 | break; | 568 | break; |
562 | 569 | ||
563 | case DB_WORD_DISPLAY: | 570 | case DB_WORD_DISPLAY: |
564 | 571 | ||
565 | ACPI_MOVE_16_TO_32(&temp32, &buffer[i + j]); | 572 | ACPI_MOVE_16_TO_32(&temp32, |
573 | &buffer[(acpi_size) i + j]); | ||
566 | acpi_os_printf("%04X ", temp32); | 574 | acpi_os_printf("%04X ", temp32); |
567 | break; | 575 | break; |
568 | 576 | ||
569 | case DB_DWORD_DISPLAY: | 577 | case DB_DWORD_DISPLAY: |
570 | 578 | ||
571 | ACPI_MOVE_32_TO_32(&temp32, &buffer[i + j]); | 579 | ACPI_MOVE_32_TO_32(&temp32, |
580 | &buffer[(acpi_size) i + j]); | ||
572 | acpi_os_printf("%08X ", temp32); | 581 | acpi_os_printf("%08X ", temp32); |
573 | break; | 582 | break; |
574 | 583 | ||
575 | case DB_QWORD_DISPLAY: | 584 | case DB_QWORD_DISPLAY: |
576 | 585 | ||
577 | ACPI_MOVE_32_TO_32(&temp32, &buffer[i + j]); | 586 | ACPI_MOVE_32_TO_32(&temp32, |
587 | &buffer[(acpi_size) i + j]); | ||
578 | acpi_os_printf("%08X", temp32); | 588 | acpi_os_printf("%08X", temp32); |
579 | 589 | ||
580 | ACPI_MOVE_32_TO_32(&temp32, &buffer[i + j + 4]); | 590 | ACPI_MOVE_32_TO_32(&temp32, |
591 | &buffer[(acpi_size) i + j + | ||
592 | 4]); | ||
581 | acpi_os_printf("%08X ", temp32); | 593 | acpi_os_printf("%08X ", temp32); |
582 | break; | 594 | break; |
583 | } | 595 | } |
584 | 596 | ||
585 | j += (acpi_native_uint) display; | 597 | j += display; |
586 | } | 598 | } |
587 | 599 | ||
588 | /* | 600 | /* |
@@ -596,7 +608,7 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) | |||
596 | return; | 608 | return; |
597 | } | 609 | } |
598 | 610 | ||
599 | buf_char = buffer[i + j]; | 611 | buf_char = buffer[(acpi_size) i + j]; |
600 | if (ACPI_IS_PRINT(buf_char)) { | 612 | if (ACPI_IS_PRINT(buf_char)) { |
601 | acpi_os_printf("%c", buf_char); | 613 | acpi_os_printf("%c", buf_char); |
602 | } else { | 614 | } else { |
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 1fbc35139e84..c5c791a575c9 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
@@ -442,7 +442,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) | |||
442 | union acpi_generic_state *state_list = NULL; | 442 | union acpi_generic_state *state_list = NULL; |
443 | union acpi_operand_object *next_object = NULL; | 443 | union acpi_operand_object *next_object = NULL; |
444 | union acpi_generic_state *state; | 444 | union acpi_generic_state *state; |
445 | acpi_native_uint i; | 445 | u32 i; |
446 | 446 | ||
447 | ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object); | 447 | ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object); |
448 | 448 | ||
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 05e61be267d5..352747e49c7a 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c | |||
@@ -97,7 +97,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
97 | acpi_status status; | 97 | acpi_status status; |
98 | union acpi_operand_object *string_desc; | 98 | union acpi_operand_object *string_desc; |
99 | union acpi_operand_object *return_desc; | 99 | union acpi_operand_object *return_desc; |
100 | acpi_native_uint i; | 100 | u32 i; |
101 | 101 | ||
102 | ACPI_FUNCTION_TRACE(ut_osi_implementation); | 102 | ACPI_FUNCTION_TRACE(ut_osi_implementation); |
103 | 103 | ||
@@ -217,7 +217,6 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
217 | 217 | ||
218 | info->prefix_node = prefix_node; | 218 | info->prefix_node = prefix_node; |
219 | info->pathname = path; | 219 | info->pathname = path; |
220 | info->parameter_type = ACPI_PARAM_ARGS; | ||
221 | 220 | ||
222 | /* Evaluate the object/method */ | 221 | /* Evaluate the object/method */ |
223 | 222 | ||
@@ -514,7 +513,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
514 | u32 count; | 513 | u32 count; |
515 | u32 size; | 514 | u32 size; |
516 | struct acpi_compatible_id_list *cid_list; | 515 | struct acpi_compatible_id_list *cid_list; |
517 | acpi_native_uint i; | 516 | u32 i; |
518 | 517 | ||
519 | ACPI_FUNCTION_TRACE(ut_execute_CID); | 518 | ACPI_FUNCTION_TRACE(ut_execute_CID); |
520 | 519 | ||
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 1f057b71db1a..f34be6773556 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -64,7 +64,7 @@ ACPI_MODULE_NAME("utmisc") | |||
64 | ******************************************************************************/ | 64 | ******************************************************************************/ |
65 | const char *acpi_ut_validate_exception(acpi_status status) | 65 | const char *acpi_ut_validate_exception(acpi_status status) |
66 | { | 66 | { |
67 | acpi_status sub_status; | 67 | u32 sub_status; |
68 | const char *exception = NULL; | 68 | const char *exception = NULL; |
69 | 69 | ||
70 | ACPI_FUNCTION_ENTRY(); | 70 | ACPI_FUNCTION_ENTRY(); |
@@ -85,32 +85,28 @@ const char *acpi_ut_validate_exception(acpi_status status) | |||
85 | case AE_CODE_PROGRAMMER: | 85 | case AE_CODE_PROGRAMMER: |
86 | 86 | ||
87 | if (sub_status <= AE_CODE_PGM_MAX) { | 87 | if (sub_status <= AE_CODE_PGM_MAX) { |
88 | exception = | 88 | exception = acpi_gbl_exception_names_pgm[sub_status]; |
89 | acpi_gbl_exception_names_pgm[sub_status - 1]; | ||
90 | } | 89 | } |
91 | break; | 90 | break; |
92 | 91 | ||
93 | case AE_CODE_ACPI_TABLES: | 92 | case AE_CODE_ACPI_TABLES: |
94 | 93 | ||
95 | if (sub_status <= AE_CODE_TBL_MAX) { | 94 | if (sub_status <= AE_CODE_TBL_MAX) { |
96 | exception = | 95 | exception = acpi_gbl_exception_names_tbl[sub_status]; |
97 | acpi_gbl_exception_names_tbl[sub_status - 1]; | ||
98 | } | 96 | } |
99 | break; | 97 | break; |
100 | 98 | ||
101 | case AE_CODE_AML: | 99 | case AE_CODE_AML: |
102 | 100 | ||
103 | if (sub_status <= AE_CODE_AML_MAX) { | 101 | if (sub_status <= AE_CODE_AML_MAX) { |
104 | exception = | 102 | exception = acpi_gbl_exception_names_aml[sub_status]; |
105 | acpi_gbl_exception_names_aml[sub_status - 1]; | ||
106 | } | 103 | } |
107 | break; | 104 | break; |
108 | 105 | ||
109 | case AE_CODE_CONTROL: | 106 | case AE_CODE_CONTROL: |
110 | 107 | ||
111 | if (sub_status <= AE_CODE_CTRL_MAX) { | 108 | if (sub_status <= AE_CODE_CTRL_MAX) { |
112 | exception = | 109 | exception = acpi_gbl_exception_names_ctrl[sub_status]; |
113 | acpi_gbl_exception_names_ctrl[sub_status - 1]; | ||
114 | } | 110 | } |
115 | break; | 111 | break; |
116 | 112 | ||
@@ -165,9 +161,9 @@ u8 acpi_ut_is_aml_table(struct acpi_table_header *table) | |||
165 | 161 | ||
166 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | 162 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) |
167 | { | 163 | { |
168 | acpi_native_uint i; | 164 | u32 i; |
169 | acpi_native_uint j; | 165 | u32 j; |
170 | acpi_native_uint k; | 166 | u32 k; |
171 | acpi_status status; | 167 | acpi_status status; |
172 | 168 | ||
173 | ACPI_FUNCTION_TRACE(ut_allocate_owner_id); | 169 | ACPI_FUNCTION_TRACE(ut_allocate_owner_id); |
@@ -273,7 +269,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
273 | { | 269 | { |
274 | acpi_owner_id owner_id = *owner_id_ptr; | 270 | acpi_owner_id owner_id = *owner_id_ptr; |
275 | acpi_status status; | 271 | acpi_status status; |
276 | acpi_native_uint index; | 272 | u32 index; |
277 | u32 bit; | 273 | u32 bit; |
278 | 274 | ||
279 | ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id); | 275 | ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id); |
@@ -593,7 +589,7 @@ acpi_ut_display_init_pathname(u8 type, | |||
593 | * | 589 | * |
594 | ******************************************************************************/ | 590 | ******************************************************************************/ |
595 | 591 | ||
596 | u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position) | 592 | u8 acpi_ut_valid_acpi_char(char character, u32 position) |
597 | { | 593 | { |
598 | 594 | ||
599 | if (!((character >= 'A' && character <= 'Z') || | 595 | if (!((character >= 'A' && character <= 'Z') || |
@@ -628,7 +624,7 @@ u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position) | |||
628 | 624 | ||
629 | u8 acpi_ut_valid_acpi_name(u32 name) | 625 | u8 acpi_ut_valid_acpi_name(u32 name) |
630 | { | 626 | { |
631 | acpi_native_uint i; | 627 | u32 i; |
632 | 628 | ||
633 | ACPI_FUNCTION_ENTRY(); | 629 | ACPI_FUNCTION_ENTRY(); |
634 | 630 | ||
@@ -657,7 +653,7 @@ u8 acpi_ut_valid_acpi_name(u32 name) | |||
657 | 653 | ||
658 | acpi_name acpi_ut_repair_name(char *name) | 654 | acpi_name acpi_ut_repair_name(char *name) |
659 | { | 655 | { |
660 | acpi_native_uint i; | 656 | u32 i; |
661 | char new_name[ACPI_NAME_SIZE]; | 657 | char new_name[ACPI_NAME_SIZE]; |
662 | 658 | ||
663 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | 659 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
@@ -1024,7 +1020,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
1024 | ******************************************************************************/ | 1020 | ******************************************************************************/ |
1025 | 1021 | ||
1026 | void ACPI_INTERNAL_VAR_XFACE | 1022 | void ACPI_INTERNAL_VAR_XFACE |
1027 | acpi_ut_error(char *module_name, u32 line_number, char *format, ...) | 1023 | acpi_ut_error(const char *module_name, u32 line_number, const char *format, ...) |
1028 | { | 1024 | { |
1029 | va_list args; | 1025 | va_list args; |
1030 | 1026 | ||
@@ -1037,8 +1033,8 @@ acpi_ut_error(char *module_name, u32 line_number, char *format, ...) | |||
1037 | } | 1033 | } |
1038 | 1034 | ||
1039 | void ACPI_INTERNAL_VAR_XFACE | 1035 | void ACPI_INTERNAL_VAR_XFACE |
1040 | acpi_ut_exception(char *module_name, | 1036 | acpi_ut_exception(const char *module_name, |
1041 | u32 line_number, acpi_status status, char *format, ...) | 1037 | u32 line_number, acpi_status status, const char *format, ...) |
1042 | { | 1038 | { |
1043 | va_list args; | 1039 | va_list args; |
1044 | 1040 | ||
@@ -1054,7 +1050,8 @@ acpi_ut_exception(char *module_name, | |||
1054 | EXPORT_SYMBOL(acpi_ut_exception); | 1050 | EXPORT_SYMBOL(acpi_ut_exception); |
1055 | 1051 | ||
1056 | void ACPI_INTERNAL_VAR_XFACE | 1052 | void ACPI_INTERNAL_VAR_XFACE |
1057 | acpi_ut_warning(char *module_name, u32 line_number, char *format, ...) | 1053 | acpi_ut_warning(const char *module_name, |
1054 | u32 line_number, const char *format, ...) | ||
1058 | { | 1055 | { |
1059 | va_list args; | 1056 | va_list args; |
1060 | 1057 | ||
@@ -1067,7 +1064,7 @@ acpi_ut_warning(char *module_name, u32 line_number, char *format, ...) | |||
1067 | } | 1064 | } |
1068 | 1065 | ||
1069 | void ACPI_INTERNAL_VAR_XFACE | 1066 | void ACPI_INTERNAL_VAR_XFACE |
1070 | acpi_ut_info(char *module_name, u32 line_number, char *format, ...) | 1067 | acpi_ut_info(const char *module_name, u32 line_number, const char *format, ...) |
1071 | { | 1068 | { |
1072 | va_list args; | 1069 | va_list args; |
1073 | 1070 | ||
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index f7d602b1a894..7331dde9e1b3 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c | |||
@@ -218,7 +218,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
218 | * the mutex ordering rule. This indicates a coding error somewhere in | 218 | * the mutex ordering rule. This indicates a coding error somewhere in |
219 | * the ACPI subsystem code. | 219 | * the ACPI subsystem code. |
220 | */ | 220 | */ |
221 | for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) { | 221 | for (i = mutex_id; i < ACPI_NUM_MUTEX; i++) { |
222 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { | 222 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
223 | if (i == mutex_id) { | 223 | if (i == mutex_id) { |
224 | ACPI_ERROR((AE_INFO, | 224 | ACPI_ERROR((AE_INFO, |
@@ -315,7 +315,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | |||
315 | * ordering rule. This indicates a coding error somewhere in | 315 | * ordering rule. This indicates a coding error somewhere in |
316 | * the ACPI subsystem code. | 316 | * the ACPI subsystem code. |
317 | */ | 317 | */ |
318 | for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) { | 318 | for (i = mutex_id; i < ACPI_NUM_MUTEX; i++) { |
319 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { | 319 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
320 | if (i == mutex_id) { | 320 | if (i == mutex_id) { |
321 | continue; | 321 | continue; |
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index e68466de8044..e25484495e65 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
@@ -83,7 +83,8 @@ acpi_ut_get_element_length(u8 object_type, | |||
83 | * | 83 | * |
84 | ******************************************************************************/ | 84 | ******************************************************************************/ |
85 | 85 | ||
86 | union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name, | 86 | union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char |
87 | *module_name, | ||
87 | u32 line_number, | 88 | u32 line_number, |
88 | u32 component_id, | 89 | u32 component_id, |
89 | acpi_object_type | 90 | acpi_object_type |
@@ -175,8 +176,8 @@ union acpi_operand_object *acpi_ut_create_package_object(u32 count) | |||
175 | * Create the element array. Count+1 allows the array to be null | 176 | * Create the element array. Count+1 allows the array to be null |
176 | * terminated. | 177 | * terminated. |
177 | */ | 178 | */ |
178 | package_elements = ACPI_ALLOCATE_ZEROED((acpi_size) | 179 | package_elements = ACPI_ALLOCATE_ZEROED(((acpi_size) count + |
179 | (count + 1) * sizeof(void *)); | 180 | 1) * sizeof(void *)); |
180 | if (!package_elements) { | 181 | if (!package_elements) { |
181 | acpi_ut_remove_reference(package_desc); | 182 | acpi_ut_remove_reference(package_desc); |
182 | return_PTR(NULL); | 183 | return_PTR(NULL); |
@@ -347,7 +348,7 @@ u8 acpi_ut_valid_internal_object(void *object) | |||
347 | * | 348 | * |
348 | ******************************************************************************/ | 349 | ******************************************************************************/ |
349 | 350 | ||
350 | void *acpi_ut_allocate_object_desc_dbg(char *module_name, | 351 | void *acpi_ut_allocate_object_desc_dbg(const char *module_name, |
351 | u32 line_number, u32 component_id) | 352 | u32 line_number, u32 component_id) |
352 | { | 353 | { |
353 | union acpi_operand_object *object; | 354 | union acpi_operand_object *object; |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index d089c4519d45..64c889331f3b 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -631,6 +631,76 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) | |||
631 | * device : video output device (LCD, CRT, ..) | 631 | * device : video output device (LCD, CRT, ..) |
632 | * | 632 | * |
633 | * Return Value: | 633 | * Return Value: |
634 | * Maximum brightness level | ||
635 | * | ||
636 | * Allocate and initialize device->brightness. | ||
637 | */ | ||
638 | |||
639 | static int | ||
640 | acpi_video_init_brightness(struct acpi_video_device *device) | ||
641 | { | ||
642 | union acpi_object *obj = NULL; | ||
643 | int i, max_level = 0, count = 0; | ||
644 | union acpi_object *o; | ||
645 | struct acpi_video_device_brightness *br = NULL; | ||
646 | |||
647 | if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) { | ||
648 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available " | ||
649 | "LCD brightness level\n")); | ||
650 | goto out; | ||
651 | } | ||
652 | |||
653 | if (obj->package.count < 2) | ||
654 | goto out; | ||
655 | |||
656 | br = kzalloc(sizeof(*br), GFP_KERNEL); | ||
657 | if (!br) { | ||
658 | printk(KERN_ERR "can't allocate memory\n"); | ||
659 | goto out; | ||
660 | } | ||
661 | |||
662 | br->levels = kmalloc(obj->package.count * sizeof *(br->levels), | ||
663 | GFP_KERNEL); | ||
664 | if (!br->levels) | ||
665 | goto out_free; | ||
666 | |||
667 | for (i = 0; i < obj->package.count; i++) { | ||
668 | o = (union acpi_object *)&obj->package.elements[i]; | ||
669 | if (o->type != ACPI_TYPE_INTEGER) { | ||
670 | printk(KERN_ERR PREFIX "Invalid data\n"); | ||
671 | continue; | ||
672 | } | ||
673 | br->levels[count] = (u32) o->integer.value; | ||
674 | |||
675 | if (br->levels[count] > max_level) | ||
676 | max_level = br->levels[count]; | ||
677 | count++; | ||
678 | } | ||
679 | |||
680 | if (count < 2) | ||
681 | goto out_free_levels; | ||
682 | |||
683 | br->count = count; | ||
684 | device->brightness = br; | ||
685 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "found %d brightness levels\n", count)); | ||
686 | kfree(obj); | ||
687 | return max_level; | ||
688 | |||
689 | out_free_levels: | ||
690 | kfree(br->levels); | ||
691 | out_free: | ||
692 | kfree(br); | ||
693 | out: | ||
694 | device->brightness = NULL; | ||
695 | kfree(obj); | ||
696 | return 0; | ||
697 | } | ||
698 | |||
699 | /* | ||
700 | * Arg: | ||
701 | * device : video output device (LCD, CRT, ..) | ||
702 | * | ||
703 | * Return Value: | ||
634 | * None | 704 | * None |
635 | * | 705 | * |
636 | * Find out all required AML methods defined under the output | 706 | * Find out all required AML methods defined under the output |
@@ -640,10 +710,7 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) | |||
640 | static void acpi_video_device_find_cap(struct acpi_video_device *device) | 710 | static void acpi_video_device_find_cap(struct acpi_video_device *device) |
641 | { | 711 | { |
642 | acpi_handle h_dummy1; | 712 | acpi_handle h_dummy1; |
643 | int i; | ||
644 | u32 max_level = 0; | 713 | u32 max_level = 0; |
645 | union acpi_object *obj = NULL; | ||
646 | struct acpi_video_device_brightness *br = NULL; | ||
647 | 714 | ||
648 | 715 | ||
649 | memset(&device->cap, 0, sizeof(device->cap)); | 716 | memset(&device->cap, 0, sizeof(device->cap)); |
@@ -672,53 +739,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
672 | device->cap._DSS = 1; | 739 | device->cap._DSS = 1; |
673 | } | 740 | } |
674 | 741 | ||
675 | if (ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) { | 742 | max_level = acpi_video_init_brightness(device); |
676 | |||
677 | if (obj->package.count >= 2) { | ||
678 | int count = 0; | ||
679 | union acpi_object *o; | ||
680 | |||
681 | br = kzalloc(sizeof(*br), GFP_KERNEL); | ||
682 | if (!br) { | ||
683 | printk(KERN_ERR "can't allocate memory\n"); | ||
684 | } else { | ||
685 | br->levels = kmalloc(obj->package.count * | ||
686 | sizeof *(br->levels), GFP_KERNEL); | ||
687 | if (!br->levels) | ||
688 | goto out; | ||
689 | |||
690 | for (i = 0; i < obj->package.count; i++) { | ||
691 | o = (union acpi_object *)&obj->package. | ||
692 | elements[i]; | ||
693 | if (o->type != ACPI_TYPE_INTEGER) { | ||
694 | printk(KERN_ERR PREFIX "Invalid data\n"); | ||
695 | continue; | ||
696 | } | ||
697 | br->levels[count] = (u32) o->integer.value; | ||
698 | |||
699 | if (br->levels[count] > max_level) | ||
700 | max_level = br->levels[count]; | ||
701 | count++; | ||
702 | } | ||
703 | out: | ||
704 | if (count < 2) { | ||
705 | kfree(br->levels); | ||
706 | kfree(br); | ||
707 | } else { | ||
708 | br->count = count; | ||
709 | device->brightness = br; | ||
710 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
711 | "found %d brightness levels\n", | ||
712 | count)); | ||
713 | } | ||
714 | } | ||
715 | } | ||
716 | |||
717 | } else { | ||
718 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available LCD brightness level\n")); | ||
719 | } | ||
720 | |||
721 | kfree(obj); | ||
722 | 743 | ||
723 | if (device->cap._BCL && device->cap._BCM && device->cap._BQC && max_level > 0){ | 744 | if (device->cap._BCL && device->cap._BCM && device->cap._BQC && max_level > 0){ |
724 | int result; | 745 | int result; |
@@ -1695,6 +1716,8 @@ static void | |||
1695 | acpi_video_switch_brightness(struct acpi_video_device *device, int event) | 1716 | acpi_video_switch_brightness(struct acpi_video_device *device, int event) |
1696 | { | 1717 | { |
1697 | unsigned long level_current, level_next; | 1718 | unsigned long level_current, level_next; |
1719 | if (!device->brightness) | ||
1720 | return; | ||
1698 | acpi_video_device_lcd_get_level_current(device, &level_current); | 1721 | acpi_video_device_lcd_get_level_current(device, &level_current); |
1699 | level_next = acpi_video_get_next_level(device, level_current, event); | 1722 | level_next = acpi_video_get_next_level(device, level_current, event); |
1700 | acpi_video_device_lcd_set_level(device, level_next); | 1723 | acpi_video_device_lcd_set_level(device, level_next); |