aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/Kconfig2
-rw-r--r--drivers/acpi/Makefile2
-rw-r--r--drivers/acpi/ac.c8
-rw-r--r--drivers/acpi/bay.c22
-rw-r--r--drivers/acpi/bus.c2
-rw-r--r--drivers/acpi/dispatcher/dsfield.c5
-rw-r--r--drivers/acpi/dispatcher/dsinit.c2
-rw-r--r--drivers/acpi/dispatcher/dsmethod.c1
-rw-r--r--drivers/acpi/dispatcher/dsopcode.c22
-rw-r--r--drivers/acpi/dispatcher/dswexec.c8
-rw-r--r--drivers/acpi/dispatcher/dswstate.c20
-rw-r--r--drivers/acpi/dock.c8
-rw-r--r--drivers/acpi/ec.c2
-rw-r--r--drivers/acpi/events/evevent.c6
-rw-r--r--drivers/acpi/events/evgpe.c36
-rw-r--r--drivers/acpi/events/evgpeblk.c18
-rw-r--r--drivers/acpi/events/evmisc.c4
-rw-r--r--drivers/acpi/events/evregion.c5
-rw-r--r--drivers/acpi/events/evrgnini.c2
-rw-r--r--drivers/acpi/events/evxfevnt.c18
-rw-r--r--drivers/acpi/executer/exconfig.c27
-rw-r--r--drivers/acpi/executer/exconvrt.c12
-rw-r--r--drivers/acpi/executer/excreate.c2
-rw-r--r--drivers/acpi/executer/exdump.c67
-rw-r--r--drivers/acpi/executer/exfldio.c9
-rw-r--r--drivers/acpi/executer/exmisc.c8
-rw-r--r--drivers/acpi/executer/exprep.c8
-rw-r--r--drivers/acpi/executer/exregion.c2
-rw-r--r--drivers/acpi/executer/exresop.c4
-rw-r--r--drivers/acpi/executer/exstore.c6
-rw-r--r--drivers/acpi/fan.c8
-rw-r--r--drivers/acpi/glue.c12
-rw-r--r--drivers/acpi/hardware/hwgpe.c52
-rw-r--r--drivers/acpi/hardware/hwsleep.c8
-rw-r--r--drivers/acpi/namespace/nsdump.c6
-rw-r--r--drivers/acpi/namespace/nseval.c35
-rw-r--r--drivers/acpi/namespace/nsinit.c1
-rw-r--r--drivers/acpi/namespace/nsload.c3
-rw-r--r--drivers/acpi/namespace/nsparse.c15
-rw-r--r--drivers/acpi/namespace/nsutils.c50
-rw-r--r--drivers/acpi/namespace/nsxfeval.c3
-rw-r--r--drivers/acpi/numa.c35
-rw-r--r--drivers/acpi/parser/psargs.c8
-rw-r--r--drivers/acpi/parser/psxface.c4
-rw-r--r--drivers/acpi/pci_irq.c38
-rw-r--r--drivers/acpi/processor_core.c76
-rw-r--r--drivers/acpi/processor_idle.c49
-rw-r--r--drivers/acpi/processor_perflib.c18
-rw-r--r--drivers/acpi/processor_throttling.c38
-rw-r--r--drivers/acpi/reboot.c50
-rw-r--r--drivers/acpi/resources/rscalc.c4
-rw-r--r--drivers/acpi/resources/rscreate.c41
-rw-r--r--drivers/acpi/resources/rsmisc.c2
-rw-r--r--drivers/acpi/resources/rsutils.c13
-rw-r--r--drivers/acpi/scan.c62
-rw-r--r--drivers/acpi/sleep/main.c5
-rw-r--r--drivers/acpi/sleep/proc.c11
-rw-r--r--drivers/acpi/system.c184
-rw-r--r--drivers/acpi/tables/tbfadt.c23
-rw-r--r--drivers/acpi/tables/tbfind.c5
-rw-r--r--drivers/acpi/tables/tbinstal.c55
-rw-r--r--drivers/acpi/tables/tbutils.c15
-rw-r--r--drivers/acpi/tables/tbxface.c30
-rw-r--r--drivers/acpi/tables/tbxfroot.c4
-rw-r--r--drivers/acpi/thermal.c11
-rw-r--r--drivers/acpi/utilities/utalloc.c5
-rw-r--r--drivers/acpi/utilities/utcopy.c4
-rw-r--r--drivers/acpi/utilities/utdebug.c54
-rw-r--r--drivers/acpi/utilities/utdelete.c2
-rw-r--r--drivers/acpi/utilities/uteval.c5
-rw-r--r--drivers/acpi/utilities/utmisc.c41
-rw-r--r--drivers/acpi/utilities/utmutex.c4
-rw-r--r--drivers/acpi/utilities/utobject.c9
-rw-r--r--drivers/acpi/video.c126
74 files changed, 996 insertions, 566 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 250d41a24f78..735f5ea17473 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -4,8 +4,6 @@
4 4
5menuconfig ACPI 5menuconfig ACPI
6 bool "ACPI (Advanced Configuration and Power Interface) Support" 6 bool "ACPI (Advanced Configuration and Power Interface) Support"
7 depends on !X86_NUMAQ
8 depends on !X86_VISWS
9 depends on !IA64_HP_SIM 7 depends on !IA64_HP_SIM
10 depends on IA64 || X86 8 depends on IA64 || X86
11 depends on PCI 9 depends on PCI
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 579c29c0665f..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#
24obj-y += osl.o utils.o \ 24obj-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/
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 5b73f6a2cd86..831883b7d6c9 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -233,6 +233,9 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
233 233
234 device = ac->device; 234 device = ac->device;
235 switch (event) { 235 switch (event) {
236 default:
237 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
238 "Unsupported event [0x%x]\n", event));
236 case ACPI_AC_NOTIFY_STATUS: 239 case ACPI_AC_NOTIFY_STATUS:
237 case ACPI_NOTIFY_BUS_CHECK: 240 case ACPI_NOTIFY_BUS_CHECK:
238 case ACPI_NOTIFY_DEVICE_CHECK: 241 case ACPI_NOTIFY_DEVICE_CHECK:
@@ -244,11 +247,6 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
244#ifdef CONFIG_ACPI_SYSFS_POWER 247#ifdef CONFIG_ACPI_SYSFS_POWER
245 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); 248 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
246#endif 249#endif
247 break;
248 default:
249 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
250 "Unsupported event [0x%x]\n", event));
251 break;
252 } 250 }
253 251
254 return; 252 return;
diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c
index d2fc94161848..e6caf5d42e0e 100644
--- a/drivers/acpi/bay.c
+++ b/drivers/acpi/bay.c
@@ -301,16 +301,20 @@ static int bay_add(acpi_handle handle, int id)
301 */ 301 */
302 pdev->dev.uevent_suppress = 0; 302 pdev->dev.uevent_suppress = 0;
303 303
304 if (acpi_bay_add_fs(new_bay)) {
305 platform_device_unregister(new_bay->pdev);
306 goto bay_add_err;
307 }
308
309 /* register for events on this device */ 304 /* register for events on this device */
310 status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, 305 status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
311 bay_notify, new_bay); 306 bay_notify, new_bay);
312 if (ACPI_FAILURE(status)) { 307 if (ACPI_FAILURE(status)) {
313 printk(KERN_ERR PREFIX "Error installing bay notify handler\n"); 308 printk(KERN_INFO PREFIX "Error installing bay notify handler\n");
309 platform_device_unregister(new_bay->pdev);
310 goto bay_add_err;
311 }
312
313 if (acpi_bay_add_fs(new_bay)) {
314 acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
315 bay_notify);
316 platform_device_unregister(new_bay->pdev);
317 goto bay_add_err;
314 } 318 }
315 319
316 /* if we are on a dock station, we should register for dock 320 /* if we are on a dock station, we should register for dock
@@ -373,6 +377,12 @@ static int __init bay_init(void)
373 377
374 INIT_LIST_HEAD(&drive_bays); 378 INIT_LIST_HEAD(&drive_bays);
375 379
380 if (acpi_disabled)
381 return -ENODEV;
382
383 if (acpi_disabled)
384 return -ENODEV;
385
376 /* look for dockable drive bays */ 386 /* look for dockable drive bays */
377 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 387 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
378 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 fc1110d6a078..ccae305ee55d 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -634,7 +634,7 @@ static int __init acpi_bus_init_irq(void)
634 return 0; 634 return 0;
635} 635}
636 636
637acpi_native_uint acpi_gbl_permanent_mmap; 637u8 acpi_gbl_permanent_mmap;
638 638
639 639
640void __init acpi_early_init(void) 640void __init acpi_early_init(void)
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c
index c78078315be9..f988a5e7d2b4 100644
--- a/drivers/acpi/dispatcher/dsfield.c
+++ b/drivers/acpi/dispatcher/dsfield.c
@@ -450,10 +450,6 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
450 return_ACPI_STATUS(AE_BAD_PARAMETER); 450 return_ACPI_STATUS(AE_BAD_PARAMETER);
451 } 451 }
452 452
453 if (!arg) {
454 return_ACPI_STATUS(AE_AML_NO_OPERAND);
455 }
456
457 /* Creating new namespace node(s), should not already exist */ 453 /* Creating new namespace node(s), should not already exist */
458 454
459 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | 455 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
@@ -467,6 +463,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
467 463
468 /* 464 /*
469 * Walk the list of entries in the field_list 465 * Walk the list of entries in the field_list
466 * Note: field_list can be of zero length. In this case, Arg will be NULL.
470 */ 467 */
471 while (arg) { 468 while (arg) {
472 /* 469 /*
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
153acpi_status 153acpi_status
154acpi_ds_initialize_objects(acpi_native_uint table_index, 154acpi_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
70acpi_ds_result_pop(union acpi_operand_object **object, 70acpi_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
400acpi_ds_obj_stack_pop_and_delete(u32 pop_count, 400acpi_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 fa44fb96fc34..1e872e79db33 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -834,7 +834,7 @@ static int dock_add(acpi_handle handle)
834 goto dock_add_err; 834 goto dock_add_err;
835 } 835 }
836 836
837 printk(KERN_INFO PREFIX "%s \n", ACPI_DOCK_DRIVER_DESCRIPTION); 837 printk(KERN_INFO PREFIX "%s\n", ACPI_DOCK_DRIVER_DESCRIPTION);
838 838
839 return 0; 839 return 0;
840 840
@@ -917,6 +917,12 @@ static int __init dock_init(void)
917 917
918 dock_station = NULL; 918 dock_station = NULL;
919 919
920 if (acpi_disabled)
921 return 0;
922
923 if (acpi_disabled)
924 return 0;
925
920 /* look for a dock station */ 926 /* look for a dock station */
921 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 927 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
922 ACPI_UINT32_MAX, find_dock, &num, NULL); 928 ACPI_UINT32_MAX, find_dock, &num, NULL);
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 0924992187e8..5622aee996b2 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -194,7 +194,7 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
194 while (time_before(jiffies, delay)) { 194 while (time_before(jiffies, delay)) {
195 if (acpi_ec_check_status(ec, event)) 195 if (acpi_ec_check_status(ec, event))
196 return 0; 196 return 0;
197 udelay(ACPI_EC_UDELAY); 197 msleep(1);
198 } 198 }
199 } 199 }
200 pr_err(PREFIX "acpi_ec_wait timeout, status = 0x%2.2x, event = %s\n", 200 pr_err(PREFIX "acpi_ec_wait timeout, status = 0x%2.2x, event = %s\n",
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
189static acpi_status acpi_ev_fixed_event_initialize(void) 189static 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
576void acpi_ev_terminate(void) 576void 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,
81acpi_status acpi_ev_install_region_handlers(void) 81acpi_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)
151acpi_status acpi_ev_initialize_op_regions(void) 151acpi_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
474ACPI_EXPORT_SYMBOL(acpi_clear_gpe) 474ACPI_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)
489acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) 488acpi_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
568ACPI_EXPORT_SYMBOL(acpi_get_gpe_status) 581ACPI_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 24da921d13e3..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 */
55static acpi_status 55static acpi_status
56acpi_ex_add_table(acpi_native_uint table_index, 56acpi_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
75static acpi_status 75static acpi_status
76acpi_ex_add_table(acpi_native_uint table_index, 76acpi_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
@@ -375,9 +376,15 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
375 goto cleanup; 376 goto cleanup;
376 } 377 }
377 378
379 /*
380 * Add the table to the namespace.
381 *
382 * Note: We load the table objects relative to the root of the namespace.
383 * This appears to go against the ACPI specification, but we do it for
384 * compatibility with other ACPI implementations.
385 */
378 status = 386 status =
379 acpi_ex_add_table(table_index, walk_state->scope_info->scope.node, 387 acpi_ex_add_table(table_index, acpi_gbl_root_node, &ddb_handle);
380 &ddb_handle);
381 if (ACPI_FAILURE(status)) { 388 if (ACPI_FAILURE(status)) {
382 389
383 /* On error, table_ptr was deallocated above */ 390 /* On error, table_ptr was deallocated above */
@@ -431,7 +438,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
431{ 438{
432 acpi_status status = AE_OK; 439 acpi_status status = AE_OK;
433 union acpi_operand_object *table_desc = ddb_handle; 440 union acpi_operand_object *table_desc = ddb_handle;
434 acpi_native_uint table_index; 441 u32 table_index;
435 struct acpi_table_header *table; 442 struct acpi_table_header *table;
436 443
437 ACPI_FUNCTION_TRACE(ex_unload_table); 444 ACPI_FUNCTION_TRACE(ex_unload_table);
@@ -448,9 +455,9 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
448 return_ACPI_STATUS(AE_BAD_PARAMETER); 455 return_ACPI_STATUS(AE_BAD_PARAMETER);
449 } 456 }
450 457
451 /* Get the table index from the ddb_handle */ 458 /* Get the table index from the ddb_handle (acpi_size for 64-bit case) */
452 459
453 table_index = (acpi_native_uint) table_desc->reference.object; 460 table_index = (u32) (acpi_size) table_desc->reference.object;
454 461
455 /* Invoke table handler if present */ 462 /* Invoke table handler if present */
456 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
52ACPI_MODULE_NAME("excreate") 50ACPI_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
771void 764void
772acpi_ex_dump_operands(union acpi_operand_object **operands, 765acpi_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 87c5d456e180..0f2dd81736bd 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -274,6 +274,12 @@ static u32 rtc_handler(void *context)
274static inline void rtc_wake_setup(void) 274static inline void rtc_wake_setup(void)
275{ 275{
276 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); 276 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL);
277 /*
278 * After the RTC handler is installed, the Fixed_RTC event should
279 * be disabled. Only when the RTC alarm is set will it be enabled.
280 */
281 acpi_clear_event(ACPI_EVENT_RTC);
282 acpi_disable_event(ACPI_EVENT_RTC, 0);
277} 283}
278 284
279static void rtc_wake_on(struct device *dev) 285static void rtc_wake_on(struct device *dev)
@@ -329,6 +335,12 @@ static int __init acpi_rtc_init(void)
329{ 335{
330 struct device *dev = get_rtc_dev(); 336 struct device *dev = get_rtc_dev();
331 337
338 if (acpi_disabled)
339 return 0;
340
341 if (acpi_disabled)
342 return 0;
343
332 if (dev) { 344 if (dev) {
333 rtc_wake_setup(); 345 rtc_wake_setup();
334 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
68acpi_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
70acpi_status 118acpi_status
71acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info) 119acpi_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
142acpi_status 189acpi_status
143acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, 190acpi_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/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index d9937e05ec6a..dba3cfbe8cba 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -223,15 +223,17 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
223 break; 223 break;
224 } 224 }
225 225
226 /* Set the system indicators to show the desired sleep state. */ 226 /*
227 227 * Set the system indicators to show the desired sleep state.
228 * _SST is an optional method (return no error if not found)
229 */
228 status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL); 230 status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
229 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 231 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
230 ACPI_EXCEPTION((AE_INFO, status, 232 ACPI_EXCEPTION((AE_INFO, status,
231 "While executing method _SST")); 233 "While executing method _SST"));
232 } 234 }
233 235
234 return_ACPI_STATUS(status); 236 return_ACPI_STATUS(AE_OK);
235} 237}
236 238
237ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) 239ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
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
74void acpi_ns_print_pathname(u32 num_segments, char *pathname) 74void 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
73acpi_status 73acpi_status
74acpi_ns_load_table(acpi_native_uint table_index, 74acpi_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 ******************************************************************************/
65acpi_status 65acpi_status
66acpi_ns_one_complete_parse(acpi_native_uint pass_number, 66acpi_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
160acpi_status 160acpi_status
161acpi_ns_parse_table(acpi_native_uint table_index, 161acpi_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
75void 75void
76acpi_ns_report_error(char *module_name, 76acpi_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
132void 132void
133acpi_ns_report_method_error(char *module_name, 133acpi_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
169void 169void
170acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message) 170acpi_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
297void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info) 298void 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
475acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) 475acpi_status
476acpi_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
529acpi_status 530acpi_status
530acpi_ns_externalize_name(u32 internal_name_length, 531acpi_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
824acpi_status 824acpi_status
825acpi_ns_get_node(struct acpi_namespace_node *prefix_node, 825acpi_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 5d59cb33b1a5..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)?
@@ -140,19 +140,42 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
140 } 140 }
141} 141}
142 142
143/*
144 * A lot of BIOS fill in 10 (= no distance) everywhere. This messes
145 * up the NUMA heuristics which wants the local node to have a smaller
146 * distance than the others.
147 * Do some quick checks here and only use the SLIT if it passes.
148 */
149static __init int slit_valid(struct acpi_table_slit *slit)
150{
151 int i, j;
152 int d = slit->locality_count;
153 for (i = 0; i < d; i++) {
154 for (j = 0; j < d; j++) {
155 u8 val = slit->entry[d*i + j];
156 if (i == j) {
157 if (val != LOCAL_DISTANCE)
158 return 0;
159 } else if (val <= LOCAL_DISTANCE)
160 return 0;
161 }
162 }
163 return 1;
164}
165
143static int __init acpi_parse_slit(struct acpi_table_header *table) 166static int __init acpi_parse_slit(struct acpi_table_header *table)
144{ 167{
145 struct acpi_table_slit *slit; 168 struct acpi_table_slit *slit;
146 u32 localities;
147 169
148 if (!table) 170 if (!table)
149 return -EINVAL; 171 return -EINVAL;
150 172
151 slit = (struct acpi_table_slit *)table; 173 slit = (struct acpi_table_slit *)table;
152 174
153 /* downcast just for %llu vs %lu for i386/ia64 */ 175 if (!slit_valid(slit)) {
154 localities = (u32) slit->locality_count; 176 printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n");
155 177 return -EINVAL;
178 }
156 acpi_numa_slit_init(slit); 179 acpi_numa_slit_init(slit);
157 180
158 return 0; 181 return 0;
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c
index f1e8bf65e24e..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
@@ -268,7 +268,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
268 */ 268 */
269 if (ACPI_SUCCESS(status) && 269 if (ACPI_SUCCESS(status) &&
270 possible_method_call && (node->type == ACPI_TYPE_METHOD)) { 270 possible_method_call && (node->type == ACPI_TYPE_METHOD)) {
271 if (walk_state->op->common.aml_opcode == AML_UNLOAD_OP) { 271 if (walk_state->opcode == AML_UNLOAD_OP) {
272 /* 272 /*
273 * acpi_ps_get_next_namestring has increased the AML pointer, 273 * acpi_ps_get_next_namestring has increased the AML pointer,
274 * so we need to restore the saved AML pointer for method call. 274 * so we need to restore the saved AML pointer for method call.
@@ -691,7 +691,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
691 691
692 /* To support super_name arg of Unload */ 692 /* To support super_name arg of Unload */
693 693
694 if (walk_state->op->common.aml_opcode == AML_UNLOAD_OP) { 694 if (walk_state->opcode == AML_UNLOAD_OP) {
695 status = 695 status =
696 acpi_ps_get_next_namepath(walk_state, 696 acpi_ps_get_next_namepath(walk_state,
697 parser_state, arg, 697 parser_state, arg,
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)
333static void 333static void
334acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action) 334acpi_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/processor_core.c b/drivers/acpi/processor_core.c
index 386e5aa48834..ec0f2d581ece 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -86,7 +86,6 @@ static int acpi_processor_info_open_fs(struct inode *inode, struct file *file);
86static void acpi_processor_notify(acpi_handle handle, u32 event, void *data); 86static void acpi_processor_notify(acpi_handle handle, u32 event, void *data);
87static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); 87static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu);
88static int acpi_processor_handle_eject(struct acpi_processor *pr); 88static int acpi_processor_handle_eject(struct acpi_processor *pr);
89extern int acpi_processor_tstate_has_changed(struct acpi_processor *pr);
90 89
91 90
92static const struct acpi_device_id processor_device_ids[] = { 91static const struct acpi_device_id processor_device_ids[] = {
@@ -119,8 +118,31 @@ static const struct file_operations acpi_processor_info_fops = {
119 .release = single_release, 118 .release = single_release,
120}; 119};
121 120
122struct acpi_processor *processors[NR_CPUS]; 121DEFINE_PER_CPU(struct acpi_processor *, processors);
123struct acpi_processor_errata errata __read_mostly; 122struct acpi_processor_errata errata __read_mostly;
123static 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
131static 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};
124 146
125/* -------------------------------------------------------------------------- 147/* --------------------------------------------------------------------------
126 Errata Handling 148 Errata Handling
@@ -266,7 +288,20 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr)
266 288
267 if (!pdc_in) 289 if (!pdc_in)
268 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;
269 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 }
270 status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL); 305 status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL);
271 306
272 if (ACPI_FAILURE(status)) 307 if (ACPI_FAILURE(status))
@@ -615,14 +650,14 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid)
615 return 0; 650 return 0;
616} 651}
617 652
618static void *processor_device_array[NR_CPUS]; 653static DEFINE_PER_CPU(void *, processor_device_array);
619 654
620static int __cpuinit acpi_processor_start(struct acpi_device *device) 655static int __cpuinit acpi_processor_start(struct acpi_device *device)
621{ 656{
622 int result = 0; 657 int result = 0;
623 acpi_status status = AE_OK; 658 acpi_status status = AE_OK;
624 struct acpi_processor *pr; 659 struct acpi_processor *pr;
625 660 struct sys_device *sysdev;
626 661
627 pr = acpi_driver_data(device); 662 pr = acpi_driver_data(device);
628 663
@@ -639,20 +674,24 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
639 * ACPI id of processors can be reported wrongly by the BIOS. 674 * ACPI id of processors can be reported wrongly by the BIOS.
640 * Don't trust it blindly 675 * Don't trust it blindly
641 */ 676 */
642 if (processor_device_array[pr->id] != NULL && 677 if (per_cpu(processor_device_array, pr->id) != NULL &&
643 processor_device_array[pr->id] != device) { 678 per_cpu(processor_device_array, pr->id) != device) {
644 printk(KERN_WARNING "BIOS reported wrong ACPI id " 679 printk(KERN_WARNING "BIOS reported wrong ACPI id "
645 "for the processor\n"); 680 "for the processor\n");
646 return -ENODEV; 681 return -ENODEV;
647 } 682 }
648 processor_device_array[pr->id] = device; 683 per_cpu(processor_device_array, pr->id) = device;
649 684
650 processors[pr->id] = pr; 685 per_cpu(processors, pr->id) = pr;
651 686
652 result = acpi_processor_add_fs(device); 687 result = acpi_processor_add_fs(device);
653 if (result) 688 if (result)
654 goto end; 689 goto end;
655 690
691 sysdev = get_cpu_sysdev(pr->id);
692 if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev"))
693 return -EFAULT;
694
656 status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, 695 status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY,
657 acpi_processor_notify, pr); 696 acpi_processor_notify, pr);
658 697
@@ -750,7 +789,7 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb,
750 unsigned long action, void *hcpu) 789 unsigned long action, void *hcpu)
751{ 790{
752 unsigned int cpu = (unsigned long)hcpu; 791 unsigned int cpu = (unsigned long)hcpu;
753 struct acpi_processor *pr = processors[cpu]; 792 struct acpi_processor *pr = per_cpu(processors, cpu);
754 793
755 if (action == CPU_ONLINE && pr) { 794 if (action == CPU_ONLINE && pr) {
756 acpi_processor_ppc_has_changed(pr); 795 acpi_processor_ppc_has_changed(pr);
@@ -811,6 +850,8 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
811 status = acpi_remove_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, 850 status = acpi_remove_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY,
812 acpi_processor_notify); 851 acpi_processor_notify);
813 852
853 sysfs_remove_link(&device->dev.kobj, "sysdev");
854
814 acpi_processor_remove_fs(device); 855 acpi_processor_remove_fs(device);
815 856
816 if (pr->cdev) { 857 if (pr->cdev) {
@@ -820,8 +861,8 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
820 pr->cdev = NULL; 861 pr->cdev = NULL;
821 } 862 }
822 863
823 processors[pr->id] = NULL; 864 per_cpu(processors, pr->id) = NULL;
824 processor_device_array[pr->id] = NULL; 865 per_cpu(processor_device_array, pr->id) = NULL;
825 kfree(pr); 866 kfree(pr);
826 867
827 return 0; 868 return 0;
@@ -1015,9 +1056,9 @@ static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu)
1015 1056
1016static int acpi_processor_handle_eject(struct acpi_processor *pr) 1057static int acpi_processor_handle_eject(struct acpi_processor *pr)
1017{ 1058{
1018 if (cpu_online(pr->id)) { 1059 if (cpu_online(pr->id))
1019 return (-EINVAL); 1060 cpu_down(pr->id);
1020 } 1061
1021 arch_unregister_cpu(pr->id); 1062 arch_unregister_cpu(pr->id);
1022 acpi_unmap_lsapic(pr->id); 1063 acpi_unmap_lsapic(pr->id);
1023 return (0); 1064 return (0);
@@ -1069,8 +1110,6 @@ static int __init acpi_processor_init(void)
1069{ 1110{
1070 int result = 0; 1111 int result = 0;
1071 1112
1072
1073 memset(&processors, 0, sizeof(processors));
1074 memset(&errata, 0, sizeof(errata)); 1113 memset(&errata, 0, sizeof(errata));
1075 1114
1076#ifdef CONFIG_SMP 1115#ifdef CONFIG_SMP
@@ -1084,6 +1123,11 @@ static int __init acpi_processor_init(void)
1084 return -ENOMEM; 1123 return -ENOMEM;
1085 acpi_processor_dir->owner = THIS_MODULE; 1124 acpi_processor_dir->owner = THIS_MODULE;
1086 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);
1087 result = cpuidle_register_driver(&acpi_idle_driver); 1131 result = cpuidle_register_driver(&acpi_idle_driver);
1088 if (result < 0) 1132 if (result < 0)
1089 goto out_proc; 1133 goto out_proc;
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 2dd2c1f3a01c..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);
@@ -1339,7 +1356,7 @@ static void smp_callback(void *v)
1339static int acpi_processor_latency_notify(struct notifier_block *b, 1356static int acpi_processor_latency_notify(struct notifier_block *b,
1340 unsigned long l, void *v) 1357 unsigned long l, void *v)
1341{ 1358{
1342 smp_call_function(smp_callback, NULL, 0, 1); 1359 smp_call_function(smp_callback, NULL, 1);
1343 return NOTIFY_OK; 1360 return NOTIFY_OK;
1344} 1361}
1345 1362
@@ -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;
@@ -1669,6 +1686,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1669 return -EINVAL; 1686 return -EINVAL;
1670 } 1687 }
1671 1688
1689 dev->cpu = pr->id;
1672 for (i = 0; i < CPUIDLE_STATE_MAX; i++) { 1690 for (i = 0; i < CPUIDLE_STATE_MAX; i++) {
1673 dev->states[i].name[0] = '\0'; 1691 dev->states[i].name[0] = '\0';
1674 dev->states[i].desc[0] = '\0'; 1692 dev->states[i].desc[0] = '\0';
@@ -1738,7 +1756,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1738 1756
1739int acpi_processor_cst_has_changed(struct acpi_processor *pr) 1757int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1740{ 1758{
1741 int ret; 1759 int ret = 0;
1742 1760
1743 if (boot_option_idle_override) 1761 if (boot_option_idle_override)
1744 return 0; 1762 return 0;
@@ -1756,8 +1774,10 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1756 cpuidle_pause_and_lock(); 1774 cpuidle_pause_and_lock();
1757 cpuidle_disable_device(&pr->power.dev); 1775 cpuidle_disable_device(&pr->power.dev);
1758 acpi_processor_get_power_info(pr); 1776 acpi_processor_get_power_info(pr);
1759 acpi_processor_setup_cpuidle(pr); 1777 if (pr->flags.power) {
1760 ret = cpuidle_enable_device(&pr->power.dev); 1778 acpi_processor_setup_cpuidle(pr);
1779 ret = cpuidle_enable_device(&pr->power.dev);
1780 }
1761 cpuidle_resume_and_unlock(); 1781 cpuidle_resume_and_unlock();
1762 1782
1763 return ret; 1783 return ret;
@@ -1777,6 +1797,15 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1777 return 0; 1797 return 0;
1778 1798
1779 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 }
1780 dmi_check_system(processor_power_dmi_table); 1809 dmi_check_system(processor_power_dmi_table);
1781 max_cstate = acpi_processor_cstate_check(max_cstate); 1810 max_cstate = acpi_processor_cstate_check(max_cstate);
1782 if (max_cstate < ACPI_C_STATES_MAX) 1811 if (max_cstate < ACPI_C_STATES_MAX)
@@ -1813,7 +1842,6 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1813 if (pr->flags.power) { 1842 if (pr->flags.power) {
1814#ifdef CONFIG_CPU_IDLE 1843#ifdef CONFIG_CPU_IDLE
1815 acpi_processor_setup_cpuidle(pr); 1844 acpi_processor_setup_cpuidle(pr);
1816 pr->power.dev.cpu = pr->id;
1817 if (cpuidle_register_device(&pr->power.dev)) 1845 if (cpuidle_register_device(&pr->power.dev))
1818 return -EIO; 1846 return -EIO;
1819#endif 1847#endif
@@ -1850,8 +1878,7 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
1850 return 0; 1878 return 0;
1851 1879
1852#ifdef CONFIG_CPU_IDLE 1880#ifdef CONFIG_CPU_IDLE
1853 if (pr->flags.power) 1881 cpuidle_unregister_device(&pr->power.dev);
1854 cpuidle_unregister_device(&pr->power.dev);
1855#endif 1882#endif
1856 pr->flags.power_setup_done = 0; 1883 pr->flags.power_setup_done = 0;
1857 1884
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
698err_ret: 698err_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 bb06738860c4..0622ace05220 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
173err_ret: 173err_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(i, online_throttling_cpus) { 1037 for_each_cpu_mask(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
6void 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
74static u8 acpi_rs_count_set_bits(u16 bit_field) 74static 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 ******************************************************************************/
63u8 acpi_rs_decode_bitmask(u16 mask, u8 * list) 63u8 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
97u16 acpi_rs_encode_bitmask(u8 * list, u8 count) 97u16 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)
130void 130void
131acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) 131acpi_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 f276890cfde7..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}
93static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); 95static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL);
94 96
95static int acpi_eject_operation(acpi_handle handle, int lockable) 97static 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 */
104 107
105 if (lockable) { 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
114
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
130static ssize_t 150static ssize_t
131acpi_eject_store(struct device *d, struct device_attribute *attr, 151acpi_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) 180err:
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
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index af7f4663deaa..0489a7d1d42c 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -32,9 +32,8 @@ static int acpi_sleep_prepare(u32 acpi_state)
32 if (!acpi_wakeup_address) { 32 if (!acpi_wakeup_address) {
33 return -EFAULT; 33 return -EFAULT;
34 } 34 }
35 acpi_set_firmware_waking_vector((acpi_physical_address) 35 acpi_set_firmware_waking_vector(
36 virt_to_phys((void *) 36 (acpi_physical_address)acpi_wakeup_address);
37 acpi_wakeup_address));
38 37
39 } 38 }
40 ACPI_FLUSH_CPU_CACHE(); 39 ACPI_FLUSH_CPU_CACHE();
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c
index 8a5fe8710513..4ebbba2b6b19 100644
--- a/drivers/acpi/sleep/proc.c
+++ b/drivers/acpi/sleep/proc.c
@@ -315,8 +315,11 @@ acpi_system_write_alarm(struct file *file,
315 cmos_bcd_write(day, acpi_gbl_FADT.day_alarm, rtc_control); 315 cmos_bcd_write(day, acpi_gbl_FADT.day_alarm, rtc_control);
316 if (acpi_gbl_FADT.month_alarm) 316 if (acpi_gbl_FADT.month_alarm)
317 cmos_bcd_write(mo, acpi_gbl_FADT.month_alarm, rtc_control); 317 cmos_bcd_write(mo, acpi_gbl_FADT.month_alarm, rtc_control);
318 if (acpi_gbl_FADT.century) 318 if (acpi_gbl_FADT.century) {
319 if (adjust)
320 yr += cmos_bcd_read(acpi_gbl_FADT.century, rtc_control) * 100;
319 cmos_bcd_write(yr / 100, acpi_gbl_FADT.century, rtc_control); 321 cmos_bcd_write(yr / 100, acpi_gbl_FADT.century, rtc_control);
322 }
320 /* enable the rtc alarm interrupt */ 323 /* enable the rtc alarm interrupt */
321 rtc_control |= RTC_AIE; 324 rtc_control |= RTC_AIE;
322 CMOS_WRITE(rtc_control, RTC_CONTROL); 325 CMOS_WRITE(rtc_control, RTC_CONTROL);
@@ -495,6 +498,12 @@ static int __init acpi_sleep_proc_init(void)
495 acpi_root_dir, &acpi_system_alarm_fops); 498 acpi_root_dir, &acpi_system_alarm_fops);
496 499
497 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); 500 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL);
501 /*
502 * Disable the RTC event after installing RTC handler.
503 * Only when RTC alarm is set will it be enabled.
504 */
505 acpi_clear_event(ACPI_EVENT_RTC);
506 acpi_disable_event(ACPI_EVENT_RTC, 0);
498#endif /* HAVE_ACPI_LEGACY_ALARM */ 507#endif /* HAVE_ACPI_LEGACY_ALARM */
499 508
500 /* 'wakeup device' [R/W] */ 509 /* 'wakeup device' [R/W] */
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
index 769f24855eb6..d8e3f153b295 100644
--- a/drivers/acpi/system.c
+++ b/drivers/acpi/system.c
@@ -77,7 +77,6 @@ static ssize_t acpi_table_show(struct kobject *kobj,
77 container_of(bin_attr, struct acpi_table_attr, attr); 77 container_of(bin_attr, struct acpi_table_attr, attr);
78 struct acpi_table_header *table_header = NULL; 78 struct acpi_table_header *table_header = NULL;
79 acpi_status status; 79 acpi_status status;
80 ssize_t ret_count = count;
81 80
82 status = 81 status =
83 acpi_get_table(table_attr->name, table_attr->instance, 82 acpi_get_table(table_attr->name, table_attr->instance,
@@ -85,18 +84,8 @@ static ssize_t acpi_table_show(struct kobject *kobj,
85 if (ACPI_FAILURE(status)) 84 if (ACPI_FAILURE(status))
86 return -ENODEV; 85 return -ENODEV;
87 86
88 if (offset >= table_header->length) { 87 return memory_read_from_buffer(buf, count, &offset,
89 ret_count = 0; 88 table_header, table_header->length);
90 goto end;
91 }
92
93 if (offset + ret_count > table_header->length)
94 ret_count = table_header->length - offset;
95
96 memcpy(buf, ((char *)table_header) + offset, ret_count);
97
98 end:
99 return ret_count;
100} 89}
101 90
102static void acpi_table_attr_init(struct acpi_table_attr *table_attr, 91static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
@@ -178,7 +167,13 @@ static int acpi_system_sysfs_init(void)
178#define COUNT_ERROR 2 /* other */ 167#define COUNT_ERROR 2 /* other */
179#define NUM_COUNTERS_EXTRA 3 168#define NUM_COUNTERS_EXTRA 3
180 169
181static u32 *all_counters; 170#define ACPI_EVENT_VALID 0x01
171struct event_counter {
172 u32 count;
173 u32 flags;
174};
175
176static struct event_counter *all_counters;
182static u32 num_gpes; 177static u32 num_gpes;
183static u32 num_counters; 178static u32 num_counters;
184static struct attribute **all_attrs; 179static struct attribute **all_attrs;
@@ -213,9 +208,44 @@ static int count_num_gpes(void)
213 return count; 208 return count;
214} 209}
215 210
211static 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
216static void delete_gpe_attr_array(void) 246static void delete_gpe_attr_array(void)
217{ 247{
218 u32 *tmp = all_counters; 248 struct event_counter *tmp = all_counters;
219 249
220 all_counters = NULL; 250 all_counters = NULL;
221 kfree(tmp); 251 kfree(tmp);
@@ -241,9 +271,10 @@ void acpi_os_gpe_count(u32 gpe_number)
241 return; 271 return;
242 272
243 if (gpe_number < num_gpes) 273 if (gpe_number < num_gpes)
244 all_counters[gpe_number]++; 274 all_counters[gpe_number].count++;
245 else 275 else
246 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR]++; 276 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR].
277 count++;
247 278
248 return; 279 return;
249} 280}
@@ -254,44 +285,144 @@ void acpi_os_fixed_event_count(u32 event_number)
254 return; 285 return;
255 286
256 if (event_number < ACPI_NUM_FIXED_EVENTS) 287 if (event_number < ACPI_NUM_FIXED_EVENTS)
257 all_counters[num_gpes + event_number]++; 288 all_counters[num_gpes + event_number].count++;
258 else 289 else
259 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR]++; 290 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR].
291 count++;
260 292
261 return; 293 return;
262} 294}
263 295
296static 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;
321end:
322 return result;
323}
324
264static ssize_t counter_show(struct kobject *kobj, 325static ssize_t counter_show(struct kobject *kobj,
265 struct kobj_attribute *attr, char *buf) 326 struct kobj_attribute *attr, char *buf)
266{ 327{
267 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 =
268 acpi_irq_handled; 335 acpi_irq_handled;
269 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE] = 336 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count =
270 acpi_gpe_count; 337 acpi_gpe_count;
271 338
272 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
356end:
357 size += sprintf(buf + size, "\n");
358 return result ? result : size;
273} 359}
274 360
275/* 361/*
276 * counter_set() sets the specified counter. 362 * counter_set() sets the specified counter.
277 * 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.
278 */ 365 */
279static ssize_t counter_set(struct kobject *kobj, 366static ssize_t counter_set(struct kobject *kobj,
280 struct kobj_attribute *attr, const char *buf, size_t size) 367 struct kobj_attribute *attr, const char *buf, size_t size)
281{ 368{
282 int index = attr - counter_attrs; 369 int index = attr - counter_attrs;
370 acpi_event_status status;
371 acpi_handle handle;
372 int result = 0;
283 373
284 if (index == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) { 374 if (index == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) {
285 int i; 375 int i;
286 for (i = 0; i < num_counters; ++i) 376 for (i = 0; i < num_counters; ++i)
287 all_counters[i] = 0; 377 all_counters[i].count = 0;
288 acpi_gpe_count = 0; 378 acpi_gpe_count = 0;
289 acpi_irq_handled = 0; 379 acpi_irq_handled = 0;
380 goto end;
381 }
290 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);
291 } else 419 } else
292 all_counters[index] = strtoul(buf, NULL, 0); 420 all_counters[index].count = strtoul(buf, NULL, 0);
293 421
294 return size; 422 if (ACPI_FAILURE(result))
423 result = -EINVAL;
424end:
425 return result ? result : size;
295} 426}
296 427
297void acpi_irq_stats_init(void) 428void acpi_irq_stats_init(void)
@@ -309,7 +440,8 @@ void acpi_irq_stats_init(void)
309 if (all_attrs == NULL) 440 if (all_attrs == NULL)
310 return; 441 return;
311 442
312 all_counters = kzalloc(sizeof(u32) * (num_counters), GFP_KERNEL); 443 all_counters = kzalloc(sizeof(struct event_counter) * (num_counters),
444 GFP_KERNEL);
313 if (all_counters == NULL) 445 if (all_counters == NULL)
314 goto fail; 446 goto fail;
315 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
125static void inline 125static void inline
126acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, 126acpi_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
158void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags) 158void 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 ******************************************************************************/
66acpi_status 66acpi_status
67acpi_tb_find_table(char *signature, 67acpi_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 402f93e1ff20..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
109acpi_status 109acpi_status
110acpi_tb_add_table(struct acpi_table_desc *table_desc, 110acpi_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);
@@ -123,24 +122,13 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc,
123 } 122 }
124 } 123 }
125 124
126 /* The table must be either an SSDT or a PSDT or an OEMx */ 125 /*
127 126 * Originally, we checked the table signature for "SSDT" or "PSDT" here.
128 if (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT)&& 127 * Next, we added support for OEMx tables, signature "OEM".
129 !ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT)&& 128 * Valid tables were encountered with a null signature, so we've just
130 strncmp(table_desc->pointer->signature, "OEM", 3)) { 129 * given up on validating the signature, since it seems to be a waste
131 /* Check for a printable name */ 130 * of code. The original code was removed (05/2008).
132 if (acpi_ut_valid_acpi_name( 131 */
133 *(u32 *) table_desc->pointer->signature)) {
134 ACPI_ERROR((AE_INFO, "Table has invalid signature "
135 "[%4.4s], must be SSDT or PSDT",
136 table_desc->pointer->signature));
137 } else {
138 ACPI_ERROR((AE_INFO, "Table has invalid signature "
139 "(0x%8.8X), must be SSDT or PSDT",
140 *(u32 *) table_desc->pointer->signature));
141 }
142 return_ACPI_STATUS(AE_BAD_SIGNATURE);
143 }
144 132
145 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 133 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
146 134
@@ -218,8 +206,8 @@ acpi_status acpi_tb_resize_root_table_list(void)
218 206
219 /* Increase the Table Array size */ 207 /* Increase the Table Array size */
220 208
221 tables = ACPI_ALLOCATE_ZEROED((acpi_gbl_root_table_list.size + 209 tables = ACPI_ALLOCATE_ZEROED(((acpi_size) acpi_gbl_root_table_list.
222 ACPI_ROOT_TABLE_SIZE_INCREMENT) 210 size + ACPI_ROOT_TABLE_SIZE_INCREMENT)
223 * sizeof(struct acpi_table_desc)); 211 * sizeof(struct acpi_table_desc));
224 if (!tables) { 212 if (!tables) {
225 ACPI_ERROR((AE_INFO, 213 ACPI_ERROR((AE_INFO,
@@ -231,7 +219,7 @@ acpi_status acpi_tb_resize_root_table_list(void)
231 219
232 if (acpi_gbl_root_table_list.tables) { 220 if (acpi_gbl_root_table_list.tables) {
233 ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, 221 ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables,
234 acpi_gbl_root_table_list.size * 222 (acpi_size) acpi_gbl_root_table_list.size *
235 sizeof(struct acpi_table_desc)); 223 sizeof(struct acpi_table_desc));
236 224
237 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { 225 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
@@ -264,7 +252,7 @@ acpi_status acpi_tb_resize_root_table_list(void)
264acpi_status 252acpi_status
265acpi_tb_store_table(acpi_physical_address address, 253acpi_tb_store_table(acpi_physical_address address,
266 struct acpi_table_header *table, 254 struct acpi_table_header *table,
267 u32 length, u8 flags, acpi_native_uint * table_index) 255 u32 length, u8 flags, u32 *table_index)
268{ 256{
269 acpi_status status = AE_OK; 257 acpi_status status = AE_OK;
270 258
@@ -345,7 +333,7 @@ void acpi_tb_delete_table(struct acpi_table_desc *table_desc)
345 333
346void acpi_tb_terminate(void) 334void acpi_tb_terminate(void)
347{ 335{
348 acpi_native_uint i; 336 u32 i;
349 337
350 ACPI_FUNCTION_TRACE(tb_terminate); 338 ACPI_FUNCTION_TRACE(tb_terminate);
351 339
@@ -385,7 +373,7 @@ void acpi_tb_terminate(void)
385 * 373 *
386 ******************************************************************************/ 374 ******************************************************************************/
387 375
388void acpi_tb_delete_namespace_by_owner(acpi_native_uint table_index) 376void acpi_tb_delete_namespace_by_owner(u32 table_index)
389{ 377{
390 acpi_owner_id owner_id; 378 acpi_owner_id owner_id;
391 379
@@ -414,7 +402,7 @@ void acpi_tb_delete_namespace_by_owner(acpi_native_uint table_index)
414 * 402 *
415 ******************************************************************************/ 403 ******************************************************************************/
416 404
417acpi_status acpi_tb_allocate_owner_id(acpi_native_uint table_index) 405acpi_status acpi_tb_allocate_owner_id(u32 table_index)
418{ 406{
419 acpi_status status = AE_BAD_PARAMETER; 407 acpi_status status = AE_BAD_PARAMETER;
420 408
@@ -442,7 +430,7 @@ acpi_status acpi_tb_allocate_owner_id(acpi_native_uint table_index)
442 * 430 *
443 ******************************************************************************/ 431 ******************************************************************************/
444 432
445acpi_status acpi_tb_release_owner_id(acpi_native_uint table_index) 433acpi_status acpi_tb_release_owner_id(u32 table_index)
446{ 434{
447 acpi_status status = AE_BAD_PARAMETER; 435 acpi_status status = AE_BAD_PARAMETER;
448 436
@@ -473,8 +461,7 @@ acpi_status acpi_tb_release_owner_id(acpi_native_uint table_index)
473 * 461 *
474 ******************************************************************************/ 462 ******************************************************************************/
475 463
476acpi_status 464acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id)
477acpi_tb_get_owner_id(acpi_native_uint table_index, acpi_owner_id * owner_id)
478{ 465{
479 acpi_status status = AE_BAD_PARAMETER; 466 acpi_status status = AE_BAD_PARAMETER;
480 467
@@ -501,7 +488,7 @@ acpi_tb_get_owner_id(acpi_native_uint table_index, acpi_owner_id * owner_id)
501 * 488 *
502 ******************************************************************************/ 489 ******************************************************************************/
503 490
504u8 acpi_tb_is_table_loaded(acpi_native_uint table_index) 491u8 acpi_tb_is_table_loaded(u32 table_index)
505{ 492{
506 u8 is_loaded = FALSE; 493 u8 is_loaded = FALSE;
507 494
@@ -529,7 +516,7 @@ u8 acpi_tb_is_table_loaded(acpi_native_uint table_index)
529 * 516 *
530 ******************************************************************************/ 517 ******************************************************************************/
531 518
532void acpi_tb_set_table_loaded_flag(acpi_native_uint table_index, u8 is_loaded) 519void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded)
533{ 520{
534 521
535 (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 */
51static acpi_physical_address 51static acpi_physical_address
52acpi_tb_get_root_table_entry(u8 * table_entry, 52acpi_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
241u8 acpi_tb_checksum(u8 * buffer, acpi_native_uint length) 241u8 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
269void 269void
270acpi_tb_install_table(acpi_physical_address address, 270acpi_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
338static acpi_physical_address 338static acpi_physical_address
339acpi_tb_get_root_table_entry(u8 * table_entry, 339acpi_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
395acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) 394acpi_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 fb57b93c2495..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)
222acpi_status acpi_load_table(struct acpi_table_header *table_ptr) 222acpi_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 *****************************************************************************/
265acpi_status 265acpi_status
266acpi_get_table_header(char *signature, 266acpi_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 *****************************************************************************/
379acpi_status 378acpi_status
380acpi_get_table(char *signature, 379acpi_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 ******************************************************************************/
437acpi_status 436acpi_status
438acpi_get_table_by_index(acpi_native_uint table_index, 437acpi_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
@@ -540,7 +538,7 @@ static acpi_status acpi_tb_load_namespace(void)
540 acpi_tb_print_table_header(0, table); 538 acpi_tb_print_table_header(0, table);
541 539
542 if (no_auto_ssdt == 0) { 540 if (no_auto_ssdt == 0) {
543 printk(KERN_WARNING "ACPI: DSDT override uses original SSDTs unless \"acpi_no_auto_ssdt\""); 541 printk(KERN_WARNING "ACPI: DSDT override uses original SSDTs unless \"acpi_no_auto_ssdt\"\n");
544 } 542 }
545 } 543 }
546 544
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
121acpi_status acpi_find_root_pointer(acpi_native_uint * table_address) 121acpi_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/thermal.c b/drivers/acpi/thermal.c
index 504385b1f211..84c795fb9b1e 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -364,10 +364,17 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
364 if (flag & ACPI_TRIPS_CRITICAL) { 364 if (flag & ACPI_TRIPS_CRITICAL) {
365 status = acpi_evaluate_integer(tz->device->handle, 365 status = acpi_evaluate_integer(tz->device->handle,
366 "_CRT", NULL, &tz->trips.critical.temperature); 366 "_CRT", NULL, &tz->trips.critical.temperature);
367 if (ACPI_FAILURE(status)) { 367 /*
368 * Treat freezing temperatures as invalid as well; some
369 * BIOSes return really low values and cause reboots at startup.
370 * Below zero (Celcius) values clearly aren't right for sure..
371 * ... so lets discard those as invalid.
372 */
373 if (ACPI_FAILURE(status) ||
374 tz->trips.critical.temperature <= 2732) {
368 tz->trips.critical.flags.valid = 0; 375 tz->trips.critical.flags.valid = 0;
369 ACPI_EXCEPTION((AE_INFO, status, 376 ACPI_EXCEPTION((AE_INFO, status,
370 "No critical threshold")); 377 "No or invalid critical threshold"));
371 return -ENODEV; 378 return -ENODEV;
372 } else { 379 } else {
373 tz->trips.critical.flags.valid = 1; 380 tz->trips.critical.flags.valid = 1;
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
312void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) 312void *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
355void *acpi_ut_allocate_zeroed(acpi_size size, 356void *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
157acpi_ut_debug_print(u32 requested_debug_level, 157acpi_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
228acpi_ut_debug_print_raw(u32 requested_debug_level, 229acpi_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 ******************************************************************************/
262void 264void
263acpi_ut_trace(u32 line_number, 265acpi_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)
293void 296void
294acpi_ut_trace_ptr(u32 line_number, 297acpi_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,
324void 327void
325acpi_ut_trace_str(u32 line_number, 328acpi_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,
356void 359void
357acpi_ut_trace_u32(u32 line_number, 360acpi_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
387void 390void
388acpi_ut_exit(u32 line_number, 391acpi_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)
417void 421void
418acpi_ut_status_exit(u32 line_number, 422acpi_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)
458void 463void
459acpi_ut_value_exit(u32 line_number, 464acpi_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)
490void 496void
491acpi_ut_ptr_exit(u32 line_number, 497acpi_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
520void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) 526void 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 e4ba7192cd15..f34be6773556 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -64,7 +64,7 @@ ACPI_MODULE_NAME("utmisc")
64 ******************************************************************************/ 64 ******************************************************************************/
65const char *acpi_ut_validate_exception(acpi_status status) 65const 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
166acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) 162acpi_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
596u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position) 592u8 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
629u8 acpi_ut_valid_acpi_name(u32 name) 625u8 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
658acpi_name acpi_ut_repair_name(char *name) 654acpi_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
1026void ACPI_INTERNAL_VAR_XFACE 1022void ACPI_INTERNAL_VAR_XFACE
1027acpi_ut_error(char *module_name, u32 line_number, char *format, ...) 1023acpi_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
1039void ACPI_INTERNAL_VAR_XFACE 1035void ACPI_INTERNAL_VAR_XFACE
1040acpi_ut_exception(char *module_name, 1036acpi_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
@@ -1048,12 +1044,14 @@ acpi_ut_exception(char *module_name,
1048 va_start(args, format); 1044 va_start(args, format);
1049 acpi_os_vprintf(format, args); 1045 acpi_os_vprintf(format, args);
1050 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); 1046 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
1047 va_end(args);
1051} 1048}
1052 1049
1053EXPORT_SYMBOL(acpi_ut_exception); 1050EXPORT_SYMBOL(acpi_ut_exception);
1054 1051
1055void ACPI_INTERNAL_VAR_XFACE 1052void ACPI_INTERNAL_VAR_XFACE
1056acpi_ut_warning(char *module_name, u32 line_number, char *format, ...) 1053acpi_ut_warning(const char *module_name,
1054 u32 line_number, const char *format, ...)
1057{ 1055{
1058 va_list args; 1056 va_list args;
1059 1057
@@ -1063,11 +1061,10 @@ acpi_ut_warning(char *module_name, u32 line_number, char *format, ...)
1063 acpi_os_vprintf(format, args); 1061 acpi_os_vprintf(format, args);
1064 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); 1062 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
1065 va_end(args); 1063 va_end(args);
1066 va_end(args);
1067} 1064}
1068 1065
1069void ACPI_INTERNAL_VAR_XFACE 1066void ACPI_INTERNAL_VAR_XFACE
1070acpi_ut_info(char *module_name, u32 line_number, char *format, ...) 1067acpi_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
86union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name, 86union 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
350void *acpi_ut_allocate_object_desc_dbg(char *module_name, 351void *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 5e5dda3a3027..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
639static int
640acpi_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
689out_free_levels:
690 kfree(br->levels);
691out_free:
692 kfree(br);
693out:
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)
640static void acpi_video_device_find_cap(struct acpi_video_device *device) 710static 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
1695acpi_video_switch_brightness(struct acpi_video_device *device, int event) 1716acpi_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);
@@ -1713,7 +1736,8 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
1713 1736
1714 status = acpi_video_bus_get_one_device(dev, video); 1737 status = acpi_video_bus_get_one_device(dev, video);
1715 if (ACPI_FAILURE(status)) { 1738 if (ACPI_FAILURE(status)) {
1716 ACPI_EXCEPTION((AE_INFO, status, "Cant attach device")); 1739 ACPI_DEBUG_PRINT((ACPI_DB_WARN,
1740 "Cant attach device"));
1717 continue; 1741 continue;
1718 } 1742 }
1719 } 1743 }