aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/acpi/acpica
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r--drivers/acpi/acpica/Makefile2
-rw-r--r--drivers/acpi/acpica/accommon.h2
-rw-r--r--drivers/acpi/acpica/acconfig.h2
-rw-r--r--drivers/acpi/acpica/acdebug.h2
-rw-r--r--drivers/acpi/acpica/acdispat.h2
-rw-r--r--drivers/acpi/acpica/acevents.h15
-rw-r--r--drivers/acpi/acpica/acglobal.h2
-rw-r--r--drivers/acpi/acpica/achware.h2
-rw-r--r--drivers/acpi/acpica/acinterp.h44
-rw-r--r--drivers/acpi/acpica/aclocal.h8
-rw-r--r--drivers/acpi/acpica/acmacros.h17
-rw-r--r--drivers/acpi/acpica/acnamesp.h33
-rw-r--r--drivers/acpi/acpica/acobject.h12
-rw-r--r--drivers/acpi/acpica/acopcode.h2
-rw-r--r--drivers/acpi/acpica/acparser.h2
-rw-r--r--drivers/acpi/acpica/acpredef.h2
-rw-r--r--drivers/acpi/acpica/acresrc.h2
-rw-r--r--drivers/acpi/acpica/acstruct.h2
-rw-r--r--drivers/acpi/acpica/actables.h2
-rw-r--r--drivers/acpi/acpica/acutils.h29
-rw-r--r--drivers/acpi/acpica/amlcode.h2
-rw-r--r--drivers/acpi/acpica/amlresrc.h2
-rw-r--r--drivers/acpi/acpica/dsfield.c12
-rw-r--r--drivers/acpi/acpica/dsinit.c4
-rw-r--r--drivers/acpi/acpica/dsmethod.c4
-rw-r--r--drivers/acpi/acpica/dsmthdat.c6
-rw-r--r--drivers/acpi/acpica/dsobject.c12
-rw-r--r--drivers/acpi/acpica/dsopcode.c2
-rw-r--r--drivers/acpi/acpica/dsutils.c2
-rw-r--r--drivers/acpi/acpica/dswexec.c2
-rw-r--r--drivers/acpi/acpica/dswload.c116
-rw-r--r--drivers/acpi/acpica/dswscope.c2
-rw-r--r--drivers/acpi/acpica/dswstate.c2
-rw-r--r--drivers/acpi/acpica/evevent.c2
-rw-r--r--drivers/acpi/acpica/evgpe.c168
-rw-r--r--drivers/acpi/acpica/evgpeblk.c97
-rw-r--r--drivers/acpi/acpica/evmisc.c14
-rw-r--r--drivers/acpi/acpica/evregion.c92
-rw-r--r--drivers/acpi/acpica/evrgnini.c19
-rw-r--r--drivers/acpi/acpica/evsci.c2
-rw-r--r--drivers/acpi/acpica/evxface.c195
-rw-r--r--drivers/acpi/acpica/evxfevnt.c102
-rw-r--r--drivers/acpi/acpica/evxfregn.c6
-rw-r--r--drivers/acpi/acpica/exconfig.c21
-rw-r--r--drivers/acpi/acpica/exconvrt.c24
-rw-r--r--drivers/acpi/acpica/excreate.c2
-rw-r--r--drivers/acpi/acpica/exdump.c2
-rw-r--r--drivers/acpi/acpica/exfield.c12
-rw-r--r--drivers/acpi/acpica/exfldio.c59
-rw-r--r--drivers/acpi/acpica/exmisc.c12
-rw-r--r--drivers/acpi/acpica/exmutex.c19
-rw-r--r--drivers/acpi/acpica/exnames.c2
-rw-r--r--drivers/acpi/acpica/exoparg1.c54
-rw-r--r--drivers/acpi/acpica/exoparg2.c6
-rw-r--r--drivers/acpi/acpica/exoparg3.c4
-rw-r--r--drivers/acpi/acpica/exoparg6.c13
-rw-r--r--drivers/acpi/acpica/exprep.c19
-rw-r--r--drivers/acpi/acpica/exregion.c35
-rw-r--r--drivers/acpi/acpica/exresnte.c2
-rw-r--r--drivers/acpi/acpica/exresolv.c2
-rw-r--r--drivers/acpi/acpica/exresop.c2
-rw-r--r--drivers/acpi/acpica/exstore.c2
-rw-r--r--drivers/acpi/acpica/exstoren.c2
-rw-r--r--drivers/acpi/acpica/exstorob.c2
-rw-r--r--drivers/acpi/acpica/exsystem.c4
-rw-r--r--drivers/acpi/acpica/exutils.c24
-rw-r--r--drivers/acpi/acpica/hwacpi.c2
-rw-r--r--drivers/acpi/acpica/hwgpe.c8
-rw-r--r--drivers/acpi/acpica/hwregs.c2
-rw-r--r--drivers/acpi/acpica/hwsleep.c2
-rw-r--r--drivers/acpi/acpica/hwtimer.c4
-rw-r--r--drivers/acpi/acpica/hwvalid.c2
-rw-r--r--drivers/acpi/acpica/hwxface.c2
-rw-r--r--drivers/acpi/acpica/nsaccess.c4
-rw-r--r--drivers/acpi/acpica/nsalloc.c2
-rw-r--r--drivers/acpi/acpica/nsdump.c8
-rw-r--r--drivers/acpi/acpica/nsdumpdv.c5
-rw-r--r--drivers/acpi/acpica/nseval.c70
-rw-r--r--drivers/acpi/acpica/nsinit.c10
-rw-r--r--drivers/acpi/acpica/nsload.c2
-rw-r--r--drivers/acpi/acpica/nsnames.c4
-rw-r--r--drivers/acpi/acpica/nsobject.c2
-rw-r--r--drivers/acpi/acpica/nsparse.c2
-rw-r--r--drivers/acpi/acpica/nspredef.c111
-rw-r--r--drivers/acpi/acpica/nsrepair.c598
-rw-r--r--drivers/acpi/acpica/nsrepair2.c567
-rw-r--r--drivers/acpi/acpica/nssearch.c2
-rw-r--r--drivers/acpi/acpica/nsutils.c59
-rw-r--r--drivers/acpi/acpica/nswalk.c202
-rw-r--r--drivers/acpi/acpica/nsxfeval.c96
-rw-r--r--drivers/acpi/acpica/nsxfname.c12
-rw-r--r--drivers/acpi/acpica/nsxfobj.c16
-rw-r--r--drivers/acpi/acpica/psargs.c4
-rw-r--r--drivers/acpi/acpica/psloop.c34
-rw-r--r--drivers/acpi/acpica/psopcode.c2
-rw-r--r--drivers/acpi/acpica/psparse.c10
-rw-r--r--drivers/acpi/acpica/psscope.c2
-rw-r--r--drivers/acpi/acpica/pstree.c2
-rw-r--r--drivers/acpi/acpica/psutils.c2
-rw-r--r--drivers/acpi/acpica/pswalk.c2
-rw-r--r--drivers/acpi/acpica/psxface.c9
-rw-r--r--drivers/acpi/acpica/rsaddr.c2
-rw-r--r--drivers/acpi/acpica/rscalc.c2
-rw-r--r--drivers/acpi/acpica/rscreate.c4
-rw-r--r--drivers/acpi/acpica/rsdump.c2
-rw-r--r--drivers/acpi/acpica/rsinfo.c2
-rw-r--r--drivers/acpi/acpica/rsio.c2
-rw-r--r--drivers/acpi/acpica/rsirq.c2
-rw-r--r--drivers/acpi/acpica/rslist.c2
-rw-r--r--drivers/acpi/acpica/rsmemory.c2
-rw-r--r--drivers/acpi/acpica/rsmisc.c2
-rw-r--r--drivers/acpi/acpica/rsutils.c2
-rw-r--r--drivers/acpi/acpica/rsxface.c4
-rw-r--r--drivers/acpi/acpica/tbfadt.c2
-rw-r--r--drivers/acpi/acpica/tbfind.c2
-rw-r--r--drivers/acpi/acpica/tbinstal.c2
-rw-r--r--drivers/acpi/acpica/tbutils.c2
-rw-r--r--drivers/acpi/acpica/tbxface.c2
-rw-r--r--drivers/acpi/acpica/tbxfroot.c2
-rw-r--r--drivers/acpi/acpica/utalloc.c2
-rw-r--r--drivers/acpi/acpica/utcopy.c29
-rw-r--r--drivers/acpi/acpica/utdebug.c5
-rw-r--r--drivers/acpi/acpica/utdelete.c2
-rw-r--r--drivers/acpi/acpica/uteval.c4
-rw-r--r--drivers/acpi/acpica/utglobal.c4
-rw-r--r--drivers/acpi/acpica/utids.c2
-rw-r--r--drivers/acpi/acpica/utinit.c2
-rw-r--r--drivers/acpi/acpica/utlock.c2
-rw-r--r--drivers/acpi/acpica/utmath.c27
-rw-r--r--drivers/acpi/acpica/utmisc.c58
-rw-r--r--drivers/acpi/acpica/utmutex.c18
-rw-r--r--drivers/acpi/acpica/utobject.c31
-rw-r--r--drivers/acpi/acpica/utresrc.c2
-rw-r--r--drivers/acpi/acpica/utstate.c2
-rw-r--r--drivers/acpi/acpica/utxface.c2
135 files changed, 2416 insertions, 1050 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index e7973bc16846..7423052ece5a 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -28,7 +28,7 @@ acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o
28acpi-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \ 28acpi-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \
29 nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ 29 nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \
30 nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \ 30 nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \
31 nsparse.o nspredef.o nsrepair.o 31 nsparse.o nspredef.o nsrepair.o nsrepair2.o
32 32
33acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o 33acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o
34 34
diff --git a/drivers/acpi/acpica/accommon.h b/drivers/acpi/acpica/accommon.h
index 3b20786cbb0d..3e50c74ed4a1 100644
--- a/drivers/acpi/acpica/accommon.h
+++ b/drivers/acpi/acpica/accommon.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acconfig.h b/drivers/acpi/acpica/acconfig.h
index a4471e3d3853..33181ad350d5 100644
--- a/drivers/acpi/acpica/acconfig.h
+++ b/drivers/acpi/acpica/acconfig.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index a4fb001d96f1..48faf3eba9fb 100644
--- a/drivers/acpi/acpica/acdebug.h
+++ b/drivers/acpi/acpica/acdebug.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acdispat.h b/drivers/acpi/acpica/acdispat.h
index 6291904be01e..894a0ff2a946 100644
--- a/drivers/acpi/acpica/acdispat.h
+++ b/drivers/acpi/acpica/acdispat.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h
index 0bba148a2c61..3e6ba99e4053 100644
--- a/drivers/acpi/acpica/acevents.h
+++ b/drivers/acpi/acpica/acevents.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -76,12 +76,9 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node *node,
76 * evgpe - GPE handling and dispatch 76 * evgpe - GPE handling and dispatch
77 */ 77 */
78acpi_status 78acpi_status
79acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, 79acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info);
80 u8 type);
81 80
82acpi_status 81acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
83acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
84 u8 write_to_hardware);
85 82
86acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); 83acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
87 84
@@ -122,9 +119,6 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info,
122u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list); 119u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list);
123 120
124acpi_status 121acpi_status
125acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type);
126
127acpi_status
128acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info); 122acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info);
129 123
130acpi_status acpi_ev_gpe_initialize(void); 124acpi_status acpi_ev_gpe_initialize(void);
@@ -139,8 +133,7 @@ acpi_status acpi_ev_initialize_op_regions(void);
139acpi_status 133acpi_status
140acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, 134acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
141 u32 function, 135 u32 function,
142 u32 region_offset, 136 u32 region_offset, u32 bit_width, u64 *value);
143 u32 bit_width, acpi_integer * value);
144 137
145acpi_status 138acpi_status
146acpi_ev_attach_region(union acpi_operand_object *handler_obj, 139acpi_ev_attach_region(union acpi_operand_object *handler_obj,
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 29ba66d5a790..f8dd8f250ac4 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h
index 36192f142fbb..5900f135dc6d 100644
--- a/drivers/acpi/acpica/achware.h
+++ b/drivers/acpi/acpica/achware.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h
index 5db9f2916f7c..6df3f8428168 100644
--- a/drivers/acpi/acpica/acinterp.h
+++ b/drivers/acpi/acpica/acinterp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -129,18 +129,17 @@ acpi_ex_common_buffer_setup(union acpi_operand_object *obj_desc,
129 129
130acpi_status 130acpi_status
131acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, 131acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
132 acpi_integer mask, 132 u64 mask,
133 acpi_integer field_value, 133 u64 field_value, u32 field_datum_byte_offset);
134 u32 field_datum_byte_offset);
135 134
136void 135void
137acpi_ex_get_buffer_datum(acpi_integer * datum, 136acpi_ex_get_buffer_datum(u64 *datum,
138 void *buffer, 137 void *buffer,
139 u32 buffer_length, 138 u32 buffer_length,
140 u32 byte_granularity, u32 buffer_offset); 139 u32 byte_granularity, u32 buffer_offset);
141 140
142void 141void
143acpi_ex_set_buffer_datum(acpi_integer merged_datum, 142acpi_ex_set_buffer_datum(u64 merged_datum,
144 void *buffer, 143 void *buffer,
145 u32 buffer_length, 144 u32 buffer_length,
146 u32 byte_granularity, u32 buffer_offset); 145 u32 byte_granularity, u32 buffer_offset);
@@ -168,8 +167,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
168 167
169acpi_status 168acpi_status
170acpi_ex_access_region(union acpi_operand_object *obj_desc, 169acpi_ex_access_region(union acpi_operand_object *obj_desc,
171 u32 field_datum_byte_offset, 170 u32 field_datum_byte_offset, u64 *value, u32 read_write);
172 acpi_integer * value, u32 read_write);
173 171
174/* 172/*
175 * exmisc - misc support routines 173 * exmisc - misc support routines
@@ -193,16 +191,14 @@ acpi_ex_do_concatenate(union acpi_operand_object *obj_desc,
193 191
194acpi_status 192acpi_status
195acpi_ex_do_logical_numeric_op(u16 opcode, 193acpi_ex_do_logical_numeric_op(u16 opcode,
196 acpi_integer integer0, 194 u64 integer0, u64 integer1, u8 *logical_result);
197 acpi_integer integer1, u8 * logical_result);
198 195
199acpi_status 196acpi_status
200acpi_ex_do_logical_op(u16 opcode, 197acpi_ex_do_logical_op(u16 opcode,
201 union acpi_operand_object *operand0, 198 union acpi_operand_object *operand0,
202 union acpi_operand_object *operand1, u8 * logical_result); 199 union acpi_operand_object *operand1, u8 *logical_result);
203 200
204acpi_integer 201u64 acpi_ex_do_math_op(u16 opcode, u64 operand0, u64 operand1);
205acpi_ex_do_math_op(u16 opcode, acpi_integer operand0, acpi_integer operand1);
206 202
207acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state); 203acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state);
208 204
@@ -278,7 +274,7 @@ acpi_status
278acpi_ex_system_do_notify_op(union acpi_operand_object *value, 274acpi_ex_system_do_notify_op(union acpi_operand_object *value,
279 union acpi_operand_object *obj_desc); 275 union acpi_operand_object *obj_desc);
280 276
281acpi_status acpi_ex_system_do_suspend(acpi_integer time); 277acpi_status acpi_ex_system_do_suspend(u64 time);
282 278
283acpi_status acpi_ex_system_do_stall(u32 time); 279acpi_status acpi_ex_system_do_stall(u32 time);
284 280
@@ -461,9 +457,9 @@ void acpi_ex_acquire_global_lock(u32 rule);
461 457
462void acpi_ex_release_global_lock(u32 rule); 458void acpi_ex_release_global_lock(u32 rule);
463 459
464void acpi_ex_eisa_id_to_string(char *dest, acpi_integer compressed_id); 460void acpi_ex_eisa_id_to_string(char *dest, u64 compressed_id);
465 461
466void acpi_ex_integer_to_string(char *dest, acpi_integer value); 462void acpi_ex_integer_to_string(char *dest, u64 value);
467 463
468/* 464/*
469 * exregion - default op_region handlers 465 * exregion - default op_region handlers
@@ -472,7 +468,7 @@ acpi_status
472acpi_ex_system_memory_space_handler(u32 function, 468acpi_ex_system_memory_space_handler(u32 function,
473 acpi_physical_address address, 469 acpi_physical_address address,
474 u32 bit_width, 470 u32 bit_width,
475 acpi_integer * value, 471 u64 *value,
476 void *handler_context, 472 void *handler_context,
477 void *region_context); 473 void *region_context);
478 474
@@ -480,35 +476,35 @@ acpi_status
480acpi_ex_system_io_space_handler(u32 function, 476acpi_ex_system_io_space_handler(u32 function,
481 acpi_physical_address address, 477 acpi_physical_address address,
482 u32 bit_width, 478 u32 bit_width,
483 acpi_integer * value, 479 u64 *value,
484 void *handler_context, void *region_context); 480 void *handler_context, void *region_context);
485 481
486acpi_status 482acpi_status
487acpi_ex_pci_config_space_handler(u32 function, 483acpi_ex_pci_config_space_handler(u32 function,
488 acpi_physical_address address, 484 acpi_physical_address address,
489 u32 bit_width, 485 u32 bit_width,
490 acpi_integer * value, 486 u64 *value,
491 void *handler_context, void *region_context); 487 void *handler_context, void *region_context);
492 488
493acpi_status 489acpi_status
494acpi_ex_cmos_space_handler(u32 function, 490acpi_ex_cmos_space_handler(u32 function,
495 acpi_physical_address address, 491 acpi_physical_address address,
496 u32 bit_width, 492 u32 bit_width,
497 acpi_integer * value, 493 u64 *value,
498 void *handler_context, void *region_context); 494 void *handler_context, void *region_context);
499 495
500acpi_status 496acpi_status
501acpi_ex_pci_bar_space_handler(u32 function, 497acpi_ex_pci_bar_space_handler(u32 function,
502 acpi_physical_address address, 498 acpi_physical_address address,
503 u32 bit_width, 499 u32 bit_width,
504 acpi_integer * value, 500 u64 *value,
505 void *handler_context, void *region_context); 501 void *handler_context, void *region_context);
506 502
507acpi_status 503acpi_status
508acpi_ex_embedded_controller_space_handler(u32 function, 504acpi_ex_embedded_controller_space_handler(u32 function,
509 acpi_physical_address address, 505 acpi_physical_address address,
510 u32 bit_width, 506 u32 bit_width,
511 acpi_integer * value, 507 u64 *value,
512 void *handler_context, 508 void *handler_context,
513 void *region_context); 509 void *region_context);
514 510
@@ -516,14 +512,14 @@ acpi_status
516acpi_ex_sm_bus_space_handler(u32 function, 512acpi_ex_sm_bus_space_handler(u32 function,
517 acpi_physical_address address, 513 acpi_physical_address address,
518 u32 bit_width, 514 u32 bit_width,
519 acpi_integer * value, 515 u64 *value,
520 void *handler_context, void *region_context); 516 void *handler_context, void *region_context);
521 517
522acpi_status 518acpi_status
523acpi_ex_data_table_space_handler(u32 function, 519acpi_ex_data_table_space_handler(u32 function,
524 acpi_physical_address address, 520 acpi_physical_address address,
525 u32 bit_width, 521 u32 bit_width,
526 acpi_integer * value, 522 u64 *value,
527 void *handler_context, void *region_context); 523 void *handler_context, void *region_context);
528 524
529#endif /* __INTERP_H__ */ 525#endif /* __INTERP_H__ */
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 81e64f478679..24b8faa5c395 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -374,6 +374,7 @@ union acpi_predefined_info {
374struct acpi_predefined_data { 374struct acpi_predefined_data {
375 char *pathname; 375 char *pathname;
376 const union acpi_predefined_info *predefined; 376 const union acpi_predefined_info *predefined;
377 union acpi_operand_object *parent_package;
377 u32 flags; 378 u32 flags;
378 u8 node_flags; 379 u8 node_flags;
379}; 380};
@@ -426,6 +427,8 @@ struct acpi_gpe_event_info {
426 struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ 427 struct acpi_gpe_register_info *register_info; /* Backpointer to register info */
427 u8 flags; /* Misc info about this GPE */ 428 u8 flags; /* Misc info about this GPE */
428 u8 gpe_number; /* This GPE */ 429 u8 gpe_number; /* This GPE */
430 u8 runtime_count;
431 u8 wakeup_count;
429}; 432};
430 433
431/* Information about a GPE register pair, one per each status/enable pair in an array */ 434/* Information about a GPE register pair, one per each status/enable pair in an array */
@@ -649,8 +652,7 @@ struct acpi_opcode_info {
649}; 652};
650 653
651union acpi_parse_value { 654union acpi_parse_value {
652 acpi_integer integer; /* Integer constant (Up to 64 bits) */ 655 u64 integer; /* Integer constant (Up to 64 bits) */
653 struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */
654 u32 size; /* bytelist or field size */ 656 u32 size; /* bytelist or field size */
655 char *string; /* NULL terminated string */ 657 char *string; /* NULL terminated string */
656 u8 *buffer; /* buffer or string */ 658 u8 *buffer; /* buffer or string */
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index 3acd9c6760ea..9894929a2abb 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -272,8 +272,8 @@
272 * MASK_BITS_ABOVE creates a mask starting AT the position and above 272 * MASK_BITS_ABOVE creates a mask starting AT the position and above
273 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position 273 * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
274 */ 274 */
275#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) 275#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((u32) (position))))
276#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) 276#define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((u32) (position)))
277 277
278/* Bitfields within ACPI registers */ 278/* Bitfields within ACPI registers */
279 279
@@ -341,6 +341,7 @@
341#define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e); 341#define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e);
342#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e); 342#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e);
343#define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist 343#define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist
344#define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist
344 345
345#else 346#else
346 347
@@ -349,6 +350,8 @@
349#define ACPI_ERROR_NAMESPACE(s, e) 350#define ACPI_ERROR_NAMESPACE(s, e)
350#define ACPI_ERROR_METHOD(s, n, p, e) 351#define ACPI_ERROR_METHOD(s, n, p, e)
351#define ACPI_WARN_PREDEFINED(plist) 352#define ACPI_WARN_PREDEFINED(plist)
353#define ACPI_INFO_PREDEFINED(plist)
354
352#endif /* ACPI_NO_ERROR_MESSAGES */ 355#endif /* ACPI_NO_ERROR_MESSAGES */
353 356
354/* 357/*
@@ -411,16 +414,16 @@
411 acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \ 414 acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \
412 return (_s); }) 415 return (_s); })
413#define return_VALUE(s) ACPI_DO_WHILE0 ({ \ 416#define return_VALUE(s) ACPI_DO_WHILE0 ({ \
414 register acpi_integer _s = (s); \ 417 register u64 _s = (s); \
415 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ 418 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \
416 return (_s); }) 419 return (_s); })
417#define return_UINT8(s) ACPI_DO_WHILE0 ({ \ 420#define return_UINT8(s) ACPI_DO_WHILE0 ({ \
418 register u8 _s = (u8) (s); \ 421 register u8 _s = (u8) (s); \
419 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ 422 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \
420 return (_s); }) 423 return (_s); })
421#define return_UINT32(s) ACPI_DO_WHILE0 ({ \ 424#define return_UINT32(s) ACPI_DO_WHILE0 ({ \
422 register u32 _s = (u32) (s); \ 425 register u32 _s = (u32) (s); \
423 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ 426 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \
424 return (_s); }) 427 return (_s); })
425#else /* Use original less-safe macros */ 428#else /* Use original less-safe macros */
426 429
@@ -431,7 +434,7 @@
431 acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \ 434 acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \
432 return((s)); }) 435 return((s)); })
433#define return_VALUE(s) ACPI_DO_WHILE0 ({ \ 436#define return_VALUE(s) ACPI_DO_WHILE0 ({ \
434 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) (s)); \ 437 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) (s)); \
435 return((s)); }) 438 return((s)); })
436#define return_UINT8(s) return_VALUE(s) 439#define return_UINT8(s) return_VALUE(s)
437#define return_UINT32(s) return_VALUE(s) 440#define return_UINT32(s) return_VALUE(s)
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index 09a2764c734b..258159cfcdfa 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -104,7 +104,8 @@ acpi_ns_walk_namespace(acpi_object_type type,
104 acpi_handle start_object, 104 acpi_handle start_object,
105 u32 max_depth, 105 u32 max_depth,
106 u32 flags, 106 u32 flags,
107 acpi_walk_callback user_function, 107 acpi_walk_callback pre_order_visit,
108 acpi_walk_callback post_order_visit,
108 void *context, void **return_value); 109 void *context, void **return_value);
109 110
110struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node 111struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node
@@ -272,7 +273,8 @@ acpi_ns_get_attached_data(struct acpi_namespace_node *node,
272 acpi_object_handler handler, void **data); 273 acpi_object_handler handler, void **data);
273 274
274/* 275/*
275 * nsrepair - return object repair for predefined methods/objects 276 * nsrepair - General return object repair for all
277 * predefined methods/objects
276 */ 278 */
277acpi_status 279acpi_status
278acpi_ns_repair_object(struct acpi_predefined_data *data, 280acpi_ns_repair_object(struct acpi_predefined_data *data,
@@ -284,6 +286,27 @@ acpi_status
284acpi_ns_repair_package_list(struct acpi_predefined_data *data, 286acpi_ns_repair_package_list(struct acpi_predefined_data *data,
285 union acpi_operand_object **obj_desc_ptr); 287 union acpi_operand_object **obj_desc_ptr);
286 288
289acpi_status
290acpi_ns_repair_null_element(struct acpi_predefined_data *data,
291 u32 expected_btypes,
292 u32 package_index,
293 union acpi_operand_object **return_object_ptr);
294
295void
296acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
297 u8 package_type,
298 union acpi_operand_object *obj_desc);
299
300/*
301 * nsrepair2 - Return object repair for specific
302 * predefined methods/objects
303 */
304acpi_status
305acpi_ns_complex_repairs(struct acpi_predefined_data *data,
306 struct acpi_namespace_node *node,
307 acpi_status validate_status,
308 union acpi_operand_object **return_object_ptr);
309
287/* 310/*
288 * nssearch - Namespace searching and entry 311 * nssearch - Namespace searching and entry
289 */ 312 */
@@ -342,9 +365,7 @@ acpi_ns_externalize_name(u32 internal_name_length,
342 const char *internal_name, 365 const char *internal_name,
343 u32 * converted_name_length, char **converted_name); 366 u32 * converted_name_length, char **converted_name);
344 367
345struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle); 368struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle);
346
347acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node);
348 369
349void acpi_ns_terminate(void); 370void acpi_ns_terminate(void);
350 371
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index b39d682a2140..cde18ea82656 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -111,7 +111,7 @@ ACPI_OBJECT_COMMON_HEADER};
111 111
112struct acpi_object_integer { 112struct acpi_object_integer {
113 ACPI_OBJECT_COMMON_HEADER u8 fill[3]; /* Prevent warning on some compilers */ 113 ACPI_OBJECT_COMMON_HEADER u8 fill[3]; /* Prevent warning on some compilers */
114 acpi_integer value; 114 u64 value;
115}; 115};
116 116
117/* 117/*
@@ -180,7 +180,11 @@ struct acpi_object_method {
180 u8 sync_level; 180 u8 sync_level;
181 union acpi_operand_object *mutex; 181 union acpi_operand_object *mutex;
182 u8 *aml_start; 182 u8 *aml_start;
183 ACPI_INTERNAL_METHOD implementation; 183 union {
184 ACPI_INTERNAL_METHOD implementation;
185 union acpi_operand_object *handler;
186 } extra;
187
184 u32 aml_length; 188 u32 aml_length;
185 u8 thread_count; 189 u8 thread_count;
186 acpi_owner_id owner_id; 190 acpi_owner_id owner_id;
@@ -283,8 +287,10 @@ struct acpi_object_buffer_field {
283 287
284struct acpi_object_notify_handler { 288struct acpi_object_notify_handler {
285 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Parent device */ 289 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Parent device */
290 u32 handler_type;
286 acpi_notify_handler handler; 291 acpi_notify_handler handler;
287 void *context; 292 void *context;
293 struct acpi_object_notify_handler *next;
288}; 294};
289 295
290struct acpi_object_addr_handler { 296struct acpi_object_addr_handler {
diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h
index dfdf63327885..8c15ff43f42b 100644
--- a/drivers/acpi/acpica/acopcode.h
+++ b/drivers/acpi/acpica/acopcode.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h
index 22881e8ce229..d0bb0fd3e57a 100644
--- a/drivers/acpi/acpica/acparser.h
+++ b/drivers/acpi/acpica/acparser.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h
index 57bdaf6ffab1..97116082cb6c 100644
--- a/drivers/acpi/acpica/acpredef.h
+++ b/drivers/acpi/acpica/acpredef.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acresrc.h b/drivers/acpi/acpica/acresrc.h
index eef5bd7a59fa..528bcbaf4ce7 100644
--- a/drivers/acpi/acpica/acresrc.h
+++ b/drivers/acpi/acpica/acresrc.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h
index 7980a26bad35..161bc0e3d70a 100644
--- a/drivers/acpi/acpica/acstruct.h
+++ b/drivers/acpi/acpica/acstruct.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h
index 01c76b8ea7ba..8ff3b741df28 100644
--- a/drivers/acpi/acpica/actables.h
+++ b/drivers/acpi/acpica/actables.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index 863a264b829e..35df755251ce 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -134,7 +134,7 @@ char *acpi_ut_get_region_name(u8 space_id);
134 134
135char *acpi_ut_get_event_name(u32 event_id); 135char *acpi_ut_get_event_name(u32 event_id);
136 136
137char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position); 137char acpi_ut_hex_to_ascii_char(u64 integer, u32 position);
138 138
139u8 acpi_ut_valid_object_type(acpi_object_type type); 139u8 acpi_ut_valid_object_type(acpi_object_type type);
140 140
@@ -279,8 +279,7 @@ acpi_ut_status_exit(u32 line_number,
279void 279void
280acpi_ut_value_exit(u32 line_number, 280acpi_ut_value_exit(u32 line_number,
281 const char *function_name, 281 const char *function_name,
282 const char *module_name, 282 const char *module_name, u32 component_id, u64 value);
283 u32 component_id, acpi_integer value);
284 283
285void 284void
286acpi_ut_ptr_exit(u32 line_number, 285acpi_ut_ptr_exit(u32 line_number,
@@ -324,7 +323,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
324acpi_status 323acpi_status
325acpi_ut_evaluate_numeric_object(char *object_name, 324acpi_ut_evaluate_numeric_object(char *object_name,
326 struct acpi_namespace_node *device_node, 325 struct acpi_namespace_node *device_node,
327 acpi_integer *value); 326 u64 *value);
328 327
329acpi_status 328acpi_status
330acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 *status_flags); 329acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 *status_flags);
@@ -386,6 +385,8 @@ u8 acpi_ut_valid_internal_object(void *object);
386 385
387union acpi_operand_object *acpi_ut_create_package_object(u32 count); 386union acpi_operand_object *acpi_ut_create_package_object(u32 count);
388 387
388union acpi_operand_object *acpi_ut_create_integer_object(u64 value);
389
389union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size); 390union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size);
390 391
391union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size); 392union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size);
@@ -435,14 +436,12 @@ void acpi_ut_delete_generic_state(union acpi_generic_state *state);
435 * utmath 436 * utmath
436 */ 437 */
437acpi_status 438acpi_status
438acpi_ut_divide(acpi_integer in_dividend, 439acpi_ut_divide(u64 in_dividend,
439 acpi_integer in_divisor, 440 u64 in_divisor, u64 *out_quotient, u64 *out_remainder);
440 acpi_integer * out_quotient, acpi_integer * out_remainder);
441 441
442acpi_status 442acpi_status
443acpi_ut_short_divide(acpi_integer in_dividend, 443acpi_ut_short_divide(u64 in_dividend,
444 u32 divisor, 444 u32 divisor, u64 *out_quotient, u32 *out_remainder);
445 acpi_integer * out_quotient, u32 * out_remainder);
446 445
447/* 446/*
448 * utmisc 447 * utmisc
@@ -472,8 +471,7 @@ acpi_name acpi_ut_repair_name(char *name);
472 471
473u8 acpi_ut_valid_acpi_char(char character, u32 position); 472u8 acpi_ut_valid_acpi_char(char character, u32 position);
474 473
475acpi_status 474acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer);
476acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
477 475
478void ACPI_INTERNAL_VAR_XFACE 476void ACPI_INTERNAL_VAR_XFACE
479acpi_ut_predefined_warning(const char *module_name, 477acpi_ut_predefined_warning(const char *module_name,
@@ -481,6 +479,11 @@ acpi_ut_predefined_warning(const char *module_name,
481 char *pathname, 479 char *pathname,
482 u8 node_flags, const char *format, ...); 480 u8 node_flags, const char *format, ...);
483 481
482void ACPI_INTERNAL_VAR_XFACE
483acpi_ut_predefined_info(const char *module_name,
484 u32 line_number,
485 char *pathname, u8 node_flags, const char *format, ...);
486
484/* Values for Base above (16=Hex, 10=Decimal) */ 487/* Values for Base above (16=Hex, 10=Decimal) */
485 488
486#define ACPI_ANY_BASE 0 489#define ACPI_ANY_BASE 0
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h
index 4940249f2524..1f484ba228fc 100644
--- a/drivers/acpi/acpica/amlcode.h
+++ b/drivers/acpi/acpica/amlcode.h
@@ -7,7 +7,7 @@
7 *****************************************************************************/ 7 *****************************************************************************/
8 8
9/* 9/*
10 * Copyright (C) 2000 - 2008, Intel Corp. 10 * Copyright (C) 2000 - 2010, Intel Corp.
11 * All rights reserved. 11 * All rights reserved.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h
index 7b070e42b7c5..0e5798fcbb19 100644
--- a/drivers/acpi/acpica/amlresrc.h
+++ b/drivers/acpi/acpica/amlresrc.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index 54a225e56a64..bb13817e0c31 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -220,7 +220,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
220 union acpi_parse_object *arg) 220 union acpi_parse_object *arg)
221{ 221{
222 acpi_status status; 222 acpi_status status;
223 acpi_integer position; 223 u64 position;
224 224
225 ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info); 225 ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info);
226 226
@@ -240,8 +240,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
240 switch (arg->common.aml_opcode) { 240 switch (arg->common.aml_opcode) {
241 case AML_INT_RESERVEDFIELD_OP: 241 case AML_INT_RESERVEDFIELD_OP:
242 242
243 position = (acpi_integer) info->field_bit_position 243 position = (u64) info->field_bit_position
244 + (acpi_integer) arg->common.value.size; 244 + (u64) arg->common.value.size;
245 245
246 if (position > ACPI_UINT32_MAX) { 246 if (position > ACPI_UINT32_MAX) {
247 ACPI_ERROR((AE_INFO, 247 ACPI_ERROR((AE_INFO,
@@ -305,8 +305,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
305 305
306 /* Keep track of bit position for the next field */ 306 /* Keep track of bit position for the next field */
307 307
308 position = (acpi_integer) info->field_bit_position 308 position = (u64) info->field_bit_position
309 + (acpi_integer) arg->common.value.size; 309 + (u64) arg->common.value.size;
310 310
311 if (position > ACPI_UINT32_MAX) { 311 if (position > ACPI_UINT32_MAX) {
312 ACPI_ERROR((AE_INFO, 312 ACPI_ERROR((AE_INFO,
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c
index 3aae13f30c5e..abe140318a74 100644
--- a/drivers/acpi/acpica/dsinit.c
+++ b/drivers/acpi/acpica/dsinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -192,7 +192,7 @@ acpi_ds_initialize_objects(u32 table_index,
192 status = 192 status =
193 acpi_ns_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, 193 acpi_ns_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
194 ACPI_NS_WALK_UNLOCK, acpi_ds_init_one_object, 194 ACPI_NS_WALK_UNLOCK, acpi_ds_init_one_object,
195 &info, NULL); 195 NULL, &info, NULL);
196 if (ACPI_FAILURE(status)) { 196 if (ACPI_FAILURE(status)) {
197 ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); 197 ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace"));
198 } 198 }
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index 567a4899a018..721039233aa7 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -414,7 +414,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
414 /* Invoke an internal method if necessary */ 414 /* Invoke an internal method if necessary */
415 415
416 if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { 416 if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) {
417 status = obj_desc->method.implementation(next_walk_state); 417 status = obj_desc->method.extra.implementation(next_walk_state);
418 if (status == AE_OK) { 418 if (status == AE_OK) {
419 status = AE_CTRL_TERMINATE; 419 status = AE_CTRL_TERMINATE;
420 } 420 }
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c
index 7d077bb2f525..cc343b959540 100644
--- a/drivers/acpi/acpica/dsmthdat.c
+++ b/drivers/acpi/acpica/dsmthdat.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -409,13 +409,11 @@ acpi_ds_method_data_get_value(u8 type,
409 /* If slack enabled, init the local_x/arg_x to an Integer of value zero */ 409 /* If slack enabled, init the local_x/arg_x to an Integer of value zero */
410 410
411 if (acpi_gbl_enable_interpreter_slack) { 411 if (acpi_gbl_enable_interpreter_slack) {
412 object = 412 object = acpi_ut_create_integer_object((u64) 0);
413 acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
414 if (!object) { 413 if (!object) {
415 return_ACPI_STATUS(AE_NO_MEMORY); 414 return_ACPI_STATUS(AE_NO_MEMORY);
416 } 415 }
417 416
418 object->integer.value = 0;
419 node->object = object; 417 node->object = object;
420 } 418 }
421 419
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c
index 507e1f0bbdfd..891e08bf560b 100644
--- a/drivers/acpi/acpica/dsobject.c
+++ b/drivers/acpi/acpica/dsobject.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -486,7 +486,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
486 * 486 *
487 * Note: technically, this is an error, from ACPI spec: "It is an error 487 * Note: technically, this is an error, from ACPI spec: "It is an error
488 * for NumElements to be less than the number of elements in the 488 * for NumElements to be less than the number of elements in the
489 * PackageList". However, we just print an error message and 489 * PackageList". However, we just print a message and
490 * no exception is returned. This provides Windows compatibility. Some 490 * no exception is returned. This provides Windows compatibility. Some
491 * BIOSs will alter the num_elements on the fly, creating this type 491 * BIOSs will alter the num_elements on the fly, creating this type
492 * of ill-formed package object. 492 * of ill-formed package object.
@@ -510,9 +510,9 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
510 arg = arg->common.next; 510 arg = arg->common.next;
511 } 511 }
512 512
513 ACPI_WARNING((AE_INFO, 513 ACPI_INFO((AE_INFO,
514 "Package List length (0x%X) larger than NumElements count (0x%X), truncated\n", 514 "Actual Package length (0x%X) is larger than NumElements field (0x%X), truncated\n",
515 i, element_count)); 515 i, element_count));
516 } else if (i < element_count) { 516 } else if (i < element_count) {
517 /* 517 /*
518 * Arg list (elements) was exhausted, but we did not reach num_elements count. 518 * Arg list (elements) was exhausted, but we did not reach num_elements count.
@@ -684,7 +684,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
684 684
685 case AML_ONES_OP: 685 case AML_ONES_OP:
686 686
687 obj_desc->integer.value = ACPI_INTEGER_MAX; 687 obj_desc->integer.value = ACPI_UINT64_MAX;
688 688
689 /* Truncate value if we are executing from a 32-bit ACPI table */ 689 /* Truncate value if we are executing from a 32-bit ACPI table */
690 690
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c
index b79978f7bc71..bf980cadb1e8 100644
--- a/drivers/acpi/acpica/dsopcode.c
+++ b/drivers/acpi/acpica/dsopcode.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c
index dfa104102926..306c62ab2e88 100644
--- a/drivers/acpi/acpica/dsutils.c
+++ b/drivers/acpi/acpica/dsutils.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c
index f0280856dc0e..6b76c486d784 100644
--- a/drivers/acpi/acpica/dswexec.c
+++ b/drivers/acpi/acpica/dswexec.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c
index 6de3a99d4cd4..140a9d002959 100644
--- a/drivers/acpi/acpica/dswload.c
+++ b/drivers/acpi/acpica/dswload.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -212,18 +212,19 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
212 case ACPI_TYPE_BUFFER: 212 case ACPI_TYPE_BUFFER:
213 213
214 /* 214 /*
215 * These types we will allow, but we will change the type. This 215 * These types we will allow, but we will change the type.
216 * enables some existing code of the form: 216 * This enables some existing code of the form:
217 * 217 *
218 * Name (DEB, 0) 218 * Name (DEB, 0)
219 * Scope (DEB) { ... } 219 * Scope (DEB) { ... }
220 * 220 *
221 * Note: silently change the type here. On the second pass, we will report 221 * Note: silently change the type here. On the second pass,
222 * a warning 222 * we will report a warning
223 */ 223 */
224 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 224 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
225 "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", 225 "Type override - [%4.4s] had invalid type (%s) "
226 path, 226 "for Scope operator, changed to type ANY\n",
227 acpi_ut_get_node_name(node),
227 acpi_ut_get_type_name(node->type))); 228 acpi_ut_get_type_name(node->type)));
228 229
229 node->type = ACPI_TYPE_ANY; 230 node->type = ACPI_TYPE_ANY;
@@ -235,8 +236,10 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
235 /* All other types are an error */ 236 /* All other types are an error */
236 237
237 ACPI_ERROR((AE_INFO, 238 ACPI_ERROR((AE_INFO,
238 "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)", 239 "Invalid type (%s) for target of "
239 acpi_ut_get_type_name(node->type), path)); 240 "Scope operator [%4.4s] (Cannot override)",
241 acpi_ut_get_type_name(node->type),
242 acpi_ut_get_node_name(node)));
240 243
241 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 244 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
242 } 245 }
@@ -639,26 +642,42 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
639 break; 642 break;
640 643
641 case AML_SCOPE_OP: 644 case AML_SCOPE_OP:
642 /* 645
643 * The Path is an object reference to an existing object. 646 /* Special case for Scope(\) -> refers to the Root node */
644 * Don't enter the name into the namespace, but look it up 647
645 * for use later. 648 if (op && (op->named.node == acpi_gbl_root_node)) {
646 */ 649 node = op->named.node;
647 status = 650
648 acpi_ns_lookup(walk_state->scope_info, buffer_ptr, 651 status =
649 object_type, ACPI_IMODE_EXECUTE, 652 acpi_ds_scope_stack_push(node, object_type,
650 ACPI_NS_SEARCH_PARENT, walk_state, &(node)); 653 walk_state);
651 if (ACPI_FAILURE(status)) { 654 if (ACPI_FAILURE(status)) {
652#ifdef ACPI_ASL_COMPILER 655 return_ACPI_STATUS(status);
653 if (status == AE_NOT_FOUND) {
654 status = AE_OK;
655 } else {
656 ACPI_ERROR_NAMESPACE(buffer_ptr, status);
657 } 656 }
657 } else {
658 /*
659 * The Path is an object reference to an existing object.
660 * Don't enter the name into the namespace, but look it up
661 * for use later.
662 */
663 status =
664 acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
665 object_type, ACPI_IMODE_EXECUTE,
666 ACPI_NS_SEARCH_PARENT, walk_state,
667 &(node));
668 if (ACPI_FAILURE(status)) {
669#ifdef ACPI_ASL_COMPILER
670 if (status == AE_NOT_FOUND) {
671 status = AE_OK;
672 } else {
673 ACPI_ERROR_NAMESPACE(buffer_ptr,
674 status);
675 }
658#else 676#else
659 ACPI_ERROR_NAMESPACE(buffer_ptr, status); 677 ACPI_ERROR_NAMESPACE(buffer_ptr, status);
660#endif 678#endif
661 return_ACPI_STATUS(status); 679 return_ACPI_STATUS(status);
680 }
662 } 681 }
663 682
664 /* 683 /*
@@ -681,15 +700,16 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
681 case ACPI_TYPE_BUFFER: 700 case ACPI_TYPE_BUFFER:
682 701
683 /* 702 /*
684 * These types we will allow, but we will change the type. This 703 * These types we will allow, but we will change the type.
685 * enables some existing code of the form: 704 * This enables some existing code of the form:
686 * 705 *
687 * Name (DEB, 0) 706 * Name (DEB, 0)
688 * Scope (DEB) { ... } 707 * Scope (DEB) { ... }
689 */ 708 */
690 ACPI_WARNING((AE_INFO, 709 ACPI_WARNING((AE_INFO,
691 "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)", 710 "Type override - [%4.4s] had invalid type (%s) "
692 buffer_ptr, 711 "for Scope operator, changed to type ANY\n",
712 acpi_ut_get_node_name(node),
693 acpi_ut_get_type_name(node->type))); 713 acpi_ut_get_type_name(node->type)));
694 714
695 node->type = ACPI_TYPE_ANY; 715 node->type = ACPI_TYPE_ANY;
@@ -701,9 +721,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
701 /* All other types are an error */ 721 /* All other types are an error */
702 722
703 ACPI_ERROR((AE_INFO, 723 ACPI_ERROR((AE_INFO,
704 "Invalid type (%s) for target of Scope operator [%4.4s]", 724 "Invalid type (%s) for target of "
725 "Scope operator [%4.4s] (Cannot override)",
705 acpi_ut_get_type_name(node->type), 726 acpi_ut_get_type_name(node->type),
706 buffer_ptr)); 727 acpi_ut_get_node_name(node)));
707 728
708 return (AE_AML_OPERAND_TYPE); 729 return (AE_AML_OPERAND_TYPE);
709 } 730 }
@@ -1031,9 +1052,22 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
1031 } 1052 }
1032 1053
1033 /* 1054 /*
1034 * If we are executing a method, initialize the region 1055 * The op_region is not fully parsed at this time. The only valid
1056 * argument is the space_id. (We must save the address of the
1057 * AML of the address and length operands)
1058 *
1059 * If we have a valid region, initialize it. The namespace is
1060 * unlocked at this point.
1061 *
1062 * Need to unlock interpreter if it is locked (if we are running
1063 * a control method), in order to allow _REG methods to be run
1064 * during acpi_ev_initialize_region.
1035 */ 1065 */
1036 if (walk_state->method_node) { 1066 if (walk_state->method_node) {
1067 /*
1068 * Executing a method: initialize the region and unlock
1069 * the interpreter
1070 */
1037 status = 1071 status =
1038 acpi_ex_create_region(op->named.data, 1072 acpi_ex_create_region(op->named.data,
1039 op->named.length, 1073 op->named.length,
@@ -1042,21 +1076,17 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
1042 if (ACPI_FAILURE(status)) { 1076 if (ACPI_FAILURE(status)) {
1043 return (status); 1077 return (status);
1044 } 1078 }
1045 }
1046 1079
1047 /* 1080 acpi_ex_exit_interpreter();
1048 * The op_region is not fully parsed at this time. Only valid 1081 }
1049 * argument is the space_id. (We must save the address of the
1050 * AML of the address and length operands)
1051 */
1052 1082
1053 /*
1054 * If we have a valid region, initialize it
1055 * Namespace is NOT locked at this point.
1056 */
1057 status = 1083 status =
1058 acpi_ev_initialize_region 1084 acpi_ev_initialize_region
1059 (acpi_ns_get_attached_object(node), FALSE); 1085 (acpi_ns_get_attached_object(node), FALSE);
1086 if (walk_state->method_node) {
1087 acpi_ex_enter_interpreter();
1088 }
1089
1060 if (ACPI_FAILURE(status)) { 1090 if (ACPI_FAILURE(status)) {
1061 /* 1091 /*
1062 * If AE_NOT_EXIST is returned, it is not fatal 1092 * If AE_NOT_EXIST is returned, it is not fatal
diff --git a/drivers/acpi/acpica/dswscope.c b/drivers/acpi/acpica/dswscope.c
index 908645e72f03..d1e701709dac 100644
--- a/drivers/acpi/acpica/dswscope.c
+++ b/drivers/acpi/acpica/dswscope.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dswstate.c b/drivers/acpi/acpica/dswstate.c
index e46c821cf572..050df8164165 100644
--- a/drivers/acpi/acpica/dswstate.c
+++ b/drivers/acpi/acpica/dswstate.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evevent.c b/drivers/acpi/acpica/evevent.c
index cd55c774e882..c1e6f472d435 100644
--- a/drivers/acpi/acpica/evevent.c
+++ b/drivers/acpi/acpica/evevent.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index afacf4416c73..78c55508aff5 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -54,54 +54,9 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context);
54 54
55/******************************************************************************* 55/*******************************************************************************
56 * 56 *
57 * FUNCTION: acpi_ev_set_gpe_type
58 *
59 * PARAMETERS: gpe_event_info - GPE to set
60 * Type - New type
61 *
62 * RETURN: Status
63 *
64 * DESCRIPTION: Sets the new type for the GPE (wake, run, or wake/run)
65 *
66 ******************************************************************************/
67
68acpi_status
69acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type)
70{
71 acpi_status status;
72
73 ACPI_FUNCTION_TRACE(ev_set_gpe_type);
74
75 /* Validate type and update register enable masks */
76
77 switch (type) {
78 case ACPI_GPE_TYPE_WAKE:
79 case ACPI_GPE_TYPE_RUNTIME:
80 case ACPI_GPE_TYPE_WAKE_RUN:
81 break;
82
83 default:
84 return_ACPI_STATUS(AE_BAD_PARAMETER);
85 }
86
87 /* Disable the GPE if currently enabled */
88
89 status = acpi_ev_disable_gpe(gpe_event_info);
90
91 /* Clear the type bits and insert the new Type */
92
93 gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK;
94 gpe_event_info->flags |= type;
95 return_ACPI_STATUS(status);
96}
97
98/*******************************************************************************
99 *
100 * FUNCTION: acpi_ev_update_gpe_enable_masks 57 * FUNCTION: acpi_ev_update_gpe_enable_masks
101 * 58 *
102 * PARAMETERS: gpe_event_info - GPE to update 59 * PARAMETERS: gpe_event_info - GPE to update
103 * Type - What to do: ACPI_GPE_DISABLE or
104 * ACPI_GPE_ENABLE
105 * 60 *
106 * RETURN: Status 61 * RETURN: Status
107 * 62 *
@@ -110,8 +65,7 @@ acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type)
110 ******************************************************************************/ 65 ******************************************************************************/
111 66
112acpi_status 67acpi_status
113acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, 68acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info)
114 u8 type)
115{ 69{
116 struct acpi_gpe_register_info *gpe_register_info; 70 struct acpi_gpe_register_info *gpe_register_info;
117 u8 register_bit; 71 u8 register_bit;
@@ -127,37 +81,14 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
127 (1 << 81 (1 <<
128 (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number)); 82 (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number));
129 83
130 /* 1) Disable case. Simply clear all enable bits */ 84 ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, register_bit);
131 85 ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
132 if (type == ACPI_GPE_DISABLE) {
133 ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
134 register_bit);
135 ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
136 return_ACPI_STATUS(AE_OK);
137 }
138
139 /* 2) Enable case. Set/Clear the appropriate enable bits */
140
141 switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
142 case ACPI_GPE_TYPE_WAKE:
143 ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
144 ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
145 break;
146 86
147 case ACPI_GPE_TYPE_RUNTIME: 87 if (gpe_event_info->runtime_count)
148 ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
149 register_bit);
150 ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit); 88 ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
151 break;
152 89
153 case ACPI_GPE_TYPE_WAKE_RUN: 90 if (gpe_event_info->wakeup_count)
154 ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit); 91 ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
155 ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
156 break;
157
158 default:
159 return_ACPI_STATUS(AE_BAD_PARAMETER);
160 }
161 92
162 return_ACPI_STATUS(AE_OK); 93 return_ACPI_STATUS(AE_OK);
163} 94}
@@ -167,8 +98,6 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
167 * FUNCTION: acpi_ev_enable_gpe 98 * FUNCTION: acpi_ev_enable_gpe
168 * 99 *
169 * PARAMETERS: gpe_event_info - GPE to enable 100 * PARAMETERS: gpe_event_info - GPE to enable
170 * write_to_hardware - Enable now, or just mark data structs
171 * (WAKE GPEs should be deferred)
172 * 101 *
173 * RETURN: Status 102 * RETURN: Status
174 * 103 *
@@ -176,9 +105,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
176 * 105 *
177 ******************************************************************************/ 106 ******************************************************************************/
178 107
179acpi_status 108acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
180acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
181 u8 write_to_hardware)
182{ 109{
183 acpi_status status; 110 acpi_status status;
184 111
@@ -186,50 +113,18 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
186 113
187 /* Make sure HW enable masks are updated */ 114 /* Make sure HW enable masks are updated */
188 115
189 status = 116 status = acpi_ev_update_gpe_enable_masks(gpe_event_info);
190 acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_ENABLE); 117 if (ACPI_FAILURE(status))
191 if (ACPI_FAILURE(status)) {
192 return_ACPI_STATUS(status); 118 return_ACPI_STATUS(status);
193 }
194
195 /* Mark wake-enabled or HW enable, or both */
196
197 switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
198 case ACPI_GPE_TYPE_WAKE:
199
200 ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
201 break;
202
203 case ACPI_GPE_TYPE_WAKE_RUN:
204
205 ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
206
207 /*lint -fallthrough */
208
209 case ACPI_GPE_TYPE_RUNTIME:
210
211 ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
212
213 if (write_to_hardware) {
214
215 /* Clear the GPE (of stale events), then enable it */
216
217 status = acpi_hw_clear_gpe(gpe_event_info);
218 if (ACPI_FAILURE(status)) {
219 return_ACPI_STATUS(status);
220 }
221
222 /* Enable the requested runtime GPE */
223
224 status = acpi_hw_write_gpe_enable_reg(gpe_event_info);
225 }
226 break;
227 119
228 default: 120 /* Clear the GPE (of stale events), then enable it */
229 return_ACPI_STATUS(AE_BAD_PARAMETER); 121 status = acpi_hw_clear_gpe(gpe_event_info);
230 } 122 if (ACPI_FAILURE(status))
123 return_ACPI_STATUS(status);
231 124
232 return_ACPI_STATUS(AE_OK); 125 /* Enable the requested GPE */
126 status = acpi_hw_write_gpe_enable_reg(gpe_event_info);
127 return_ACPI_STATUS(status);
233} 128}
234 129
235/******************************************************************************* 130/*******************************************************************************
@@ -252,34 +147,9 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
252 147
253 /* Make sure HW enable masks are updated */ 148 /* Make sure HW enable masks are updated */
254 149
255 status = 150 status = acpi_ev_update_gpe_enable_masks(gpe_event_info);
256 acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_DISABLE); 151 if (ACPI_FAILURE(status))
257 if (ACPI_FAILURE(status)) {
258 return_ACPI_STATUS(status); 152 return_ACPI_STATUS(status);
259 }
260
261 /* Clear the appropriate enabled flags for this GPE */
262
263 switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
264 case ACPI_GPE_TYPE_WAKE:
265 ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
266 break;
267
268 case ACPI_GPE_TYPE_WAKE_RUN:
269 ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
270
271 /* fallthrough */
272
273 case ACPI_GPE_TYPE_RUNTIME:
274
275 /* Disable the requested runtime GPE */
276
277 ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
278 break;
279
280 default:
281 break;
282 }
283 153
284 /* 154 /*
285 * Even if we don't know the GPE type, make sure that we always 155 * Even if we don't know the GPE type, make sure that we always
@@ -521,7 +391,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
521 391
522 /* Set the GPE flags for return to enabled state */ 392 /* Set the GPE flags for return to enabled state */
523 393
524 (void)acpi_ev_enable_gpe(gpe_event_info, FALSE); 394 (void)acpi_ev_update_gpe_enable_masks(gpe_event_info);
525 395
526 /* 396 /*
527 * Take a snapshot of the GPE info for this level - we copy the info to 397 * Take a snapshot of the GPE info for this level - we copy the info to
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index a60aaa7635f3..fef721917eaf 100644
--- a/drivers/acpi/acpica/evgpeblk.c
+++ b/drivers/acpi/acpica/evgpeblk.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -258,7 +258,6 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
258 u32 gpe_number; 258 u32 gpe_number;
259 char name[ACPI_NAME_SIZE + 1]; 259 char name[ACPI_NAME_SIZE + 1];
260 u8 type; 260 u8 type;
261 acpi_status status;
262 261
263 ACPI_FUNCTION_TRACE(ev_save_method_info); 262 ACPI_FUNCTION_TRACE(ev_save_method_info);
264 263
@@ -325,26 +324,20 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
325 324
326 /* 325 /*
327 * Now we can add this information to the gpe_event_info block for use 326 * Now we can add this information to the gpe_event_info block for use
328 * during dispatch of this GPE. Default type is RUNTIME, although this may 327 * during dispatch of this GPE.
329 * change when the _PRW methods are executed later.
330 */ 328 */
331 gpe_event_info = 329 gpe_event_info =
332 &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; 330 &gpe_block->event_info[gpe_number - gpe_block->block_base_number];
333 331
334 gpe_event_info->flags = (u8) 332 gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD);
335 (type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME);
336 333
337 gpe_event_info->dispatch.method_node = 334 gpe_event_info->dispatch.method_node =
338 (struct acpi_namespace_node *)obj_handle; 335 (struct acpi_namespace_node *)obj_handle;
339 336
340 /* Update enable mask, but don't enable the HW GPE as of yet */
341
342 status = acpi_ev_enable_gpe(gpe_event_info, FALSE);
343
344 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, 337 ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
345 "Registered GPE method %s as GPE number 0x%.2X\n", 338 "Registered GPE method %s as GPE number 0x%.2X\n",
346 name, gpe_number)); 339 name, gpe_number));
347 return_ACPI_STATUS(status); 340 return_ACPI_STATUS(AE_OK);
348} 341}
349 342
350/******************************************************************************* 343/*******************************************************************************
@@ -454,20 +447,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
454 gpe_block-> 447 gpe_block->
455 block_base_number]; 448 block_base_number];
456 449
457 /* Mark GPE for WAKE-ONLY but WAKE_DISABLED */ 450 gpe_event_info->flags |= ACPI_GPE_CAN_WAKE;
458
459 gpe_event_info->flags &=
460 ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED);
461
462 status =
463 acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE);
464 if (ACPI_FAILURE(status)) {
465 goto cleanup;
466 }
467
468 status =
469 acpi_ev_update_gpe_enable_masks(gpe_event_info,
470 ACPI_GPE_DISABLE);
471 } 451 }
472 452
473 cleanup: 453 cleanup:
@@ -945,8 +925,8 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
945 925
946 status = acpi_ns_walk_namespace(ACPI_TYPE_METHOD, gpe_device, 926 status = acpi_ns_walk_namespace(ACPI_TYPE_METHOD, gpe_device,
947 ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, 927 ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
948 acpi_ev_save_method_info, gpe_block, 928 acpi_ev_save_method_info, NULL,
949 NULL); 929 gpe_block, NULL);
950 930
951 /* Return the new block */ 931 /* Return the new block */
952 932
@@ -989,7 +969,6 @@ acpi_status
989acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, 969acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
990 struct acpi_gpe_block_info *gpe_block) 970 struct acpi_gpe_block_info *gpe_block)
991{ 971{
992 acpi_status status;
993 struct acpi_gpe_event_info *gpe_event_info; 972 struct acpi_gpe_event_info *gpe_event_info;
994 struct acpi_gpe_walk_info gpe_info; 973 struct acpi_gpe_walk_info gpe_info;
995 u32 wake_gpe_count; 974 u32 wake_gpe_count;
@@ -1019,42 +998,50 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
1019 gpe_info.gpe_block = gpe_block; 998 gpe_info.gpe_block = gpe_block;
1020 gpe_info.gpe_device = gpe_device; 999 gpe_info.gpe_device = gpe_device;
1021 1000
1022 status = 1001 acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
1023 acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
1024 ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, 1002 ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
1025 acpi_ev_match_prw_and_gpe, &gpe_info, 1003 acpi_ev_match_prw_and_gpe, NULL,
1026 NULL); 1004 &gpe_info, NULL);
1027 } 1005 }
1028 1006
1029 /* 1007 /*
1030 * Enable all GPEs in this block that have these attributes: 1008 * Enable all GPEs that have a corresponding method and aren't
1031 * 1) are "runtime" or "run/wake" GPEs, and 1009 * capable of generating wakeups. Any other GPEs within this block
1032 * 2) have a corresponding _Lxx or _Exx method 1010 * must be enabled via the acpi_enable_gpe() interface.
1033 *
1034 * Any other GPEs within this block must be enabled via the
1035 * acpi_enable_gpe() external interface.
1036 */ 1011 */
1037 wake_gpe_count = 0; 1012 wake_gpe_count = 0;
1038 gpe_enabled_count = 0; 1013 gpe_enabled_count = 0;
1014 if (gpe_device == acpi_gbl_fadt_gpe_device)
1015 gpe_device = NULL;
1039 1016
1040 for (i = 0; i < gpe_block->register_count; i++) { 1017 for (i = 0; i < gpe_block->register_count; i++) {
1041 for (j = 0; j < 8; j++) { 1018 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
1019 acpi_status status;
1020 acpi_size gpe_index;
1021 int gpe_number;
1042 1022
1043 /* Get the info block for this particular GPE */ 1023 /* Get the info block for this particular GPE */
1024 gpe_index = (acpi_size)i * ACPI_GPE_REGISTER_WIDTH + j;
1025 gpe_event_info = &gpe_block->event_info[gpe_index];
1044 1026
1045 gpe_event_info = &gpe_block->event_info[((acpi_size) i * 1027 if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) {
1046 ACPI_GPE_REGISTER_WIDTH)
1047 + j];
1048
1049 if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
1050 ACPI_GPE_DISPATCH_METHOD) &&
1051 (gpe_event_info->flags & ACPI_GPE_TYPE_RUNTIME)) {
1052 gpe_enabled_count++;
1053 }
1054
1055 if (gpe_event_info->flags & ACPI_GPE_TYPE_WAKE) {
1056 wake_gpe_count++; 1028 wake_gpe_count++;
1029 if (acpi_gbl_leave_wake_gpes_disabled)
1030 continue;
1057 } 1031 }
1032
1033 if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD))
1034 continue;
1035
1036 gpe_number = gpe_index + gpe_block->block_base_number;
1037 status = acpi_enable_gpe(gpe_device, gpe_number,
1038 ACPI_GPE_TYPE_RUNTIME);
1039 if (ACPI_FAILURE(status))
1040 ACPI_ERROR((AE_INFO,
1041 "Failed to enable GPE %02X\n",
1042 gpe_number));
1043 else
1044 gpe_enabled_count++;
1058 } 1045 }
1059 } 1046 }
1060 1047
@@ -1062,15 +1049,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
1062 "Found %u Wake, Enabled %u Runtime GPEs in this block\n", 1049 "Found %u Wake, Enabled %u Runtime GPEs in this block\n",
1063 wake_gpe_count, gpe_enabled_count)); 1050 wake_gpe_count, gpe_enabled_count));
1064 1051
1065 /* Enable all valid runtime GPEs found above */ 1052 return_ACPI_STATUS(AE_OK);
1066
1067 status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block, NULL);
1068 if (ACPI_FAILURE(status)) {
1069 ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p",
1070 gpe_block));
1071 }
1072
1073 return_ACPI_STATUS(status);
1074} 1053}
1075 1054
1076/******************************************************************************* 1055/*******************************************************************************
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c
index ce224e1eaa89..9a3cb7045a32 100644
--- a/drivers/acpi/acpica/evmisc.c
+++ b/drivers/acpi/acpica/evmisc.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -259,9 +259,15 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
259 259
260 handler_obj = notify_info->notify.handler_obj; 260 handler_obj = notify_info->notify.handler_obj;
261 if (handler_obj) { 261 if (handler_obj) {
262 handler_obj->notify.handler(notify_info->notify.node, 262 struct acpi_object_notify_handler *notifier;
263 notify_info->notify.value, 263
264 handler_obj->notify.context); 264 notifier = &handler_obj->notify;
265 while (notifier) {
266 notifier->handler(notify_info->notify.node,
267 notify_info->notify.value,
268 notifier->context);
269 notifier = notifier->next;
270 }
265 } 271 }
266 272
267 /* All done with the info object */ 273 /* All done with the info object */
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 98c7f9c62653..98fd210e87b2 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,10 @@
51ACPI_MODULE_NAME("evregion") 51ACPI_MODULE_NAME("evregion")
52 52
53/* Local prototypes */ 53/* Local prototypes */
54static u8
55acpi_ev_has_default_handler(struct acpi_namespace_node *node,
56 acpi_adr_space_type space_id);
57
54static acpi_status 58static acpi_status
55acpi_ev_reg_run(acpi_handle obj_handle, 59acpi_ev_reg_run(acpi_handle obj_handle,
56 u32 level, void *context, void **return_value); 60 u32 level, void *context, void **return_value);
@@ -142,6 +146,50 @@ acpi_status acpi_ev_install_region_handlers(void)
142 146
143/******************************************************************************* 147/*******************************************************************************
144 * 148 *
149 * FUNCTION: acpi_ev_has_default_handler
150 *
151 * PARAMETERS: Node - Namespace node for the device
152 * space_id - The address space ID
153 *
154 * RETURN: TRUE if default handler is installed, FALSE otherwise
155 *
156 * DESCRIPTION: Check if the default handler is installed for the requested
157 * space ID.
158 *
159 ******************************************************************************/
160
161static u8
162acpi_ev_has_default_handler(struct acpi_namespace_node *node,
163 acpi_adr_space_type space_id)
164{
165 union acpi_operand_object *obj_desc;
166 union acpi_operand_object *handler_obj;
167
168 /* Must have an existing internal object */
169
170 obj_desc = acpi_ns_get_attached_object(node);
171 if (obj_desc) {
172 handler_obj = obj_desc->device.handler;
173
174 /* Walk the linked list of handlers for this object */
175
176 while (handler_obj) {
177 if (handler_obj->address_space.space_id == space_id) {
178 if (handler_obj->address_space.handler_flags &
179 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
180 return (TRUE);
181 }
182 }
183
184 handler_obj = handler_obj->address_space.next;
185 }
186 }
187
188 return (FALSE);
189}
190
191/*******************************************************************************
192 *
145 * FUNCTION: acpi_ev_initialize_op_regions 193 * FUNCTION: acpi_ev_initialize_op_regions
146 * 194 *
147 * PARAMETERS: None 195 * PARAMETERS: None
@@ -169,12 +217,18 @@ acpi_status acpi_ev_initialize_op_regions(void)
169 217
170 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { 218 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
171 /* 219 /*
172 * TBD: Make sure handler is the DEFAULT handler, otherwise 220 * Make sure the installed handler is the DEFAULT handler. If not the
173 * _REG will have already been run. 221 * default, the _REG methods will have already been run (when the
222 * handler was installed)
174 */ 223 */
175 status = acpi_ev_execute_reg_methods(acpi_gbl_root_node, 224 if (acpi_ev_has_default_handler(acpi_gbl_root_node,
176 acpi_gbl_default_address_spaces 225 acpi_gbl_default_address_spaces
177 [i]); 226 [i])) {
227 status =
228 acpi_ev_execute_reg_methods(acpi_gbl_root_node,
229 acpi_gbl_default_address_spaces
230 [i]);
231 }
178 } 232 }
179 233
180 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 234 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
@@ -235,23 +289,20 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
235 * connection status 1 for connecting the handler, 0 for disconnecting 289 * connection status 1 for connecting the handler, 0 for disconnecting
236 * the handler (Passed as a parameter) 290 * the handler (Passed as a parameter)
237 */ 291 */
238 args[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 292 args[0] =
293 acpi_ut_create_integer_object((u64) region_obj->region.space_id);
239 if (!args[0]) { 294 if (!args[0]) {
240 status = AE_NO_MEMORY; 295 status = AE_NO_MEMORY;
241 goto cleanup1; 296 goto cleanup1;
242 } 297 }
243 298
244 args[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 299 args[1] = acpi_ut_create_integer_object((u64) function);
245 if (!args[1]) { 300 if (!args[1]) {
246 status = AE_NO_MEMORY; 301 status = AE_NO_MEMORY;
247 goto cleanup2; 302 goto cleanup2;
248 } 303 }
249 304
250 /* Setup the parameter objects */ 305 args[2] = NULL; /* Terminate list */
251
252 args[0]->integer.value = region_obj->region.space_id;
253 args[1]->integer.value = function;
254 args[2] = NULL;
255 306
256 /* Execute the method, no return value */ 307 /* Execute the method, no return value */
257 308
@@ -278,7 +329,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
278 * region_offset - Where in the region to read or write 329 * region_offset - Where in the region to read or write
279 * bit_width - Field width in bits (8, 16, 32, or 64) 330 * bit_width - Field width in bits (8, 16, 32, or 64)
280 * Value - Pointer to in or out value, must be 331 * Value - Pointer to in or out value, must be
281 * full 64-bit acpi_integer 332 * a full 64-bit integer
282 * 333 *
283 * RETURN: Status 334 * RETURN: Status
284 * 335 *
@@ -290,8 +341,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
290acpi_status 341acpi_status
291acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, 342acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
292 u32 function, 343 u32 function,
293 u32 region_offset, 344 u32 region_offset, u32 bit_width, u64 *value)
294 u32 bit_width, acpi_integer * value)
295{ 345{
296 acpi_status status; 346 acpi_status status;
297 acpi_adr_space_handler handler; 347 acpi_adr_space_handler handler;
@@ -667,7 +717,7 @@ acpi_ev_install_handler(acpi_handle obj_handle,
667 717
668 /* Convert and validate the device handle */ 718 /* Convert and validate the device handle */
669 719
670 node = acpi_ns_map_handle_to_node(obj_handle); 720 node = acpi_ns_validate_handle(obj_handle);
671 if (!node) { 721 if (!node) {
672 return (AE_BAD_PARAMETER); 722 return (AE_BAD_PARAMETER);
673 } 723 }
@@ -971,8 +1021,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
971 */ 1021 */
972 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, 1022 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
973 ACPI_NS_WALK_UNLOCK, 1023 ACPI_NS_WALK_UNLOCK,
974 acpi_ev_install_handler, handler_obj, 1024 acpi_ev_install_handler, NULL,
975 NULL); 1025 handler_obj, NULL);
976 1026
977 unlock_and_exit: 1027 unlock_and_exit:
978 return_ACPI_STATUS(status); 1028 return_ACPI_STATUS(status);
@@ -1008,7 +1058,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
1008 */ 1058 */
1009 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, 1059 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
1010 ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, 1060 ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run,
1011 &space_id, NULL); 1061 NULL, &space_id, NULL);
1012 1062
1013 return_ACPI_STATUS(status); 1063 return_ACPI_STATUS(status);
1014} 1064}
@@ -1036,7 +1086,7 @@ acpi_ev_reg_run(acpi_handle obj_handle,
1036 1086
1037 /* Convert and validate the device handle */ 1087 /* Convert and validate the device handle */
1038 1088
1039 node = acpi_ns_map_handle_to_node(obj_handle); 1089 node = acpi_ns_validate_handle(obj_handle);
1040 if (!node) { 1090 if (!node) {
1041 return (AE_BAD_PARAMETER); 1091 return (AE_BAD_PARAMETER);
1042 } 1092 }
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index cf29c4953028..2e3b0334072f 100644
--- a/drivers/acpi/acpica/evrgnini.c
+++ b/drivers/acpi/acpica/evrgnini.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -168,7 +168,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
168 void *handler_context, void **region_context) 168 void *handler_context, void **region_context)
169{ 169{
170 acpi_status status = AE_OK; 170 acpi_status status = AE_OK;
171 acpi_integer pci_value; 171 u64 pci_value;
172 struct acpi_pci_id *pci_id = *region_context; 172 struct acpi_pci_id *pci_id = *region_context;
173 union acpi_operand_object *handler_obj; 173 union acpi_operand_object *handler_obj;
174 struct acpi_namespace_node *parent_node; 174 struct acpi_namespace_node *parent_node;
@@ -575,6 +575,21 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
575 handler_obj = obj_desc->thermal_zone.handler; 575 handler_obj = obj_desc->thermal_zone.handler;
576 break; 576 break;
577 577
578 case ACPI_TYPE_METHOD:
579 /*
580 * If we are executing module level code, the original
581 * Node's object was replaced by this Method object and we
582 * saved the handler in the method object.
583 *
584 * See acpi_ns_exec_module_code
585 */
586 if (obj_desc->method.
587 flags & AOPOBJ_MODULE_LEVEL) {
588 handler_obj =
589 obj_desc->method.extra.handler;
590 }
591 break;
592
578 default: 593 default:
579 /* Ignore other objects */ 594 /* Ignore other objects */
580 break; 595 break;
diff --git a/drivers/acpi/acpica/evsci.c b/drivers/acpi/acpica/evsci.c
index 567b356c85af..8dfbaa96e422 100644
--- a/drivers/acpi/acpica/evsci.c
+++ b/drivers/acpi/acpica/evsci.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c
index 10b8543dd466..b40757955f9b 100644
--- a/drivers/acpi/acpica/evxface.c
+++ b/drivers/acpi/acpica/evxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -218,6 +218,72 @@ ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler)
218 218
219/******************************************************************************* 219/*******************************************************************************
220 * 220 *
221 * FUNCTION: acpi_populate_handler_object
222 *
223 * PARAMETERS: handler_obj - Handler object to populate
224 * handler_type - The type of handler:
225 * ACPI_SYSTEM_NOTIFY: system_handler (00-7f)
226 * ACPI_DEVICE_NOTIFY: driver_handler (80-ff)
227 * ACPI_ALL_NOTIFY: both system and device
228 * handler - Address of the handler
229 * context - Value passed to the handler on each GPE
230 * next - Address of a handler object to link to
231 *
232 * RETURN: None
233 *
234 * DESCRIPTION: Populate a handler object.
235 *
236 ******************************************************************************/
237static void
238acpi_populate_handler_object(struct acpi_object_notify_handler *handler_obj,
239 u32 handler_type,
240 acpi_notify_handler handler, void *context,
241 struct acpi_object_notify_handler *next)
242{
243 handler_obj->handler_type = handler_type;
244 handler_obj->handler = handler;
245 handler_obj->context = context;
246 handler_obj->next = next;
247}
248
249/*******************************************************************************
250 *
251 * FUNCTION: acpi_add_handler_object
252 *
253 * PARAMETERS: parent_obj - Parent of the new object
254 * handler - Address of the handler
255 * context - Value passed to the handler on each GPE
256 *
257 * RETURN: Status
258 *
259 * DESCRIPTION: Create a new handler object and populate it.
260 *
261 ******************************************************************************/
262static acpi_status
263acpi_add_handler_object(struct acpi_object_notify_handler *parent_obj,
264 acpi_notify_handler handler, void *context)
265{
266 struct acpi_object_notify_handler *handler_obj;
267
268 /* The parent must not be a defice notify handler object. */
269 if (parent_obj->handler_type & ACPI_DEVICE_NOTIFY)
270 return AE_BAD_PARAMETER;
271
272 handler_obj = ACPI_ALLOCATE_ZEROED(sizeof(*handler_obj));
273 if (!handler_obj)
274 return AE_NO_MEMORY;
275
276 acpi_populate_handler_object(handler_obj,
277 ACPI_SYSTEM_NOTIFY,
278 handler, context,
279 parent_obj->next);
280 parent_obj->next = handler_obj;
281
282 return AE_OK;
283}
284
285/*******************************************************************************
286 *
221 * FUNCTION: acpi_install_notify_handler 287 * FUNCTION: acpi_install_notify_handler
222 * 288 *
223 * PARAMETERS: Device - The device for which notifies will be handled 289 * PARAMETERS: Device - The device for which notifies will be handled
@@ -259,7 +325,7 @@ acpi_install_notify_handler(acpi_handle device,
259 325
260 /* Convert and validate the device handle */ 326 /* Convert and validate the device handle */
261 327
262 node = acpi_ns_map_handle_to_node(device); 328 node = acpi_ns_validate_handle(device);
263 if (!node) { 329 if (!node) {
264 status = AE_BAD_PARAMETER; 330 status = AE_BAD_PARAMETER;
265 goto unlock_and_exit; 331 goto unlock_and_exit;
@@ -316,15 +382,32 @@ acpi_install_notify_handler(acpi_handle device,
316 obj_desc = acpi_ns_get_attached_object(node); 382 obj_desc = acpi_ns_get_attached_object(node);
317 if (obj_desc) { 383 if (obj_desc) {
318 384
319 /* Object exists - make sure there's no handler */ 385 /* Object exists. */
320 386
321 if (((handler_type & ACPI_SYSTEM_NOTIFY) && 387 /* For a device notify, make sure there's no handler. */
322 obj_desc->common_notify.system_notify) || 388 if ((handler_type & ACPI_DEVICE_NOTIFY) &&
323 ((handler_type & ACPI_DEVICE_NOTIFY) && 389 obj_desc->common_notify.device_notify) {
324 obj_desc->common_notify.device_notify)) {
325 status = AE_ALREADY_EXISTS; 390 status = AE_ALREADY_EXISTS;
326 goto unlock_and_exit; 391 goto unlock_and_exit;
327 } 392 }
393
394 /* System notifies may have more handlers installed. */
395 notify_obj = obj_desc->common_notify.system_notify;
396
397 if ((handler_type & ACPI_SYSTEM_NOTIFY) && notify_obj) {
398 struct acpi_object_notify_handler *parent_obj;
399
400 if (handler_type & ACPI_DEVICE_NOTIFY) {
401 status = AE_ALREADY_EXISTS;
402 goto unlock_and_exit;
403 }
404
405 parent_obj = &notify_obj->notify;
406 status = acpi_add_handler_object(parent_obj,
407 handler,
408 context);
409 goto unlock_and_exit;
410 }
328 } else { 411 } else {
329 /* Create a new object */ 412 /* Create a new object */
330 413
@@ -356,9 +439,10 @@ acpi_install_notify_handler(acpi_handle device,
356 goto unlock_and_exit; 439 goto unlock_and_exit;
357 } 440 }
358 441
359 notify_obj->notify.node = node; 442 acpi_populate_handler_object(&notify_obj->notify,
360 notify_obj->notify.handler = handler; 443 handler_type,
361 notify_obj->notify.context = context; 444 handler, context,
445 NULL);
362 446
363 if (handler_type & ACPI_SYSTEM_NOTIFY) { 447 if (handler_type & ACPI_SYSTEM_NOTIFY) {
364 obj_desc->common_notify.system_notify = notify_obj; 448 obj_desc->common_notify.system_notify = notify_obj;
@@ -418,6 +502,10 @@ acpi_remove_notify_handler(acpi_handle device,
418 goto exit; 502 goto exit;
419 } 503 }
420 504
505
506 /* Make sure all deferred tasks are completed */
507 acpi_os_wait_events_complete(NULL);
508
421 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 509 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
422 if (ACPI_FAILURE(status)) { 510 if (ACPI_FAILURE(status)) {
423 goto exit; 511 goto exit;
@@ -425,7 +513,7 @@ acpi_remove_notify_handler(acpi_handle device,
425 513
426 /* Convert and validate the device handle */ 514 /* Convert and validate the device handle */
427 515
428 node = acpi_ns_map_handle_to_node(device); 516 node = acpi_ns_validate_handle(device);
429 if (!node) { 517 if (!node) {
430 status = AE_BAD_PARAMETER; 518 status = AE_BAD_PARAMETER;
431 goto unlock_and_exit; 519 goto unlock_and_exit;
@@ -445,15 +533,6 @@ acpi_remove_notify_handler(acpi_handle device,
445 goto unlock_and_exit; 533 goto unlock_and_exit;
446 } 534 }
447 535
448 /* Make sure all deferred tasks are completed */
449
450 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
451 acpi_os_wait_events_complete(NULL);
452 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
453 if (ACPI_FAILURE(status)) {
454 goto exit;
455 }
456
457 if (handler_type & ACPI_SYSTEM_NOTIFY) { 536 if (handler_type & ACPI_SYSTEM_NOTIFY) {
458 acpi_gbl_system_notify.node = NULL; 537 acpi_gbl_system_notify.node = NULL;
459 acpi_gbl_system_notify.handler = NULL; 538 acpi_gbl_system_notify.handler = NULL;
@@ -488,28 +567,60 @@ acpi_remove_notify_handler(acpi_handle device,
488 /* Object exists - make sure there's an existing handler */ 567 /* Object exists - make sure there's an existing handler */
489 568
490 if (handler_type & ACPI_SYSTEM_NOTIFY) { 569 if (handler_type & ACPI_SYSTEM_NOTIFY) {
570 struct acpi_object_notify_handler *handler_obj;
571 struct acpi_object_notify_handler *parent_obj;
572
491 notify_obj = obj_desc->common_notify.system_notify; 573 notify_obj = obj_desc->common_notify.system_notify;
492 if (!notify_obj) { 574 if (!notify_obj) {
493 status = AE_NOT_EXIST; 575 status = AE_NOT_EXIST;
494 goto unlock_and_exit; 576 goto unlock_and_exit;
495 } 577 }
496 578
497 if (notify_obj->notify.handler != handler) { 579 handler_obj = &notify_obj->notify;
580 parent_obj = NULL;
581 while (handler_obj->handler != handler) {
582 if (handler_obj->next) {
583 parent_obj = handler_obj;
584 handler_obj = handler_obj->next;
585 } else {
586 break;
587 }
588 }
589
590 if (handler_obj->handler != handler) {
498 status = AE_BAD_PARAMETER; 591 status = AE_BAD_PARAMETER;
499 goto unlock_and_exit; 592 goto unlock_and_exit;
500 } 593 }
501 /* Make sure all deferred tasks are completed */
502 594
503 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 595 /*
504 acpi_os_wait_events_complete(NULL); 596 * Remove the handler. There are three possible cases.
505 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 597 * First, we may need to remove a non-embedded object.
506 if (ACPI_FAILURE(status)) { 598 * Second, we may need to remove the embedded object's
507 goto exit; 599 * handler data, while non-embedded objects exist.
600 * Finally, we may need to remove the embedded object
601 * entirely along with its container.
602 */
603 if (parent_obj) {
604 /* Non-embedded object is being removed. */
605 parent_obj->next = handler_obj->next;
606 ACPI_FREE(handler_obj);
607 } else if (notify_obj->notify.next) {
608 /*
609 * The handler matches the embedded object, but
610 * there are more handler objects in the list.
611 * Replace the embedded object's data with the
612 * first next object's data and remove that
613 * object.
614 */
615 parent_obj = &notify_obj->notify;
616 handler_obj = notify_obj->notify.next;
617 *parent_obj = *handler_obj;
618 ACPI_FREE(handler_obj);
619 } else {
620 /* No more handler objects in the list. */
621 obj_desc->common_notify.system_notify = NULL;
622 acpi_ut_remove_reference(notify_obj);
508 } 623 }
509
510 /* Remove the handler */
511 obj_desc->common_notify.system_notify = NULL;
512 acpi_ut_remove_reference(notify_obj);
513 } 624 }
514 625
515 if (handler_type & ACPI_DEVICE_NOTIFY) { 626 if (handler_type & ACPI_DEVICE_NOTIFY) {
@@ -523,14 +634,6 @@ acpi_remove_notify_handler(acpi_handle device,
523 status = AE_BAD_PARAMETER; 634 status = AE_BAD_PARAMETER;
524 goto unlock_and_exit; 635 goto unlock_and_exit;
525 } 636 }
526 /* Make sure all deferred tasks are completed */
527
528 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
529 acpi_os_wait_events_complete(NULL);
530 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
531 if (ACPI_FAILURE(status)) {
532 goto exit;
533 }
534 637
535 /* Remove the handler */ 638 /* Remove the handler */
536 obj_desc->common_notify.device_notify = NULL; 639 obj_desc->common_notify.device_notify = NULL;
@@ -617,13 +720,6 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
617 handler->context = context; 720 handler->context = context;
618 handler->method_node = gpe_event_info->dispatch.method_node; 721 handler->method_node = gpe_event_info->dispatch.method_node;
619 722
620 /* Disable the GPE before installing the handler */
621
622 status = acpi_ev_disable_gpe(gpe_event_info);
623 if (ACPI_FAILURE(status)) {
624 goto unlock_and_exit;
625 }
626
627 /* Install the handler */ 723 /* Install the handler */
628 724
629 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); 725 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
@@ -707,13 +803,6 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
707 goto unlock_and_exit; 803 goto unlock_and_exit;
708 } 804 }
709 805
710 /* Disable the GPE before removing the handler */
711
712 status = acpi_ev_disable_gpe(gpe_event_info);
713 if (ACPI_FAILURE(status)) {
714 goto unlock_and_exit;
715 }
716
717 /* Make sure all deferred tasks are completed */ 806 /* Make sure all deferred tasks are completed */
718 807
719 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); 808 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index 4721f58fe42c..5ff32c78ea2d 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -201,23 +201,27 @@ ACPI_EXPORT_SYMBOL(acpi_enable_event)
201 201
202/******************************************************************************* 202/*******************************************************************************
203 * 203 *
204 * FUNCTION: acpi_set_gpe_type 204 * FUNCTION: acpi_set_gpe
205 * 205 *
206 * PARAMETERS: gpe_device - Parent GPE Device 206 * PARAMETERS: gpe_device - Parent GPE Device
207 * gpe_number - GPE level within the GPE block 207 * gpe_number - GPE level within the GPE block
208 * Type - New GPE type 208 * action - Enable or disable
209 * Called from ISR or not
209 * 210 *
210 * RETURN: Status 211 * RETURN: Status
211 * 212 *
212 * DESCRIPTION: Set the type of an individual GPE 213 * DESCRIPTION: Enable or disable an ACPI event (general purpose)
213 * 214 *
214 ******************************************************************************/ 215 ******************************************************************************/
215acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) 216acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action)
216{ 217{
217 acpi_status status = AE_OK; 218 acpi_status status = AE_OK;
219 acpi_cpu_flags flags;
218 struct acpi_gpe_event_info *gpe_event_info; 220 struct acpi_gpe_event_info *gpe_event_info;
219 221
220 ACPI_FUNCTION_TRACE(acpi_set_gpe_type); 222 ACPI_FUNCTION_TRACE(acpi_set_gpe);
223
224 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
221 225
222 /* Ensure that we have a valid GPE number */ 226 /* Ensure that we have a valid GPE number */
223 227
@@ -227,19 +231,29 @@ acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type)
227 goto unlock_and_exit; 231 goto unlock_and_exit;
228 } 232 }
229 233
230 if ((gpe_event_info->flags & ACPI_GPE_TYPE_MASK) == type) { 234 /* Perform the action */
231 return_ACPI_STATUS(AE_OK); 235
232 } 236 switch (action) {
237 case ACPI_GPE_ENABLE:
238 status = acpi_ev_enable_gpe(gpe_event_info);
239 break;
233 240
234 /* Set the new type (will disable GPE if currently enabled) */ 241 case ACPI_GPE_DISABLE:
242 status = acpi_ev_disable_gpe(gpe_event_info);
243 break;
235 244
236 status = acpi_ev_set_gpe_type(gpe_event_info, type); 245 default:
246 ACPI_ERROR((AE_INFO, "Invalid action\n"));
247 status = AE_BAD_PARAMETER;
248 break;
249 }
237 250
238 unlock_and_exit: 251 unlock_and_exit:
252 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
239 return_ACPI_STATUS(status); 253 return_ACPI_STATUS(status);
240} 254}
241 255
242ACPI_EXPORT_SYMBOL(acpi_set_gpe_type) 256ACPI_EXPORT_SYMBOL(acpi_set_gpe)
243 257
244/******************************************************************************* 258/*******************************************************************************
245 * 259 *
@@ -247,15 +261,14 @@ ACPI_EXPORT_SYMBOL(acpi_set_gpe_type)
247 * 261 *
248 * PARAMETERS: gpe_device - Parent GPE Device 262 * PARAMETERS: gpe_device - Parent GPE Device
249 * gpe_number - GPE level within the GPE block 263 * gpe_number - GPE level within the GPE block
250 * Flags - Just enable, or also wake enable? 264 * type - Purpose the GPE will be used for
251 * Called from ISR or not
252 * 265 *
253 * RETURN: Status 266 * RETURN: Status
254 * 267 *
255 * DESCRIPTION: Enable an ACPI event (general purpose) 268 * DESCRIPTION: Take a reference to a GPE and enable it if necessary
256 * 269 *
257 ******************************************************************************/ 270 ******************************************************************************/
258acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number) 271acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 type)
259{ 272{
260 acpi_status status = AE_OK; 273 acpi_status status = AE_OK;
261 acpi_cpu_flags flags; 274 acpi_cpu_flags flags;
@@ -263,6 +276,9 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
263 276
264 ACPI_FUNCTION_TRACE(acpi_enable_gpe); 277 ACPI_FUNCTION_TRACE(acpi_enable_gpe);
265 278
279 if (type & ~ACPI_GPE_TYPE_WAKE_RUN)
280 return_ACPI_STATUS(AE_BAD_PARAMETER);
281
266 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); 282 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
267 283
268 /* Ensure that we have a valid GPE number */ 284 /* Ensure that we have a valid GPE number */
@@ -273,15 +289,32 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
273 goto unlock_and_exit; 289 goto unlock_and_exit;
274 } 290 }
275 291
276 /* Perform the enable */ 292 if (type & ACPI_GPE_TYPE_RUNTIME) {
293 if (++gpe_event_info->runtime_count == 1) {
294 status = acpi_ev_enable_gpe(gpe_event_info);
295 if (ACPI_FAILURE(status))
296 gpe_event_info->runtime_count--;
297 }
298 }
299
300 if (type & ACPI_GPE_TYPE_WAKE) {
301 if (!(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) {
302 status = AE_BAD_PARAMETER;
303 goto unlock_and_exit;
304 }
277 305
278 status = acpi_ev_enable_gpe(gpe_event_info, TRUE); 306 /*
307 * Wake-up GPEs are only enabled right prior to putting the
308 * system into a sleep state.
309 */
310 if (++gpe_event_info->wakeup_count == 1)
311 acpi_ev_update_gpe_enable_masks(gpe_event_info);
312 }
279 313
280 unlock_and_exit: 314unlock_and_exit:
281 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 315 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
282 return_ACPI_STATUS(status); 316 return_ACPI_STATUS(status);
283} 317}
284
285ACPI_EXPORT_SYMBOL(acpi_enable_gpe) 318ACPI_EXPORT_SYMBOL(acpi_enable_gpe)
286 319
287/******************************************************************************* 320/*******************************************************************************
@@ -290,15 +323,14 @@ ACPI_EXPORT_SYMBOL(acpi_enable_gpe)
290 * 323 *
291 * PARAMETERS: gpe_device - Parent GPE Device 324 * PARAMETERS: gpe_device - Parent GPE Device
292 * gpe_number - GPE level within the GPE block 325 * gpe_number - GPE level within the GPE block
293 * Flags - Just disable, or also wake disable? 326 * type - Purpose the GPE won't be used for any more
294 * Called from ISR or not
295 * 327 *
296 * RETURN: Status 328 * RETURN: Status
297 * 329 *
298 * DESCRIPTION: Disable an ACPI event (general purpose) 330 * DESCRIPTION: Release a reference to a GPE and disable it if necessary
299 * 331 *
300 ******************************************************************************/ 332 ******************************************************************************/
301acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number) 333acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 type)
302{ 334{
303 acpi_status status = AE_OK; 335 acpi_status status = AE_OK;
304 acpi_cpu_flags flags; 336 acpi_cpu_flags flags;
@@ -306,6 +338,9 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
306 338
307 ACPI_FUNCTION_TRACE(acpi_disable_gpe); 339 ACPI_FUNCTION_TRACE(acpi_disable_gpe);
308 340
341 if (type & ~ACPI_GPE_TYPE_WAKE_RUN)
342 return_ACPI_STATUS(AE_BAD_PARAMETER);
343
309 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); 344 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
310 /* Ensure that we have a valid GPE number */ 345 /* Ensure that we have a valid GPE number */
311 346
@@ -315,13 +350,24 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
315 goto unlock_and_exit; 350 goto unlock_and_exit;
316 } 351 }
317 352
318 status = acpi_ev_disable_gpe(gpe_event_info); 353 if ((type & ACPI_GPE_TYPE_RUNTIME) && gpe_event_info->runtime_count) {
354 if (--gpe_event_info->runtime_count == 0)
355 status = acpi_ev_disable_gpe(gpe_event_info);
356 }
357
358 if ((type & ACPI_GPE_TYPE_WAKE) && gpe_event_info->wakeup_count) {
359 /*
360 * Wake-up GPEs are not enabled after leaving system sleep
361 * states, so we don't need to disable them here.
362 */
363 if (--gpe_event_info->wakeup_count == 0)
364 acpi_ev_update_gpe_enable_masks(gpe_event_info);
365 }
319 366
320unlock_and_exit: 367unlock_and_exit:
321 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 368 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
322 return_ACPI_STATUS(status); 369 return_ACPI_STATUS(status);
323} 370}
324
325ACPI_EXPORT_SYMBOL(acpi_disable_gpe) 371ACPI_EXPORT_SYMBOL(acpi_disable_gpe)
326 372
327/******************************************************************************* 373/*******************************************************************************
@@ -610,7 +656,7 @@ acpi_install_gpe_block(acpi_handle gpe_device,
610 return (status); 656 return (status);
611 } 657 }
612 658
613 node = acpi_ns_map_handle_to_node(gpe_device); 659 node = acpi_ns_validate_handle(gpe_device);
614 if (!node) { 660 if (!node) {
615 status = AE_BAD_PARAMETER; 661 status = AE_BAD_PARAMETER;
616 goto unlock_and_exit; 662 goto unlock_and_exit;
@@ -698,7 +744,7 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
698 return (status); 744 return (status);
699 } 745 }
700 746
701 node = acpi_ns_map_handle_to_node(gpe_device); 747 node = acpi_ns_validate_handle(gpe_device);
702 if (!node) { 748 if (!node) {
703 status = AE_BAD_PARAMETER; 749 status = AE_BAD_PARAMETER;
704 goto unlock_and_exit; 750 goto unlock_and_exit;
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c
index 7c3d2d356ffb..541cbc1544d5 100644
--- a/drivers/acpi/acpica/evxfregn.c
+++ b/drivers/acpi/acpica/evxfregn.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -89,7 +89,7 @@ acpi_install_address_space_handler(acpi_handle device,
89 89
90 /* Convert and validate the device handle */ 90 /* Convert and validate the device handle */
91 91
92 node = acpi_ns_map_handle_to_node(device); 92 node = acpi_ns_validate_handle(device);
93 if (!node) { 93 if (!node) {
94 status = AE_BAD_PARAMETER; 94 status = AE_BAD_PARAMETER;
95 goto unlock_and_exit; 95 goto unlock_and_exit;
@@ -155,7 +155,7 @@ acpi_remove_address_space_handler(acpi_handle device,
155 155
156 /* Convert and validate the device handle */ 156 /* Convert and validate the device handle */
157 157
158 node = acpi_ns_map_handle_to_node(device); 158 node = acpi_ns_validate_handle(device);
159 if (!node || 159 if (!node ||
160 ((node->type != ACPI_TYPE_DEVICE) && 160 ((node->type != ACPI_TYPE_DEVICE) &&
161 (node->type != ACPI_TYPE_PROCESSOR) && 161 (node->type != ACPI_TYPE_PROCESSOR) &&
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c
index 24afef81af39..7e8b3bedc376 100644
--- a/drivers/acpi/acpica/exconfig.c
+++ b/drivers/acpi/acpica/exconfig.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -170,14 +170,12 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
170 170
171 /* Table not found, return an Integer=0 and AE_OK */ 171 /* Table not found, return an Integer=0 and AE_OK */
172 172
173 ddb_handle = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 173 ddb_handle = acpi_ut_create_integer_object((u64) 0);
174 if (!ddb_handle) { 174 if (!ddb_handle) {
175 return_ACPI_STATUS(AE_NO_MEMORY); 175 return_ACPI_STATUS(AE_NO_MEMORY);
176 } 176 }
177 177
178 ddb_handle->integer.value = 0;
179 *return_desc = ddb_handle; 178 *return_desc = ddb_handle;
180
181 return_ACPI_STATUS(AE_OK); 179 return_ACPI_STATUS(AE_OK);
182 } 180 }
183 181
@@ -286,7 +284,7 @@ static acpi_status
286acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer) 284acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer)
287{ 285{
288 acpi_status status; 286 acpi_status status;
289 acpi_integer value; 287 u64 value;
290 u32 region_offset = 0; 288 u32 region_offset = 0;
291 u32 i; 289 u32 i;
292 290
@@ -492,7 +490,11 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
492 490
493 status = acpi_tb_add_table(&table_desc, &table_index); 491 status = acpi_tb_add_table(&table_desc, &table_index);
494 if (ACPI_FAILURE(status)) { 492 if (ACPI_FAILURE(status)) {
495 goto cleanup; 493
494 /* Delete allocated table buffer */
495
496 acpi_tb_delete_table(&table_desc);
497 return_ACPI_STATUS(status);
496 } 498 }
497 499
498 /* 500 /*
@@ -535,13 +537,6 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
535 acpi_gbl_table_handler_context); 537 acpi_gbl_table_handler_context);
536 } 538 }
537 539
538 cleanup:
539 if (ACPI_FAILURE(status)) {
540
541 /* Delete allocated table buffer */
542
543 acpi_tb_delete_table(&table_desc);
544 }
545 return_ACPI_STATUS(status); 540 return_ACPI_STATUS(status);
546} 541}
547 542
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c
index 37d0d39e60a6..bda7aed0404b 100644
--- a/drivers/acpi/acpica/exconvrt.c
+++ b/drivers/acpi/acpica/exconvrt.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -51,8 +51,7 @@ ACPI_MODULE_NAME("exconvrt")
51 51
52/* Local prototypes */ 52/* Local prototypes */
53static u32 53static u32
54acpi_ex_convert_to_ascii(acpi_integer integer, 54acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 max_length);
55 u16 base, u8 * string, u8 max_length);
56 55
57/******************************************************************************* 56/*******************************************************************************
58 * 57 *
@@ -75,7 +74,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
75{ 74{
76 union acpi_operand_object *return_desc; 75 union acpi_operand_object *return_desc;
77 u8 *pointer; 76 u8 *pointer;
78 acpi_integer result; 77 u64 result;
79 u32 i; 78 u32 i;
80 u32 count; 79 u32 count;
81 acpi_status status; 80 acpi_status status;
@@ -155,7 +154,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
155 * Little endian is used, meaning that the first byte of the buffer 154 * Little endian is used, meaning that the first byte of the buffer
156 * is the LSB of the integer 155 * is the LSB of the integer
157 */ 156 */
158 result |= (((acpi_integer) pointer[i]) << (i * 8)); 157 result |= (((u64) pointer[i]) << (i * 8));
159 } 158 }
160 break; 159 break;
161 160
@@ -167,7 +166,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
167 166
168 /* Create a new integer */ 167 /* Create a new integer */
169 168
170 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 169 return_desc = acpi_ut_create_integer_object(result);
171 if (!return_desc) { 170 if (!return_desc) {
172 return_ACPI_STATUS(AE_NO_MEMORY); 171 return_ACPI_STATUS(AE_NO_MEMORY);
173 } 172 }
@@ -177,7 +176,6 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
177 176
178 /* Save the Result */ 177 /* Save the Result */
179 178
180 return_desc->integer.value = result;
181 acpi_ex_truncate_for32bit_table(return_desc); 179 acpi_ex_truncate_for32bit_table(return_desc);
182 *result_desc = return_desc; 180 *result_desc = return_desc;
183 return_ACPI_STATUS(AE_OK); 181 return_ACPI_STATUS(AE_OK);
@@ -286,10 +284,9 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
286 ******************************************************************************/ 284 ******************************************************************************/
287 285
288static u32 286static u32
289acpi_ex_convert_to_ascii(acpi_integer integer, 287acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width)
290 u16 base, u8 * string, u8 data_width)
291{ 288{
292 acpi_integer digit; 289 u64 digit;
293 u32 i; 290 u32 i;
294 u32 j; 291 u32 j;
295 u32 k = 0; 292 u32 k = 0;
@@ -532,10 +529,9 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
532 * (separated by commas or spaces) 529 * (separated by commas or spaces)
533 */ 530 */
534 for (i = 0; i < obj_desc->buffer.length; i++) { 531 for (i = 0; i < obj_desc->buffer.length; i++) {
535 new_buf += acpi_ex_convert_to_ascii((acpi_integer) 532 new_buf += acpi_ex_convert_to_ascii((u64) obj_desc->
536 obj_desc->buffer. 533 buffer.pointer[i],
537 pointer[i], base, 534 base, new_buf, 1);
538 new_buf, 1);
539 *new_buf++ = separator; /* each separated by a comma or space */ 535 *new_buf++ = separator; /* each separated by a comma or space */
540 } 536 }
541 537
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c
index 02b25d233d99..0aa57d938698 100644
--- a/drivers/acpi/acpica/excreate.c
+++ b/drivers/acpi/acpica/excreate.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index de3446372ddc..d39d438ba1e3 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index 0b33d6c887b9..6c79fecbee42 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -130,7 +130,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
130 /* Call the region handler for the read */ 130 /* Call the region handler for the read */
131 131
132 status = acpi_ex_access_region(obj_desc, 0, 132 status = acpi_ex_access_region(obj_desc, 0,
133 ACPI_CAST_PTR(acpi_integer, 133 ACPI_CAST_PTR(u64,
134 buffer_desc-> 134 buffer_desc->
135 buffer.pointer), 135 buffer.pointer),
136 function); 136 function);
@@ -141,7 +141,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
141 /* 141 /*
142 * Allocate a buffer for the contents of the field. 142 * Allocate a buffer for the contents of the field.
143 * 143 *
144 * If the field is larger than the size of an acpi_integer, create 144 * If the field is larger than the current integer width, create
145 * a BUFFER to hold it. Otherwise, use an INTEGER. This allows 145 * a BUFFER to hold it. Otherwise, use an INTEGER. This allows
146 * the use of arithmetic operators on the returned value if the 146 * the use of arithmetic operators on the returned value if the
147 * field size is equal or smaller than an Integer. 147 * field size is equal or smaller than an Integer.
@@ -162,13 +162,12 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
162 } else { 162 } else {
163 /* Field will fit within an Integer (normal case) */ 163 /* Field will fit within an Integer (normal case) */
164 164
165 buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 165 buffer_desc = acpi_ut_create_integer_object((u64) 0);
166 if (!buffer_desc) { 166 if (!buffer_desc) {
167 return_ACPI_STATUS(AE_NO_MEMORY); 167 return_ACPI_STATUS(AE_NO_MEMORY);
168 } 168 }
169 169
170 length = acpi_gbl_integer_byte_width; 170 length = acpi_gbl_integer_byte_width;
171 buffer_desc->integer.value = 0;
172 buffer = &buffer_desc->integer.value; 171 buffer = &buffer_desc->integer.value;
173 } 172 }
174 173
@@ -307,8 +306,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
307 * same buffer) 306 * same buffer)
308 */ 307 */
309 status = acpi_ex_access_region(obj_desc, 0, 308 status = acpi_ex_access_region(obj_desc, 0,
310 (acpi_integer *) buffer, 309 (u64 *) buffer, function);
311 function);
312 acpi_ex_release_global_lock(obj_desc->common_field.field_flags); 310 acpi_ex_release_global_lock(obj_desc->common_field.field_flags);
313 311
314 *result_desc = buffer_desc; 312 *result_desc = buffer_desc;
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c
index d7b3b418fb45..f68a216168be 100644
--- a/drivers/acpi/acpica/exfldio.c
+++ b/drivers/acpi/acpica/exfldio.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -55,11 +55,10 @@ ACPI_MODULE_NAME("exfldio")
55static acpi_status 55static acpi_status
56acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, 56acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
57 u32 field_datum_byte_offset, 57 u32 field_datum_byte_offset,
58 acpi_integer * value, u32 read_write); 58 u64 *value, u32 read_write);
59 59
60static u8 60static u8
61acpi_ex_register_overflow(union acpi_operand_object *obj_desc, 61acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value);
62 acpi_integer value);
63 62
64static acpi_status 63static acpi_status
65acpi_ex_setup_region(union acpi_operand_object *obj_desc, 64acpi_ex_setup_region(union acpi_operand_object *obj_desc,
@@ -212,7 +211,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
212 * field_datum_byte_offset - Byte offset of this datum within the 211 * field_datum_byte_offset - Byte offset of this datum within the
213 * parent field 212 * parent field
214 * Value - Where to store value (must at least 213 * Value - Where to store value (must at least
215 * the size of acpi_integer) 214 * 64 bits)
216 * Function - Read or Write flag plus other region- 215 * Function - Read or Write flag plus other region-
217 * dependent flags 216 * dependent flags
218 * 217 *
@@ -224,8 +223,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
224 223
225acpi_status 224acpi_status
226acpi_ex_access_region(union acpi_operand_object *obj_desc, 225acpi_ex_access_region(union acpi_operand_object *obj_desc,
227 u32 field_datum_byte_offset, 226 u32 field_datum_byte_offset, u64 *value, u32 function)
228 acpi_integer * value, u32 function)
229{ 227{
230 acpi_status status; 228 acpi_status status;
231 union acpi_operand_object *rgn_desc; 229 union acpi_operand_object *rgn_desc;
@@ -317,8 +315,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,
317 ******************************************************************************/ 315 ******************************************************************************/
318 316
319static u8 317static u8
320acpi_ex_register_overflow(union acpi_operand_object *obj_desc, 318acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value)
321 acpi_integer value)
322{ 319{
323 320
324 if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) { 321 if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) {
@@ -329,7 +326,7 @@ acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
329 return (FALSE); 326 return (FALSE);
330 } 327 }
331 328
332 if (value >= ((acpi_integer) 1 << obj_desc->common_field.bit_length)) { 329 if (value >= ((u64) 1 << obj_desc->common_field.bit_length)) {
333 /* 330 /*
334 * The Value is larger than the maximum value that can fit into 331 * The Value is larger than the maximum value that can fit into
335 * the register. 332 * the register.
@@ -362,11 +359,10 @@ acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
362 359
363static acpi_status 360static acpi_status
364acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, 361acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
365 u32 field_datum_byte_offset, 362 u32 field_datum_byte_offset, u64 *value, u32 read_write)
366 acpi_integer * value, u32 read_write)
367{ 363{
368 acpi_status status; 364 acpi_status status;
369 acpi_integer local_value; 365 u64 local_value;
370 366
371 ACPI_FUNCTION_TRACE_U32(ex_field_datum_io, field_datum_byte_offset); 367 ACPI_FUNCTION_TRACE_U32(ex_field_datum_io, field_datum_byte_offset);
372 368
@@ -439,8 +435,8 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
439 * the register 435 * the register
440 */ 436 */
441 if (acpi_ex_register_overflow(obj_desc->bank_field.bank_obj, 437 if (acpi_ex_register_overflow(obj_desc->bank_field.bank_obj,
442 (acpi_integer) obj_desc-> 438 (u64) obj_desc->bank_field.
443 bank_field.value)) { 439 value)) {
444 return_ACPI_STATUS(AE_AML_REGISTER_LIMIT); 440 return_ACPI_STATUS(AE_AML_REGISTER_LIMIT);
445 } 441 }
446 442
@@ -481,8 +477,8 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
481 * the register 477 * the register
482 */ 478 */
483 if (acpi_ex_register_overflow(obj_desc->index_field.index_obj, 479 if (acpi_ex_register_overflow(obj_desc->index_field.index_obj,
484 (acpi_integer) obj_desc-> 480 (u64) obj_desc->index_field.
485 index_field.value)) { 481 value)) {
486 return_ACPI_STATUS(AE_AML_REGISTER_LIMIT); 482 return_ACPI_STATUS(AE_AML_REGISTER_LIMIT);
487 } 483 }
488 484
@@ -512,7 +508,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
512 status = 508 status =
513 acpi_ex_extract_from_field(obj_desc->index_field. 509 acpi_ex_extract_from_field(obj_desc->index_field.
514 data_obj, value, 510 data_obj, value,
515 sizeof(acpi_integer)); 511 sizeof(u64));
516 } else { 512 } else {
517 /* Write the datum to the data_register */ 513 /* Write the datum to the data_register */
518 514
@@ -523,7 +519,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
523 status = 519 status =
524 acpi_ex_insert_into_field(obj_desc->index_field. 520 acpi_ex_insert_into_field(obj_desc->index_field.
525 data_obj, value, 521 data_obj, value,
526 sizeof(acpi_integer)); 522 sizeof(u64));
527 } 523 }
528 break; 524 break;
529 525
@@ -571,13 +567,12 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
571 567
572acpi_status 568acpi_status
573acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, 569acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
574 acpi_integer mask, 570 u64 mask,
575 acpi_integer field_value, 571 u64 field_value, u32 field_datum_byte_offset)
576 u32 field_datum_byte_offset)
577{ 572{
578 acpi_status status = AE_OK; 573 acpi_status status = AE_OK;
579 acpi_integer merged_value; 574 u64 merged_value;
580 acpi_integer current_value; 575 u64 current_value;
581 576
582 ACPI_FUNCTION_TRACE_U32(ex_write_with_update_rule, mask); 577 ACPI_FUNCTION_TRACE_U32(ex_write_with_update_rule, mask);
583 578
@@ -587,7 +582,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
587 582
588 /* If the mask is all ones, we don't need to worry about the update rule */ 583 /* If the mask is all ones, we don't need to worry about the update rule */
589 584
590 if (mask != ACPI_INTEGER_MAX) { 585 if (mask != ACPI_UINT64_MAX) {
591 586
592 /* Decode the update rule */ 587 /* Decode the update rule */
593 588
@@ -678,8 +673,8 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
678 void *buffer, u32 buffer_length) 673 void *buffer, u32 buffer_length)
679{ 674{
680 acpi_status status; 675 acpi_status status;
681 acpi_integer raw_datum; 676 u64 raw_datum;
682 acpi_integer merged_datum; 677 u64 merged_datum;
683 u32 field_offset = 0; 678 u32 field_offset = 0;
684 u32 buffer_offset = 0; 679 u32 buffer_offset = 0;
685 u32 buffer_tail_bits; 680 u32 buffer_tail_bits;
@@ -804,10 +799,10 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
804 void *buffer, u32 buffer_length) 799 void *buffer, u32 buffer_length)
805{ 800{
806 acpi_status status; 801 acpi_status status;
807 acpi_integer mask; 802 u64 mask;
808 acpi_integer width_mask; 803 u64 width_mask;
809 acpi_integer merged_datum; 804 u64 merged_datum;
810 acpi_integer raw_datum = 0; 805 u64 raw_datum = 0;
811 u32 field_offset = 0; 806 u32 field_offset = 0;
812 u32 buffer_offset = 0; 807 u32 buffer_offset = 0;
813 u32 buffer_tail_bits; 808 u32 buffer_tail_bits;
@@ -855,7 +850,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
855 * shift operator 850 * shift operator
856 */ 851 */
857 if (obj_desc->common_field.access_bit_width == ACPI_INTEGER_BIT_SIZE) { 852 if (obj_desc->common_field.access_bit_width == ACPI_INTEGER_BIT_SIZE) {
858 width_mask = ACPI_INTEGER_MAX; 853 width_mask = ACPI_UINT64_MAX;
859 } else { 854 } else {
860 width_mask = 855 width_mask =
861 ACPI_MASK_BITS_ABOVE(obj_desc->common_field. 856 ACPI_MASK_BITS_ABOVE(obj_desc->common_field.
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c
index 998eac329937..c5bb1eeed2df 100644
--- a/drivers/acpi/acpica/exmisc.c
+++ b/drivers/acpi/acpica/exmisc.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -409,8 +409,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
409 * 409 *
410 ******************************************************************************/ 410 ******************************************************************************/
411 411
412acpi_integer 412u64 acpi_ex_do_math_op(u16 opcode, u64 integer0, u64 integer1)
413acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1)
414{ 413{
415 414
416 ACPI_FUNCTION_ENTRY(); 415 ACPI_FUNCTION_ENTRY();
@@ -498,8 +497,7 @@ acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1)
498 497
499acpi_status 498acpi_status
500acpi_ex_do_logical_numeric_op(u16 opcode, 499acpi_ex_do_logical_numeric_op(u16 opcode,
501 acpi_integer integer0, 500 u64 integer0, u64 integer1, u8 *logical_result)
502 acpi_integer integer1, u8 * logical_result)
503{ 501{
504 acpi_status status = AE_OK; 502 acpi_status status = AE_OK;
505 u8 local_result = FALSE; 503 u8 local_result = FALSE;
@@ -564,8 +562,8 @@ acpi_ex_do_logical_op(u16 opcode,
564 union acpi_operand_object *operand1, u8 * logical_result) 562 union acpi_operand_object *operand1, u8 * logical_result)
565{ 563{
566 union acpi_operand_object *local_operand1 = operand1; 564 union acpi_operand_object *local_operand1 = operand1;
567 acpi_integer integer0; 565 u64 integer0;
568 acpi_integer integer1; 566 u64 integer1;
569 u32 length0; 567 u32 length0;
570 u32 length1; 568 u32 length1;
571 acpi_status status = AE_OK; 569 acpi_status status = AE_OK;
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c
index 2f0114202b05..7116bc86494d 100644
--- a/drivers/acpi/acpica/exmutex.c
+++ b/drivers/acpi/acpica/exmutex.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -375,6 +375,14 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
375 return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); 375 return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED);
376 } 376 }
377 377
378 /* Must have a valid thread. */
379 if (!walk_state->thread) {
380 ACPI_ERROR((AE_INFO,
381 "Cannot release Mutex [%4.4s], null thread info",
382 acpi_ut_get_node_name(obj_desc->mutex.node)));
383 return_ACPI_STATUS(AE_AML_INTERNAL);
384 }
385
378 /* 386 /*
379 * The Mutex is owned, but this thread must be the owner. 387 * The Mutex is owned, but this thread must be the owner.
380 * Special case for Global Lock, any thread can release 388 * Special case for Global Lock, any thread can release
@@ -392,15 +400,6 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
392 return_ACPI_STATUS(AE_AML_NOT_OWNER); 400 return_ACPI_STATUS(AE_AML_NOT_OWNER);
393 } 401 }
394 402
395 /* Must have a valid thread ID */
396
397 if (!walk_state->thread) {
398 ACPI_ERROR((AE_INFO,
399 "Cannot release Mutex [%4.4s], null thread info",
400 acpi_ut_get_node_name(obj_desc->mutex.node)));
401 return_ACPI_STATUS(AE_AML_INTERNAL);
402 }
403
404 /* 403 /*
405 * The sync level of the mutex must be equal to the current sync level. In 404 * The sync level of the mutex must be equal to the current sync level. In
406 * other words, the current level means that at least one mutex at that 405 * other words, the current level means that at least one mutex at that
diff --git a/drivers/acpi/acpica/exnames.c b/drivers/acpi/acpica/exnames.c
index ffdae122d94a..679f308c5a89 100644
--- a/drivers/acpi/acpica/exnames.c
+++ b/drivers/acpi/acpica/exnames.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c
index 9635d21e568d..99adbab5acbf 100644
--- a/drivers/acpi/acpica/exoparg1.c
+++ b/drivers/acpi/acpica/exoparg1.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -100,12 +100,12 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state)
100 100
101 /* Create a return object of type Integer */ 101 /* Create a return object of type Integer */
102 102
103 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 103 return_desc =
104 acpi_ut_create_integer_object(acpi_os_get_timer());
104 if (!return_desc) { 105 if (!return_desc) {
105 status = AE_NO_MEMORY; 106 status = AE_NO_MEMORY;
106 goto cleanup; 107 goto cleanup;
107 } 108 }
108 return_desc->integer.value = acpi_os_get_timer();
109 break; 109 break;
110 110
111 default: /* Unknown opcode */ 111 default: /* Unknown opcode */
@@ -261,8 +261,8 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
261 union acpi_operand_object *return_desc2 = NULL; 261 union acpi_operand_object *return_desc2 = NULL;
262 u32 temp32; 262 u32 temp32;
263 u32 i; 263 u32 i;
264 acpi_integer power_of_ten; 264 u64 power_of_ten;
265 acpi_integer digit; 265 u64 digit;
266 266
267 ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R, 267 ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R,
268 acpi_ps_get_opcode_name(walk_state->opcode)); 268 acpi_ps_get_opcode_name(walk_state->opcode));
@@ -362,7 +362,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
362 /* Sum the digit into the result with the current power of 10 */ 362 /* Sum the digit into the result with the current power of 10 */
363 363
364 return_desc->integer.value += 364 return_desc->integer.value +=
365 (((acpi_integer) temp32) * power_of_ten); 365 (((u64) temp32) * power_of_ten);
366 366
367 /* Shift to next BCD digit */ 367 /* Shift to next BCD digit */
368 368
@@ -392,7 +392,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
392 * remainder from above 392 * remainder from above
393 */ 393 */
394 return_desc->integer.value |= 394 return_desc->integer.value |=
395 (((acpi_integer) temp32) << ACPI_MUL_4(i)); 395 (((u64) temp32) << ACPI_MUL_4(i));
396 } 396 }
397 397
398 /* Overflow if there is any data left in Digit */ 398 /* Overflow if there is any data left in Digit */
@@ -439,7 +439,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
439 439
440 /* The object exists in the namespace, return TRUE */ 440 /* The object exists in the namespace, return TRUE */
441 441
442 return_desc->integer.value = ACPI_INTEGER_MAX; 442 return_desc->integer.value = ACPI_UINT64_MAX;
443 goto cleanup; 443 goto cleanup;
444 444
445 default: 445 default:
@@ -589,7 +589,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
589 union acpi_operand_object *return_desc = NULL; 589 union acpi_operand_object *return_desc = NULL;
590 acpi_status status = AE_OK; 590 acpi_status status = AE_OK;
591 u32 type; 591 u32 type;
592 acpi_integer value; 592 u64 value;
593 593
594 ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R, 594 ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R,
595 acpi_ps_get_opcode_name(walk_state->opcode)); 595 acpi_ps_get_opcode_name(walk_state->opcode));
@@ -599,7 +599,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
599 switch (walk_state->opcode) { 599 switch (walk_state->opcode) {
600 case AML_LNOT_OP: /* LNot (Operand) */ 600 case AML_LNOT_OP: /* LNot (Operand) */
601 601
602 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 602 return_desc = acpi_ut_create_integer_object((u64) 0);
603 if (!return_desc) { 603 if (!return_desc) {
604 status = AE_NO_MEMORY; 604 status = AE_NO_MEMORY;
605 goto cleanup; 605 goto cleanup;
@@ -610,7 +610,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
610 * return_desc->Integer.Value is initially == 0 (FALSE) from above. 610 * return_desc->Integer.Value is initially == 0 (FALSE) from above.
611 */ 611 */
612 if (!operand[0]->integer.value) { 612 if (!operand[0]->integer.value) {
613 return_desc->integer.value = ACPI_INTEGER_MAX; 613 return_desc->integer.value = ACPI_UINT64_MAX;
614 } 614 }
615 break; 615 break;
616 616
@@ -702,13 +702,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
702 702
703 /* Allocate a descriptor to hold the type. */ 703 /* Allocate a descriptor to hold the type. */
704 704
705 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 705 return_desc = acpi_ut_create_integer_object((u64) type);
706 if (!return_desc) { 706 if (!return_desc) {
707 status = AE_NO_MEMORY; 707 status = AE_NO_MEMORY;
708 goto cleanup; 708 goto cleanup;
709 } 709 }
710
711 return_desc->integer.value = type;
712 break; 710 break;
713 711
714 case AML_SIZE_OF_OP: /* size_of (source_object) */ 712 case AML_SIZE_OF_OP: /* size_of (source_object) */
@@ -777,13 +775,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
777 * Now that we have the size of the object, create a result 775 * Now that we have the size of the object, create a result
778 * object to hold the value 776 * object to hold the value
779 */ 777 */
780 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 778 return_desc = acpi_ut_create_integer_object(value);
781 if (!return_desc) { 779 if (!return_desc) {
782 status = AE_NO_MEMORY; 780 status = AE_NO_MEMORY;
783 goto cleanup; 781 goto cleanup;
784 } 782 }
785
786 return_desc->integer.value = value;
787 break; 783 break;
788 784
789 case AML_REF_OF_OP: /* ref_of (source_object) */ 785 case AML_REF_OF_OP: /* ref_of (source_object) */
@@ -946,24 +942,24 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
946 * NOTE: index into a buffer is NOT a pointer to a 942 * NOTE: index into a buffer is NOT a pointer to a
947 * sub-buffer of the main buffer, it is only a pointer to a 943 * sub-buffer of the main buffer, it is only a pointer to a
948 * single element (byte) of the buffer! 944 * single element (byte) of the buffer!
945 *
946 * Since we are returning the value of the buffer at the
947 * indexed location, we don't need to add an additional
948 * reference to the buffer itself.
949 */ 949 */
950 return_desc = 950 return_desc =
951 acpi_ut_create_internal_object 951 acpi_ut_create_integer_object((u64)
952 (ACPI_TYPE_INTEGER); 952 temp_desc->
953 buffer.
954 pointer
955 [operand
956 [0]->
957 reference.
958 value]);
953 if (!return_desc) { 959 if (!return_desc) {
954 status = AE_NO_MEMORY; 960 status = AE_NO_MEMORY;
955 goto cleanup; 961 goto cleanup;
956 } 962 }
957
958 /*
959 * Since we are returning the value of the buffer at the
960 * indexed location, we don't need to add an additional
961 * reference to the buffer itself.
962 */
963 return_desc->integer.value =
964 temp_desc->buffer.
965 pointer[operand[0]->reference.
966 value];
967 break; 963 break;
968 964
969 case ACPI_TYPE_PACKAGE: 965 case ACPI_TYPE_PACKAGE:
diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c
index 85d95c92dfd3..22841bbbe63c 100644
--- a/drivers/acpi/acpica/exoparg2.c
+++ b/drivers/acpi/acpica/exoparg2.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -282,7 +282,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
282{ 282{
283 union acpi_operand_object **operand = &walk_state->operands[0]; 283 union acpi_operand_object **operand = &walk_state->operands[0];
284 union acpi_operand_object *return_desc = NULL; 284 union acpi_operand_object *return_desc = NULL;
285 acpi_integer index; 285 u64 index;
286 acpi_status status = AE_OK; 286 acpi_status status = AE_OK;
287 acpi_size length; 287 acpi_size length;
288 288
@@ -584,7 +584,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
584 * Default is FALSE (zero) 584 * Default is FALSE (zero)
585 */ 585 */
586 if (logical_result) { 586 if (logical_result) {
587 return_desc->integer.value = ACPI_INTEGER_MAX; 587 return_desc->integer.value = ACPI_UINT64_MAX;
588 } 588 }
589 589
590 cleanup: 590 cleanup:
diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c
index 253f9e122584..8bb1012ef44e 100644
--- a/drivers/acpi/acpica/exoparg3.c
+++ b/drivers/acpi/acpica/exoparg3.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -148,7 +148,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
148 union acpi_operand_object *return_desc = NULL; 148 union acpi_operand_object *return_desc = NULL;
149 char *buffer = NULL; 149 char *buffer = NULL;
150 acpi_status status = AE_OK; 150 acpi_status status = AE_OK;
151 acpi_integer index; 151 u64 index;
152 acpi_size length; 152 acpi_size length;
153 153
154 ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_1T_1R, 154 ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_1T_1R,
diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c
index ae43f7670a6c..f256b6a25f2e 100644
--- a/drivers/acpi/acpica/exoparg6.c
+++ b/drivers/acpi/acpica/exoparg6.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -218,7 +218,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
218 union acpi_operand_object **operand = &walk_state->operands[0]; 218 union acpi_operand_object **operand = &walk_state->operands[0];
219 union acpi_operand_object *return_desc = NULL; 219 union acpi_operand_object *return_desc = NULL;
220 acpi_status status = AE_OK; 220 acpi_status status = AE_OK;
221 acpi_integer index; 221 u64 index;
222 union acpi_operand_object *this_element; 222 union acpi_operand_object *this_element;
223 223
224 ACPI_FUNCTION_TRACE_STR(ex_opcode_6A_0T_1R, 224 ACPI_FUNCTION_TRACE_STR(ex_opcode_6A_0T_1R,
@@ -253,18 +253,15 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
253 } 253 }
254 254
255 /* Create an integer for the return value */ 255 /* Create an integer for the return value */
256 /* Default return value is ACPI_UINT64_MAX if no match found */
256 257
257 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 258 return_desc = acpi_ut_create_integer_object(ACPI_UINT64_MAX);
258 if (!return_desc) { 259 if (!return_desc) {
259 status = AE_NO_MEMORY; 260 status = AE_NO_MEMORY;
260 goto cleanup; 261 goto cleanup;
261 262
262 } 263 }
263 264
264 /* Default return value if no match found */
265
266 return_desc->integer.value = ACPI_INTEGER_MAX;
267
268 /* 265 /*
269 * Examine each element until a match is found. Both match conditions 266 * Examine each element until a match is found. Both match conditions
270 * must be satisfied for a match to occur. Within the loop, 267 * must be satisfied for a match to occur. Within the loop,
@@ -273,7 +270,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
273 * 270 *
274 * Upon finding a match, the loop will terminate via "break" at 271 * Upon finding a match, the loop will terminate via "break" at
275 * the bottom. If it terminates "normally", match_value will be 272 * the bottom. If it terminates "normally", match_value will be
276 * ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no 273 * ACPI_UINT64_MAX (Ones) (its initial value) indicating that no
277 * match was found. 274 * match was found.
278 */ 275 */
279 for (; index < operand[0]->package.count; index++) { 276 for (; index < operand[0]->package.count; index++) {
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c
index 52fec07064f0..2fbfe51fb141 100644
--- a/drivers/acpi/acpica/exprep.c
+++ b/drivers/acpi/acpica/exprep.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -468,6 +468,23 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
468 468
469 acpi_ut_add_reference(obj_desc->field.region_obj); 469 acpi_ut_add_reference(obj_desc->field.region_obj);
470 470
471 /* allow full data read from EC address space */
472 if (obj_desc->field.region_obj->region.space_id ==
473 ACPI_ADR_SPACE_EC) {
474 if (obj_desc->common_field.bit_length > 8) {
475 unsigned width =
476 ACPI_ROUND_BITS_UP_TO_BYTES(
477 obj_desc->common_field.bit_length);
478 // access_bit_width is u8, don't overflow it
479 if (width > 8)
480 width = 8;
481 obj_desc->common_field.access_byte_width =
482 width;
483 obj_desc->common_field.access_bit_width =
484 8 * width;
485 }
486 }
487
471 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 488 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
472 "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", 489 "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n",
473 obj_desc->field.start_field_bit_offset, 490 obj_desc->field.start_field_bit_offset,
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c
index 2bd83ac57c3a..486b2e5661b6 100644
--- a/drivers/acpi/acpica/exregion.c
+++ b/drivers/acpi/acpica/exregion.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -70,7 +70,7 @@ acpi_status
70acpi_ex_system_memory_space_handler(u32 function, 70acpi_ex_system_memory_space_handler(u32 function,
71 acpi_physical_address address, 71 acpi_physical_address address,
72 u32 bit_width, 72 u32 bit_width,
73 acpi_integer * value, 73 u64 *value,
74 void *handler_context, void *region_context) 74 void *handler_context, void *region_context)
75{ 75{
76 acpi_status status = AE_OK; 76 acpi_status status = AE_OK;
@@ -115,8 +115,7 @@ acpi_ex_system_memory_space_handler(u32 function,
115 * Hardware does not support non-aligned data transfers, we must verify 115 * Hardware does not support non-aligned data transfers, we must verify
116 * the request. 116 * the request.
117 */ 117 */
118 (void)acpi_ut_short_divide((acpi_integer) address, length, NULL, 118 (void)acpi_ut_short_divide((u64) address, length, NULL, &remainder);
119 &remainder);
120 if (remainder != 0) { 119 if (remainder != 0) {
121 return_ACPI_STATUS(AE_AML_ALIGNMENT); 120 return_ACPI_STATUS(AE_AML_ALIGNMENT);
122 } 121 }
@@ -128,10 +127,9 @@ acpi_ex_system_memory_space_handler(u32 function,
128 * 2) Address beyond the current mapping? 127 * 2) Address beyond the current mapping?
129 */ 128 */
130 if ((address < mem_info->mapped_physical_address) || 129 if ((address < mem_info->mapped_physical_address) ||
131 (((acpi_integer) address + length) > ((acpi_integer) 130 (((u64) address + length) > ((u64)
132 mem_info-> 131 mem_info->mapped_physical_address +
133 mapped_physical_address + 132 mem_info->mapped_length))) {
134 mem_info->mapped_length))) {
135 /* 133 /*
136 * The request cannot be resolved by the current memory mapping; 134 * The request cannot be resolved by the current memory mapping;
137 * Delete the existing mapping and create a new one. 135 * Delete the existing mapping and create a new one.
@@ -193,8 +191,7 @@ acpi_ex_system_memory_space_handler(u32 function,
193 * access 191 * access
194 */ 192 */
195 logical_addr_ptr = mem_info->mapped_logical_address + 193 logical_addr_ptr = mem_info->mapped_logical_address +
196 ((acpi_integer) address - 194 ((u64) address - (u64) mem_info->mapped_physical_address);
197 (acpi_integer) mem_info->mapped_physical_address);
198 195
199 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 196 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
200 "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", 197 "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n",
@@ -215,19 +212,19 @@ acpi_ex_system_memory_space_handler(u32 function,
215 *value = 0; 212 *value = 0;
216 switch (bit_width) { 213 switch (bit_width) {
217 case 8: 214 case 8:
218 *value = (acpi_integer) ACPI_GET8(logical_addr_ptr); 215 *value = (u64) ACPI_GET8(logical_addr_ptr);
219 break; 216 break;
220 217
221 case 16: 218 case 16:
222 *value = (acpi_integer) ACPI_GET16(logical_addr_ptr); 219 *value = (u64) ACPI_GET16(logical_addr_ptr);
223 break; 220 break;
224 221
225 case 32: 222 case 32:
226 *value = (acpi_integer) ACPI_GET32(logical_addr_ptr); 223 *value = (u64) ACPI_GET32(logical_addr_ptr);
227 break; 224 break;
228 225
229 case 64: 226 case 64:
230 *value = (acpi_integer) ACPI_GET64(logical_addr_ptr); 227 *value = (u64) ACPI_GET64(logical_addr_ptr);
231 break; 228 break;
232 229
233 default: 230 default:
@@ -291,7 +288,7 @@ acpi_status
291acpi_ex_system_io_space_handler(u32 function, 288acpi_ex_system_io_space_handler(u32 function,
292 acpi_physical_address address, 289 acpi_physical_address address,
293 u32 bit_width, 290 u32 bit_width,
294 acpi_integer * value, 291 u64 *value,
295 void *handler_context, void *region_context) 292 void *handler_context, void *region_context)
296{ 293{
297 acpi_status status = AE_OK; 294 acpi_status status = AE_OK;
@@ -350,7 +347,7 @@ acpi_status
350acpi_ex_pci_config_space_handler(u32 function, 347acpi_ex_pci_config_space_handler(u32 function,
351 acpi_physical_address address, 348 acpi_physical_address address,
352 u32 bit_width, 349 u32 bit_width,
353 acpi_integer * value, 350 u64 *value,
354 void *handler_context, void *region_context) 351 void *handler_context, void *region_context)
355{ 352{
356 acpi_status status = AE_OK; 353 acpi_status status = AE_OK;
@@ -425,7 +422,7 @@ acpi_status
425acpi_ex_cmos_space_handler(u32 function, 422acpi_ex_cmos_space_handler(u32 function,
426 acpi_physical_address address, 423 acpi_physical_address address,
427 u32 bit_width, 424 u32 bit_width,
428 acpi_integer * value, 425 u64 *value,
429 void *handler_context, void *region_context) 426 void *handler_context, void *region_context)
430{ 427{
431 acpi_status status = AE_OK; 428 acpi_status status = AE_OK;
@@ -457,7 +454,7 @@ acpi_status
457acpi_ex_pci_bar_space_handler(u32 function, 454acpi_ex_pci_bar_space_handler(u32 function,
458 acpi_physical_address address, 455 acpi_physical_address address,
459 u32 bit_width, 456 u32 bit_width,
460 acpi_integer * value, 457 u64 *value,
461 void *handler_context, void *region_context) 458 void *handler_context, void *region_context)
462{ 459{
463 acpi_status status = AE_OK; 460 acpi_status status = AE_OK;
@@ -489,7 +486,7 @@ acpi_status
489acpi_ex_data_table_space_handler(u32 function, 486acpi_ex_data_table_space_handler(u32 function,
490 acpi_physical_address address, 487 acpi_physical_address address,
491 u32 bit_width, 488 u32 bit_width,
492 acpi_integer * value, 489 u64 *value,
493 void *handler_context, void *region_context) 490 void *handler_context, void *region_context)
494{ 491{
495 ACPI_FUNCTION_TRACE(ex_data_table_space_handler); 492 ACPI_FUNCTION_TRACE(ex_data_table_space_handler);
diff --git a/drivers/acpi/acpica/exresnte.c b/drivers/acpi/acpica/exresnte.c
index 607958ff467c..fdc1b27999ef 100644
--- a/drivers/acpi/acpica/exresnte.c
+++ b/drivers/acpi/acpica/exresnte.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c
index c93b54ce7f78..fdd6a7079b97 100644
--- a/drivers/acpi/acpica/exresolv.c
+++ b/drivers/acpi/acpica/exresolv.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c
index 5c729a9e9131..c5ecd615f145 100644
--- a/drivers/acpi/acpica/exresop.c
+++ b/drivers/acpi/acpica/exresop.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c
index 6efd07a4f779..702b9ecfd44b 100644
--- a/drivers/acpi/acpica/exstore.c
+++ b/drivers/acpi/acpica/exstore.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exstoren.c b/drivers/acpi/acpica/exstoren.c
index 608e838d537e..d4af684620ca 100644
--- a/drivers/acpi/acpica/exstoren.c
+++ b/drivers/acpi/acpica/exstoren.c
@@ -7,7 +7,7 @@
7 *****************************************************************************/ 7 *****************************************************************************/
8 8
9/* 9/*
10 * Copyright (C) 2000 - 2008, Intel Corp. 10 * Copyright (C) 2000 - 2010, Intel Corp.
11 * All rights reserved. 11 * All rights reserved.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exstorob.c b/drivers/acpi/acpica/exstorob.c
index 257706e7734f..e972b667b09b 100644
--- a/drivers/acpi/acpica/exstorob.c
+++ b/drivers/acpi/acpica/exstorob.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c
index 3d00b9357233..e11b6cb42a57 100644
--- a/drivers/acpi/acpica/exsystem.c
+++ b/drivers/acpi/acpica/exsystem.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -193,7 +193,7 @@ acpi_status acpi_ex_system_do_stall(u32 how_long)
193 * 193 *
194 ******************************************************************************/ 194 ******************************************************************************/
195 195
196acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) 196acpi_status acpi_ex_system_do_suspend(u64 how_long)
197{ 197{
198 ACPI_FUNCTION_ENTRY(); 198 ACPI_FUNCTION_ENTRY();
199 199
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index 7d41f99f7052..74c24d517f81 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -67,7 +67,7 @@
67ACPI_MODULE_NAME("exutils") 67ACPI_MODULE_NAME("exutils")
68 68
69/* Local prototypes */ 69/* Local prototypes */
70static u32 acpi_ex_digits_needed(acpi_integer value, u32 base); 70static u32 acpi_ex_digits_needed(u64 value, u32 base);
71 71
72#ifndef ACPI_NO_METHOD_EXECUTION 72#ifndef ACPI_NO_METHOD_EXECUTION
73/******************************************************************************* 73/*******************************************************************************
@@ -230,7 +230,7 @@ void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc)
230 * We are running a method that exists in a 32-bit ACPI table. 230 * We are running a method that exists in a 32-bit ACPI table.
231 * Truncate the value to 32 bits by zeroing out the upper 32-bit field 231 * Truncate the value to 32 bits by zeroing out the upper 32-bit field
232 */ 232 */
233 obj_desc->integer.value &= (acpi_integer) ACPI_UINT32_MAX; 233 obj_desc->integer.value &= (u64) ACPI_UINT32_MAX;
234 } 234 }
235} 235}
236 236
@@ -327,14 +327,14 @@ void acpi_ex_release_global_lock(u32 field_flags)
327 * 327 *
328 ******************************************************************************/ 328 ******************************************************************************/
329 329
330static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) 330static u32 acpi_ex_digits_needed(u64 value, u32 base)
331{ 331{
332 u32 num_digits; 332 u32 num_digits;
333 acpi_integer current_value; 333 u64 current_value;
334 334
335 ACPI_FUNCTION_TRACE(ex_digits_needed); 335 ACPI_FUNCTION_TRACE(ex_digits_needed);
336 336
337 /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ 337 /* u64 is unsigned, so we don't worry about a '-' prefix */
338 338
339 if (value == 0) { 339 if (value == 0) {
340 return_UINT32(1); 340 return_UINT32(1);
@@ -370,7 +370,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
370 * 370 *
371 ******************************************************************************/ 371 ******************************************************************************/
372 372
373void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id) 373void acpi_ex_eisa_id_to_string(char *out_string, u64 compressed_id)
374{ 374{
375 u32 swapped_id; 375 u32 swapped_id;
376 376
@@ -394,10 +394,10 @@ void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id)
394 (char)(0x40 + (((unsigned long)swapped_id >> 26) & 0x1F)); 394 (char)(0x40 + (((unsigned long)swapped_id >> 26) & 0x1F));
395 out_string[1] = (char)(0x40 + ((swapped_id >> 21) & 0x1F)); 395 out_string[1] = (char)(0x40 + ((swapped_id >> 21) & 0x1F));
396 out_string[2] = (char)(0x40 + ((swapped_id >> 16) & 0x1F)); 396 out_string[2] = (char)(0x40 + ((swapped_id >> 16) & 0x1F));
397 out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 12); 397 out_string[3] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 12);
398 out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 8); 398 out_string[4] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 8);
399 out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 4); 399 out_string[5] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 4);
400 out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 0); 400 out_string[6] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 0);
401 out_string[7] = 0; 401 out_string[7] = 0;
402} 402}
403 403
@@ -418,7 +418,7 @@ void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id)
418 * 418 *
419 ******************************************************************************/ 419 ******************************************************************************/
420 420
421void acpi_ex_integer_to_string(char *out_string, acpi_integer value) 421void acpi_ex_integer_to_string(char *out_string, u64 value)
422{ 422{
423 u32 count; 423 u32 count;
424 u32 digits_needed; 424 u32 digits_needed;
diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c
index 9af361a191e7..679a112a7d26 100644
--- a/drivers/acpi/acpica/hwacpi.c
+++ b/drivers/acpi/acpica/hwacpi.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c
index c28c41b3180b..bd72319a38f0 100644
--- a/drivers/acpi/acpica/hwgpe.c
+++ b/drivers/acpi/acpica/hwgpe.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -224,7 +224,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
224 224
225 status = acpi_hw_read(&in_byte, &gpe_register_info->status_address); 225 status = acpi_hw_read(&in_byte, &gpe_register_info->status_address);
226 if (ACPI_FAILURE(status)) { 226 if (ACPI_FAILURE(status)) {
227 goto unlock_and_exit; 227 return (status);
228 } 228 }
229 229
230 if (register_bit & in_byte) { 230 if (register_bit & in_byte) {
@@ -234,9 +234,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
234 /* Set return value */ 234 /* Set return value */
235 235
236 (*event_status) = local_event_status; 236 (*event_status) = local_event_status;
237 237 return (AE_OK);
238 unlock_and_exit:
239 return (status);
240} 238}
241 239
242/****************************************************************************** 240/******************************************************************************
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index 15c9ed2be853..ec7fc227b33f 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -7,7 +7,7 @@
7 ******************************************************************************/ 7 ******************************************************************************/
8 8
9/* 9/*
10 * Copyright (C) 2000 - 2008, Intel Corp. 10 * Copyright (C) 2000 - 2010, Intel Corp.
11 * All rights reserved. 11 * All rights reserved.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index cc22f9a585b0..5e6d4dbb8024 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c
index 6b282e85d039..1ef8e0bb250b 100644
--- a/drivers/acpi/acpica/hwtimer.c
+++ b/drivers/acpi/acpica/hwtimer.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -140,7 +140,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
140{ 140{
141 acpi_status status; 141 acpi_status status;
142 u32 delta_ticks; 142 u32 delta_ticks;
143 acpi_integer quotient; 143 u64 quotient;
144 144
145 ACPI_FUNCTION_TRACE(acpi_get_timer_duration); 145 ACPI_FUNCTION_TRACE(acpi_get_timer_duration);
146 146
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c
index ec33f270c5b7..e26c17d4b716 100644
--- a/drivers/acpi/acpica/hwvalid.c
+++ b/drivers/acpi/acpica/hwvalid.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2009, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index 647c7b6e6756..50cc3be77724 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c
index 9c3cdbe2d82a..aa2b80132d0a 100644
--- a/drivers/acpi/acpica/nsaccess.c
+++ b/drivers/acpi/acpica/nsaccess.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -165,7 +165,7 @@ acpi_status acpi_ns_root_initialize(void)
165 165
166 obj_desc->method.method_flags = 166 obj_desc->method.method_flags =
167 AML_METHOD_INTERNAL_ONLY; 167 AML_METHOD_INTERNAL_ONLY;
168 obj_desc->method.implementation = 168 obj_desc->method.extra.implementation =
169 acpi_ut_osi_implementation; 169 acpi_ut_osi_implementation;
170#endif 170#endif
171 break; 171 break;
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c
index 8a58a1b85aa0..982269c1fa48 100644
--- a/drivers/acpi/acpica/nsalloc.c
+++ b/drivers/acpi/acpica/nsalloc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c
index 2bad613db73a..0689d36638d9 100644
--- a/drivers/acpi/acpica/nsdump.c
+++ b/drivers/acpi/acpica/nsdump.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -180,7 +180,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
180 return (AE_OK); 180 return (AE_OK);
181 } 181 }
182 182
183 this_node = acpi_ns_map_handle_to_node(obj_handle); 183 this_node = acpi_ns_validate_handle(obj_handle);
184 if (!this_node) { 184 if (!this_node) {
185 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid object handle %p\n", 185 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid object handle %p\n",
186 obj_handle)); 186 obj_handle));
@@ -634,8 +634,8 @@ acpi_ns_dump_objects(acpi_object_type type,
634 (void)acpi_ns_walk_namespace(type, start_handle, max_depth, 634 (void)acpi_ns_walk_namespace(type, start_handle, max_depth,
635 ACPI_NS_WALK_NO_UNLOCK | 635 ACPI_NS_WALK_NO_UNLOCK |
636 ACPI_NS_WALK_TEMP_NODES, 636 ACPI_NS_WALK_TEMP_NODES,
637 acpi_ns_dump_one_object, (void *)&info, 637 acpi_ns_dump_one_object, NULL,
638 NULL); 638 (void *)&info, NULL);
639} 639}
640#endif /* ACPI_FUTURE_USAGE */ 640#endif /* ACPI_FUTURE_USAGE */
641 641
diff --git a/drivers/acpi/acpica/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c
index 0fe87f1aef16..d2a97921e249 100644
--- a/drivers/acpi/acpica/nsdumpdv.c
+++ b/drivers/acpi/acpica/nsdumpdv.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -131,7 +131,8 @@ void acpi_ns_dump_root_devices(void)
131 131
132 status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, sys_bus_handle, 132 status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, sys_bus_handle,
133 ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, 133 ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
134 acpi_ns_dump_one_device, NULL, NULL); 134 acpi_ns_dump_one_device, NULL, NULL,
135 NULL);
135} 136}
136 137
137#endif 138#endif
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c
index 846d1132feb1..f52829cc294b 100644
--- a/drivers/acpi/acpica/nseval.c
+++ b/drivers/acpi/acpica/nseval.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -366,50 +366,88 @@ static void
366acpi_ns_exec_module_code(union acpi_operand_object *method_obj, 366acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
367 struct acpi_evaluate_info *info) 367 struct acpi_evaluate_info *info)
368{ 368{
369 union acpi_operand_object *root_obj; 369 union acpi_operand_object *parent_obj;
370 struct acpi_namespace_node *parent_node;
371 acpi_object_type type;
370 acpi_status status; 372 acpi_status status;
371 373
372 ACPI_FUNCTION_TRACE(ns_exec_module_code); 374 ACPI_FUNCTION_TRACE(ns_exec_module_code);
373 375
376 /*
377 * Get the parent node. We cheat by using the next_object field
378 * of the method object descriptor.
379 */
380 parent_node = ACPI_CAST_PTR(struct acpi_namespace_node,
381 method_obj->method.next_object);
382 type = acpi_ns_get_type(parent_node);
383
384 /*
385 * Get the region handler and save it in the method object. We may need
386 * this if an operation region declaration causes a _REG method to be run.
387 *
388 * We can't do this in acpi_ps_link_module_code because
389 * acpi_gbl_root_node->Object is NULL at PASS1.
390 */
391 if ((type == ACPI_TYPE_DEVICE) && parent_node->object) {
392 method_obj->method.extra.handler =
393 parent_node->object->device.handler;
394 }
395
396 /* Must clear next_object (acpi_ns_attach_object needs the field) */
397
398 method_obj->method.next_object = NULL;
399
374 /* Initialize the evaluation information block */ 400 /* Initialize the evaluation information block */
375 401
376 ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info)); 402 ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info));
377 info->prefix_node = acpi_gbl_root_node; 403 info->prefix_node = parent_node;
378 404
379 /* 405 /*
380 * Get the currently attached root object. Add a reference, because the 406 * Get the currently attached parent object. Add a reference, because the
381 * ref count will be decreased when the method object is installed to 407 * ref count will be decreased when the method object is installed to
382 * the root node. 408 * the parent node.
383 */ 409 */
384 root_obj = acpi_ns_get_attached_object(acpi_gbl_root_node); 410 parent_obj = acpi_ns_get_attached_object(parent_node);
385 acpi_ut_add_reference(root_obj); 411 if (parent_obj) {
412 acpi_ut_add_reference(parent_obj);
413 }
386 414
387 /* Install the method (module-level code) in the root node */ 415 /* Install the method (module-level code) in the parent node */
388 416
389 status = acpi_ns_attach_object(acpi_gbl_root_node, method_obj, 417 status = acpi_ns_attach_object(parent_node, method_obj,
390 ACPI_TYPE_METHOD); 418 ACPI_TYPE_METHOD);
391 if (ACPI_FAILURE(status)) { 419 if (ACPI_FAILURE(status)) {
392 goto exit; 420 goto exit;
393 } 421 }
394 422
395 /* Execute the root node as a control method */ 423 /* Execute the parent node as a control method */
396 424
397 status = acpi_ns_evaluate(info); 425 status = acpi_ns_evaluate(info);
398 426
399 ACPI_DEBUG_PRINT((ACPI_DB_INIT, "Executed module-level code at %p\n", 427 ACPI_DEBUG_PRINT((ACPI_DB_INIT, "Executed module-level code at %p\n",
400 method_obj->method.aml_start)); 428 method_obj->method.aml_start));
401 429
430 /* Delete a possible implicit return value (in slack mode) */
431
432 if (info->return_object) {
433 acpi_ut_remove_reference(info->return_object);
434 }
435
402 /* Detach the temporary method object */ 436 /* Detach the temporary method object */
403 437
404 acpi_ns_detach_object(acpi_gbl_root_node); 438 acpi_ns_detach_object(parent_node);
405 439
406 /* Restore the original root object */ 440 /* Restore the original parent object */
407 441
408 status = 442 if (parent_obj) {
409 acpi_ns_attach_object(acpi_gbl_root_node, root_obj, 443 status = acpi_ns_attach_object(parent_node, parent_obj, type);
410 ACPI_TYPE_DEVICE); 444 } else {
445 parent_node->type = (u8)type;
446 }
411 447
412 exit: 448 exit:
413 acpi_ut_remove_reference(root_obj); 449 if (parent_obj) {
450 acpi_ut_remove_reference(parent_obj);
451 }
414 return_VOID; 452 return_VOID;
415} 453}
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index 1d5b360eb25b..9bd6f050f299 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -96,7 +96,7 @@ acpi_status acpi_ns_initialize_objects(void)
96 /* Walk entire namespace from the supplied root */ 96 /* Walk entire namespace from the supplied root */
97 97
98 status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, 98 status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
99 ACPI_UINT32_MAX, acpi_ns_init_one_object, 99 ACPI_UINT32_MAX, acpi_ns_init_one_object, NULL,
100 &info, NULL); 100 &info, NULL);
101 if (ACPI_FAILURE(status)) { 101 if (ACPI_FAILURE(status)) {
102 ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); 102 ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace"));
@@ -156,7 +156,8 @@ acpi_status acpi_ns_initialize_devices(void)
156 156
157 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, 157 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
158 ACPI_UINT32_MAX, FALSE, 158 ACPI_UINT32_MAX, FALSE,
159 acpi_ns_find_ini_methods, &info, NULL); 159 acpi_ns_find_ini_methods, NULL, &info,
160 NULL);
160 if (ACPI_FAILURE(status)) { 161 if (ACPI_FAILURE(status)) {
161 goto error_exit; 162 goto error_exit;
162 } 163 }
@@ -189,7 +190,8 @@ acpi_status acpi_ns_initialize_devices(void)
189 190
190 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, 191 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
191 ACPI_UINT32_MAX, FALSE, 192 ACPI_UINT32_MAX, FALSE,
192 acpi_ns_init_one_device, &info, NULL); 193 acpi_ns_init_one_device, NULL, &info,
194 NULL);
193 195
194 ACPI_FREE(info.evaluate_info); 196 ACPI_FREE(info.evaluate_info);
195 if (ACPI_FAILURE(status)) { 197 if (ACPI_FAILURE(status)) {
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c
index a7234e60e985..df18be94fefe 100644
--- a/drivers/acpi/acpica/nsload.c
+++ b/drivers/acpi/acpica/nsload.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c
index af8e6bcee07e..959372451635 100644
--- a/drivers/acpi/acpica/nsnames.c
+++ b/drivers/acpi/acpica/nsnames.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -232,7 +232,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle,
232 232
233 ACPI_FUNCTION_TRACE_PTR(ns_handle_to_pathname, target_handle); 233 ACPI_FUNCTION_TRACE_PTR(ns_handle_to_pathname, target_handle);
234 234
235 node = acpi_ns_map_handle_to_node(target_handle); 235 node = acpi_ns_validate_handle(target_handle);
236 if (!node) { 236 if (!node) {
237 return_ACPI_STATUS(AE_BAD_PARAMETER); 237 return_ACPI_STATUS(AE_BAD_PARAMETER);
238 } 238 }
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c
index 60f3af08d28c..41a9213dd5af 100644
--- a/drivers/acpi/acpica/nsobject.c
+++ b/drivers/acpi/acpica/nsobject.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c
index 662a4bd5b621..27cda52c76bc 100644
--- a/drivers/acpi/acpica/nsparse.c
+++ b/drivers/acpi/acpica/nsparse.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index f8427afeebdf..7096bcda0c72 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -216,23 +216,39 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
216 data->pathname = pathname; 216 data->pathname = pathname;
217 217
218 /* 218 /*
219 * Check that the type of the return object is what is expected for 219 * Check that the type of the main return object is what is expected
220 * this predefined name 220 * for this predefined name
221 */ 221 */
222 status = acpi_ns_check_object_type(data, return_object_ptr, 222 status = acpi_ns_check_object_type(data, return_object_ptr,
223 predefined->info.expected_btypes, 223 predefined->info.expected_btypes,
224 ACPI_NOT_PACKAGE_ELEMENT); 224 ACPI_NOT_PACKAGE_ELEMENT);
225 if (ACPI_FAILURE(status)) { 225 if (ACPI_FAILURE(status)) {
226 goto check_validation_status; 226 goto exit;
227 } 227 }
228 228
229 /* For returned Package objects, check the type of all sub-objects */ 229 /*
230 230 * For returned Package objects, check the type of all sub-objects.
231 if (return_object->common.type == ACPI_TYPE_PACKAGE) { 231 * Note: Package may have been newly created by call above.
232 */
233 if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) {
234 data->parent_package = *return_object_ptr;
232 status = acpi_ns_check_package(data, return_object_ptr); 235 status = acpi_ns_check_package(data, return_object_ptr);
236 if (ACPI_FAILURE(status)) {
237 goto exit;
238 }
233 } 239 }
234 240
235check_validation_status: 241 /*
242 * The return object was OK, or it was successfully repaired above.
243 * Now make some additional checks such as verifying that package
244 * objects are sorted correctly (if required) or buffer objects have
245 * the correct data width (bytes vs. dwords). These repairs are
246 * performed on a per-name basis, i.e., the code is specific to
247 * particular predefined names.
248 */
249 status = acpi_ns_complex_repairs(data, node, status, return_object_ptr);
250
251exit:
236 /* 252 /*
237 * If the object validation failed or if we successfully repaired one 253 * If the object validation failed or if we successfully repaired one
238 * or more objects, mark the parent node to suppress further warning 254 * or more objects, mark the parent node to suppress further warning
@@ -421,6 +437,13 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
421 data->pathname, package->ret_info.type, 437 data->pathname, package->ret_info.type,
422 return_object->package.count)); 438 return_object->package.count));
423 439
440 /*
441 * For variable-length Packages, we can safely remove all embedded
442 * and trailing NULL package elements
443 */
444 acpi_ns_remove_null_elements(data, package->ret_info.type,
445 return_object);
446
424 /* Extract package count and elements array */ 447 /* Extract package count and elements array */
425 448
426 elements = return_object->package.elements; 449 elements = return_object->package.elements;
@@ -455,11 +478,11 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
455 if (count < expected_count) { 478 if (count < expected_count) {
456 goto package_too_small; 479 goto package_too_small;
457 } else if (count > expected_count) { 480 } else if (count > expected_count) {
458 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, 481 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
459 data->node_flags, 482 "%s: Return Package is larger than needed - "
460 "Return Package is larger than needed - " 483 "found %u, expected %u\n",
461 "found %u, expected %u", count, 484 data->pathname, count,
462 expected_count)); 485 expected_count));
463 } 486 }
464 487
465 /* Validate all elements of the returned package */ 488 /* Validate all elements of the returned package */
@@ -601,7 +624,8 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
601 * there is only one entry). We may be able to repair this by 624 * there is only one entry). We may be able to repair this by
602 * wrapping the returned Package with a new outer Package. 625 * wrapping the returned Package with a new outer Package.
603 */ 626 */
604 if ((*elements)->common.type != ACPI_TYPE_PACKAGE) { 627 if (*elements
628 && ((*elements)->common.type != ACPI_TYPE_PACKAGE)) {
605 629
606 /* Create the new outer package and populate it */ 630 /* Create the new outer package and populate it */
607 631
@@ -677,11 +701,17 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
677 u32 i; 701 u32 i;
678 u32 j; 702 u32 j;
679 703
680 /* Validate each sub-Package in the parent Package */ 704 /*
681 705 * Validate each sub-Package in the parent Package
706 *
707 * NOTE: assumes list of sub-packages contains no NULL elements.
708 * Any NULL elements should have been removed by earlier call
709 * to acpi_ns_remove_null_elements.
710 */
682 for (i = 0; i < count; i++) { 711 for (i = 0; i < count; i++) {
683 sub_package = *elements; 712 sub_package = *elements;
684 sub_elements = sub_package->package.elements; 713 sub_elements = sub_package->package.elements;
714 data->parent_package = sub_package;
685 715
686 /* Each sub-object must be of type Package */ 716 /* Each sub-object must be of type Package */
687 717
@@ -693,6 +723,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
693 723
694 /* Examine the different types of expected sub-packages */ 724 /* Examine the different types of expected sub-packages */
695 725
726 data->parent_package = sub_package;
696 switch (package->ret_info.type) { 727 switch (package->ret_info.type) {
697 case ACPI_PTYPE2: 728 case ACPI_PTYPE2:
698 case ACPI_PTYPE2_PKG_COUNT: 729 case ACPI_PTYPE2_PKG_COUNT:
@@ -772,7 +803,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
772 803
773 /* 804 /*
774 * First element is the (Integer) count of elements, including 805 * First element is the (Integer) count of elements, including
775 * the count field. 806 * the count field (the ACPI name is num_elements)
776 */ 807 */
777 status = acpi_ns_check_object_type(data, sub_elements, 808 status = acpi_ns_check_object_type(data, sub_elements,
778 ACPI_RTYPE_INTEGER, 809 ACPI_RTYPE_INTEGER,
@@ -794,6 +825,16 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
794 expected_count = package->ret_info.count1; 825 expected_count = package->ret_info.count1;
795 goto package_too_small; 826 goto package_too_small;
796 } 827 }
828 if (expected_count == 0) {
829 /*
830 * Either the num_entries element was originally zero or it was
831 * a NULL element and repaired to an Integer of value zero.
832 * In either case, repair it by setting num_entries to be the
833 * actual size of the subpackage.
834 */
835 expected_count = sub_package->package.count;
836 (*sub_elements)->integer.value = expected_count;
837 }
797 838
798 /* Check the type of each sub-package element */ 839 /* Check the type of each sub-package element */
799 840
@@ -917,10 +958,18 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
917 char type_buffer[48]; /* Room for 5 types */ 958 char type_buffer[48]; /* Room for 5 types */
918 959
919 /* 960 /*
920 * If we get a NULL return_object here, it is a NULL package element, 961 * If we get a NULL return_object here, it is a NULL package element.
921 * and this is always an error. 962 * Since all extraneous NULL package elements were removed earlier by a
963 * call to acpi_ns_remove_null_elements, this is an unexpected NULL element.
964 * We will attempt to repair it.
922 */ 965 */
923 if (!return_object) { 966 if (!return_object) {
967 status = acpi_ns_repair_null_element(data, expected_btypes,
968 package_index,
969 return_object_ptr);
970 if (ACPI_SUCCESS(status)) {
971 return (AE_OK); /* Repair was successful */
972 }
924 goto type_error_exit; 973 goto type_error_exit;
925 } 974 }
926 975
@@ -972,27 +1021,25 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
972 1021
973 /* Is the object one of the expected types? */ 1022 /* Is the object one of the expected types? */
974 1023
975 if (!(return_btype & expected_btypes)) { 1024 if (return_btype & expected_btypes) {
976 1025
977 /* Type mismatch -- attempt repair of the returned object */ 1026 /* For reference objects, check that the reference type is correct */
978 1027
979 status = acpi_ns_repair_object(data, expected_btypes, 1028 if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) {
980 package_index, 1029 status = acpi_ns_check_reference(data, return_object);
981 return_object_ptr);
982 if (ACPI_SUCCESS(status)) {
983 return (AE_OK); /* Repair was successful */
984 } 1030 }
985 goto type_error_exit; 1031
1032 return (status);
986 } 1033 }
987 1034
988 /* For reference objects, check that the reference type is correct */ 1035 /* Type mismatch -- attempt repair of the returned object */
989 1036
990 if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) { 1037 status = acpi_ns_repair_object(data, expected_btypes,
991 status = acpi_ns_check_reference(data, return_object); 1038 package_index, return_object_ptr);
1039 if (ACPI_SUCCESS(status)) {
1040 return (AE_OK); /* Repair was successful */
992 } 1041 }
993 1042
994 return (status);
995
996 type_error_exit: 1043 type_error_exit:
997 1044
998 /* Create a string with all expected types for this predefined object */ 1045 /* Create a string with all expected types for this predefined object */
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c
index db2b2a99c3a8..d4be37751be4 100644
--- a/drivers/acpi/acpica/nsrepair.c
+++ b/drivers/acpi/acpica/nsrepair.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2009, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,7 @@
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include "accommon.h" 45#include "accommon.h"
46#include "acnamesp.h" 46#include "acnamesp.h"
47#include "acinterp.h"
47#include "acpredef.h" 48#include "acpredef.h"
48 49
49#define _COMPONENT ACPI_NAMESPACE 50#define _COMPONENT ACPI_NAMESPACE
@@ -51,6 +52,52 @@ ACPI_MODULE_NAME("nsrepair")
51 52
52/******************************************************************************* 53/*******************************************************************************
53 * 54 *
55 * This module attempts to repair or convert objects returned by the
56 * predefined methods to an object type that is expected, as per the ACPI
57 * specification. The need for this code is dictated by the many machines that
58 * return incorrect types for the standard predefined methods. Performing these
59 * conversions here, in one place, eliminates the need for individual ACPI
60 * device drivers to do the same. Note: Most of these conversions are different
61 * than the internal object conversion routines used for implicit object
62 * conversion.
63 *
64 * The following conversions can be performed as necessary:
65 *
66 * Integer -> String
67 * Integer -> Buffer
68 * String -> Integer
69 * String -> Buffer
70 * Buffer -> Integer
71 * Buffer -> String
72 * Buffer -> Package of Integers
73 * Package -> Package of one Package
74 *
75 * Additional possible repairs:
76 *
77 * Optional/unnecessary NULL package elements removed
78 * Required package elements that are NULL replaced by Integer/String/Buffer
79 * Incorrect standalone package wrapped with required outer package
80 *
81 ******************************************************************************/
82/* Local prototypes */
83static acpi_status
84acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
85 union acpi_operand_object **return_object);
86
87static acpi_status
88acpi_ns_convert_to_string(union acpi_operand_object *original_object,
89 union acpi_operand_object **return_object);
90
91static acpi_status
92acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
93 union acpi_operand_object **return_object);
94
95static acpi_status
96acpi_ns_convert_to_package(union acpi_operand_object *original_object,
97 union acpi_operand_object **return_object);
98
99/*******************************************************************************
100 *
54 * FUNCTION: acpi_ns_repair_object 101 * FUNCTION: acpi_ns_repair_object
55 * 102 *
56 * PARAMETERS: Data - Pointer to validation data structure 103 * PARAMETERS: Data - Pointer to validation data structure
@@ -67,6 +114,7 @@ ACPI_MODULE_NAME("nsrepair")
67 * not expected. 114 * not expected.
68 * 115 *
69 ******************************************************************************/ 116 ******************************************************************************/
117
70acpi_status 118acpi_status
71acpi_ns_repair_object(struct acpi_predefined_data *data, 119acpi_ns_repair_object(struct acpi_predefined_data *data,
72 u32 expected_btypes, 120 u32 expected_btypes,
@@ -75,26 +123,206 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,
75{ 123{
76 union acpi_operand_object *return_object = *return_object_ptr; 124 union acpi_operand_object *return_object = *return_object_ptr;
77 union acpi_operand_object *new_object; 125 union acpi_operand_object *new_object;
78 acpi_size length; 126 acpi_status status;
127
128 ACPI_FUNCTION_NAME(ns_repair_object);
129
130 /*
131 * At this point, we know that the type of the returned object was not
132 * one of the expected types for this predefined name. Attempt to
133 * repair the object by converting it to one of the expected object
134 * types for this predefined name.
135 */
136 if (expected_btypes & ACPI_RTYPE_INTEGER) {
137 status = acpi_ns_convert_to_integer(return_object, &new_object);
138 if (ACPI_SUCCESS(status)) {
139 goto object_repaired;
140 }
141 }
142 if (expected_btypes & ACPI_RTYPE_STRING) {
143 status = acpi_ns_convert_to_string(return_object, &new_object);
144 if (ACPI_SUCCESS(status)) {
145 goto object_repaired;
146 }
147 }
148 if (expected_btypes & ACPI_RTYPE_BUFFER) {
149 status = acpi_ns_convert_to_buffer(return_object, &new_object);
150 if (ACPI_SUCCESS(status)) {
151 goto object_repaired;
152 }
153 }
154 if (expected_btypes & ACPI_RTYPE_PACKAGE) {
155 status = acpi_ns_convert_to_package(return_object, &new_object);
156 if (ACPI_SUCCESS(status)) {
157 goto object_repaired;
158 }
159 }
160
161 /* We cannot repair this object */
162
163 return (AE_AML_OPERAND_TYPE);
164
165 object_repaired:
166
167 /* Object was successfully repaired */
168
169 /*
170 * If the original object is a package element, we need to:
171 * 1. Set the reference count of the new object to match the
172 * reference count of the old object.
173 * 2. Decrement the reference count of the original object.
174 */
175 if (package_index != ACPI_NOT_PACKAGE_ELEMENT) {
176 new_object->common.reference_count =
177 return_object->common.reference_count;
178
179 if (return_object->common.reference_count > 1) {
180 return_object->common.reference_count--;
181 }
182
183 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
184 "%s: Converted %s to expected %s at index %u\n",
185 data->pathname,
186 acpi_ut_get_object_type_name(return_object),
187 acpi_ut_get_object_type_name(new_object),
188 package_index));
189 } else {
190 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
191 "%s: Converted %s to expected %s\n",
192 data->pathname,
193 acpi_ut_get_object_type_name(return_object),
194 acpi_ut_get_object_type_name(new_object)));
195 }
196
197 /* Delete old object, install the new return object */
198
199 acpi_ut_remove_reference(return_object);
200 *return_object_ptr = new_object;
201 data->flags |= ACPI_OBJECT_REPAIRED;
202 return (AE_OK);
203}
204
205/*******************************************************************************
206 *
207 * FUNCTION: acpi_ns_convert_to_integer
208 *
209 * PARAMETERS: original_object - Object to be converted
210 * return_object - Where the new converted object is returned
211 *
212 * RETURN: Status. AE_OK if conversion was successful.
213 *
214 * DESCRIPTION: Attempt to convert a String/Buffer object to an Integer.
215 *
216 ******************************************************************************/
217
218static acpi_status
219acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
220 union acpi_operand_object **return_object)
221{
222 union acpi_operand_object *new_object;
223 acpi_status status;
224 u64 value = 0;
225 u32 i;
226
227 switch (original_object->common.type) {
228 case ACPI_TYPE_STRING:
229
230 /* String-to-Integer conversion */
231
232 status = acpi_ut_strtoul64(original_object->string.pointer,
233 ACPI_ANY_BASE, &value);
234 if (ACPI_FAILURE(status)) {
235 return (status);
236 }
237 break;
79 238
80 switch (return_object->common.type) {
81 case ACPI_TYPE_BUFFER: 239 case ACPI_TYPE_BUFFER:
82 240
83 /* Does the method/object legally return a string? */ 241 /* Buffer-to-Integer conversion. Max buffer size is 64 bits. */
84 242
85 if (!(expected_btypes & ACPI_RTYPE_STRING)) { 243 if (original_object->buffer.length > 8) {
86 return (AE_AML_OPERAND_TYPE); 244 return (AE_AML_OPERAND_TYPE);
87 } 245 }
88 246
247 /* Extract each buffer byte to create the integer */
248
249 for (i = 0; i < original_object->buffer.length; i++) {
250 value |=
251 ((u64) original_object->buffer.
252 pointer[i] << (i * 8));
253 }
254 break;
255
256 default:
257 return (AE_AML_OPERAND_TYPE);
258 }
259
260 new_object = acpi_ut_create_integer_object(value);
261 if (!new_object) {
262 return (AE_NO_MEMORY);
263 }
264
265 *return_object = new_object;
266 return (AE_OK);
267}
268
269/*******************************************************************************
270 *
271 * FUNCTION: acpi_ns_convert_to_string
272 *
273 * PARAMETERS: original_object - Object to be converted
274 * return_object - Where the new converted object is returned
275 *
276 * RETURN: Status. AE_OK if conversion was successful.
277 *
278 * DESCRIPTION: Attempt to convert a Integer/Buffer object to a String.
279 *
280 ******************************************************************************/
281
282static acpi_status
283acpi_ns_convert_to_string(union acpi_operand_object *original_object,
284 union acpi_operand_object **return_object)
285{
286 union acpi_operand_object *new_object;
287 acpi_size length;
288 acpi_status status;
289
290 switch (original_object->common.type) {
291 case ACPI_TYPE_INTEGER:
292 /*
293 * Integer-to-String conversion. Commonly, convert
294 * an integer of value 0 to a NULL string. The last element of
295 * _BIF and _BIX packages occasionally need this fix.
296 */
297 if (original_object->integer.value == 0) {
298
299 /* Allocate a new NULL string object */
300
301 new_object = acpi_ut_create_string_object(0);
302 if (!new_object) {
303 return (AE_NO_MEMORY);
304 }
305 } else {
306 status =
307 acpi_ex_convert_to_string(original_object,
308 &new_object,
309 ACPI_IMPLICIT_CONVERT_HEX);
310 if (ACPI_FAILURE(status)) {
311 return (status);
312 }
313 }
314 break;
315
316 case ACPI_TYPE_BUFFER:
89 /* 317 /*
90 * Have a Buffer, expected a String, convert. Use a to_string 318 * Buffer-to-String conversion. Use a to_string
91 * conversion, no transform performed on the buffer data. The best 319 * conversion, no transform performed on the buffer data. The best
92 * example of this is the _BIF method, where the string data from 320 * example of this is the _BIF method, where the string data from
93 * the battery is often (incorrectly) returned as buffer object(s). 321 * the battery is often (incorrectly) returned as buffer object(s).
94 */ 322 */
95 length = 0; 323 length = 0;
96 while ((length < return_object->buffer.length) && 324 while ((length < original_object->buffer.length) &&
97 (return_object->buffer.pointer[length])) { 325 (original_object->buffer.pointer[length])) {
98 length++; 326 length++;
99 } 327 }
100 328
@@ -110,44 +338,343 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,
110 * terminated at Length+1. 338 * terminated at Length+1.
111 */ 339 */
112 ACPI_MEMCPY(new_object->string.pointer, 340 ACPI_MEMCPY(new_object->string.pointer,
113 return_object->buffer.pointer, length); 341 original_object->buffer.pointer, length);
342 break;
343
344 default:
345 return (AE_AML_OPERAND_TYPE);
346 }
347
348 *return_object = new_object;
349 return (AE_OK);
350}
351
352/*******************************************************************************
353 *
354 * FUNCTION: acpi_ns_convert_to_buffer
355 *
356 * PARAMETERS: original_object - Object to be converted
357 * return_object - Where the new converted object is returned
358 *
359 * RETURN: Status. AE_OK if conversion was successful.
360 *
361 * DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer.
362 *
363 ******************************************************************************/
114 364
365static acpi_status
366acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
367 union acpi_operand_object **return_object)
368{
369 union acpi_operand_object *new_object;
370 acpi_status status;
371 union acpi_operand_object **elements;
372 u32 *dword_buffer;
373 u32 count;
374 u32 i;
375
376 switch (original_object->common.type) {
377 case ACPI_TYPE_INTEGER:
115 /* 378 /*
116 * If the original object is a package element, we need to: 379 * Integer-to-Buffer conversion.
117 * 1. Set the reference count of the new object to match the 380 * Convert the Integer to a packed-byte buffer. _MAT and other
118 * reference count of the old object. 381 * objects need this sometimes, if a read has been performed on a
119 * 2. Decrement the reference count of the original object. 382 * Field object that is less than or equal to the global integer
383 * size (32 or 64 bits).
120 */ 384 */
121 if (package_index != ACPI_NOT_PACKAGE_ELEMENT) { 385 status =
122 new_object->common.reference_count = 386 acpi_ex_convert_to_buffer(original_object, &new_object);
123 return_object->common.reference_count; 387 if (ACPI_FAILURE(status)) {
388 return (status);
389 }
390 break;
391
392 case ACPI_TYPE_STRING:
124 393
125 if (return_object->common.reference_count > 1) { 394 /* String-to-Buffer conversion. Simple data copy */
126 return_object->common.reference_count--; 395
396 new_object =
397 acpi_ut_create_buffer_object(original_object->string.
398 length);
399 if (!new_object) {
400 return (AE_NO_MEMORY);
401 }
402
403 ACPI_MEMCPY(new_object->buffer.pointer,
404 original_object->string.pointer,
405 original_object->string.length);
406 break;
407
408 case ACPI_TYPE_PACKAGE:
409 /*
410 * This case is often seen for predefined names that must return a
411 * Buffer object with multiple DWORD integers within. For example,
412 * _FDE and _GTM. The Package can be converted to a Buffer.
413 */
414
415 /* All elements of the Package must be integers */
416
417 elements = original_object->package.elements;
418 count = original_object->package.count;
419
420 for (i = 0; i < count; i++) {
421 if ((!*elements) ||
422 ((*elements)->common.type != ACPI_TYPE_INTEGER)) {
423 return (AE_AML_OPERAND_TYPE);
127 } 424 }
425 elements++;
426 }
128 427
129 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, 428 /* Create the new buffer object to replace the Package */
130 data->node_flags, 429
131 "Converted Buffer to expected String at index %u", 430 new_object = acpi_ut_create_buffer_object(ACPI_MUL_4(count));
132 package_index)); 431 if (!new_object) {
133 } else { 432 return (AE_NO_MEMORY);
134 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
135 data->node_flags,
136 "Converted Buffer to expected String"));
137 } 433 }
138 434
139 /* Delete old object, install the new return object */ 435 /* Copy the package elements (integers) to the buffer as DWORDs */
140 436
141 acpi_ut_remove_reference(return_object); 437 elements = original_object->package.elements;
142 *return_object_ptr = new_object; 438 dword_buffer = ACPI_CAST_PTR(u32, new_object->buffer.pointer);
143 data->flags |= ACPI_OBJECT_REPAIRED; 439
144 return (AE_OK); 440 for (i = 0; i < count; i++) {
441 *dword_buffer = (u32) (*elements)->integer.value;
442 dword_buffer++;
443 elements++;
444 }
445 break;
145 446
146 default: 447 default:
448 return (AE_AML_OPERAND_TYPE);
449 }
450
451 *return_object = new_object;
452 return (AE_OK);
453}
454
455/*******************************************************************************
456 *
457 * FUNCTION: acpi_ns_convert_to_package
458 *
459 * PARAMETERS: original_object - Object to be converted
460 * return_object - Where the new converted object is returned
461 *
462 * RETURN: Status. AE_OK if conversion was successful.
463 *
464 * DESCRIPTION: Attempt to convert a Buffer object to a Package. Each byte of
465 * the buffer is converted to a single integer package element.
466 *
467 ******************************************************************************/
468
469static acpi_status
470acpi_ns_convert_to_package(union acpi_operand_object *original_object,
471 union acpi_operand_object **return_object)
472{
473 union acpi_operand_object *new_object;
474 union acpi_operand_object **elements;
475 u32 length;
476 u8 *buffer;
477
478 switch (original_object->common.type) {
479 case ACPI_TYPE_BUFFER:
480
481 /* Buffer-to-Package conversion */
482
483 length = original_object->buffer.length;
484 new_object = acpi_ut_create_package_object(length);
485 if (!new_object) {
486 return (AE_NO_MEMORY);
487 }
488
489 /* Convert each buffer byte to an integer package element */
490
491 elements = new_object->package.elements;
492 buffer = original_object->buffer.pointer;
493
494 while (length--) {
495 *elements =
496 acpi_ut_create_integer_object((u64) *buffer);
497 if (!*elements) {
498 acpi_ut_remove_reference(new_object);
499 return (AE_NO_MEMORY);
500 }
501 elements++;
502 buffer++;
503 }
147 break; 504 break;
505
506 default:
507 return (AE_AML_OPERAND_TYPE);
148 } 508 }
149 509
150 return (AE_AML_OPERAND_TYPE); 510 *return_object = new_object;
511 return (AE_OK);
512}
513
514/*******************************************************************************
515 *
516 * FUNCTION: acpi_ns_repair_null_element
517 *
518 * PARAMETERS: Data - Pointer to validation data structure
519 * expected_btypes - Object types expected
520 * package_index - Index of object within parent package (if
521 * applicable - ACPI_NOT_PACKAGE_ELEMENT
522 * otherwise)
523 * return_object_ptr - Pointer to the object returned from the
524 * evaluation of a method or object
525 *
526 * RETURN: Status. AE_OK if repair was successful.
527 *
528 * DESCRIPTION: Attempt to repair a NULL element of a returned Package object.
529 *
530 ******************************************************************************/
531
532acpi_status
533acpi_ns_repair_null_element(struct acpi_predefined_data *data,
534 u32 expected_btypes,
535 u32 package_index,
536 union acpi_operand_object **return_object_ptr)
537{
538 union acpi_operand_object *return_object = *return_object_ptr;
539 union acpi_operand_object *new_object;
540
541 ACPI_FUNCTION_NAME(ns_repair_null_element);
542
543 /* No repair needed if return object is non-NULL */
544
545 if (return_object) {
546 return (AE_OK);
547 }
548
549 /*
550 * Attempt to repair a NULL element of a Package object. This applies to
551 * predefined names that return a fixed-length package and each element
552 * is required. It does not apply to variable-length packages where NULL
553 * elements are allowed, especially at the end of the package.
554 */
555 if (expected_btypes & ACPI_RTYPE_INTEGER) {
556
557 /* Need an Integer - create a zero-value integer */
558
559 new_object = acpi_ut_create_integer_object(0);
560 } else if (expected_btypes & ACPI_RTYPE_STRING) {
561
562 /* Need a String - create a NULL string */
563
564 new_object = acpi_ut_create_string_object(0);
565 } else if (expected_btypes & ACPI_RTYPE_BUFFER) {
566
567 /* Need a Buffer - create a zero-length buffer */
568
569 new_object = acpi_ut_create_buffer_object(0);
570 } else {
571 /* Error for all other expected types */
572
573 return (AE_AML_OPERAND_TYPE);
574 }
575
576 if (!new_object) {
577 return (AE_NO_MEMORY);
578 }
579
580 /* Set the reference count according to the parent Package object */
581
582 new_object->common.reference_count =
583 data->parent_package->common.reference_count;
584
585 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
586 "%s: Converted NULL package element to expected %s at index %u\n",
587 data->pathname,
588 acpi_ut_get_object_type_name(new_object),
589 package_index));
590
591 *return_object_ptr = new_object;
592 data->flags |= ACPI_OBJECT_REPAIRED;
593 return (AE_OK);
594}
595
596/******************************************************************************
597 *
598 * FUNCTION: acpi_ns_remove_null_elements
599 *
600 * PARAMETERS: Data - Pointer to validation data structure
601 * package_type - An acpi_return_package_types value
602 * obj_desc - A Package object
603 *
604 * RETURN: None.
605 *
606 * DESCRIPTION: Remove all NULL package elements from packages that contain
607 * a variable number of sub-packages. For these types of
608 * packages, NULL elements can be safely removed.
609 *
610 *****************************************************************************/
611
612void
613acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
614 u8 package_type,
615 union acpi_operand_object *obj_desc)
616{
617 union acpi_operand_object **source;
618 union acpi_operand_object **dest;
619 u32 count;
620 u32 new_count;
621 u32 i;
622
623 ACPI_FUNCTION_NAME(ns_remove_null_elements);
624
625 /*
626 * PTYPE1 packages contain no subpackages.
627 * PTYPE2 packages contain a variable number of sub-packages. We can
628 * safely remove all NULL elements from the PTYPE2 packages.
629 */
630 switch (package_type) {
631 case ACPI_PTYPE1_FIXED:
632 case ACPI_PTYPE1_VAR:
633 case ACPI_PTYPE1_OPTION:
634 return;
635
636 case ACPI_PTYPE2:
637 case ACPI_PTYPE2_COUNT:
638 case ACPI_PTYPE2_PKG_COUNT:
639 case ACPI_PTYPE2_FIXED:
640 case ACPI_PTYPE2_MIN:
641 case ACPI_PTYPE2_REV_FIXED:
642 break;
643
644 default:
645 return;
646 }
647
648 count = obj_desc->package.count;
649 new_count = count;
650
651 source = obj_desc->package.elements;
652 dest = source;
653
654 /* Examine all elements of the package object, remove nulls */
655
656 for (i = 0; i < count; i++) {
657 if (!*source) {
658 new_count--;
659 } else {
660 *dest = *source;
661 dest++;
662 }
663 source++;
664 }
665
666 /* Update parent package if any null elements were removed */
667
668 if (new_count < count) {
669 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
670 "%s: Found and removed %u NULL elements\n",
671 data->pathname, (count - new_count)));
672
673 /* NULL terminate list and update the package count */
674
675 *dest = NULL;
676 obj_desc->package.count = new_count;
677 }
151} 678}
152 679
153/******************************************************************************* 680/*******************************************************************************
@@ -180,6 +707,8 @@ acpi_ns_repair_package_list(struct acpi_predefined_data *data,
180{ 707{
181 union acpi_operand_object *pkg_obj_desc; 708 union acpi_operand_object *pkg_obj_desc;
182 709
710 ACPI_FUNCTION_NAME(ns_repair_package_list);
711
183 /* 712 /*
184 * Create the new outer package and populate it. The new package will 713 * Create the new outer package and populate it. The new package will
185 * have a single element, the lone subpackage. 714 * have a single element, the lone subpackage.
@@ -196,8 +725,9 @@ acpi_ns_repair_package_list(struct acpi_predefined_data *data,
196 *obj_desc_ptr = pkg_obj_desc; 725 *obj_desc_ptr = pkg_obj_desc;
197 data->flags |= ACPI_OBJECT_REPAIRED; 726 data->flags |= ACPI_OBJECT_REPAIRED;
198 727
199 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 728 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
200 "Incorrectly formed Package, attempting repair")); 729 "%s: Repaired incorrectly formed Package\n",
730 data->pathname));
201 731
202 return (AE_OK); 732 return (AE_OK);
203} 733}
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
new file mode 100644
index 000000000000..61bd0f6755d2
--- /dev/null
+++ b/drivers/acpi/acpica/nsrepair2.c
@@ -0,0 +1,567 @@
1/******************************************************************************
2 *
3 * Module Name: nsrepair2 - Repair for objects returned by specific
4 * predefined methods
5 *
6 *****************************************************************************/
7
8/*
9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
45#include <acpi/acpi.h>
46#include "accommon.h"
47#include "acnamesp.h"
48
49#define _COMPONENT ACPI_NAMESPACE
50ACPI_MODULE_NAME("nsrepair2")
51
52/*
53 * Information structure and handler for ACPI predefined names that can
54 * be repaired on a per-name basis.
55 */
56typedef
57acpi_status(*acpi_repair_function) (struct acpi_predefined_data *data,
58 union acpi_operand_object **return_object_ptr);
59
60typedef struct acpi_repair_info {
61 char name[ACPI_NAME_SIZE];
62 acpi_repair_function repair_function;
63
64} acpi_repair_info;
65
66/* Local prototypes */
67
68static const struct acpi_repair_info *acpi_ns_match_repairable_name(struct
69 acpi_namespace_node
70 *node);
71
72static acpi_status
73acpi_ns_repair_ALR(struct acpi_predefined_data *data,
74 union acpi_operand_object **return_object_ptr);
75
76static acpi_status
77acpi_ns_repair_FDE(struct acpi_predefined_data *data,
78 union acpi_operand_object **return_object_ptr);
79
80static acpi_status
81acpi_ns_repair_PSS(struct acpi_predefined_data *data,
82 union acpi_operand_object **return_object_ptr);
83
84static acpi_status
85acpi_ns_repair_TSS(struct acpi_predefined_data *data,
86 union acpi_operand_object **return_object_ptr);
87
88static acpi_status
89acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
90 union acpi_operand_object *return_object,
91 u32 expected_count,
92 u32 sort_index,
93 u8 sort_direction, char *sort_key_name);
94
95static void
96acpi_ns_sort_list(union acpi_operand_object **elements,
97 u32 count, u32 index, u8 sort_direction);
98
99/* Values for sort_direction above */
100
101#define ACPI_SORT_ASCENDING 0
102#define ACPI_SORT_DESCENDING 1
103
104/*
105 * This table contains the names of the predefined methods for which we can
106 * perform more complex repairs.
107 *
108 * As necessary:
109 *
110 * _ALR: Sort the list ascending by ambient_illuminance
111 * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs
112 * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs
113 * _PSS: Sort the list descending by Power
114 * _TSS: Sort the list descending by Power
115 */
116static const struct acpi_repair_info acpi_ns_repairable_names[] = {
117 {"_ALR", acpi_ns_repair_ALR},
118 {"_FDE", acpi_ns_repair_FDE},
119 {"_GTM", acpi_ns_repair_FDE}, /* _GTM has same repair as _FDE */
120 {"_PSS", acpi_ns_repair_PSS},
121 {"_TSS", acpi_ns_repair_TSS},
122 {{0, 0, 0, 0}, NULL} /* Table terminator */
123};
124
125#define ACPI_FDE_FIELD_COUNT 5
126#define ACPI_FDE_BYTE_BUFFER_SIZE 5
127#define ACPI_FDE_DWORD_BUFFER_SIZE (ACPI_FDE_FIELD_COUNT * sizeof (u32))
128
129/******************************************************************************
130 *
131 * FUNCTION: acpi_ns_complex_repairs
132 *
133 * PARAMETERS: Data - Pointer to validation data structure
134 * Node - Namespace node for the method/object
135 * validate_status - Original status of earlier validation
136 * return_object_ptr - Pointer to the object returned from the
137 * evaluation of a method or object
138 *
139 * RETURN: Status. AE_OK if repair was successful. If name is not
140 * matched, validate_status is returned.
141 *
142 * DESCRIPTION: Attempt to repair/convert a return object of a type that was
143 * not expected.
144 *
145 *****************************************************************************/
146
147acpi_status
148acpi_ns_complex_repairs(struct acpi_predefined_data *data,
149 struct acpi_namespace_node *node,
150 acpi_status validate_status,
151 union acpi_operand_object **return_object_ptr)
152{
153 const struct acpi_repair_info *predefined;
154 acpi_status status;
155
156 /* Check if this name is in the list of repairable names */
157
158 predefined = acpi_ns_match_repairable_name(node);
159 if (!predefined) {
160 return (validate_status);
161 }
162
163 status = predefined->repair_function(data, return_object_ptr);
164 return (status);
165}
166
167/******************************************************************************
168 *
169 * FUNCTION: acpi_ns_match_repairable_name
170 *
171 * PARAMETERS: Node - Namespace node for the method/object
172 *
173 * RETURN: Pointer to entry in repair table. NULL indicates not found.
174 *
175 * DESCRIPTION: Check an object name against the repairable object list.
176 *
177 *****************************************************************************/
178
179static const struct acpi_repair_info *acpi_ns_match_repairable_name(struct
180 acpi_namespace_node
181 *node)
182{
183 const struct acpi_repair_info *this_name;
184
185 /* Search info table for a repairable predefined method/object name */
186
187 this_name = acpi_ns_repairable_names;
188 while (this_name->repair_function) {
189 if (ACPI_COMPARE_NAME(node->name.ascii, this_name->name)) {
190 return (this_name);
191 }
192 this_name++;
193 }
194
195 return (NULL); /* Not found */
196}
197
198/******************************************************************************
199 *
200 * FUNCTION: acpi_ns_repair_ALR
201 *
202 * PARAMETERS: Data - Pointer to validation data structure
203 * return_object_ptr - Pointer to the object returned from the
204 * evaluation of a method or object
205 *
206 * RETURN: Status. AE_OK if object is OK or was repaired successfully
207 *
208 * DESCRIPTION: Repair for the _ALR object. If necessary, sort the object list
209 * ascending by the ambient illuminance values.
210 *
211 *****************************************************************************/
212
213static acpi_status
214acpi_ns_repair_ALR(struct acpi_predefined_data *data,
215 union acpi_operand_object **return_object_ptr)
216{
217 union acpi_operand_object *return_object = *return_object_ptr;
218 acpi_status status;
219
220 status = acpi_ns_check_sorted_list(data, return_object, 2, 1,
221 ACPI_SORT_ASCENDING,
222 "AmbientIlluminance");
223
224 return (status);
225}
226
227/******************************************************************************
228 *
229 * FUNCTION: acpi_ns_repair_FDE
230 *
231 * PARAMETERS: Data - Pointer to validation data structure
232 * return_object_ptr - Pointer to the object returned from the
233 * evaluation of a method or object
234 *
235 * RETURN: Status. AE_OK if object is OK or was repaired successfully
236 *
237 * DESCRIPTION: Repair for the _FDE and _GTM objects. The expected return
238 * value is a Buffer of 5 DWORDs. This function repairs a common
239 * problem where the return value is a Buffer of BYTEs, not
240 * DWORDs.
241 *
242 *****************************************************************************/
243
244static acpi_status
245acpi_ns_repair_FDE(struct acpi_predefined_data *data,
246 union acpi_operand_object **return_object_ptr)
247{
248 union acpi_operand_object *return_object = *return_object_ptr;
249 union acpi_operand_object *buffer_object;
250 u8 *byte_buffer;
251 u32 *dword_buffer;
252 u32 i;
253
254 ACPI_FUNCTION_NAME(ns_repair_FDE);
255
256 switch (return_object->common.type) {
257 case ACPI_TYPE_BUFFER:
258
259 /* This is the expected type. Length should be (at least) 5 DWORDs */
260
261 if (return_object->buffer.length >= ACPI_FDE_DWORD_BUFFER_SIZE) {
262 return (AE_OK);
263 }
264
265 /* We can only repair if we have exactly 5 BYTEs */
266
267 if (return_object->buffer.length != ACPI_FDE_BYTE_BUFFER_SIZE) {
268 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
269 data->node_flags,
270 "Incorrect return buffer length %u, expected %u",
271 return_object->buffer.length,
272 ACPI_FDE_DWORD_BUFFER_SIZE));
273
274 return (AE_AML_OPERAND_TYPE);
275 }
276
277 /* Create the new (larger) buffer object */
278
279 buffer_object =
280 acpi_ut_create_buffer_object(ACPI_FDE_DWORD_BUFFER_SIZE);
281 if (!buffer_object) {
282 return (AE_NO_MEMORY);
283 }
284
285 /* Expand each byte to a DWORD */
286
287 byte_buffer = return_object->buffer.pointer;
288 dword_buffer =
289 ACPI_CAST_PTR(u32, buffer_object->buffer.pointer);
290
291 for (i = 0; i < ACPI_FDE_FIELD_COUNT; i++) {
292 *dword_buffer = (u32) *byte_buffer;
293 dword_buffer++;
294 byte_buffer++;
295 }
296
297 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
298 "%s Expanded Byte Buffer to expected DWord Buffer\n",
299 data->pathname));
300 break;
301
302 default:
303 return (AE_AML_OPERAND_TYPE);
304 }
305
306 /* Delete the original return object, return the new buffer object */
307
308 acpi_ut_remove_reference(return_object);
309 *return_object_ptr = buffer_object;
310
311 data->flags |= ACPI_OBJECT_REPAIRED;
312 return (AE_OK);
313}
314
315/******************************************************************************
316 *
317 * FUNCTION: acpi_ns_repair_TSS
318 *
319 * PARAMETERS: Data - Pointer to validation data structure
320 * return_object_ptr - Pointer to the object returned from the
321 * evaluation of a method or object
322 *
323 * RETURN: Status. AE_OK if object is OK or was repaired successfully
324 *
325 * DESCRIPTION: Repair for the _TSS object. If necessary, sort the object list
326 * descending by the power dissipation values.
327 *
328 *****************************************************************************/
329
330static acpi_status
331acpi_ns_repair_TSS(struct acpi_predefined_data *data,
332 union acpi_operand_object **return_object_ptr)
333{
334 union acpi_operand_object *return_object = *return_object_ptr;
335 acpi_status status;
336
337 status = acpi_ns_check_sorted_list(data, return_object, 5, 1,
338 ACPI_SORT_DESCENDING,
339 "PowerDissipation");
340
341 return (status);
342}
343
344/******************************************************************************
345 *
346 * FUNCTION: acpi_ns_repair_PSS
347 *
348 * PARAMETERS: Data - Pointer to validation data structure
349 * return_object_ptr - Pointer to the object returned from the
350 * evaluation of a method or object
351 *
352 * RETURN: Status. AE_OK if object is OK or was repaired successfully
353 *
354 * DESCRIPTION: Repair for the _PSS object. If necessary, sort the object list
355 * by the CPU frequencies. Check that the power dissipation values
356 * are all proportional to CPU frequency (i.e., sorting by
357 * frequency should be the same as sorting by power.)
358 *
359 *****************************************************************************/
360
361static acpi_status
362acpi_ns_repair_PSS(struct acpi_predefined_data *data,
363 union acpi_operand_object **return_object_ptr)
364{
365 union acpi_operand_object *return_object = *return_object_ptr;
366 union acpi_operand_object **outer_elements;
367 u32 outer_element_count;
368 union acpi_operand_object **elements;
369 union acpi_operand_object *obj_desc;
370 u32 previous_value;
371 acpi_status status;
372 u32 i;
373
374 /*
375 * Entries (sub-packages) in the _PSS Package must be sorted by power
376 * dissipation, in descending order. If it appears that the list is
377 * incorrectly sorted, sort it. We sort by cpu_frequency, since this
378 * should be proportional to the power.
379 */
380 status = acpi_ns_check_sorted_list(data, return_object, 6, 0,
381 ACPI_SORT_DESCENDING,
382 "CpuFrequency");
383 if (ACPI_FAILURE(status)) {
384 return (status);
385 }
386
387 /*
388 * We now know the list is correctly sorted by CPU frequency. Check if
389 * the power dissipation values are proportional.
390 */
391 previous_value = ACPI_UINT32_MAX;
392 outer_elements = return_object->package.elements;
393 outer_element_count = return_object->package.count;
394
395 for (i = 0; i < outer_element_count; i++) {
396 elements = (*outer_elements)->package.elements;
397 obj_desc = elements[1]; /* Index1 = power_dissipation */
398
399 if ((u32) obj_desc->integer.value > previous_value) {
400 ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
401 data->node_flags,
402 "SubPackage[%u,%u] - suspicious power dissipation values",
403 i - 1, i));
404 }
405
406 previous_value = (u32) obj_desc->integer.value;
407 outer_elements++;
408 }
409
410 return (AE_OK);
411}
412
413/******************************************************************************
414 *
415 * FUNCTION: acpi_ns_check_sorted_list
416 *
417 * PARAMETERS: Data - Pointer to validation data structure
418 * return_object - Pointer to the top-level returned object
419 * expected_count - Minimum length of each sub-package
420 * sort_index - Sub-package entry to sort on
421 * sort_direction - Ascending or descending
422 * sort_key_name - Name of the sort_index field
423 *
424 * RETURN: Status. AE_OK if the list is valid and is sorted correctly or
425 * has been repaired by sorting the list.
426 *
427 * DESCRIPTION: Check if the package list is valid and sorted correctly by the
428 * sort_index. If not, then sort the list.
429 *
430 *****************************************************************************/
431
432static acpi_status
433acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
434 union acpi_operand_object *return_object,
435 u32 expected_count,
436 u32 sort_index,
437 u8 sort_direction, char *sort_key_name)
438{
439 u32 outer_element_count;
440 union acpi_operand_object **outer_elements;
441 union acpi_operand_object **elements;
442 union acpi_operand_object *obj_desc;
443 u32 i;
444 u32 previous_value;
445
446 ACPI_FUNCTION_NAME(ns_check_sorted_list);
447
448 /* The top-level object must be a package */
449
450 if (return_object->common.type != ACPI_TYPE_PACKAGE) {
451 return (AE_AML_OPERAND_TYPE);
452 }
453
454 /*
455 * NOTE: assumes list of sub-packages contains no NULL elements.
456 * Any NULL elements should have been removed by earlier call
457 * to acpi_ns_remove_null_elements.
458 */
459 outer_elements = return_object->package.elements;
460 outer_element_count = return_object->package.count;
461 if (!outer_element_count) {
462 return (AE_AML_PACKAGE_LIMIT);
463 }
464
465 previous_value = 0;
466 if (sort_direction == ACPI_SORT_DESCENDING) {
467 previous_value = ACPI_UINT32_MAX;
468 }
469
470 /* Examine each subpackage */
471
472 for (i = 0; i < outer_element_count; i++) {
473
474 /* Each element of the top-level package must also be a package */
475
476 if ((*outer_elements)->common.type != ACPI_TYPE_PACKAGE) {
477 return (AE_AML_OPERAND_TYPE);
478 }
479
480 /* Each sub-package must have the minimum length */
481
482 if ((*outer_elements)->package.count < expected_count) {
483 return (AE_AML_PACKAGE_LIMIT);
484 }
485
486 elements = (*outer_elements)->package.elements;
487 obj_desc = elements[sort_index];
488
489 if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
490 return (AE_AML_OPERAND_TYPE);
491 }
492
493 /*
494 * The list must be sorted in the specified order. If we detect a
495 * discrepancy, sort the entire list.
496 */
497 if (((sort_direction == ACPI_SORT_ASCENDING) &&
498 (obj_desc->integer.value < previous_value)) ||
499 ((sort_direction == ACPI_SORT_DESCENDING) &&
500 (obj_desc->integer.value > previous_value))) {
501 acpi_ns_sort_list(return_object->package.elements,
502 outer_element_count, sort_index,
503 sort_direction);
504
505 data->flags |= ACPI_OBJECT_REPAIRED;
506
507 ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
508 "%s: Repaired unsorted list - now sorted by %s\n",
509 data->pathname, sort_key_name));
510 return (AE_OK);
511 }
512
513 previous_value = (u32) obj_desc->integer.value;
514 outer_elements++;
515 }
516
517 return (AE_OK);
518}
519
520/******************************************************************************
521 *
522 * FUNCTION: acpi_ns_sort_list
523 *
524 * PARAMETERS: Elements - Package object element list
525 * Count - Element count for above
526 * Index - Sort by which package element
527 * sort_direction - Ascending or Descending sort
528 *
529 * RETURN: None
530 *
531 * DESCRIPTION: Sort the objects that are in a package element list.
532 *
533 * NOTE: Assumes that all NULL elements have been removed from the package,
534 * and that all elements have been verified to be of type Integer.
535 *
536 *****************************************************************************/
537
538static void
539acpi_ns_sort_list(union acpi_operand_object **elements,
540 u32 count, u32 index, u8 sort_direction)
541{
542 union acpi_operand_object *obj_desc1;
543 union acpi_operand_object *obj_desc2;
544 union acpi_operand_object *temp_obj;
545 u32 i;
546 u32 j;
547
548 /* Simple bubble sort */
549
550 for (i = 1; i < count; i++) {
551 for (j = (count - 1); j >= i; j--) {
552 obj_desc1 = elements[j - 1]->package.elements[index];
553 obj_desc2 = elements[j]->package.elements[index];
554
555 if (((sort_direction == ACPI_SORT_ASCENDING) &&
556 (obj_desc1->integer.value >
557 obj_desc2->integer.value))
558 || ((sort_direction == ACPI_SORT_DESCENDING)
559 && (obj_desc1->integer.value <
560 obj_desc2->integer.value))) {
561 temp_obj = elements[j - 1];
562 elements[j - 1] = elements[j];
563 elements[j] = temp_obj;
564 }
565 }
566 }
567}
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c
index 7e865639a928..08f8b3f5ccaa 100644
--- a/drivers/acpi/acpica/nssearch.c
+++ b/drivers/acpi/acpica/nssearch.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index ea55ab4f9849..24d05a87a2a3 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -671,24 +671,25 @@ acpi_ns_externalize_name(u32 internal_name_length,
671 671
672/******************************************************************************* 672/*******************************************************************************
673 * 673 *
674 * FUNCTION: acpi_ns_map_handle_to_node 674 * FUNCTION: acpi_ns_validate_handle
675 * 675 *
676 * PARAMETERS: Handle - Handle to be converted to an Node 676 * PARAMETERS: Handle - Handle to be validated and typecast to a
677 * namespace node.
677 * 678 *
678 * RETURN: A Name table entry pointer 679 * RETURN: A pointer to a namespace node
679 * 680 *
680 * DESCRIPTION: Convert a namespace handle to a real Node 681 * DESCRIPTION: Convert a namespace handle to a namespace node. Handles special
682 * cases for the root node.
681 * 683 *
682 * Note: Real integer handles would allow for more verification 684 * NOTE: Real integer handles would allow for more verification
683 * and keep all pointers within this subsystem - however this introduces 685 * and keep all pointers within this subsystem - however this introduces
684 * more (and perhaps unnecessary) overhead. 686 * more overhead and has not been necessary to this point. Drivers
685 * 687 * holding handles are typically notified before a node becomes invalid
686 * The current implemenation is basically a placeholder until such time comes 688 * due to a table unload.
687 * that it is needed.
688 * 689 *
689 ******************************************************************************/ 690 ******************************************************************************/
690 691
691struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) 692struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle)
692{ 693{
693 694
694 ACPI_FUNCTION_ENTRY(); 695 ACPI_FUNCTION_ENTRY();
@@ -710,42 +711,6 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle)
710 711
711/******************************************************************************* 712/*******************************************************************************
712 * 713 *
713 * FUNCTION: acpi_ns_convert_entry_to_handle
714 *
715 * PARAMETERS: Node - Node to be converted to a Handle
716 *
717 * RETURN: A user handle
718 *
719 * DESCRIPTION: Convert a real Node to a namespace handle
720 *
721 ******************************************************************************/
722
723acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node)
724{
725
726 /*
727 * Simple implementation for now;
728 */
729 return ((acpi_handle) node);
730
731/* Example future implementation ---------------------
732
733 if (!Node)
734 {
735 return (NULL);
736 }
737
738 if (Node == acpi_gbl_root_node)
739 {
740 return (ACPI_ROOT_OBJECT);
741 }
742
743 return ((acpi_handle) Node);
744------------------------------------------------------*/
745}
746
747/*******************************************************************************
748 *
749 * FUNCTION: acpi_ns_terminate 714 * FUNCTION: acpi_ns_terminate
750 * 715 *
751 * PARAMETERS: none 716 * PARAMETERS: none
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c
index 35539df5c75d..00e79fb26029 100644
--- a/drivers/acpi/acpica/nswalk.c
+++ b/drivers/acpi/acpica/nswalk.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -165,24 +165,27 @@ struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type,
165 * max_depth - Depth to which search is to reach 165 * max_depth - Depth to which search is to reach
166 * Flags - Whether to unlock the NS before invoking 166 * Flags - Whether to unlock the NS before invoking
167 * the callback routine 167 * the callback routine
168 * user_function - Called when an object of "Type" is found 168 * pre_order_visit - Called during tree pre-order visit
169 * Context - Passed to user function 169 * when an object of "Type" is found
170 * return_value - from the user_function if terminated early. 170 * post_order_visit - Called during tree post-order visit
171 * Otherwise, returns NULL. 171 * when an object of "Type" is found
172 * Context - Passed to user function(s) above
173 * return_value - from the user_function if terminated
174 * early. Otherwise, returns NULL.
172 * RETURNS: Status 175 * RETURNS: Status
173 * 176 *
174 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, 177 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
175 * starting (and ending) at the node specified by start_handle. 178 * starting (and ending) at the node specified by start_handle.
176 * The user_function is called whenever a node that matches 179 * The callback function is called whenever a node that matches
177 * the type parameter is found. If the user function returns 180 * the type parameter is found. If the callback function returns
178 * a non-zero value, the search is terminated immediately and 181 * a non-zero value, the search is terminated immediately and
179 * this value is returned to the caller. 182 * this value is returned to the caller.
180 * 183 *
181 * The point of this procedure is to provide a generic namespace 184 * The point of this procedure is to provide a generic namespace
182 * walk routine that can be called from multiple places to 185 * walk routine that can be called from multiple places to
183 * provide multiple services; the User Function can be tailored 186 * provide multiple services; the callback function(s) can be
184 * to each task, whether it is a print function, a compare 187 * tailored to each task, whether it is a print function,
185 * function, etc. 188 * a compare function, etc.
186 * 189 *
187 ******************************************************************************/ 190 ******************************************************************************/
188 191
@@ -191,7 +194,8 @@ acpi_ns_walk_namespace(acpi_object_type type,
191 acpi_handle start_node, 194 acpi_handle start_node,
192 u32 max_depth, 195 u32 max_depth,
193 u32 flags, 196 u32 flags,
194 acpi_walk_callback user_function, 197 acpi_walk_callback pre_order_visit,
198 acpi_walk_callback post_order_visit,
195 void *context, void **return_value) 199 void *context, void **return_value)
196{ 200{
197 acpi_status status; 201 acpi_status status;
@@ -200,6 +204,7 @@ acpi_ns_walk_namespace(acpi_object_type type,
200 struct acpi_namespace_node *parent_node; 204 struct acpi_namespace_node *parent_node;
201 acpi_object_type child_type; 205 acpi_object_type child_type;
202 u32 level; 206 u32 level;
207 u8 node_previously_visited = FALSE;
203 208
204 ACPI_FUNCTION_TRACE(ns_walk_namespace); 209 ACPI_FUNCTION_TRACE(ns_walk_namespace);
205 210
@@ -212,7 +217,7 @@ acpi_ns_walk_namespace(acpi_object_type type,
212 /* Null child means "get first node" */ 217 /* Null child means "get first node" */
213 218
214 parent_node = start_node; 219 parent_node = start_node;
215 child_node = NULL; 220 child_node = acpi_ns_get_next_node(parent_node, NULL);
216 child_type = ACPI_TYPE_ANY; 221 child_type = ACPI_TYPE_ANY;
217 level = 1; 222 level = 1;
218 223
@@ -221,102 +226,129 @@ acpi_ns_walk_namespace(acpi_object_type type,
221 * started. When Level is zero, the loop is done because we have 226 * started. When Level is zero, the loop is done because we have
222 * bubbled up to (and passed) the original parent handle (start_entry) 227 * bubbled up to (and passed) the original parent handle (start_entry)
223 */ 228 */
224 while (level > 0) { 229 while (level > 0 && child_node) {
230 status = AE_OK;
225 231
226 /* Get the next node in this scope. Null if not found */ 232 /* Found next child, get the type if we are not searching for ANY */
227 233
228 status = AE_OK; 234 if (type != ACPI_TYPE_ANY) {
229 child_node = acpi_ns_get_next_node(parent_node, child_node); 235 child_type = child_node->type;
230 if (child_node) { 236 }
231 237
232 /* Found next child, get the type if we are not searching for ANY */ 238 /*
239 * Ignore all temporary namespace nodes (created during control
240 * method execution) unless told otherwise. These temporary nodes
241 * can cause a race condition because they can be deleted during
242 * the execution of the user function (if the namespace is
243 * unlocked before invocation of the user function.) Only the
244 * debugger namespace dump will examine the temporary nodes.
245 */
246 if ((child_node->flags & ANOBJ_TEMPORARY) &&
247 !(flags & ACPI_NS_WALK_TEMP_NODES)) {
248 status = AE_CTRL_DEPTH;
249 }
233 250
234 if (type != ACPI_TYPE_ANY) { 251 /* Type must match requested type */
235 child_type = child_node->type;
236 }
237 252
253 else if (child_type == type) {
238 /* 254 /*
239 * Ignore all temporary namespace nodes (created during control 255 * Found a matching node, invoke the user callback function.
240 * method execution) unless told otherwise. These temporary nodes 256 * Unlock the namespace if flag is set.
241 * can cause a race condition because they can be deleted during
242 * the execution of the user function (if the namespace is
243 * unlocked before invocation of the user function.) Only the
244 * debugger namespace dump will examine the temporary nodes.
245 */ 257 */
246 if ((child_node->flags & ANOBJ_TEMPORARY) && 258 if (flags & ACPI_NS_WALK_UNLOCK) {
247 !(flags & ACPI_NS_WALK_TEMP_NODES)) { 259 mutex_status =
248 status = AE_CTRL_DEPTH; 260 acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
261 if (ACPI_FAILURE(mutex_status)) {
262 return_ACPI_STATUS(mutex_status);
263 }
249 } 264 }
250 265
251 /* Type must match requested type */ 266 /*
252 267 * Invoke the user function, either pre-order or post-order
253 else if (child_type == type) { 268 * or both.
254 /* 269 */
255 * Found a matching node, invoke the user callback function. 270 if (!node_previously_visited) {
256 * Unlock the namespace if flag is set. 271 if (pre_order_visit) {
257 */ 272 status =
258 if (flags & ACPI_NS_WALK_UNLOCK) { 273 pre_order_visit(child_node, level,
259 mutex_status = 274 context,
260 acpi_ut_release_mutex 275 return_value);
261 (ACPI_MTX_NAMESPACE);
262 if (ACPI_FAILURE(mutex_status)) {
263 return_ACPI_STATUS
264 (mutex_status);
265 }
266 } 276 }
277 } else {
278 if (post_order_visit) {
279 status =
280 post_order_visit(child_node, level,
281 context,
282 return_value);
283 }
284 }
267 285
268 status = 286 if (flags & ACPI_NS_WALK_UNLOCK) {
269 user_function(child_node, level, context, 287 mutex_status =
270 return_value); 288 acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
271 289 if (ACPI_FAILURE(mutex_status)) {
272 if (flags & ACPI_NS_WALK_UNLOCK) { 290 return_ACPI_STATUS(mutex_status);
273 mutex_status =
274 acpi_ut_acquire_mutex
275 (ACPI_MTX_NAMESPACE);
276 if (ACPI_FAILURE(mutex_status)) {
277 return_ACPI_STATUS
278 (mutex_status);
279 }
280 } 291 }
292 }
281 293
282 switch (status) { 294 switch (status) {
283 case AE_OK: 295 case AE_OK:
284 case AE_CTRL_DEPTH: 296 case AE_CTRL_DEPTH:
285 297
286 /* Just keep going */ 298 /* Just keep going */
287 break; 299 break;
288 300
289 case AE_CTRL_TERMINATE: 301 case AE_CTRL_TERMINATE:
290 302
291 /* Exit now, with OK status */ 303 /* Exit now, with OK status */
292 304
293 return_ACPI_STATUS(AE_OK); 305 return_ACPI_STATUS(AE_OK);
294 306
295 default: 307 default:
296 308
297 /* All others are valid exceptions */ 309 /* All others are valid exceptions */
298 310
299 return_ACPI_STATUS(status); 311 return_ACPI_STATUS(status);
300 } 312 }
313 }
314
315 /*
316 * Depth first search: Attempt to go down another level in the
317 * namespace if we are allowed to. Don't go any further if we have
318 * reached the caller specified maximum depth or if the user
319 * function has specified that the maximum depth has been reached.
320 */
321 if (!node_previously_visited &&
322 (level < max_depth) && (status != AE_CTRL_DEPTH)) {
323 if (child_node->child) {
324
325 /* There is at least one child of this node, visit it */
326
327 level++;
328 parent_node = child_node;
329 child_node =
330 acpi_ns_get_next_node(parent_node, NULL);
331 continue;
301 } 332 }
333 }
302 334
303 /* 335 /* No more children, re-visit this node */
304 * Depth first search: Attempt to go down another level in the
305 * namespace if we are allowed to. Don't go any further if we have
306 * reached the caller specified maximum depth or if the user
307 * function has specified that the maximum depth has been reached.
308 */
309 if ((level < max_depth) && (status != AE_CTRL_DEPTH)) {
310 if (child_node->child) {
311 336
312 /* There is at least one child of this node, visit it */ 337 if (!node_previously_visited) {
338 node_previously_visited = TRUE;
339 continue;
340 }
313 341
314 level++; 342 /* No more children, visit peers */
315 parent_node = child_node; 343
316 child_node = NULL; 344 child_node = acpi_ns_get_next_node(parent_node, child_node);
317 } 345 if (child_node) {
318 } 346 node_previously_visited = FALSE;
319 } else { 347 }
348
349 /* No peers, re-visit parent */
350
351 else {
320 /* 352 /*
321 * No more children of this node (acpi_ns_get_next_node failed), go 353 * No more children of this node (acpi_ns_get_next_node failed), go
322 * back upwards in the namespace tree to the node's parent. 354 * back upwards in the namespace tree to the node's parent.
@@ -324,6 +356,8 @@ acpi_ns_walk_namespace(acpi_object_type type,
324 level--; 356 level--;
325 child_node = parent_node; 357 child_node = parent_node;
326 parent_node = acpi_ns_get_parent_node(parent_node); 358 parent_node = acpi_ns_get_parent_node(parent_node);
359
360 node_previously_visited = TRUE;
327 } 361 }
328 } 362 }
329 363
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index 4929dbdbc8f0..ebef8a7fd707 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -190,7 +190,7 @@ acpi_evaluate_object(acpi_handle handle,
190 190
191 /* Convert and validate the device handle */ 191 /* Convert and validate the device handle */
192 192
193 info->prefix_node = acpi_ns_map_handle_to_node(handle); 193 info->prefix_node = acpi_ns_validate_handle(handle);
194 if (!info->prefix_node) { 194 if (!info->prefix_node) {
195 status = AE_BAD_PARAMETER; 195 status = AE_BAD_PARAMETER;
196 goto cleanup; 196 goto cleanup;
@@ -433,8 +433,11 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
433 * PARAMETERS: Type - acpi_object_type to search for 433 * PARAMETERS: Type - acpi_object_type to search for
434 * start_object - Handle in namespace where search begins 434 * start_object - Handle in namespace where search begins
435 * max_depth - Depth to which search is to reach 435 * max_depth - Depth to which search is to reach
436 * user_function - Called when an object of "Type" is found 436 * pre_order_visit - Called during tree pre-order visit
437 * Context - Passed to user function 437 * when an object of "Type" is found
438 * post_order_visit - Called during tree post-order visit
439 * when an object of "Type" is found
440 * Context - Passed to user function(s) above
438 * return_value - Location where return value of 441 * return_value - Location where return value of
439 * user_function is put if terminated early 442 * user_function is put if terminated early
440 * 443 *
@@ -443,16 +446,16 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
443 * 446 *
444 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, 447 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
445 * starting (and ending) at the object specified by start_handle. 448 * starting (and ending) at the object specified by start_handle.
446 * The user_function is called whenever an object that matches 449 * The callback function is called whenever an object that matches
447 * the type parameter is found. If the user function returns 450 * the type parameter is found. If the callback function returns
448 * a non-zero value, the search is terminated immediately and this 451 * a non-zero value, the search is terminated immediately and this
449 * value is returned to the caller. 452 * value is returned to the caller.
450 * 453 *
451 * The point of this procedure is to provide a generic namespace 454 * The point of this procedure is to provide a generic namespace
452 * walk routine that can be called from multiple places to 455 * walk routine that can be called from multiple places to
453 * provide multiple services; the User Function can be tailored 456 * provide multiple services; the callback function(s) can be
454 * to each task, whether it is a print function, a compare 457 * tailored to each task, whether it is a print function,
455 * function, etc. 458 * a compare function, etc.
456 * 459 *
457 ******************************************************************************/ 460 ******************************************************************************/
458 461
@@ -460,7 +463,8 @@ acpi_status
460acpi_walk_namespace(acpi_object_type type, 463acpi_walk_namespace(acpi_object_type type,
461 acpi_handle start_object, 464 acpi_handle start_object,
462 u32 max_depth, 465 u32 max_depth,
463 acpi_walk_callback user_function, 466 acpi_walk_callback pre_order_visit,
467 acpi_walk_callback post_order_visit,
464 void *context, void **return_value) 468 void *context, void **return_value)
465{ 469{
466 acpi_status status; 470 acpi_status status;
@@ -469,7 +473,8 @@ acpi_walk_namespace(acpi_object_type type,
469 473
470 /* Parameter validation */ 474 /* Parameter validation */
471 475
472 if ((type > ACPI_TYPE_LOCAL_MAX) || (!max_depth) || (!user_function)) { 476 if ((type > ACPI_TYPE_LOCAL_MAX) ||
477 (!max_depth) || (!pre_order_visit && !post_order_visit)) {
473 return_ACPI_STATUS(AE_BAD_PARAMETER); 478 return_ACPI_STATUS(AE_BAD_PARAMETER);
474 } 479 }
475 480
@@ -501,8 +506,9 @@ acpi_walk_namespace(acpi_object_type type,
501 } 506 }
502 507
503 status = acpi_ns_walk_namespace(type, start_object, max_depth, 508 status = acpi_ns_walk_namespace(type, start_object, max_depth,
504 ACPI_NS_WALK_UNLOCK, user_function, 509 ACPI_NS_WALK_UNLOCK, pre_order_visit,
505 context, return_value); 510 post_order_visit, context,
511 return_value);
506 512
507 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 513 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
508 514
@@ -546,7 +552,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
546 return (status); 552 return (status);
547 } 553 }
548 554
549 node = acpi_ns_map_handle_to_node(obj_handle); 555 node = acpi_ns_validate_handle(obj_handle);
550 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 556 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
551 if (ACPI_FAILURE(status)) { 557 if (ACPI_FAILURE(status)) {
552 return (status); 558 return (status);
@@ -556,25 +562,20 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
556 return (AE_BAD_PARAMETER); 562 return (AE_BAD_PARAMETER);
557 } 563 }
558 564
559 /* Run _STA to determine if device is present */ 565 /*
560 566 * First, filter based on the device HID and CID.
561 status = acpi_ut_execute_STA(node, &flags); 567 *
562 if (ACPI_FAILURE(status)) { 568 * 01/2010: For this case where a specific HID is requested, we don't
563 return (AE_CTRL_DEPTH); 569 * want to run _STA until we have an actual HID match. Thus, we will
564 } 570 * not unnecessarily execute _STA on devices for which the caller
565 571 * doesn't care about. Previously, _STA was executed unconditionally
566 if (!(flags & ACPI_STA_DEVICE_PRESENT) && 572 * on all devices found here.
567 !(flags & ACPI_STA_DEVICE_FUNCTIONING)) { 573 *
568 /* 574 * A side-effect of this change is that now we will continue to search
569 * Don't examine the children of the device only when the 575 * for a matching HID even under device trees where the parent device
570 * device is neither present nor functional. See ACPI spec, 576 * would have returned a _STA that indicates it is not present or
571 * description of _STA for more information. 577 * not functioning (thus aborting the search on that branch).
572 */ 578 */
573 return (AE_CTRL_DEPTH);
574 }
575
576 /* Filter based on device HID & CID */
577
578 if (info->hid != NULL) { 579 if (info->hid != NULL) {
579 status = acpi_ut_execute_HID(node, &hid); 580 status = acpi_ut_execute_HID(node, &hid);
580 if (status == AE_NOT_FOUND) { 581 if (status == AE_NOT_FOUND) {
@@ -614,6 +615,25 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
614 } 615 }
615 } 616 }
616 617
618 /* Run _STA to determine if device is present */
619
620 status = acpi_ut_execute_STA(node, &flags);
621 if (ACPI_FAILURE(status)) {
622 return (AE_CTRL_DEPTH);
623 }
624
625 if (!(flags & ACPI_STA_DEVICE_PRESENT) &&
626 !(flags & ACPI_STA_DEVICE_FUNCTIONING)) {
627 /*
628 * Don't examine the children of the device only when the
629 * device is neither present nor functional. See ACPI spec,
630 * description of _STA for more information.
631 */
632 return (AE_CTRL_DEPTH);
633 }
634
635 /* We have a valid device, invoke the user function */
636
617 status = info->user_function(obj_handle, nesting_level, info->context, 637 status = info->user_function(obj_handle, nesting_level, info->context,
618 return_value); 638 return_value);
619 return (status); 639 return (status);
@@ -681,8 +701,8 @@ acpi_get_devices(const char *HID,
681 701
682 status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 702 status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
683 ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, 703 ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
684 acpi_ns_get_device_callback, &info, 704 acpi_ns_get_device_callback, NULL,
685 return_value); 705 &info, return_value);
686 706
687 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 707 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
688 return_ACPI_STATUS(status); 708 return_ACPI_STATUS(status);
@@ -723,7 +743,7 @@ acpi_attach_data(acpi_handle obj_handle,
723 743
724 /* Convert and validate the handle */ 744 /* Convert and validate the handle */
725 745
726 node = acpi_ns_map_handle_to_node(obj_handle); 746 node = acpi_ns_validate_handle(obj_handle);
727 if (!node) { 747 if (!node) {
728 status = AE_BAD_PARAMETER; 748 status = AE_BAD_PARAMETER;
729 goto unlock_and_exit; 749 goto unlock_and_exit;
@@ -769,7 +789,7 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler)
769 789
770 /* Convert and validate the handle */ 790 /* Convert and validate the handle */
771 791
772 node = acpi_ns_map_handle_to_node(obj_handle); 792 node = acpi_ns_validate_handle(obj_handle);
773 if (!node) { 793 if (!node) {
774 status = AE_BAD_PARAMETER; 794 status = AE_BAD_PARAMETER;
775 goto unlock_and_exit; 795 goto unlock_and_exit;
@@ -816,7 +836,7 @@ acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data)
816 836
817 /* Convert and validate the handle */ 837 /* Convert and validate the handle */
818 838
819 node = acpi_ns_map_handle_to_node(obj_handle); 839 node = acpi_ns_validate_handle(obj_handle);
820 if (!node) { 840 if (!node) {
821 status = AE_BAD_PARAMETER; 841 status = AE_BAD_PARAMETER;
822 goto unlock_and_exit; 842 goto unlock_and_exit;
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c
index ddc84af6336e..b01e45a415e3 100644
--- a/drivers/acpi/acpica/nsxfname.c
+++ b/drivers/acpi/acpica/nsxfname.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -93,7 +93,7 @@ acpi_get_handle(acpi_handle parent,
93 /* Convert a parent handle to a prefix node */ 93 /* Convert a parent handle to a prefix node */
94 94
95 if (parent) { 95 if (parent) {
96 prefix_node = acpi_ns_map_handle_to_node(parent); 96 prefix_node = acpi_ns_validate_handle(parent);
97 if (!prefix_node) { 97 if (!prefix_node) {
98 return (AE_BAD_PARAMETER); 98 return (AE_BAD_PARAMETER);
99 } 99 }
@@ -114,7 +114,7 @@ acpi_get_handle(acpi_handle parent,
114 114
115 if (!ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH)) { 115 if (!ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH)) {
116 *ret_handle = 116 *ret_handle =
117 acpi_ns_convert_entry_to_handle(acpi_gbl_root_node); 117 ACPI_CAST_PTR(acpi_handle, acpi_gbl_root_node);
118 return (AE_OK); 118 return (AE_OK);
119 } 119 }
120 } else if (!prefix_node) { 120 } else if (!prefix_node) {
@@ -129,7 +129,7 @@ acpi_get_handle(acpi_handle parent,
129 status = 129 status =
130 acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, &node); 130 acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, &node);
131 if (ACPI_SUCCESS(status)) { 131 if (ACPI_SUCCESS(status)) {
132 *ret_handle = acpi_ns_convert_entry_to_handle(node); 132 *ret_handle = ACPI_CAST_PTR(acpi_handle, node);
133 } 133 }
134 134
135 return (status); 135 return (status);
@@ -186,7 +186,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
186 return (status); 186 return (status);
187 } 187 }
188 188
189 node = acpi_ns_map_handle_to_node(handle); 189 node = acpi_ns_validate_handle(handle);
190 if (!node) { 190 if (!node) {
191 status = AE_BAD_PARAMETER; 191 status = AE_BAD_PARAMETER;
192 goto unlock_and_exit; 192 goto unlock_and_exit;
@@ -291,7 +291,7 @@ acpi_get_object_info(acpi_handle handle,
291 goto cleanup; 291 goto cleanup;
292 } 292 }
293 293
294 node = acpi_ns_map_handle_to_node(handle); 294 node = acpi_ns_validate_handle(handle);
295 if (!node) { 295 if (!node) {
296 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 296 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
297 return (AE_BAD_PARAMETER); 297 return (AE_BAD_PARAMETER);
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c
index 4071bad4458e..eafef24ea448 100644
--- a/drivers/acpi/acpica/nsxfobj.c
+++ b/drivers/acpi/acpica/nsxfobj.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -79,7 +79,7 @@ acpi_status acpi_get_id(acpi_handle handle, acpi_owner_id * ret_id)
79 79
80 /* Convert and validate the handle */ 80 /* Convert and validate the handle */
81 81
82 node = acpi_ns_map_handle_to_node(handle); 82 node = acpi_ns_validate_handle(handle);
83 if (!node) { 83 if (!node) {
84 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 84 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
85 return (AE_BAD_PARAMETER); 85 return (AE_BAD_PARAMETER);
@@ -132,7 +132,7 @@ acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type)
132 132
133 /* Convert and validate the handle */ 133 /* Convert and validate the handle */
134 134
135 node = acpi_ns_map_handle_to_node(handle); 135 node = acpi_ns_validate_handle(handle);
136 if (!node) { 136 if (!node) {
137 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 137 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
138 return (AE_BAD_PARAMETER); 138 return (AE_BAD_PARAMETER);
@@ -182,7 +182,7 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
182 182
183 /* Convert and validate the handle */ 183 /* Convert and validate the handle */
184 184
185 node = acpi_ns_map_handle_to_node(handle); 185 node = acpi_ns_validate_handle(handle);
186 if (!node) { 186 if (!node) {
187 status = AE_BAD_PARAMETER; 187 status = AE_BAD_PARAMETER;
188 goto unlock_and_exit; 188 goto unlock_and_exit;
@@ -191,7 +191,7 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
191 /* Get the parent entry */ 191 /* Get the parent entry */
192 192
193 parent_node = acpi_ns_get_parent_node(node); 193 parent_node = acpi_ns_get_parent_node(node);
194 *ret_handle = acpi_ns_convert_entry_to_handle(parent_node); 194 *ret_handle = ACPI_CAST_PTR(acpi_handle, parent_node);
195 195
196 /* Return exception if parent is null */ 196 /* Return exception if parent is null */
197 197
@@ -251,7 +251,7 @@ acpi_get_next_object(acpi_object_type type,
251 251
252 /* Start search at the beginning of the specified scope */ 252 /* Start search at the beginning of the specified scope */
253 253
254 parent_node = acpi_ns_map_handle_to_node(parent); 254 parent_node = acpi_ns_validate_handle(parent);
255 if (!parent_node) { 255 if (!parent_node) {
256 status = AE_BAD_PARAMETER; 256 status = AE_BAD_PARAMETER;
257 goto unlock_and_exit; 257 goto unlock_and_exit;
@@ -260,7 +260,7 @@ acpi_get_next_object(acpi_object_type type,
260 /* Non-null handle, ignore the parent */ 260 /* Non-null handle, ignore the parent */
261 /* Convert and validate the handle */ 261 /* Convert and validate the handle */
262 262
263 child_node = acpi_ns_map_handle_to_node(child); 263 child_node = acpi_ns_validate_handle(child);
264 if (!child_node) { 264 if (!child_node) {
265 status = AE_BAD_PARAMETER; 265 status = AE_BAD_PARAMETER;
266 goto unlock_and_exit; 266 goto unlock_and_exit;
@@ -276,7 +276,7 @@ acpi_get_next_object(acpi_object_type type,
276 } 276 }
277 277
278 if (ret_handle) { 278 if (ret_handle) {
279 *ret_handle = acpi_ns_convert_entry_to_handle(node); 279 *ret_handle = ACPI_CAST_PTR(acpi_handle, node);
280 } 280 }
281 281
282 unlock_and_exit: 282 unlock_and_exit:
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
index b161f3544b51..00493e108a01 100644
--- a/drivers/acpi/acpica/psargs.c
+++ b/drivers/acpi/acpica/psargs.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -403,7 +403,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
403 /* Get 1 byte from the AML stream */ 403 /* Get 1 byte from the AML stream */
404 404
405 opcode = AML_BYTE_OP; 405 opcode = AML_BYTE_OP;
406 arg->common.value.integer = (acpi_integer) * aml; 406 arg->common.value.integer = (u64) *aml;
407 length = 1; 407 length = 1;
408 break; 408 break;
409 409
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c
index cd7995b3aed4..59aabaeab1d3 100644
--- a/drivers/acpi/acpica/psloop.c
+++ b/drivers/acpi/acpica/psloop.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -87,7 +87,8 @@ acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
87 union acpi_parse_object *op, acpi_status status); 87 union acpi_parse_object *op, acpi_status status);
88 88
89static void 89static void
90acpi_ps_link_module_code(u8 *aml_start, u32 aml_length, acpi_owner_id owner_id); 90acpi_ps_link_module_code(union acpi_parse_object *parent_op,
91 u8 *aml_start, u32 aml_length, acpi_owner_id owner_id);
91 92
92/******************************************************************************* 93/*******************************************************************************
93 * 94 *
@@ -479,11 +480,14 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
479 */ 480 */
480 if (walk_state->pass_number == 481 if (walk_state->pass_number ==
481 ACPI_IMODE_LOAD_PASS1) { 482 ACPI_IMODE_LOAD_PASS1) {
482 acpi_ps_link_module_code(aml_op_start, 483 acpi_ps_link_module_code(op->common.
483 walk_state-> 484 parent,
485 aml_op_start,
486 (u32)
487 (walk_state->
484 parser_state. 488 parser_state.
485 pkg_end - 489 pkg_end -
486 aml_op_start, 490 aml_op_start),
487 walk_state-> 491 walk_state->
488 owner_id); 492 owner_id);
489 } 493 }
@@ -598,7 +602,8 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
598 * 602 *
599 * FUNCTION: acpi_ps_link_module_code 603 * FUNCTION: acpi_ps_link_module_code
600 * 604 *
601 * PARAMETERS: aml_start - Pointer to the AML 605 * PARAMETERS: parent_op - Parent parser op
606 * aml_start - Pointer to the AML
602 * aml_length - Length of executable AML 607 * aml_length - Length of executable AML
603 * owner_id - owner_id of module level code 608 * owner_id - owner_id of module level code
604 * 609 *
@@ -611,11 +616,13 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
611 ******************************************************************************/ 616 ******************************************************************************/
612 617
613static void 618static void
614acpi_ps_link_module_code(u8 *aml_start, u32 aml_length, acpi_owner_id owner_id) 619acpi_ps_link_module_code(union acpi_parse_object *parent_op,
620 u8 *aml_start, u32 aml_length, acpi_owner_id owner_id)
615{ 621{
616 union acpi_operand_object *prev; 622 union acpi_operand_object *prev;
617 union acpi_operand_object *next; 623 union acpi_operand_object *next;
618 union acpi_operand_object *method_obj; 624 union acpi_operand_object *method_obj;
625 struct acpi_namespace_node *parent_node;
619 626
620 /* Get the tail of the list */ 627 /* Get the tail of the list */
621 628
@@ -639,11 +646,24 @@ acpi_ps_link_module_code(u8 *aml_start, u32 aml_length, acpi_owner_id owner_id)
639 return; 646 return;
640 } 647 }
641 648
649 if (parent_op->common.node) {
650 parent_node = parent_op->common.node;
651 } else {
652 parent_node = acpi_gbl_root_node;
653 }
654
642 method_obj->method.aml_start = aml_start; 655 method_obj->method.aml_start = aml_start;
643 method_obj->method.aml_length = aml_length; 656 method_obj->method.aml_length = aml_length;
644 method_obj->method.owner_id = owner_id; 657 method_obj->method.owner_id = owner_id;
645 method_obj->method.flags |= AOPOBJ_MODULE_LEVEL; 658 method_obj->method.flags |= AOPOBJ_MODULE_LEVEL;
646 659
660 /*
661 * Save the parent node in next_object. This is cheating, but we
662 * don't want to expand the method object.
663 */
664 method_obj->method.next_object =
665 ACPI_CAST_PTR(union acpi_operand_object, parent_node);
666
647 if (!prev) { 667 if (!prev) {
648 acpi_gbl_module_code_list = method_obj; 668 acpi_gbl_module_code_list = method_obj;
649 } else { 669 } else {
diff --git a/drivers/acpi/acpica/psopcode.c b/drivers/acpi/acpica/psopcode.c
index 3bc3a60194d6..2b0c3be2b1b8 100644
--- a/drivers/acpi/acpica/psopcode.c
+++ b/drivers/acpi/acpica/psopcode.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c
index 70838e9b608c..8d81542194d4 100644
--- a/drivers/acpi/acpica/psparse.c
+++ b/drivers/acpi/acpica/psparse.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -610,17 +610,13 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
610 implicit_return_obj) { 610 implicit_return_obj) {
611 previous_walk_state-> 611 previous_walk_state->
612 implicit_return_obj = 612 implicit_return_obj =
613 acpi_ut_create_internal_object 613 acpi_ut_create_integer_object
614 (ACPI_TYPE_INTEGER); 614 ((u64) 0);
615 if (!previous_walk_state-> 615 if (!previous_walk_state->
616 implicit_return_obj) { 616 implicit_return_obj) {
617 return_ACPI_STATUS 617 return_ACPI_STATUS
618 (AE_NO_MEMORY); 618 (AE_NO_MEMORY);
619 } 619 }
620
621 previous_walk_state->
622 implicit_return_obj->
623 integer.value = 0;
624 } 620 }
625 621
626 /* Restart the calling control method */ 622 /* Restart the calling control method */
diff --git a/drivers/acpi/acpica/psscope.c b/drivers/acpi/acpica/psscope.c
index 2feca5ca9581..40e2b279ea12 100644
--- a/drivers/acpi/acpica/psscope.c
+++ b/drivers/acpi/acpica/psscope.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/pstree.c b/drivers/acpi/acpica/pstree.c
index 4d3389118ec3..d4b970c3630b 100644
--- a/drivers/acpi/acpica/pstree.c
+++ b/drivers/acpi/acpica/pstree.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c
index e636e078ad3d..fe29eee5adb1 100644
--- a/drivers/acpi/acpica/psutils.c
+++ b/drivers/acpi/acpica/psutils.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/pswalk.c b/drivers/acpi/acpica/pswalk.c
index 78b8b791f2ae..8abb9629443d 100644
--- a/drivers/acpi/acpica/pswalk.c
+++ b/drivers/acpi/acpica/pswalk.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c
index dd9731c29a79..6064dd4e94c2 100644
--- a/drivers/acpi/acpica/psxface.c
+++ b/drivers/acpi/acpica/psxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -287,7 +287,8 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
287 /* Invoke an internal method if necessary */ 287 /* Invoke an internal method if necessary */
288 288
289 if (info->obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { 289 if (info->obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) {
290 status = info->obj_desc->method.implementation(walk_state); 290 status =
291 info->obj_desc->method.extra.implementation(walk_state);
291 info->return_object = walk_state->return_desc; 292 info->return_object = walk_state->return_desc;
292 293
293 /* Cleanup states */ 294 /* Cleanup states */
@@ -306,14 +307,12 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
306 */ 307 */
307 if (acpi_gbl_enable_interpreter_slack) { 308 if (acpi_gbl_enable_interpreter_slack) {
308 walk_state->implicit_return_obj = 309 walk_state->implicit_return_obj =
309 acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 310 acpi_ut_create_integer_object((u64) 0);
310 if (!walk_state->implicit_return_obj) { 311 if (!walk_state->implicit_return_obj) {
311 status = AE_NO_MEMORY; 312 status = AE_NO_MEMORY;
312 acpi_ds_delete_walk_state(walk_state); 313 acpi_ds_delete_walk_state(walk_state);
313 goto cleanup; 314 goto cleanup;
314 } 315 }
315
316 walk_state->implicit_return_obj->integer.value = 0;
317 } 316 }
318 317
319 /* Parse the AML */ 318 /* Parse the AML */
diff --git a/drivers/acpi/acpica/rsaddr.c b/drivers/acpi/acpica/rsaddr.c
index 1e437bfd8db5..226c806ae986 100644
--- a/drivers/acpi/acpica/rsaddr.c
+++ b/drivers/acpi/acpica/rsaddr.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c
index 3c4dcc3d1069..d6ebf7ec622d 100644
--- a/drivers/acpi/acpica/rscalc.c
+++ b/drivers/acpi/acpica/rscalc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c
index a3c23d686d5f..f2ee3b548609 100644
--- a/drivers/acpi/acpica/rscreate.c
+++ b/drivers/acpi/acpica/rscreate.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -182,7 +182,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
182 182
183 /* 183 /*
184 * Loop through the ACPI_INTERNAL_OBJECTS - Each object should be a 184 * Loop through the ACPI_INTERNAL_OBJECTS - Each object should be a
185 * package that in turn contains an acpi_integer Address, a u8 Pin, 185 * package that in turn contains an u64 Address, a u8 Pin,
186 * 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;
diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c
index 3f0ca5a12d34..f859b0386fe4 100644
--- a/drivers/acpi/acpica/rsdump.c
+++ b/drivers/acpi/acpica/rsdump.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsinfo.c b/drivers/acpi/acpica/rsinfo.c
index 77b25fdb459c..1fd868b964fd 100644
--- a/drivers/acpi/acpica/rsinfo.c
+++ b/drivers/acpi/acpica/rsinfo.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsio.c b/drivers/acpi/acpica/rsio.c
index 35a49aa95609..33bff17c0bbc 100644
--- a/drivers/acpi/acpica/rsio.c
+++ b/drivers/acpi/acpica/rsio.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsirq.c b/drivers/acpi/acpica/rsirq.c
index 2e0256983aa6..545da40d7fa7 100644
--- a/drivers/acpi/acpica/rsirq.c
+++ b/drivers/acpi/acpica/rsirq.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c
index 1b1dbc69f087..fd057c72d252 100644
--- a/drivers/acpi/acpica/rslist.c
+++ b/drivers/acpi/acpica/rslist.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsmemory.c b/drivers/acpi/acpica/rsmemory.c
index ddc76cebdc92..887b8ba8c432 100644
--- a/drivers/acpi/acpica/rsmemory.c
+++ b/drivers/acpi/acpica/rsmemory.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsmisc.c b/drivers/acpi/acpica/rsmisc.c
index 5bc49a553284..07de352fa443 100644
--- a/drivers/acpi/acpica/rsmisc.c
+++ b/drivers/acpi/acpica/rsmisc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c
index bc03d5966829..22cfcfbd9fff 100644
--- a/drivers/acpi/acpica/rsutils.c
+++ b/drivers/acpi/acpica/rsutils.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c
index 395212bcd19b..9f6a6e7e1c8e 100644
--- a/drivers/acpi/acpica/rsxface.c
+++ b/drivers/acpi/acpica/rsxface.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -104,7 +104,7 @@ acpi_rs_validate_parameters(acpi_handle device_handle,
104 return_ACPI_STATUS(AE_BAD_PARAMETER); 104 return_ACPI_STATUS(AE_BAD_PARAMETER);
105 } 105 }
106 106
107 node = acpi_ns_map_handle_to_node(device_handle); 107 node = acpi_ns_validate_handle(device_handle);
108 if (!node) { 108 if (!node) {
109 return_ACPI_STATUS(AE_BAD_PARAMETER); 109 return_ACPI_STATUS(AE_BAD_PARAMETER);
110 } 110 }
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index c016335fb759..f43fbe0fc3fc 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c
index 1054dfd49207..e252180ce61c 100644
--- a/drivers/acpi/acpica/tbfind.c
+++ b/drivers/acpi/acpica/tbfind.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index 63e82329a9e8..7ec02b0f69e0 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index 1f15497f00d1..02723a9fb10c 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index a88f02bd6c94..5217a6159a31 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2008, Intel Corp. 9 * Copyright (C) 2000 - 2010, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c
index 85ea834199e2..dda6e8c497d3 100644
--- a/drivers/acpi/acpica/tbxfroot.c
+++ b/drivers/acpi/acpica/tbxfroot.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c
index 7580f6b3069e..3d706b8fd449 100644
--- a/drivers/acpi/acpica/utalloc.c
+++ b/drivers/acpi/acpica/utalloc.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c
index 0f0c64bf8ac9..97ec3621e71d 100644
--- a/drivers/acpi/acpica/utcopy.c
+++ b/drivers/acpi/acpica/utcopy.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -323,11 +323,11 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type,
323 * RETURN: Status 323 * RETURN: Status
324 * 324 *
325 * DESCRIPTION: This function is called to place a package object in a user 325 * DESCRIPTION: This function is called to place a package object in a user
326 * buffer. A package object by definition contains other objects. 326 * buffer. A package object by definition contains other objects.
327 * 327 *
328 * The buffer is assumed to have sufficient space for the object. 328 * The buffer is assumed to have sufficient space for the object.
329 * The caller must have verified the buffer length needed using the 329 * The caller must have verified the buffer length needed using
330 * acpi_ut_get_object_size function before calling this function. 330 * the acpi_ut_get_object_size function before calling this function.
331 * 331 *
332 ******************************************************************************/ 332 ******************************************************************************/
333 333
@@ -382,12 +382,12 @@ acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
382 * FUNCTION: acpi_ut_copy_iobject_to_eobject 382 * FUNCTION: acpi_ut_copy_iobject_to_eobject
383 * 383 *
384 * PARAMETERS: internal_object - The internal object to be converted 384 * PARAMETERS: internal_object - The internal object to be converted
385 * buffer_ptr - Where the object is returned 385 * ret_buffer - Where the object is returned
386 * 386 *
387 * RETURN: Status 387 * RETURN: Status
388 * 388 *
389 * DESCRIPTION: This function is called to build an API object to be returned to 389 * DESCRIPTION: This function is called to build an API object to be returned
390 * the caller. 390 * to the caller.
391 * 391 *
392 ******************************************************************************/ 392 ******************************************************************************/
393 393
@@ -626,7 +626,7 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object,
626 * PARAMETERS: external_object - The external object to be converted 626 * PARAMETERS: external_object - The external object to be converted
627 * internal_object - Where the internal object is returned 627 * internal_object - Where the internal object is returned
628 * 628 *
629 * RETURN: Status - the status of the call 629 * RETURN: Status
630 * 630 *
631 * DESCRIPTION: Converts an external object to an internal object. 631 * DESCRIPTION: Converts an external object to an internal object.
632 * 632 *
@@ -665,7 +665,7 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object,
665 * 665 *
666 * RETURN: Status 666 * RETURN: Status
667 * 667 *
668 * DESCRIPTION: Simple copy of one internal object to another. Reference count 668 * DESCRIPTION: Simple copy of one internal object to another. Reference count
669 * of the destination object is preserved. 669 * of the destination object is preserved.
670 * 670 *
671 ******************************************************************************/ 671 ******************************************************************************/
@@ -897,10 +897,11 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type,
897 * 897 *
898 * FUNCTION: acpi_ut_copy_ipackage_to_ipackage 898 * FUNCTION: acpi_ut_copy_ipackage_to_ipackage
899 * 899 *
900 * PARAMETERS: *source_obj - Pointer to the source package object 900 * PARAMETERS: source_obj - Pointer to the source package object
901 * *dest_obj - Where the internal object is returned 901 * dest_obj - Where the internal object is returned
902 * walk_state - Current Walk state descriptor
902 * 903 *
903 * RETURN: Status - the status of the call 904 * RETURN: Status
904 * 905 *
905 * DESCRIPTION: This function is called to copy an internal package object 906 * DESCRIPTION: This function is called to copy an internal package object
906 * into another internal package object. 907 * into another internal package object.
@@ -953,9 +954,9 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
953 * 954 *
954 * FUNCTION: acpi_ut_copy_iobject_to_iobject 955 * FUNCTION: acpi_ut_copy_iobject_to_iobject
955 * 956 *
956 * PARAMETERS: walk_state - Current walk state 957 * PARAMETERS: source_desc - The internal object to be copied
957 * source_desc - The internal object to be copied
958 * dest_desc - Where the copied object is returned 958 * dest_desc - Where the copied object is returned
959 * walk_state - Current walk state
959 * 960 *
960 * RETURN: Status 961 * RETURN: Status
961 * 962 *
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c
index 527d729f6815..983510640059 100644
--- a/drivers/acpi/acpica/utdebug.c
+++ b/drivers/acpi/acpica/utdebug.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -460,8 +460,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_status_exit)
460void 460void
461acpi_ut_value_exit(u32 line_number, 461acpi_ut_value_exit(u32 line_number,
462 const char *function_name, 462 const char *function_name,
463 const char *module_name, 463 const char *module_name, u32 component_id, u64 value)
464 u32 component_id, acpi_integer value)
465{ 464{
466 465
467 acpi_debug_print(ACPI_LV_FUNCTIONS, 466 acpi_debug_print(ACPI_LV_FUNCTIONS,
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c
index 96e26e70c63d..16b51c69606a 100644
--- a/drivers/acpi/acpica/utdelete.c
+++ b/drivers/acpi/acpica/utdelete.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c
index 5d54e36ab453..7f5e734ce7f7 100644
--- a/drivers/acpi/acpica/uteval.c
+++ b/drivers/acpi/acpica/uteval.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -348,7 +348,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
348acpi_status 348acpi_status
349acpi_ut_evaluate_numeric_object(char *object_name, 349acpi_ut_evaluate_numeric_object(char *object_name,
350 struct acpi_namespace_node *device_node, 350 struct acpi_namespace_node *device_node,
351 acpi_integer *value) 351 u64 *value)
352{ 352{
353 union acpi_operand_object *obj_desc; 353 union acpi_operand_object *obj_desc;
354 acpi_status status; 354 acpi_status status;
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index 3f2c68f4e959..eda3e656c4af 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -234,7 +234,7 @@ static const char acpi_gbl_hex_to_ascii[] = {
234 * 234 *
235 ******************************************************************************/ 235 ******************************************************************************/
236 236
237char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position) 237char acpi_ut_hex_to_ascii_char(u64 integer, u32 position)
238{ 238{
239 239
240 return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); 240 return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]);
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c
index 52eaae404554..1397fadd0d4b 100644
--- a/drivers/acpi/acpica/utids.c
+++ b/drivers/acpi/acpica/utids.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2009, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c
index 9d0919ebf7b0..a39c93dac719 100644
--- a/drivers/acpi/acpica/utinit.c
+++ b/drivers/acpi/acpica/utinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utlock.c b/drivers/acpi/acpica/utlock.c
index 25e03120686d..b081cd46a15f 100644
--- a/drivers/acpi/acpica/utlock.c
+++ b/drivers/acpi/acpica/utlock.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2009, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c
index c9f682d640ef..35059a14eb72 100644
--- a/drivers/acpi/acpica/utmath.c
+++ b/drivers/acpi/acpica/utmath.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -70,9 +70,8 @@ ACPI_MODULE_NAME("utmath")
70 * 70 *
71 ******************************************************************************/ 71 ******************************************************************************/
72acpi_status 72acpi_status
73acpi_ut_short_divide(acpi_integer dividend, 73acpi_ut_short_divide(u64 dividend,
74 u32 divisor, 74 u32 divisor, u64 *out_quotient, u32 *out_remainder)
75 acpi_integer * out_quotient, u32 * out_remainder)
76{ 75{
77 union uint64_overlay dividend_ovl; 76 union uint64_overlay dividend_ovl;
78 union uint64_overlay quotient; 77 union uint64_overlay quotient;
@@ -126,9 +125,8 @@ acpi_ut_short_divide(acpi_integer dividend,
126 ******************************************************************************/ 125 ******************************************************************************/
127 126
128acpi_status 127acpi_status
129acpi_ut_divide(acpi_integer in_dividend, 128acpi_ut_divide(u64 in_dividend,
130 acpi_integer in_divisor, 129 u64 in_divisor, u64 *out_quotient, u64 *out_remainder)
131 acpi_integer * out_quotient, acpi_integer * out_remainder)
132{ 130{
133 union uint64_overlay dividend; 131 union uint64_overlay dividend;
134 union uint64_overlay divisor; 132 union uint64_overlay divisor;
@@ -199,9 +197,8 @@ acpi_ut_divide(acpi_integer in_dividend,
199 * The 64-bit remainder must be generated. 197 * The 64-bit remainder must be generated.
200 */ 198 */
201 partial1 = quotient.part.lo * divisor.part.hi; 199 partial1 = quotient.part.lo * divisor.part.hi;
202 partial2.full = 200 partial2.full = (u64) quotient.part.lo * divisor.part.lo;
203 (acpi_integer) quotient.part.lo * divisor.part.lo; 201 partial3.full = (u64) partial2.part.hi + partial1;
204 partial3.full = (acpi_integer) partial2.part.hi + partial1;
205 202
206 remainder.part.hi = partial3.part.lo; 203 remainder.part.hi = partial3.part.lo;
207 remainder.part.lo = partial2.part.lo; 204 remainder.part.lo = partial2.part.lo;
@@ -257,9 +254,8 @@ acpi_ut_divide(acpi_integer in_dividend,
257 * 254 *
258 ******************************************************************************/ 255 ******************************************************************************/
259acpi_status 256acpi_status
260acpi_ut_short_divide(acpi_integer in_dividend, 257acpi_ut_short_divide(u64 in_dividend,
261 u32 divisor, 258 u32 divisor, u64 *out_quotient, u32 *out_remainder)
262 acpi_integer * out_quotient, u32 * out_remainder)
263{ 259{
264 260
265 ACPI_FUNCTION_TRACE(ut_short_divide); 261 ACPI_FUNCTION_TRACE(ut_short_divide);
@@ -284,9 +280,8 @@ acpi_ut_short_divide(acpi_integer in_dividend,
284} 280}
285 281
286acpi_status 282acpi_status
287acpi_ut_divide(acpi_integer in_dividend, 283acpi_ut_divide(u64 in_dividend,
288 acpi_integer in_divisor, 284 u64 in_divisor, u64 *out_quotient, u64 *out_remainder)
289 acpi_integer * out_quotient, acpi_integer * out_remainder)
290{ 285{
291 ACPI_FUNCTION_TRACE(ut_divide); 286 ACPI_FUNCTION_TRACE(ut_divide);
292 287
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index 61f6315fce9f..32982e2ac384 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -724,13 +724,12 @@ acpi_name acpi_ut_repair_name(char *name)
724 * 724 *
725 ******************************************************************************/ 725 ******************************************************************************/
726 726
727acpi_status 727acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer)
728acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
729{ 728{
730 u32 this_digit = 0; 729 u32 this_digit = 0;
731 acpi_integer return_value = 0; 730 u64 return_value = 0;
732 acpi_integer quotient; 731 u64 quotient;
733 acpi_integer dividend; 732 u64 dividend;
734 u32 to_integer_op = (base == ACPI_ANY_BASE); 733 u32 to_integer_op = (base == ACPI_ANY_BASE);
735 u32 mode32 = (acpi_gbl_integer_byte_width == 4); 734 u32 mode32 = (acpi_gbl_integer_byte_width == 4);
736 u8 valid_digits = 0; 735 u8 valid_digits = 0;
@@ -844,9 +843,8 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
844 843
845 /* Divide the digit into the correct position */ 844 /* Divide the digit into the correct position */
846 845
847 (void) 846 (void)acpi_ut_short_divide((dividend - (u64) this_digit),
848 acpi_ut_short_divide((dividend - (acpi_integer) this_digit), 847 base, &quotient, NULL);
849 base, &quotient, NULL);
850 848
851 if (return_value > quotient) { 849 if (return_value > quotient) {
852 if (to_integer_op) { 850 if (to_integer_op) {
@@ -1161,3 +1159,45 @@ acpi_ut_predefined_warning(const char *module_name,
1161 ACPI_COMMON_MSG_SUFFIX; 1159 ACPI_COMMON_MSG_SUFFIX;
1162 va_end(args); 1160 va_end(args);
1163} 1161}
1162
1163/*******************************************************************************
1164 *
1165 * FUNCTION: acpi_ut_predefined_info
1166 *
1167 * PARAMETERS: module_name - Caller's module name (for error output)
1168 * line_number - Caller's line number (for error output)
1169 * Pathname - Full pathname to the node
1170 * node_flags - From Namespace node for the method/object
1171 * Format - Printf format string + additional args
1172 *
1173 * RETURN: None
1174 *
1175 * DESCRIPTION: Info messages for the predefined validation module. Messages
1176 * are only emitted the first time a problem with a particular
1177 * method/object is detected. This prevents a flood of
1178 * messages for methods that are repeatedly evaluated.
1179 *
1180 ******************************************************************************/
1181
1182void ACPI_INTERNAL_VAR_XFACE
1183acpi_ut_predefined_info(const char *module_name,
1184 u32 line_number,
1185 char *pathname, u8 node_flags, const char *format, ...)
1186{
1187 va_list args;
1188
1189 /*
1190 * Warning messages for this method/object will be disabled after the
1191 * first time a validation fails or an object is successfully repaired.
1192 */
1193 if (node_flags & ANOBJ_EVALUATED) {
1194 return;
1195 }
1196
1197 acpi_os_printf("ACPI Info for %s: ", pathname);
1198
1199 va_start(args, format);
1200 acpi_os_vprintf(format, args);
1201 ACPI_COMMON_MSG_SUFFIX;
1202 va_end(args);
1203}
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c
index 80bb65154117..55d014ed6d55 100644
--- a/drivers/acpi/acpica/utmutex.c
+++ b/drivers/acpi/acpica/utmutex.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -50,7 +50,7 @@ ACPI_MODULE_NAME("utmutex")
50/* Local prototypes */ 50/* Local prototypes */
51static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id); 51static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id);
52 52
53static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id); 53static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id);
54 54
55/******************************************************************************* 55/*******************************************************************************
56 * 56 *
@@ -114,7 +114,7 @@ void acpi_ut_mutex_terminate(void)
114 /* Delete each predefined mutex object */ 114 /* Delete each predefined mutex object */
115 115
116 for (i = 0; i < ACPI_NUM_MUTEX; i++) { 116 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
117 (void)acpi_ut_delete_mutex(i); 117 acpi_ut_delete_mutex(i);
118 } 118 }
119 119
120 /* Delete the spinlocks */ 120 /* Delete the spinlocks */
@@ -146,10 +146,6 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
146 146
147 ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id); 147 ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id);
148 148
149 if (mutex_id > ACPI_MAX_MUTEX) {
150 return_ACPI_STATUS(AE_BAD_PARAMETER);
151 }
152
153 if (!acpi_gbl_mutex_info[mutex_id].mutex) { 149 if (!acpi_gbl_mutex_info[mutex_id].mutex) {
154 status = 150 status =
155 acpi_os_create_mutex(&acpi_gbl_mutex_info[mutex_id].mutex); 151 acpi_os_create_mutex(&acpi_gbl_mutex_info[mutex_id].mutex);
@@ -173,21 +169,15 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
173 * 169 *
174 ******************************************************************************/ 170 ******************************************************************************/
175 171
176static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) 172static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
177{ 173{
178 174
179 ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); 175 ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id);
180 176
181 if (mutex_id > ACPI_MAX_MUTEX) {
182 return_ACPI_STATUS(AE_BAD_PARAMETER);
183 }
184
185 acpi_os_delete_mutex(acpi_gbl_mutex_info[mutex_id].mutex); 177 acpi_os_delete_mutex(acpi_gbl_mutex_info[mutex_id].mutex);
186 178
187 acpi_gbl_mutex_info[mutex_id].mutex = NULL; 179 acpi_gbl_mutex_info[mutex_id].mutex = NULL;
188 acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; 180 acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
189
190 return_ACPI_STATUS(AE_OK);
191} 181}
192 182
193/******************************************************************************* 183/*******************************************************************************
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
index 0207b625274a..3356f0cb0745 100644
--- a/drivers/acpi/acpica/utobject.c
+++ b/drivers/acpi/acpica/utobject.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -190,6 +190,35 @@ union acpi_operand_object *acpi_ut_create_package_object(u32 count)
190 190
191/******************************************************************************* 191/*******************************************************************************
192 * 192 *
193 * FUNCTION: acpi_ut_create_integer_object
194 *
195 * PARAMETERS: initial_value - Initial value for the integer
196 *
197 * RETURN: Pointer to a new Integer object, null on failure
198 *
199 * DESCRIPTION: Create an initialized integer object
200 *
201 ******************************************************************************/
202
203union acpi_operand_object *acpi_ut_create_integer_object(u64 initial_value)
204{
205 union acpi_operand_object *integer_desc;
206
207 ACPI_FUNCTION_TRACE(ut_create_integer_object);
208
209 /* Create and initialize a new integer object */
210
211 integer_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
212 if (!integer_desc) {
213 return_PTR(NULL);
214 }
215
216 integer_desc->integer.value = initial_value;
217 return_PTR(integer_desc);
218}
219
220/*******************************************************************************
221 *
193 * FUNCTION: acpi_ut_create_buffer_object 222 * FUNCTION: acpi_ut_create_buffer_object
194 * 223 *
195 * PARAMETERS: buffer_size - Size of buffer to be created 224 * PARAMETERS: buffer_size - Size of buffer to be created
diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c
index 91b7c00236f4..7965919000b1 100644
--- a/drivers/acpi/acpica/utresrc.c
+++ b/drivers/acpi/acpica/utresrc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c
index 0440c958f5a4..d35d109b8da2 100644
--- a/drivers/acpi/acpica/utstate.c
+++ b/drivers/acpi/acpica/utstate.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c
index b1f5f680bc78..db9d8ca57987 100644
--- a/drivers/acpi/acpica/utxface.c
+++ b/drivers/acpi/acpica/utxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2010, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without