aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-01-17 21:01:07 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-01-17 21:01:07 -0500
commit2a2bafcb3b60f0b5b1cc7b10f21356a8516f192a (patch)
tree589800f95c6c2f5c106fb01414075ac2d5a767eb
parent90fd94e4aba4ddfb6764c051a6bf9a3f4f26fb50 (diff)
parent3bd93bd76ba6b5588a1b2b9f4f451952c7d8994d (diff)
Merge branch 'acpica'
* acpica: (40 commits) ACPICA: Update version to 20171215 ACPICA: trivial style fix, no functional change ACPICA: Fix a couple memory leaks during package object resolution ACPICA: Recognize the Windows 10 version 1607 and 1703 OSI strings ACPICA: DT compiler: prevent error if optional field at the end of table is not present ACPICA: Rename a global variable, no functional change ACPICA: Create and deploy safe version of strncpy ACPICA: Cleanup the global variables and update comments ACPICA: Debugger: fix slight indentation issue ACPICA: Fix a regression in the acpi_evaluate_object_type() interface ACPICA: Update for a few debug output statements ACPICA: Debug output, no functional change ACPICA: Update information in MAINTAINERS ACPICA: Rename variable to match upstream ACPICA: Update version to 20171110 ACPICA: ACPI 6.2: Additional PPTT flags ACPICA: Update linkage for get mutex name interface ACPICA: Update mutex error messages, no functional change ACPICA: Debugger: add "background" command for method execution ACPICA: Small typo fix, no functional change ...
-rw-r--r--MAINTAINERS2
-rw-r--r--drivers/acpi/acpica/acapps.h3
-rw-r--r--drivers/acpi/acpica/acdebug.h4
-rw-r--r--drivers/acpi/acpica/acglobal.h82
-rw-r--r--drivers/acpi/acpica/aclocal.h15
-rw-r--r--drivers/acpi/acpica/acmacros.h2
-rw-r--r--drivers/acpi/acpica/acnamesp.h3
-rw-r--r--drivers/acpi/acpica/acutils.h23
-rw-r--r--drivers/acpi/acpica/dbexec.c110
-rw-r--r--drivers/acpi/acpica/dbfileio.c4
-rw-r--r--drivers/acpi/acpica/dbinput.c145
-rw-r--r--drivers/acpi/acpica/dscontrol.c18
-rw-r--r--drivers/acpi/acpica/dsfield.c28
-rw-r--r--drivers/acpi/acpica/dsobject.c4
-rw-r--r--drivers/acpi/acpica/dspkginit.c21
-rw-r--r--drivers/acpi/acpica/dsutils.c3
-rw-r--r--drivers/acpi/acpica/dswload.c6
-rw-r--r--drivers/acpi/acpica/dswload2.c13
-rw-r--r--drivers/acpi/acpica/evregion.c10
-rw-r--r--drivers/acpi/acpica/exdump.c11
-rw-r--r--drivers/acpi/acpica/hwtimer.c29
-rw-r--r--drivers/acpi/acpica/hwvalid.c14
-rw-r--r--drivers/acpi/acpica/nsaccess.c13
-rw-r--r--drivers/acpi/acpica/nsconvert.c3
-rw-r--r--drivers/acpi/acpica/nsnames.c149
-rw-r--r--drivers/acpi/acpica/nssearch.c1
-rw-r--r--drivers/acpi/acpica/nsxfeval.c9
-rw-r--r--drivers/acpi/acpica/psargs.c2
-rw-r--r--drivers/acpi/acpica/psobject.c10
-rw-r--r--drivers/acpi/acpica/psutils.c14
-rw-r--r--drivers/acpi/acpica/utdebug.c18
-rw-r--r--drivers/acpi/acpica/utdecode.c11
-rw-r--r--drivers/acpi/acpica/uterror.c73
-rw-r--r--drivers/acpi/acpica/utinit.c1
-rw-r--r--drivers/acpi/acpica/utmath.c4
-rw-r--r--drivers/acpi/acpica/utmutex.c9
-rw-r--r--drivers/acpi/acpica/utnonansi.c11
-rw-r--r--drivers/acpi/acpica/utosi.c2
-rw-r--r--drivers/acpi/acpica/utstrsuppt.c42
-rw-r--r--drivers/acpi/acpica/uttrack.c6
-rw-r--r--drivers/acpi/acpica/utxferror.c8
-rw-r--r--include/acpi/acconfig.h4
-rw-r--r--include/acpi/acexcep.h12
-rw-r--r--include/acpi/acpixf.h6
-rw-r--r--include/acpi/actbl1.h159
-rw-r--r--include/acpi/actbl2.h15
-rw-r--r--include/acpi/actypes.h4
-rw-r--r--tools/power/acpi/tools/acpidump/apmain.c28
48 files changed, 877 insertions, 287 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 18994806e441..4c1cdc399a22 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -321,7 +321,7 @@ F: drivers/acpi/apei/
321 321
322ACPI COMPONENT ARCHITECTURE (ACPICA) 322ACPI COMPONENT ARCHITECTURE (ACPICA)
323M: Robert Moore <robert.moore@intel.com> 323M: Robert Moore <robert.moore@intel.com>
324M: Lv Zheng <lv.zheng@intel.com> 324M: Erik Schmauss <erik.schmauss@intel.com>
325M: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> 325M: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
326L: linux-acpi@vger.kernel.org 326L: linux-acpi@vger.kernel.org
327L: devel@acpica.org 327L: devel@acpica.org
diff --git a/drivers/acpi/acpica/acapps.h b/drivers/acpi/acpica/acapps.h
index 7a1a68b5ac5c..2243c8164b34 100644
--- a/drivers/acpi/acpica/acapps.h
+++ b/drivers/acpi/acpica/acapps.h
@@ -80,6 +80,9 @@
80 prefix, ACPICA_COPYRIGHT, \ 80 prefix, ACPICA_COPYRIGHT, \
81 prefix 81 prefix
82 82
83#define ACPI_COMMON_BUILD_TIME \
84 "Build date/time: %s %s\n", __DATE__, __TIME__
85
83/* Macros for usage messages */ 86/* Macros for usage messages */
84 87
85#define ACPI_USAGE_HEADER(usage) \ 88#define ACPI_USAGE_HEADER(usage) \
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index 71743e5252f5..54b8d9df9423 100644
--- a/drivers/acpi/acpica/acdebug.h
+++ b/drivers/acpi/acpica/acdebug.h
@@ -223,6 +223,10 @@ void
223acpi_db_execute(char *name, char **args, acpi_object_type *types, u32 flags); 223acpi_db_execute(char *name, char **args, acpi_object_type *types, u32 flags);
224 224
225void 225void
226acpi_db_create_execution_thread(char *method_name_arg,
227 char **arguments, acpi_object_type *types);
228
229void
226acpi_db_create_execution_threads(char *num_threads_arg, 230acpi_db_create_execution_threads(char *num_threads_arg,
227 char *num_loops_arg, char *method_name_arg); 231 char *num_loops_arg, char *method_name_arg);
228 232
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 95eed442703f..45ef3f5dc9ad 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -46,7 +46,7 @@
46 46
47/***************************************************************************** 47/*****************************************************************************
48 * 48 *
49 * Globals related to the ACPI tables 49 * Globals related to the incoming ACPI tables
50 * 50 *
51 ****************************************************************************/ 51 ****************************************************************************/
52 52
@@ -87,7 +87,7 @@ ACPI_GLOBAL(u8, acpi_gbl_integer_nybble_width);
87 87
88/***************************************************************************** 88/*****************************************************************************
89 * 89 *
90 * Mutual exclusion within ACPICA subsystem 90 * Mutual exclusion within the ACPICA subsystem
91 * 91 *
92 ****************************************************************************/ 92 ****************************************************************************/
93 93
@@ -167,7 +167,7 @@ ACPI_GLOBAL(u8, acpi_gbl_next_owner_id_offset);
167 167
168ACPI_INIT_GLOBAL(u8, acpi_gbl_namespace_initialized, FALSE); 168ACPI_INIT_GLOBAL(u8, acpi_gbl_namespace_initialized, FALSE);
169 169
170/* Misc */ 170/* Miscellaneous */
171 171
172ACPI_GLOBAL(u32, acpi_gbl_original_mode); 172ACPI_GLOBAL(u32, acpi_gbl_original_mode);
173ACPI_GLOBAL(u32, acpi_gbl_ns_lookup_count); 173ACPI_GLOBAL(u32, acpi_gbl_ns_lookup_count);
@@ -191,10 +191,9 @@ extern const char acpi_gbl_lower_hex_digits[];
191extern const char acpi_gbl_upper_hex_digits[]; 191extern const char acpi_gbl_upper_hex_digits[];
192extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; 192extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
193 193
194#ifdef ACPI_DBG_TRACK_ALLOCATIONS
195
196/* Lists for tracking memory allocations (debug only) */ 194/* Lists for tracking memory allocations (debug only) */
197 195
196#ifdef ACPI_DBG_TRACK_ALLOCATIONS
198ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_global_list); 197ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_global_list);
199ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_ns_node_list); 198ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_ns_node_list);
200ACPI_GLOBAL(u8, acpi_gbl_display_final_mem_stats); 199ACPI_GLOBAL(u8, acpi_gbl_display_final_mem_stats);
@@ -203,7 +202,7 @@ ACPI_GLOBAL(u8, acpi_gbl_disable_mem_tracking);
203 202
204/***************************************************************************** 203/*****************************************************************************
205 * 204 *
206 * Namespace globals 205 * ACPI Namespace
207 * 206 *
208 ****************************************************************************/ 207 ****************************************************************************/
209 208
@@ -234,15 +233,20 @@ ACPI_INIT_GLOBAL(u32, acpi_gbl_nesting_level, 0);
234 233
235/***************************************************************************** 234/*****************************************************************************
236 * 235 *
237 * Interpreter globals 236 * Interpreter/Parser globals
238 * 237 *
239 ****************************************************************************/ 238 ****************************************************************************/
240 239
241ACPI_GLOBAL(struct acpi_thread_state *, acpi_gbl_current_walk_list);
242
243/* Control method single step flag */ 240/* Control method single step flag */
244 241
245ACPI_GLOBAL(u8, acpi_gbl_cm_single_step); 242ACPI_GLOBAL(u8, acpi_gbl_cm_single_step);
243ACPI_GLOBAL(struct acpi_thread_state *, acpi_gbl_current_walk_list);
244ACPI_INIT_GLOBAL(union acpi_parse_object, *acpi_gbl_current_scope, NULL);
245
246/* ASL/ASL+ converter */
247
248ACPI_INIT_GLOBAL(u8, acpi_gbl_capture_comments, FALSE);
249ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_last_list_head, NULL);
246 250
247/***************************************************************************** 251/*****************************************************************************
248 * 252 *
@@ -252,7 +256,6 @@ ACPI_GLOBAL(u8, acpi_gbl_cm_single_step);
252 256
253extern struct acpi_bit_register_info 257extern struct acpi_bit_register_info
254 acpi_gbl_bit_register_info[ACPI_NUM_BITREG]; 258 acpi_gbl_bit_register_info[ACPI_NUM_BITREG];
255
256ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a); 259ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a);
257ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b); 260ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b);
258 261
@@ -263,7 +266,6 @@ ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b);
263 ****************************************************************************/ 266 ****************************************************************************/
264 267
265#if (!ACPI_REDUCED_HARDWARE) 268#if (!ACPI_REDUCED_HARDWARE)
266
267ACPI_GLOBAL(u8, acpi_gbl_all_gpes_initialized); 269ACPI_GLOBAL(u8, acpi_gbl_all_gpes_initialized);
268ACPI_GLOBAL(struct acpi_gpe_xrupt_info *, acpi_gbl_gpe_xrupt_list_head); 270ACPI_GLOBAL(struct acpi_gpe_xrupt_info *, acpi_gbl_gpe_xrupt_list_head);
269ACPI_GLOBAL(struct acpi_gpe_block_info *, 271ACPI_GLOBAL(struct acpi_gpe_block_info *,
@@ -272,10 +274,8 @@ ACPI_GLOBAL(acpi_gbl_event_handler, acpi_gbl_global_event_handler);
272ACPI_GLOBAL(void *, acpi_gbl_global_event_handler_context); 274ACPI_GLOBAL(void *, acpi_gbl_global_event_handler_context);
273ACPI_GLOBAL(struct acpi_fixed_event_handler, 275ACPI_GLOBAL(struct acpi_fixed_event_handler,
274 acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]); 276 acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]);
275
276extern struct acpi_fixed_event_info 277extern struct acpi_fixed_event_info
277 acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; 278 acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
278
279#endif /* !ACPI_REDUCED_HARDWARE */ 279#endif /* !ACPI_REDUCED_HARDWARE */
280 280
281/***************************************************************************** 281/*****************************************************************************
@@ -291,14 +291,14 @@ ACPI_GLOBAL(u32, acpi_gpe_count);
291ACPI_GLOBAL(u32, acpi_sci_count); 291ACPI_GLOBAL(u32, acpi_sci_count);
292ACPI_GLOBAL(u32, acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS]); 292ACPI_GLOBAL(u32, acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS]);
293 293
294/* Support for dynamic control method tracing mechanism */ 294/* Dynamic control method tracing mechanism */
295 295
296ACPI_GLOBAL(u32, acpi_gbl_original_dbg_level); 296ACPI_GLOBAL(u32, acpi_gbl_original_dbg_level);
297ACPI_GLOBAL(u32, acpi_gbl_original_dbg_layer); 297ACPI_GLOBAL(u32, acpi_gbl_original_dbg_layer);
298 298
299/***************************************************************************** 299/*****************************************************************************
300 * 300 *
301 * Debugger and Disassembler globals 301 * Debugger and Disassembler
302 * 302 *
303 ****************************************************************************/ 303 ****************************************************************************/
304 304
@@ -326,7 +326,6 @@ ACPI_GLOBAL(struct acpi_external_file *, acpi_gbl_external_file_list);
326#endif 326#endif
327 327
328#ifdef ACPI_DEBUGGER 328#ifdef ACPI_DEBUGGER
329
330ACPI_INIT_GLOBAL(u8, acpi_gbl_abort_method, FALSE); 329ACPI_INIT_GLOBAL(u8, acpi_gbl_abort_method, FALSE);
331ACPI_INIT_GLOBAL(acpi_thread_id, acpi_gbl_db_thread_id, ACPI_INVALID_THREAD_ID); 330ACPI_INIT_GLOBAL(acpi_thread_id, acpi_gbl_db_thread_id, ACPI_INVALID_THREAD_ID);
332 331
@@ -340,7 +339,6 @@ ACPI_GLOBAL(u32, acpi_gbl_db_console_debug_level);
340ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_db_scope_node); 339ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_db_scope_node);
341ACPI_GLOBAL(u8, acpi_gbl_db_terminate_loop); 340ACPI_GLOBAL(u8, acpi_gbl_db_terminate_loop);
342ACPI_GLOBAL(u8, acpi_gbl_db_threads_terminated); 341ACPI_GLOBAL(u8, acpi_gbl_db_threads_terminated);
343
344ACPI_GLOBAL(char *, acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]); 342ACPI_GLOBAL(char *, acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]);
345ACPI_GLOBAL(acpi_object_type, acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]); 343ACPI_GLOBAL(acpi_object_type, acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]);
346 344
@@ -350,32 +348,33 @@ ACPI_GLOBAL(char, acpi_gbl_db_parsed_buf[ACPI_DB_LINE_BUFFER_SIZE]);
350ACPI_GLOBAL(char, acpi_gbl_db_scope_buf[ACPI_DB_LINE_BUFFER_SIZE]); 348ACPI_GLOBAL(char, acpi_gbl_db_scope_buf[ACPI_DB_LINE_BUFFER_SIZE]);
351ACPI_GLOBAL(char, acpi_gbl_db_debug_filename[ACPI_DB_LINE_BUFFER_SIZE]); 349ACPI_GLOBAL(char, acpi_gbl_db_debug_filename[ACPI_DB_LINE_BUFFER_SIZE]);
352 350
353/* 351/* Statistics globals */
354 * Statistic globals 352
355 */
356ACPI_GLOBAL(u16, acpi_gbl_obj_type_count[ACPI_TOTAL_TYPES]); 353ACPI_GLOBAL(u16, acpi_gbl_obj_type_count[ACPI_TOTAL_TYPES]);
357ACPI_GLOBAL(u16, acpi_gbl_node_type_count[ACPI_TOTAL_TYPES]); 354ACPI_GLOBAL(u16, acpi_gbl_node_type_count[ACPI_TOTAL_TYPES]);
358ACPI_GLOBAL(u16, acpi_gbl_obj_type_count_misc); 355ACPI_GLOBAL(u16, acpi_gbl_obj_type_count_misc);
359ACPI_GLOBAL(u16, acpi_gbl_node_type_count_misc); 356ACPI_GLOBAL(u16, acpi_gbl_node_type_count_misc);
360ACPI_GLOBAL(u32, acpi_gbl_num_nodes); 357ACPI_GLOBAL(u32, acpi_gbl_num_nodes);
361ACPI_GLOBAL(u32, acpi_gbl_num_objects); 358ACPI_GLOBAL(u32, acpi_gbl_num_objects);
362
363#endif /* ACPI_DEBUGGER */ 359#endif /* ACPI_DEBUGGER */
364 360
365#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER) 361#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
366
367ACPI_GLOBAL(const char, *acpi_gbl_pld_panel_list[]); 362ACPI_GLOBAL(const char, *acpi_gbl_pld_panel_list[]);
368ACPI_GLOBAL(const char, *acpi_gbl_pld_vertical_position_list[]); 363ACPI_GLOBAL(const char, *acpi_gbl_pld_vertical_position_list[]);
369ACPI_GLOBAL(const char, *acpi_gbl_pld_horizontal_position_list[]); 364ACPI_GLOBAL(const char, *acpi_gbl_pld_horizontal_position_list[]);
370ACPI_GLOBAL(const char, *acpi_gbl_pld_shape_list[]); 365ACPI_GLOBAL(const char, *acpi_gbl_pld_shape_list[]);
371
372ACPI_INIT_GLOBAL(u8, acpi_gbl_disasm_flag, FALSE); 366ACPI_INIT_GLOBAL(u8, acpi_gbl_disasm_flag, FALSE);
373
374#endif 367#endif
375 368
376/* 369/*****************************************************************************
377 * Meant for the -ca option. 370 *
378 */ 371 * ACPICA application-specific globals
372 *
373 ****************************************************************************/
374
375/* ASL-to-ASL+ conversion utility (implemented within the iASL compiler) */
376
377#ifdef ACPI_ASL_COMPILER
379ACPI_INIT_GLOBAL(char *, acpi_gbl_current_inline_comment, NULL); 378ACPI_INIT_GLOBAL(char *, acpi_gbl_current_inline_comment, NULL);
380ACPI_INIT_GLOBAL(char *, acpi_gbl_current_end_node_comment, NULL); 379ACPI_INIT_GLOBAL(char *, acpi_gbl_current_end_node_comment, NULL);
381ACPI_INIT_GLOBAL(char *, acpi_gbl_current_open_brace_comment, NULL); 380ACPI_INIT_GLOBAL(char *, acpi_gbl_current_open_brace_comment, NULL);
@@ -386,23 +385,18 @@ ACPI_INIT_GLOBAL(char *, acpi_gbl_current_filename, NULL);
386ACPI_INIT_GLOBAL(char *, acpi_gbl_current_parent_filename, NULL); 385ACPI_INIT_GLOBAL(char *, acpi_gbl_current_parent_filename, NULL);
387ACPI_INIT_GLOBAL(char *, acpi_gbl_current_include_filename, NULL); 386ACPI_INIT_GLOBAL(char *, acpi_gbl_current_include_filename, NULL);
388 387
389ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_last_list_head, NULL);
390
391ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_head, 388ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_head,
392 NULL); 389 NULL);
393ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_tail, 390ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_tail,
394 NULL); 391 NULL);
395
396ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_head, 392ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_head,
397 NULL); 393 NULL);
398ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_tail, 394ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_tail,
399 NULL); 395 NULL);
400
401ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_head, 396ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_head,
402 NULL); 397 NULL);
403ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_tail, 398ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_tail,
404 NULL); 399 NULL);
405
406ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_head, 400ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_head,
407 NULL); 401 NULL);
408ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_tail, 402ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_tail,
@@ -410,30 +404,18 @@ ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_tail,
410 404
411ACPI_INIT_GLOBAL(struct acpi_comment_addr_node, 405ACPI_INIT_GLOBAL(struct acpi_comment_addr_node,
412 *acpi_gbl_comment_addr_list_head, NULL); 406 *acpi_gbl_comment_addr_list_head, NULL);
413
414ACPI_INIT_GLOBAL(union acpi_parse_object, *acpi_gbl_current_scope, NULL);
415
416ACPI_INIT_GLOBAL(struct acpi_file_node, *acpi_gbl_file_tree_root, NULL); 407ACPI_INIT_GLOBAL(struct acpi_file_node, *acpi_gbl_file_tree_root, NULL);
417 408
418ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_reg_comment_cache); 409ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_reg_comment_cache);
419ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_comment_addr_cache); 410ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_comment_addr_cache);
420ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_file_cache); 411ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_file_cache);
421 412
422ACPI_INIT_GLOBAL(u8, gbl_capture_comments, FALSE);
423
424ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_asl_conversion, FALSE); 413ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_asl_conversion, FALSE);
425ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_conv_debug_file, NULL); 414ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_conv_debug_file, NULL);
426
427ACPI_GLOBAL(char, acpi_gbl_table_sig[4]); 415ACPI_GLOBAL(char, acpi_gbl_table_sig[4]);
428 416#endif
429/*****************************************************************************
430 *
431 * Application globals
432 *
433 ****************************************************************************/
434 417
435#ifdef ACPI_APPLICATION 418#ifdef ACPI_APPLICATION
436
437ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_debug_file, NULL); 419ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_debug_file, NULL);
438ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_output_file, NULL); 420ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_output_file, NULL);
439ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_timeout, FALSE); 421ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_timeout, FALSE);
@@ -442,16 +424,6 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_timeout, FALSE);
442 424
443ACPI_GLOBAL(acpi_spinlock, acpi_gbl_print_lock); /* For print buffer */ 425ACPI_GLOBAL(acpi_spinlock, acpi_gbl_print_lock); /* For print buffer */
444ACPI_GLOBAL(char, acpi_gbl_print_buffer[1024]); 426ACPI_GLOBAL(char, acpi_gbl_print_buffer[1024]);
445
446#endif /* ACPI_APPLICATION */ 427#endif /* ACPI_APPLICATION */
447 428
448/*****************************************************************************
449 *
450 * Info/help support
451 *
452 ****************************************************************************/
453
454extern const struct ah_predefined_name asl_predefined_info[];
455extern const struct ah_device_id asl_device_ids[];
456
457#endif /* __ACGLOBAL_H__ */ 429#endif /* __ACGLOBAL_H__ */
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 0d45b8bb1678..a56675f0661e 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -622,7 +622,7 @@ struct acpi_control_state {
622 union acpi_parse_object *predicate_op; 622 union acpi_parse_object *predicate_op;
623 u8 *aml_predicate_start; /* Start of if/while predicate */ 623 u8 *aml_predicate_start; /* Start of if/while predicate */
624 u8 *package_end; /* End of if/while block */ 624 u8 *package_end; /* End of if/while block */
625 u32 loop_count; /* While() loop counter */ 625 u64 loop_timeout; /* While() loop timeout */
626}; 626};
627 627
628/* 628/*
@@ -1218,16 +1218,17 @@ struct acpi_db_method_info {
1218 acpi_object_type *types; 1218 acpi_object_type *types;
1219 1219
1220 /* 1220 /*
1221 * Arguments to be passed to method for the command 1221 * Arguments to be passed to method for the commands Threads and
1222 * Threads - 1222 * Background. Note, ACPI specifies a maximum of 7 arguments (0 - 6).
1223 * the Number of threads, ID of current thread and 1223 *
1224 * Index of current thread inside all them created. 1224 * For the Threads command, the Number of threads, ID of current
1225 * thread and Index of current thread inside all them created.
1225 */ 1226 */
1226 char init_args; 1227 char init_args;
1227#ifdef ACPI_DEBUGGER 1228#ifdef ACPI_DEBUGGER
1228 acpi_object_type arg_types[4]; 1229 acpi_object_type arg_types[ACPI_METHOD_NUM_ARGS];
1229#endif 1230#endif
1230 char *arguments[4]; 1231 char *arguments[ACPI_METHOD_NUM_ARGS];
1231 char num_threads_str[11]; 1232 char num_threads_str[11];
1232 char id_of_thread_str[11]; 1233 char id_of_thread_str[11];
1233 char index_of_thread_str[11]; 1234 char index_of_thread_str[11];
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index c7f0c96cc00f..128a3d71b598 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -455,7 +455,7 @@
455 * the plist contains a set of parens to allow variable-length lists. 455 * the plist contains a set of parens to allow variable-length lists.
456 * These macros are used for both the debug and non-debug versions of the code. 456 * These macros are used for both the debug and non-debug versions of the code.
457 */ 457 */
458#define ACPI_ERROR_NAMESPACE(s, e) acpi_ut_namespace_error (AE_INFO, s, e); 458#define ACPI_ERROR_NAMESPACE(s, p, e) acpi_ut_prefixed_namespace_error (AE_INFO, s, p, e);
459#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e); 459#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e);
460#define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist 460#define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist
461#define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist 461#define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index 54a0c51b3e37..2fb1bb78d85c 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -289,6 +289,9 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node,
289char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node, 289char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node,
290 u8 no_trailing); 290 u8 no_trailing);
291 291
292char *acpi_ns_build_prefixed_pathname(union acpi_generic_state *prefix_scope,
293 const char *internal_path);
294
292char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); 295char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
293 296
294acpi_status 297acpi_status
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index 83b75e9db7ef..b6b29d717824 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -118,9 +118,6 @@ extern const char *acpi_gbl_ptyp_decode[];
118#ifndef ACPI_MSG_ERROR 118#ifndef ACPI_MSG_ERROR
119#define ACPI_MSG_ERROR "ACPI Error: " 119#define ACPI_MSG_ERROR "ACPI Error: "
120#endif 120#endif
121#ifndef ACPI_MSG_EXCEPTION
122#define ACPI_MSG_EXCEPTION "ACPI Exception: "
123#endif
124#ifndef ACPI_MSG_WARNING 121#ifndef ACPI_MSG_WARNING
125#define ACPI_MSG_WARNING "ACPI Warning: " 122#define ACPI_MSG_WARNING "ACPI Warning: "
126#endif 123#endif
@@ -129,10 +126,10 @@ extern const char *acpi_gbl_ptyp_decode[];
129#endif 126#endif
130 127
131#ifndef ACPI_MSG_BIOS_ERROR 128#ifndef ACPI_MSG_BIOS_ERROR
132#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): " 129#define ACPI_MSG_BIOS_ERROR "Firmware Error (ACPI): "
133#endif 130#endif
134#ifndef ACPI_MSG_BIOS_WARNING 131#ifndef ACPI_MSG_BIOS_WARNING
135#define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): " 132#define ACPI_MSG_BIOS_WARNING "Firmware Warning (ACPI): "
136#endif 133#endif
137 134
138/* 135/*
@@ -233,10 +230,10 @@ u64 acpi_ut_implicit_strtoul64(char *string);
233 */ 230 */
234acpi_status acpi_ut_init_globals(void); 231acpi_status acpi_ut_init_globals(void);
235 232
236#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
237
238const char *acpi_ut_get_mutex_name(u32 mutex_id); 233const char *acpi_ut_get_mutex_name(u32 mutex_id);
239 234
235#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
236
240const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type); 237const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type);
241#endif 238#endif
242 239
@@ -641,9 +638,11 @@ void ut_convert_backslashes(char *pathname);
641 638
642void acpi_ut_repair_name(char *name); 639void acpi_ut_repair_name(char *name);
643 640
644#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) 641#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) || defined (ACPI_DEBUG_OUTPUT)
645u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source); 642u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source);
646 643
644void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size);
645
647u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source); 646u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source);
648 647
649u8 648u8
@@ -737,9 +736,11 @@ acpi_ut_predefined_bios_error(const char *module_name,
737 u8 node_flags, const char *format, ...); 736 u8 node_flags, const char *format, ...);
738 737
739void 738void
740acpi_ut_namespace_error(const char *module_name, 739acpi_ut_prefixed_namespace_error(const char *module_name,
741 u32 line_number, 740 u32 line_number,
742 const char *internal_name, acpi_status lookup_status); 741 union acpi_generic_state *prefix_scope,
742 const char *internal_name,
743 acpi_status lookup_status);
743 744
744void 745void
745acpi_ut_method_error(const char *module_name, 746acpi_ut_method_error(const char *module_name,
diff --git a/drivers/acpi/acpica/dbexec.c b/drivers/acpi/acpica/dbexec.c
index 3b30319752f0..ed088fceb18d 100644
--- a/drivers/acpi/acpica/dbexec.c
+++ b/drivers/acpi/acpica/dbexec.c
@@ -67,6 +67,8 @@ static acpi_status
67acpi_db_execution_walk(acpi_handle obj_handle, 67acpi_db_execution_walk(acpi_handle obj_handle,
68 u32 nesting_level, void *context, void **return_value); 68 u32 nesting_level, void *context, void **return_value);
69 69
70static void ACPI_SYSTEM_XFACE acpi_db_single_execution_thread(void *context);
71
70/******************************************************************************* 72/*******************************************************************************
71 * 73 *
72 * FUNCTION: acpi_db_delete_objects 74 * FUNCTION: acpi_db_delete_objects
@@ -229,7 +231,7 @@ static acpi_status acpi_db_execute_setup(struct acpi_db_method_info *info)
229 231
230 ACPI_FUNCTION_NAME(db_execute_setup); 232 ACPI_FUNCTION_NAME(db_execute_setup);
231 233
232 /* Catenate the current scope to the supplied name */ 234 /* Concatenate the current scope to the supplied name */
233 235
234 info->pathname[0] = 0; 236 info->pathname[0] = 0;
235 if ((info->name[0] != '\\') && (info->name[0] != '/')) { 237 if ((info->name[0] != '\\') && (info->name[0] != '/')) {
@@ -611,6 +613,112 @@ static void ACPI_SYSTEM_XFACE acpi_db_method_thread(void *context)
611 613
612/******************************************************************************* 614/*******************************************************************************
613 * 615 *
616 * FUNCTION: acpi_db_single_execution_thread
617 *
618 * PARAMETERS: context - Method info struct
619 *
620 * RETURN: None
621 *
622 * DESCRIPTION: Create one thread and execute a method
623 *
624 ******************************************************************************/
625
626static void ACPI_SYSTEM_XFACE acpi_db_single_execution_thread(void *context)
627{
628 struct acpi_db_method_info *info = context;
629 acpi_status status;
630 struct acpi_buffer return_obj;
631
632 acpi_os_printf("\n");
633
634 status = acpi_db_execute_method(info, &return_obj);
635 if (ACPI_FAILURE(status)) {
636 acpi_os_printf("%s During evaluation of %s\n",
637 acpi_format_exception(status), info->pathname);
638 return;
639 }
640
641 /* Display a return object, if any */
642
643 if (return_obj.length) {
644 acpi_os_printf("Evaluation of %s returned object %p, "
645 "external buffer length %X\n",
646 acpi_gbl_db_method_info.pathname,
647 return_obj.pointer, (u32)return_obj.length);
648
649 acpi_db_dump_external_object(return_obj.pointer, 1);
650 }
651
652 acpi_os_printf("\nBackground thread completed\n%c ",
653 ACPI_DEBUGGER_COMMAND_PROMPT);
654}
655
656/*******************************************************************************
657 *
658 * FUNCTION: acpi_db_create_execution_thread
659 *
660 * PARAMETERS: method_name_arg - Control method to execute
661 * arguments - Array of arguments to the method
662 * types - Corresponding array of object types
663 *
664 * RETURN: None
665 *
666 * DESCRIPTION: Create a single thread to evaluate a namespace object. Handles
667 * arguments passed on command line for control methods.
668 *
669 ******************************************************************************/
670
671void
672acpi_db_create_execution_thread(char *method_name_arg,
673 char **arguments, acpi_object_type *types)
674{
675 acpi_status status;
676 u32 i;
677
678 memset(&acpi_gbl_db_method_info, 0, sizeof(struct acpi_db_method_info));
679 acpi_gbl_db_method_info.name = method_name_arg;
680 acpi_gbl_db_method_info.init_args = 1;
681 acpi_gbl_db_method_info.args = acpi_gbl_db_method_info.arguments;
682 acpi_gbl_db_method_info.types = acpi_gbl_db_method_info.arg_types;
683
684 /* Setup method arguments, up to 7 (0-6) */
685
686 for (i = 0; (i < ACPI_METHOD_NUM_ARGS) && *arguments; i++) {
687 acpi_gbl_db_method_info.arguments[i] = *arguments;
688 arguments++;
689
690 acpi_gbl_db_method_info.arg_types[i] = *types;
691 types++;
692 }
693
694 status = acpi_db_execute_setup(&acpi_gbl_db_method_info);
695 if (ACPI_FAILURE(status)) {
696 return;
697 }
698
699 /* Get the NS node, determines existence also */
700
701 status = acpi_get_handle(NULL, acpi_gbl_db_method_info.pathname,
702 &acpi_gbl_db_method_info.method);
703 if (ACPI_FAILURE(status)) {
704 acpi_os_printf("%s Could not get handle for %s\n",
705 acpi_format_exception(status),
706 acpi_gbl_db_method_info.pathname);
707 return;
708 }
709
710 status = acpi_os_execute(OSL_DEBUGGER_EXEC_THREAD,
711 acpi_db_single_execution_thread,
712 &acpi_gbl_db_method_info);
713 if (ACPI_FAILURE(status)) {
714 return;
715 }
716
717 acpi_os_printf("\nBackground thread started\n");
718}
719
720/*******************************************************************************
721 *
614 * FUNCTION: acpi_db_create_execution_threads 722 * FUNCTION: acpi_db_create_execution_threads
615 * 723 *
616 * PARAMETERS: num_threads_arg - Number of threads to create 724 * PARAMETERS: num_threads_arg - Number of threads to create
diff --git a/drivers/acpi/acpica/dbfileio.c b/drivers/acpi/acpica/dbfileio.c
index 4d81ea291d93..cf9607945704 100644
--- a/drivers/acpi/acpica/dbfileio.c
+++ b/drivers/acpi/acpica/dbfileio.c
@@ -99,8 +99,8 @@ void acpi_db_open_debug_file(char *name)
99 } 99 }
100 100
101 acpi_os_printf("Debug output file %s opened\n", name); 101 acpi_os_printf("Debug output file %s opened\n", name);
102 strncpy(acpi_gbl_db_debug_filename, name, 102 acpi_ut_safe_strncpy(acpi_gbl_db_debug_filename, name,
103 sizeof(acpi_gbl_db_debug_filename)); 103 sizeof(acpi_gbl_db_debug_filename));
104 acpi_gbl_db_output_to_file = TRUE; 104 acpi_gbl_db_output_to_file = TRUE;
105} 105}
106#endif 106#endif
diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c
index 2626d79db064..954ca3b981a7 100644
--- a/drivers/acpi/acpica/dbinput.c
+++ b/drivers/acpi/acpica/dbinput.c
@@ -136,6 +136,7 @@ enum acpi_ex_debugger_commands {
136 CMD_UNLOAD, 136 CMD_UNLOAD,
137 137
138 CMD_TERMINATE, 138 CMD_TERMINATE,
139 CMD_BACKGROUND,
139 CMD_THREADS, 140 CMD_THREADS,
140 141
141 CMD_TEST, 142 CMD_TEST,
@@ -212,6 +213,7 @@ static const struct acpi_db_command_info acpi_gbl_db_commands[] = {
212 {"UNLOAD", 1}, 213 {"UNLOAD", 1},
213 214
214 {"TERMINATE", 0}, 215 {"TERMINATE", 0},
216 {"BACKGROUND", 1},
215 {"THREADS", 3}, 217 {"THREADS", 3},
216 218
217 {"TEST", 1}, 219 {"TEST", 1},
@@ -222,9 +224,56 @@ static const struct acpi_db_command_info acpi_gbl_db_commands[] = {
222/* 224/*
223 * Help for all debugger commands. First argument is the number of lines 225 * Help for all debugger commands. First argument is the number of lines
224 * of help to output for the command. 226 * of help to output for the command.
227 *
228 * Note: Some commands are not supported by the kernel-level version of
229 * the debugger.
225 */ 230 */
226static const struct acpi_db_command_help acpi_gbl_db_command_help[] = { 231static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
227 {0, "\nGeneral-Purpose Commands:", "\n"}, 232 {0, "\nNamespace Access:", "\n"},
233 {1, " Businfo", "Display system bus info\n"},
234 {1, " Disassemble <Method>", "Disassemble a control method\n"},
235 {1, " Find <AcpiName> (? is wildcard)",
236 "Find ACPI name(s) with wildcards\n"},
237 {1, " Integrity", "Validate namespace integrity\n"},
238 {1, " Methods", "Display list of loaded control methods\n"},
239 {1, " Namespace [Object] [Depth]",
240 "Display loaded namespace tree/subtree\n"},
241 {1, " Notify <Object> <Value>", "Send a notification on Object\n"},
242 {1, " Objects [ObjectType]",
243 "Display summary of all objects or just given type\n"},
244 {1, " Owner <OwnerId> [Depth]",
245 "Display loaded namespace by object owner\n"},
246 {1, " Paths", "Display full pathnames of namespace objects\n"},
247 {1, " Predefined", "Check all predefined names\n"},
248 {1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"},
249 {1, " References <Addr>", "Find all references to object at addr\n"},
250 {1, " Resources [DeviceName]",
251 "Display Device resources (no arg = all devices)\n"},
252 {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
253 {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
254 {1, " Type <Object>", "Display object type\n"},
255
256 {0, "\nControl Method Execution:", "\n"},
257 {1, " Evaluate <Namepath> [Arguments]",
258 "Evaluate object or control method\n"},
259 {1, " Execute <Namepath> [Arguments]", "Synonym for Evaluate\n"},
260#ifdef ACPI_APPLICATION
261 {1, " Background <Namepath> [Arguments]",
262 "Evaluate object/method in a separate thread\n"},
263 {1, " Thread <Threads><Loops><NamePath>",
264 "Spawn threads to execute method(s)\n"},
265#endif
266 {1, " Debug <Namepath> [Arguments]", "Single-Step a control method\n"},
267 {7, " [Arguments] formats:", "Control method argument formats\n"},
268 {1, " Hex Integer", "Integer\n"},
269 {1, " \"Ascii String\"", "String\n"},
270 {1, " (Hex Byte List)", "Buffer\n"},
271 {1, " (01 42 7A BF)", "Buffer example (4 bytes)\n"},
272 {1, " [Package Element List]", "Package\n"},
273 {1, " [0x01 0x1234 \"string\"]",
274 "Package example (3 elements)\n"},
275
276 {0, "\nMiscellaneous:", "\n"},
228 {1, " Allocations", "Display list of current memory allocations\n"}, 277 {1, " Allocations", "Display list of current memory allocations\n"},
229 {2, " Dump <Address>|<Namepath>", "\n"}, 278 {2, " Dump <Address>|<Namepath>", "\n"},
230 {0, " [Byte|Word|Dword|Qword]", 279 {0, " [Byte|Word|Dword|Qword]",
@@ -248,46 +297,30 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
248 {1, " Stack", "Display CPU stack usage\n"}, 297 {1, " Stack", "Display CPU stack usage\n"},
249 {1, " Tables", "Info about current ACPI table(s)\n"}, 298 {1, " Tables", "Info about current ACPI table(s)\n"},
250 {1, " Tables", "Display info about loaded ACPI tables\n"}, 299 {1, " Tables", "Display info about loaded ACPI tables\n"},
300#ifdef ACPI_APPLICATION
301 {1, " Terminate", "Delete namespace and all internal objects\n"},
302#endif
251 {1, " ! <CommandNumber>", "Execute command from history buffer\n"}, 303 {1, " ! <CommandNumber>", "Execute command from history buffer\n"},
252 {1, " !!", "Execute last command again\n"}, 304 {1, " !!", "Execute last command again\n"},
253 305
254 {0, "\nNamespace Access Commands:", "\n"}, 306 {0, "\nMethod and Namespace Debugging:", "\n"},
255 {1, " Businfo", "Display system bus info\n"}, 307 {5, " Trace <State> [<Namepath>] [Once]",
256 {1, " Disassemble <Method>", "Disassemble a control method\n"}, 308 "Trace control method execution\n"},
257 {1, " Find <AcpiName> (? is wildcard)", 309 {1, " Enable", "Enable all messages\n"},
258 "Find ACPI name(s) with wildcards\n"}, 310 {1, " Disable", "Disable tracing\n"},
259 {1, " Integrity", "Validate namespace integrity\n"}, 311 {1, " Method", "Enable method execution messages\n"},
260 {1, " Methods", "Display list of loaded control methods\n"}, 312 {1, " Opcode", "Enable opcode execution messages\n"},
261 {1, " Namespace [Object] [Depth]", 313 {3, " Test <TestName>", "Invoke a debug test\n"},
262 "Display loaded namespace tree/subtree\n"}, 314 {1, " Objects", "Read/write/compare all namespace data objects\n"},
263 {1, " Notify <Object> <Value>", "Send a notification on Object\n"}, 315 {1, " Predefined",
264 {1, " Objects [ObjectType]", 316 "Validate all ACPI predefined names (_STA, etc.)\n"},
265 "Display summary of all objects or just given type\n"}, 317 {1, " Execute predefined",
266 {1, " Owner <OwnerId> [Depth]", 318 "Execute all predefined (public) methods\n"},
267 "Display loaded namespace by object owner\n"},
268 {1, " Paths", "Display full pathnames of namespace objects\n"},
269 {1, " Predefined", "Check all predefined names\n"},
270 {1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"},
271 {1, " References <Addr>", "Find all references to object at addr\n"},
272 {1, " Resources [DeviceName]",
273 "Display Device resources (no arg = all devices)\n"},
274 {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
275 {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
276 {1, " Type <Object>", "Display object type\n"},
277 319
278 {0, "\nControl Method Execution Commands:", "\n"}, 320 {0, "\nControl Method Single-Step Execution:", "\n"},
279 {1, " Arguments (or Args)", "Display method arguments\n"}, 321 {1, " Arguments (or Args)", "Display method arguments\n"},
280 {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"}, 322 {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"},
281 {1, " Call", "Run to next control method invocation\n"}, 323 {1, " Call", "Run to next control method invocation\n"},
282 {1, " Debug <Namepath> [Arguments]", "Single Step a control method\n"},
283 {6, " Evaluate", "Synonym for Execute\n"},
284 {5, " Execute <Namepath> [Arguments]", "Execute control method\n"},
285 {1, " Hex Integer", "Integer method argument\n"},
286 {1, " \"Ascii String\"", "String method argument\n"},
287 {1, " (Hex Byte List)", "Buffer method argument\n"},
288 {1, " [Package Element List]", "Package method argument\n"},
289 {5, " Execute predefined",
290 "Execute all predefined (public) methods\n"},
291 {1, " Go", "Allow method to run to completion\n"}, 324 {1, " Go", "Allow method to run to completion\n"},
292 {1, " Information", "Display info about the current method\n"}, 325 {1, " Information", "Display info about the current method\n"},
293 {1, " Into", "Step into (not over) a method call\n"}, 326 {1, " Into", "Step into (not over) a method call\n"},
@@ -296,41 +329,24 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
296 {1, " Results", "Display method result stack\n"}, 329 {1, " Results", "Display method result stack\n"},
297 {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"}, 330 {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"},
298 {1, " Stop", "Terminate control method\n"}, 331 {1, " Stop", "Terminate control method\n"},
299 {5, " Trace <State> [<Namepath>] [Once]",
300 "Trace control method execution\n"},
301 {1, " Enable", "Enable all messages\n"},
302 {1, " Disable", "Disable tracing\n"},
303 {1, " Method", "Enable method execution messages\n"},
304 {1, " Opcode", "Enable opcode execution messages\n"},
305 {1, " Tree", "Display control method calling tree\n"}, 332 {1, " Tree", "Display control method calling tree\n"},
306 {1, " <Enter>", "Single step next AML opcode (over calls)\n"}, 333 {1, " <Enter>", "Single step next AML opcode (over calls)\n"},
307 334
308#ifdef ACPI_APPLICATION 335#ifdef ACPI_APPLICATION
309 {0, "\nHardware Simulation Commands:", "\n"}, 336 {0, "\nFile Operations:", "\n"},
310 {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"},
311 {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
312 {1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"},
313 {1, " Gpes", "Display info on all GPE devices\n"},
314 {1, " Sci", "Generate an SCI\n"},
315 {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
316
317 {0, "\nFile I/O Commands:", "\n"},
318 {1, " Close", "Close debug output file\n"}, 337 {1, " Close", "Close debug output file\n"},
319 {1, " Load <Input Filename>", "Load ACPI table from a file\n"}, 338 {1, " Load <Input Filename>", "Load ACPI table from a file\n"},
320 {1, " Open <Output Filename>", "Open a file for debug output\n"}, 339 {1, " Open <Output Filename>", "Open a file for debug output\n"},
321 {1, " Unload <Namepath>", 340 {1, " Unload <Namepath>",
322 "Unload an ACPI table via namespace object\n"}, 341 "Unload an ACPI table via namespace object\n"},
323 342
324 {0, "\nUser Space Commands:", "\n"}, 343 {0, "\nHardware Simulation:", "\n"},
325 {1, " Terminate", "Delete namespace and all internal objects\n"}, 344 {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"},
326 {1, " Thread <Threads><Loops><NamePath>", 345 {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
327 "Spawn threads to execute method(s)\n"}, 346 {1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"},
328 347 {1, " Gpes", "Display info on all GPE devices\n"},
329 {0, "\nDebug Test Commands:", "\n"}, 348 {1, " Sci", "Generate an SCI\n"},
330 {3, " Test <TestName>", "Invoke a debug test\n"}, 349 {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
331 {1, " Objects", "Read/write/compare all namespace data objects\n"},
332 {1, " Predefined",
333 "Execute all ACPI predefined names (_STA, etc.)\n"},
334#endif 350#endif
335 {0, NULL, NULL} 351 {0, NULL, NULL}
336}; 352};
@@ -442,11 +458,15 @@ static void acpi_db_display_help(char *command)
442 458
443 /* No argument to help, display help for all commands */ 459 /* No argument to help, display help for all commands */
444 460
461 acpi_os_printf("\nSummary of AML Debugger Commands\n\n");
462
445 while (next->invocation) { 463 while (next->invocation) {
446 acpi_os_printf("%-38s%s", next->invocation, 464 acpi_os_printf("%-38s%s", next->invocation,
447 next->description); 465 next->description);
448 next++; 466 next++;
449 } 467 }
468 acpi_os_printf("\n");
469
450 } else { 470 } else {
451 /* Display help for all commands that match the subtring */ 471 /* Display help for all commands that match the subtring */
452 472
@@ -1087,6 +1107,13 @@ acpi_db_command_dispatch(char *input_buffer,
1087 /* acpi_initialize (NULL); */ 1107 /* acpi_initialize (NULL); */
1088 break; 1108 break;
1089 1109
1110 case CMD_BACKGROUND:
1111
1112 acpi_db_create_execution_thread(acpi_gbl_db_args[1],
1113 &acpi_gbl_db_args[2],
1114 &acpi_gbl_db_arg_types[2]);
1115 break;
1116
1090 case CMD_THREADS: 1117 case CMD_THREADS:
1091 1118
1092 acpi_db_create_execution_threads(acpi_gbl_db_args[1], 1119 acpi_db_create_execution_threads(acpi_gbl_db_args[1],
diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c
index f470e81b0499..4b6ebc2a2851 100644
--- a/drivers/acpi/acpica/dscontrol.c
+++ b/drivers/acpi/acpica/dscontrol.c
@@ -118,6 +118,8 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
118 control_state->control.package_end = 118 control_state->control.package_end =
119 walk_state->parser_state.pkg_end; 119 walk_state->parser_state.pkg_end;
120 control_state->control.opcode = op->common.aml_opcode; 120 control_state->control.opcode = op->common.aml_opcode;
121 control_state->control.loop_timeout = acpi_os_get_timer() +
122 (u64)(acpi_gbl_max_loop_iterations * ACPI_100NSEC_PER_SEC);
121 123
122 /* Push the control state on this walk's control stack */ 124 /* Push the control state on this walk's control stack */
123 125
@@ -206,15 +208,15 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state,
206 /* Predicate was true, the body of the loop was just executed */ 208 /* Predicate was true, the body of the loop was just executed */
207 209
208 /* 210 /*
209 * This loop counter mechanism allows the interpreter to escape 211 * This infinite loop detection mechanism allows the interpreter
210 * possibly infinite loops. This can occur in poorly written AML 212 * to escape possibly infinite loops. This can occur in poorly
211 * when the hardware does not respond within a while loop and the 213 * written AML when the hardware does not respond within a while
212 * loop does not implement a timeout. 214 * loop and the loop does not implement a timeout.
213 */ 215 */
214 control_state->control.loop_count++; 216 if (ACPI_TIME_AFTER(acpi_os_get_timer(),
215 if (control_state->control.loop_count > 217 control_state->control.
216 acpi_gbl_max_loop_iterations) { 218 loop_timeout)) {
217 status = AE_AML_INFINITE_LOOP; 219 status = AE_AML_LOOP_TIMEOUT;
218 break; 220 break;
219 } 221 }
220 222
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index 7bcf5f5ea029..0cab34a593d5 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -209,7 +209,8 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
209 ACPI_IMODE_LOAD_PASS1, flags, 209 ACPI_IMODE_LOAD_PASS1, flags,
210 walk_state, &node); 210 walk_state, &node);
211 if (ACPI_FAILURE(status)) { 211 if (ACPI_FAILURE(status)) {
212 ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 212 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
213 arg->common.value.string, status);
213 return_ACPI_STATUS(status); 214 return_ACPI_STATUS(status);
214 } 215 }
215 } 216 }
@@ -383,7 +384,9 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
383 walk_state, 384 walk_state,
384 &info->connection_node); 385 &info->connection_node);
385 if (ACPI_FAILURE(status)) { 386 if (ACPI_FAILURE(status)) {
386 ACPI_ERROR_NAMESPACE(child->common. 387 ACPI_ERROR_NAMESPACE(walk_state->
388 scope_info,
389 child->common.
387 value.name, 390 value.name,
388 status); 391 status);
389 return_ACPI_STATUS(status); 392 return_ACPI_STATUS(status);
@@ -402,7 +405,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
402 ACPI_NS_DONT_OPEN_SCOPE, 405 ACPI_NS_DONT_OPEN_SCOPE,
403 walk_state, &info->field_node); 406 walk_state, &info->field_node);
404 if (ACPI_FAILURE(status)) { 407 if (ACPI_FAILURE(status)) {
405 ACPI_ERROR_NAMESPACE((char *)&arg->named.name, 408 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
409 (char *)&arg->named.name,
406 status); 410 status);
407 return_ACPI_STATUS(status); 411 return_ACPI_STATUS(status);
408 } else { 412 } else {
@@ -498,7 +502,8 @@ acpi_ds_create_field(union acpi_parse_object *op,
498 &region_node); 502 &region_node);
499#endif 503#endif
500 if (ACPI_FAILURE(status)) { 504 if (ACPI_FAILURE(status)) {
501 ACPI_ERROR_NAMESPACE(arg->common.value.name, status); 505 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
506 arg->common.value.name, status);
502 return_ACPI_STATUS(status); 507 return_ACPI_STATUS(status);
503 } 508 }
504 } 509 }
@@ -618,7 +623,8 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
618 ACPI_IMODE_LOAD_PASS1, flags, 623 ACPI_IMODE_LOAD_PASS1, flags,
619 walk_state, &node); 624 walk_state, &node);
620 if (ACPI_FAILURE(status)) { 625 if (ACPI_FAILURE(status)) {
621 ACPI_ERROR_NAMESPACE((char *)&arg->named.name, 626 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
627 (char *)&arg->named.name,
622 status); 628 status);
623 if (status != AE_ALREADY_EXISTS) { 629 if (status != AE_ALREADY_EXISTS) {
624 return_ACPI_STATUS(status); 630 return_ACPI_STATUS(status);
@@ -681,7 +687,8 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
681 &region_node); 687 &region_node);
682#endif 688#endif
683 if (ACPI_FAILURE(status)) { 689 if (ACPI_FAILURE(status)) {
684 ACPI_ERROR_NAMESPACE(arg->common.value.name, status); 690 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
691 arg->common.value.name, status);
685 return_ACPI_STATUS(status); 692 return_ACPI_STATUS(status);
686 } 693 }
687 } 694 }
@@ -695,7 +702,8 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
695 ACPI_NS_SEARCH_PARENT, walk_state, 702 ACPI_NS_SEARCH_PARENT, walk_state,
696 &info.register_node); 703 &info.register_node);
697 if (ACPI_FAILURE(status)) { 704 if (ACPI_FAILURE(status)) {
698 ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 705 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
706 arg->common.value.string, status);
699 return_ACPI_STATUS(status); 707 return_ACPI_STATUS(status);
700 } 708 }
701 709
@@ -765,7 +773,8 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
765 ACPI_NS_SEARCH_PARENT, walk_state, 773 ACPI_NS_SEARCH_PARENT, walk_state,
766 &info.register_node); 774 &info.register_node);
767 if (ACPI_FAILURE(status)) { 775 if (ACPI_FAILURE(status)) {
768 ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 776 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
777 arg->common.value.string, status);
769 return_ACPI_STATUS(status); 778 return_ACPI_STATUS(status);
770 } 779 }
771 780
@@ -778,7 +787,8 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
778 ACPI_NS_SEARCH_PARENT, walk_state, 787 ACPI_NS_SEARCH_PARENT, walk_state,
779 &info.data_register_node); 788 &info.data_register_node);
780 if (ACPI_FAILURE(status)) { 789 if (ACPI_FAILURE(status)) {
781 ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 790 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
791 arg->common.value.string, status);
782 return_ACPI_STATUS(status); 792 return_ACPI_STATUS(status);
783 } 793 }
784 794
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c
index 82448551781b..b21fe084ffc8 100644
--- a/drivers/acpi/acpica/dsobject.c
+++ b/drivers/acpi/acpica/dsobject.c
@@ -112,7 +112,9 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
112 acpi_namespace_node, 112 acpi_namespace_node,
113 &(op->common.node))); 113 &(op->common.node)));
114 if (ACPI_FAILURE(status)) { 114 if (ACPI_FAILURE(status)) {
115 ACPI_ERROR_NAMESPACE(op->common.value. 115 ACPI_ERROR_NAMESPACE(walk_state->
116 scope_info,
117 op->common.value.
116 string, status); 118 string, status);
117 return_ACPI_STATUS(status); 119 return_ACPI_STATUS(status);
118 } 120 }
diff --git a/drivers/acpi/acpica/dspkginit.c b/drivers/acpi/acpica/dspkginit.c
index 6d487edfe2de..5a602b75084e 100644
--- a/drivers/acpi/acpica/dspkginit.c
+++ b/drivers/acpi/acpica/dspkginit.c
@@ -297,8 +297,10 @@ acpi_ds_init_package_element(u8 object_type,
297{ 297{
298 union acpi_operand_object **element_ptr; 298 union acpi_operand_object **element_ptr;
299 299
300 ACPI_FUNCTION_TRACE(ds_init_package_element);
301
300 if (!source_object) { 302 if (!source_object) {
301 return (AE_OK); 303 return_ACPI_STATUS(AE_OK);
302 } 304 }
303 305
304 /* 306 /*
@@ -329,7 +331,7 @@ acpi_ds_init_package_element(u8 object_type,
329 source_object->package.flags |= AOPOBJ_DATA_VALID; 331 source_object->package.flags |= AOPOBJ_DATA_VALID;
330 } 332 }
331 333
332 return (AE_OK); 334 return_ACPI_STATUS(AE_OK);
333} 335}
334 336
335/******************************************************************************* 337/*******************************************************************************
@@ -352,6 +354,7 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
352 union acpi_generic_state scope_info; 354 union acpi_generic_state scope_info;
353 union acpi_operand_object *element = *element_ptr; 355 union acpi_operand_object *element = *element_ptr;
354 struct acpi_namespace_node *resolved_node; 356 struct acpi_namespace_node *resolved_node;
357 struct acpi_namespace_node *original_node;
355 char *external_path = NULL; 358 char *external_path = NULL;
356 acpi_object_type type; 359 acpi_object_type type;
357 360
@@ -441,6 +444,7 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
441 * will remain as named references. This behavior is not described 444 * will remain as named references. This behavior is not described
442 * in the ACPI spec, but it appears to be an oversight. 445 * in the ACPI spec, but it appears to be an oversight.
443 */ 446 */
447 original_node = resolved_node;
444 status = acpi_ex_resolve_node_to_value(&resolved_node, NULL); 448 status = acpi_ex_resolve_node_to_value(&resolved_node, NULL);
445 if (ACPI_FAILURE(status)) { 449 if (ACPI_FAILURE(status)) {
446 return_VOID; 450 return_VOID;
@@ -468,26 +472,27 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
468 */ 472 */
469 case ACPI_TYPE_DEVICE: 473 case ACPI_TYPE_DEVICE:
470 case ACPI_TYPE_THERMAL: 474 case ACPI_TYPE_THERMAL:
471 475 case ACPI_TYPE_METHOD:
472 /* TBD: This may not be necesssary */
473
474 acpi_ut_add_reference(resolved_node->object);
475 break; 476 break;
476 477
477 case ACPI_TYPE_MUTEX: 478 case ACPI_TYPE_MUTEX:
478 case ACPI_TYPE_METHOD:
479 case ACPI_TYPE_POWER: 479 case ACPI_TYPE_POWER:
480 case ACPI_TYPE_PROCESSOR: 480 case ACPI_TYPE_PROCESSOR:
481 case ACPI_TYPE_EVENT: 481 case ACPI_TYPE_EVENT:
482 case ACPI_TYPE_REGION: 482 case ACPI_TYPE_REGION:
483 483
484 /* acpi_ex_resolve_node_to_value gave these an extra reference */
485
486 acpi_ut_remove_reference(original_node->object);
484 break; 487 break;
485 488
486 default: 489 default:
487 /* 490 /*
488 * For all other types - the node was resolved to an actual 491 * For all other types - the node was resolved to an actual
489 * operand object with a value, return the object 492 * operand object with a value, return the object. Remove
493 * a reference on the existing object.
490 */ 494 */
495 acpi_ut_remove_reference(element);
491 *element_ptr = (union acpi_operand_object *)resolved_node; 496 *element_ptr = (union acpi_operand_object *)resolved_node;
492 break; 497 break;
493 } 498 }
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c
index 0dabd9b95684..4c5faf629a83 100644
--- a/drivers/acpi/acpica/dsutils.c
+++ b/drivers/acpi/acpica/dsutils.c
@@ -583,7 +583,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
583 } 583 }
584 584
585 if (ACPI_FAILURE(status)) { 585 if (ACPI_FAILURE(status)) {
586 ACPI_ERROR_NAMESPACE(name_string, status); 586 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
587 name_string, status);
587 } 588 }
588 } 589 }
589 590
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c
index eaa859a89702..5771e4e4a99a 100644
--- a/drivers/acpi/acpica/dswload.c
+++ b/drivers/acpi/acpica/dswload.c
@@ -207,7 +207,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
207 } 207 }
208#endif 208#endif
209 if (ACPI_FAILURE(status)) { 209 if (ACPI_FAILURE(status)) {
210 ACPI_ERROR_NAMESPACE(path, status); 210 ACPI_ERROR_NAMESPACE(walk_state->scope_info, path,
211 status);
211 return_ACPI_STATUS(status); 212 return_ACPI_STATUS(status);
212 } 213 }
213 214
@@ -375,7 +376,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
375 } 376 }
376 377
377 if (ACPI_FAILURE(status)) { 378 if (ACPI_FAILURE(status)) {
378 ACPI_ERROR_NAMESPACE(path, status); 379 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
380 path, status);
379 return_ACPI_STATUS(status); 381 return_ACPI_STATUS(status);
380 } 382 }
381 } 383 }
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c
index aad83ef5a4ec..b3d0aaec8203 100644
--- a/drivers/acpi/acpica/dswload2.c
+++ b/drivers/acpi/acpica/dswload2.c
@@ -184,11 +184,14 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
184 if (status == AE_NOT_FOUND) { 184 if (status == AE_NOT_FOUND) {
185 status = AE_OK; 185 status = AE_OK;
186 } else { 186 } else {
187 ACPI_ERROR_NAMESPACE(buffer_ptr, 187 ACPI_ERROR_NAMESPACE(walk_state->
188 scope_info,
189 buffer_ptr,
188 status); 190 status);
189 } 191 }
190#else 192#else
191 ACPI_ERROR_NAMESPACE(buffer_ptr, status); 193 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
194 buffer_ptr, status);
192#endif 195#endif
193 return_ACPI_STATUS(status); 196 return_ACPI_STATUS(status);
194 } 197 }
@@ -343,7 +346,8 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
343 } 346 }
344 347
345 if (ACPI_FAILURE(status)) { 348 if (ACPI_FAILURE(status)) {
346 ACPI_ERROR_NAMESPACE(buffer_ptr, status); 349 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
350 buffer_ptr, status);
347 return_ACPI_STATUS(status); 351 return_ACPI_STATUS(status);
348 } 352 }
349 353
@@ -719,7 +723,8 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
719 */ 723 */
720 op->common.node = new_node; 724 op->common.node = new_node;
721 } else { 725 } else {
722 ACPI_ERROR_NAMESPACE(arg->common.value.string, status); 726 ACPI_ERROR_NAMESPACE(walk_state->scope_info,
727 arg->common.value.string, status);
723 } 728 }
724 break; 729 break;
725 730
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 28b447ff92df..bb58419f0d61 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -298,6 +298,16 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
298 ACPI_EXCEPTION((AE_INFO, status, "Returned by Handler for [%s]", 298 ACPI_EXCEPTION((AE_INFO, status, "Returned by Handler for [%s]",
299 acpi_ut_get_region_name(region_obj->region. 299 acpi_ut_get_region_name(region_obj->region.
300 space_id))); 300 space_id)));
301
302 /*
303 * Special case for an EC timeout. These are seen so frequently
304 * that an additional error message is helpful
305 */
306 if ((region_obj->region.space_id == ACPI_ADR_SPACE_EC) &&
307 (status == AE_TIME)) {
308 ACPI_ERROR((AE_INFO,
309 "Timeout from EC hardware or EC device driver"));
310 }
301 } 311 }
302 312
303 if (!(handler_desc->address_space.handler_flags & 313 if (!(handler_desc->address_space.handler_flags &
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index 83398dc4b7c2..b2ff61bdb9a8 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -617,10 +617,11 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
617 u32 length; 617 u32 length;
618 u32 index; 618 u32 index;
619 619
620 ACPI_FUNCTION_NAME(ex_dump_operand) 620 ACPI_FUNCTION_NAME(ex_dump_operand);
621 621
622 /* Check if debug output enabled */ 622 /* Check if debug output enabled */
623 if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_EXEC, _COMPONENT)) { 623
624 if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_EXEC, _COMPONENT)) {
624 return; 625 return;
625 } 626 }
626 627
@@ -904,7 +905,7 @@ void
904acpi_ex_dump_operands(union acpi_operand_object **operands, 905acpi_ex_dump_operands(union acpi_operand_object **operands,
905 const char *opcode_name, u32 num_operands) 906 const char *opcode_name, u32 num_operands)
906{ 907{
907 ACPI_FUNCTION_NAME(ex_dump_operands); 908 ACPI_FUNCTION_TRACE(ex_dump_operands);
908 909
909 if (!opcode_name) { 910 if (!opcode_name) {
910 opcode_name = "UNKNOWN"; 911 opcode_name = "UNKNOWN";
@@ -928,7 +929,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands,
928 929
929 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 930 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
930 "**** End operand dump for [%s]\n", opcode_name)); 931 "**** End operand dump for [%s]\n", opcode_name));
931 return; 932 return_VOID;
932} 933}
933 934
934/******************************************************************************* 935/*******************************************************************************
diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c
index a2f4e25d45b1..5b4282902a83 100644
--- a/drivers/acpi/acpica/hwtimer.c
+++ b/drivers/acpi/acpica/hwtimer.c
@@ -150,10 +150,10 @@ ACPI_EXPORT_SYMBOL(acpi_get_timer)
150 * 150 *
151 ******************************************************************************/ 151 ******************************************************************************/
152acpi_status 152acpi_status
153acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) 153acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 *time_elapsed)
154{ 154{
155 acpi_status status; 155 acpi_status status;
156 u32 delta_ticks; 156 u64 delta_ticks;
157 u64 quotient; 157 u64 quotient;
158 158
159 ACPI_FUNCTION_TRACE(acpi_get_timer_duration); 159 ACPI_FUNCTION_TRACE(acpi_get_timer_duration);
@@ -168,30 +168,29 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
168 return_ACPI_STATUS(AE_SUPPORT); 168 return_ACPI_STATUS(AE_SUPPORT);
169 } 169 }
170 170
171 if (start_ticks == end_ticks) {
172 *time_elapsed = 0;
173 return_ACPI_STATUS(AE_OK);
174 }
175
171 /* 176 /*
172 * Compute Tick Delta: 177 * Compute Tick Delta:
173 * Handle (max one) timer rollovers on 24-bit versus 32-bit timers. 178 * Handle (max one) timer rollovers on 24-bit versus 32-bit timers.
174 */ 179 */
175 if (start_ticks < end_ticks) { 180 delta_ticks = end_ticks;
176 delta_ticks = end_ticks - start_ticks; 181 if (start_ticks > end_ticks) {
177 } else if (start_ticks > end_ticks) {
178 if ((acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) == 0) { 182 if ((acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) == 0) {
179 183
180 /* 24-bit Timer */ 184 /* 24-bit Timer */
181 185
182 delta_ticks = 186 delta_ticks |= (u64)1 << 24;
183 (((0x00FFFFFF - start_ticks) +
184 end_ticks) & 0x00FFFFFF);
185 } else { 187 } else {
186 /* 32-bit Timer */ 188 /* 32-bit Timer */
187 189
188 delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks; 190 delta_ticks |= (u64)1 << 32;
189 } 191 }
190 } else { /* start_ticks == end_ticks */
191
192 *time_elapsed = 0;
193 return_ACPI_STATUS(AE_OK);
194 } 192 }
193 delta_ticks -= start_ticks;
195 194
196 /* 195 /*
197 * Compute Duration (Requires a 64-bit multiply and divide): 196 * Compute Duration (Requires a 64-bit multiply and divide):
@@ -199,10 +198,10 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
199 * time_elapsed (microseconds) = 198 * time_elapsed (microseconds) =
200 * (delta_ticks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY; 199 * (delta_ticks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY;
201 */ 200 */
202 status = acpi_ut_short_divide(((u64)delta_ticks) * ACPI_USEC_PER_SEC, 201 status = acpi_ut_short_divide(delta_ticks * ACPI_USEC_PER_SEC,
203 ACPI_PM_TIMER_FREQUENCY, &quotient, NULL); 202 ACPI_PM_TIMER_FREQUENCY, &quotient, NULL);
204 203
205 *time_elapsed = (u32) quotient; 204 *time_elapsed = (u32)quotient;
206 return_ACPI_STATUS(status); 205 return_ACPI_STATUS(status);
207} 206}
208 207
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c
index 3094cec4eab4..d1679035d5f3 100644
--- a/drivers/acpi/acpica/hwvalid.c
+++ b/drivers/acpi/acpica/hwvalid.c
@@ -128,14 +128,14 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
128 acpi_io_address last_address; 128 acpi_io_address last_address;
129 const struct acpi_port_info *port_info; 129 const struct acpi_port_info *port_info;
130 130
131 ACPI_FUNCTION_NAME(hw_validate_io_request); 131 ACPI_FUNCTION_TRACE(hw_validate_io_request);
132 132
133 /* Supported widths are 8/16/32 */ 133 /* Supported widths are 8/16/32 */
134 134
135 if ((bit_width != 8) && (bit_width != 16) && (bit_width != 32)) { 135 if ((bit_width != 8) && (bit_width != 16) && (bit_width != 32)) {
136 ACPI_ERROR((AE_INFO, 136 ACPI_ERROR((AE_INFO,
137 "Bad BitWidth parameter: %8.8X", bit_width)); 137 "Bad BitWidth parameter: %8.8X", bit_width));
138 return (AE_BAD_PARAMETER); 138 return_ACPI_STATUS(AE_BAD_PARAMETER);
139 } 139 }
140 140
141 port_info = acpi_protected_ports; 141 port_info = acpi_protected_ports;
@@ -153,13 +153,13 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
153 ACPI_ERROR((AE_INFO, 153 ACPI_ERROR((AE_INFO,
154 "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X", 154 "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X",
155 ACPI_FORMAT_UINT64(address), byte_width)); 155 ACPI_FORMAT_UINT64(address), byte_width));
156 return (AE_LIMIT); 156 return_ACPI_STATUS(AE_LIMIT);
157 } 157 }
158 158
159 /* Exit if requested address is not within the protected port table */ 159 /* Exit if requested address is not within the protected port table */
160 160
161 if (address > acpi_protected_ports[ACPI_PORT_INFO_ENTRIES - 1].end) { 161 if (address > acpi_protected_ports[ACPI_PORT_INFO_ENTRIES - 1].end) {
162 return (AE_OK); 162 return_ACPI_STATUS(AE_OK);
163 } 163 }
164 164
165 /* Check request against the list of protected I/O ports */ 165 /* Check request against the list of protected I/O ports */
@@ -180,8 +180,8 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
180 /* Port illegality may depend on the _OSI calls made by the BIOS */ 180 /* Port illegality may depend on the _OSI calls made by the BIOS */
181 181
182 if (acpi_gbl_osi_data >= port_info->osi_dependency) { 182 if (acpi_gbl_osi_data >= port_info->osi_dependency) {
183 ACPI_DEBUG_PRINT((ACPI_DB_IO, 183 ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
184 "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)", 184 "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)\n",
185 ACPI_FORMAT_UINT64(address), 185 ACPI_FORMAT_UINT64(address),
186 byte_width, port_info->name, 186 byte_width, port_info->name,
187 port_info->start, 187 port_info->start,
@@ -198,7 +198,7 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
198 } 198 }
199 } 199 }
200 200
201 return (AE_OK); 201 return_ACPI_STATUS(AE_OK);
202} 202}
203 203
204/****************************************************************************** 204/******************************************************************************
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c
index f2733f51ca8d..33e652a12fca 100644
--- a/drivers/acpi/acpica/nsaccess.c
+++ b/drivers/acpi/acpica/nsaccess.c
@@ -644,17 +644,18 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
644 this_node->object; 644 this_node->object;
645 } 645 }
646 } 646 }
647#ifdef ACPI_ASL_COMPILER
648 if (!acpi_gbl_disasm_flag &&
649 (this_node->flags & ANOBJ_IS_EXTERNAL)) {
650 this_node->flags |= IMPLICIT_EXTERNAL;
651 }
652#endif
653 } 647 }
654 648
655 /* Special handling for the last segment (num_segments == 0) */ 649 /* Special handling for the last segment (num_segments == 0) */
656 650
657 else { 651 else {
652#ifdef ACPI_ASL_COMPILER
653 if (!acpi_gbl_disasm_flag
654 && (this_node->flags & ANOBJ_IS_EXTERNAL)) {
655 this_node->flags &= ~IMPLICIT_EXTERNAL;
656 }
657#endif
658
658 /* 659 /*
659 * Sanity typecheck of the target object: 660 * Sanity typecheck of the target object:
660 * 661 *
diff --git a/drivers/acpi/acpica/nsconvert.c b/drivers/acpi/acpica/nsconvert.c
index 539d775bbc92..d55dcc82f434 100644
--- a/drivers/acpi/acpica/nsconvert.c
+++ b/drivers/acpi/acpica/nsconvert.c
@@ -495,7 +495,8 @@ acpi_ns_convert_to_reference(struct acpi_namespace_node *scope,
495 495
496 /* Check if we are resolving a named reference within a package */ 496 /* Check if we are resolving a named reference within a package */
497 497
498 ACPI_ERROR_NAMESPACE(original_object->string.pointer, status); 498 ACPI_ERROR_NAMESPACE(&scope_info,
499 original_object->string.pointer, status);
499 goto error_exit; 500 goto error_exit;
500 } 501 }
501 502
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c
index a410760a0308..22c92d1a24d8 100644
--- a/drivers/acpi/acpica/nsnames.c
+++ b/drivers/acpi/acpica/nsnames.c
@@ -49,6 +49,9 @@
49#define _COMPONENT ACPI_NAMESPACE 49#define _COMPONENT ACPI_NAMESPACE
50ACPI_MODULE_NAME("nsnames") 50ACPI_MODULE_NAME("nsnames")
51 51
52/* Local Prototypes */
53static void acpi_ns_normalize_pathname(char *original_path);
54
52/******************************************************************************* 55/*******************************************************************************
53 * 56 *
54 * FUNCTION: acpi_ns_get_external_pathname 57 * FUNCTION: acpi_ns_get_external_pathname
@@ -63,6 +66,7 @@ ACPI_MODULE_NAME("nsnames")
63 * for error and debug statements. 66 * for error and debug statements.
64 * 67 *
65 ******************************************************************************/ 68 ******************************************************************************/
69
66char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) 70char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
67{ 71{
68 char *name_buffer; 72 char *name_buffer;
@@ -352,3 +356,148 @@ char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node,
352 356
353 return_PTR(name_buffer); 357 return_PTR(name_buffer);
354} 358}
359
360/*******************************************************************************
361 *
362 * FUNCTION: acpi_ns_build_prefixed_pathname
363 *
364 * PARAMETERS: prefix_scope - Scope/Path that prefixes the internal path
365 * internal_path - Name or path of the namespace node
366 *
367 * RETURN: None
368 *
369 * DESCRIPTION: Construct a fully qualified pathname from a concatenation of:
370 * 1) Path associated with the prefix_scope namespace node
371 * 2) External path representation of the Internal path
372 *
373 ******************************************************************************/
374
375char *acpi_ns_build_prefixed_pathname(union acpi_generic_state *prefix_scope,
376 const char *internal_path)
377{
378 acpi_status status;
379 char *full_path = NULL;
380 char *external_path = NULL;
381 char *prefix_path = NULL;
382 u32 prefix_path_length = 0;
383
384 /* If there is a prefix, get the pathname to it */
385
386 if (prefix_scope && prefix_scope->scope.node) {
387 prefix_path =
388 acpi_ns_get_normalized_pathname(prefix_scope->scope.node,
389 TRUE);
390 if (prefix_path) {
391 prefix_path_length = strlen(prefix_path);
392 }
393 }
394
395 status = acpi_ns_externalize_name(ACPI_UINT32_MAX, internal_path,
396 NULL, &external_path);
397 if (ACPI_FAILURE(status)) {
398 goto cleanup;
399 }
400
401 /* Merge the prefix path and the path. 2 is for one dot and trailing null */
402
403 full_path =
404 ACPI_ALLOCATE_ZEROED(prefix_path_length + strlen(external_path) +
405 2);
406 if (!full_path) {
407 goto cleanup;
408 }
409
410 /* Don't merge if the External path is already fully qualified */
411
412 if (prefix_path && (*external_path != '\\') && (*external_path != '^')) {
413 strcat(full_path, prefix_path);
414 if (prefix_path[1]) {
415 strcat(full_path, ".");
416 }
417 }
418
419 acpi_ns_normalize_pathname(external_path);
420 strcat(full_path, external_path);
421
422cleanup:
423 if (prefix_path) {
424 ACPI_FREE(prefix_path);
425 }
426 if (external_path) {
427 ACPI_FREE(external_path);
428 }
429
430 return (full_path);
431}
432
433/*******************************************************************************
434 *
435 * FUNCTION: acpi_ns_normalize_pathname
436 *
437 * PARAMETERS: original_path - Path to be normalized, in External format
438 *
439 * RETURN: The original path is processed in-place
440 *
441 * DESCRIPTION: Remove trailing underscores from each element of a path.
442 *
443 * For example: \A___.B___.C___ becomes \A.B.C
444 *
445 ******************************************************************************/
446
447static void acpi_ns_normalize_pathname(char *original_path)
448{
449 char *input_path = original_path;
450 char *new_path_buffer;
451 char *new_path;
452 u32 i;
453
454 /* Allocate a temp buffer in which to construct the new path */
455
456 new_path_buffer = ACPI_ALLOCATE_ZEROED(strlen(input_path) + 1);
457 new_path = new_path_buffer;
458 if (!new_path_buffer) {
459 return;
460 }
461
462 /* Special characters may appear at the beginning of the path */
463
464 if (*input_path == '\\') {
465 *new_path = *input_path;
466 new_path++;
467 input_path++;
468 }
469
470 while (*input_path == '^') {
471 *new_path = *input_path;
472 new_path++;
473 input_path++;
474 }
475
476 /* Remainder of the path */
477
478 while (*input_path) {
479
480 /* Do one nameseg at a time */
481
482 for (i = 0; (i < ACPI_NAME_SIZE) && *input_path; i++) {
483 if ((i == 0) || (*input_path != '_')) { /* First char is allowed to be underscore */
484 *new_path = *input_path;
485 new_path++;
486 }
487
488 input_path++;
489 }
490
491 /* Dot means that there are more namesegs to come */
492
493 if (*input_path == '.') {
494 *new_path = *input_path;
495 new_path++;
496 input_path++;
497 }
498 }
499
500 *new_path = 0;
501 strcpy(original_path, new_path_buffer);
502 ACPI_FREE(new_path_buffer);
503}
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c
index 5de8957f5ef0..e91dbee9235f 100644
--- a/drivers/acpi/acpica/nssearch.c
+++ b/drivers/acpi/acpica/nssearch.c
@@ -417,6 +417,7 @@ acpi_ns_search_and_enter(u32 target_name,
417 if (flags & ACPI_NS_EXTERNAL || 417 if (flags & ACPI_NS_EXTERNAL ||
418 (walk_state && walk_state->opcode == AML_SCOPE_OP)) { 418 (walk_state && walk_state->opcode == AML_SCOPE_OP)) {
419 new_node->flags |= ANOBJ_IS_EXTERNAL; 419 new_node->flags |= ANOBJ_IS_EXTERNAL;
420 new_node->flags |= IMPLICIT_EXTERNAL;
420 } 421 }
421#endif 422#endif
422 423
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index 783f4c838aee..9b51f65823b2 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -61,10 +61,10 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info);
61 * 61 *
62 * PARAMETERS: handle - Object handle (optional) 62 * PARAMETERS: handle - Object handle (optional)
63 * pathname - Object pathname (optional) 63 * pathname - Object pathname (optional)
64 * external_params - List of parameters to pass to method, 64 * external_params - List of parameters to pass to a method,
65 * terminated by NULL. May be NULL 65 * terminated by NULL. May be NULL
66 * if no parameters are being passed. 66 * if no parameters are being passed.
67 * return_buffer - Where to put method's return value (if 67 * return_buffer - Where to put the object's return value (if
68 * any). If NULL, no value is returned. 68 * any). If NULL, no value is returned.
69 * return_type - Expected type of return object 69 * return_type - Expected type of return object
70 * 70 *
@@ -100,13 +100,14 @@ acpi_evaluate_object_typed(acpi_handle handle,
100 free_buffer_on_error = TRUE; 100 free_buffer_on_error = TRUE;
101 } 101 }
102 102
103 /* Get a handle here, in order to build an error message if needed */
104
105 target_handle = handle;
103 if (pathname) { 106 if (pathname) {
104 status = acpi_get_handle(handle, pathname, &target_handle); 107 status = acpi_get_handle(handle, pathname, &target_handle);
105 if (ACPI_FAILURE(status)) { 108 if (ACPI_FAILURE(status)) {
106 return_ACPI_STATUS(status); 109 return_ACPI_STATUS(status);
107 } 110 }
108 } else {
109 target_handle = handle;
110 } 111 }
111 112
112 full_pathname = acpi_ns_get_external_pathname(target_handle); 113 full_pathname = acpi_ns_get_external_pathname(target_handle);
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
index eb9dfaca555f..171e2faa7c50 100644
--- a/drivers/acpi/acpica/psargs.c
+++ b/drivers/acpi/acpica/psargs.c
@@ -361,7 +361,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
361 /* Final exception check (may have been changed from code above) */ 361 /* Final exception check (may have been changed from code above) */
362 362
363 if (ACPI_FAILURE(status)) { 363 if (ACPI_FAILURE(status)) {
364 ACPI_ERROR_NAMESPACE(path, status); 364 ACPI_ERROR_NAMESPACE(walk_state->scope_info, path, status);
365 365
366 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == 366 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
367 ACPI_PARSE_EXECUTE) { 367 ACPI_PARSE_EXECUTE) {
diff --git a/drivers/acpi/acpica/psobject.c b/drivers/acpi/acpica/psobject.c
index 0bef6df71bba..c0b179883ff2 100644
--- a/drivers/acpi/acpica/psobject.c
+++ b/drivers/acpi/acpica/psobject.c
@@ -372,16 +372,10 @@ acpi_ps_create_op(struct acpi_walk_state *walk_state,
372 * external declaration opcode. Setting walk_state->Aml to 372 * external declaration opcode. Setting walk_state->Aml to
373 * walk_state->parser_state.Aml + 2 moves increments the 373 * walk_state->parser_state.Aml + 2 moves increments the
374 * walk_state->Aml past the object type and the paramcount of the 374 * walk_state->Aml past the object type and the paramcount of the
375 * external opcode. For the error message, only print the AML 375 * external opcode.
376 * offset. We could attempt to print the name but this may cause
377 * a segmentation fault when printing the namepath because the
378 * AML may be incorrect.
379 */ 376 */
380 acpi_os_printf
381 ("// Invalid external declaration at AML offset 0x%x.\n",
382 walk_state->aml -
383 walk_state->parser_state.aml_start);
384 walk_state->aml = walk_state->parser_state.aml + 2; 377 walk_state->aml = walk_state->parser_state.aml + 2;
378 walk_state->parser_state.aml = walk_state->aml;
385 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); 379 return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
386 } 380 }
387#endif 381#endif
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c
index 02642760cb93..cd59dfe6a47d 100644
--- a/drivers/acpi/acpica/psutils.c
+++ b/drivers/acpi/acpica/psutils.c
@@ -94,9 +94,11 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
94 op->common.descriptor_type = ACPI_DESC_TYPE_PARSER; 94 op->common.descriptor_type = ACPI_DESC_TYPE_PARSER;
95 op->common.aml_opcode = opcode; 95 op->common.aml_opcode = opcode;
96 96
97 ACPI_DISASM_ONLY_MEMBERS(strncpy(op->common.aml_op_name, 97 ACPI_DISASM_ONLY_MEMBERS(acpi_ut_safe_strncpy(op->common.aml_op_name,
98 (acpi_ps_get_opcode_info(opcode))-> 98 (acpi_ps_get_opcode_info
99 name, sizeof(op->common.aml_op_name))); 99 (opcode))->name,
100 sizeof(op->common.
101 aml_op_name)));
100} 102}
101 103
102/******************************************************************************* 104/*******************************************************************************
@@ -158,10 +160,10 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode, u8 *aml)
158 if (opcode == AML_SCOPE_OP) { 160 if (opcode == AML_SCOPE_OP) {
159 acpi_gbl_current_scope = op; 161 acpi_gbl_current_scope = op;
160 } 162 }
161 }
162 163
163 if (gbl_capture_comments) { 164 if (acpi_gbl_capture_comments) {
164 ASL_CV_TRANSFER_COMMENTS(op); 165 ASL_CV_TRANSFER_COMMENTS(op);
166 }
165 } 167 }
166 168
167 return (op); 169 return (op);
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c
index 615a885e2ca3..cff7154b7fee 100644
--- a/drivers/acpi/acpica/utdebug.c
+++ b/drivers/acpi/acpica/utdebug.c
@@ -163,6 +163,9 @@ acpi_debug_print(u32 requested_debug_level,
163{ 163{
164 acpi_thread_id thread_id; 164 acpi_thread_id thread_id;
165 va_list args; 165 va_list args;
166#ifdef ACPI_APPLICATION
167 int fill_count;
168#endif
166 169
167 /* Check if debug output enabled */ 170 /* Check if debug output enabled */
168 171
@@ -202,10 +205,21 @@ acpi_debug_print(u32 requested_debug_level,
202 acpi_os_printf("[%u] ", (u32)thread_id); 205 acpi_os_printf("[%u] ", (u32)thread_id);
203 } 206 }
204 207
205 acpi_os_printf("[%02ld] ", acpi_gbl_nesting_level); 208 fill_count = 48 - acpi_gbl_nesting_level -
206#endif 209 strlen(acpi_ut_trim_function_name(function_name));
210 if (fill_count < 0) {
211 fill_count = 0;
212 }
213
214 acpi_os_printf("[%02ld] %*s",
215 acpi_gbl_nesting_level, acpi_gbl_nesting_level + 1, " ");
216 acpi_os_printf("%s%*s: ",
217 acpi_ut_trim_function_name(function_name), fill_count,
218 " ");
207 219
220#else
208 acpi_os_printf("%-22.22s: ", acpi_ut_trim_function_name(function_name)); 221 acpi_os_printf("%-22.22s: ", acpi_ut_trim_function_name(function_name));
222#endif
209 223
210 va_start(args, format); 224 va_start(args, format);
211 acpi_os_vprintf(format, args); 225 acpi_os_vprintf(format, args);
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c
index 02cd2c2d961a..55debbad487d 100644
--- a/drivers/acpi/acpica/utdecode.c
+++ b/drivers/acpi/acpica/utdecode.c
@@ -395,11 +395,6 @@ const char *acpi_ut_get_reference_name(union acpi_operand_object *object)
395 return (acpi_gbl_ref_class_names[object->reference.class]); 395 return (acpi_gbl_ref_class_names[object->reference.class]);
396} 396}
397 397
398#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
399/*
400 * Strings and procedures used for debug only
401 */
402
403/******************************************************************************* 398/*******************************************************************************
404 * 399 *
405 * FUNCTION: acpi_ut_get_mutex_name 400 * FUNCTION: acpi_ut_get_mutex_name
@@ -433,6 +428,12 @@ const char *acpi_ut_get_mutex_name(u32 mutex_id)
433 return (acpi_gbl_mutex_names[mutex_id]); 428 return (acpi_gbl_mutex_names[mutex_id]);
434} 429}
435 430
431#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
432
433/*
434 * Strings and procedures used for debug only
435 */
436
436/******************************************************************************* 437/*******************************************************************************
437 * 438 *
438 * FUNCTION: acpi_ut_get_notify_name 439 * FUNCTION: acpi_ut_get_notify_name
diff --git a/drivers/acpi/acpica/uterror.c b/drivers/acpi/acpica/uterror.c
index e3368186e1c1..42388dcb5ccc 100644
--- a/drivers/acpi/acpica/uterror.c
+++ b/drivers/acpi/acpica/uterror.c
@@ -182,6 +182,78 @@ acpi_ut_predefined_bios_error(const char *module_name,
182 182
183/******************************************************************************* 183/*******************************************************************************
184 * 184 *
185 * FUNCTION: acpi_ut_prefixed_namespace_error
186 *
187 * PARAMETERS: module_name - Caller's module name (for error output)
188 * line_number - Caller's line number (for error output)
189 * prefix_scope - Scope/Path that prefixes the internal path
190 * internal_path - Name or path of the namespace node
191 * lookup_status - Exception code from NS lookup
192 *
193 * RETURN: None
194 *
195 * DESCRIPTION: Print error message with the full pathname constructed this way:
196 *
197 * prefix_scope_node_full_path.externalized_internal_path
198 *
199 * NOTE: 10/2017: Treat the major ns_lookup errors as firmware errors
200 *
201 ******************************************************************************/
202
203void
204acpi_ut_prefixed_namespace_error(const char *module_name,
205 u32 line_number,
206 union acpi_generic_state *prefix_scope,
207 const char *internal_path,
208 acpi_status lookup_status)
209{
210 char *full_path;
211 const char *message;
212
213 /*
214 * Main cases:
215 * 1) Object creation, object must not already exist
216 * 2) Object lookup, object must exist
217 */
218 switch (lookup_status) {
219 case AE_ALREADY_EXISTS:
220
221 acpi_os_printf(ACPI_MSG_BIOS_ERROR);
222 message = "Failure creating";
223 break;
224
225 case AE_NOT_FOUND:
226
227 acpi_os_printf(ACPI_MSG_BIOS_ERROR);
228 message = "Failure looking up";
229 break;
230
231 default:
232
233 acpi_os_printf(ACPI_MSG_ERROR);
234 message = "Failure looking up";
235 break;
236 }
237
238 /* Concatenate the prefix path and the internal path */
239
240 full_path =
241 acpi_ns_build_prefixed_pathname(prefix_scope, internal_path);
242
243 acpi_os_printf("%s [%s], %s", message,
244 full_path ? full_path : "Could not get pathname",
245 acpi_format_exception(lookup_status));
246
247 if (full_path) {
248 ACPI_FREE(full_path);
249 }
250
251 ACPI_MSG_SUFFIX;
252}
253
254#ifdef __OBSOLETE_FUNCTION
255/*******************************************************************************
256 *
185 * FUNCTION: acpi_ut_namespace_error 257 * FUNCTION: acpi_ut_namespace_error
186 * 258 *
187 * PARAMETERS: module_name - Caller's module name (for error output) 259 * PARAMETERS: module_name - Caller's module name (for error output)
@@ -240,6 +312,7 @@ acpi_ut_namespace_error(const char *module_name,
240 ACPI_MSG_SUFFIX; 312 ACPI_MSG_SUFFIX;
241 ACPI_MSG_REDIRECT_END; 313 ACPI_MSG_REDIRECT_END;
242} 314}
315#endif
243 316
244/******************************************************************************* 317/*******************************************************************************
245 * 318 *
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c
index 23e766d1691d..45eeb0dcf283 100644
--- a/drivers/acpi/acpica/utinit.c
+++ b/drivers/acpi/acpica/utinit.c
@@ -206,7 +206,6 @@ acpi_status acpi_ut_init_globals(void)
206 acpi_gbl_next_owner_id_offset = 0; 206 acpi_gbl_next_owner_id_offset = 0;
207 acpi_gbl_debugger_configuration = DEBUGGER_THREADING; 207 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
208 acpi_gbl_osi_mutex = NULL; 208 acpi_gbl_osi_mutex = NULL;
209 acpi_gbl_max_loop_iterations = ACPI_MAX_LOOP_COUNT;
210 209
211 /* Hardware oriented */ 210 /* Hardware oriented */
212 211
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c
index 5f9c680076c4..2055a858e5f5 100644
--- a/drivers/acpi/acpica/utmath.c
+++ b/drivers/acpi/acpica/utmath.c
@@ -134,7 +134,7 @@ acpi_status acpi_ut_short_shift_left(u64 operand, u32 count, u64 *out_result)
134 134
135 if ((count & 63) >= 32) { 135 if ((count & 63) >= 32) {
136 operand_ovl.part.hi = operand_ovl.part.lo; 136 operand_ovl.part.hi = operand_ovl.part.lo;
137 operand_ovl.part.lo ^= operand_ovl.part.lo; 137 operand_ovl.part.lo = 0;
138 count = (count & 63) - 32; 138 count = (count & 63) - 32;
139 } 139 }
140 ACPI_SHIFT_LEFT_64_BY_32(operand_ovl.part.hi, 140 ACPI_SHIFT_LEFT_64_BY_32(operand_ovl.part.hi,
@@ -171,7 +171,7 @@ acpi_status acpi_ut_short_shift_right(u64 operand, u32 count, u64 *out_result)
171 171
172 if ((count & 63) >= 32) { 172 if ((count & 63) >= 32) {
173 operand_ovl.part.lo = operand_ovl.part.hi; 173 operand_ovl.part.lo = operand_ovl.part.hi;
174 operand_ovl.part.hi ^= operand_ovl.part.hi; 174 operand_ovl.part.hi = 0;
175 count = (count & 63) - 32; 175 count = (count & 63) - 32;
176 } 176 }
177 ACPI_SHIFT_RIGHT_64_BY_32(operand_ovl.part.hi, 177 ACPI_SHIFT_RIGHT_64_BY_32(operand_ovl.part.hi,
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c
index 586354788018..524ba931d5e8 100644
--- a/drivers/acpi/acpica/utmutex.c
+++ b/drivers/acpi/acpica/utmutex.c
@@ -286,8 +286,9 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
286 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; 286 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id;
287 } else { 287 } else {
288 ACPI_EXCEPTION((AE_INFO, status, 288 ACPI_EXCEPTION((AE_INFO, status,
289 "Thread %u could not acquire Mutex [0x%X]", 289 "Thread %u could not acquire Mutex [%s] (0x%X)",
290 (u32)this_thread_id, mutex_id)); 290 (u32)this_thread_id,
291 acpi_ut_get_mutex_name(mutex_id), mutex_id));
291 } 292 }
292 293
293 return (status); 294 return (status);
@@ -322,8 +323,8 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
322 */ 323 */
323 if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) { 324 if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) {
324 ACPI_ERROR((AE_INFO, 325 ACPI_ERROR((AE_INFO,
325 "Mutex [0x%X] is not acquired, cannot release", 326 "Mutex [%s] (0x%X) is not acquired, cannot release",
326 mutex_id)); 327 acpi_ut_get_mutex_name(mutex_id), mutex_id));
327 328
328 return (AE_NOT_ACQUIRED); 329 return (AE_NOT_ACQUIRED);
329 } 330 }
diff --git a/drivers/acpi/acpica/utnonansi.c b/drivers/acpi/acpica/utnonansi.c
index 792664982ea3..33a0970646df 100644
--- a/drivers/acpi/acpica/utnonansi.c
+++ b/drivers/acpi/acpica/utnonansi.c
@@ -140,7 +140,7 @@ int acpi_ut_stricmp(char *string1, char *string2)
140 return (c1 - c2); 140 return (c1 - c2);
141} 141}
142 142
143#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) 143#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) || defined (ACPI_DEBUG_OUTPUT)
144/******************************************************************************* 144/*******************************************************************************
145 * 145 *
146 * FUNCTION: acpi_ut_safe_strcpy, acpi_ut_safe_strcat, acpi_ut_safe_strncat 146 * FUNCTION: acpi_ut_safe_strcpy, acpi_ut_safe_strcat, acpi_ut_safe_strncat
@@ -199,4 +199,13 @@ acpi_ut_safe_strncat(char *dest,
199 strncat(dest, source, max_transfer_length); 199 strncat(dest, source, max_transfer_length);
200 return (FALSE); 200 return (FALSE);
201} 201}
202
203void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size)
204{
205 /* Always terminate destination string */
206
207 strncpy(dest, source, dest_size);
208 dest[dest_size - 1] = 0;
209}
210
202#endif 211#endif
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c
index 3175b133c0e4..f6b8dd24b006 100644
--- a/drivers/acpi/acpica/utosi.c
+++ b/drivers/acpi/acpica/utosi.c
@@ -101,6 +101,8 @@ static struct acpi_interface_info acpi_default_supported_interfaces[] = {
101 {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ 101 {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */
102 {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */ 102 {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */
103 {"Windows 2015", NULL, 0, ACPI_OSI_WIN_10}, /* Windows 10 - Added 03/2015 */ 103 {"Windows 2015", NULL, 0, ACPI_OSI_WIN_10}, /* Windows 10 - Added 03/2015 */
104 {"Windows 2016", NULL, 0, ACPI_OSI_WIN_10_RS1}, /* Windows 10 version 1607 - Added 12/2017 */
105 {"Windows 2017", NULL, 0, ACPI_OSI_WIN_10_RS2}, /* Windows 10 version 1703 - Added 12/2017 */
104 106
105 /* Feature Group Strings */ 107 /* Feature Group Strings */
106 108
diff --git a/drivers/acpi/acpica/utstrsuppt.c b/drivers/acpi/acpica/utstrsuppt.c
index 965fb5cec94f..97f48d71f9e6 100644
--- a/drivers/acpi/acpica/utstrsuppt.c
+++ b/drivers/acpi/acpica/utstrsuppt.c
@@ -52,10 +52,9 @@ static acpi_status
52acpi_ut_insert_digit(u64 *accumulated_value, u32 base, int ascii_digit); 52acpi_ut_insert_digit(u64 *accumulated_value, u32 base, int ascii_digit);
53 53
54static acpi_status 54static acpi_status
55acpi_ut_strtoul_multiply64(u64 multiplicand, u64 multiplier, u64 *out_product); 55acpi_ut_strtoul_multiply64(u64 multiplicand, u32 base, u64 *out_product);
56 56
57static acpi_status 57static acpi_status acpi_ut_strtoul_add64(u64 addend1, u32 digit, u64 *out_sum);
58acpi_ut_strtoul_add64(u64 addend1, u64 addend2, u64 *out_sum);
59 58
60/******************************************************************************* 59/*******************************************************************************
61 * 60 *
@@ -357,7 +356,7 @@ acpi_ut_insert_digit(u64 *accumulated_value, u32 base, int ascii_digit)
357 * FUNCTION: acpi_ut_strtoul_multiply64 356 * FUNCTION: acpi_ut_strtoul_multiply64
358 * 357 *
359 * PARAMETERS: multiplicand - Current accumulated converted integer 358 * PARAMETERS: multiplicand - Current accumulated converted integer
360 * multiplier - Base/Radix 359 * base - Base/Radix
361 * out_product - Where the product is returned 360 * out_product - Where the product is returned
362 * 361 *
363 * RETURN: Status and 64-bit product 362 * RETURN: Status and 64-bit product
@@ -369,33 +368,40 @@ acpi_ut_insert_digit(u64 *accumulated_value, u32 base, int ascii_digit)
369 ******************************************************************************/ 368 ******************************************************************************/
370 369
371static acpi_status 370static acpi_status
372acpi_ut_strtoul_multiply64(u64 multiplicand, u64 multiplier, u64 *out_product) 371acpi_ut_strtoul_multiply64(u64 multiplicand, u32 base, u64 *out_product)
373{ 372{
374 u64 val; 373 u64 product;
374 u64 quotient;
375 375
376 /* Exit if either operand is zero */ 376 /* Exit if either operand is zero */
377 377
378 *out_product = 0; 378 *out_product = 0;
379 if (!multiplicand || !multiplier) { 379 if (!multiplicand || !base) {
380 return (AE_OK); 380 return (AE_OK);
381 } 381 }
382 382
383 /* Check for 64-bit overflow before the actual multiplication */ 383 /*
384 384 * Check for 64-bit overflow before the actual multiplication.
385 acpi_ut_short_divide(ACPI_UINT64_MAX, (u32)multiplier, &val, NULL); 385 *
386 if (multiplicand > val) { 386 * Notes: 64-bit division is often not supported on 32-bit platforms
387 * (it requires a library function), Therefore ACPICA has a local
388 * 64-bit divide function. Also, Multiplier is currently only used
389 * as the radix (8/10/16), to the 64/32 divide will always work.
390 */
391 acpi_ut_short_divide(ACPI_UINT64_MAX, base, &quotient, NULL);
392 if (multiplicand > quotient) {
387 return (AE_NUMERIC_OVERFLOW); 393 return (AE_NUMERIC_OVERFLOW);
388 } 394 }
389 395
390 val = multiplicand * multiplier; 396 product = multiplicand * base;
391 397
392 /* Check for 32-bit overflow if necessary */ 398 /* Check for 32-bit overflow if necessary */
393 399
394 if ((acpi_gbl_integer_bit_width == 32) && (val > ACPI_UINT32_MAX)) { 400 if ((acpi_gbl_integer_bit_width == 32) && (product > ACPI_UINT32_MAX)) {
395 return (AE_NUMERIC_OVERFLOW); 401 return (AE_NUMERIC_OVERFLOW);
396 } 402 }
397 403
398 *out_product = val; 404 *out_product = product;
399 return (AE_OK); 405 return (AE_OK);
400} 406}
401 407
@@ -404,7 +410,7 @@ acpi_ut_strtoul_multiply64(u64 multiplicand, u64 multiplier, u64 *out_product)
404 * FUNCTION: acpi_ut_strtoul_add64 410 * FUNCTION: acpi_ut_strtoul_add64
405 * 411 *
406 * PARAMETERS: addend1 - Current accumulated converted integer 412 * PARAMETERS: addend1 - Current accumulated converted integer
407 * addend2 - New hex value/char 413 * digit - New hex value/char
408 * out_sum - Where sum is returned (Accumulator) 414 * out_sum - Where sum is returned (Accumulator)
409 * 415 *
410 * RETURN: Status and 64-bit sum 416 * RETURN: Status and 64-bit sum
@@ -415,17 +421,17 @@ acpi_ut_strtoul_multiply64(u64 multiplicand, u64 multiplier, u64 *out_product)
415 * 421 *
416 ******************************************************************************/ 422 ******************************************************************************/
417 423
418static acpi_status acpi_ut_strtoul_add64(u64 addend1, u64 addend2, u64 *out_sum) 424static acpi_status acpi_ut_strtoul_add64(u64 addend1, u32 digit, u64 *out_sum)
419{ 425{
420 u64 sum; 426 u64 sum;
421 427
422 /* Check for 64-bit overflow before the actual addition */ 428 /* Check for 64-bit overflow before the actual addition */
423 429
424 if ((addend1 > 0) && (addend2 > (ACPI_UINT64_MAX - addend1))) { 430 if ((addend1 > 0) && (digit > (ACPI_UINT64_MAX - addend1))) {
425 return (AE_NUMERIC_OVERFLOW); 431 return (AE_NUMERIC_OVERFLOW);
426 } 432 }
427 433
428 sum = addend1 + addend2; 434 sum = addend1 + digit;
429 435
430 /* Check for 32-bit overflow if necessary */ 436 /* Check for 32-bit overflow if necessary */
431 437
diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c
index 3c8de88ecbd5..633b4e2c669f 100644
--- a/drivers/acpi/acpica/uttrack.c
+++ b/drivers/acpi/acpica/uttrack.c
@@ -402,8 +402,8 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
402 allocation->component = component; 402 allocation->component = component;
403 allocation->line = line; 403 allocation->line = line;
404 404
405 strncpy(allocation->module, module, ACPI_MAX_MODULE_NAME); 405 acpi_ut_safe_strncpy(allocation->module, (char *)module,
406 allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0; 406 ACPI_MAX_MODULE_NAME);
407 407
408 if (!element) { 408 if (!element) {
409 409
@@ -717,7 +717,7 @@ exit:
717 if (!num_outstanding) { 717 if (!num_outstanding) {
718 ACPI_INFO(("No outstanding allocations")); 718 ACPI_INFO(("No outstanding allocations"));
719 } else { 719 } else {
720 ACPI_ERROR((AE_INFO, "%u(0x%X) Outstanding allocations", 720 ACPI_ERROR((AE_INFO, "%u (0x%X) Outstanding cache allocations",
721 num_outstanding, num_outstanding)); 721 num_outstanding, num_outstanding));
722 } 722 }
723 723
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c
index 950a1e500bfa..9da4f8ef2e77 100644
--- a/drivers/acpi/acpica/utxferror.c
+++ b/drivers/acpi/acpica/utxferror.c
@@ -96,8 +96,8 @@ ACPI_EXPORT_SYMBOL(acpi_error)
96 * 96 *
97 * RETURN: None 97 * RETURN: None
98 * 98 *
99 * DESCRIPTION: Print "ACPI Exception" message with module/line/version info 99 * DESCRIPTION: Print an "ACPI Error" message with module/line/version
100 * and decoded acpi_status. 100 * info as well as decoded acpi_status.
101 * 101 *
102 ******************************************************************************/ 102 ******************************************************************************/
103void ACPI_INTERNAL_VAR_XFACE 103void ACPI_INTERNAL_VAR_XFACE
@@ -111,10 +111,10 @@ acpi_exception(const char *module_name,
111 /* For AE_OK, just print the message */ 111 /* For AE_OK, just print the message */
112 112
113 if (ACPI_SUCCESS(status)) { 113 if (ACPI_SUCCESS(status)) {
114 acpi_os_printf(ACPI_MSG_EXCEPTION); 114 acpi_os_printf(ACPI_MSG_ERROR);
115 115
116 } else { 116 } else {
117 acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ", 117 acpi_os_printf(ACPI_MSG_ERROR "%s, ",
118 acpi_format_exception(status)); 118 acpi_format_exception(status));
119 } 119 }
120 120
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 6db3b4668b1a..ffe364fa4040 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -145,9 +145,9 @@
145 145
146#define ACPI_ADDRESS_RANGE_MAX 2 146#define ACPI_ADDRESS_RANGE_MAX 2
147 147
148/* Maximum number of While() loops before abort */ 148/* Maximum time (default 30s) of While() loops before abort */
149 149
150#define ACPI_MAX_LOOP_COUNT 0x000FFFFF 150#define ACPI_MAX_LOOP_TIMEOUT 30
151 151
152/****************************************************************************** 152/******************************************************************************
153 * 153 *
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 17d61b1f2511..3c46f0ef5f7a 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -130,8 +130,9 @@ struct acpi_exception_info {
130#define AE_HEX_OVERFLOW EXCEP_ENV (0x0020) 130#define AE_HEX_OVERFLOW EXCEP_ENV (0x0020)
131#define AE_DECIMAL_OVERFLOW EXCEP_ENV (0x0021) 131#define AE_DECIMAL_OVERFLOW EXCEP_ENV (0x0021)
132#define AE_OCTAL_OVERFLOW EXCEP_ENV (0x0022) 132#define AE_OCTAL_OVERFLOW EXCEP_ENV (0x0022)
133#define AE_END_OF_TABLE EXCEP_ENV (0x0023)
133 134
134#define AE_CODE_ENV_MAX 0x0022 135#define AE_CODE_ENV_MAX 0x0023
135 136
136/* 137/*
137 * Programmer exceptions 138 * Programmer exceptions
@@ -195,7 +196,7 @@ struct acpi_exception_info {
195#define AE_AML_CIRCULAR_REFERENCE EXCEP_AML (0x001E) 196#define AE_AML_CIRCULAR_REFERENCE EXCEP_AML (0x001E)
196#define AE_AML_BAD_RESOURCE_LENGTH EXCEP_AML (0x001F) 197#define AE_AML_BAD_RESOURCE_LENGTH EXCEP_AML (0x001F)
197#define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020) 198#define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020)
198#define AE_AML_INFINITE_LOOP EXCEP_AML (0x0021) 199#define AE_AML_LOOP_TIMEOUT EXCEP_AML (0x0021)
199#define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022) 200#define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022)
200#define AE_AML_TARGET_TYPE EXCEP_AML (0x0023) 201#define AE_AML_TARGET_TYPE EXCEP_AML (0x0023)
201 202
@@ -275,7 +276,8 @@ static const struct acpi_exception_info acpi_gbl_exception_names_env[] = {
275 EXCEP_TXT("AE_DECIMAL_OVERFLOW", 276 EXCEP_TXT("AE_DECIMAL_OVERFLOW",
276 "Overflow during ASCII decimal-to-binary conversion"), 277 "Overflow during ASCII decimal-to-binary conversion"),
277 EXCEP_TXT("AE_OCTAL_OVERFLOW", 278 EXCEP_TXT("AE_OCTAL_OVERFLOW",
278 "Overflow during ASCII octal-to-binary conversion") 279 "Overflow during ASCII octal-to-binary conversion"),
280 EXCEP_TXT("AE_END_OF_TABLE", "Reached the end of table")
279}; 281};
280 282
281static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = { 283static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = {
@@ -368,8 +370,8 @@ static const struct acpi_exception_info acpi_gbl_exception_names_aml[] = {
368 "The length of a Resource Descriptor in the AML is incorrect"), 370 "The length of a Resource Descriptor in the AML is incorrect"),
369 EXCEP_TXT("AE_AML_ILLEGAL_ADDRESS", 371 EXCEP_TXT("AE_AML_ILLEGAL_ADDRESS",
370 "A memory, I/O, or PCI configuration address is invalid"), 372 "A memory, I/O, or PCI configuration address is invalid"),
371 EXCEP_TXT("AE_AML_INFINITE_LOOP", 373 EXCEP_TXT("AE_AML_LOOP_TIMEOUT",
372 "An apparent infinite AML While loop, method was aborted"), 374 "An AML While loop exceeded the maximum execution time"),
373 EXCEP_TXT("AE_AML_UNINITIALIZED_NODE", 375 EXCEP_TXT("AE_AML_UNINITIALIZED_NODE",
374 "A namespace node is uninitialized or unresolved"), 376 "A namespace node is uninitialized or unresolved"),
375 EXCEP_TXT("AE_AML_TARGET_TYPE", 377 EXCEP_TXT("AE_AML_TARGET_TYPE",
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index e1dd1a8d42b6..c589c3e12d90 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -46,7 +46,7 @@
46 46
47/* Current ACPICA subsystem version in YYYYMMDD format */ 47/* Current ACPICA subsystem version in YYYYMMDD format */
48 48
49#define ACPI_CA_VERSION 0x20170831 49#define ACPI_CA_VERSION 0x20171215
50 50
51#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
52#include <acpi/actypes.h> 52#include <acpi/actypes.h>
@@ -260,11 +260,11 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_osi_data, 0);
260ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE); 260ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE);
261 261
262/* 262/*
263 * Maximum number of While() loop iterations before forced method abort. 263 * Maximum timeout for While() loop iterations before forced method abort.
264 * This mechanism is intended to prevent infinite loops during interpreter 264 * This mechanism is intended to prevent infinite loops during interpreter
265 * execution within a host kernel. 265 * execution within a host kernel.
266 */ 266 */
267ACPI_INIT_GLOBAL(u32, acpi_gbl_max_loop_iterations, ACPI_MAX_LOOP_COUNT); 267ACPI_INIT_GLOBAL(u32, acpi_gbl_max_loop_iterations, ACPI_MAX_LOOP_TIMEOUT);
268 268
269/* 269/*
270 * This mechanism is used to trace a specified AML method. The method is 270 * This mechanism is used to trace a specified AML method. The method is
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 7a89e6de94da..4c304bf4d591 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -69,9 +69,10 @@
69#define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */ 69#define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */
70#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ 70#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */
71#define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */ 71#define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */
72#define ACPI_SIG_PDTT "PDTT" /* Processor Debug Trigger Table */ 72#define ACPI_SIG_PDTT "PDTT" /* Platform Debug Trigger Table */
73#define ACPI_SIG_PPTT "PPTT" /* Processor Properties Topology Table */ 73#define ACPI_SIG_PPTT "PPTT" /* Processor Properties Topology Table */
74#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ 74#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */
75#define ACPI_SIG_SDEV "SDEV" /* Secure Devices table */
75#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ 76#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */
76#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ 77#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */
77#define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */ 78#define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */
@@ -1149,7 +1150,8 @@ enum acpi_nfit_type {
1149 ACPI_NFIT_TYPE_CONTROL_REGION = 4, 1150 ACPI_NFIT_TYPE_CONTROL_REGION = 4,
1150 ACPI_NFIT_TYPE_DATA_REGION = 5, 1151 ACPI_NFIT_TYPE_DATA_REGION = 5,
1151 ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6, 1152 ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6,
1152 ACPI_NFIT_TYPE_RESERVED = 7 /* 7 and greater are reserved */ 1153 ACPI_NFIT_TYPE_CAPABILITIES = 7,
1154 ACPI_NFIT_TYPE_RESERVED = 8 /* 8 and greater are reserved */
1153}; 1155};
1154 1156
1155/* 1157/*
@@ -1162,7 +1164,7 @@ struct acpi_nfit_system_address {
1162 struct acpi_nfit_header header; 1164 struct acpi_nfit_header header;
1163 u16 range_index; 1165 u16 range_index;
1164 u16 flags; 1166 u16 flags;
1165 u32 reserved; /* Reseved, must be zero */ 1167 u32 reserved; /* Reserved, must be zero */
1166 u32 proximity_domain; 1168 u32 proximity_domain;
1167 u8 range_guid[16]; 1169 u8 range_guid[16];
1168 u64 address; 1170 u64 address;
@@ -1281,9 +1283,72 @@ struct acpi_nfit_flush_address {
1281 u64 hint_address[1]; /* Variable length */ 1283 u64 hint_address[1]; /* Variable length */
1282}; 1284};
1283 1285
1286/* 7: Platform Capabilities Structure */
1287
1288struct acpi_nfit_capabilities {
1289 struct acpi_nfit_header header;
1290 u8 highest_capability;
1291 u8 reserved[3]; /* Reserved, must be zero */
1292 u32 capabilities;
1293 u32 reserved2;
1294};
1295
1296/* Capabilities Flags */
1297
1298#define ACPI_NFIT_CAPABILITY_CACHE_FLUSH (1) /* 00: Cache Flush to NVDIMM capable */
1299#define ACPI_NFIT_CAPABILITY_MEM_FLUSH (1<<1) /* 01: Memory Flush to NVDIMM capable */
1300#define ACPI_NFIT_CAPABILITY_MEM_MIRRORING (1<<2) /* 02: Memory Mirroring capable */
1301
1302/*
1303 * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM
1304 */
1305struct nfit_device_handle {
1306 u32 handle;
1307};
1308
1309/* Device handle construction and extraction macros */
1310
1311#define ACPI_NFIT_DIMM_NUMBER_MASK 0x0000000F
1312#define ACPI_NFIT_CHANNEL_NUMBER_MASK 0x000000F0
1313#define ACPI_NFIT_MEMORY_ID_MASK 0x00000F00
1314#define ACPI_NFIT_SOCKET_ID_MASK 0x0000F000
1315#define ACPI_NFIT_NODE_ID_MASK 0x0FFF0000
1316
1317#define ACPI_NFIT_DIMM_NUMBER_OFFSET 0
1318#define ACPI_NFIT_CHANNEL_NUMBER_OFFSET 4
1319#define ACPI_NFIT_MEMORY_ID_OFFSET 8
1320#define ACPI_NFIT_SOCKET_ID_OFFSET 12
1321#define ACPI_NFIT_NODE_ID_OFFSET 16
1322
1323/* Macro to construct a NFIT/NVDIMM device handle */
1324
1325#define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \
1326 ((dimm) | \
1327 ((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET) | \
1328 ((memory) << ACPI_NFIT_MEMORY_ID_OFFSET) | \
1329 ((socket) << ACPI_NFIT_SOCKET_ID_OFFSET) | \
1330 ((node) << ACPI_NFIT_NODE_ID_OFFSET))
1331
1332/* Macros to extract individual fields from a NFIT/NVDIMM device handle */
1333
1334#define ACPI_NFIT_GET_DIMM_NUMBER(handle) \
1335 ((handle) & ACPI_NFIT_DIMM_NUMBER_MASK)
1336
1337#define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \
1338 (((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET)
1339
1340#define ACPI_NFIT_GET_MEMORY_ID(handle) \
1341 (((handle) & ACPI_NFIT_MEMORY_ID_MASK) >> ACPI_NFIT_MEMORY_ID_OFFSET)
1342
1343#define ACPI_NFIT_GET_SOCKET_ID(handle) \
1344 (((handle) & ACPI_NFIT_SOCKET_ID_MASK) >> ACPI_NFIT_SOCKET_ID_OFFSET)
1345
1346#define ACPI_NFIT_GET_NODE_ID(handle) \
1347 (((handle) & ACPI_NFIT_NODE_ID_MASK) >> ACPI_NFIT_NODE_ID_OFFSET)
1348
1284/******************************************************************************* 1349/*******************************************************************************
1285 * 1350 *
1286 * PDTT - Processor Debug Trigger Table (ACPI 6.2) 1351 * PDTT - Platform Debug Trigger Table (ACPI 6.2)
1287 * Version 0 1352 * Version 0
1288 * 1353 *
1289 ******************************************************************************/ 1354 ******************************************************************************/
@@ -1301,14 +1366,14 @@ struct acpi_table_pdtt {
1301 * starting at array_offset. 1366 * starting at array_offset.
1302 */ 1367 */
1303struct acpi_pdtt_channel { 1368struct acpi_pdtt_channel {
1304 u16 sub_channel_id; 1369 u8 subchannel_id;
1370 u8 flags;
1305}; 1371};
1306 1372
1307/* Mask and Flags for above */ 1373/* Flags for above */
1308 1374
1309#define ACPI_PDTT_SUBCHANNEL_ID_MASK 0x00FF 1375#define ACPI_PDTT_RUNTIME_TRIGGER (1)
1310#define ACPI_PDTT_RUNTIME_TRIGGER (1<<8) 1376#define ACPI_PDTT_WAIT_COMPLETION (1<<1)
1311#define ACPI_PPTT_WAIT_COMPLETION (1<<9)
1312 1377
1313/******************************************************************************* 1378/*******************************************************************************
1314 * 1379 *
@@ -1376,6 +1441,20 @@ struct acpi_pptt_cache {
1376#define ACPI_PPTT_MASK_CACHE_TYPE (0x0C) /* Cache type */ 1441#define ACPI_PPTT_MASK_CACHE_TYPE (0x0C) /* Cache type */
1377#define ACPI_PPTT_MASK_WRITE_POLICY (0x10) /* Write policy */ 1442#define ACPI_PPTT_MASK_WRITE_POLICY (0x10) /* Write policy */
1378 1443
1444/* Attributes describing cache */
1445#define ACPI_PPTT_CACHE_READ_ALLOCATE (0x0) /* Cache line is allocated on read */
1446#define ACPI_PPTT_CACHE_WRITE_ALLOCATE (0x01) /* Cache line is allocated on write */
1447#define ACPI_PPTT_CACHE_RW_ALLOCATE (0x02) /* Cache line is allocated on read and write */
1448#define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT (0x03) /* Alternate representation of above */
1449
1450#define ACPI_PPTT_CACHE_TYPE_DATA (0x0) /* Data cache */
1451#define ACPI_PPTT_CACHE_TYPE_INSTR (1<<2) /* Instruction cache */
1452#define ACPI_PPTT_CACHE_TYPE_UNIFIED (2<<2) /* Unified I & D cache */
1453#define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT (3<<2) /* Alternate representation of above */
1454
1455#define ACPI_PPTT_CACHE_POLICY_WB (0x0) /* Cache is write back */
1456#define ACPI_PPTT_CACHE_POLICY_WT (1<<4) /* Cache is write through */
1457
1379/* 2: ID Structure */ 1458/* 2: ID Structure */
1380 1459
1381struct acpi_pptt_id { 1460struct acpi_pptt_id {
@@ -1405,6 +1484,68 @@ struct acpi_table_sbst {
1405 1484
1406/******************************************************************************* 1485/*******************************************************************************
1407 * 1486 *
1487 * SDEV - Secure Devices Table (ACPI 6.2)
1488 * Version 1
1489 *
1490 ******************************************************************************/
1491
1492struct acpi_table_sdev {
1493 struct acpi_table_header header; /* Common ACPI table header */
1494};
1495
1496struct acpi_sdev_header {
1497 u8 type;
1498 u8 flags;
1499 u16 length;
1500};
1501
1502/* Values for subtable type above */
1503
1504enum acpi_sdev_type {
1505 ACPI_SDEV_TYPE_NAMESPACE_DEVICE = 0,
1506 ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1,
1507 ACPI_SDEV_TYPE_RESERVED = 2 /* 2 and greater are reserved */
1508};
1509
1510/* Values for flags above */
1511
1512#define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS (1)
1513
1514/*
1515 * SDEV subtables
1516 */
1517
1518/* 0: Namespace Device Based Secure Device Structure */
1519
1520struct acpi_sdev_namespace {
1521 struct acpi_sdev_header header;
1522 u16 device_id_offset;
1523 u16 device_id_length;
1524 u16 vendor_data_offset;
1525 u16 vendor_data_length;
1526};
1527
1528/* 1: PCIe Endpoint Device Based Device Structure */
1529
1530struct acpi_sdev_pcie {
1531 struct acpi_sdev_header header;
1532 u16 segment;
1533 u16 start_bus;
1534 u16 path_offset;
1535 u16 path_length;
1536 u16 vendor_data_offset;
1537 u16 vendor_data_length;
1538};
1539
1540/* 1a: PCIe Endpoint path entry */
1541
1542struct acpi_sdev_pcie_path {
1543 u8 device;
1544 u8 function;
1545};
1546
1547/*******************************************************************************
1548 *
1408 * SLIT - System Locality Distance Information Table 1549 * SLIT - System Locality Distance Information Table
1409 * Version 1 1550 * Version 1
1410 * 1551 *
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 686b6f8c09dc..0d60d5df14f8 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -810,6 +810,7 @@ struct acpi_iort_smmu_v3 {
810 u8 pxm; 810 u8 pxm;
811 u8 reserved1; 811 u8 reserved1;
812 u16 reserved2; 812 u16 reserved2;
813 u32 id_mapping_index;
813}; 814};
814 815
815/* Values for Model field above */ 816/* Values for Model field above */
@@ -1246,6 +1247,8 @@ enum acpi_spmi_interface_types {
1246 * TCPA - Trusted Computing Platform Alliance table 1247 * TCPA - Trusted Computing Platform Alliance table
1247 * Version 2 1248 * Version 2
1248 * 1249 *
1250 * TCG Hardware Interface Table for TPM 1.2 Clients and Servers
1251 *
1249 * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", 1252 * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
1250 * Version 1.2, Revision 8 1253 * Version 1.2, Revision 8
1251 * February 27, 2017 1254 * February 27, 2017
@@ -1310,6 +1313,8 @@ struct acpi_table_tcpa_server {
1310 * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table 1313 * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
1311 * Version 4 1314 * Version 4
1312 * 1315 *
1316 * TCG Hardware Interface Table for TPM 2.0 Clients and Servers
1317 *
1313 * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", 1318 * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
1314 * Version 1.2, Revision 8 1319 * Version 1.2, Revision 8
1315 * February 27, 2017 1320 * February 27, 2017
@@ -1329,15 +1334,23 @@ struct acpi_table_tpm2 {
1329/* Values for start_method above */ 1334/* Values for start_method above */
1330 1335
1331#define ACPI_TPM2_NOT_ALLOWED 0 1336#define ACPI_TPM2_NOT_ALLOWED 0
1337#define ACPI_TPM2_RESERVED1 1
1332#define ACPI_TPM2_START_METHOD 2 1338#define ACPI_TPM2_START_METHOD 2
1339#define ACPI_TPM2_RESERVED3 3
1340#define ACPI_TPM2_RESERVED4 4
1341#define ACPI_TPM2_RESERVED5 5
1333#define ACPI_TPM2_MEMORY_MAPPED 6 1342#define ACPI_TPM2_MEMORY_MAPPED 6
1334#define ACPI_TPM2_COMMAND_BUFFER 7 1343#define ACPI_TPM2_COMMAND_BUFFER 7
1335#define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD 8 1344#define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD 8
1345#define ACPI_TPM2_RESERVED9 9
1346#define ACPI_TPM2_RESERVED10 10
1336#define ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC 11 /* V1.2 Rev 8 */ 1347#define ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC 11 /* V1.2 Rev 8 */
1348#define ACPI_TPM2_RESERVED 12
1337 1349
1338/* Trailer appears after any start_method subtables */ 1350/* Optional trailer appears after any start_method subtables */
1339 1351
1340struct acpi_tpm2_trailer { 1352struct acpi_tpm2_trailer {
1353 u8 method_parameters[12];
1341 u32 minimum_log_length; /* Minimum length for the event log area */ 1354 u32 minimum_log_length; /* Minimum length for the event log area */
1342 u64 log_address; /* Address of the event log area */ 1355 u64 log_address; /* Address of the event log area */
1343}; 1356};
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 4f077edb9b81..31f1be74dd16 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -468,6 +468,8 @@ typedef void *acpi_handle; /* Actually a ptr to a NS Node */
468#define ACPI_NSEC_PER_MSEC 1000000L 468#define ACPI_NSEC_PER_MSEC 1000000L
469#define ACPI_NSEC_PER_SEC 1000000000L 469#define ACPI_NSEC_PER_SEC 1000000000L
470 470
471#define ACPI_TIME_AFTER(a, b) ((s64)((b) - (a)) < 0)
472
471/* Owner IDs are used to track namespace nodes for selective deletion */ 473/* Owner IDs are used to track namespace nodes for selective deletion */
472 474
473typedef u8 acpi_owner_id; 475typedef u8 acpi_owner_id;
@@ -1299,6 +1301,8 @@ typedef enum {
1299#define ACPI_OSI_WIN_7 0x0B 1301#define ACPI_OSI_WIN_7 0x0B
1300#define ACPI_OSI_WIN_8 0x0C 1302#define ACPI_OSI_WIN_8 0x0C
1301#define ACPI_OSI_WIN_10 0x0D 1303#define ACPI_OSI_WIN_10 0x0D
1304#define ACPI_OSI_WIN_10_RS1 0x0E
1305#define ACPI_OSI_WIN_10_RS2 0x0F
1302 1306
1303/* Definitions of getopt */ 1307/* Definitions of getopt */
1304 1308
diff --git a/tools/power/acpi/tools/acpidump/apmain.c b/tools/power/acpi/tools/acpidump/apmain.c
index 22c3b4ee1617..be418fba9441 100644
--- a/tools/power/acpi/tools/acpidump/apmain.c
+++ b/tools/power/acpi/tools/acpidump/apmain.c
@@ -79,7 +79,7 @@ struct ap_dump_action action_table[AP_MAX_ACTIONS];
79u32 current_action = 0; 79u32 current_action = 0;
80 80
81#define AP_UTILITY_NAME "ACPI Binary Table Dump Utility" 81#define AP_UTILITY_NAME "ACPI Binary Table Dump Utility"
82#define AP_SUPPORTED_OPTIONS "?a:bc:f:hn:o:r:svxz" 82#define AP_SUPPORTED_OPTIONS "?a:bc:f:hn:o:r:sv^xz"
83 83
84/****************************************************************************** 84/******************************************************************************
85 * 85 *
@@ -100,6 +100,7 @@ static void ap_display_usage(void)
100 ACPI_OPTION("-r <Address>", "Dump tables from specified RSDP"); 100 ACPI_OPTION("-r <Address>", "Dump tables from specified RSDP");
101 ACPI_OPTION("-s", "Print table summaries only"); 101 ACPI_OPTION("-s", "Print table summaries only");
102 ACPI_OPTION("-v", "Display version information"); 102 ACPI_OPTION("-v", "Display version information");
103 ACPI_OPTION("-vd", "Display build date and time");
103 ACPI_OPTION("-z", "Verbose mode"); 104 ACPI_OPTION("-z", "Verbose mode");
104 105
105 ACPI_USAGE_TEXT("\nTable Options:\n"); 106 ACPI_USAGE_TEXT("\nTable Options:\n");
@@ -231,10 +232,29 @@ static int ap_do_options(int argc, char **argv)
231 } 232 }
232 continue; 233 continue;
233 234
234 case 'v': /* Revision/version */ 235 case 'v': /* -v: (Version): signon already emitted, just exit */
235 236
236 acpi_os_printf(ACPI_COMMON_SIGNON(AP_UTILITY_NAME)); 237 switch (acpi_gbl_optarg[0]) {
237 return (1); 238 case '^': /* -v: (Version) */
239
240 fprintf(stderr,
241 ACPI_COMMON_SIGNON(AP_UTILITY_NAME));
242 return (1);
243
244 case 'd':
245
246 fprintf(stderr,
247 ACPI_COMMON_SIGNON(AP_UTILITY_NAME));
248 printf(ACPI_COMMON_BUILD_TIME);
249 return (1);
250
251 default:
252
253 printf("Unknown option: -v%s\n",
254 acpi_gbl_optarg);
255 return (-1);
256 }
257 break;
238 258
239 case 'z': /* Verbose mode */ 259 case 'z': /* Verbose mode */
240 260