aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r--drivers/acpi/acpica/Makefile3
-rw-r--r--drivers/acpi/acpica/acdebug.h94
-rw-r--r--drivers/acpi/acpica/acdispat.h11
-rw-r--r--drivers/acpi/acpica/acevents.h6
-rw-r--r--drivers/acpi/acpica/acglobal.h73
-rw-r--r--drivers/acpi/acpica/aclocal.h16
-rw-r--r--drivers/acpi/acpica/acmacros.h163
-rw-r--r--drivers/acpi/acpica/acobject.h7
-rw-r--r--drivers/acpi/acpica/acopcode.h6
-rw-r--r--drivers/acpi/acpica/acparser.h3
-rw-r--r--drivers/acpi/acpica/acpredef.h11
-rw-r--r--drivers/acpi/acpica/acstruct.h2
-rw-r--r--drivers/acpi/acpica/acutils.h58
-rw-r--r--drivers/acpi/acpica/amlresrc.h1
-rw-r--r--drivers/acpi/acpica/dscontrol.c2
-rw-r--r--drivers/acpi/acpica/dsfield.c2
-rw-r--r--drivers/acpi/acpica/dsmethod.c6
-rw-r--r--drivers/acpi/acpica/dsmthdat.c14
-rw-r--r--drivers/acpi/acpica/dsobject.c6
-rw-r--r--drivers/acpi/acpica/dsopcode.c3
-rw-r--r--drivers/acpi/acpica/dsutils.c33
-rw-r--r--drivers/acpi/acpica/dswexec.c10
-rw-r--r--drivers/acpi/acpica/dswload2.c4
-rw-r--r--drivers/acpi/acpica/dswstate.c26
-rw-r--r--drivers/acpi/acpica/evgpe.c20
-rw-r--r--drivers/acpi/acpica/evgpeblk.c3
-rw-r--r--drivers/acpi/acpica/evgpeutil.c3
-rw-r--r--drivers/acpi/acpica/evrgnini.c7
-rw-r--r--drivers/acpi/acpica/evxface.c2
-rw-r--r--drivers/acpi/acpica/evxfgpe.c13
-rw-r--r--drivers/acpi/acpica/exconvrt.c4
-rw-r--r--drivers/acpi/acpica/excreate.c9
-rw-r--r--drivers/acpi/acpica/exdebug.c10
-rw-r--r--drivers/acpi/acpica/exdump.c20
-rw-r--r--drivers/acpi/acpica/exfield.c4
-rw-r--r--drivers/acpi/acpica/exfldio.c15
-rw-r--r--drivers/acpi/acpica/exmisc.c5
-rw-r--r--drivers/acpi/acpica/exmutex.c9
-rw-r--r--drivers/acpi/acpica/exnames.c9
-rw-r--r--drivers/acpi/acpica/exoparg1.c11
-rw-r--r--drivers/acpi/acpica/exoparg2.c2
-rw-r--r--drivers/acpi/acpica/exoparg3.c3
-rw-r--r--drivers/acpi/acpica/exoparg6.c5
-rw-r--r--drivers/acpi/acpica/exprep.c13
-rw-r--r--drivers/acpi/acpica/exregion.c3
-rw-r--r--drivers/acpi/acpica/exresnte.c9
-rw-r--r--drivers/acpi/acpica/exresolv.c3
-rw-r--r--drivers/acpi/acpica/exresop.c8
-rw-r--r--drivers/acpi/acpica/exstore.c4
-rw-r--r--drivers/acpi/acpica/exstoren.c11
-rw-r--r--drivers/acpi/acpica/exstorob.c5
-rw-r--r--drivers/acpi/acpica/exsystem.c9
-rw-r--r--drivers/acpi/acpica/exutils.c5
-rw-r--r--drivers/acpi/acpica/hwacpi.c3
-rw-r--r--drivers/acpi/acpica/hwgpe.c4
-rw-r--r--drivers/acpi/acpica/hwpci.c4
-rw-r--r--drivers/acpi/acpica/hwregs.c1
-rw-r--r--drivers/acpi/acpica/hwtimer.c6
-rw-r--r--drivers/acpi/acpica/hwvalid.c1
-rw-r--r--drivers/acpi/acpica/hwxface.c1
-rw-r--r--drivers/acpi/acpica/hwxfsleep.c12
-rw-r--r--drivers/acpi/acpica/nsaccess.c7
-rw-r--r--drivers/acpi/acpica/nsalloc.c4
-rw-r--r--drivers/acpi/acpica/nsdump.c10
-rw-r--r--drivers/acpi/acpica/nsinit.c4
-rw-r--r--drivers/acpi/acpica/nsload.c10
-rw-r--r--drivers/acpi/acpica/nsnames.c2
-rw-r--r--drivers/acpi/acpica/nsobject.c8
-rw-r--r--drivers/acpi/acpica/nsparse.c8
-rw-r--r--drivers/acpi/acpica/nssearch.c17
-rw-r--r--drivers/acpi/acpica/nsutils.c18
-rw-r--r--drivers/acpi/acpica/nswalk.c10
-rw-r--r--drivers/acpi/acpica/nsxfeval.c20
-rw-r--r--drivers/acpi/acpica/nsxfname.c66
-rw-r--r--drivers/acpi/acpica/nsxfobj.c4
-rw-r--r--drivers/acpi/acpica/psargs.c8
-rw-r--r--drivers/acpi/acpica/psloop.c61
-rw-r--r--drivers/acpi/acpica/psopcode.c29
-rw-r--r--drivers/acpi/acpica/psparse.c13
-rw-r--r--drivers/acpi/acpica/psutils.c4
-rw-r--r--drivers/acpi/acpica/rscalc.c14
-rw-r--r--drivers/acpi/acpica/rslist.c4
-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.c4
-rw-r--r--drivers/acpi/acpica/tbxfload.c2
-rw-r--r--drivers/acpi/acpica/tbxfroot.c3
-rw-r--r--drivers/acpi/acpica/utcache.c323
-rw-r--r--drivers/acpi/acpica/utclib.c749
-rw-r--r--drivers/acpi/acpica/utdebug.c37
-rw-r--r--drivers/acpi/acpica/utids.c104
-rw-r--r--drivers/acpi/acpica/utmath.c2
-rw-r--r--drivers/acpi/acpica/utmisc.c150
-rw-r--r--drivers/acpi/acpica/utmutex.c14
-rw-r--r--drivers/acpi/acpica/utobject.c8
-rw-r--r--drivers/acpi/acpica/utstate.c2
-rw-r--r--drivers/acpi/acpica/uttrack.c692
-rw-r--r--drivers/acpi/acpica/utxface.c5
-rw-r--r--drivers/acpi/acpica/utxferror.c2
100 files changed, 2619 insertions, 621 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 7f1d40797e80..c8bc24bd1f72 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -161,3 +161,6 @@ acpi-y += \
161 utxfinit.o \ 161 utxfinit.o \
162 utxferror.o \ 162 utxferror.o \
163 utxfmutex.o 163 utxfmutex.o
164
165acpi-$(ACPI_FUTURE_USAGE) += uttrack.o utcache.o utclib.o
166
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index 5e8abb07724f..432a318c9ed1 100644
--- a/drivers/acpi/acpica/acdebug.h
+++ b/drivers/acpi/acpica/acdebug.h
@@ -44,17 +44,28 @@
44#ifndef __ACDEBUG_H__ 44#ifndef __ACDEBUG_H__
45#define __ACDEBUG_H__ 45#define __ACDEBUG_H__
46 46
47#define ACPI_DEBUG_BUFFER_SIZE 4196 47#define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */
48 48
49struct command_info { 49struct acpi_db_command_info {
50 char *name; /* Command Name */ 50 char *name; /* Command Name */
51 u8 min_args; /* Minimum arguments required */ 51 u8 min_args; /* Minimum arguments required */
52}; 52};
53 53
54struct argument_info { 54struct acpi_db_command_help {
55 u8 line_count; /* Number of help lines */
56 char *invocation; /* Command Invocation */
57 char *description; /* Command Description */
58};
59
60struct acpi_db_argument_info {
55 char *name; /* Argument Name */ 61 char *name; /* Argument Name */
56}; 62};
57 63
64struct acpi_db_execute_walk {
65 u32 count;
66 u32 max_count;
67};
68
58#define PARAM_LIST(pl) pl 69#define PARAM_LIST(pl) pl
59#define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose) 70#define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose)
60#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ 71#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\
@@ -77,59 +88,71 @@ acpi_db_single_step(struct acpi_walk_state *walk_state,
77/* 88/*
78 * dbcmds - debug commands and output routines 89 * dbcmds - debug commands and output routines
79 */ 90 */
80acpi_status acpi_db_disassemble_method(char *name); 91struct acpi_namespace_node *acpi_db_convert_to_node(char *in_string);
81 92
82void acpi_db_display_table_info(char *table_arg); 93void acpi_db_display_table_info(char *table_arg);
83 94
84void acpi_db_unload_acpi_table(char *table_arg, char *instance_arg); 95void acpi_db_display_template(char *buffer_arg);
85 96
86void 97void acpi_db_unload_acpi_table(char *name);
87acpi_db_set_method_breakpoint(char *location,
88 struct acpi_walk_state *walk_state,
89 union acpi_parse_object *op);
90 98
91void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op); 99void acpi_db_send_notify(char *name, u32 value);
92 100
93void acpi_db_get_bus_info(void); 101void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg);
94 102
95void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op); 103acpi_status acpi_db_sleep(char *object_arg);
96 104
97void acpi_db_dump_namespace(char *start_arg, char *depth_arg); 105void acpi_db_display_locks(void);
98 106
99void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg); 107void acpi_db_display_resources(char *object_arg);
100 108
101void acpi_db_send_notify(char *name, u32 value); 109ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_display_gpes(void))
110
111void acpi_db_display_handlers(void);
112
113ACPI_HW_DEPENDENT_RETURN_VOID(void
114 acpi_db_generate_gpe(char *gpe_arg,
115 char *block_arg))
116
117/*
118 * dbmethod - control method commands
119 */
120void
121acpi_db_set_method_breakpoint(char *location,
122 struct acpi_walk_state *walk_state,
123 union acpi_parse_object *op);
124
125void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op);
102 126
103void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg); 127void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg);
104 128
105acpi_status 129acpi_status acpi_db_disassemble_method(char *name);
106acpi_db_display_objects(char *obj_type_arg, char *display_count_arg);
107 130
108void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg); 131void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op);
109 132
110acpi_status acpi_db_find_name_in_namespace(char *name_arg); 133void acpi_db_batch_execute(char *count_arg);
111 134
135/*
136 * dbnames - namespace commands
137 */
112void acpi_db_set_scope(char *name); 138void acpi_db_set_scope(char *name);
113 139
114ACPI_HW_DEPENDENT_RETURN_OK(acpi_status acpi_db_sleep(char *object_arg)) 140void acpi_db_dump_namespace(char *start_arg, char *depth_arg);
115 141
116void acpi_db_find_references(char *object_arg); 142void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg);
117 143
118void acpi_db_display_locks(void); 144acpi_status acpi_db_find_name_in_namespace(char *name_arg);
119 145
120void acpi_db_display_resources(char *object_arg); 146void acpi_db_check_predefined_names(void);
121 147
122ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_display_gpes(void)) 148acpi_status
149acpi_db_display_objects(char *obj_type_arg, char *display_count_arg);
123 150
124void acpi_db_check_integrity(void); 151void acpi_db_check_integrity(void);
125 152
126ACPI_HW_DEPENDENT_RETURN_VOID(void 153void acpi_db_find_references(char *object_arg);
127 acpi_db_generate_gpe(char *gpe_arg,
128 char *block_arg))
129
130void acpi_db_check_predefined_names(void);
131 154
132void acpi_db_batch_execute(void); 155void acpi_db_get_bus_info(void);
133 156
134/* 157/*
135 * dbdisply - debug display commands 158 * dbdisply - debug display commands
@@ -161,7 +184,8 @@ acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
161/* 184/*
162 * dbexec - debugger control method execution 185 * dbexec - debugger control method execution
163 */ 186 */
164void acpi_db_execute(char *name, char **args, u32 flags); 187void
188acpi_db_execute(char *name, char **args, acpi_object_type * types, u32 flags);
165 189
166void 190void
167acpi_db_create_execution_threads(char *num_threads_arg, 191acpi_db_create_execution_threads(char *num_threads_arg,
@@ -175,7 +199,8 @@ u32 acpi_db_get_cache_info(struct acpi_memory_list *cache);
175 * dbfileio - Debugger file I/O commands 199 * dbfileio - Debugger file I/O commands
176 */ 200 */
177acpi_object_type 201acpi_object_type
178acpi_db_match_argument(char *user_argument, struct argument_info *arguments); 202acpi_db_match_argument(char *user_argument,
203 struct acpi_db_argument_info *arguments);
179 204
180void acpi_db_close_debug_file(void); 205void acpi_db_close_debug_file(void);
181 206
@@ -208,6 +233,11 @@ acpi_db_command_dispatch(char *input_buffer,
208 233
209void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context); 234void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context);
210 235
236acpi_status acpi_db_user_commands(char prompt, union acpi_parse_object *op);
237
238char *acpi_db_get_next_token(char *string,
239 char **next, acpi_object_type * return_type);
240
211/* 241/*
212 * dbstats - Generation and display of ACPI table statistics 242 * dbstats - Generation and display of ACPI table statistics
213 */ 243 */
diff --git a/drivers/acpi/acpica/acdispat.h b/drivers/acpi/acpica/acdispat.h
index 5935ba6707e2..ed33ebcdaebe 100644
--- a/drivers/acpi/acpica/acdispat.h
+++ b/drivers/acpi/acpica/acdispat.h
@@ -309,10 +309,13 @@ acpi_ds_obj_stack_push(void *object, struct acpi_walk_state *walk_state);
309acpi_status 309acpi_status
310acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state); 310acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state);
311 311
312struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union acpi_parse_object 312struct acpi_walk_state * acpi_ds_create_walk_state(acpi_owner_id owner_id,
313 *origin, union acpi_operand_object 313 union acpi_parse_object
314 *mth_desc, struct acpi_thread_state 314 *origin,
315 *thread); 315 union acpi_operand_object
316 *mth_desc,
317 struct acpi_thread_state
318 *thread);
316 319
317acpi_status 320acpi_status
318acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, 321acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h
index c0a43b38c6a3..e975c6720448 100644
--- a/drivers/acpi/acpica/acevents.h
+++ b/drivers/acpi/acpica/acevents.h
@@ -84,9 +84,11 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info);
84 84
85acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info); 85acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
86 86
87acpi_status acpi_ev_add_gpe_reference(struct acpi_gpe_event_info *gpe_event_info); 87acpi_status
88acpi_ev_add_gpe_reference(struct acpi_gpe_event_info *gpe_event_info);
88 89
89acpi_status acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info); 90acpi_status
91acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info);
90 92
91struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, 93struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
92 u32 gpe_number); 94 u32 gpe_number);
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index ce79100fb5eb..64472e4ec329 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -70,7 +70,7 @@
70 70
71/* 71/*
72 * Enable "slack" in the AML interpreter? Default is FALSE, and the 72 * Enable "slack" in the AML interpreter? Default is FALSE, and the
73 * interpreter strictly follows the ACPI specification. Setting to TRUE 73 * interpreter strictly follows the ACPI specification. Setting to TRUE
74 * allows the interpreter to ignore certain errors and/or bad AML constructs. 74 * allows the interpreter to ignore certain errors and/or bad AML constructs.
75 * 75 *
76 * Currently, these features are enabled by this flag: 76 * Currently, these features are enabled by this flag:
@@ -155,26 +155,6 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_no_resource_disassembly, FALSE);
155 155
156/***************************************************************************** 156/*****************************************************************************
157 * 157 *
158 * Debug support
159 *
160 ****************************************************************************/
161
162/* Procedure nesting level for debug output */
163
164extern u32 acpi_gbl_nesting_level;
165
166ACPI_EXTERN u32 acpi_gpe_count;
167ACPI_EXTERN u32 acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS];
168
169/* Support for dynamic control method tracing mechanism */
170
171ACPI_EXTERN u32 acpi_gbl_original_dbg_level;
172ACPI_EXTERN u32 acpi_gbl_original_dbg_layer;
173ACPI_EXTERN u32 acpi_gbl_trace_dbg_level;
174ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer;
175
176/*****************************************************************************
177 *
178 * ACPI Table globals 158 * ACPI Table globals
179 * 159 *
180 ****************************************************************************/ 160 ****************************************************************************/
@@ -259,15 +239,6 @@ ACPI_EXTERN acpi_spinlock acpi_gbl_hardware_lock; /* For ACPI H/W except GPE reg
259 * 239 *
260 ****************************************************************************/ 240 ****************************************************************************/
261 241
262#ifdef ACPI_DBG_TRACK_ALLOCATIONS
263
264/* Lists for tracking memory allocations */
265
266ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list;
267ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
268ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats;
269#endif
270
271/* Object caches */ 242/* Object caches */
272 243
273ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache; 244ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache;
@@ -326,6 +297,15 @@ extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
326 297
327#endif 298#endif
328 299
300#ifdef ACPI_DBG_TRACK_ALLOCATIONS
301
302/* Lists for tracking memory allocations */
303
304ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list;
305ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
306ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats;
307#endif
308
329/***************************************************************************** 309/*****************************************************************************
330 * 310 *
331 * Namespace globals 311 * Namespace globals
@@ -396,13 +376,35 @@ ACPI_EXTERN struct acpi_gpe_block_info
396#if (!ACPI_REDUCED_HARDWARE) 376#if (!ACPI_REDUCED_HARDWARE)
397 377
398ACPI_EXTERN u8 acpi_gbl_all_gpes_initialized; 378ACPI_EXTERN u8 acpi_gbl_all_gpes_initialized;
399ACPI_EXTERN ACPI_GBL_EVENT_HANDLER acpi_gbl_global_event_handler; 379ACPI_EXTERN acpi_gbl_event_handler acpi_gbl_global_event_handler;
400ACPI_EXTERN void *acpi_gbl_global_event_handler_context; 380ACPI_EXTERN void *acpi_gbl_global_event_handler_context;
401 381
402#endif /* !ACPI_REDUCED_HARDWARE */ 382#endif /* !ACPI_REDUCED_HARDWARE */
403 383
404/***************************************************************************** 384/*****************************************************************************
405 * 385 *
386 * Debug support
387 *
388 ****************************************************************************/
389
390/* Procedure nesting level for debug output */
391
392extern u32 acpi_gbl_nesting_level;
393
394/* Event counters */
395
396ACPI_EXTERN u32 acpi_gpe_count;
397ACPI_EXTERN u32 acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS];
398
399/* Support for dynamic control method tracing mechanism */
400
401ACPI_EXTERN u32 acpi_gbl_original_dbg_level;
402ACPI_EXTERN u32 acpi_gbl_original_dbg_layer;
403ACPI_EXTERN u32 acpi_gbl_trace_dbg_level;
404ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer;
405
406/*****************************************************************************
407 *
406 * Debugger globals 408 * Debugger globals
407 * 409 *
408 ****************************************************************************/ 410 ****************************************************************************/
@@ -426,10 +428,11 @@ ACPI_EXTERN u8 acpi_gbl_db_opt_stats;
426ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; 428ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods;
427 429
428ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]; 430ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS];
429ACPI_EXTERN char acpi_gbl_db_line_buf[80]; 431ACPI_EXTERN acpi_object_type acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS];
430ACPI_EXTERN char acpi_gbl_db_parsed_buf[80]; 432ACPI_EXTERN char acpi_gbl_db_line_buf[ACPI_DB_LINE_BUFFER_SIZE];
431ACPI_EXTERN char acpi_gbl_db_scope_buf[40]; 433ACPI_EXTERN char acpi_gbl_db_parsed_buf[ACPI_DB_LINE_BUFFER_SIZE];
432ACPI_EXTERN char acpi_gbl_db_debug_filename[40]; 434ACPI_EXTERN char acpi_gbl_db_scope_buf[80];
435ACPI_EXTERN char acpi_gbl_db_debug_filename[80];
433ACPI_EXTERN u8 acpi_gbl_db_output_to_file; 436ACPI_EXTERN u8 acpi_gbl_db_output_to_file;
434ACPI_EXTERN char *acpi_gbl_db_buffer; 437ACPI_EXTERN char *acpi_gbl_db_buffer;
435ACPI_EXTERN char *acpi_gbl_db_filename; 438ACPI_EXTERN char *acpi_gbl_db_filename;
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index c816ee675094..ff8bd0061e8b 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -262,10 +262,10 @@ struct acpi_create_field_info {
262}; 262};
263 263
264typedef 264typedef
265acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); 265acpi_status(*acpi_internal_method) (struct acpi_walk_state * walk_state);
266 266
267/* 267/*
268 * Bitmapped ACPI types. Used internally only 268 * Bitmapped ACPI types. Used internally only
269 */ 269 */
270#define ACPI_BTYPE_ANY 0x00000000 270#define ACPI_BTYPE_ANY 0x00000000
271#define ACPI_BTYPE_INTEGER 0x00000001 271#define ACPI_BTYPE_INTEGER 0x00000001
@@ -486,8 +486,10 @@ struct acpi_gpe_device_info {
486 struct acpi_namespace_node *gpe_device; 486 struct acpi_namespace_node *gpe_device;
487}; 487};
488 488
489typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *gpe_xrupt_info, 489typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
490 struct acpi_gpe_block_info *gpe_block, void *context); 490 gpe_xrupt_info,
491 struct acpi_gpe_block_info *gpe_block,
492 void *context);
491 493
492/* Information about each particular fixed event */ 494/* Information about each particular fixed event */
493 495
@@ -582,7 +584,7 @@ struct acpi_pscope_state {
582}; 584};
583 585
584/* 586/*
585 * Thread state - one per thread across multiple walk states. Multiple walk 587 * Thread state - one per thread across multiple walk states. Multiple walk
586 * states are created when there are nested control methods executing. 588 * states are created when there are nested control methods executing.
587 */ 589 */
588struct acpi_thread_state { 590struct acpi_thread_state {
@@ -645,7 +647,7 @@ union acpi_generic_state {
645 * 647 *
646 ****************************************************************************/ 648 ****************************************************************************/
647 649
648typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state); 650typedef acpi_status(*acpi_execute_op) (struct acpi_walk_state * walk_state);
649 651
650/* Address Range info block */ 652/* Address Range info block */
651 653
@@ -1031,6 +1033,7 @@ struct acpi_db_method_info {
1031 acpi_handle method; 1033 acpi_handle method;
1032 acpi_handle main_thread_gate; 1034 acpi_handle main_thread_gate;
1033 acpi_handle thread_complete_gate; 1035 acpi_handle thread_complete_gate;
1036 acpi_handle info_gate;
1034 acpi_thread_id *threads; 1037 acpi_thread_id *threads;
1035 u32 num_threads; 1038 u32 num_threads;
1036 u32 num_created; 1039 u32 num_created;
@@ -1041,6 +1044,7 @@ struct acpi_db_method_info {
1041 u32 num_loops; 1044 u32 num_loops;
1042 char pathname[128]; 1045 char pathname[128];
1043 char **args; 1046 char **args;
1047 acpi_object_type *types;
1044 1048
1045 /* 1049 /*
1046 * Arguments to be passed to method for the command 1050 * Arguments to be passed to method for the command
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index a7f68c47f517..5efad99f2169 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -84,29 +84,29 @@
84 84
85/* These macros reverse the bytes during the move, converting little-endian to big endian */ 85/* These macros reverse the bytes during the move, converting little-endian to big endian */
86 86
87 /* Big Endian <== Little Endian */ 87 /* Big Endian <== Little Endian */
88 /* Hi...Lo Lo...Hi */ 88 /* Hi...Lo Lo...Hi */
89/* 16-bit source, 16/32/64 destination */ 89/* 16-bit source, 16/32/64 destination */
90 90
91#define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\ 91#define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\
92 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];} 92 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];}
93 93
94#define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d))=0;\ 94#define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d))=0;\
95 ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ 95 ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
96 ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} 96 ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
97 97
98#define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\ 98#define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\
99 ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ 99 ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
100 ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} 100 ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
101 101
102/* 32-bit source, 16/32/64 destination */ 102/* 32-bit source, 16/32/64 destination */
103 103
104#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ 104#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
105 105
106#define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\ 106#define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\
107 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\ 107 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\
108 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ 108 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
109 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} 109 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
110 110
111#define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\ 111#define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\
112 ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\ 112 ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
@@ -196,24 +196,12 @@
196#endif 196#endif
197#endif 197#endif
198 198
199/* Macros based on machine integer width */
200
201#if ACPI_MACHINE_WIDTH == 32
202#define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_32_TO_16(d, s)
203
204#elif ACPI_MACHINE_WIDTH == 64
205#define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_64_TO_16(d, s)
206
207#else
208#error unknown ACPI_MACHINE_WIDTH
209#endif
210
211/* 199/*
212 * Fast power-of-two math macros for non-optimized compilers 200 * Fast power-of-two math macros for non-optimized compilers
213 */ 201 */
214#define _ACPI_DIV(value, power_of2) ((u32) ((value) >> (power_of2))) 202#define _ACPI_DIV(value, power_of2) ((u32) ((value) >> (power_of2)))
215#define _ACPI_MUL(value, power_of2) ((u32) ((value) << (power_of2))) 203#define _ACPI_MUL(value, power_of2) ((u32) ((value) << (power_of2)))
216#define _ACPI_MOD(value, divisor) ((u32) ((value) & ((divisor) -1))) 204#define _ACPI_MOD(value, divisor) ((u32) ((value) & ((divisor) -1)))
217 205
218#define ACPI_DIV_2(a) _ACPI_DIV(a, 1) 206#define ACPI_DIV_2(a) _ACPI_DIV(a, 1)
219#define ACPI_MUL_2(a) _ACPI_MUL(a, 1) 207#define ACPI_MUL_2(a) _ACPI_MUL(a, 1)
@@ -238,12 +226,12 @@
238/* 226/*
239 * Rounding macros (Power of two boundaries only) 227 * Rounding macros (Power of two boundaries only)
240 */ 228 */
241#define ACPI_ROUND_DOWN(value, boundary) (((acpi_size)(value)) & \ 229#define ACPI_ROUND_DOWN(value, boundary) (((acpi_size)(value)) & \
242 (~(((acpi_size) boundary)-1))) 230 (~(((acpi_size) boundary)-1)))
243 231
244#define ACPI_ROUND_UP(value, boundary) ((((acpi_size)(value)) + \ 232#define ACPI_ROUND_UP(value, boundary) ((((acpi_size)(value)) + \
245 (((acpi_size) boundary)-1)) & \ 233 (((acpi_size) boundary)-1)) & \
246 (~(((acpi_size) boundary)-1))) 234 (~(((acpi_size) boundary)-1)))
247 235
248/* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */ 236/* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */
249 237
@@ -264,7 +252,7 @@
264 252
265#define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary)) 253#define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary))
266 254
267#define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1)) 255#define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1))
268 256
269/* 257/*
270 * Bitmask creation 258 * Bitmask creation
@@ -355,7 +343,6 @@
355 * Ascii error messages can be configured out 343 * Ascii error messages can be configured out
356 */ 344 */
357#ifndef ACPI_NO_ERROR_MESSAGES 345#ifndef ACPI_NO_ERROR_MESSAGES
358
359/* 346/*
360 * Error reporting. Callers module and line number are inserted by AE_INFO, 347 * Error reporting. Callers module and line number are inserted by AE_INFO,
361 * the plist contains a set of parens to allow variable-length lists. 348 * the plist contains a set of parens to allow variable-length lists.
@@ -375,18 +362,15 @@
375#define ACPI_WARN_PREDEFINED(plist) 362#define ACPI_WARN_PREDEFINED(plist)
376#define ACPI_INFO_PREDEFINED(plist) 363#define ACPI_INFO_PREDEFINED(plist)
377 364
378#endif /* ACPI_NO_ERROR_MESSAGES */ 365#endif /* ACPI_NO_ERROR_MESSAGES */
379 366
380/* 367/*
381 * Debug macros that are conditionally compiled 368 * Debug macros that are conditionally compiled
382 */ 369 */
383#ifdef ACPI_DEBUG_OUTPUT 370#ifdef ACPI_DEBUG_OUTPUT
384
385/* 371/*
386 * Function entry tracing 372 * Function entry tracing
387 */ 373 */
388#ifdef CONFIG_ACPI_DEBUG_FUNC_TRACE
389
390#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ 374#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
391 acpi_ut_trace(ACPI_DEBUG_PARAMETERS) 375 acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
392#define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \ 376#define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \
@@ -464,45 +448,19 @@
464 448
465#endif /* ACPI_SIMPLE_RETURN_MACROS */ 449#endif /* ACPI_SIMPLE_RETURN_MACROS */
466 450
467#else /* !CONFIG_ACPI_DEBUG_FUNC_TRACE */
468
469#define ACPI_FUNCTION_TRACE(a)
470#define ACPI_FUNCTION_TRACE_PTR(a,b)
471#define ACPI_FUNCTION_TRACE_U32(a,b)
472#define ACPI_FUNCTION_TRACE_STR(a,b)
473#define ACPI_FUNCTION_EXIT
474#define ACPI_FUNCTION_STATUS_EXIT(s)
475#define ACPI_FUNCTION_VALUE_EXIT(s)
476#define ACPI_FUNCTION_TRACE(a)
477#define ACPI_FUNCTION_ENTRY()
478
479#define return_VOID return
480#define return_ACPI_STATUS(s) return(s)
481#define return_VALUE(s) return(s)
482#define return_UINT8(s) return(s)
483#define return_UINT32(s) return(s)
484#define return_PTR(s) return(s)
485
486#endif /* CONFIG_ACPI_DEBUG_FUNC_TRACE */
487
488/* Conditional execution */ 451/* Conditional execution */
489 452
490#define ACPI_DEBUG_EXEC(a) a 453#define ACPI_DEBUG_EXEC(a) a
491#define ACPI_NORMAL_EXEC(a)
492
493#define ACPI_DEBUG_DEFINE(a) a;
494#define ACPI_DEBUG_ONLY_MEMBERS(a) a; 454#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
495#define _VERBOSE_STRUCTURES 455#define _VERBOSE_STRUCTURES
496 456
497/* Stack and buffer dumping */ 457/* Various object display routines for debug */
498 458
499#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0) 459#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0)
500#define ACPI_DUMP_OPERANDS(a, b, c) acpi_ex_dump_operands(a, b, c) 460#define ACPI_DUMP_OPERANDS(a, b ,c) acpi_ex_dump_operands(a, b, c)
501
502#define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b) 461#define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b)
503#define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d) 462#define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d)
504#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) 463#define ACPI_DUMP_BUFFER(a, b) acpi_ut_debug_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
505#define ACPI_DUMP_BUFFER(a, b) acpi_ut_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
506 464
507#else 465#else
508/* 466/*
@@ -510,25 +468,23 @@
510 * leaving no executable debug code! 468 * leaving no executable debug code!
511 */ 469 */
512#define ACPI_DEBUG_EXEC(a) 470#define ACPI_DEBUG_EXEC(a)
513#define ACPI_NORMAL_EXEC(a) a; 471#define ACPI_DEBUG_ONLY_MEMBERS(a)
514 472#define ACPI_FUNCTION_TRACE(a)
515#define ACPI_DEBUG_DEFINE(a) do { } while(0) 473#define ACPI_FUNCTION_TRACE_PTR(a, b)
516#define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while(0) 474#define ACPI_FUNCTION_TRACE_U32(a, b)
517#define ACPI_FUNCTION_TRACE(a) do { } while(0) 475#define ACPI_FUNCTION_TRACE_STR(a, b)
518#define ACPI_FUNCTION_TRACE_PTR(a, b) do { } while(0) 476#define ACPI_FUNCTION_EXIT
519#define ACPI_FUNCTION_TRACE_U32(a, b) do { } while(0) 477#define ACPI_FUNCTION_STATUS_EXIT(s)
520#define ACPI_FUNCTION_TRACE_STR(a, b) do { } while(0) 478#define ACPI_FUNCTION_VALUE_EXIT(s)
521#define ACPI_FUNCTION_EXIT do { } while(0) 479#define ACPI_FUNCTION_ENTRY()
522#define ACPI_FUNCTION_STATUS_EXIT(s) do { } while(0) 480#define ACPI_DUMP_STACK_ENTRY(a)
523#define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0) 481#define ACPI_DUMP_OPERANDS(a, b, c)
524#define ACPI_FUNCTION_ENTRY() do { } while(0) 482#define ACPI_DUMP_ENTRY(a, b)
525#define ACPI_DUMP_STACK_ENTRY(a) do { } while(0) 483#define ACPI_DUMP_TABLES(a, b)
526#define ACPI_DUMP_OPERANDS(a, b, c) do { } while(0) 484#define ACPI_DUMP_PATHNAME(a, b, c, d)
527#define ACPI_DUMP_ENTRY(a, b) do { } while(0) 485#define ACPI_DUMP_BUFFER(a, b)
528#define ACPI_DUMP_TABLES(a, b) do { } while(0) 486#define ACPI_DEBUG_PRINT(pl)
529#define ACPI_DUMP_PATHNAME(a, b, c, d) do { } while(0) 487#define ACPI_DEBUG_PRINT_RAW(pl)
530#define ACPI_DUMP_RESOURCE_LIST(a) do { } while(0)
531#define ACPI_DUMP_BUFFER(a, b) do { } while(0)
532 488
533#define return_VOID return 489#define return_VOID return
534#define return_ACPI_STATUS(s) return(s) 490#define return_ACPI_STATUS(s) return(s)
@@ -556,18 +512,6 @@
556#define ACPI_DEBUGGER_EXEC(a) 512#define ACPI_DEBUGGER_EXEC(a)
557#endif 513#endif
558 514
559#ifdef ACPI_DEBUG_OUTPUT
560/*
561 * 1) Set name to blanks
562 * 2) Copy the object name
563 */
564#define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->common.name, ' ', sizeof (a->common.name));\
565 ACPI_STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name))
566#else
567
568#define ACPI_ADD_OBJECT_NAME(a,b)
569#endif
570
571/* 515/*
572 * Memory allocation tracking (DEBUG ONLY) 516 * Memory allocation tracking (DEBUG ONLY)
573 */ 517 */
@@ -578,13 +522,13 @@
578/* Memory allocation */ 522/* Memory allocation */
579 523
580#ifndef ACPI_ALLOCATE 524#ifndef ACPI_ALLOCATE
581#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a), ACPI_MEM_PARAMETERS) 525#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size) (a), ACPI_MEM_PARAMETERS)
582#endif 526#endif
583#ifndef ACPI_ALLOCATE_ZEROED 527#ifndef ACPI_ALLOCATE_ZEROED
584#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), ACPI_MEM_PARAMETERS) 528#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size) (a), ACPI_MEM_PARAMETERS)
585#endif 529#endif
586#ifndef ACPI_FREE 530#ifndef ACPI_FREE
587#define ACPI_FREE(a) acpio_os_free(a) 531#define ACPI_FREE(a) acpi_os_free(a)
588#endif 532#endif
589#define ACPI_MEM_TRACKING(a) 533#define ACPI_MEM_TRACKING(a)
590 534
@@ -592,16 +536,25 @@
592 536
593/* Memory allocation */ 537/* Memory allocation */
594 538
595#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS) 539#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size) (a), ACPI_MEM_PARAMETERS)
596#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS) 540#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size) (a), ACPI_MEM_PARAMETERS)
597#define ACPI_FREE(a) acpi_ut_free_and_track(a, ACPI_MEM_PARAMETERS) 541#define ACPI_FREE(a) acpi_ut_free_and_track(a, ACPI_MEM_PARAMETERS)
598#define ACPI_MEM_TRACKING(a) a 542#define ACPI_MEM_TRACKING(a) a
599 543
600#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ 544#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
601 545
602/* Preemption point */ 546/*
603#ifndef ACPI_PREEMPTION_POINT 547 * Macros used for ACPICA utilities only
604#define ACPI_PREEMPTION_POINT() /* no preemption */ 548 */
605#endif 549
550/* Generate a UUID */
551
552#define ACPI_INIT_UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
553 (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \
554 (b) & 0xFF, ((b) >> 8) & 0xFF, \
555 (c) & 0xFF, ((c) >> 8) & 0xFF, \
556 (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)
557
558#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
606 559
607#endif /* ACMACROS_H */ 560#endif /* ACMACROS_H */
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index 364a1303fb8f..24eb9eac9514 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Name: acobject.h - Definition of union acpi_operand_object (Internal object only) 3 * Name: acobject.h - Definition of union acpi_operand_object (Internal object only)
@@ -179,7 +178,7 @@ struct acpi_object_method {
179 union acpi_operand_object *mutex; 178 union acpi_operand_object *mutex;
180 u8 *aml_start; 179 u8 *aml_start;
181 union { 180 union {
182 ACPI_INTERNAL_METHOD implementation; 181 acpi_internal_method implementation;
183 union acpi_operand_object *handler; 182 union acpi_operand_object *handler;
184 } dispatch; 183 } dispatch;
185 184
@@ -198,7 +197,7 @@ struct acpi_object_method {
198 197
199/****************************************************************************** 198/******************************************************************************
200 * 199 *
201 * Objects that can be notified. All share a common notify_info area. 200 * Objects that can be notified. All share a common notify_info area.
202 * 201 *
203 *****************************************************************************/ 202 *****************************************************************************/
204 203
@@ -235,7 +234,7 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
235 234
236/****************************************************************************** 235/******************************************************************************
237 * 236 *
238 * Fields. All share a common header/info field. 237 * Fields. All share a common header/info field.
239 * 238 *
240 *****************************************************************************/ 239 *****************************************************************************/
241 240
diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h
index 9440d053fbb3..d786a5128b78 100644
--- a/drivers/acpi/acpica/acopcode.h
+++ b/drivers/acpi/acpica/acopcode.h
@@ -54,7 +54,7 @@
54#define _UNK 0x6B 54#define _UNK 0x6B
55 55
56/* 56/*
57 * Reserved ASCII characters. Do not use any of these for 57 * Reserved ASCII characters. Do not use any of these for
58 * internal opcodes, since they are used to differentiate 58 * internal opcodes, since they are used to differentiate
59 * name strings from AML opcodes 59 * name strings from AML opcodes
60 */ 60 */
@@ -63,7 +63,7 @@
63#define _PFX 0x6D 63#define _PFX 0x6D
64 64
65/* 65/*
66 * All AML opcodes and the parse-time arguments for each. Used by the AML 66 * All AML opcodes and the parse-time arguments for each. Used by the AML
67 * parser Each list is compressed into a 32-bit number and stored in the 67 * parser Each list is compressed into a 32-bit number and stored in the
68 * master opcode table (in psopcode.c). 68 * master opcode table (in psopcode.c).
69 */ 69 */
@@ -193,7 +193,7 @@
193#define ARGP_ZERO_OP ARG_NONE 193#define ARGP_ZERO_OP ARG_NONE
194 194
195/* 195/*
196 * All AML opcodes and the runtime arguments for each. Used by the AML 196 * All AML opcodes and the runtime arguments for each. Used by the AML
197 * interpreter Each list is compressed into a 32-bit number and stored 197 * interpreter Each list is compressed into a 32-bit number and stored
198 * in the master opcode table (in psopcode.c). 198 * in the master opcode table (in psopcode.c).
199 * 199 *
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h
index b725d780d34d..eefcf47a61a0 100644
--- a/drivers/acpi/acpica/acparser.h
+++ b/drivers/acpi/acpica/acparser.h
@@ -150,8 +150,7 @@ u8 acpi_ps_has_completed_scope(struct acpi_parse_state *parser_state);
150 150
151void 151void
152acpi_ps_pop_scope(struct acpi_parse_state *parser_state, 152acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
153 union acpi_parse_object **op, 153 union acpi_parse_object **op, u32 *arg_list, u32 *arg_count);
154 u32 * arg_list, u32 * arg_count);
155 154
156acpi_status 155acpi_status
157acpi_ps_push_scope(struct acpi_parse_state *parser_state, 156acpi_ps_push_scope(struct acpi_parse_state *parser_state,
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h
index 3080c017f5ba..9dfa1c83bd4e 100644
--- a/drivers/acpi/acpica/acpredef.h
+++ b/drivers/acpi/acpica/acpredef.h
@@ -150,8 +150,7 @@ enum acpi_return_package_types {
150 * is saved here (rather than in a separate table) in order to minimize the 150 * is saved here (rather than in a separate table) in order to minimize the
151 * overall size of the stored data. 151 * overall size of the stored data.
152 */ 152 */
153static const union acpi_predefined_info predefined_names[] = 153static const union acpi_predefined_info predefined_names[] = {
154{
155 {{"_AC0", 0, ACPI_RTYPE_INTEGER}}, 154 {{"_AC0", 0, ACPI_RTYPE_INTEGER}},
156 {{"_AC1", 0, ACPI_RTYPE_INTEGER}}, 155 {{"_AC1", 0, ACPI_RTYPE_INTEGER}},
157 {{"_AC2", 0, ACPI_RTYPE_INTEGER}}, 156 {{"_AC2", 0, ACPI_RTYPE_INTEGER}},
@@ -538,7 +537,8 @@ static const union acpi_predefined_info predefined_names[] =
538 537
539 /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */ 538 /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */
540 539
541 {{"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}}, 540 {{"_WAK", 1,
541 ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}},
542 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */ 542 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */
543 543
544 /* _WDG/_WED are MS extensions defined by "Windows Instrumentation" */ 544 /* _WDG/_WED are MS extensions defined by "Windows Instrumentation" */
@@ -551,11 +551,12 @@ static const union acpi_predefined_info predefined_names[] =
551}; 551};
552 552
553#if 0 553#if 0
554
554 /* This is an internally implemented control method, no need to check */ 555 /* This is an internally implemented control method, no need to check */
555 {{"_OSI", 1, ACPI_RTYPE_INTEGER}}, 556{ {
557"_OSI", 1, ACPI_RTYPE_INTEGER}},
556 558
557 /* TBD: */ 559 /* TBD: */
558
559 _PRT - currently ignore reversed entries. attempt to fix here? 560 _PRT - currently ignore reversed entries. attempt to fix here?
560 think about possibly fixing package elements like _BIF, etc. 561 think about possibly fixing package elements like _BIF, etc.
561#endif 562#endif
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h
index f196e2c9a71f..937e66c65d1e 100644
--- a/drivers/acpi/acpica/acstruct.h
+++ b/drivers/acpi/acpica/acstruct.h
@@ -53,7 +53,7 @@
53 ****************************************************************************/ 53 ****************************************************************************/
54 54
55/* 55/*
56 * Walk state - current state of a parse tree walk. Used for both a leisurely 56 * Walk state - current state of a parse tree walk. Used for both a leisurely
57 * stroll through the tree (for whatever reason), and for control method 57 * stroll through the tree (for whatever reason), and for control method
58 * execution. 58 * execution.
59 */ 59 */
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index 5035327ebccc..b0f5f92b674a 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -69,6 +69,22 @@ extern const char *acpi_gbl_siz_decode[];
69extern const char *acpi_gbl_trs_decode[]; 69extern const char *acpi_gbl_trs_decode[];
70extern const char *acpi_gbl_ttp_decode[]; 70extern const char *acpi_gbl_ttp_decode[];
71extern const char *acpi_gbl_typ_decode[]; 71extern const char *acpi_gbl_typ_decode[];
72extern const char *acpi_gbl_ppc_decode[];
73extern const char *acpi_gbl_ior_decode[];
74extern const char *acpi_gbl_dts_decode[];
75extern const char *acpi_gbl_ct_decode[];
76extern const char *acpi_gbl_sbt_decode[];
77extern const char *acpi_gbl_am_decode[];
78extern const char *acpi_gbl_sm_decode[];
79extern const char *acpi_gbl_wm_decode[];
80extern const char *acpi_gbl_cph_decode[];
81extern const char *acpi_gbl_cpo_decode[];
82extern const char *acpi_gbl_dp_decode[];
83extern const char *acpi_gbl_ed_decode[];
84extern const char *acpi_gbl_bpb_decode[];
85extern const char *acpi_gbl_sb_decode[];
86extern const char *acpi_gbl_fc_decode[];
87extern const char *acpi_gbl_pt_decode[];
72#endif 88#endif
73 89
74/* Types for Resource descriptor entries */ 90/* Types for Resource descriptor entries */
@@ -79,14 +95,14 @@ extern const char *acpi_gbl_typ_decode[];
79#define ACPI_SMALL_VARIABLE_LENGTH 3 95#define ACPI_SMALL_VARIABLE_LENGTH 3
80 96
81typedef 97typedef
82acpi_status(*acpi_walk_aml_callback) (u8 * aml, 98acpi_status(*acpi_walk_aml_callback) (u8 *aml,
83 u32 length, 99 u32 length,
84 u32 offset, 100 u32 offset,
85 u8 resource_index, void **context); 101 u8 resource_index, void **context);
86 102
87typedef 103typedef
88acpi_status(*acpi_pkg_callback) (u8 object_type, 104acpi_status(*acpi_pkg_callback) (u8 object_type,
89 union acpi_operand_object * source_object, 105 union acpi_operand_object *source_object,
90 union acpi_generic_state * state, 106 union acpi_generic_state * state,
91 void *context); 107 void *context);
92 108
@@ -202,7 +218,9 @@ extern const u8 _acpi_ctype[];
202#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) 218#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
203#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) 219#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
204 220
205#endif /* ACPI_USE_SYSTEM_CLIBRARY */ 221#endif /* !ACPI_USE_SYSTEM_CLIBRARY */
222
223#define ACPI_IS_ASCII(c) ((c) < 0x80)
206 224
207/* 225/*
208 * utcopy - Object construction and conversion interfaces 226 * utcopy - Object construction and conversion interfaces
@@ -210,11 +228,11 @@ extern const u8 _acpi_ctype[];
210acpi_status 228acpi_status
211acpi_ut_build_simple_object(union acpi_operand_object *obj, 229acpi_ut_build_simple_object(union acpi_operand_object *obj,
212 union acpi_object *user_obj, 230 union acpi_object *user_obj,
213 u8 * data_space, u32 * buffer_space_used); 231 u8 *data_space, u32 *buffer_space_used);
214 232
215acpi_status 233acpi_status
216acpi_ut_build_package_object(union acpi_operand_object *obj, 234acpi_ut_build_package_object(union acpi_operand_object *obj,
217 u8 * buffer, u32 * space_used); 235 u8 *buffer, u32 *space_used);
218 236
219acpi_status 237acpi_status
220acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *obj, 238acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *obj,
@@ -287,9 +305,10 @@ acpi_ut_ptr_exit(u32 line_number,
287 const char *function_name, 305 const char *function_name,
288 const char *module_name, u32 component_id, u8 *ptr); 306 const char *module_name, u32 component_id, u8 *ptr);
289 307
290void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); 308void
309acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id);
291 310
292void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display); 311void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 offset);
293 312
294void acpi_ut_report_error(char *module_name, u32 line_number); 313void acpi_ut_report_error(char *module_name, u32 line_number);
295 314
@@ -337,15 +356,19 @@ acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node,
337 */ 356 */
338acpi_status 357acpi_status
339acpi_ut_execute_HID(struct acpi_namespace_node *device_node, 358acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
340 struct acpica_device_id **return_id); 359 struct acpi_pnp_device_id ** return_id);
341 360
342acpi_status 361acpi_status
343acpi_ut_execute_UID(struct acpi_namespace_node *device_node, 362acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
344 struct acpica_device_id **return_id); 363 struct acpi_pnp_device_id ** return_id);
364
365acpi_status
366acpi_ut_execute_SUB(struct acpi_namespace_node *device_node,
367 struct acpi_pnp_device_id **return_id);
345 368
346acpi_status 369acpi_status
347acpi_ut_execute_CID(struct acpi_namespace_node *device_node, 370acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
348 struct acpica_device_id_list **return_cid_list); 371 struct acpi_pnp_device_id_list ** return_cid_list);
349 372
350/* 373/*
351 * utlock - reader/writer locks 374 * utlock - reader/writer locks
@@ -479,15 +502,19 @@ acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
479 502
480void acpi_ut_strupr(char *src_string); 503void acpi_ut_strupr(char *src_string);
481 504
505void acpi_ut_strlwr(char *src_string);
506
507int acpi_ut_stricmp(char *string1, char *string2);
508
482void acpi_ut_print_string(char *string, u8 max_length); 509void acpi_ut_print_string(char *string, u8 max_length);
483 510
484u8 acpi_ut_valid_acpi_name(u32 name); 511u8 acpi_ut_valid_acpi_name(u32 name);
485 512
486acpi_name acpi_ut_repair_name(char *name); 513void acpi_ut_repair_name(char *name);
487 514
488u8 acpi_ut_valid_acpi_char(char character, u32 position); 515u8 acpi_ut_valid_acpi_char(char character, u32 position);
489 516
490acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer); 517acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer);
491 518
492/* Values for Base above (16=Hex, 10=Decimal) */ 519/* Values for Base above (16=Hex, 10=Decimal) */
493 520
@@ -508,12 +535,12 @@ acpi_ut_display_init_pathname(u8 type,
508 * utresrc 535 * utresrc
509 */ 536 */
510acpi_status 537acpi_status
511acpi_ut_walk_aml_resources(u8 * aml, 538acpi_ut_walk_aml_resources(u8 *aml,
512 acpi_size aml_length, 539 acpi_size aml_length,
513 acpi_walk_aml_callback user_function, 540 acpi_walk_aml_callback user_function,
514 void **context); 541 void **context);
515 542
516acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index); 543acpi_status acpi_ut_validate_resource(void *aml, u8 *return_index);
517 544
518u32 acpi_ut_get_descriptor_length(void *aml); 545u32 acpi_ut_get_descriptor_length(void *aml);
519 546
@@ -524,8 +551,7 @@ u8 acpi_ut_get_resource_header_length(void *aml);
524u8 acpi_ut_get_resource_type(void *aml); 551u8 acpi_ut_get_resource_type(void *aml);
525 552
526acpi_status 553acpi_status
527acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, 554acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, u8 **end_tag);
528 u8 ** end_tag);
529 555
530/* 556/*
531 * utmutex - mutex support 557 * utmutex - mutex support
diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h
index af4947956ec2..968449685e06 100644
--- a/drivers/acpi/acpica/amlresrc.h
+++ b/drivers/acpi/acpica/amlresrc.h
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: amlresrc.h - AML resource descriptors 3 * Module Name: amlresrc.h - AML resource descriptors
diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c
index 465f02134b89..57895db3231a 100644
--- a/drivers/acpi/acpica/dscontrol.c
+++ b/drivers/acpi/acpica/dscontrol.c
@@ -280,7 +280,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
280 280
281 /* 281 /*
282 * Get the return value and save as the last result 282 * Get the return value and save as the last result
283 * value. This is the only place where walk_state->return_desc 283 * value. This is the only place where walk_state->return_desc
284 * is set to anything other than zero! 284 * is set to anything other than zero!
285 */ 285 */
286 walk_state->return_desc = walk_state->operands[0]; 286 walk_state->return_desc = walk_state->operands[0];
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index 3da6fd8530c5..b5b904ee815f 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -277,7 +277,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
277 * 277 *
278 * RETURN: Status 278 * RETURN: Status
279 * 279 *
280 * DESCRIPTION: Process all named fields in a field declaration. Names are 280 * DESCRIPTION: Process all named fields in a field declaration. Names are
281 * entered into the namespace. 281 * entered into the namespace.
282 * 282 *
283 ******************************************************************************/ 283 ******************************************************************************/
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index aa9a5d4e4052..52eb4e01622a 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -170,7 +170,7 @@ acpi_ds_create_method_mutex(union acpi_operand_object *method_desc)
170 * 170 *
171 * RETURN: Status 171 * RETURN: Status
172 * 172 *
173 * DESCRIPTION: Prepare a method for execution. Parses the method if necessary, 173 * DESCRIPTION: Prepare a method for execution. Parses the method if necessary,
174 * increments the thread count, and waits at the method semaphore 174 * increments the thread count, and waits at the method semaphore
175 * for clearance to execute. 175 * for clearance to execute.
176 * 176 *
@@ -444,7 +444,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
444 * RETURN: Status 444 * RETURN: Status
445 * 445 *
446 * DESCRIPTION: Restart a method that was preempted by another (nested) method 446 * DESCRIPTION: Restart a method that was preempted by another (nested) method
447 * invocation. Handle the return value (if any) from the callee. 447 * invocation. Handle the return value (if any) from the callee.
448 * 448 *
449 ******************************************************************************/ 449 ******************************************************************************/
450 450
@@ -530,7 +530,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
530 * 530 *
531 * RETURN: None 531 * RETURN: None
532 * 532 *
533 * DESCRIPTION: Terminate a control method. Delete everything that the method 533 * DESCRIPTION: Terminate a control method. Delete everything that the method
534 * created, delete all locals and arguments, and delete the parse 534 * created, delete all locals and arguments, and delete the parse
535 * tree if requested. 535 * tree if requested.
536 * 536 *
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c
index 8d55cebaa656..9a83b7e0f3ba 100644
--- a/drivers/acpi/acpica/dsmthdat.c
+++ b/drivers/acpi/acpica/dsmthdat.c
@@ -76,7 +76,7 @@ acpi_ds_method_data_get_type(u16 opcode,
76 * RETURN: Status 76 * RETURN: Status
77 * 77 *
78 * DESCRIPTION: Initialize the data structures that hold the method's arguments 78 * DESCRIPTION: Initialize the data structures that hold the method's arguments
79 * and locals. The data struct is an array of namespace nodes for 79 * and locals. The data struct is an array of namespace nodes for
80 * each - this allows ref_of and de_ref_of to work properly for these 80 * each - this allows ref_of and de_ref_of to work properly for these
81 * special data types. 81 * special data types.
82 * 82 *
@@ -129,7 +129,7 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state)
129 * 129 *
130 * RETURN: None 130 * RETURN: None
131 * 131 *
132 * DESCRIPTION: Delete method locals and arguments. Arguments are only 132 * DESCRIPTION: Delete method locals and arguments. Arguments are only
133 * deleted if this method was called from another method. 133 * deleted if this method was called from another method.
134 * 134 *
135 ******************************************************************************/ 135 ******************************************************************************/
@@ -183,7 +183,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state)
183 * 183 *
184 * RETURN: Status 184 * RETURN: Status
185 * 185 *
186 * DESCRIPTION: Initialize arguments for a method. The parameter list is a list 186 * DESCRIPTION: Initialize arguments for a method. The parameter list is a list
187 * of ACPI operand objects, either null terminated or whose length 187 * of ACPI operand objects, either null terminated or whose length
188 * is defined by max_param_count. 188 * is defined by max_param_count.
189 * 189 *
@@ -401,7 +401,7 @@ acpi_ds_method_data_get_value(u8 type,
401 * This means that either 1) The expected argument was 401 * This means that either 1) The expected argument was
402 * not passed to the method, or 2) A local variable 402 * not passed to the method, or 2) A local variable
403 * was referenced by the method (via the ASL) 403 * was referenced by the method (via the ASL)
404 * before it was initialized. Either case is an error. 404 * before it was initialized. Either case is an error.
405 */ 405 */
406 406
407 /* If slack enabled, init the local_x/arg_x to an Integer of value zero */ 407 /* If slack enabled, init the local_x/arg_x to an Integer of value zero */
@@ -465,7 +465,7 @@ acpi_ds_method_data_get_value(u8 type,
465 * 465 *
466 * RETURN: None 466 * RETURN: None
467 * 467 *
468 * DESCRIPTION: Delete the entry at Opcode:Index. Inserts 468 * DESCRIPTION: Delete the entry at Opcode:Index. Inserts
469 * a null into the stack slot after the object is deleted. 469 * a null into the stack slot after the object is deleted.
470 * 470 *
471 ******************************************************************************/ 471 ******************************************************************************/
@@ -523,7 +523,7 @@ acpi_ds_method_data_delete_value(u8 type,
523 * 523 *
524 * RETURN: Status 524 * RETURN: Status
525 * 525 *
526 * DESCRIPTION: Store a value in an Arg or Local. The obj_desc is installed 526 * DESCRIPTION: Store a value in an Arg or Local. The obj_desc is installed
527 * as the new value for the Arg or Local and the reference count 527 * as the new value for the Arg or Local and the reference count
528 * for obj_desc is incremented. 528 * for obj_desc is incremented.
529 * 529 *
@@ -566,7 +566,7 @@ acpi_ds_store_object_to_local(u8 type,
566 566
567 /* 567 /*
568 * If the reference count on the object is more than one, we must 568 * If the reference count on the object is more than one, we must
569 * take a copy of the object before we store. A reference count 569 * take a copy of the object before we store. A reference count
570 * of exactly 1 means that the object was just created during the 570 * of exactly 1 means that the object was just created during the
571 * evaluation of an expression, and we can safely use it since it 571 * evaluation of an expression, and we can safely use it since it
572 * is not used anywhere else. 572 * is not used anywhere else.
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c
index 68592dd34960..c9f15d3a3686 100644
--- a/drivers/acpi/acpica/dsobject.c
+++ b/drivers/acpi/acpica/dsobject.c
@@ -293,7 +293,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
293 293
294 /* 294 /*
295 * Second arg is the buffer data (optional) byte_list can be either 295 * Second arg is the buffer data (optional) byte_list can be either
296 * individual bytes or a string initializer. In either case, a 296 * individual bytes or a string initializer. In either case, a
297 * byte_list appears in the AML. 297 * byte_list appears in the AML.
298 */ 298 */
299 arg = op->common.value.arg; /* skip first arg */ 299 arg = op->common.value.arg; /* skip first arg */
@@ -568,7 +568,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state,
568 568
569 /* 569 /*
570 * Because of the execution pass through the non-control-method 570 * Because of the execution pass through the non-control-method
571 * parts of the table, we can arrive here twice. Only init 571 * parts of the table, we can arrive here twice. Only init
572 * the named object node the first time through 572 * the named object node the first time through
573 */ 573 */
574 if (acpi_ns_get_attached_object(node)) { 574 if (acpi_ns_get_attached_object(node)) {
@@ -618,7 +618,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state,
618 * RETURN: Status 618 * RETURN: Status
619 * 619 *
620 * DESCRIPTION: Initialize a namespace object from a parser Op and its 620 * DESCRIPTION: Initialize a namespace object from a parser Op and its
621 * associated arguments. The namespace object is a more compact 621 * associated arguments. The namespace object is a more compact
622 * representation of the Op and its arguments. 622 * representation of the Op and its arguments.
623 * 623 *
624 ******************************************************************************/ 624 ******************************************************************************/
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c
index aa34d8984d34..0df024e5fb63 100644
--- a/drivers/acpi/acpica/dsopcode.c
+++ b/drivers/acpi/acpica/dsopcode.c
@@ -649,7 +649,8 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
649 ((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) && 649 ((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) &&
650 (op->common.parent->common.aml_opcode != 650 (op->common.parent->common.aml_opcode !=
651 AML_VAR_PACKAGE_OP) 651 AML_VAR_PACKAGE_OP)
652 && (op->common.parent->common.aml_opcode != AML_NAME_OP))) { 652 && (op->common.parent->common.aml_opcode !=
653 AML_NAME_OP))) {
653 walk_state->result_obj = obj_desc; 654 walk_state->result_obj = obj_desc;
654 } 655 }
655 } 656 }
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c
index 73a5447475f5..afeb99f49482 100644
--- a/drivers/acpi/acpica/dsutils.c
+++ b/drivers/acpi/acpica/dsutils.c
@@ -61,7 +61,7 @@ ACPI_MODULE_NAME("dsutils")
61 * 61 *
62 * RETURN: None. 62 * RETURN: None.
63 * 63 *
64 * DESCRIPTION: Clear and remove a reference on an implicit return value. Used 64 * DESCRIPTION: Clear and remove a reference on an implicit return value. Used
65 * to delete "stale" return values (if enabled, the return value 65 * to delete "stale" return values (if enabled, the return value
66 * from every operator is saved at least momentarily, in case the 66 * from every operator is saved at least momentarily, in case the
67 * parent method exits.) 67 * parent method exits.)
@@ -107,7 +107,7 @@ void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state)
107 * 107 *
108 * DESCRIPTION: Implements the optional "implicit return". We save the result 108 * DESCRIPTION: Implements the optional "implicit return". We save the result
109 * of every ASL operator and control method invocation in case the 109 * of every ASL operator and control method invocation in case the
110 * parent method exit. Before storing a new return value, we 110 * parent method exit. Before storing a new return value, we
111 * delete the previous return value. 111 * delete the previous return value.
112 * 112 *
113 ******************************************************************************/ 113 ******************************************************************************/
@@ -198,7 +198,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
198 * 198 *
199 * If there is no parent, or the parent is a scope_op, we are executing 199 * If there is no parent, or the parent is a scope_op, we are executing
200 * at the method level. An executing method typically has no parent, 200 * at the method level. An executing method typically has no parent,
201 * since each method is parsed separately. A method invoked externally 201 * since each method is parsed separately. A method invoked externally
202 * via execute_control_method has a scope_op as the parent. 202 * via execute_control_method has a scope_op as the parent.
203 */ 203 */
204 if ((!op->common.parent) || 204 if ((!op->common.parent) ||
@@ -223,7 +223,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
223 } 223 }
224 224
225 /* 225 /*
226 * Decide what to do with the result based on the parent. If 226 * Decide what to do with the result based on the parent. If
227 * the parent opcode will not use the result, delete the object. 227 * the parent opcode will not use the result, delete the object.
228 * Otherwise leave it as is, it will be deleted when it is used 228 * Otherwise leave it as is, it will be deleted when it is used
229 * as an operand later. 229 * as an operand later.
@@ -266,7 +266,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
266 266
267 /* 267 /*
268 * These opcodes allow term_arg(s) as operands and therefore 268 * These opcodes allow term_arg(s) as operands and therefore
269 * the operands can be method calls. The result is used. 269 * the operands can be method calls. The result is used.
270 */ 270 */
271 goto result_used; 271 goto result_used;
272 272
@@ -284,7 +284,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
284 AML_BANK_FIELD_OP)) { 284 AML_BANK_FIELD_OP)) {
285 /* 285 /*
286 * These opcodes allow term_arg(s) as operands and therefore 286 * These opcodes allow term_arg(s) as operands and therefore
287 * the operands can be method calls. The result is used. 287 * the operands can be method calls. The result is used.
288 */ 288 */
289 goto result_used; 289 goto result_used;
290 } 290 }
@@ -329,9 +329,9 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
329 * 329 *
330 * RETURN: Status 330 * RETURN: Status
331 * 331 *
332 * DESCRIPTION: Used after interpretation of an opcode. If there is an internal 332 * DESCRIPTION: Used after interpretation of an opcode. If there is an internal
333 * result descriptor, check if the parent opcode will actually use 333 * result descriptor, check if the parent opcode will actually use
334 * this result. If not, delete the result now so that it will 334 * this result. If not, delete the result now so that it will
335 * not become orphaned. 335 * not become orphaned.
336 * 336 *
337 ******************************************************************************/ 337 ******************************************************************************/
@@ -376,7 +376,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
376 * 376 *
377 * RETURN: Status 377 * RETURN: Status
378 * 378 *
379 * DESCRIPTION: Resolve all operands to their values. Used to prepare 379 * DESCRIPTION: Resolve all operands to their values. Used to prepare
380 * arguments to a control method invocation (a call from one 380 * arguments to a control method invocation (a call from one
381 * method to another.) 381 * method to another.)
382 * 382 *
@@ -391,7 +391,7 @@ acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state)
391 391
392 /* 392 /*
393 * Attempt to resolve each of the valid operands 393 * Attempt to resolve each of the valid operands
394 * Method arguments are passed by reference, not by value. This means 394 * Method arguments are passed by reference, not by value. This means
395 * that the actual objects are passed, not copies of the objects. 395 * that the actual objects are passed, not copies of the objects.
396 */ 396 */
397 for (i = 0; i < walk_state->num_operands; i++) { 397 for (i = 0; i < walk_state->num_operands; i++) {
@@ -451,7 +451,7 @@ void acpi_ds_clear_operands(struct acpi_walk_state *walk_state)
451 * RETURN: Status 451 * RETURN: Status
452 * 452 *
453 * DESCRIPTION: Translate a parse tree object that is an argument to an AML 453 * DESCRIPTION: Translate a parse tree object that is an argument to an AML
454 * opcode to the equivalent interpreter object. This may include 454 * opcode to the equivalent interpreter object. This may include
455 * looking up a name or entering a new name into the internal 455 * looking up a name or entering a new name into the internal
456 * namespace. 456 * namespace.
457 * 457 *
@@ -496,9 +496,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
496 /* 496 /*
497 * Special handling for buffer_field declarations. This is a deferred 497 * Special handling for buffer_field declarations. This is a deferred
498 * opcode that unfortunately defines the field name as the last 498 * opcode that unfortunately defines the field name as the last
499 * parameter instead of the first. We get here when we are performing 499 * parameter instead of the first. We get here when we are performing
500 * the deferred execution, so the actual name of the field is already 500 * the deferred execution, so the actual name of the field is already
501 * in the namespace. We don't want to attempt to look it up again 501 * in the namespace. We don't want to attempt to look it up again
502 * because we may be executing in a different scope than where the 502 * because we may be executing in a different scope than where the
503 * actual opcode exists. 503 * actual opcode exists.
504 */ 504 */
@@ -560,7 +560,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
560 * indicate this to the interpreter, set the 560 * indicate this to the interpreter, set the
561 * object to the root 561 * object to the root
562 */ 562 */
563 obj_desc = ACPI_CAST_PTR(union 563 obj_desc =
564 ACPI_CAST_PTR(union
564 acpi_operand_object, 565 acpi_operand_object,
565 acpi_gbl_root_node); 566 acpi_gbl_root_node);
566 status = AE_OK; 567 status = AE_OK;
@@ -604,8 +605,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
604 /* 605 /*
605 * If the name is null, this means that this is an 606 * If the name is null, this means that this is an
606 * optional result parameter that was not specified 607 * optional result parameter that was not specified
607 * in the original ASL. Create a Zero Constant for a 608 * in the original ASL. Create a Zero Constant for a
608 * placeholder. (Store to a constant is a Noop.) 609 * placeholder. (Store to a constant is a Noop.)
609 */ 610 */
610 opcode = AML_ZERO_OP; /* Has no arguments! */ 611 opcode = AML_ZERO_OP; /* Has no arguments! */
611 612
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c
index 642f3c053e87..58593931be96 100644
--- a/drivers/acpi/acpica/dswexec.c
+++ b/drivers/acpi/acpica/dswexec.c
@@ -57,7 +57,7 @@ ACPI_MODULE_NAME("dswexec")
57/* 57/*
58 * Dispatch table for opcode classes 58 * Dispatch table for opcode classes
59 */ 59 */
60static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch[] = { 60static acpi_execute_op acpi_gbl_op_type_dispatch[] = {
61 acpi_ex_opcode_0A_0T_1R, 61 acpi_ex_opcode_0A_0T_1R,
62 acpi_ex_opcode_1A_0T_0R, 62 acpi_ex_opcode_1A_0T_0R,
63 acpi_ex_opcode_1A_0T_1R, 63 acpi_ex_opcode_1A_0T_1R,
@@ -204,7 +204,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
204 * RETURN: Status 204 * RETURN: Status
205 * 205 *
206 * DESCRIPTION: Descending callback used during the execution of control 206 * DESCRIPTION: Descending callback used during the execution of control
207 * methods. This is where most operators and operands are 207 * methods. This is where most operators and operands are
208 * dispatched to the interpreter. 208 * dispatched to the interpreter.
209 * 209 *
210 ****************************************************************************/ 210 ****************************************************************************/
@@ -297,7 +297,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
297 if (walk_state->walk_type & ACPI_WALK_METHOD) { 297 if (walk_state->walk_type & ACPI_WALK_METHOD) {
298 /* 298 /*
299 * Found a named object declaration during method execution; 299 * Found a named object declaration during method execution;
300 * we must enter this object into the namespace. The created 300 * we must enter this object into the namespace. The created
301 * object is temporary and will be deleted upon completion of 301 * object is temporary and will be deleted upon completion of
302 * the execution of this method. 302 * the execution of this method.
303 * 303 *
@@ -348,7 +348,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
348 * RETURN: Status 348 * RETURN: Status
349 * 349 *
350 * DESCRIPTION: Ascending callback used during the execution of control 350 * DESCRIPTION: Ascending callback used during the execution of control
351 * methods. The only thing we really need to do here is to 351 * methods. The only thing we really need to do here is to
352 * notice the beginning of IF, ELSE, and WHILE blocks. 352 * notice the beginning of IF, ELSE, and WHILE blocks.
353 * 353 *
354 ****************************************************************************/ 354 ****************************************************************************/
@@ -432,7 +432,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
432 if (ACPI_SUCCESS(status)) { 432 if (ACPI_SUCCESS(status)) {
433 /* 433 /*
434 * Dispatch the request to the appropriate interpreter handler 434 * Dispatch the request to the appropriate interpreter handler
435 * routine. There is one routine per opcode "type" based upon the 435 * routine. There is one routine per opcode "type" based upon the
436 * number of opcode arguments and return type. 436 * number of opcode arguments and return type.
437 */ 437 */
438 status = 438 status =
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c
index 89c0114210c0..379835748357 100644
--- a/drivers/acpi/acpica/dswload2.c
+++ b/drivers/acpi/acpica/dswload2.c
@@ -254,7 +254,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
254 acpi_ut_get_type_name(node->type), 254 acpi_ut_get_type_name(node->type),
255 acpi_ut_get_node_name(node))); 255 acpi_ut_get_node_name(node)));
256 256
257 return (AE_AML_OPERAND_TYPE); 257 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
258 } 258 }
259 break; 259 break;
260 260
@@ -602,7 +602,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
602 region_space, 602 region_space,
603 walk_state); 603 walk_state);
604 if (ACPI_FAILURE(status)) { 604 if (ACPI_FAILURE(status)) {
605 return (status); 605 return_ACPI_STATUS(status);
606 } 606 }
607 607
608 acpi_ex_exit_interpreter(); 608 acpi_ex_exit_interpreter();
diff --git a/drivers/acpi/acpica/dswstate.c b/drivers/acpi/acpica/dswstate.c
index d0e6555061e4..3e65a15a735f 100644
--- a/drivers/acpi/acpica/dswstate.c
+++ b/drivers/acpi/acpica/dswstate.c
@@ -51,8 +51,9 @@
51ACPI_MODULE_NAME("dswstate") 51ACPI_MODULE_NAME("dswstate")
52 52
53 /* Local prototypes */ 53 /* Local prototypes */
54static acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *ws); 54static acpi_status
55static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *ws); 55acpi_ds_result_stack_push(struct acpi_walk_state *walk_state);
56static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state);
56 57
57/******************************************************************************* 58/*******************************************************************************
58 * 59 *
@@ -347,7 +348,7 @@ acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state)
347 * 348 *
348 * RETURN: Status 349 * RETURN: Status
349 * 350 *
350 * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT 351 * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
351 * deleted by this routine. 352 * deleted by this routine.
352 * 353 *
353 ******************************************************************************/ 354 ******************************************************************************/
@@ -491,7 +492,7 @@ acpi_ds_push_walk_state(struct acpi_walk_state *walk_state,
491 * RETURN: A walk_state object popped from the thread's stack 492 * RETURN: A walk_state object popped from the thread's stack
492 * 493 *
493 * DESCRIPTION: Remove and return the walkstate object that is at the head of 494 * DESCRIPTION: Remove and return the walkstate object that is at the head of
494 * the walk stack for the given walk list. NULL indicates that 495 * the walk stack for the given walk list. NULL indicates that
495 * the list is empty. 496 * the list is empty.
496 * 497 *
497 ******************************************************************************/ 498 ******************************************************************************/
@@ -531,14 +532,17 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread)
531 * 532 *
532 * RETURN: Pointer to the new walk state. 533 * RETURN: Pointer to the new walk state.
533 * 534 *
534 * DESCRIPTION: Allocate and initialize a new walk state. The current walk 535 * DESCRIPTION: Allocate and initialize a new walk state. The current walk
535 * state is set to this new state. 536 * state is set to this new state.
536 * 537 *
537 ******************************************************************************/ 538 ******************************************************************************/
538 539
539struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union acpi_parse_object 540struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id,
540 *origin, union acpi_operand_object 541 union acpi_parse_object
541 *method_desc, struct acpi_thread_state 542 *origin,
543 union acpi_operand_object
544 *method_desc,
545 struct acpi_thread_state
542 *thread) 546 *thread)
543{ 547{
544 struct acpi_walk_state *walk_state; 548 struct acpi_walk_state *walk_state;
@@ -653,7 +657,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
653 /* 657 /*
654 * Setup the current scope. 658 * Setup the current scope.
655 * Find a Named Op that has a namespace node associated with it. 659 * Find a Named Op that has a namespace node associated with it.
656 * search upwards from this Op. Current scope is the first 660 * search upwards from this Op. Current scope is the first
657 * Op with a namespace node. 661 * Op with a namespace node.
658 */ 662 */
659 extra_op = parser_state->start_op; 663 extra_op = parser_state->start_op;
@@ -704,13 +708,13 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state)
704 ACPI_FUNCTION_TRACE_PTR(ds_delete_walk_state, walk_state); 708 ACPI_FUNCTION_TRACE_PTR(ds_delete_walk_state, walk_state);
705 709
706 if (!walk_state) { 710 if (!walk_state) {
707 return; 711 return_VOID;
708 } 712 }
709 713
710 if (walk_state->descriptor_type != ACPI_DESC_TYPE_WALK) { 714 if (walk_state->descriptor_type != ACPI_DESC_TYPE_WALK) {
711 ACPI_ERROR((AE_INFO, "%p is not a valid walk state", 715 ACPI_ERROR((AE_INFO, "%p is not a valid walk state",
712 walk_state)); 716 walk_state));
713 return; 717 return_VOID;
714 } 718 }
715 719
716 /* There should not be any open scopes */ 720 /* There should not be any open scopes */
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index ef0193d74b5d..36d120574423 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -89,7 +89,8 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info)
89 /* Set the mask bit only if there are references to this GPE */ 89 /* Set the mask bit only if there are references to this GPE */
90 90
91 if (gpe_event_info->runtime_count) { 91 if (gpe_event_info->runtime_count) {
92 ACPI_SET_BIT(gpe_register_info->enable_for_run, (u8)register_bit); 92 ACPI_SET_BIT(gpe_register_info->enable_for_run,
93 (u8)register_bit);
93 } 94 }
94 95
95 return_ACPI_STATUS(AE_OK); 96 return_ACPI_STATUS(AE_OK);
@@ -106,8 +107,7 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info)
106 * DESCRIPTION: Clear a GPE of stale events and enable it. 107 * DESCRIPTION: Clear a GPE of stale events and enable it.
107 * 108 *
108 ******************************************************************************/ 109 ******************************************************************************/
109acpi_status 110acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
110acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
111{ 111{
112 acpi_status status; 112 acpi_status status;
113 113
@@ -131,8 +131,8 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
131 } 131 }
132 132
133 /* Enable the requested GPE */ 133 /* Enable the requested GPE */
134 status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
135 134
135 status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
136 return_ACPI_STATUS(status); 136 return_ACPI_STATUS(status);
137} 137}
138 138
@@ -150,7 +150,8 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
150 * 150 *
151 ******************************************************************************/ 151 ******************************************************************************/
152 152
153acpi_status acpi_ev_add_gpe_reference(struct acpi_gpe_event_info *gpe_event_info) 153acpi_status
154acpi_ev_add_gpe_reference(struct acpi_gpe_event_info *gpe_event_info)
154{ 155{
155 acpi_status status = AE_OK; 156 acpi_status status = AE_OK;
156 157
@@ -191,7 +192,8 @@ acpi_status acpi_ev_add_gpe_reference(struct acpi_gpe_event_info *gpe_event_info
191 * 192 *
192 ******************************************************************************/ 193 ******************************************************************************/
193 194
194acpi_status acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info) 195acpi_status
196acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info)
195{ 197{
196 acpi_status status = AE_OK; 198 acpi_status status = AE_OK;
197 199
@@ -208,7 +210,8 @@ acpi_status acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_i
208 210
209 status = acpi_ev_update_gpe_enable_mask(gpe_event_info); 211 status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
210 if (ACPI_SUCCESS(status)) { 212 if (ACPI_SUCCESS(status)) {
211 status = acpi_hw_low_set_gpe(gpe_event_info, 213 status =
214 acpi_hw_low_set_gpe(gpe_event_info,
212 ACPI_GPE_DISABLE); 215 ACPI_GPE_DISABLE);
213 } 216 }
214 217
@@ -306,7 +309,8 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
306 309
307 /* A Non-NULL gpe_device means this is a GPE Block Device */ 310 /* A Non-NULL gpe_device means this is a GPE Block Device */
308 311
309 obj_desc = acpi_ns_get_attached_object((struct acpi_namespace_node *) 312 obj_desc =
313 acpi_ns_get_attached_object((struct acpi_namespace_node *)
310 gpe_device); 314 gpe_device);
311 if (!obj_desc || !obj_desc->device.gpe_block) { 315 if (!obj_desc || !obj_desc->device.gpe_block) {
312 return (NULL); 316 return (NULL);
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index 8cf4c104c7b7..1571a61a7833 100644
--- a/drivers/acpi/acpica/evgpeblk.c
+++ b/drivers/acpi/acpica/evgpeblk.c
@@ -486,7 +486,8 @@ acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
486 if (ACPI_FAILURE(status)) { 486 if (ACPI_FAILURE(status)) {
487 ACPI_EXCEPTION((AE_INFO, status, 487 ACPI_EXCEPTION((AE_INFO, status,
488 "Could not enable GPE 0x%02X", 488 "Could not enable GPE 0x%02X",
489 gpe_index + gpe_block->block_base_number)); 489 gpe_index +
490 gpe_block->block_base_number));
490 continue; 491 continue;
491 } 492 }
492 493
diff --git a/drivers/acpi/acpica/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c
index cb50dd91bc18..228a0c3b1d49 100644
--- a/drivers/acpi/acpica/evgpeutil.c
+++ b/drivers/acpi/acpica/evgpeutil.c
@@ -374,7 +374,8 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
374 gpe_event_info->dispatch.handler = NULL; 374 gpe_event_info->dispatch.handler = NULL;
375 gpe_event_info->flags &= 375 gpe_event_info->flags &=
376 ~ACPI_GPE_DISPATCH_MASK; 376 ~ACPI_GPE_DISPATCH_MASK;
377 } else if ((gpe_event_info-> 377 } else
378 if ((gpe_event_info->
378 flags & ACPI_GPE_DISPATCH_MASK) == 379 flags & ACPI_GPE_DISPATCH_MASK) ==
379 ACPI_GPE_DISPATCH_NOTIFY) { 380 ACPI_GPE_DISPATCH_NOTIFY) {
380 381
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index 4c1c8261166f..1474241bfc7e 100644
--- a/drivers/acpi/acpica/evrgnini.c
+++ b/drivers/acpi/acpica/evrgnini.c
@@ -227,8 +227,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
227 227
228 /* Install a handler for this PCI root bridge */ 228 /* Install a handler for this PCI root bridge */
229 229
230 status = 230 status = acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
231 acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
232 if (ACPI_FAILURE(status)) { 231 if (ACPI_FAILURE(status)) {
233 if (status == AE_SAME_HANDLER) { 232 if (status == AE_SAME_HANDLER) {
234 /* 233 /*
@@ -350,8 +349,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
350static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) 349static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
351{ 350{
352 acpi_status status; 351 acpi_status status;
353 struct acpica_device_id *hid; 352 struct acpi_pnp_device_id *hid;
354 struct acpica_device_id_list *cid; 353 struct acpi_pnp_device_id_list *cid;
355 u32 i; 354 u32 i;
356 u8 match; 355 u8 match;
357 356
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c
index 7587eb6c9584..ae668f32cf16 100644
--- a/drivers/acpi/acpica/evxface.c
+++ b/drivers/acpi/acpica/evxface.c
@@ -398,7 +398,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_exception_handler)
398 * 398 *
399 ******************************************************************************/ 399 ******************************************************************************/
400acpi_status 400acpi_status
401acpi_install_global_event_handler(ACPI_GBL_EVENT_HANDLER handler, void *context) 401acpi_install_global_event_handler(acpi_gbl_event_handler handler, void *context)
402{ 402{
403 acpi_status status; 403 acpi_status status;
404 404
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c
index 87c5f2332260..3f30e753b652 100644
--- a/drivers/acpi/acpica/evxfgpe.c
+++ b/drivers/acpi/acpica/evxfgpe.c
@@ -221,7 +221,8 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device,
221 if (wake_device == ACPI_ROOT_OBJECT) { 221 if (wake_device == ACPI_ROOT_OBJECT) {
222 device_node = acpi_gbl_root_node; 222 device_node = acpi_gbl_root_node;
223 } else { 223 } else {
224 device_node = ACPI_CAST_PTR(struct acpi_namespace_node, wake_device); 224 device_node =
225 ACPI_CAST_PTR(struct acpi_namespace_node, wake_device);
225 } 226 }
226 227
227 /* Validate WakeDevice is of type Device */ 228 /* Validate WakeDevice is of type Device */
@@ -324,7 +325,8 @@ ACPI_EXPORT_SYMBOL(acpi_setup_gpe_for_wake)
324 * 325 *
325 ******************************************************************************/ 326 ******************************************************************************/
326 327
327acpi_status acpi_set_gpe_wake_mask(acpi_handle gpe_device, u32 gpe_number, u8 action) 328acpi_status
329acpi_set_gpe_wake_mask(acpi_handle gpe_device, u32 gpe_number, u8 action)
328{ 330{
329 acpi_status status = AE_OK; 331 acpi_status status = AE_OK;
330 struct acpi_gpe_event_info *gpe_event_info; 332 struct acpi_gpe_event_info *gpe_event_info;
@@ -567,7 +569,7 @@ acpi_install_gpe_block(acpi_handle gpe_device,
567 569
568 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 570 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
569 if (ACPI_FAILURE(status)) { 571 if (ACPI_FAILURE(status)) {
570 return (status); 572 return_ACPI_STATUS(status);
571 } 573 }
572 574
573 node = acpi_ns_validate_handle(gpe_device); 575 node = acpi_ns_validate_handle(gpe_device);
@@ -650,7 +652,7 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
650 652
651 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 653 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
652 if (ACPI_FAILURE(status)) { 654 if (ACPI_FAILURE(status)) {
653 return (status); 655 return_ACPI_STATUS(status);
654 } 656 }
655 657
656 node = acpi_ns_validate_handle(gpe_device); 658 node = acpi_ns_validate_handle(gpe_device);
@@ -694,8 +696,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block)
694 * the FADT-defined gpe blocks. Otherwise, the GPE block device. 696 * the FADT-defined gpe blocks. Otherwise, the GPE block device.
695 * 697 *
696 ******************************************************************************/ 698 ******************************************************************************/
697acpi_status 699acpi_status acpi_get_gpe_device(u32 index, acpi_handle * gpe_device)
698acpi_get_gpe_device(u32 index, acpi_handle *gpe_device)
699{ 700{
700 struct acpi_gpe_device_info info; 701 struct acpi_gpe_device_info info;
701 acpi_status status; 702 acpi_status status;
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c
index bfb062e4c4b4..4492a4e03022 100644
--- a/drivers/acpi/acpica/exconvrt.c
+++ b/drivers/acpi/acpica/exconvrt.c
@@ -516,8 +516,8 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
516 string_length--; 516 string_length--;
517 } 517 }
518 518
519 return_desc = acpi_ut_create_string_object((acpi_size) 519 return_desc =
520 string_length); 520 acpi_ut_create_string_object((acpi_size) string_length);
521 if (!return_desc) { 521 if (!return_desc) {
522 return_ACPI_STATUS(AE_NO_MEMORY); 522 return_ACPI_STATUS(AE_NO_MEMORY);
523 } 523 }
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c
index 691d4763102c..66554bc6f9a8 100644
--- a/drivers/acpi/acpica/excreate.c
+++ b/drivers/acpi/acpica/excreate.c
@@ -78,7 +78,7 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
78 (target_node->type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { 78 (target_node->type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
79 /* 79 /*
80 * Dereference an existing alias so that we don't create a chain 80 * Dereference an existing alias so that we don't create a chain
81 * of aliases. With this code, we guarantee that an alias is 81 * of aliases. With this code, we guarantee that an alias is
82 * always exactly one level of indirection away from the 82 * always exactly one level of indirection away from the
83 * actual aliased name. 83 * actual aliased name.
84 */ 84 */
@@ -90,7 +90,7 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
90 /* 90 /*
91 * For objects that can never change (i.e., the NS node will 91 * For objects that can never change (i.e., the NS node will
92 * permanently point to the same object), we can simply attach 92 * permanently point to the same object), we can simply attach
93 * the object to the new NS node. For other objects (such as 93 * the object to the new NS node. For other objects (such as
94 * Integers, buffers, etc.), we have to point the Alias node 94 * Integers, buffers, etc.), we have to point the Alias node
95 * to the original Node. 95 * to the original Node.
96 */ 96 */
@@ -139,7 +139,7 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
139 139
140 /* 140 /*
141 * The new alias assumes the type of the target, and it points 141 * The new alias assumes the type of the target, and it points
142 * to the same object. The reference count of the object has an 142 * to the same object. The reference count of the object has an
143 * additional reference to prevent deletion out from under either the 143 * additional reference to prevent deletion out from under either the
144 * target node or the alias Node 144 * target node or the alias Node
145 */ 145 */
@@ -243,8 +243,7 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
243 243
244 /* Init object and attach to NS node */ 244 /* Init object and attach to NS node */
245 245
246 obj_desc->mutex.sync_level = 246 obj_desc->mutex.sync_level = (u8)walk_state->operands[1]->integer.value;
247 (u8) walk_state->operands[1]->integer.value;
248 obj_desc->mutex.node = 247 obj_desc->mutex.node =
249 (struct acpi_namespace_node *)walk_state->operands[0]; 248 (struct acpi_namespace_node *)walk_state->operands[0];
250 249
diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c
index bc5b9a6a1316..d7c9f51608a7 100644
--- a/drivers/acpi/acpica/exdebug.c
+++ b/drivers/acpi/acpica/exdebug.c
@@ -145,10 +145,10 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
145 case ACPI_TYPE_BUFFER: 145 case ACPI_TYPE_BUFFER:
146 146
147 acpi_os_printf("[0x%.2X]\n", (u32)source_desc->buffer.length); 147 acpi_os_printf("[0x%.2X]\n", (u32)source_desc->buffer.length);
148 acpi_ut_dump_buffer2(source_desc->buffer.pointer, 148 acpi_ut_dump_buffer(source_desc->buffer.pointer,
149 (source_desc->buffer.length < 256) ? 149 (source_desc->buffer.length < 256) ?
150 source_desc->buffer.length : 256, 150 source_desc->buffer.length : 256,
151 DB_BYTE_DISPLAY); 151 DB_BYTE_DISPLAY, 0);
152 break; 152 break;
153 153
154 case ACPI_TYPE_STRING: 154 case ACPI_TYPE_STRING:
@@ -190,7 +190,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
190 190
191 acpi_os_printf("Table Index 0x%X\n", 191 acpi_os_printf("Table Index 0x%X\n",
192 source_desc->reference.value); 192 source_desc->reference.value);
193 return; 193 return_VOID;
194 194
195 default: 195 default:
196 break; 196 break;
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index 213c081776fc..858b43a7dcf6 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -464,7 +464,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
464 464
465 ACPI_FUNCTION_NAME(ex_dump_operand) 465 ACPI_FUNCTION_NAME(ex_dump_operand)
466 466
467 if (!((ACPI_LV_EXEC & acpi_dbg_level) 467 if (!
468 ((ACPI_LV_EXEC & acpi_dbg_level)
468 && (_COMPONENT & acpi_dbg_layer))) { 469 && (_COMPONENT & acpi_dbg_layer))) {
469 return; 470 return;
470 } 471 }
@@ -777,7 +778,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands,
777 * PARAMETERS: title - Descriptive text 778 * PARAMETERS: title - Descriptive text
778 * value - Value to be displayed 779 * value - Value to be displayed
779 * 780 *
780 * DESCRIPTION: Object dump output formatting functions. These functions 781 * DESCRIPTION: Object dump output formatting functions. These functions
781 * reduce the number of format strings required and keeps them 782 * reduce the number of format strings required and keeps them
782 * all in one place for easy modification. 783 * all in one place for easy modification.
783 * 784 *
@@ -810,7 +811,8 @@ void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags)
810 ACPI_FUNCTION_ENTRY(); 811 ACPI_FUNCTION_ENTRY();
811 812
812 if (!flags) { 813 if (!flags) {
813 if (!((ACPI_LV_OBJECTS & acpi_dbg_level) 814 if (!
815 ((ACPI_LV_OBJECTS & acpi_dbg_level)
814 && (_COMPONENT & acpi_dbg_layer))) { 816 && (_COMPONENT & acpi_dbg_layer))) {
815 return; 817 return;
816 } 818 }
@@ -940,10 +942,11 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
940 acpi_os_printf("[Buffer] Length %.2X = ", 942 acpi_os_printf("[Buffer] Length %.2X = ",
941 obj_desc->buffer.length); 943 obj_desc->buffer.length);
942 if (obj_desc->buffer.length) { 944 if (obj_desc->buffer.length) {
943 acpi_ut_dump_buffer(ACPI_CAST_PTR 945 acpi_ut_debug_dump_buffer(ACPI_CAST_PTR
944 (u8, obj_desc->buffer.pointer), 946 (u8,
945 obj_desc->buffer.length, 947 obj_desc->buffer.pointer),
946 DB_DWORD_DISPLAY, _COMPONENT); 948 obj_desc->buffer.length,
949 DB_DWORD_DISPLAY, _COMPONENT);
947 } else { 950 } else {
948 acpi_os_printf("\n"); 951 acpi_os_printf("\n");
949 } 952 }
@@ -996,7 +999,8 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
996 } 999 }
997 1000
998 if (!flags) { 1001 if (!flags) {
999 if (!((ACPI_LV_OBJECTS & acpi_dbg_level) 1002 if (!
1003 ((ACPI_LV_OBJECTS & acpi_dbg_level)
1000 && (_COMPONENT & acpi_dbg_layer))) { 1004 && (_COMPONENT & acpi_dbg_layer))) {
1001 return_VOID; 1005 return_VOID;
1002 } 1006 }
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index dc092f5b35d6..ebc55fbf3ff7 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -59,7 +59,7 @@ ACPI_MODULE_NAME("exfield")
59 * 59 *
60 * RETURN: Status 60 * RETURN: Status
61 * 61 *
62 * DESCRIPTION: Read from a named field. Returns either an Integer or a 62 * DESCRIPTION: Read from a named field. Returns either an Integer or a
63 * Buffer, depending on the size of the field. 63 * Buffer, depending on the size of the field.
64 * 64 *
65 ******************************************************************************/ 65 ******************************************************************************/
@@ -149,7 +149,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
149 * Allocate a buffer for the contents of the field. 149 * Allocate a buffer for the contents of the field.
150 * 150 *
151 * If the field is larger than the current integer width, create 151 * If the field is larger than the current integer width, create
152 * a BUFFER to hold it. Otherwise, use an INTEGER. This allows 152 * a BUFFER to hold it. Otherwise, use an INTEGER. This allows
153 * the use of arithmetic operators on the returned value if the 153 * the use of arithmetic operators on the returned value if the
154 * field size is equal or smaller than an Integer. 154 * field size is equal or smaller than an Integer.
155 * 155 *
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c
index a7784152ed30..aa2ccfb7cb61 100644
--- a/drivers/acpi/acpica/exfldio.c
+++ b/drivers/acpi/acpica/exfldio.c
@@ -54,8 +54,7 @@ ACPI_MODULE_NAME("exfldio")
54/* Local prototypes */ 54/* Local prototypes */
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, u64 *value, u32 read_write);
58 u64 *value, u32 read_write);
59 58
60static u8 59static u8
61acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value); 60acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value);
@@ -155,7 +154,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
155#endif 154#endif
156 155
157 /* 156 /*
158 * Validate the request. The entire request from the byte offset for a 157 * Validate the request. The entire request from the byte offset for a
159 * length of one field datum (access width) must fit within the region. 158 * length of one field datum (access width) must fit within the region.
160 * (Region length is specified in bytes) 159 * (Region length is specified in bytes)
161 */ 160 */
@@ -183,7 +182,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
183 obj_desc->common_field.access_byte_width) { 182 obj_desc->common_field.access_byte_width) {
184 /* 183 /*
185 * This is the case where the access_type (acc_word, etc.) is wider 184 * This is the case where the access_type (acc_word, etc.) is wider
186 * than the region itself. For example, a region of length one 185 * than the region itself. For example, a region of length one
187 * byte, and a field with Dword access specified. 186 * byte, and a field with Dword access specified.
188 */ 187 */
189 ACPI_ERROR((AE_INFO, 188 ACPI_ERROR((AE_INFO,
@@ -321,7 +320,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,
321 * 320 *
322 * DESCRIPTION: Check if a value is out of range of the field being written. 321 * DESCRIPTION: Check if a value is out of range of the field being written.
323 * Used to check if the values written to Index and Bank registers 322 * Used to check if the values written to Index and Bank registers
324 * are out of range. Normally, the value is simply truncated 323 * are out of range. Normally, the value is simply truncated
325 * to fit the field, but this case is most likely a serious 324 * to fit the field, but this case is most likely a serious
326 * coding error in the ASL. 325 * coding error in the ASL.
327 * 326 *
@@ -370,7 +369,7 @@ acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value)
370 * 369 *
371 * RETURN: Status 370 * RETURN: Status
372 * 371 *
373 * DESCRIPTION: Read or Write a single datum of a field. The field_type is 372 * DESCRIPTION: Read or Write a single datum of a field. The field_type is
374 * demultiplexed here to handle the different types of fields 373 * demultiplexed here to handle the different types of fields
375 * (buffer_field, region_field, index_field, bank_field) 374 * (buffer_field, region_field, index_field, bank_field)
376 * 375 *
@@ -860,7 +859,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
860 ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); 859 ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length);
861 /* 860 /*
862 * We must have a buffer that is at least as long as the field 861 * We must have a buffer that is at least as long as the field
863 * we are writing to. This is because individual fields are 862 * we are writing to. This is because individual fields are
864 * indivisible and partial writes are not supported -- as per 863 * indivisible and partial writes are not supported -- as per
865 * the ACPI specification. 864 * the ACPI specification.
866 */ 865 */
@@ -875,7 +874,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
875 874
876 /* 875 /*
877 * Copy the original data to the new buffer, starting 876 * Copy the original data to the new buffer, starting
878 * at Byte zero. All unused (upper) bytes of the 877 * at Byte zero. All unused (upper) bytes of the
879 * buffer will be 0. 878 * buffer will be 0.
880 */ 879 */
881 ACPI_MEMCPY((char *)new_buffer, (char *)buffer, buffer_length); 880 ACPI_MEMCPY((char *)new_buffer, (char *)buffer, buffer_length);
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c
index 271c0c57ea10..84058705ed12 100644
--- a/drivers/acpi/acpica/exmisc.c
+++ b/drivers/acpi/acpica/exmisc.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes 3 * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
@@ -254,7 +253,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
254 ACPI_FUNCTION_TRACE(ex_do_concatenate); 253 ACPI_FUNCTION_TRACE(ex_do_concatenate);
255 254
256 /* 255 /*
257 * Convert the second operand if necessary. The first operand 256 * Convert the second operand if necessary. The first operand
258 * determines the type of the second operand, (See the Data Types 257 * determines the type of the second operand, (See the Data Types
259 * section of the ACPI specification.) Both object types are 258 * section of the ACPI specification.) Both object types are
260 * guaranteed to be either Integer/String/Buffer by the operand 259 * guaranteed to be either Integer/String/Buffer by the operand
@@ -573,7 +572,7 @@ acpi_ex_do_logical_op(u16 opcode,
573 ACPI_FUNCTION_TRACE(ex_do_logical_op); 572 ACPI_FUNCTION_TRACE(ex_do_logical_op);
574 573
575 /* 574 /*
576 * Convert the second operand if necessary. The first operand 575 * Convert the second operand if necessary. The first operand
577 * determines the type of the second operand, (See the Data Types 576 * determines the type of the second operand, (See the Data Types
578 * section of the ACPI 3.0+ specification.) Both object types are 577 * section of the ACPI 3.0+ specification.) Both object types are
579 * guaranteed to be either Integer/String/Buffer by the operand 578 * guaranteed to be either Integer/String/Buffer by the operand
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c
index bcceda5be9e3..d1f449d93dcf 100644
--- a/drivers/acpi/acpica/exmutex.c
+++ b/drivers/acpi/acpica/exmutex.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exmutex - ASL Mutex Acquire/Release functions 3 * Module Name: exmutex - ASL Mutex Acquire/Release functions
@@ -305,7 +304,7 @@ acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc)
305 ACPI_FUNCTION_TRACE(ex_release_mutex_object); 304 ACPI_FUNCTION_TRACE(ex_release_mutex_object);
306 305
307 if (obj_desc->mutex.acquisition_depth == 0) { 306 if (obj_desc->mutex.acquisition_depth == 0) {
308 return (AE_NOT_ACQUIRED); 307 return_ACPI_STATUS(AE_NOT_ACQUIRED);
309 } 308 }
310 309
311 /* Match multiple Acquires with multiple Releases */ 310 /* Match multiple Acquires with multiple Releases */
@@ -462,7 +461,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread)
462 union acpi_operand_object *next = thread->acquired_mutex_list; 461 union acpi_operand_object *next = thread->acquired_mutex_list;
463 union acpi_operand_object *obj_desc; 462 union acpi_operand_object *obj_desc;
464 463
465 ACPI_FUNCTION_ENTRY(); 464 ACPI_FUNCTION_NAME(ex_release_all_mutexes);
466 465
467 /* Traverse the list of owned mutexes, releasing each one */ 466 /* Traverse the list of owned mutexes, releasing each one */
468 467
@@ -474,6 +473,10 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread)
474 obj_desc->mutex.next = NULL; 473 obj_desc->mutex.next = NULL;
475 obj_desc->mutex.acquisition_depth = 0; 474 obj_desc->mutex.acquisition_depth = 0;
476 475
476 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
477 "Force-releasing held mutex: %p\n",
478 obj_desc));
479
477 /* Release the mutex, special case for Global Lock */ 480 /* Release the mutex, special case for Global Lock */
478 481
479 if (obj_desc == acpi_gbl_global_lock_mutex) { 482 if (obj_desc == acpi_gbl_global_lock_mutex) {
diff --git a/drivers/acpi/acpica/exnames.c b/drivers/acpi/acpica/exnames.c
index fcc75fa27d32..2ff578a16adc 100644
--- a/drivers/acpi/acpica/exnames.c
+++ b/drivers/acpi/acpica/exnames.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exnames - interpreter/scanner name load/execute 3 * Module Name: exnames - interpreter/scanner name load/execute
@@ -53,8 +52,7 @@ ACPI_MODULE_NAME("exnames")
53/* Local prototypes */ 52/* Local prototypes */
54static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs); 53static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs);
55 54
56static acpi_status 55static acpi_status acpi_ex_name_segment(u8 **in_aml_address, char *name_string);
57acpi_ex_name_segment(u8 ** in_aml_address, char *name_string);
58 56
59/******************************************************************************* 57/*******************************************************************************
60 * 58 *
@@ -64,7 +62,7 @@ acpi_ex_name_segment(u8 ** in_aml_address, char *name_string);
64 * (-1)==root, 0==none 62 * (-1)==root, 0==none
65 * num_name_segs - count of 4-character name segments 63 * num_name_segs - count of 4-character name segments
66 * 64 *
67 * RETURN: A pointer to the allocated string segment. This segment must 65 * RETURN: A pointer to the allocated string segment. This segment must
68 * be deleted by the caller. 66 * be deleted by the caller.
69 * 67 *
70 * DESCRIPTION: Allocate a buffer for a name string. Ensure allocated name 68 * DESCRIPTION: Allocate a buffer for a name string. Ensure allocated name
@@ -178,7 +176,8 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
178 176
179 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Bytes from stream:\n")); 177 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Bytes from stream:\n"));
180 178
181 for (index = 0; (index < ACPI_NAME_SIZE) 179 for (index = 0;
180 (index < ACPI_NAME_SIZE)
182 && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) { 181 && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) {
183 char_buf[index] = *aml_address++; 182 char_buf[index] = *aml_address++;
184 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); 183 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index]));
diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c
index 9ba8c73cea16..bbf01e9bf057 100644
--- a/drivers/acpi/acpica/exoparg1.c
+++ b/drivers/acpi/acpica/exoparg1.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exoparg1 - AML execution - opcodes with 1 argument 3 * Module Name: exoparg1 - AML execution - opcodes with 1 argument
@@ -606,7 +605,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
606 } 605 }
607 606
608 /* 607 /*
609 * Set result to ONES (TRUE) if Value == 0. Note: 608 * Set result to ONES (TRUE) if Value == 0. Note:
610 * return_desc->Integer.Value is initially == 0 (FALSE) from above. 609 * return_desc->Integer.Value is initially == 0 (FALSE) from above.
611 */ 610 */
612 if (!operand[0]->integer.value) { 611 if (!operand[0]->integer.value) {
@@ -618,7 +617,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
618 case AML_INCREMENT_OP: /* Increment (Operand) */ 617 case AML_INCREMENT_OP: /* Increment (Operand) */
619 618
620 /* 619 /*
621 * Create a new integer. Can't just get the base integer and 620 * Create a new integer. Can't just get the base integer and
622 * increment it because it may be an Arg or Field. 621 * increment it because it may be an Arg or Field.
623 */ 622 */
624 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 623 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
@@ -686,7 +685,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
686 685
687 /* 686 /*
688 * Note: The operand is not resolved at this point because we want to 687 * Note: The operand is not resolved at this point because we want to
689 * get the associated object, not its value. For example, we don't 688 * get the associated object, not its value. For example, we don't
690 * want to resolve a field_unit to its value, we want the actual 689 * want to resolve a field_unit to its value, we want the actual
691 * field_unit object. 690 * field_unit object.
692 */ 691 */
@@ -727,7 +726,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
727 726
728 /* 727 /*
729 * The type of the base object must be integer, buffer, string, or 728 * The type of the base object must be integer, buffer, string, or
730 * package. All others are not supported. 729 * package. All others are not supported.
731 * 730 *
732 * NOTE: Integer is not specifically supported by the ACPI spec, 731 * NOTE: Integer is not specifically supported by the ACPI spec,
733 * but is supported implicitly via implicit operand conversion. 732 * but is supported implicitly via implicit operand conversion.
@@ -965,7 +964,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
965 case ACPI_TYPE_PACKAGE: 964 case ACPI_TYPE_PACKAGE:
966 965
967 /* 966 /*
968 * Return the referenced element of the package. We must 967 * Return the referenced element of the package. We must
969 * add another reference to the referenced object, however. 968 * add another reference to the referenced object, however.
970 */ 969 */
971 return_desc = 970 return_desc =
diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c
index 879e8a277b94..ee5634a074c4 100644
--- a/drivers/acpi/acpica/exoparg2.c
+++ b/drivers/acpi/acpica/exoparg2.c
@@ -123,7 +123,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
123 /* 123 /*
124 * Dispatch the notify to the appropriate handler 124 * Dispatch the notify to the appropriate handler
125 * NOTE: the request is queued for execution after this method 125 * NOTE: the request is queued for execution after this method
126 * completes. The notify handlers are NOT invoked synchronously 126 * completes. The notify handlers are NOT invoked synchronously
127 * from this thread -- because handlers may in turn run other 127 * from this thread -- because handlers may in turn run other
128 * control methods. 128 * control methods.
129 */ 129 */
diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c
index 71fcc65c9ffa..2c89b4651f08 100644
--- a/drivers/acpi/acpica/exoparg3.c
+++ b/drivers/acpi/acpica/exoparg3.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exoparg3 - AML execution - opcodes with 3 arguments 3 * Module Name: exoparg3 - AML execution - opcodes with 3 arguments
@@ -158,7 +157,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
158 case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ 157 case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
159 158
160 /* 159 /*
161 * Create the return object. The Source operand is guaranteed to be 160 * Create the return object. The Source operand is guaranteed to be
162 * either a String or a Buffer, so just use its type. 161 * either a String or a Buffer, so just use its type.
163 */ 162 */
164 return_desc = acpi_ut_create_internal_object((operand[0])-> 163 return_desc = acpi_ut_create_internal_object((operand[0])->
diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c
index 0786b8659061..3e08695c3b30 100644
--- a/drivers/acpi/acpica/exoparg6.c
+++ b/drivers/acpi/acpica/exoparg6.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exoparg6 - AML execution - opcodes with 6 arguments 3 * Module Name: exoparg6 - AML execution - opcodes with 6 arguments
@@ -198,7 +197,7 @@ acpi_ex_do_match(u32 match_op,
198 return (FALSE); 197 return (FALSE);
199 } 198 }
200 199
201 return logical_result; 200 return (logical_result);
202} 201}
203 202
204/******************************************************************************* 203/*******************************************************************************
@@ -269,7 +268,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
269 * and the next should be examined. 268 * and the next should be examined.
270 * 269 *
271 * Upon finding a match, the loop will terminate via "break" at 270 * Upon finding a match, the loop will terminate via "break" at
272 * the bottom. If it terminates "normally", match_value will be 271 * the bottom. If it terminates "normally", match_value will be
273 * ACPI_UINT64_MAX (Ones) (its initial value) indicating that no 272 * ACPI_UINT64_MAX (Ones) (its initial value) indicating that no
274 * match was found. 273 * match was found.
275 */ 274 */
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c
index 81eca60d2748..ba9db4de7c89 100644
--- a/drivers/acpi/acpica/exprep.c
+++ b/drivers/acpi/acpica/exprep.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities 3 * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
@@ -78,8 +77,8 @@ acpi_ex_generate_access(u32 field_bit_offset,
78 * any_acc keyword. 77 * any_acc keyword.
79 * 78 *
80 * NOTE: Need to have the region_length in order to check for boundary 79 * NOTE: Need to have the region_length in order to check for boundary
81 * conditions (end-of-region). However, the region_length is a deferred 80 * conditions (end-of-region). However, the region_length is a deferred
82 * operation. Therefore, to complete this implementation, the generation 81 * operation. Therefore, to complete this implementation, the generation
83 * of this access width must be deferred until the region length has 82 * of this access width must be deferred until the region length has
84 * been evaluated. 83 * been evaluated.
85 * 84 *
@@ -308,7 +307,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
308 * RETURN: Status 307 * RETURN: Status
309 * 308 *
310 * DESCRIPTION: Initialize the areas of the field object that are common 309 * DESCRIPTION: Initialize the areas of the field object that are common
311 * to the various types of fields. Note: This is very "sensitive" 310 * to the various types of fields. Note: This is very "sensitive"
312 * code because we are solving the general case for field 311 * code because we are solving the general case for field
313 * alignment. 312 * alignment.
314 * 313 *
@@ -336,13 +335,13 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
336 obj_desc->common_field.bit_length = field_bit_length; 335 obj_desc->common_field.bit_length = field_bit_length;
337 336
338 /* 337 /*
339 * Decode the access type so we can compute offsets. The access type gives 338 * Decode the access type so we can compute offsets. The access type gives
340 * two pieces of information - the width of each field access and the 339 * two pieces of information - the width of each field access and the
341 * necessary byte_alignment (address granularity) of the access. 340 * necessary byte_alignment (address granularity) of the access.
342 * 341 *
343 * For any_acc, the access_bit_width is the largest width that is both 342 * For any_acc, the access_bit_width is the largest width that is both
344 * necessary and possible in an attempt to access the whole field in one 343 * necessary and possible in an attempt to access the whole field in one
345 * I/O operation. However, for any_acc, the byte_alignment is always one 344 * I/O operation. However, for any_acc, the byte_alignment is always one
346 * byte. 345 * byte.
347 * 346 *
348 * For all Buffer Fields, the byte_alignment is always one byte. 347 * For all Buffer Fields, the byte_alignment is always one byte.
@@ -363,7 +362,7 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
363 362
364 /* 363 /*
365 * base_byte_offset is the address of the start of the field within the 364 * base_byte_offset is the address of the start of the field within the
366 * region. It is the byte address of the first *datum* (field-width data 365 * region. It is the byte address of the first *datum* (field-width data
367 * unit) of the field. (i.e., the first datum that contains at least the 366 * unit) of the field. (i.e., the first datum that contains at least the
368 * first *bit* of the field.) 367 * first *bit* of the field.)
369 * 368 *
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c
index 1f1ce0c3d2f8..1db2c0bfde0b 100644
--- a/drivers/acpi/acpica/exregion.c
+++ b/drivers/acpi/acpica/exregion.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exregion - ACPI default op_region (address space) handlers 3 * Module Name: exregion - ACPI default op_region (address space) handlers
@@ -202,7 +201,7 @@ acpi_ex_system_memory_space_handler(u32 function,
202 * Perform the memory read or write 201 * Perform the memory read or write
203 * 202 *
204 * Note: For machines that do not support non-aligned transfers, the target 203 * Note: For machines that do not support non-aligned transfers, the target
205 * address was checked for alignment above. We do not attempt to break the 204 * address was checked for alignment above. We do not attempt to break the
206 * transfer up into smaller (byte-size) chunks because the AML specifically 205 * transfer up into smaller (byte-size) chunks because the AML specifically
207 * asked for a transfer width that the hardware may require. 206 * asked for a transfer width that the hardware may require.
208 */ 207 */
diff --git a/drivers/acpi/acpica/exresnte.c b/drivers/acpi/acpica/exresnte.c
index fa50e77e64a8..6239956786eb 100644
--- a/drivers/acpi/acpica/exresnte.c
+++ b/drivers/acpi/acpica/exresnte.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exresnte - AML Interpreter object resolution 3 * Module Name: exresnte - AML Interpreter object resolution
@@ -58,8 +57,8 @@ ACPI_MODULE_NAME("exresnte")
58 * PARAMETERS: object_ptr - Pointer to a location that contains 57 * PARAMETERS: object_ptr - Pointer to a location that contains
59 * a pointer to a NS node, and will receive a 58 * a pointer to a NS node, and will receive a
60 * pointer to the resolved object. 59 * pointer to the resolved object.
61 * walk_state - Current state. Valid only if executing AML 60 * walk_state - Current state. Valid only if executing AML
62 * code. NULL if simply resolving an object 61 * code. NULL if simply resolving an object
63 * 62 *
64 * RETURN: Status 63 * RETURN: Status
65 * 64 *
@@ -67,7 +66,7 @@ ACPI_MODULE_NAME("exresnte")
67 * 66 *
68 * Note: for some of the data types, the pointer attached to the Node 67 * Note: for some of the data types, the pointer attached to the Node
69 * can be either a pointer to an actual internal object or a pointer into the 68 * can be either a pointer to an actual internal object or a pointer into the
70 * AML stream itself. These types are currently: 69 * AML stream itself. These types are currently:
71 * 70 *
72 * ACPI_TYPE_INTEGER 71 * ACPI_TYPE_INTEGER
73 * ACPI_TYPE_STRING 72 * ACPI_TYPE_STRING
@@ -89,7 +88,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
89 ACPI_FUNCTION_TRACE(ex_resolve_node_to_value); 88 ACPI_FUNCTION_TRACE(ex_resolve_node_to_value);
90 89
91 /* 90 /*
92 * The stack pointer points to a struct acpi_namespace_node (Node). Get the 91 * The stack pointer points to a struct acpi_namespace_node (Node). Get the
93 * object that is attached to the Node. 92 * object that is attached to the Node.
94 */ 93 */
95 node = *object_ptr; 94 node = *object_ptr;
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c
index bbf40ac27585..cc176b245e22 100644
--- a/drivers/acpi/acpica/exresolv.c
+++ b/drivers/acpi/acpica/exresolv.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exresolv - AML Interpreter object resolution 3 * Module Name: exresolv - AML Interpreter object resolution
@@ -327,7 +326,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
327 * 326 *
328 * RETURN: Status 327 * RETURN: Status
329 * 328 *
330 * DESCRIPTION: Return the base object and type. Traverse a reference list if 329 * DESCRIPTION: Return the base object and type. Traverse a reference list if
331 * necessary to get to the base object. 330 * necessary to get to the base object.
332 * 331 *
333 ******************************************************************************/ 332 ******************************************************************************/
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c
index f232fbabdea8..b9ebff2f6a09 100644
--- a/drivers/acpi/acpica/exresop.c
+++ b/drivers/acpi/acpica/exresop.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exresop - AML Interpreter operand/object resolution 3 * Module Name: exresop - AML Interpreter operand/object resolution
@@ -87,7 +86,7 @@ acpi_ex_check_object_type(acpi_object_type type_needed,
87 if (type_needed == ACPI_TYPE_LOCAL_REFERENCE) { 86 if (type_needed == ACPI_TYPE_LOCAL_REFERENCE) {
88 /* 87 /*
89 * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference 88 * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
90 * objects and thus allow them to be targets. (As per the ACPI 89 * objects and thus allow them to be targets. (As per the ACPI
91 * specification, a store to a constant is a noop.) 90 * specification, a store to a constant is a noop.)
92 */ 91 */
93 if ((this_type == ACPI_TYPE_INTEGER) && 92 if ((this_type == ACPI_TYPE_INTEGER) &&
@@ -337,7 +336,8 @@ acpi_ex_resolve_operands(u16 opcode,
337 if ((opcode == AML_STORE_OP) && 336 if ((opcode == AML_STORE_OP) &&
338 ((*stack_ptr)->common.type == 337 ((*stack_ptr)->common.type ==
339 ACPI_TYPE_LOCAL_REFERENCE) 338 ACPI_TYPE_LOCAL_REFERENCE)
340 && ((*stack_ptr)->reference.class == ACPI_REFCLASS_INDEX)) { 339 && ((*stack_ptr)->reference.class ==
340 ACPI_REFCLASS_INDEX)) {
341 goto next_operand; 341 goto next_operand;
342 } 342 }
343 break; 343 break;
@@ -638,7 +638,7 @@ acpi_ex_resolve_operands(u16 opcode,
638 if (acpi_gbl_enable_interpreter_slack) { 638 if (acpi_gbl_enable_interpreter_slack) {
639 /* 639 /*
640 * Enable original behavior of Store(), allowing any and all 640 * Enable original behavior of Store(), allowing any and all
641 * objects as the source operand. The ACPI spec does not 641 * objects as the source operand. The ACPI spec does not
642 * allow this, however. 642 * allow this, however.
643 */ 643 */
644 break; 644 break;
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c
index 5fffe7ab5ece..90431f12f831 100644
--- a/drivers/acpi/acpica/exstore.c
+++ b/drivers/acpi/acpica/exstore.c
@@ -374,7 +374,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
374 * with the input value. 374 * with the input value.
375 * 375 *
376 * When storing into an object the data is converted to the 376 * When storing into an object the data is converted to the
377 * target object type then stored in the object. This means 377 * target object type then stored in the object. This means
378 * that the target object type (for an initialized target) will 378 * that the target object type (for an initialized target) will
379 * not be changed by a store operation. 379 * not be changed by a store operation.
380 * 380 *
@@ -491,7 +491,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
491 acpi_ut_get_object_type_name(source_desc), 491 acpi_ut_get_object_type_name(source_desc),
492 source_desc, node)); 492 source_desc, node));
493 493
494 /* No conversions for all other types. Just attach the source object */ 494 /* No conversions for all other types. Just attach the source object */
495 495
496 status = acpi_ns_attach_object(node, source_desc, 496 status = acpi_ns_attach_object(node, source_desc,
497 source_desc->common.type); 497 source_desc->common.type);
diff --git a/drivers/acpi/acpica/exstoren.c b/drivers/acpi/acpica/exstoren.c
index b35bed52e061..87153bbc4b43 100644
--- a/drivers/acpi/acpica/exstoren.c
+++ b/drivers/acpi/acpica/exstoren.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exstoren - AML Interpreter object store support, 3 * Module Name: exstoren - AML Interpreter object store support,
@@ -61,7 +60,7 @@ ACPI_MODULE_NAME("exstoren")
61 * 60 *
62 * RETURN: Status, resolved object in source_desc_ptr. 61 * RETURN: Status, resolved object in source_desc_ptr.
63 * 62 *
64 * DESCRIPTION: Resolve an object. If the object is a reference, dereference 63 * DESCRIPTION: Resolve an object. If the object is a reference, dereference
65 * it and return the actual object in the source_desc_ptr. 64 * it and return the actual object in the source_desc_ptr.
66 * 65 *
67 ******************************************************************************/ 66 ******************************************************************************/
@@ -93,7 +92,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
93 92
94 /* 93 /*
95 * Stores into a Field/Region or into a Integer/Buffer/String 94 * Stores into a Field/Region or into a Integer/Buffer/String
96 * are all essentially the same. This case handles the 95 * are all essentially the same. This case handles the
97 * "interchangeable" types Integer, String, and Buffer. 96 * "interchangeable" types Integer, String, and Buffer.
98 */ 97 */
99 if (source_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) { 98 if (source_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) {
@@ -167,7 +166,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
167 * 166 *
168 * RETURN: Status 167 * RETURN: Status
169 * 168 *
170 * DESCRIPTION: "Store" an object to another object. This may include 169 * DESCRIPTION: "Store" an object to another object. This may include
171 * converting the source type to the target type (implicit 170 * converting the source type to the target type (implicit
172 * conversion), and a copy of the value of the source to 171 * conversion), and a copy of the value of the source to
173 * the target. 172 * the target.
@@ -178,14 +177,14 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
178 * with the input value. 177 * with the input value.
179 * 178 *
180 * When storing into an object the data is converted to the 179 * When storing into an object the data is converted to the
181 * target object type then stored in the object. This means 180 * target object type then stored in the object. This means
182 * that the target object type (for an initialized target) will 181 * that the target object type (for an initialized target) will
183 * not be changed by a store operation. 182 * not be changed by a store operation.
184 * 183 *
185 * This module allows destination types of Number, String, 184 * This module allows destination types of Number, String,
186 * Buffer, and Package. 185 * Buffer, and Package.
187 * 186 *
188 * Assumes parameters are already validated. NOTE: source_desc 187 * Assumes parameters are already validated. NOTE: source_desc
189 * resolution (from a reference object) must be performed by 188 * resolution (from a reference object) must be performed by
190 * the caller if necessary. 189 * the caller if necessary.
191 * 190 *
diff --git a/drivers/acpi/acpica/exstorob.c b/drivers/acpi/acpica/exstorob.c
index 53c248473547..b5f339cb1305 100644
--- a/drivers/acpi/acpica/exstorob.c
+++ b/drivers/acpi/acpica/exstorob.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exstorob - AML Interpreter object store support, store to object 3 * Module Name: exstorob - AML Interpreter object store support, store to object
@@ -108,7 +107,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
108#ifdef ACPI_OBSOLETE_BEHAVIOR 107#ifdef ACPI_OBSOLETE_BEHAVIOR
109 /* 108 /*
110 * NOTE: ACPI versions up to 3.0 specified that the buffer must be 109 * NOTE: ACPI versions up to 3.0 specified that the buffer must be
111 * truncated if the string is smaller than the buffer. However, "other" 110 * truncated if the string is smaller than the buffer. However, "other"
112 * implementations of ACPI never did this and thus became the defacto 111 * implementations of ACPI never did this and thus became the defacto
113 * standard. ACPI 3.0A changes this behavior such that the buffer 112 * standard. ACPI 3.0A changes this behavior such that the buffer
114 * is no longer truncated. 113 * is no longer truncated.
@@ -117,7 +116,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
117 /* 116 /*
118 * OBSOLETE BEHAVIOR: 117 * OBSOLETE BEHAVIOR:
119 * If the original source was a string, we must truncate the buffer, 118 * If the original source was a string, we must truncate the buffer,
120 * according to the ACPI spec. Integer-to-Buffer and Buffer-to-Buffer 119 * according to the ACPI spec. Integer-to-Buffer and Buffer-to-Buffer
121 * copy must not truncate the original buffer. 120 * copy must not truncate the original buffer.
122 */ 121 */
123 if (original_src_type == ACPI_TYPE_STRING) { 122 if (original_src_type == ACPI_TYPE_STRING) {
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c
index b760641e2fc6..c8a0ad5c1f55 100644
--- a/drivers/acpi/acpica/exsystem.c
+++ b/drivers/acpi/acpica/exsystem.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exsystem - Interface to OS services 3 * Module Name: exsystem - Interface to OS services
@@ -59,7 +58,7 @@ ACPI_MODULE_NAME("exsystem")
59 * RETURN: Status 58 * RETURN: Status
60 * 59 *
61 * DESCRIPTION: Implements a semaphore wait with a check to see if the 60 * DESCRIPTION: Implements a semaphore wait with a check to see if the
62 * semaphore is available immediately. If it is not, the 61 * semaphore is available immediately. If it is not, the
63 * interpreter is released before waiting. 62 * interpreter is released before waiting.
64 * 63 *
65 ******************************************************************************/ 64 ******************************************************************************/
@@ -104,7 +103,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
104 * RETURN: Status 103 * RETURN: Status
105 * 104 *
106 * DESCRIPTION: Implements a mutex wait with a check to see if the 105 * DESCRIPTION: Implements a mutex wait with a check to see if the
107 * mutex is available immediately. If it is not, the 106 * mutex is available immediately. If it is not, the
108 * interpreter is released before waiting. 107 * interpreter is released before waiting.
109 * 108 *
110 ******************************************************************************/ 109 ******************************************************************************/
@@ -152,7 +151,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
152 * DESCRIPTION: Suspend running thread for specified amount of time. 151 * DESCRIPTION: Suspend running thread for specified amount of time.
153 * Note: ACPI specification requires that Stall() does not 152 * Note: ACPI specification requires that Stall() does not
154 * relinquish the processor, and delays longer than 100 usec 153 * relinquish the processor, and delays longer than 100 usec
155 * should use Sleep() instead. We allow stalls up to 255 usec 154 * should use Sleep() instead. We allow stalls up to 255 usec
156 * for compatibility with other interpreters and existing BIOSs. 155 * for compatibility with other interpreters and existing BIOSs.
157 * 156 *
158 ******************************************************************************/ 157 ******************************************************************************/
@@ -254,7 +253,7 @@ acpi_status acpi_ex_system_signal_event(union acpi_operand_object * obj_desc)
254 * RETURN: Status 253 * RETURN: Status
255 * 254 *
256 * DESCRIPTION: Provides an access point to perform synchronization operations 255 * DESCRIPTION: Provides an access point to perform synchronization operations
257 * within the AML. This operation is a request to wait for an 256 * within the AML. This operation is a request to wait for an
258 * event. 257 * event.
259 * 258 *
260 ******************************************************************************/ 259 ******************************************************************************/
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index d1ab7917eed7..264d22d8018c 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: exutils - interpreter/scanner utilities 3 * Module Name: exutils - interpreter/scanner utilities
@@ -45,12 +44,12 @@
45/* 44/*
46 * DEFINE_AML_GLOBALS is tested in amlcode.h 45 * DEFINE_AML_GLOBALS is tested in amlcode.h
47 * to determine whether certain global names should be "defined" or only 46 * to determine whether certain global names should be "defined" or only
48 * "declared" in the current compilation. This enhances maintainability 47 * "declared" in the current compilation. This enhances maintainability
49 * by enabling a single header file to embody all knowledge of the names 48 * by enabling a single header file to embody all knowledge of the names
50 * in question. 49 * in question.
51 * 50 *
52 * Exactly one module of any executable should #define DEFINE_GLOBALS 51 * Exactly one module of any executable should #define DEFINE_GLOBALS
53 * before #including the header files which use this convention. The 52 * before #including the header files which use this convention. The
54 * names in question will be defined and initialized in that module, 53 * names in question will be defined and initialized in that module,
55 * and declared as extern in all other modules which #include those 54 * and declared as extern in all other modules which #include those
56 * header files. 55 * header files.
diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c
index a1e71d0ef57b..90a9aea1cee9 100644
--- a/drivers/acpi/acpica/hwacpi.c
+++ b/drivers/acpi/acpica/hwacpi.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface 3 * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
@@ -136,7 +135,7 @@ acpi_status acpi_hw_set_mode(u32 mode)
136 * 135 *
137 * RETURN: SYS_MODE_ACPI or SYS_MODE_LEGACY 136 * RETURN: SYS_MODE_ACPI or SYS_MODE_LEGACY
138 * 137 *
139 * DESCRIPTION: Return current operating state of system. Determined by 138 * DESCRIPTION: Return current operating state of system. Determined by
140 * querying the SCI_EN bit. 139 * querying the SCI_EN bit.
141 * 140 *
142 ******************************************************************************/ 141 ******************************************************************************/
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c
index db4076580e2b..64560045052d 100644
--- a/drivers/acpi/acpica/hwgpe.c
+++ b/drivers/acpi/acpica/hwgpe.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: hwgpe - Low level GPE enable/disable/clear functions 3 * Module Name: hwgpe - Low level GPE enable/disable/clear functions
@@ -339,7 +338,8 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
339 338
340acpi_status 339acpi_status
341acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, 340acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
342 struct acpi_gpe_block_info *gpe_block, void *context) 341 struct acpi_gpe_block_info * gpe_block,
342 void *context)
343{ 343{
344 u32 i; 344 u32 i;
345 acpi_status status; 345 acpi_status status;
diff --git a/drivers/acpi/acpica/hwpci.c b/drivers/acpi/acpica/hwpci.c
index 1455ddcdc32c..65bc3453a29c 100644
--- a/drivers/acpi/acpica/hwpci.c
+++ b/drivers/acpi/acpica/hwpci.c
@@ -259,7 +259,7 @@ acpi_hw_process_pci_list(struct acpi_pci_id *pci_id,
259 status = acpi_hw_get_pci_device_info(pci_id, info->device, 259 status = acpi_hw_get_pci_device_info(pci_id, info->device,
260 &bus_number, &is_bridge); 260 &bus_number, &is_bridge);
261 if (ACPI_FAILURE(status)) { 261 if (ACPI_FAILURE(status)) {
262 return_ACPI_STATUS(status); 262 return (status);
263 } 263 }
264 264
265 info = info->next; 265 info = info->next;
@@ -271,7 +271,7 @@ acpi_hw_process_pci_list(struct acpi_pci_id *pci_id,
271 pci_id->segment, pci_id->bus, pci_id->device, 271 pci_id->segment, pci_id->bus, pci_id->device,
272 pci_id->function, status, bus_number, is_bridge)); 272 pci_id->function, status, bus_number, is_bridge));
273 273
274 return_ACPI_STATUS(AE_OK); 274 return (AE_OK);
275} 275}
276 276
277/******************************************************************************* 277/*******************************************************************************
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index 4af6d20ef077..f4e57503576b 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -1,4 +1,3 @@
1
2/******************************************************************************* 1/*******************************************************************************
3 * 2 *
4 * Module Name: hwregs - Read/write access functions for the various ACPI 3 * Module Name: hwregs - Read/write access functions for the various ACPI
diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c
index b6411f16832f..bfdce22f3798 100644
--- a/drivers/acpi/acpica/hwtimer.c
+++ b/drivers/acpi/acpica/hwtimer.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Name: hwtimer.c - ACPI Power Management Timer Interface 3 * Name: hwtimer.c - ACPI Power Management Timer Interface
@@ -101,8 +100,7 @@ acpi_status acpi_get_timer(u32 * ticks)
101 return_ACPI_STATUS(AE_BAD_PARAMETER); 100 return_ACPI_STATUS(AE_BAD_PARAMETER);
102 } 101 }
103 102
104 status = 103 status = acpi_hw_read(ticks, &acpi_gbl_FADT.xpm_timer_block);
105 acpi_hw_read(ticks, &acpi_gbl_FADT.xpm_timer_block);
106 104
107 return_ACPI_STATUS(status); 105 return_ACPI_STATUS(status);
108} 106}
@@ -129,7 +127,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_timer)
129 * a versatile and accurate timer. 127 * a versatile and accurate timer.
130 * 128 *
131 * Note that this function accommodates only a single timer 129 * Note that this function accommodates only a single timer
132 * rollover. Thus for 24-bit timers, this function should only 130 * rollover. Thus for 24-bit timers, this function should only
133 * be used for calculating durations less than ~4.6 seconds 131 * be used for calculating durations less than ~4.6 seconds
134 * (~20 minutes for 32-bit timers) -- calculations below: 132 * (~20 minutes for 32-bit timers) -- calculations below:
135 * 133 *
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c
index c99d546b217f..b6aae58299dc 100644
--- a/drivers/acpi/acpica/hwvalid.c
+++ b/drivers/acpi/acpica/hwvalid.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: hwvalid - I/O request validation 3 * Module Name: hwvalid - I/O request validation
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index 7bfd649d1996..05a154c3c9ac 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -1,4 +1,3 @@
1
2/****************************************************************************** 1/******************************************************************************
3 * 2 *
4 * Module Name: hwxface - Public ACPICA hardware interfaces 3 * Module Name: hwxface - Public ACPICA hardware interfaces
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index 0ff1ecea5c3a..ae443fe2ebf6 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -49,8 +49,7 @@
49ACPI_MODULE_NAME("hwxfsleep") 49ACPI_MODULE_NAME("hwxfsleep")
50 50
51/* Local prototypes */ 51/* Local prototypes */
52static acpi_status 52static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);
53acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);
54 53
55/* 54/*
56 * Dispatch table used to efficiently branch to the various sleep 55 * Dispatch table used to efficiently branch to the various sleep
@@ -234,8 +233,7 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios)
234 * function. 233 * function.
235 * 234 *
236 ******************************************************************************/ 235 ******************************************************************************/
237static acpi_status 236static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id)
238acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id)
239{ 237{
240 acpi_status status; 238 acpi_status status;
241 struct acpi_sleep_functions *sleep_functions = 239 struct acpi_sleep_functions *sleep_functions =
@@ -369,8 +367,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
369 return_ACPI_STATUS(AE_AML_OPERAND_VALUE); 367 return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
370 } 368 }
371 369
372 status = 370 status = acpi_hw_sleep_dispatch(sleep_state, ACPI_SLEEP_FUNCTION_ID);
373 acpi_hw_sleep_dispatch(sleep_state, ACPI_SLEEP_FUNCTION_ID);
374 return_ACPI_STATUS(status); 371 return_ACPI_STATUS(status);
375} 372}
376 373
@@ -396,8 +393,7 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)
396 ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep); 393 ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep);
397 394
398 status = 395 status =
399 acpi_hw_sleep_dispatch(sleep_state, 396 acpi_hw_sleep_dispatch(sleep_state, ACPI_WAKE_PREP_FUNCTION_ID);
400 ACPI_WAKE_PREP_FUNCTION_ID);
401 return_ACPI_STATUS(status); 397 return_ACPI_STATUS(status);
402} 398}
403 399
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c
index 23db53ce2293..d70eaf39dfdf 100644
--- a/drivers/acpi/acpica/nsaccess.c
+++ b/drivers/acpi/acpica/nsaccess.c
@@ -110,11 +110,11 @@ acpi_status acpi_ns_root_initialize(void)
110 status = acpi_ns_lookup(NULL, init_val->name, init_val->type, 110 status = acpi_ns_lookup(NULL, init_val->name, init_val->type,
111 ACPI_IMODE_LOAD_PASS2, 111 ACPI_IMODE_LOAD_PASS2,
112 ACPI_NS_NO_UPSEARCH, NULL, &new_node); 112 ACPI_NS_NO_UPSEARCH, NULL, &new_node);
113 113 if (ACPI_FAILURE(status)) {
114 if (ACPI_FAILURE(status) || (!new_node)) { /* Must be on same line for code converter */
115 ACPI_EXCEPTION((AE_INFO, status, 114 ACPI_EXCEPTION((AE_INFO, status,
116 "Could not create predefined name %s", 115 "Could not create predefined name %s",
117 init_val->name)); 116 init_val->name));
117 continue;
118 } 118 }
119 119
120 /* 120 /*
@@ -179,8 +179,7 @@ acpi_status acpi_ns_root_initialize(void)
179 179
180 /* Build an object around the static string */ 180 /* Build an object around the static string */
181 181
182 obj_desc->string.length = 182 obj_desc->string.length = (u32)ACPI_STRLEN(val);
183 (u32) ACPI_STRLEN(val);
184 obj_desc->string.pointer = val; 183 obj_desc->string.pointer = val;
185 obj_desc->common.flags |= AOPOBJ_STATIC_POINTER; 184 obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
186 break; 185 break;
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c
index ac389e5bb594..15143c44f5e5 100644
--- a/drivers/acpi/acpica/nsalloc.c
+++ b/drivers/acpi/acpica/nsalloc.c
@@ -332,7 +332,7 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
332 * 332 *
333 * RETURN: None. 333 * RETURN: None.
334 * 334 *
335 * DESCRIPTION: Delete a subtree of the namespace. This includes all objects 335 * DESCRIPTION: Delete a subtree of the namespace. This includes all objects
336 * stored within the subtree. 336 * stored within the subtree.
337 * 337 *
338 ******************************************************************************/ 338 ******************************************************************************/
@@ -418,7 +418,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
418 * RETURN: Status 418 * RETURN: Status
419 * 419 *
420 * DESCRIPTION: Delete entries within the namespace that are owned by a 420 * DESCRIPTION: Delete entries within the namespace that are owned by a
421 * specific ID. Used to delete entire ACPI tables. All 421 * specific ID. Used to delete entire ACPI tables. All
422 * reference counts are updated. 422 * reference counts are updated.
423 * 423 *
424 * MUTEX: Locks namespace during deletion walk. 424 * MUTEX: Locks namespace during deletion walk.
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c
index 2526aaf945ee..924b3c71473a 100644
--- a/drivers/acpi/acpica/nsdump.c
+++ b/drivers/acpi/acpica/nsdump.c
@@ -209,14 +209,6 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
209 "Invalid ACPI Object Type 0x%08X", type)); 209 "Invalid ACPI Object Type 0x%08X", type));
210 } 210 }
211 211
212 if (!acpi_ut_valid_acpi_name(this_node->name.integer)) {
213 this_node->name.integer =
214 acpi_ut_repair_name(this_node->name.ascii);
215
216 ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X",
217 this_node->name.integer));
218 }
219
220 acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node)); 212 acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node));
221 } 213 }
222 214
@@ -700,7 +692,7 @@ void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level)
700 * 692 *
701 * PARAMETERS: search_base - Root of subtree to be dumped, or 693 * PARAMETERS: search_base - Root of subtree to be dumped, or
702 * NS_ALL to dump the entire namespace 694 * NS_ALL to dump the entire namespace
703 * max_depth - Maximum depth of dump. Use INT_MAX 695 * max_depth - Maximum depth of dump. Use INT_MAX
704 * for an effectively unlimited depth. 696 * for an effectively unlimited depth.
705 * 697 *
706 * RETURN: None 698 * RETURN: None
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index 95ffe8dfa1f1..4328e2adfeb9 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -96,8 +96,8 @@ 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, NULL, 99 ACPI_UINT32_MAX, acpi_ns_init_one_object,
100 &info, NULL); 100 NULL, &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"));
103 } 103 }
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c
index 76935ff29289..911f99127b99 100644
--- a/drivers/acpi/acpica/nsload.c
+++ b/drivers/acpi/acpica/nsload.c
@@ -80,8 +80,8 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)
80 80
81 /* 81 /*
82 * Parse the table and load the namespace with all named 82 * Parse the table and load the namespace with all named
83 * objects found within. Control methods are NOT parsed 83 * objects found within. Control methods are NOT parsed
84 * at this time. In fact, the control methods cannot be 84 * at this time. In fact, the control methods cannot be
85 * parsed until the entire namespace is loaded, because 85 * parsed until the entire namespace is loaded, because
86 * if a control method makes a forward reference (call) 86 * if a control method makes a forward reference (call)
87 * to another control method, we can't continue parsing 87 * to another control method, we can't continue parsing
@@ -122,7 +122,7 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)
122 } 122 }
123 123
124 /* 124 /*
125 * Now we can parse the control methods. We always parse 125 * Now we can parse the control methods. We always parse
126 * them here for a sanity check, and if configured for 126 * them here for a sanity check, and if configured for
127 * just-in-time parsing, we delete the control method 127 * just-in-time parsing, we delete the control method
128 * parse trees. 128 * parse trees.
@@ -166,7 +166,7 @@ acpi_status acpi_ns_load_namespace(void)
166 } 166 }
167 167
168 /* 168 /*
169 * Load the namespace. The DSDT is required, 169 * Load the namespace. The DSDT is required,
170 * but the SSDT and PSDT tables are optional. 170 * but the SSDT and PSDT tables are optional.
171 */ 171 */
172 status = acpi_ns_load_table_by_type(ACPI_TABLE_ID_DSDT); 172 status = acpi_ns_load_table_by_type(ACPI_TABLE_ID_DSDT);
@@ -283,7 +283,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
283 * RETURN: Status 283 * RETURN: Status
284 * 284 *
285 * DESCRIPTION: Shrinks the namespace, typically in response to an undocking 285 * DESCRIPTION: Shrinks the namespace, typically in response to an undocking
286 * event. Deletes an entire subtree starting from (and 286 * event. Deletes an entire subtree starting from (and
287 * including) the given handle. 287 * including) the given handle.
288 * 288 *
289 ******************************************************************************/ 289 ******************************************************************************/
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c
index 96e0eb609bb4..55a175eadcc3 100644
--- a/drivers/acpi/acpica/nsnames.c
+++ b/drivers/acpi/acpica/nsnames.c
@@ -195,7 +195,7 @@ acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node)
195 ACPI_ERROR((AE_INFO, 195 ACPI_ERROR((AE_INFO,
196 "Invalid Namespace Node (%p) while traversing namespace", 196 "Invalid Namespace Node (%p) while traversing namespace",
197 next_node)); 197 next_node));
198 return 0; 198 return (0);
199 } 199 }
200 size += ACPI_PATH_SEGMENT_LENGTH; 200 size += ACPI_PATH_SEGMENT_LENGTH;
201 next_node = next_node->parent; 201 next_node = next_node->parent;
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c
index d6c9a3cc6716..e69f7fa2579d 100644
--- a/drivers/acpi/acpica/nsobject.c
+++ b/drivers/acpi/acpica/nsobject.c
@@ -61,7 +61,7 @@ ACPI_MODULE_NAME("nsobject")
61 * RETURN: Status 61 * RETURN: Status
62 * 62 *
63 * DESCRIPTION: Record the given object as the value associated with the 63 * DESCRIPTION: Record the given object as the value associated with the
64 * name whose acpi_handle is passed. If Object is NULL 64 * name whose acpi_handle is passed. If Object is NULL
65 * and Type is ACPI_TYPE_ANY, set the name as having no value. 65 * and Type is ACPI_TYPE_ANY, set the name as having no value.
66 * Note: Future may require that the Node->Flags field be passed 66 * Note: Future may require that the Node->Flags field be passed
67 * as a parameter. 67 * as a parameter.
@@ -133,7 +133,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node,
133 ((struct acpi_namespace_node *)object)->object) { 133 ((struct acpi_namespace_node *)object)->object) {
134 /* 134 /*
135 * Value passed is a name handle and that name has a 135 * Value passed is a name handle and that name has a
136 * non-null value. Use that name's value and type. 136 * non-null value. Use that name's value and type.
137 */ 137 */
138 obj_desc = ((struct acpi_namespace_node *)object)->object; 138 obj_desc = ((struct acpi_namespace_node *)object)->object;
139 object_type = ((struct acpi_namespace_node *)object)->type; 139 object_type = ((struct acpi_namespace_node *)object)->type;
@@ -321,7 +321,7 @@ union acpi_operand_object *acpi_ns_get_secondary_object(union
321 * 321 *
322 * RETURN: Status 322 * RETURN: Status
323 * 323 *
324 * DESCRIPTION: Low-level attach data. Create and attach a Data object. 324 * DESCRIPTION: Low-level attach data. Create and attach a Data object.
325 * 325 *
326 ******************************************************************************/ 326 ******************************************************************************/
327 327
@@ -377,7 +377,7 @@ acpi_ns_attach_data(struct acpi_namespace_node *node,
377 * 377 *
378 * RETURN: Status 378 * RETURN: Status
379 * 379 *
380 * DESCRIPTION: Low-level detach data. Delete the data node, but the caller 380 * DESCRIPTION: Low-level detach data. Delete the data node, but the caller
381 * is responsible for the actual data. 381 * is responsible for the actual data.
382 * 382 *
383 ******************************************************************************/ 383 ******************************************************************************/
diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c
index ec7ba2d3463c..233f756d5cfa 100644
--- a/drivers/acpi/acpica/nsparse.c
+++ b/drivers/acpi/acpica/nsparse.c
@@ -168,11 +168,11 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node)
168 /* 168 /*
169 * AML Parse, pass 1 169 * AML Parse, pass 1
170 * 170 *
171 * In this pass, we load most of the namespace. Control methods 171 * In this pass, we load most of the namespace. Control methods
172 * are not parsed until later. A parse tree is not created. Instead, 172 * are not parsed until later. A parse tree is not created. Instead,
173 * each Parser Op subtree is deleted when it is finished. This saves 173 * each Parser Op subtree is deleted when it is finished. This saves
174 * a great deal of memory, and allows a small cache of parse objects 174 * a great deal of memory, and allows a small cache of parse objects
175 * to service the entire parse. The second pass of the parse then 175 * to service the entire parse. The second pass of the parse then
176 * performs another complete parse of the AML. 176 * performs another complete parse of the AML.
177 */ 177 */
178 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n")); 178 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n"));
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c
index 456cc859f869..1d2d8ffc1bc5 100644
--- a/drivers/acpi/acpica/nssearch.c
+++ b/drivers/acpi/acpica/nssearch.c
@@ -314,22 +314,7 @@ acpi_ns_search_and_enter(u32 target_name,
314 * this problem, and we want to be able to enable ACPI support for them, 314 * this problem, and we want to be able to enable ACPI support for them,
315 * even though there are a few bad names. 315 * even though there are a few bad names.
316 */ 316 */
317 if (!acpi_ut_valid_acpi_name(target_name)) { 317 acpi_ut_repair_name(ACPI_CAST_PTR(char, &target_name));
318 target_name =
319 acpi_ut_repair_name(ACPI_CAST_PTR(char, &target_name));
320
321 /* Report warning only if in strict mode or debug mode */
322
323 if (!acpi_gbl_enable_interpreter_slack) {
324 ACPI_WARNING((AE_INFO,
325 "Found bad character(s) in name, repaired: [%4.4s]\n",
326 ACPI_CAST_PTR(char, &target_name)));
327 } else {
328 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
329 "Found bad character(s) in name, repaired: [%4.4s]\n",
330 ACPI_CAST_PTR(char, &target_name)));
331 }
332 }
333 318
334 /* Try to find the name in the namespace level specified by the caller */ 319 /* Try to find the name in the namespace level specified by the caller */
335 320
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index ef753a41e087..b5b4cb72a8a8 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -530,7 +530,7 @@ acpi_ns_externalize_name(u32 internal_name_length,
530 ((num_segments > 0) ? (num_segments - 1) : 0) + 1; 530 ((num_segments > 0) ? (num_segments - 1) : 0) + 1;
531 531
532 /* 532 /*
533 * Check to see if we're still in bounds. If not, there's a problem 533 * Check to see if we're still in bounds. If not, there's a problem
534 * with internal_name (invalid format). 534 * with internal_name (invalid format).
535 */ 535 */
536 if (required_length > internal_name_length) { 536 if (required_length > internal_name_length) {
@@ -557,10 +557,14 @@ acpi_ns_externalize_name(u32 internal_name_length,
557 (*converted_name)[j++] = '.'; 557 (*converted_name)[j++] = '.';
558 } 558 }
559 559
560 (*converted_name)[j++] = internal_name[names_index++]; 560 /* Copy and validate the 4-char name segment */
561 (*converted_name)[j++] = internal_name[names_index++]; 561
562 (*converted_name)[j++] = internal_name[names_index++]; 562 ACPI_MOVE_NAME(&(*converted_name)[j],
563 (*converted_name)[j++] = internal_name[names_index++]; 563 &internal_name[names_index]);
564 acpi_ut_repair_name(&(*converted_name)[j]);
565
566 j += ACPI_NAME_SIZE;
567 names_index += ACPI_NAME_SIZE;
564 } 568 }
565 } 569 }
566 570
@@ -681,7 +685,7 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
681 * \ (backslash) and ^ (carat) prefixes, and the 685 * \ (backslash) and ^ (carat) prefixes, and the
682 * . (period) to separate segments are supported. 686 * . (period) to separate segments are supported.
683 * prefix_node - Root of subtree to be searched, or NS_ALL for the 687 * prefix_node - Root of subtree to be searched, or NS_ALL for the
684 * root of the name space. If Name is fully 688 * root of the name space. If Name is fully
685 * qualified (first s8 is '\'), the passed value 689 * qualified (first s8 is '\'), the passed value
686 * of Scope will not be accessed. 690 * of Scope will not be accessed.
687 * flags - Used to indicate whether to perform upsearch or 691 * flags - Used to indicate whether to perform upsearch or
@@ -689,7 +693,7 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
689 * return_node - Where the Node is returned 693 * return_node - Where the Node is returned
690 * 694 *
691 * DESCRIPTION: Look up a name relative to a given scope and return the 695 * DESCRIPTION: Look up a name relative to a given scope and return the
692 * corresponding Node. NOTE: Scope can be null. 696 * corresponding Node. NOTE: Scope can be null.
693 * 697 *
694 * MUTEX: Locks namespace 698 * MUTEX: Locks namespace
695 * 699 *
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c
index 730bccc5e7f7..0483877f26b8 100644
--- a/drivers/acpi/acpica/nswalk.c
+++ b/drivers/acpi/acpica/nswalk.c
@@ -60,8 +60,8 @@ ACPI_MODULE_NAME("nswalk")
60 * RETURN: struct acpi_namespace_node - Pointer to the NEXT child or NULL if 60 * RETURN: struct acpi_namespace_node - Pointer to the NEXT child or NULL if
61 * none is found. 61 * none is found.
62 * 62 *
63 * DESCRIPTION: Return the next peer node within the namespace. If Handle 63 * DESCRIPTION: Return the next peer node within the namespace. If Handle
64 * is valid, Scope is ignored. Otherwise, the first node 64 * is valid, Scope is ignored. Otherwise, the first node
65 * within Scope is returned. 65 * within Scope is returned.
66 * 66 *
67 ******************************************************************************/ 67 ******************************************************************************/
@@ -97,8 +97,8 @@ struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node
97 * RETURN: struct acpi_namespace_node - Pointer to the NEXT child or NULL if 97 * RETURN: struct acpi_namespace_node - Pointer to the NEXT child or NULL if
98 * none is found. 98 * none is found.
99 * 99 *
100 * DESCRIPTION: Return the next peer node within the namespace. If Handle 100 * DESCRIPTION: Return the next peer node within the namespace. If Handle
101 * is valid, Scope is ignored. Otherwise, the first node 101 * is valid, Scope is ignored. Otherwise, the first node
102 * within Scope is returned. 102 * within Scope is returned.
103 * 103 *
104 ******************************************************************************/ 104 ******************************************************************************/
@@ -305,7 +305,7 @@ acpi_ns_walk_namespace(acpi_object_type type,
305 305
306 /* 306 /*
307 * Depth first search: Attempt to go down another level in the 307 * Depth first search: Attempt to go down another level in the
308 * namespace if we are allowed to. Don't go any further if we have 308 * namespace if we are allowed to. Don't go any further if we have
309 * reached the caller specified maximum depth or if the user 309 * reached the caller specified maximum depth or if the user
310 * function has specified that the maximum depth has been reached. 310 * function has specified that the maximum depth has been reached.
311 */ 311 */
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index 9692e6702333..d6a9f77972b6 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -61,16 +61,16 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info);
61 * PARAMETERS: handle - Object handle (optional) 61 * PARAMETERS: handle - Object handle (optional)
62 * pathname - Object pathname (optional) 62 * pathname - Object pathname (optional)
63 * external_params - List of parameters to pass to method, 63 * external_params - List of parameters to pass to method,
64 * terminated by NULL. May be NULL 64 * terminated by NULL. May be NULL
65 * if no parameters are being passed. 65 * if no parameters are being passed.
66 * return_buffer - Where to put method's return value (if 66 * return_buffer - Where to put method's return value (if
67 * any). If NULL, no value is returned. 67 * any). If NULL, no value is returned.
68 * return_type - Expected type of return object 68 * return_type - Expected type of return object
69 * 69 *
70 * RETURN: Status 70 * RETURN: Status
71 * 71 *
72 * DESCRIPTION: Find and evaluate the given object, passing the given 72 * DESCRIPTION: Find and evaluate the given object, passing the given
73 * parameters if necessary. One of "Handle" or "Pathname" must 73 * parameters if necessary. One of "Handle" or "Pathname" must
74 * be valid (non-null) 74 * be valid (non-null)
75 * 75 *
76 ******************************************************************************/ 76 ******************************************************************************/
@@ -155,15 +155,15 @@ ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed)
155 * PARAMETERS: handle - Object handle (optional) 155 * PARAMETERS: handle - Object handle (optional)
156 * pathname - Object pathname (optional) 156 * pathname - Object pathname (optional)
157 * external_params - List of parameters to pass to method, 157 * external_params - List of parameters to pass to method,
158 * terminated by NULL. May be NULL 158 * terminated by NULL. May be NULL
159 * if no parameters are being passed. 159 * if no parameters are being passed.
160 * return_buffer - Where to put method's return value (if 160 * return_buffer - Where to put method's return value (if
161 * any). If NULL, no value is returned. 161 * any). If NULL, no value is returned.
162 * 162 *
163 * RETURN: Status 163 * RETURN: Status
164 * 164 *
165 * DESCRIPTION: Find and evaluate the given object, passing the given 165 * DESCRIPTION: Find and evaluate the given object, passing the given
166 * parameters if necessary. One of "Handle" or "Pathname" must 166 * parameters if necessary. One of "Handle" or "Pathname" must
167 * be valid (non-null) 167 * be valid (non-null)
168 * 168 *
169 ******************************************************************************/ 169 ******************************************************************************/
@@ -542,15 +542,15 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
542 acpi_status status; 542 acpi_status status;
543 struct acpi_namespace_node *node; 543 struct acpi_namespace_node *node;
544 u32 flags; 544 u32 flags;
545 struct acpica_device_id *hid; 545 struct acpi_pnp_device_id *hid;
546 struct acpica_device_id_list *cid; 546 struct acpi_pnp_device_id_list *cid;
547 u32 i; 547 u32 i;
548 u8 found; 548 u8 found;
549 int no_match; 549 int no_match;
550 550
551 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 551 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
552 if (ACPI_FAILURE(status)) { 552 if (ACPI_FAILURE(status)) {
553 return (status); 553 return_ACPI_STATUS(status);
554 } 554 }
555 555
556 node = acpi_ns_validate_handle(obj_handle); 556 node = acpi_ns_validate_handle(obj_handle);
@@ -656,7 +656,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
656 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, 656 * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
657 * starting (and ending) at the object specified by start_handle. 657 * starting (and ending) at the object specified by start_handle.
658 * The user_function is called whenever an object of type 658 * The user_function is called whenever an object of type
659 * Device is found. If the user function returns 659 * Device is found. If the user function returns
660 * a non-zero value, the search is terminated immediately and this 660 * a non-zero value, the search is terminated immediately and this
661 * value is returned to the caller. 661 * value is returned to the caller.
662 * 662 *
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c
index 08e9610b34ca..811c6f13f476 100644
--- a/drivers/acpi/acpica/nsxfname.c
+++ b/drivers/acpi/acpica/nsxfname.c
@@ -53,8 +53,8 @@
53ACPI_MODULE_NAME("nsxfname") 53ACPI_MODULE_NAME("nsxfname")
54 54
55/* Local prototypes */ 55/* Local prototypes */
56static char *acpi_ns_copy_device_id(struct acpica_device_id *dest, 56static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,
57 struct acpica_device_id *source, 57 struct acpi_pnp_device_id *source,
58 char *string_area); 58 char *string_area);
59 59
60/****************************************************************************** 60/******************************************************************************
@@ -69,8 +69,8 @@ static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,
69 * RETURN: Status 69 * RETURN: Status
70 * 70 *
71 * DESCRIPTION: This routine will search for a caller specified name in the 71 * DESCRIPTION: This routine will search for a caller specified name in the
72 * name space. The caller can restrict the search region by 72 * name space. The caller can restrict the search region by
73 * specifying a non NULL parent. The parent value is itself a 73 * specifying a non NULL parent. The parent value is itself a
74 * namespace handle. 74 * namespace handle.
75 * 75 *
76 ******************************************************************************/ 76 ******************************************************************************/
@@ -149,7 +149,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_handle)
149 * RETURN: Pointer to a string containing the fully qualified Name. 149 * RETURN: Pointer to a string containing the fully qualified Name.
150 * 150 *
151 * DESCRIPTION: This routine returns the fully qualified name associated with 151 * DESCRIPTION: This routine returns the fully qualified name associated with
152 * the Handle parameter. This and the acpi_pathname_to_handle are 152 * the Handle parameter. This and the acpi_pathname_to_handle are
153 * complementary functions. 153 * complementary functions.
154 * 154 *
155 ******************************************************************************/ 155 ******************************************************************************/
@@ -202,8 +202,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
202 202
203 /* Just copy the ACPI name from the Node and zero terminate it */ 203 /* Just copy the ACPI name from the Node and zero terminate it */
204 204
205 ACPI_STRNCPY(buffer->pointer, acpi_ut_get_node_name(node), 205 ACPI_MOVE_NAME(buffer->pointer, acpi_ut_get_node_name(node));
206 ACPI_NAME_SIZE);
207 ((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0; 206 ((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0;
208 status = AE_OK; 207 status = AE_OK;
209 208
@@ -219,20 +218,21 @@ ACPI_EXPORT_SYMBOL(acpi_get_name)
219 * 218 *
220 * FUNCTION: acpi_ns_copy_device_id 219 * FUNCTION: acpi_ns_copy_device_id
221 * 220 *
222 * PARAMETERS: dest - Pointer to the destination DEVICE_ID 221 * PARAMETERS: dest - Pointer to the destination PNP_DEVICE_ID
223 * source - Pointer to the source DEVICE_ID 222 * source - Pointer to the source PNP_DEVICE_ID
224 * string_area - Pointer to where to copy the dest string 223 * string_area - Pointer to where to copy the dest string
225 * 224 *
226 * RETURN: Pointer to the next string area 225 * RETURN: Pointer to the next string area
227 * 226 *
228 * DESCRIPTION: Copy a single DEVICE_ID, including the string data. 227 * DESCRIPTION: Copy a single PNP_DEVICE_ID, including the string data.
229 * 228 *
230 ******************************************************************************/ 229 ******************************************************************************/
231static char *acpi_ns_copy_device_id(struct acpica_device_id *dest, 230static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,
232 struct acpica_device_id *source, 231 struct acpi_pnp_device_id *source,
233 char *string_area) 232 char *string_area)
234{ 233{
235 /* Create the destination DEVICE_ID */ 234
235 /* Create the destination PNP_DEVICE_ID */
236 236
237 dest->string = string_area; 237 dest->string = string_area;
238 dest->length = source->length; 238 dest->length = source->length;
@@ -256,8 +256,8 @@ static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,
256 * namespace node and possibly by running several standard 256 * namespace node and possibly by running several standard
257 * control methods (Such as in the case of a device.) 257 * control methods (Such as in the case of a device.)
258 * 258 *
259 * For Device and Processor objects, run the Device _HID, _UID, _CID, _STA, 259 * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB,
260 * _ADR, _sx_w, and _sx_d methods. 260 * _STA, _ADR, _sx_w, and _sx_d methods.
261 * 261 *
262 * Note: Allocates the return buffer, must be freed by the caller. 262 * Note: Allocates the return buffer, must be freed by the caller.
263 * 263 *
@@ -269,9 +269,10 @@ acpi_get_object_info(acpi_handle handle,
269{ 269{
270 struct acpi_namespace_node *node; 270 struct acpi_namespace_node *node;
271 struct acpi_device_info *info; 271 struct acpi_device_info *info;
272 struct acpica_device_id_list *cid_list = NULL; 272 struct acpi_pnp_device_id_list *cid_list = NULL;
273 struct acpica_device_id *hid = NULL; 273 struct acpi_pnp_device_id *hid = NULL;
274 struct acpica_device_id *uid = NULL; 274 struct acpi_pnp_device_id *uid = NULL;
275 struct acpi_pnp_device_id *sub = NULL;
275 char *next_id_string; 276 char *next_id_string;
276 acpi_object_type type; 277 acpi_object_type type;
277 acpi_name name; 278 acpi_name name;
@@ -316,7 +317,7 @@ acpi_get_object_info(acpi_handle handle,
316 if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { 317 if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) {
317 /* 318 /*
318 * Get extra info for ACPI Device/Processor objects only: 319 * Get extra info for ACPI Device/Processor objects only:
319 * Run the Device _HID, _UID, and _CID methods. 320 * Run the Device _HID, _UID, _SUB, and _CID methods.
320 * 321 *
321 * Note: none of these methods are required, so they may or may 322 * Note: none of these methods are required, so they may or may
322 * not be present for this device. The Info->Valid bitfield is used 323 * not be present for this device. The Info->Valid bitfield is used
@@ -339,6 +340,14 @@ acpi_get_object_info(acpi_handle handle,
339 valid |= ACPI_VALID_UID; 340 valid |= ACPI_VALID_UID;
340 } 341 }
341 342
343 /* Execute the Device._SUB method */
344
345 status = acpi_ut_execute_SUB(node, &sub);
346 if (ACPI_SUCCESS(status)) {
347 info_size += sub->length;
348 valid |= ACPI_VALID_SUB;
349 }
350
342 /* Execute the Device._CID method */ 351 /* Execute the Device._CID method */
343 352
344 status = acpi_ut_execute_CID(node, &cid_list); 353 status = acpi_ut_execute_CID(node, &cid_list);
@@ -348,7 +357,7 @@ acpi_get_object_info(acpi_handle handle,
348 357
349 info_size += 358 info_size +=
350 (cid_list->list_size - 359 (cid_list->list_size -
351 sizeof(struct acpica_device_id_list)); 360 sizeof(struct acpi_pnp_device_id_list));
352 valid |= ACPI_VALID_CID; 361 valid |= ACPI_VALID_CID;
353 } 362 }
354 } 363 }
@@ -418,16 +427,17 @@ acpi_get_object_info(acpi_handle handle,
418 next_id_string = ACPI_CAST_PTR(char, info->compatible_id_list.ids); 427 next_id_string = ACPI_CAST_PTR(char, info->compatible_id_list.ids);
419 if (cid_list) { 428 if (cid_list) {
420 429
421 /* Point past the CID DEVICE_ID array */ 430 /* Point past the CID PNP_DEVICE_ID array */
422 431
423 next_id_string += 432 next_id_string +=
424 ((acpi_size) cid_list->count * 433 ((acpi_size) cid_list->count *
425 sizeof(struct acpica_device_id)); 434 sizeof(struct acpi_pnp_device_id));
426 } 435 }
427 436
428 /* 437 /*
429 * Copy the HID, UID, and CIDs to the return buffer. The variable-length 438 * Copy the HID, UID, SUB, and CIDs to the return buffer.
430 * strings are copied to the reserved area at the end of the buffer. 439 * The variable-length strings are copied to the reserved area
440 * at the end of the buffer.
431 * 441 *
432 * For HID and CID, check if the ID is a PCI Root Bridge. 442 * For HID and CID, check if the ID is a PCI Root Bridge.
433 */ 443 */
@@ -445,6 +455,11 @@ acpi_get_object_info(acpi_handle handle,
445 uid, next_id_string); 455 uid, next_id_string);
446 } 456 }
447 457
458 if (sub) {
459 next_id_string = acpi_ns_copy_device_id(&info->subsystem_id,
460 sub, next_id_string);
461 }
462
448 if (cid_list) { 463 if (cid_list) {
449 info->compatible_id_list.count = cid_list->count; 464 info->compatible_id_list.count = cid_list->count;
450 info->compatible_id_list.list_size = cid_list->list_size; 465 info->compatible_id_list.list_size = cid_list->list_size;
@@ -481,6 +496,9 @@ acpi_get_object_info(acpi_handle handle,
481 if (uid) { 496 if (uid) {
482 ACPI_FREE(uid); 497 ACPI_FREE(uid);
483 } 498 }
499 if (sub) {
500 ACPI_FREE(sub);
501 }
484 if (cid_list) { 502 if (cid_list) {
485 ACPI_FREE(cid_list); 503 ACPI_FREE(cid_list);
486 } 504 }
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c
index 6766fc4f088f..9d029dac6b64 100644
--- a/drivers/acpi/acpica/nsxfobj.c
+++ b/drivers/acpi/acpica/nsxfobj.c
@@ -220,8 +220,8 @@ ACPI_EXPORT_SYMBOL(acpi_get_parent)
220 * 220 *
221 * RETURN: Status 221 * RETURN: Status
222 * 222 *
223 * DESCRIPTION: Return the next peer object within the namespace. If Handle is 223 * DESCRIPTION: Return the next peer object within the namespace. If Handle is
224 * valid, Scope is ignored. Otherwise, the first object within 224 * valid, Scope is ignored. Otherwise, the first object within
225 * Scope is returned. 225 * Scope is returned.
226 * 226 *
227 ******************************************************************************/ 227 ******************************************************************************/
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
index 844464c4f901..cb79e2d4d743 100644
--- a/drivers/acpi/acpica/psargs.c
+++ b/drivers/acpi/acpica/psargs.c
@@ -120,7 +120,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
120 * RETURN: Pointer to end-of-package +1 120 * RETURN: Pointer to end-of-package +1
121 * 121 *
122 * DESCRIPTION: Get next package length and return a pointer past the end of 122 * DESCRIPTION: Get next package length and return a pointer past the end of
123 * the package. Consumes the package length field 123 * the package. Consumes the package length field
124 * 124 *
125 ******************************************************************************/ 125 ******************************************************************************/
126 126
@@ -147,8 +147,8 @@ u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state)
147 * RETURN: Pointer to the start of the name string (pointer points into 147 * RETURN: Pointer to the start of the name string (pointer points into
148 * the AML. 148 * the AML.
149 * 149 *
150 * DESCRIPTION: Get next raw namestring within the AML stream. Handles all name 150 * DESCRIPTION: Get next raw namestring within the AML stream. Handles all name
151 * prefix characters. Set parser state to point past the string. 151 * prefix characters. Set parser state to point past the string.
152 * (Name is consumed from the AML.) 152 * (Name is consumed from the AML.)
153 * 153 *
154 ******************************************************************************/ 154 ******************************************************************************/
@@ -220,7 +220,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
220 * 220 *
221 * DESCRIPTION: Get next name (if method call, return # of required args). 221 * DESCRIPTION: Get next name (if method call, return # of required args).
222 * Names are looked up in the internal namespace to determine 222 * Names are looked up in the internal namespace to determine
223 * if the name represents a control method. If a method 223 * if the name represents a control method. If a method
224 * is found, the number of arguments to the method is returned. 224 * is found, the number of arguments to the method is returned.
225 * This information is critical for parsing to continue correctly. 225 * This information is critical for parsing to continue correctly.
226 * 226 *
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c
index 799162c1b6df..5607805aab26 100644
--- a/drivers/acpi/acpica/psloop.c
+++ b/drivers/acpi/acpica/psloop.c
@@ -133,18 +133,46 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)
133 133
134 case AML_CLASS_UNKNOWN: 134 case AML_CLASS_UNKNOWN:
135 135
136 /* The opcode is unrecognized. Just skip unknown opcodes */ 136 /* The opcode is unrecognized. Complain and skip unknown opcodes */
137 137
138 ACPI_ERROR((AE_INFO, 138 if (walk_state->pass_number == 2) {
139 "Found unknown opcode 0x%X at AML address %p offset 0x%X, ignoring", 139 ACPI_ERROR((AE_INFO,
140 walk_state->opcode, walk_state->parser_state.aml, 140 "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
141 walk_state->aml_offset)); 141 walk_state->opcode,
142 (u32)(walk_state->aml_offset +
143 sizeof(struct acpi_table_header))));
142 144
143 ACPI_DUMP_BUFFER(walk_state->parser_state.aml, 128); 145 ACPI_DUMP_BUFFER(walk_state->parser_state.aml - 16, 48);
144 146
145 /* Assume one-byte bad opcode */ 147#ifdef ACPI_ASL_COMPILER
148 /*
149 * This is executed for the disassembler only. Output goes
150 * to the disassembled ASL output file.
151 */
152 acpi_os_printf
153 ("/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n",
154 walk_state->opcode,
155 (u32)(walk_state->aml_offset +
156 sizeof(struct acpi_table_header)));
157
158 /* Dump the context surrounding the invalid opcode */
159
160 acpi_ut_dump_buffer(((u8 *)walk_state->parser_state.
161 aml - 16), 48, DB_BYTE_DISPLAY,
162 walk_state->aml_offset +
163 sizeof(struct acpi_table_header) -
164 16);
165 acpi_os_printf(" */\n");
166#endif
167 }
168
169 /* Increment past one-byte or two-byte opcode */
146 170
147 walk_state->parser_state.aml++; 171 walk_state->parser_state.aml++;
172 if (walk_state->opcode > 0xFF) { /* Can only happen if first byte is 0x5B */
173 walk_state->parser_state.aml++;
174 }
175
148 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); 176 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
149 177
150 default: 178 default:
@@ -519,11 +547,18 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
519 if ((op_info->class == 547 if ((op_info->class ==
520 AML_CLASS_EXECUTE) && (!arg)) { 548 AML_CLASS_EXECUTE) && (!arg)) {
521 ACPI_WARNING((AE_INFO, 549 ACPI_WARNING((AE_INFO,
522 "Detected an unsupported executable opcode " 550 "Unsupported module-level executable opcode "
523 "at module-level: [0x%.4X] at table offset 0x%.4X", 551 "0x%.2X at table offset 0x%.4X",
524 op->common.aml_opcode, 552 op->common.
525 (u32)((aml_op_start - walk_state->parser_state.aml_start) 553 aml_opcode,
526 + sizeof(struct acpi_table_header)))); 554 (u32)
555 (ACPI_PTR_DIFF
556 (aml_op_start,
557 walk_state->
558 parser_state.
559 aml_start) +
560 sizeof(struct
561 acpi_table_header))));
527 } 562 }
528 } 563 }
529 break; 564 break;
@@ -843,8 +878,6 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state,
843 *op = NULL; 878 *op = NULL;
844 } 879 }
845 880
846 ACPI_PREEMPTION_POINT();
847
848 return_ACPI_STATUS(AE_OK); 881 return_ACPI_STATUS(AE_OK);
849} 882}
850 883
diff --git a/drivers/acpi/acpica/psopcode.c b/drivers/acpi/acpica/psopcode.c
index ed1d457bd5ca..1793d934aa30 100644
--- a/drivers/acpi/acpica/psopcode.c
+++ b/drivers/acpi/acpica/psopcode.c
@@ -59,7 +59,7 @@ static const u8 acpi_gbl_argument_count[] =
59 * 59 *
60 * DESCRIPTION: Opcode table. Each entry contains <opcode, type, name, operands> 60 * DESCRIPTION: Opcode table. Each entry contains <opcode, type, name, operands>
61 * The name is a simple ascii string, the operand specifier is an 61 * The name is a simple ascii string, the operand specifier is an
62 * ascii string with one letter per operand. The letter specifies 62 * ascii string with one letter per operand. The letter specifies
63 * the operand type. 63 * the operand type.
64 * 64 *
65 ******************************************************************************/ 65 ******************************************************************************/
@@ -183,7 +183,7 @@ static const u8 acpi_gbl_argument_count[] =
183 ******************************************************************************/ 183 ******************************************************************************/
184 184
185/* 185/*
186 * Master Opcode information table. A summary of everything we know about each 186 * Master Opcode information table. A summary of everything we know about each
187 * opcode, all in one place. 187 * opcode, all in one place.
188 */ 188 */
189const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = { 189const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
@@ -392,10 +392,12 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
392 AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), 392 AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
393/* 38 */ ACPI_OP("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, 393/* 38 */ ACPI_OP("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY,
394 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, 394 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
395 AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT), 395 AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC |
396 AML_CONSTANT),
396/* 39 */ ACPI_OP("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, 397/* 39 */ ACPI_OP("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY,
397 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, 398 AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
398 AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT), 399 AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC |
400 AML_CONSTANT),
399/* 3A */ ACPI_OP("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, 401/* 3A */ ACPI_OP("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY,
400 AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, 402 AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R,
401 AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), 403 AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
@@ -495,7 +497,8 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
495 AML_NSNODE | AML_NAMED | AML_DEFER), 497 AML_NSNODE | AML_NAMED | AML_DEFER),
496/* 59 */ ACPI_OP("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY, 498/* 59 */ ACPI_OP("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY,
497 AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, 499 AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD,
498 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), 500 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
501 AML_FIELD),
499/* 5A */ ACPI_OP("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, 502/* 5A */ ACPI_OP("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP,
500 ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT, 503 ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT,
501 AML_TYPE_NAMED_NO_OBJ, 504 AML_TYPE_NAMED_NO_OBJ,
@@ -519,12 +522,13 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
519/* 5E */ ACPI_OP("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, 522/* 5E */ ACPI_OP("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP,
520 ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, 523 ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
521 AML_TYPE_NAMED_FIELD, 524 AML_TYPE_NAMED_FIELD,
522 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), 525 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
526 AML_FIELD),
523/* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, 527/* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP,
524 ACPI_TYPE_LOCAL_BANK_FIELD, AML_CLASS_NAMED_OBJECT, 528 ACPI_TYPE_LOCAL_BANK_FIELD,
525 AML_TYPE_NAMED_FIELD, 529 AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD,
526 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD | 530 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
527 AML_DEFER), 531 AML_FIELD | AML_DEFER),
528 532
529/* Internal opcodes that map to invalid AML opcodes */ 533/* Internal opcodes that map to invalid AML opcodes */
530 534
@@ -632,7 +636,8 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
632/* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, 636/* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP,
633 ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, 637 ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
634 AML_TYPE_NAMED_NO_OBJ, 638 AML_TYPE_NAMED_NO_OBJ,
635 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE), 639 AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
640 AML_NSNODE),
636 641
637/* ACPI 3.0 opcodes */ 642/* ACPI 3.0 opcodes */
638 643
@@ -695,7 +700,7 @@ static const u8 acpi_gbl_short_op_index[256] = {
695 700
696/* 701/*
697 * This table is indexed by the second opcode of the extended opcode 702 * This table is indexed by the second opcode of the extended opcode
698 * pair. It returns an index into the opcode table (acpi_gbl_aml_op_info) 703 * pair. It returns an index into the opcode table (acpi_gbl_aml_op_info)
699 */ 704 */
700static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = { 705static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = {
701/* 0 1 2 3 4 5 6 7 */ 706/* 0 1 2 3 4 5 6 7 */
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c
index 01985703bb98..2494caf47755 100644
--- a/drivers/acpi/acpica/psparse.c
+++ b/drivers/acpi/acpica/psparse.c
@@ -43,9 +43,9 @@
43 43
44/* 44/*
45 * Parse the AML and build an operation tree as most interpreters, 45 * Parse the AML and build an operation tree as most interpreters,
46 * like Perl, do. Parsing is done by hand rather than with a YACC 46 * like Perl, do. Parsing is done by hand rather than with a YACC
47 * generated parser to tightly constrain stack and dynamic memory 47 * generated parser to tightly constrain stack and dynamic memory
48 * usage. At the same time, parsing is kept flexible and the code 48 * usage. At the same time, parsing is kept flexible and the code
49 * fairly compact by parsing based on a list of AML opcode 49 * fairly compact by parsing based on a list of AML opcode
50 * templates in aml_op_info[] 50 * templates in aml_op_info[]
51 */ 51 */
@@ -379,7 +379,7 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
379 case AE_CTRL_FALSE: 379 case AE_CTRL_FALSE:
380 /* 380 /*
381 * Either an IF/WHILE Predicate was false or we encountered a BREAK 381 * Either an IF/WHILE Predicate was false or we encountered a BREAK
382 * opcode. In both cases, we do not execute the rest of the 382 * opcode. In both cases, we do not execute the rest of the
383 * package; We simply close out the parent (finishing the walk of 383 * package; We simply close out the parent (finishing the walk of
384 * this branch of the tree) and continue execution at the parent 384 * this branch of the tree) and continue execution at the parent
385 * level. 385 * level.
@@ -459,8 +459,9 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
459 459
460 /* Executing a control method - additional cleanup */ 460 /* Executing a control method - additional cleanup */
461 461
462 acpi_ds_terminate_control_method( 462 acpi_ds_terminate_control_method(walk_state->
463 walk_state->method_desc, walk_state); 463 method_desc,
464 walk_state);
464 } 465 }
465 466
466 acpi_ds_delete_walk_state(walk_state); 467 acpi_ds_delete_walk_state(walk_state);
@@ -487,7 +488,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
487 acpi_gbl_current_walk_list = thread; 488 acpi_gbl_current_walk_list = thread;
488 489
489 /* 490 /*
490 * Execute the walk loop as long as there is a valid Walk State. This 491 * Execute the walk loop as long as there is a valid Walk State. This
491 * handles nested control method invocations without recursion. 492 * handles nested control method invocations without recursion.
492 */ 493 */
493 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "State=%p\n", walk_state)); 494 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "State=%p\n", walk_state));
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c
index 8736ad5f04d3..4137dcb352d1 100644
--- a/drivers/acpi/acpica/psutils.c
+++ b/drivers/acpi/acpica/psutils.c
@@ -108,7 +108,7 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
108 * RETURN: Pointer to the new Op, null on failure 108 * RETURN: Pointer to the new Op, null on failure
109 * 109 *
110 * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on 110 * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on
111 * opcode. A cache of opcodes is available for the pure 111 * opcode. A cache of opcodes is available for the pure
112 * GENERIC_OP, since this is by far the most commonly used. 112 * GENERIC_OP, since this is by far the most commonly used.
113 * 113 *
114 ******************************************************************************/ 114 ******************************************************************************/
@@ -164,7 +164,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)
164 * 164 *
165 * RETURN: None. 165 * RETURN: None.
166 * 166 *
167 * DESCRIPTION: Free an Op object. Either put it on the GENERIC_OP cache list 167 * DESCRIPTION: Free an Op object. Either put it on the GENERIC_OP cache list
168 * or actually free it. 168 * or actually free it.
169 * 169 *
170 ******************************************************************************/ 170 ******************************************************************************/
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c
index de12469d1c9c..147feb6aa2a0 100644
--- a/drivers/acpi/acpica/rscalc.c
+++ b/drivers/acpi/acpica/rscalc.c
@@ -457,6 +457,15 @@ acpi_rs_get_list_length(u8 * aml_buffer,
457 * Get the number of vendor data bytes 457 * Get the number of vendor data bytes
458 */ 458 */
459 extra_struct_bytes = resource_length; 459 extra_struct_bytes = resource_length;
460
461 /*
462 * There is already one byte included in the minimum
463 * descriptor size. If there are extra struct bytes,
464 * subtract one from the count.
465 */
466 if (extra_struct_bytes) {
467 extra_struct_bytes--;
468 }
460 break; 469 break;
461 470
462 case ACPI_RESOURCE_NAME_END_TAG: 471 case ACPI_RESOURCE_NAME_END_TAG:
@@ -601,7 +610,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
601 /* 610 /*
602 * Calculate the size of the return buffer. 611 * Calculate the size of the return buffer.
603 * The base size is the number of elements * the sizes of the 612 * The base size is the number of elements * the sizes of the
604 * structures. Additional space for the strings is added below. 613 * structures. Additional space for the strings is added below.
605 * The minus one is to subtract the size of the u8 Source[1] 614 * The minus one is to subtract the size of the u8 Source[1]
606 * member because it is added below. 615 * member because it is added below.
607 * 616 *
@@ -664,8 +673,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
664 (*sub_object_list)->string. 673 (*sub_object_list)->string.
665 length + 1); 674 length + 1);
666 } else { 675 } else {
667 temp_size_needed += 676 temp_size_needed += acpi_ns_get_pathname_length((*sub_object_list)->reference.node);
668 acpi_ns_get_pathname_length((*sub_object_list)->reference.node);
669 } 677 }
670 } else { 678 } else {
671 /* 679 /*
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c
index 46b5324b22d6..8b64db9a3fd2 100644
--- a/drivers/acpi/acpica/rslist.c
+++ b/drivers/acpi/acpica/rslist.c
@@ -109,7 +109,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml,
109 ACPI_ERROR((AE_INFO, 109 ACPI_ERROR((AE_INFO,
110 "Invalid/unsupported resource descriptor: Type 0x%2.2X", 110 "Invalid/unsupported resource descriptor: Type 0x%2.2X",
111 resource_index)); 111 resource_index));
112 return (AE_AML_INVALID_RESOURCE_TYPE); 112 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
113 } 113 }
114 114
115 /* Convert the AML byte stream resource to a local resource struct */ 115 /* Convert the AML byte stream resource to a local resource struct */
@@ -200,7 +200,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
200 ACPI_ERROR((AE_INFO, 200 ACPI_ERROR((AE_INFO,
201 "Invalid/unsupported resource descriptor: Type 0x%2.2X", 201 "Invalid/unsupported resource descriptor: Type 0x%2.2X",
202 resource->type)); 202 resource->type));
203 return (AE_AML_INVALID_RESOURCE_TYPE); 203 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
204 } 204 }
205 205
206 status = acpi_rs_convert_resource_to_aml(resource, 206 status = acpi_rs_convert_resource_to_aml(resource,
diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c
index 57deae166577..77d1db29a725 100644
--- a/drivers/acpi/acpica/tbfind.c
+++ b/drivers/acpi/acpica/tbfind.c
@@ -77,7 +77,7 @@ acpi_tb_find_table(char *signature,
77 /* Normalize the input strings */ 77 /* Normalize the input strings */
78 78
79 ACPI_MEMSET(&header, 0, sizeof(struct acpi_table_header)); 79 ACPI_MEMSET(&header, 0, sizeof(struct acpi_table_header));
80 ACPI_STRNCPY(header.signature, signature, ACPI_NAME_SIZE); 80 ACPI_MOVE_NAME(header.signature, signature);
81 ACPI_STRNCPY(header.oem_id, oem_id, ACPI_OEM_ID_SIZE); 81 ACPI_STRNCPY(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
82 ACPI_STRNCPY(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE); 82 ACPI_STRNCPY(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
83 83
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index 70f9d787c82c..f540ae462925 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -526,6 +526,8 @@ void acpi_tb_terminate(void)
526 526
527 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n")); 527 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n"));
528 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); 528 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
529
530 return_VOID;
529} 531}
530 532
531/******************************************************************************* 533/*******************************************************************************
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index b6cea30da638..285e24b97382 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -354,7 +354,7 @@ u8 acpi_tb_checksum(u8 *buffer, u32 length)
354 sum = (u8) (sum + *(buffer++)); 354 sum = (u8) (sum + *(buffer++));
355 } 355 }
356 356
357 return sum; 357 return (sum);
358} 358}
359 359
360/******************************************************************************* 360/*******************************************************************************
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index 21101262e47a..f5632780421d 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -236,7 +236,7 @@ acpi_get_table_header(char *signature,
236 sizeof(struct 236 sizeof(struct
237 acpi_table_header)); 237 acpi_table_header));
238 if (!header) { 238 if (!header) {
239 return AE_NO_MEMORY; 239 return (AE_NO_MEMORY);
240 } 240 }
241 ACPI_MEMCPY(out_table_header, header, 241 ACPI_MEMCPY(out_table_header, header,
242 sizeof(struct acpi_table_header)); 242 sizeof(struct acpi_table_header));
@@ -244,7 +244,7 @@ acpi_get_table_header(char *signature,
244 sizeof(struct 244 sizeof(struct
245 acpi_table_header)); 245 acpi_table_header));
246 } else { 246 } else {
247 return AE_NOT_FOUND; 247 return (AE_NOT_FOUND);
248 } 248 }
249 } else { 249 } else {
250 ACPI_MEMCPY(out_table_header, 250 ACPI_MEMCPY(out_table_header,
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
index f87cc63e69a1..a5e1e4e47098 100644
--- a/drivers/acpi/acpica/tbxfload.c
+++ b/drivers/acpi/acpica/tbxfload.c
@@ -211,7 +211,7 @@ static acpi_status acpi_tb_load_namespace(void)
211 * DESCRIPTION: Dynamically load an ACPI table from the caller's buffer. Must 211 * DESCRIPTION: Dynamically load an ACPI table from the caller's buffer. Must
212 * be a valid ACPI table with a valid ACPI table header. 212 * be a valid ACPI table with a valid ACPI table header.
213 * Note1: Mainly intended to support hotplug addition of SSDTs. 213 * Note1: Mainly intended to support hotplug addition of SSDTs.
214 * Note2: Does not copy the incoming table. User is reponsible 214 * Note2: Does not copy the incoming table. User is responsible
215 * to ensure that the table is not deleted or unmapped. 215 * to ensure that the table is not deleted or unmapped.
216 * 216 *
217 ******************************************************************************/ 217 ******************************************************************************/
diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c
index 74e720800037..28f330230f99 100644
--- a/drivers/acpi/acpica/tbxfroot.c
+++ b/drivers/acpi/acpica/tbxfroot.c
@@ -67,7 +67,6 @@ static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp);
67 67
68static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp) 68static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
69{ 69{
70 ACPI_FUNCTION_ENTRY();
71 70
72 /* 71 /*
73 * The signature and checksum must both be correct 72 * The signature and checksum must both be correct
@@ -108,7 +107,7 @@ static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
108 * RETURN: Status, RSDP physical address 107 * RETURN: Status, RSDP physical address
109 * 108 *
110 * DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor 109 * DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor
111 * pointer structure. If it is found, set *RSDP to point to it. 110 * pointer structure. If it is found, set *RSDP to point to it.
112 * 111 *
113 * NOTE1: The RSDP must be either in the first 1K of the Extended 112 * NOTE1: The RSDP must be either in the first 1K of the Extended
114 * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.) 113 * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.)
diff --git a/drivers/acpi/acpica/utcache.c b/drivers/acpi/acpica/utcache.c
new file mode 100644
index 000000000000..e1d40ed26390
--- /dev/null
+++ b/drivers/acpi/acpica/utcache.c
@@ -0,0 +1,323 @@
1/******************************************************************************
2 *
3 * Module Name: utcache - local cache allocation routines
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46
47#define _COMPONENT ACPI_UTILITIES
48ACPI_MODULE_NAME("utcache")
49
50#ifdef ACPI_USE_LOCAL_CACHE
51/*******************************************************************************
52 *
53 * FUNCTION: acpi_os_create_cache
54 *
55 * PARAMETERS: cache_name - Ascii name for the cache
56 * object_size - Size of each cached object
57 * max_depth - Maximum depth of the cache (in objects)
58 * return_cache - Where the new cache object is returned
59 *
60 * RETURN: Status
61 *
62 * DESCRIPTION: Create a cache object
63 *
64 ******************************************************************************/
65acpi_status
66acpi_os_create_cache(char *cache_name,
67 u16 object_size,
68 u16 max_depth, struct acpi_memory_list ** return_cache)
69{
70 struct acpi_memory_list *cache;
71
72 ACPI_FUNCTION_ENTRY();
73
74 if (!cache_name || !return_cache || (object_size < 16)) {
75 return (AE_BAD_PARAMETER);
76 }
77
78 /* Create the cache object */
79
80 cache = acpi_os_allocate(sizeof(struct acpi_memory_list));
81 if (!cache) {
82 return (AE_NO_MEMORY);
83 }
84
85 /* Populate the cache object and return it */
86
87 ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list));
88 cache->link_offset = 8;
89 cache->list_name = cache_name;
90 cache->object_size = object_size;
91 cache->max_depth = max_depth;
92
93 *return_cache = cache;
94 return (AE_OK);
95}
96
97/*******************************************************************************
98 *
99 * FUNCTION: acpi_os_purge_cache
100 *
101 * PARAMETERS: cache - Handle to cache object
102 *
103 * RETURN: Status
104 *
105 * DESCRIPTION: Free all objects within the requested cache.
106 *
107 ******************************************************************************/
108
109acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache)
110{
111 char *next;
112 acpi_status status;
113
114 ACPI_FUNCTION_ENTRY();
115
116 if (!cache) {
117 return (AE_BAD_PARAMETER);
118 }
119
120 status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
121 if (ACPI_FAILURE(status)) {
122 return (status);
123 }
124
125 /* Walk the list of objects in this cache */
126
127 while (cache->list_head) {
128
129 /* Delete and unlink one cached state object */
130
131 next = *(ACPI_CAST_INDIRECT_PTR(char,
132 &(((char *)cache->
133 list_head)[cache->
134 link_offset])));
135 ACPI_FREE(cache->list_head);
136
137 cache->list_head = next;
138 cache->current_depth--;
139 }
140
141 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
142 return (AE_OK);
143}
144
145/*******************************************************************************
146 *
147 * FUNCTION: acpi_os_delete_cache
148 *
149 * PARAMETERS: cache - Handle to cache object
150 *
151 * RETURN: Status
152 *
153 * DESCRIPTION: Free all objects within the requested cache and delete the
154 * cache object.
155 *
156 ******************************************************************************/
157
158acpi_status acpi_os_delete_cache(struct acpi_memory_list * cache)
159{
160 acpi_status status;
161
162 ACPI_FUNCTION_ENTRY();
163
164 /* Purge all objects in the cache */
165
166 status = acpi_os_purge_cache(cache);
167 if (ACPI_FAILURE(status)) {
168 return (status);
169 }
170
171 /* Now we can delete the cache object */
172
173 acpi_os_free(cache);
174 return (AE_OK);
175}
176
177/*******************************************************************************
178 *
179 * FUNCTION: acpi_os_release_object
180 *
181 * PARAMETERS: cache - Handle to cache object
182 * object - The object to be released
183 *
184 * RETURN: None
185 *
186 * DESCRIPTION: Release an object to the specified cache. If cache is full,
187 * the object is deleted.
188 *
189 ******************************************************************************/
190
191acpi_status
192acpi_os_release_object(struct acpi_memory_list * cache, void *object)
193{
194 acpi_status status;
195
196 ACPI_FUNCTION_ENTRY();
197
198 if (!cache || !object) {
199 return (AE_BAD_PARAMETER);
200 }
201
202 /* If cache is full, just free this object */
203
204 if (cache->current_depth >= cache->max_depth) {
205 ACPI_FREE(object);
206 ACPI_MEM_TRACKING(cache->total_freed++);
207 }
208
209 /* Otherwise put this object back into the cache */
210
211 else {
212 status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
213 if (ACPI_FAILURE(status)) {
214 return (status);
215 }
216
217 /* Mark the object as cached */
218
219 ACPI_MEMSET(object, 0xCA, cache->object_size);
220 ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_CACHED);
221
222 /* Put the object at the head of the cache list */
223
224 *(ACPI_CAST_INDIRECT_PTR(char,
225 &(((char *)object)[cache->
226 link_offset]))) =
227 cache->list_head;
228 cache->list_head = object;
229 cache->current_depth++;
230
231 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
232 }
233
234 return (AE_OK);
235}
236
237/*******************************************************************************
238 *
239 * FUNCTION: acpi_os_acquire_object
240 *
241 * PARAMETERS: cache - Handle to cache object
242 *
243 * RETURN: the acquired object. NULL on error
244 *
245 * DESCRIPTION: Get an object from the specified cache. If cache is empty,
246 * the object is allocated.
247 *
248 ******************************************************************************/
249
250void *acpi_os_acquire_object(struct acpi_memory_list *cache)
251{
252 acpi_status status;
253 void *object;
254
255 ACPI_FUNCTION_NAME(os_acquire_object);
256
257 if (!cache) {
258 return (NULL);
259 }
260
261 status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
262 if (ACPI_FAILURE(status)) {
263 return (NULL);
264 }
265
266 ACPI_MEM_TRACKING(cache->requests++);
267
268 /* Check the cache first */
269
270 if (cache->list_head) {
271
272 /* There is an object available, use it */
273
274 object = cache->list_head;
275 cache->list_head = *(ACPI_CAST_INDIRECT_PTR(char,
276 &(((char *)
277 object)[cache->
278 link_offset])));
279
280 cache->current_depth--;
281
282 ACPI_MEM_TRACKING(cache->hits++);
283 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
284 "Object %p from %s cache\n", object,
285 cache->list_name));
286
287 status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
288 if (ACPI_FAILURE(status)) {
289 return (NULL);
290 }
291
292 /* Clear (zero) the previously used Object */
293
294 ACPI_MEMSET(object, 0, cache->object_size);
295 } else {
296 /* The cache is empty, create a new object */
297
298 ACPI_MEM_TRACKING(cache->total_allocated++);
299
300#ifdef ACPI_DBG_TRACK_ALLOCATIONS
301 if ((cache->total_allocated - cache->total_freed) >
302 cache->max_occupied) {
303 cache->max_occupied =
304 cache->total_allocated - cache->total_freed;
305 }
306#endif
307
308 /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
309
310 status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
311 if (ACPI_FAILURE(status)) {
312 return (NULL);
313 }
314
315 object = ACPI_ALLOCATE_ZEROED(cache->object_size);
316 if (!object) {
317 return (NULL);
318 }
319 }
320
321 return (object);
322}
323#endif /* ACPI_USE_LOCAL_CACHE */
diff --git a/drivers/acpi/acpica/utclib.c b/drivers/acpi/acpica/utclib.c
new file mode 100644
index 000000000000..19ea4755aa73
--- /dev/null
+++ b/drivers/acpi/acpica/utclib.c
@@ -0,0 +1,749 @@
1/******************************************************************************
2 *
3 * Module Name: cmclib - Local implementation of C library functions
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46
47/*
48 * These implementations of standard C Library routines can optionally be
49 * used if a C library is not available. In general, they are less efficient
50 * than an inline or assembly implementation
51 */
52
53#define _COMPONENT ACPI_UTILITIES
54ACPI_MODULE_NAME("cmclib")
55
56#ifndef ACPI_USE_SYSTEM_CLIBRARY
57#define NEGATIVE 1
58#define POSITIVE 0
59/*******************************************************************************
60 *
61 * FUNCTION: acpi_ut_memcmp (memcmp)
62 *
63 * PARAMETERS: buffer1 - First Buffer
64 * buffer2 - Second Buffer
65 * count - Maximum # of bytes to compare
66 *
67 * RETURN: Index where Buffers mismatched, or 0 if Buffers matched
68 *
69 * DESCRIPTION: Compare two Buffers, with a maximum length
70 *
71 ******************************************************************************/
72int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count)
73{
74
75 return ((count == ACPI_SIZE_MAX) ? 0 : ((unsigned char)*buffer1 -
76 (unsigned char)*buffer2));
77}
78
79/*******************************************************************************
80 *
81 * FUNCTION: acpi_ut_memcpy (memcpy)
82 *
83 * PARAMETERS: dest - Target of the copy
84 * src - Source buffer to copy
85 * count - Number of bytes to copy
86 *
87 * RETURN: Dest
88 *
89 * DESCRIPTION: Copy arbitrary bytes of memory
90 *
91 ******************************************************************************/
92
93void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count)
94{
95 char *new = (char *)dest;
96 char *old = (char *)src;
97
98 while (count) {
99 *new = *old;
100 new++;
101 old++;
102 count--;
103 }
104
105 return (dest);
106}
107
108/*******************************************************************************
109 *
110 * FUNCTION: acpi_ut_memset (memset)
111 *
112 * PARAMETERS: dest - Buffer to set
113 * value - Value to set each byte of memory
114 * count - Number of bytes to set
115 *
116 * RETURN: Dest
117 *
118 * DESCRIPTION: Initialize a buffer to a known value.
119 *
120 ******************************************************************************/
121
122void *acpi_ut_memset(void *dest, u8 value, acpi_size count)
123{
124 char *new = (char *)dest;
125
126 while (count) {
127 *new = (char)value;
128 new++;
129 count--;
130 }
131
132 return (dest);
133}
134
135/*******************************************************************************
136 *
137 * FUNCTION: acpi_ut_strlen (strlen)
138 *
139 * PARAMETERS: string - Null terminated string
140 *
141 * RETURN: Length
142 *
143 * DESCRIPTION: Returns the length of the input string
144 *
145 ******************************************************************************/
146
147acpi_size acpi_ut_strlen(const char *string)
148{
149 u32 length = 0;
150
151 /* Count the string until a null is encountered */
152
153 while (*string) {
154 length++;
155 string++;
156 }
157
158 return (length);
159}
160
161/*******************************************************************************
162 *
163 * FUNCTION: acpi_ut_strcpy (strcpy)
164 *
165 * PARAMETERS: dst_string - Target of the copy
166 * src_string - The source string to copy
167 *
168 * RETURN: dst_string
169 *
170 * DESCRIPTION: Copy a null terminated string
171 *
172 ******************************************************************************/
173
174char *acpi_ut_strcpy(char *dst_string, const char *src_string)
175{
176 char *string = dst_string;
177
178 /* Move bytes brute force */
179
180 while (*src_string) {
181 *string = *src_string;
182
183 string++;
184 src_string++;
185 }
186
187 /* Null terminate */
188
189 *string = 0;
190 return (dst_string);
191}
192
193/*******************************************************************************
194 *
195 * FUNCTION: acpi_ut_strncpy (strncpy)
196 *
197 * PARAMETERS: dst_string - Target of the copy
198 * src_string - The source string to copy
199 * count - Maximum # of bytes to copy
200 *
201 * RETURN: dst_string
202 *
203 * DESCRIPTION: Copy a null terminated string, with a maximum length
204 *
205 ******************************************************************************/
206
207char *acpi_ut_strncpy(char *dst_string, const char *src_string, acpi_size count)
208{
209 char *string = dst_string;
210
211 /* Copy the string */
212
213 for (string = dst_string;
214 count && (count--, (*string++ = *src_string++));) {;
215 }
216
217 /* Pad with nulls if necessary */
218
219 while (count--) {
220 *string = 0;
221 string++;
222 }
223
224 /* Return original pointer */
225
226 return (dst_string);
227}
228
229/*******************************************************************************
230 *
231 * FUNCTION: acpi_ut_strcmp (strcmp)
232 *
233 * PARAMETERS: string1 - First string
234 * string2 - Second string
235 *
236 * RETURN: Index where strings mismatched, or 0 if strings matched
237 *
238 * DESCRIPTION: Compare two null terminated strings
239 *
240 ******************************************************************************/
241
242int acpi_ut_strcmp(const char *string1, const char *string2)
243{
244
245 for (; (*string1 == *string2); string2++) {
246 if (!*string1++) {
247 return (0);
248 }
249 }
250
251 return ((unsigned char)*string1 - (unsigned char)*string2);
252}
253
254#ifdef ACPI_FUTURE_IMPLEMENTATION
255/* Not used at this time */
256/*******************************************************************************
257 *
258 * FUNCTION: acpi_ut_strchr (strchr)
259 *
260 * PARAMETERS: string - Search string
261 * ch - character to search for
262 *
263 * RETURN: Ptr to char or NULL if not found
264 *
265 * DESCRIPTION: Search a string for a character
266 *
267 ******************************************************************************/
268
269char *acpi_ut_strchr(const char *string, int ch)
270{
271
272 for (; (*string); string++) {
273 if ((*string) == (char)ch) {
274 return ((char *)string);
275 }
276 }
277
278 return (NULL);
279}
280#endif
281
282/*******************************************************************************
283 *
284 * FUNCTION: acpi_ut_strncmp (strncmp)
285 *
286 * PARAMETERS: string1 - First string
287 * string2 - Second string
288 * count - Maximum # of bytes to compare
289 *
290 * RETURN: Index where strings mismatched, or 0 if strings matched
291 *
292 * DESCRIPTION: Compare two null terminated strings, with a maximum length
293 *
294 ******************************************************************************/
295
296int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count)
297{
298
299 for (; count-- && (*string1 == *string2); string2++) {
300 if (!*string1++) {
301 return (0);
302 }
303 }
304
305 return ((count == ACPI_SIZE_MAX) ? 0 : ((unsigned char)*string1 -
306 (unsigned char)*string2));
307}
308
309/*******************************************************************************
310 *
311 * FUNCTION: acpi_ut_strcat (Strcat)
312 *
313 * PARAMETERS: dst_string - Target of the copy
314 * src_string - The source string to copy
315 *
316 * RETURN: dst_string
317 *
318 * DESCRIPTION: Append a null terminated string to a null terminated string
319 *
320 ******************************************************************************/
321
322char *acpi_ut_strcat(char *dst_string, const char *src_string)
323{
324 char *string;
325
326 /* Find end of the destination string */
327
328 for (string = dst_string; *string++;) {;
329 }
330
331 /* Concatenate the string */
332
333 for (--string; (*string++ = *src_string++);) {;
334 }
335
336 return (dst_string);
337}
338
339/*******************************************************************************
340 *
341 * FUNCTION: acpi_ut_strncat (strncat)
342 *
343 * PARAMETERS: dst_string - Target of the copy
344 * src_string - The source string to copy
345 * count - Maximum # of bytes to copy
346 *
347 * RETURN: dst_string
348 *
349 * DESCRIPTION: Append a null terminated string to a null terminated string,
350 * with a maximum count.
351 *
352 ******************************************************************************/
353
354char *acpi_ut_strncat(char *dst_string, const char *src_string, acpi_size count)
355{
356 char *string;
357
358 if (count) {
359
360 /* Find end of the destination string */
361
362 for (string = dst_string; *string++;) {;
363 }
364
365 /* Concatenate the string */
366
367 for (--string; (*string++ = *src_string++) && --count;) {;
368 }
369
370 /* Null terminate if necessary */
371
372 if (!count) {
373 *string = 0;
374 }
375 }
376
377 return (dst_string);
378}
379
380/*******************************************************************************
381 *
382 * FUNCTION: acpi_ut_strstr (strstr)
383 *
384 * PARAMETERS: string1 - Target string
385 * string2 - Substring to search for
386 *
387 * RETURN: Where substring match starts, Null if no match found
388 *
389 * DESCRIPTION: Checks if String2 occurs in String1. This is not really a
390 * full implementation of strstr, only sufficient for command
391 * matching
392 *
393 ******************************************************************************/
394
395char *acpi_ut_strstr(char *string1, char *string2)
396{
397 char *string;
398
399 if (acpi_ut_strlen(string2) > acpi_ut_strlen(string1)) {
400 return (NULL);
401 }
402
403 /* Walk entire string, comparing the letters */
404
405 for (string = string1; *string2;) {
406 if (*string2 != *string) {
407 return (NULL);
408 }
409
410 string2++;
411 string++;
412 }
413
414 return (string1);
415}
416
417/*******************************************************************************
418 *
419 * FUNCTION: acpi_ut_strtoul (strtoul)
420 *
421 * PARAMETERS: string - Null terminated string
422 * terminater - Where a pointer to the terminating byte is
423 * returned
424 * base - Radix of the string
425 *
426 * RETURN: Converted value
427 *
428 * DESCRIPTION: Convert a string into a 32-bit unsigned value.
429 * Note: use acpi_ut_strtoul64 for 64-bit integers.
430 *
431 ******************************************************************************/
432
433u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base)
434{
435 u32 converted = 0;
436 u32 index;
437 u32 sign;
438 const char *string_start;
439 u32 return_value = 0;
440 acpi_status status = AE_OK;
441
442 /*
443 * Save the value of the pointer to the buffer's first
444 * character, save the current errno value, and then
445 * skip over any white space in the buffer:
446 */
447 string_start = string;
448 while (ACPI_IS_SPACE(*string) || *string == '\t') {
449 ++string;
450 }
451
452 /*
453 * The buffer may contain an optional plus or minus sign.
454 * If it does, then skip over it but remember what is was:
455 */
456 if (*string == '-') {
457 sign = NEGATIVE;
458 ++string;
459 } else if (*string == '+') {
460 ++string;
461 sign = POSITIVE;
462 } else {
463 sign = POSITIVE;
464 }
465
466 /*
467 * If the input parameter Base is zero, then we need to
468 * determine if it is octal, decimal, or hexadecimal:
469 */
470 if (base == 0) {
471 if (*string == '0') {
472 if (acpi_ut_to_lower(*(++string)) == 'x') {
473 base = 16;
474 ++string;
475 } else {
476 base = 8;
477 }
478 } else {
479 base = 10;
480 }
481 } else if (base < 2 || base > 36) {
482 /*
483 * The specified Base parameter is not in the domain of
484 * this function:
485 */
486 goto done;
487 }
488
489 /*
490 * For octal and hexadecimal bases, skip over the leading
491 * 0 or 0x, if they are present.
492 */
493 if (base == 8 && *string == '0') {
494 string++;
495 }
496
497 if (base == 16 &&
498 *string == '0' && acpi_ut_to_lower(*(++string)) == 'x') {
499 string++;
500 }
501
502 /*
503 * Main loop: convert the string to an unsigned long:
504 */
505 while (*string) {
506 if (ACPI_IS_DIGIT(*string)) {
507 index = (u32)((u8)*string - '0');
508 } else {
509 index = (u32)acpi_ut_to_upper(*string);
510 if (ACPI_IS_UPPER(index)) {
511 index = index - 'A' + 10;
512 } else {
513 goto done;
514 }
515 }
516
517 if (index >= base) {
518 goto done;
519 }
520
521 /*
522 * Check to see if value is out of range:
523 */
524
525 if (return_value > ((ACPI_UINT32_MAX - (u32)index) / (u32)base)) {
526 status = AE_ERROR;
527 return_value = 0; /* reset */
528 } else {
529 return_value *= base;
530 return_value += index;
531 converted = 1;
532 }
533
534 ++string;
535 }
536
537 done:
538 /*
539 * If appropriate, update the caller's pointer to the next
540 * unconverted character in the buffer.
541 */
542 if (terminator) {
543 if (converted == 0 && return_value == 0 && string != NULL) {
544 *terminator = (char *)string_start;
545 } else {
546 *terminator = (char *)string;
547 }
548 }
549
550 if (status == AE_ERROR) {
551 return_value = ACPI_UINT32_MAX;
552 }
553
554 /*
555 * If a minus sign was present, then "the conversion is negated":
556 */
557 if (sign == NEGATIVE) {
558 return_value = (ACPI_UINT32_MAX - return_value) + 1;
559 }
560
561 return (return_value);
562}
563
564/*******************************************************************************
565 *
566 * FUNCTION: acpi_ut_to_upper (TOUPPER)
567 *
568 * PARAMETERS: c - Character to convert
569 *
570 * RETURN: Converted character as an int
571 *
572 * DESCRIPTION: Convert character to uppercase
573 *
574 ******************************************************************************/
575
576int acpi_ut_to_upper(int c)
577{
578
579 return (ACPI_IS_LOWER(c) ? ((c) - 0x20) : (c));
580}
581
582/*******************************************************************************
583 *
584 * FUNCTION: acpi_ut_to_lower (TOLOWER)
585 *
586 * PARAMETERS: c - Character to convert
587 *
588 * RETURN: Converted character as an int
589 *
590 * DESCRIPTION: Convert character to lowercase
591 *
592 ******************************************************************************/
593
594int acpi_ut_to_lower(int c)
595{
596
597 return (ACPI_IS_UPPER(c) ? ((c) + 0x20) : (c));
598}
599
600/*******************************************************************************
601 *
602 * FUNCTION: is* functions
603 *
604 * DESCRIPTION: is* functions use the ctype table below
605 *
606 ******************************************************************************/
607
608const u8 _acpi_ctype[257] = {
609 _ACPI_CN, /* 0x00 0 NUL */
610 _ACPI_CN, /* 0x01 1 SOH */
611 _ACPI_CN, /* 0x02 2 STX */
612 _ACPI_CN, /* 0x03 3 ETX */
613 _ACPI_CN, /* 0x04 4 EOT */
614 _ACPI_CN, /* 0x05 5 ENQ */
615 _ACPI_CN, /* 0x06 6 ACK */
616 _ACPI_CN, /* 0x07 7 BEL */
617 _ACPI_CN, /* 0x08 8 BS */
618 _ACPI_CN | _ACPI_SP, /* 0x09 9 TAB */
619 _ACPI_CN | _ACPI_SP, /* 0x0A 10 LF */
620 _ACPI_CN | _ACPI_SP, /* 0x0B 11 VT */
621 _ACPI_CN | _ACPI_SP, /* 0x0C 12 FF */
622 _ACPI_CN | _ACPI_SP, /* 0x0D 13 CR */
623 _ACPI_CN, /* 0x0E 14 SO */
624 _ACPI_CN, /* 0x0F 15 SI */
625 _ACPI_CN, /* 0x10 16 DLE */
626 _ACPI_CN, /* 0x11 17 DC1 */
627 _ACPI_CN, /* 0x12 18 DC2 */
628 _ACPI_CN, /* 0x13 19 DC3 */
629 _ACPI_CN, /* 0x14 20 DC4 */
630 _ACPI_CN, /* 0x15 21 NAK */
631 _ACPI_CN, /* 0x16 22 SYN */
632 _ACPI_CN, /* 0x17 23 ETB */
633 _ACPI_CN, /* 0x18 24 CAN */
634 _ACPI_CN, /* 0x19 25 EM */
635 _ACPI_CN, /* 0x1A 26 SUB */
636 _ACPI_CN, /* 0x1B 27 ESC */
637 _ACPI_CN, /* 0x1C 28 FS */
638 _ACPI_CN, /* 0x1D 29 GS */
639 _ACPI_CN, /* 0x1E 30 RS */
640 _ACPI_CN, /* 0x1F 31 US */
641 _ACPI_XS | _ACPI_SP, /* 0x20 32 ' ' */
642 _ACPI_PU, /* 0x21 33 '!' */
643 _ACPI_PU, /* 0x22 34 '"' */
644 _ACPI_PU, /* 0x23 35 '#' */
645 _ACPI_PU, /* 0x24 36 '$' */
646 _ACPI_PU, /* 0x25 37 '%' */
647 _ACPI_PU, /* 0x26 38 '&' */
648 _ACPI_PU, /* 0x27 39 ''' */
649 _ACPI_PU, /* 0x28 40 '(' */
650 _ACPI_PU, /* 0x29 41 ')' */
651 _ACPI_PU, /* 0x2A 42 '*' */
652 _ACPI_PU, /* 0x2B 43 '+' */
653 _ACPI_PU, /* 0x2C 44 ',' */
654 _ACPI_PU, /* 0x2D 45 '-' */
655 _ACPI_PU, /* 0x2E 46 '.' */
656 _ACPI_PU, /* 0x2F 47 '/' */
657 _ACPI_XD | _ACPI_DI, /* 0x30 48 '0' */
658 _ACPI_XD | _ACPI_DI, /* 0x31 49 '1' */
659 _ACPI_XD | _ACPI_DI, /* 0x32 50 '2' */
660 _ACPI_XD | _ACPI_DI, /* 0x33 51 '3' */
661 _ACPI_XD | _ACPI_DI, /* 0x34 52 '4' */
662 _ACPI_XD | _ACPI_DI, /* 0x35 53 '5' */
663 _ACPI_XD | _ACPI_DI, /* 0x36 54 '6' */
664 _ACPI_XD | _ACPI_DI, /* 0x37 55 '7' */
665 _ACPI_XD | _ACPI_DI, /* 0x38 56 '8' */
666 _ACPI_XD | _ACPI_DI, /* 0x39 57 '9' */
667 _ACPI_PU, /* 0x3A 58 ':' */
668 _ACPI_PU, /* 0x3B 59 ';' */
669 _ACPI_PU, /* 0x3C 60 '<' */
670 _ACPI_PU, /* 0x3D 61 '=' */
671 _ACPI_PU, /* 0x3E 62 '>' */
672 _ACPI_PU, /* 0x3F 63 '?' */
673 _ACPI_PU, /* 0x40 64 '@' */
674 _ACPI_XD | _ACPI_UP, /* 0x41 65 'A' */
675 _ACPI_XD | _ACPI_UP, /* 0x42 66 'B' */
676 _ACPI_XD | _ACPI_UP, /* 0x43 67 'C' */
677 _ACPI_XD | _ACPI_UP, /* 0x44 68 'D' */
678 _ACPI_XD | _ACPI_UP, /* 0x45 69 'E' */
679 _ACPI_XD | _ACPI_UP, /* 0x46 70 'F' */
680 _ACPI_UP, /* 0x47 71 'G' */
681 _ACPI_UP, /* 0x48 72 'H' */
682 _ACPI_UP, /* 0x49 73 'I' */
683 _ACPI_UP, /* 0x4A 74 'J' */
684 _ACPI_UP, /* 0x4B 75 'K' */
685 _ACPI_UP, /* 0x4C 76 'L' */
686 _ACPI_UP, /* 0x4D 77 'M' */
687 _ACPI_UP, /* 0x4E 78 'N' */
688 _ACPI_UP, /* 0x4F 79 'O' */
689 _ACPI_UP, /* 0x50 80 'P' */
690 _ACPI_UP, /* 0x51 81 'Q' */
691 _ACPI_UP, /* 0x52 82 'R' */
692 _ACPI_UP, /* 0x53 83 'S' */
693 _ACPI_UP, /* 0x54 84 'T' */
694 _ACPI_UP, /* 0x55 85 'U' */
695 _ACPI_UP, /* 0x56 86 'V' */
696 _ACPI_UP, /* 0x57 87 'W' */
697 _ACPI_UP, /* 0x58 88 'X' */
698 _ACPI_UP, /* 0x59 89 'Y' */
699 _ACPI_UP, /* 0x5A 90 'Z' */
700 _ACPI_PU, /* 0x5B 91 '[' */
701 _ACPI_PU, /* 0x5C 92 '\' */
702 _ACPI_PU, /* 0x5D 93 ']' */
703 _ACPI_PU, /* 0x5E 94 '^' */
704 _ACPI_PU, /* 0x5F 95 '_' */
705 _ACPI_PU, /* 0x60 96 '`' */
706 _ACPI_XD | _ACPI_LO, /* 0x61 97 'a' */
707 _ACPI_XD | _ACPI_LO, /* 0x62 98 'b' */
708 _ACPI_XD | _ACPI_LO, /* 0x63 99 'c' */
709 _ACPI_XD | _ACPI_LO, /* 0x64 100 'd' */
710 _ACPI_XD | _ACPI_LO, /* 0x65 101 'e' */
711 _ACPI_XD | _ACPI_LO, /* 0x66 102 'f' */
712 _ACPI_LO, /* 0x67 103 'g' */
713 _ACPI_LO, /* 0x68 104 'h' */
714 _ACPI_LO, /* 0x69 105 'i' */
715 _ACPI_LO, /* 0x6A 106 'j' */
716 _ACPI_LO, /* 0x6B 107 'k' */
717 _ACPI_LO, /* 0x6C 108 'l' */
718 _ACPI_LO, /* 0x6D 109 'm' */
719 _ACPI_LO, /* 0x6E 110 'n' */
720 _ACPI_LO, /* 0x6F 111 'o' */
721 _ACPI_LO, /* 0x70 112 'p' */
722 _ACPI_LO, /* 0x71 113 'q' */
723 _ACPI_LO, /* 0x72 114 'r' */
724 _ACPI_LO, /* 0x73 115 's' */
725 _ACPI_LO, /* 0x74 116 't' */
726 _ACPI_LO, /* 0x75 117 'u' */
727 _ACPI_LO, /* 0x76 118 'v' */
728 _ACPI_LO, /* 0x77 119 'w' */
729 _ACPI_LO, /* 0x78 120 'x' */
730 _ACPI_LO, /* 0x79 121 'y' */
731 _ACPI_LO, /* 0x7A 122 'z' */
732 _ACPI_PU, /* 0x7B 123 '{' */
733 _ACPI_PU, /* 0x7C 124 '|' */
734 _ACPI_PU, /* 0x7D 125 '}' */
735 _ACPI_PU, /* 0x7E 126 '~' */
736 _ACPI_CN, /* 0x7F 127 DEL */
737
738 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 to 0x8F */
739 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 to 0x9F */
740 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 to 0xAF */
741 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 to 0xBF */
742 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 to 0xCF */
743 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 to 0xDF */
744 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 to 0xEF */
745 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xF0 to 0xFF */
746 0 /* 0x100 */
747};
748
749#endif /* ACPI_USE_SYSTEM_CLIBRARY */
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c
index e810894149ae..5d95166245ae 100644
--- a/drivers/acpi/acpica/utdebug.c
+++ b/drivers/acpi/acpica/utdebug.c
@@ -47,8 +47,9 @@
47 47
48#define _COMPONENT ACPI_UTILITIES 48#define _COMPONENT ACPI_UTILITIES
49ACPI_MODULE_NAME("utdebug") 49ACPI_MODULE_NAME("utdebug")
50
50#ifdef ACPI_DEBUG_OUTPUT 51#ifdef ACPI_DEBUG_OUTPUT
51static acpi_thread_id acpi_gbl_prev_thread_id; 52static acpi_thread_id acpi_gbl_prev_thread_id = (acpi_thread_id) 0xFFFFFFFF;
52static char *acpi_gbl_fn_entry_str = "----Entry"; 53static char *acpi_gbl_fn_entry_str = "----Entry";
53static char *acpi_gbl_fn_exit_str = "----Exit-"; 54static char *acpi_gbl_fn_exit_str = "----Exit-";
54 55
@@ -109,7 +110,7 @@ void acpi_ut_track_stack_ptr(void)
109 * RETURN: Updated pointer to the function name 110 * RETURN: Updated pointer to the function name
110 * 111 *
111 * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. 112 * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
112 * This allows compiler macros such as __func__ to be used 113 * This allows compiler macros such as __FUNCTION__ to be used
113 * with no change to the debug output. 114 * with no change to the debug output.
114 * 115 *
115 ******************************************************************************/ 116 ******************************************************************************/
@@ -222,7 +223,7 @@ ACPI_EXPORT_SYMBOL(acpi_debug_print)
222 * 223 *
223 * RETURN: None 224 * RETURN: None
224 * 225 *
225 * DESCRIPTION: Print message with no headers. Has same interface as 226 * DESCRIPTION: Print message with no headers. Has same interface as
226 * debug_print so that the same macros can be used. 227 * debug_print so that the same macros can be used.
227 * 228 *
228 ******************************************************************************/ 229 ******************************************************************************/
@@ -258,7 +259,7 @@ ACPI_EXPORT_SYMBOL(acpi_debug_print_raw)
258 * 259 *
259 * RETURN: None 260 * RETURN: None
260 * 261 *
261 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 262 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
262 * set in debug_level 263 * set in debug_level
263 * 264 *
264 ******************************************************************************/ 265 ******************************************************************************/
@@ -290,7 +291,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_trace)
290 * 291 *
291 * RETURN: None 292 * RETURN: None
292 * 293 *
293 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 294 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
294 * set in debug_level 295 * set in debug_level
295 * 296 *
296 ******************************************************************************/ 297 ******************************************************************************/
@@ -299,6 +300,7 @@ acpi_ut_trace_ptr(u32 line_number,
299 const char *function_name, 300 const char *function_name,
300 const char *module_name, u32 component_id, void *pointer) 301 const char *module_name, u32 component_id, void *pointer)
301{ 302{
303
302 acpi_gbl_nesting_level++; 304 acpi_gbl_nesting_level++;
303 acpi_ut_track_stack_ptr(); 305 acpi_ut_track_stack_ptr();
304 306
@@ -319,7 +321,7 @@ acpi_ut_trace_ptr(u32 line_number,
319 * 321 *
320 * RETURN: None 322 * RETURN: None
321 * 323 *
322 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 324 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
323 * set in debug_level 325 * set in debug_level
324 * 326 *
325 ******************************************************************************/ 327 ******************************************************************************/
@@ -350,7 +352,7 @@ acpi_ut_trace_str(u32 line_number,
350 * 352 *
351 * RETURN: None 353 * RETURN: None
352 * 354 *
353 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 355 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
354 * set in debug_level 356 * set in debug_level
355 * 357 *
356 ******************************************************************************/ 358 ******************************************************************************/
@@ -380,7 +382,7 @@ acpi_ut_trace_u32(u32 line_number,
380 * 382 *
381 * RETURN: None 383 * RETURN: None
382 * 384 *
383 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 385 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
384 * set in debug_level 386 * set in debug_level
385 * 387 *
386 ******************************************************************************/ 388 ******************************************************************************/
@@ -412,7 +414,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_exit)
412 * 414 *
413 * RETURN: None 415 * RETURN: None
414 * 416 *
415 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 417 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
416 * set in debug_level. Prints exit status also. 418 * set in debug_level. Prints exit status also.
417 * 419 *
418 ******************************************************************************/ 420 ******************************************************************************/
@@ -453,7 +455,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_status_exit)
453 * 455 *
454 * RETURN: None 456 * RETURN: None
455 * 457 *
456 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 458 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
457 * set in debug_level. Prints exit value also. 459 * set in debug_level. Prints exit value also.
458 * 460 *
459 ******************************************************************************/ 461 ******************************************************************************/
@@ -485,7 +487,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_value_exit)
485 * 487 *
486 * RETURN: None 488 * RETURN: None
487 * 489 *
488 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 490 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
489 * set in debug_level. Prints exit value also. 491 * set in debug_level. Prints exit value also.
490 * 492 *
491 ******************************************************************************/ 493 ******************************************************************************/
@@ -511,7 +513,7 @@ acpi_ut_ptr_exit(u32 line_number,
511 * PARAMETERS: buffer - Buffer to dump 513 * PARAMETERS: buffer - Buffer to dump
512 * count - Amount to dump, in bytes 514 * count - Amount to dump, in bytes
513 * display - BYTE, WORD, DWORD, or QWORD display 515 * display - BYTE, WORD, DWORD, or QWORD display
514 * component_ID - Caller's component ID 516 * offset - Beginning buffer offset (display only)
515 * 517 *
516 * RETURN: None 518 * RETURN: None
517 * 519 *
@@ -519,7 +521,7 @@ acpi_ut_ptr_exit(u32 line_number,
519 * 521 *
520 ******************************************************************************/ 522 ******************************************************************************/
521 523
522void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) 524void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
523{ 525{
524 u32 i = 0; 526 u32 i = 0;
525 u32 j; 527 u32 j;
@@ -541,7 +543,7 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
541 543
542 /* Print current offset */ 544 /* Print current offset */
543 545
544 acpi_os_printf("%6.4X: ", i); 546 acpi_os_printf("%6.4X: ", (base_offset + i));
545 547
546 /* Print 16 hex chars */ 548 /* Print 16 hex chars */
547 549
@@ -623,7 +625,7 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
623 625
624/******************************************************************************* 626/*******************************************************************************
625 * 627 *
626 * FUNCTION: acpi_ut_dump_buffer 628 * FUNCTION: acpi_ut_debug_dump_buffer
627 * 629 *
628 * PARAMETERS: buffer - Buffer to dump 630 * PARAMETERS: buffer - Buffer to dump
629 * count - Amount to dump, in bytes 631 * count - Amount to dump, in bytes
@@ -636,7 +638,8 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
636 * 638 *
637 ******************************************************************************/ 639 ******************************************************************************/
638 640
639void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) 641void
642acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id)
640{ 643{
641 644
642 /* Only dump the buffer if tracing is enabled */ 645 /* Only dump the buffer if tracing is enabled */
@@ -646,5 +649,5 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
646 return; 649 return;
647 } 650 }
648 651
649 acpi_ut_dump_buffer2(buffer, count, display); 652 acpi_ut_dump_buffer(buffer, count, display, 0);
650} 653}
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c
index 5d84e1954575..774c3aefbf5d 100644
--- a/drivers/acpi/acpica/utids.c
+++ b/drivers/acpi/acpica/utids.c
@@ -67,10 +67,10 @@ ACPI_MODULE_NAME("utids")
67 ******************************************************************************/ 67 ******************************************************************************/
68acpi_status 68acpi_status
69acpi_ut_execute_HID(struct acpi_namespace_node *device_node, 69acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
70 struct acpica_device_id **return_id) 70 struct acpi_pnp_device_id **return_id)
71{ 71{
72 union acpi_operand_object *obj_desc; 72 union acpi_operand_object *obj_desc;
73 struct acpica_device_id *hid; 73 struct acpi_pnp_device_id *hid;
74 u32 length; 74 u32 length;
75 acpi_status status; 75 acpi_status status;
76 76
@@ -94,16 +94,17 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
94 /* Allocate a buffer for the HID */ 94 /* Allocate a buffer for the HID */
95 95
96 hid = 96 hid =
97 ACPI_ALLOCATE_ZEROED(sizeof(struct acpica_device_id) + 97 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
98 (acpi_size) length); 98 (acpi_size) length);
99 if (!hid) { 99 if (!hid) {
100 status = AE_NO_MEMORY; 100 status = AE_NO_MEMORY;
101 goto cleanup; 101 goto cleanup;
102 } 102 }
103 103
104 /* Area for the string starts after DEVICE_ID struct */ 104 /* Area for the string starts after PNP_DEVICE_ID struct */
105 105
106 hid->string = ACPI_ADD_PTR(char, hid, sizeof(struct acpica_device_id)); 106 hid->string =
107 ACPI_ADD_PTR(char, hid, sizeof(struct acpi_pnp_device_id));
107 108
108 /* Convert EISAID to a string or simply copy existing string */ 109 /* Convert EISAID to a string or simply copy existing string */
109 110
@@ -126,6 +127,73 @@ cleanup:
126 127
127/******************************************************************************* 128/*******************************************************************************
128 * 129 *
130 * FUNCTION: acpi_ut_execute_SUB
131 *
132 * PARAMETERS: device_node - Node for the device
133 * return_id - Where the _SUB is returned
134 *
135 * RETURN: Status
136 *
137 * DESCRIPTION: Executes the _SUB control method that returns the subsystem
138 * ID of the device. The _SUB value is always a string containing
139 * either a valid PNP or ACPI ID.
140 *
141 * NOTE: Internal function, no parameter validation
142 *
143 ******************************************************************************/
144
145acpi_status
146acpi_ut_execute_SUB(struct acpi_namespace_node *device_node,
147 struct acpi_pnp_device_id **return_id)
148{
149 union acpi_operand_object *obj_desc;
150 struct acpi_pnp_device_id *sub;
151 u32 length;
152 acpi_status status;
153
154 ACPI_FUNCTION_TRACE(ut_execute_SUB);
155
156 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__SUB,
157 ACPI_BTYPE_STRING, &obj_desc);
158 if (ACPI_FAILURE(status)) {
159 return_ACPI_STATUS(status);
160 }
161
162 /* Get the size of the String to be returned, includes null terminator */
163
164 length = obj_desc->string.length + 1;
165
166 /* Allocate a buffer for the SUB */
167
168 sub =
169 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
170 (acpi_size) length);
171 if (!sub) {
172 status = AE_NO_MEMORY;
173 goto cleanup;
174 }
175
176 /* Area for the string starts after PNP_DEVICE_ID struct */
177
178 sub->string =
179 ACPI_ADD_PTR(char, sub, sizeof(struct acpi_pnp_device_id));
180
181 /* Simply copy existing string */
182
183 ACPI_STRCPY(sub->string, obj_desc->string.pointer);
184 sub->length = length;
185 *return_id = sub;
186
187 cleanup:
188
189 /* On exit, we must delete the return object */
190
191 acpi_ut_remove_reference(obj_desc);
192 return_ACPI_STATUS(status);
193}
194
195/*******************************************************************************
196 *
129 * FUNCTION: acpi_ut_execute_UID 197 * FUNCTION: acpi_ut_execute_UID
130 * 198 *
131 * PARAMETERS: device_node - Node for the device 199 * PARAMETERS: device_node - Node for the device
@@ -144,10 +212,10 @@ cleanup:
144 212
145acpi_status 213acpi_status
146acpi_ut_execute_UID(struct acpi_namespace_node *device_node, 214acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
147 struct acpica_device_id **return_id) 215 struct acpi_pnp_device_id **return_id)
148{ 216{
149 union acpi_operand_object *obj_desc; 217 union acpi_operand_object *obj_desc;
150 struct acpica_device_id *uid; 218 struct acpi_pnp_device_id *uid;
151 u32 length; 219 u32 length;
152 acpi_status status; 220 acpi_status status;
153 221
@@ -171,16 +239,17 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
171 /* Allocate a buffer for the UID */ 239 /* Allocate a buffer for the UID */
172 240
173 uid = 241 uid =
174 ACPI_ALLOCATE_ZEROED(sizeof(struct acpica_device_id) + 242 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
175 (acpi_size) length); 243 (acpi_size) length);
176 if (!uid) { 244 if (!uid) {
177 status = AE_NO_MEMORY; 245 status = AE_NO_MEMORY;
178 goto cleanup; 246 goto cleanup;
179 } 247 }
180 248
181 /* Area for the string starts after DEVICE_ID struct */ 249 /* Area for the string starts after PNP_DEVICE_ID struct */
182 250
183 uid->string = ACPI_ADD_PTR(char, uid, sizeof(struct acpica_device_id)); 251 uid->string =
252 ACPI_ADD_PTR(char, uid, sizeof(struct acpi_pnp_device_id));
184 253
185 /* Convert an Integer to string, or just copy an existing string */ 254 /* Convert an Integer to string, or just copy an existing string */
186 255
@@ -226,11 +295,11 @@ cleanup:
226 295
227acpi_status 296acpi_status
228acpi_ut_execute_CID(struct acpi_namespace_node *device_node, 297acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
229 struct acpica_device_id_list **return_cid_list) 298 struct acpi_pnp_device_id_list **return_cid_list)
230{ 299{
231 union acpi_operand_object **cid_objects; 300 union acpi_operand_object **cid_objects;
232 union acpi_operand_object *obj_desc; 301 union acpi_operand_object *obj_desc;
233 struct acpica_device_id_list *cid_list; 302 struct acpi_pnp_device_id_list *cid_list;
234 char *next_id_string; 303 char *next_id_string;
235 u32 string_area_size; 304 u32 string_area_size;
236 u32 length; 305 u32 length;
@@ -288,11 +357,12 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
288 /* 357 /*
289 * Now that we know the length of the CIDs, allocate return buffer: 358 * Now that we know the length of the CIDs, allocate return buffer:
290 * 1) Size of the base structure + 359 * 1) Size of the base structure +
291 * 2) Size of the CID DEVICE_ID array + 360 * 2) Size of the CID PNP_DEVICE_ID array +
292 * 3) Size of the actual CID strings 361 * 3) Size of the actual CID strings
293 */ 362 */
294 cid_list_size = sizeof(struct acpica_device_id_list) + 363 cid_list_size = sizeof(struct acpi_pnp_device_id_list) +
295 ((count - 1) * sizeof(struct acpica_device_id)) + string_area_size; 364 ((count - 1) * sizeof(struct acpi_pnp_device_id)) +
365 string_area_size;
296 366
297 cid_list = ACPI_ALLOCATE_ZEROED(cid_list_size); 367 cid_list = ACPI_ALLOCATE_ZEROED(cid_list_size);
298 if (!cid_list) { 368 if (!cid_list) {
@@ -300,10 +370,10 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
300 goto cleanup; 370 goto cleanup;
301 } 371 }
302 372
303 /* Area for CID strings starts after the CID DEVICE_ID array */ 373 /* Area for CID strings starts after the CID PNP_DEVICE_ID array */
304 374
305 next_id_string = ACPI_CAST_PTR(char, cid_list->ids) + 375 next_id_string = ACPI_CAST_PTR(char, cid_list->ids) +
306 ((acpi_size) count * sizeof(struct acpica_device_id)); 376 ((acpi_size) count * sizeof(struct acpi_pnp_device_id));
307 377
308 /* Copy/convert the CIDs to the return buffer */ 378 /* Copy/convert the CIDs to the return buffer */
309 379
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c
index d88a8aaab2a6..49563674833a 100644
--- a/drivers/acpi/acpica/utmath.c
+++ b/drivers/acpi/acpica/utmath.c
@@ -81,7 +81,7 @@ typedef union uint64_overlay {
81 * RETURN: Status (Checks for divide-by-zero) 81 * RETURN: Status (Checks for divide-by-zero)
82 * 82 *
83 * DESCRIPTION: Perform a short (maximum 64 bits divided by 32 bits) 83 * DESCRIPTION: Perform a short (maximum 64 bits divided by 32 bits)
84 * divide and modulo. The result is a 64-bit quotient and a 84 * divide and modulo. The result is a 64-bit quotient and a
85 * 32-bit remainder. 85 * 32-bit remainder.
86 * 86 *
87 ******************************************************************************/ 87 ******************************************************************************/
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index 33c6cf7ff467..9286a69eb9aa 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -41,8 +41,6 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <linux/module.h>
45
46#include <acpi/acpi.h> 44#include <acpi/acpi.h>
47#include "accommon.h" 45#include "accommon.h"
48#include "acnamesp.h" 46#include "acnamesp.h"
@@ -201,8 +199,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
201 */ 199 */
202 acpi_gbl_owner_id_mask[j] |= (1 << k); 200 acpi_gbl_owner_id_mask[j] |= (1 << k);
203 201
204 acpi_gbl_last_owner_id_index = (u8) j; 202 acpi_gbl_last_owner_id_index = (u8)j;
205 acpi_gbl_next_owner_id_offset = (u8) (k + 1); 203 acpi_gbl_next_owner_id_offset = (u8)(k + 1);
206 204
207 /* 205 /*
208 * Construct encoded ID from the index and bit position 206 * Construct encoded ID from the index and bit position
@@ -252,7 +250,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
252 * control method or unloading a table. Either way, we would 250 * control method or unloading a table. Either way, we would
253 * ignore any error anyway. 251 * ignore any error anyway.
254 * 252 *
255 * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255 253 * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255
256 * 254 *
257 ******************************************************************************/ 255 ******************************************************************************/
258 256
@@ -339,6 +337,73 @@ void acpi_ut_strupr(char *src_string)
339 return; 337 return;
340} 338}
341 339
340#ifdef ACPI_ASL_COMPILER
341/*******************************************************************************
342 *
343 * FUNCTION: acpi_ut_strlwr (strlwr)
344 *
345 * PARAMETERS: src_string - The source string to convert
346 *
347 * RETURN: None
348 *
349 * DESCRIPTION: Convert string to lowercase
350 *
351 * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
352 *
353 ******************************************************************************/
354
355void acpi_ut_strlwr(char *src_string)
356{
357 char *string;
358
359 ACPI_FUNCTION_ENTRY();
360
361 if (!src_string) {
362 return;
363 }
364
365 /* Walk entire string, lowercasing the letters */
366
367 for (string = src_string; *string; string++) {
368 *string = (char)ACPI_TOLOWER(*string);
369 }
370
371 return;
372}
373
374/******************************************************************************
375 *
376 * FUNCTION: acpi_ut_stricmp
377 *
378 * PARAMETERS: string1 - first string to compare
379 * string2 - second string to compare
380 *
381 * RETURN: int that signifies string relationship. Zero means strings
382 * are equal.
383 *
384 * DESCRIPTION: Implementation of the non-ANSI stricmp function (compare
385 * strings with no case sensitivity)
386 *
387 ******************************************************************************/
388
389int acpi_ut_stricmp(char *string1, char *string2)
390{
391 int c1;
392 int c2;
393
394 do {
395 c1 = tolower((int)*string1);
396 c2 = tolower((int)*string2);
397
398 string1++;
399 string2++;
400 }
401 while ((c1 == c2) && (c1));
402
403 return (c1 - c2);
404}
405#endif
406
342/******************************************************************************* 407/*******************************************************************************
343 * 408 *
344 * FUNCTION: acpi_ut_print_string 409 * FUNCTION: acpi_ut_print_string
@@ -469,8 +534,8 @@ u32 acpi_ut_dword_byte_swap(u32 value)
469 * RETURN: None 534 * RETURN: None
470 * 535 *
471 * DESCRIPTION: Set the global integer bit width based upon the revision 536 * DESCRIPTION: Set the global integer bit width based upon the revision
472 * of the DSDT. For Revision 1 and 0, Integers are 32 bits. 537 * of the DSDT. For Revision 1 and 0, Integers are 32 bits.
473 * For Revision 2 and above, Integers are 64 bits. Yes, this 538 * For Revision 2 and above, Integers are 64 bits. Yes, this
474 * makes a difference. 539 * makes a difference.
475 * 540 *
476 ******************************************************************************/ 541 ******************************************************************************/
@@ -606,7 +671,7 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position)
606 * 671 *
607 * RETURN: TRUE if the name is valid, FALSE otherwise 672 * RETURN: TRUE if the name is valid, FALSE otherwise
608 * 673 *
609 * DESCRIPTION: Check for a valid ACPI name. Each character must be one of: 674 * DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
610 * 1) Upper case alpha 675 * 1) Upper case alpha
611 * 2) numeric 676 * 2) numeric
612 * 3) underscore 677 * 3) underscore
@@ -638,29 +703,59 @@ u8 acpi_ut_valid_acpi_name(u32 name)
638 * RETURN: Repaired version of the name 703 * RETURN: Repaired version of the name
639 * 704 *
640 * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and 705 * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
641 * return the new name. 706 * return the new name. NOTE: the Name parameter must reside in
707 * read/write memory, cannot be a const.
708 *
709 * An ACPI Name must consist of valid ACPI characters. We will repair the name
710 * if necessary because we don't want to abort because of this, but we want
711 * all namespace names to be printable. A warning message is appropriate.
712 *
713 * This issue came up because there are in fact machines that exhibit
714 * this problem, and we want to be able to enable ACPI support for them,
715 * even though there are a few bad names.
642 * 716 *
643 ******************************************************************************/ 717 ******************************************************************************/
644 718
645acpi_name acpi_ut_repair_name(char *name) 719void acpi_ut_repair_name(char *name)
646{ 720{
647 u32 i; 721 u32 i;
648 char new_name[ACPI_NAME_SIZE]; 722 u8 found_bad_char = FALSE;
723 u32 original_name;
724
725 ACPI_FUNCTION_NAME(ut_repair_name);
726
727 ACPI_MOVE_NAME(&original_name, name);
728
729 /* Check each character in the name */
649 730
650 for (i = 0; i < ACPI_NAME_SIZE; i++) { 731 for (i = 0; i < ACPI_NAME_SIZE; i++) {
651 new_name[i] = name[i]; 732 if (acpi_ut_valid_acpi_char(name[i], i)) {
733 continue;
734 }
652 735
653 /* 736 /*
654 * Replace a bad character with something printable, yet technically 737 * Replace a bad character with something printable, yet technically
655 * still invalid. This prevents any collisions with existing "good" 738 * still invalid. This prevents any collisions with existing "good"
656 * names in the namespace. 739 * names in the namespace.
657 */ 740 */
658 if (!acpi_ut_valid_acpi_char(name[i], i)) { 741 name[i] = '*';
659 new_name[i] = '*'; 742 found_bad_char = TRUE;
660 }
661 } 743 }
662 744
663 return (*(u32 *) new_name); 745 if (found_bad_char) {
746
747 /* Report warning only if in strict mode or debug mode */
748
749 if (!acpi_gbl_enable_interpreter_slack) {
750 ACPI_WARNING((AE_INFO,
751 "Found bad character(s) in name, repaired: [%4.4s]\n",
752 name));
753 } else {
754 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
755 "Found bad character(s) in name, repaired: [%4.4s]\n",
756 name));
757 }
758 }
664} 759}
665 760
666/******************************************************************************* 761/*******************************************************************************
@@ -681,7 +776,7 @@ acpi_name acpi_ut_repair_name(char *name)
681 * 776 *
682 ******************************************************************************/ 777 ******************************************************************************/
683 778
684acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer) 779acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
685{ 780{
686 u32 this_digit = 0; 781 u32 this_digit = 0;
687 u64 return_value = 0; 782 u64 return_value = 0;
@@ -754,14 +849,14 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer)
754 849
755 /* Convert ASCII 0-9 to Decimal value */ 850 /* Convert ASCII 0-9 to Decimal value */
756 851
757 this_digit = ((u8) * string) - '0'; 852 this_digit = ((u8)*string) - '0';
758 } else if (base == 10) { 853 } else if (base == 10) {
759 854
760 /* Digit is out of range; possible in to_integer case only */ 855 /* Digit is out of range; possible in to_integer case only */
761 856
762 term = 1; 857 term = 1;
763 } else { 858 } else {
764 this_digit = (u8) ACPI_TOUPPER(*string); 859 this_digit = (u8)ACPI_TOUPPER(*string);
765 if (ACPI_IS_XDIGIT((char)this_digit)) { 860 if (ACPI_IS_XDIGIT((char)this_digit)) {
766 861
767 /* Convert ASCII Hex char to value */ 862 /* Convert ASCII Hex char to value */
@@ -788,8 +883,9 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer)
788 883
789 valid_digits++; 884 valid_digits++;
790 885
791 if (sign_of0x && ((valid_digits > 16) 886 if (sign_of0x
792 || ((valid_digits > 8) && mode32))) { 887 && ((valid_digits > 16)
888 || ((valid_digits > 8) && mode32))) {
793 /* 889 /*
794 * This is to_integer operation case. 890 * This is to_integer operation case.
795 * No any restrictions for string-to-integer conversion, 891 * No any restrictions for string-to-integer conversion,
@@ -800,7 +896,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer)
800 896
801 /* Divide the digit into the correct position */ 897 /* Divide the digit into the correct position */
802 898
803 (void)acpi_ut_short_divide((dividend - (u64) this_digit), 899 (void)acpi_ut_short_divide((dividend - (u64)this_digit),
804 base, &quotient, NULL); 900 base, &quotient, NULL);
805 901
806 if (return_value > quotient) { 902 if (return_value > quotient) {
@@ -890,7 +986,7 @@ acpi_ut_create_update_state_and_push(union acpi_operand_object *object,
890 ******************************************************************************/ 986 ******************************************************************************/
891 987
892acpi_status 988acpi_status
893acpi_ut_walk_package_tree(union acpi_operand_object * source_object, 989acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
894 void *target_object, 990 void *target_object,
895 acpi_pkg_callback walk_callback, void *context) 991 acpi_pkg_callback walk_callback, void *context)
896{ 992{
@@ -917,10 +1013,10 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
917 1013
918 /* 1014 /*
919 * Check for: 1015 * Check for:
920 * 1) An uninitialized package element. It is completely 1016 * 1) An uninitialized package element. It is completely
921 * legal to declare a package and leave it uninitialized 1017 * legal to declare a package and leave it uninitialized
922 * 2) Not an internal object - can be a namespace node instead 1018 * 2) Not an internal object - can be a namespace node instead
923 * 3) Any type other than a package. Packages are handled in else 1019 * 3) Any type other than a package. Packages are handled in else
924 * case below. 1020 * case below.
925 */ 1021 */
926 if ((!this_source_obj) || 1022 if ((!this_source_obj) ||
@@ -939,7 +1035,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
939 state->pkg.source_object->package.count) { 1035 state->pkg.source_object->package.count) {
940 /* 1036 /*
941 * We've handled all of the objects at this level, This means 1037 * We've handled all of the objects at this level, This means
942 * that we have just completed a package. That package may 1038 * that we have just completed a package. That package may
943 * have contained one or more packages itself. 1039 * have contained one or more packages itself.
944 * 1040 *
945 * Delete this state and pop the previous state (package). 1041 * Delete this state and pop the previous state (package).
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c
index 296baa676bc5..5ccf57c0d87e 100644
--- a/drivers/acpi/acpica/utmutex.c
+++ b/drivers/acpi/acpica/utmutex.c
@@ -193,6 +193,8 @@ static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
193 193
194 acpi_gbl_mutex_info[mutex_id].mutex = NULL; 194 acpi_gbl_mutex_info[mutex_id].mutex = NULL;
195 acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; 195 acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
196
197 return_VOID;
196} 198}
197 199
198/******************************************************************************* 200/*******************************************************************************
@@ -226,9 +228,9 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
226 /* 228 /*
227 * Mutex debug code, for internal debugging only. 229 * Mutex debug code, for internal debugging only.
228 * 230 *
229 * Deadlock prevention. Check if this thread owns any mutexes of value 231 * Deadlock prevention. Check if this thread owns any mutexes of value
230 * greater than or equal to this one. If so, the thread has violated 232 * greater than or equal to this one. If so, the thread has violated
231 * the mutex ordering rule. This indicates a coding error somewhere in 233 * the mutex ordering rule. This indicates a coding error somewhere in
232 * the ACPI subsystem code. 234 * the ACPI subsystem code.
233 */ 235 */
234 for (i = mutex_id; i < ACPI_NUM_MUTEX; i++) { 236 for (i = mutex_id; i < ACPI_NUM_MUTEX; i++) {
@@ -319,9 +321,9 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
319 /* 321 /*
320 * Mutex debug code, for internal debugging only. 322 * Mutex debug code, for internal debugging only.
321 * 323 *
322 * Deadlock prevention. Check if this thread owns any mutexes of value 324 * Deadlock prevention. Check if this thread owns any mutexes of value
323 * greater than this one. If so, the thread has violated the mutex 325 * greater than this one. If so, the thread has violated the mutex
324 * ordering rule. This indicates a coding error somewhere in 326 * ordering rule. This indicates a coding error somewhere in
325 * the ACPI subsystem code. 327 * the ACPI subsystem code.
326 */ 328 */
327 for (i = mutex_id; i < ACPI_NUM_MUTEX; i++) { 329 for (i = mutex_id; i < ACPI_NUM_MUTEX; i++) {
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
index 655f0799a391..5c52ca78f6fa 100644
--- a/drivers/acpi/acpica/utobject.c
+++ b/drivers/acpi/acpica/utobject.c
@@ -77,7 +77,7 @@ acpi_ut_get_element_length(u8 object_type,
77 * 77 *
78 * NOTE: We always allocate the worst-case object descriptor because 78 * NOTE: We always allocate the worst-case object descriptor because
79 * these objects are cached, and we want them to be 79 * these objects are cached, and we want them to be
80 * one-size-satisifies-any-request. This in itself may not be 80 * one-size-satisifies-any-request. This in itself may not be
81 * the most memory efficient, but the efficiency of the object 81 * the most memory efficient, but the efficiency of the object
82 * cache should more than make up for this! 82 * cache should more than make up for this!
83 * 83 *
@@ -370,9 +370,9 @@ u8 acpi_ut_valid_internal_object(void *object)
370 * line_number - Caller's line number (for error output) 370 * line_number - Caller's line number (for error output)
371 * component_id - Caller's component ID (for error output) 371 * component_id - Caller's component ID (for error output)
372 * 372 *
373 * RETURN: Pointer to newly allocated object descriptor. Null on error 373 * RETURN: Pointer to newly allocated object descriptor. Null on error
374 * 374 *
375 * DESCRIPTION: Allocate a new object descriptor. Gracefully handle 375 * DESCRIPTION: Allocate a new object descriptor. Gracefully handle
376 * error conditions. 376 * error conditions.
377 * 377 *
378 ******************************************************************************/ 378 ******************************************************************************/
@@ -554,7 +554,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
554 554
555 /* 555 /*
556 * Account for the space required by the object rounded up to the next 556 * Account for the space required by the object rounded up to the next
557 * multiple of the machine word size. This keeps each object aligned 557 * multiple of the machine word size. This keeps each object aligned
558 * on a machine word boundary. (preventing alignment faults on some 558 * on a machine word boundary. (preventing alignment faults on some
559 * machines.) 559 * machines.)
560 */ 560 */
diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c
index a1c988260073..cee0473ba813 100644
--- a/drivers/acpi/acpica/utstate.c
+++ b/drivers/acpi/acpica/utstate.c
@@ -147,7 +147,7 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
147 * 147 *
148 * RETURN: The new state object. NULL on failure. 148 * RETURN: The new state object. NULL on failure.
149 * 149 *
150 * DESCRIPTION: Create a generic state object. Attempt to obtain one from 150 * DESCRIPTION: Create a generic state object. Attempt to obtain one from
151 * the global state cache; If none available, create a new one. 151 * the global state cache; If none available, create a new one.
152 * 152 *
153 ******************************************************************************/ 153 ******************************************************************************/
diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c
new file mode 100644
index 000000000000..a424a9e3fea4
--- /dev/null
+++ b/drivers/acpi/acpica/uttrack.c
@@ -0,0 +1,692 @@
1/******************************************************************************
2 *
3 * Module Name: uttrack - Memory allocation tracking routines (debug only)
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44/*
45 * These procedures are used for tracking memory leaks in the subsystem, and
46 * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set.
47 *
48 * Each memory allocation is tracked via a doubly linked list. Each
49 * element contains the caller's component, module name, function name, and
50 * line number. acpi_ut_allocate and acpi_ut_allocate_zeroed call
51 * acpi_ut_track_allocation to add an element to the list; deletion
52 * occurs in the body of acpi_ut_free.
53 */
54
55#include <acpi/acpi.h>
56#include "accommon.h"
57
58#ifdef ACPI_DBG_TRACK_ALLOCATIONS
59
60#define _COMPONENT ACPI_UTILITIES
61ACPI_MODULE_NAME("uttrack")
62
63/* Local prototypes */
64static struct acpi_debug_mem_block *acpi_ut_find_allocation(struct
65 acpi_debug_mem_block
66 *allocation);
67
68static acpi_status
69acpi_ut_track_allocation(struct acpi_debug_mem_block *address,
70 acpi_size size,
71 u8 alloc_type,
72 u32 component, const char *module, u32 line);
73
74static acpi_status
75acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
76 u32 component, const char *module, u32 line);
77
78/*******************************************************************************
79 *
80 * FUNCTION: acpi_ut_create_list
81 *
82 * PARAMETERS: cache_name - Ascii name for the cache
83 * object_size - Size of each cached object
84 * return_cache - Where the new cache object is returned
85 *
86 * RETURN: Status
87 *
88 * DESCRIPTION: Create a local memory list for tracking purposed
89 *
90 ******************************************************************************/
91
92acpi_status
93acpi_ut_create_list(char *list_name,
94 u16 object_size, struct acpi_memory_list **return_cache)
95{
96 struct acpi_memory_list *cache;
97
98 cache = acpi_os_allocate(sizeof(struct acpi_memory_list));
99 if (!cache) {
100 return (AE_NO_MEMORY);
101 }
102
103 ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list));
104
105 cache->list_name = list_name;
106 cache->object_size = object_size;
107
108 *return_cache = cache;
109 return (AE_OK);
110}
111
112/*******************************************************************************
113 *
114 * FUNCTION: acpi_ut_allocate_and_track
115 *
116 * PARAMETERS: size - Size of the allocation
117 * component - Component type of caller
118 * module - Source file name of caller
119 * line - Line number of caller
120 *
121 * RETURN: Address of the allocated memory on success, NULL on failure.
122 *
123 * DESCRIPTION: The subsystem's equivalent of malloc.
124 *
125 ******************************************************************************/
126
127void *acpi_ut_allocate_and_track(acpi_size size,
128 u32 component, const char *module, u32 line)
129{
130 struct acpi_debug_mem_block *allocation;
131 acpi_status status;
132
133 allocation =
134 acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header),
135 component, module, line);
136 if (!allocation) {
137 return (NULL);
138 }
139
140 status = acpi_ut_track_allocation(allocation, size,
141 ACPI_MEM_MALLOC, component, module,
142 line);
143 if (ACPI_FAILURE(status)) {
144 acpi_os_free(allocation);
145 return (NULL);
146 }
147
148 acpi_gbl_global_list->total_allocated++;
149 acpi_gbl_global_list->total_size += (u32)size;
150 acpi_gbl_global_list->current_total_size += (u32)size;
151 if (acpi_gbl_global_list->current_total_size >
152 acpi_gbl_global_list->max_occupied) {
153 acpi_gbl_global_list->max_occupied =
154 acpi_gbl_global_list->current_total_size;
155 }
156
157 return ((void *)&allocation->user_space);
158}
159
160/*******************************************************************************
161 *
162 * FUNCTION: acpi_ut_allocate_zeroed_and_track
163 *
164 * PARAMETERS: size - Size of the allocation
165 * component - Component type of caller
166 * module - Source file name of caller
167 * line - Line number of caller
168 *
169 * RETURN: Address of the allocated memory on success, NULL on failure.
170 *
171 * DESCRIPTION: Subsystem equivalent of calloc.
172 *
173 ******************************************************************************/
174
175void *acpi_ut_allocate_zeroed_and_track(acpi_size size,
176 u32 component,
177 const char *module, u32 line)
178{
179 struct acpi_debug_mem_block *allocation;
180 acpi_status status;
181
182 allocation =
183 acpi_ut_allocate_zeroed(size + sizeof(struct acpi_debug_mem_header),
184 component, module, line);
185 if (!allocation) {
186
187 /* Report allocation error */
188
189 ACPI_ERROR((module, line,
190 "Could not allocate size %u", (u32)size));
191 return (NULL);
192 }
193
194 status = acpi_ut_track_allocation(allocation, size,
195 ACPI_MEM_CALLOC, component, module,
196 line);
197 if (ACPI_FAILURE(status)) {
198 acpi_os_free(allocation);
199 return (NULL);
200 }
201
202 acpi_gbl_global_list->total_allocated++;
203 acpi_gbl_global_list->total_size += (u32)size;
204 acpi_gbl_global_list->current_total_size += (u32)size;
205 if (acpi_gbl_global_list->current_total_size >
206 acpi_gbl_global_list->max_occupied) {
207 acpi_gbl_global_list->max_occupied =
208 acpi_gbl_global_list->current_total_size;
209 }
210
211 return ((void *)&allocation->user_space);
212}
213
214/*******************************************************************************
215 *
216 * FUNCTION: acpi_ut_free_and_track
217 *
218 * PARAMETERS: allocation - Address of the memory to deallocate
219 * component - Component type of caller
220 * module - Source file name of caller
221 * line - Line number of caller
222 *
223 * RETURN: None
224 *
225 * DESCRIPTION: Frees the memory at Allocation
226 *
227 ******************************************************************************/
228
229void
230acpi_ut_free_and_track(void *allocation,
231 u32 component, const char *module, u32 line)
232{
233 struct acpi_debug_mem_block *debug_block;
234 acpi_status status;
235
236 ACPI_FUNCTION_TRACE_PTR(ut_free, allocation);
237
238 if (NULL == allocation) {
239 ACPI_ERROR((module, line, "Attempt to delete a NULL address"));
240
241 return_VOID;
242 }
243
244 debug_block = ACPI_CAST_PTR(struct acpi_debug_mem_block,
245 (((char *)allocation) -
246 sizeof(struct acpi_debug_mem_header)));
247
248 acpi_gbl_global_list->total_freed++;
249 acpi_gbl_global_list->current_total_size -= debug_block->size;
250
251 status = acpi_ut_remove_allocation(debug_block,
252 component, module, line);
253 if (ACPI_FAILURE(status)) {
254 ACPI_EXCEPTION((AE_INFO, status, "Could not free memory"));
255 }
256
257 acpi_os_free(debug_block);
258 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation));
259 return_VOID;
260}
261
262/*******************************************************************************
263 *
264 * FUNCTION: acpi_ut_find_allocation
265 *
266 * PARAMETERS: allocation - Address of allocated memory
267 *
268 * RETURN: Three cases:
269 * 1) List is empty, NULL is returned.
270 * 2) Element was found. Returns Allocation parameter.
271 * 3) Element was not found. Returns position where it should be
272 * inserted into the list.
273 *
274 * DESCRIPTION: Searches for an element in the global allocation tracking list.
275 * If the element is not found, returns the location within the
276 * list where the element should be inserted.
277 *
278 * Note: The list is ordered by larger-to-smaller addresses.
279 *
280 * This global list is used to detect memory leaks in ACPICA as
281 * well as other issues such as an attempt to release the same
282 * internal object more than once. Although expensive as far
283 * as cpu time, this list is much more helpful for finding these
284 * types of issues than using memory leak detectors outside of
285 * the ACPICA code.
286 *
287 ******************************************************************************/
288
289static struct acpi_debug_mem_block *acpi_ut_find_allocation(struct
290 acpi_debug_mem_block
291 *allocation)
292{
293 struct acpi_debug_mem_block *element;
294
295 element = acpi_gbl_global_list->list_head;
296 if (!element) {
297 return (NULL);
298 }
299
300 /*
301 * Search for the address.
302 *
303 * Note: List is ordered by larger-to-smaller addresses, on the
304 * assumption that a new allocation usually has a larger address
305 * than previous allocations.
306 */
307 while (element > allocation) {
308
309 /* Check for end-of-list */
310
311 if (!element->next) {
312 return (element);
313 }
314
315 element = element->next;
316 }
317
318 if (element == allocation) {
319 return (element);
320 }
321
322 return (element->previous);
323}
324
325/*******************************************************************************
326 *
327 * FUNCTION: acpi_ut_track_allocation
328 *
329 * PARAMETERS: allocation - Address of allocated memory
330 * size - Size of the allocation
331 * alloc_type - MEM_MALLOC or MEM_CALLOC
332 * component - Component type of caller
333 * module - Source file name of caller
334 * line - Line number of caller
335 *
336 * RETURN: Status
337 *
338 * DESCRIPTION: Inserts an element into the global allocation tracking list.
339 *
340 ******************************************************************************/
341
342static acpi_status
343acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
344 acpi_size size,
345 u8 alloc_type,
346 u32 component, const char *module, u32 line)
347{
348 struct acpi_memory_list *mem_list;
349 struct acpi_debug_mem_block *element;
350 acpi_status status = AE_OK;
351
352 ACPI_FUNCTION_TRACE_PTR(ut_track_allocation, allocation);
353
354 if (acpi_gbl_disable_mem_tracking) {
355 return_ACPI_STATUS(AE_OK);
356 }
357
358 mem_list = acpi_gbl_global_list;
359 status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY);
360 if (ACPI_FAILURE(status)) {
361 return_ACPI_STATUS(status);
362 }
363
364 /*
365 * Search the global list for this address to make sure it is not
366 * already present. This will catch several kinds of problems.
367 */
368 element = acpi_ut_find_allocation(allocation);
369 if (element == allocation) {
370 ACPI_ERROR((AE_INFO,
371 "UtTrackAllocation: Allocation (%p) already present in global list!",
372 allocation));
373 goto unlock_and_exit;
374 }
375
376 /* Fill in the instance data */
377
378 allocation->size = (u32)size;
379 allocation->alloc_type = alloc_type;
380 allocation->component = component;
381 allocation->line = line;
382
383 ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME);
384 allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0;
385
386 if (!element) {
387
388 /* Insert at list head */
389
390 if (mem_list->list_head) {
391 ((struct acpi_debug_mem_block *)(mem_list->list_head))->
392 previous = allocation;
393 }
394
395 allocation->next = mem_list->list_head;
396 allocation->previous = NULL;
397
398 mem_list->list_head = allocation;
399 } else {
400 /* Insert after element */
401
402 allocation->next = element->next;
403 allocation->previous = element;
404
405 if (element->next) {
406 (element->next)->previous = allocation;
407 }
408
409 element->next = allocation;
410 }
411
412 unlock_and_exit:
413 status = acpi_ut_release_mutex(ACPI_MTX_MEMORY);
414 return_ACPI_STATUS(status);
415}
416
417/*******************************************************************************
418 *
419 * FUNCTION: acpi_ut_remove_allocation
420 *
421 * PARAMETERS: allocation - Address of allocated memory
422 * component - Component type of caller
423 * module - Source file name of caller
424 * line - Line number of caller
425 *
426 * RETURN: Status
427 *
428 * DESCRIPTION: Deletes an element from the global allocation tracking list.
429 *
430 ******************************************************************************/
431
432static acpi_status
433acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
434 u32 component, const char *module, u32 line)
435{
436 struct acpi_memory_list *mem_list;
437 acpi_status status;
438
439 ACPI_FUNCTION_TRACE(ut_remove_allocation);
440
441 if (acpi_gbl_disable_mem_tracking) {
442 return_ACPI_STATUS(AE_OK);
443 }
444
445 mem_list = acpi_gbl_global_list;
446 if (NULL == mem_list->list_head) {
447
448 /* No allocations! */
449
450 ACPI_ERROR((module, line,
451 "Empty allocation list, nothing to free!"));
452
453 return_ACPI_STATUS(AE_OK);
454 }
455
456 status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY);
457 if (ACPI_FAILURE(status)) {
458 return_ACPI_STATUS(status);
459 }
460
461 /* Unlink */
462
463 if (allocation->previous) {
464 (allocation->previous)->next = allocation->next;
465 } else {
466 mem_list->list_head = allocation->next;
467 }
468
469 if (allocation->next) {
470 (allocation->next)->previous = allocation->previous;
471 }
472
473 /* Mark the segment as deleted */
474
475 ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size);
476
477 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n",
478 allocation->size));
479
480 status = acpi_ut_release_mutex(ACPI_MTX_MEMORY);
481 return_ACPI_STATUS(status);
482}
483
484/*******************************************************************************
485 *
486 * FUNCTION: acpi_ut_dump_allocation_info
487 *
488 * PARAMETERS: None
489 *
490 * RETURN: None
491 *
492 * DESCRIPTION: Print some info about the outstanding allocations.
493 *
494 ******************************************************************************/
495
496void acpi_ut_dump_allocation_info(void)
497{
498/*
499 struct acpi_memory_list *mem_list;
500*/
501
502 ACPI_FUNCTION_TRACE(ut_dump_allocation_info);
503
504/*
505 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
506 ("%30s: %4d (%3d Kb)\n", "Current allocations",
507 mem_list->current_count,
508 ROUND_UP_TO_1K (mem_list->current_size)));
509
510 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
511 ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations",
512 mem_list->max_concurrent_count,
513 ROUND_UP_TO_1K (mem_list->max_concurrent_size)));
514
515 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
516 ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects",
517 running_object_count,
518 ROUND_UP_TO_1K (running_object_size)));
519
520 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
521 ("%30s: %4d (%3d Kb)\n", "Total (all) allocations",
522 running_alloc_count,
523 ROUND_UP_TO_1K (running_alloc_size)));
524
525 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
526 ("%30s: %4d (%3d Kb)\n", "Current Nodes",
527 acpi_gbl_current_node_count,
528 ROUND_UP_TO_1K (acpi_gbl_current_node_size)));
529
530 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
531 ("%30s: %4d (%3d Kb)\n", "Max Nodes",
532 acpi_gbl_max_concurrent_node_count,
533 ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count *
534 sizeof (struct acpi_namespace_node)))));
535*/
536 return_VOID;
537}
538
539/*******************************************************************************
540 *
541 * FUNCTION: acpi_ut_dump_allocations
542 *
543 * PARAMETERS: component - Component(s) to dump info for.
544 * module - Module to dump info for. NULL means all.
545 *
546 * RETURN: None
547 *
548 * DESCRIPTION: Print a list of all outstanding allocations.
549 *
550 ******************************************************************************/
551
552void acpi_ut_dump_allocations(u32 component, const char *module)
553{
554 struct acpi_debug_mem_block *element;
555 union acpi_descriptor *descriptor;
556 u32 num_outstanding = 0;
557 u8 descriptor_type;
558
559 ACPI_FUNCTION_TRACE(ut_dump_allocations);
560
561 if (acpi_gbl_disable_mem_tracking) {
562 return_VOID;
563 }
564
565 /*
566 * Walk the allocation list.
567 */
568 if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_MEMORY))) {
569 return_VOID;
570 }
571
572 element = acpi_gbl_global_list->list_head;
573 while (element) {
574 if ((element->component & component) &&
575 ((module == NULL)
576 || (0 == ACPI_STRCMP(module, element->module)))) {
577 descriptor =
578 ACPI_CAST_PTR(union acpi_descriptor,
579 &element->user_space);
580
581 if (element->size <
582 sizeof(struct acpi_common_descriptor)) {
583 acpi_os_printf("%p Length 0x%04X %9.9s-%u "
584 "[Not a Descriptor - too small]\n",
585 descriptor, element->size,
586 element->module, element->line);
587 } else {
588 /* Ignore allocated objects that are in a cache */
589
590 if (ACPI_GET_DESCRIPTOR_TYPE(descriptor) !=
591 ACPI_DESC_TYPE_CACHED) {
592 acpi_os_printf
593 ("%p Length 0x%04X %9.9s-%u [%s] ",
594 descriptor, element->size,
595 element->module, element->line,
596 acpi_ut_get_descriptor_name
597 (descriptor));
598
599 /* Validate the descriptor type using Type field and length */
600
601 descriptor_type = 0; /* Not a valid descriptor type */
602
603 switch (ACPI_GET_DESCRIPTOR_TYPE
604 (descriptor)) {
605 case ACPI_DESC_TYPE_OPERAND:
606 if (element->size ==
607 sizeof(union
608 acpi_operand_object))
609 {
610 descriptor_type =
611 ACPI_DESC_TYPE_OPERAND;
612 }
613 break;
614
615 case ACPI_DESC_TYPE_PARSER:
616 if (element->size ==
617 sizeof(union
618 acpi_parse_object)) {
619 descriptor_type =
620 ACPI_DESC_TYPE_PARSER;
621 }
622 break;
623
624 case ACPI_DESC_TYPE_NAMED:
625 if (element->size ==
626 sizeof(struct
627 acpi_namespace_node))
628 {
629 descriptor_type =
630 ACPI_DESC_TYPE_NAMED;
631 }
632 break;
633
634 default:
635 break;
636 }
637
638 /* Display additional info for the major descriptor types */
639
640 switch (descriptor_type) {
641 case ACPI_DESC_TYPE_OPERAND:
642 acpi_os_printf
643 ("%12.12s RefCount 0x%04X\n",
644 acpi_ut_get_type_name
645 (descriptor->object.common.
646 type),
647 descriptor->object.common.
648 reference_count);
649 break;
650
651 case ACPI_DESC_TYPE_PARSER:
652 acpi_os_printf
653 ("AmlOpcode 0x%04hX\n",
654 descriptor->op.asl.
655 aml_opcode);
656 break;
657
658 case ACPI_DESC_TYPE_NAMED:
659 acpi_os_printf("%4.4s\n",
660 acpi_ut_get_node_name
661 (&descriptor->
662 node));
663 break;
664
665 default:
666 acpi_os_printf("\n");
667 break;
668 }
669 }
670 }
671
672 num_outstanding++;
673 }
674
675 element = element->next;
676 }
677
678 (void)acpi_ut_release_mutex(ACPI_MTX_MEMORY);
679
680 /* Print summary */
681
682 if (!num_outstanding) {
683 ACPI_INFO((AE_INFO, "No outstanding allocations"));
684 } else {
685 ACPI_ERROR((AE_INFO, "%u(0x%X) Outstanding allocations",
686 num_outstanding, num_outstanding));
687 }
688
689 return_VOID;
690}
691
692#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c
index b09632b4f5b3..390db0ca5e2e 100644
--- a/drivers/acpi/acpica/utxface.c
+++ b/drivers/acpi/acpica/utxface.c
@@ -147,7 +147,7 @@ ACPI_EXPORT_SYMBOL(acpi_subsystem_status)
147 * RETURN: status - the status of the call 147 * RETURN: status - the status of the call
148 * 148 *
149 * DESCRIPTION: This function is called to get information about the current 149 * DESCRIPTION: This function is called to get information about the current
150 * state of the ACPI subsystem. It will return system information 150 * state of the ACPI subsystem. It will return system information
151 * in the out_buffer. 151 * in the out_buffer.
152 * 152 *
153 * If the function fails an appropriate status will be returned 153 * If the function fails an appropriate status will be returned
@@ -238,7 +238,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
238 } 238 }
239 239
240 acpi_gbl_init_handler = handler; 240 acpi_gbl_init_handler = handler;
241 return AE_OK; 241 return (AE_OK);
242} 242}
243 243
244ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) 244ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler)
@@ -263,6 +263,7 @@ acpi_status acpi_purge_cached_objects(void)
263 (void)acpi_os_purge_cache(acpi_gbl_operand_cache); 263 (void)acpi_os_purge_cache(acpi_gbl_operand_cache);
264 (void)acpi_os_purge_cache(acpi_gbl_ps_node_cache); 264 (void)acpi_os_purge_cache(acpi_gbl_ps_node_cache);
265 (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache); 265 (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache);
266
266 return_ACPI_STATUS(AE_OK); 267 return_ACPI_STATUS(AE_OK);
267} 268}
268 269
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c
index 6d63cc39b9ae..d4d3826140d8 100644
--- a/drivers/acpi/acpica/utxferror.c
+++ b/drivers/acpi/acpica/utxferror.c
@@ -408,7 +408,7 @@ acpi_ut_namespace_error(const char *module_name,
408 408
409 ACPI_MOVE_32_TO_32(&bad_name, 409 ACPI_MOVE_32_TO_32(&bad_name,
410 ACPI_CAST_PTR(u32, internal_name)); 410 ACPI_CAST_PTR(u32, internal_name));
411 acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); 411 acpi_os_printf("[0x%.8X] (NON-ASCII)", bad_name);
412 } else { 412 } else {
413 /* Convert path to external format */ 413 /* Convert path to external format */
414 414