Merge branch 'acpica'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 18 Jan 2018 02:01:07 +0000 (03:01 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 18 Jan 2018 02:01:07 +0000 (03:01 +0100)
* 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
  ...

48 files changed:
MAINTAINERS
drivers/acpi/acpica/acapps.h
drivers/acpi/acpica/acdebug.h
drivers/acpi/acpica/acglobal.h
drivers/acpi/acpica/aclocal.h
drivers/acpi/acpica/acmacros.h
drivers/acpi/acpica/acnamesp.h
drivers/acpi/acpica/acutils.h
drivers/acpi/acpica/dbexec.c
drivers/acpi/acpica/dbfileio.c
drivers/acpi/acpica/dbinput.c
drivers/acpi/acpica/dscontrol.c
drivers/acpi/acpica/dsfield.c
drivers/acpi/acpica/dsobject.c
drivers/acpi/acpica/dspkginit.c
drivers/acpi/acpica/dsutils.c
drivers/acpi/acpica/dswload.c
drivers/acpi/acpica/dswload2.c
drivers/acpi/acpica/evregion.c
drivers/acpi/acpica/exdump.c
drivers/acpi/acpica/hwtimer.c
drivers/acpi/acpica/hwvalid.c
drivers/acpi/acpica/nsaccess.c
drivers/acpi/acpica/nsconvert.c
drivers/acpi/acpica/nsnames.c
drivers/acpi/acpica/nssearch.c
drivers/acpi/acpica/nsxfeval.c
drivers/acpi/acpica/psargs.c
drivers/acpi/acpica/psobject.c
drivers/acpi/acpica/psutils.c
drivers/acpi/acpica/utdebug.c
drivers/acpi/acpica/utdecode.c
drivers/acpi/acpica/uterror.c
drivers/acpi/acpica/utinit.c
drivers/acpi/acpica/utmath.c
drivers/acpi/acpica/utmutex.c
drivers/acpi/acpica/utnonansi.c
drivers/acpi/acpica/utosi.c
drivers/acpi/acpica/utstrsuppt.c
drivers/acpi/acpica/uttrack.c
drivers/acpi/acpica/utxferror.c
include/acpi/acconfig.h
include/acpi/acexcep.h
include/acpi/acpixf.h
include/acpi/actbl1.h
include/acpi/actbl2.h
include/acpi/actypes.h
tools/power/acpi/tools/acpidump/apmain.c

index 18994806e441f86f2415e417458a02dc111fa6d2..4c1cdc399a22daa2ad2e29de0276d4991094defb 100644 (file)
@@ -321,7 +321,7 @@ F:  drivers/acpi/apei/
 
 ACPI COMPONENT ARCHITECTURE (ACPICA)
 M:     Robert Moore <robert.moore@intel.com>
-M:     Lv Zheng <lv.zheng@intel.com>
+M:     Erik Schmauss <erik.schmauss@intel.com>
 M:     "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
 L:     linux-acpi@vger.kernel.org
 L:     devel@acpica.org
index 7a1a68b5ac5c3c329c0858b6023624df3a2e9856..2243c8164b3419cc055faafb18c0051aeb829765 100644 (file)
@@ -80,6 +80,9 @@
        prefix, ACPICA_COPYRIGHT, \
        prefix
 
+#define ACPI_COMMON_BUILD_TIME \
+       "Build date/time: %s %s\n", __DATE__, __TIME__
+
 /* Macros for usage messages */
 
 #define ACPI_USAGE_HEADER(usage) \
index 71743e5252f5736b6c5cb0f4b438558f4a66816a..54b8d9df9423cd252c19bb31b6f810d9cb1616c1 100644 (file)
@@ -222,6 +222,10 @@ ACPI_DBR_DEPENDENT_RETURN_VOID(void
 void
 acpi_db_execute(char *name, char **args, acpi_object_type *types, u32 flags);
 
+void
+acpi_db_create_execution_thread(char *method_name_arg,
+                               char **arguments, acpi_object_type *types);
+
 void
 acpi_db_create_execution_threads(char *num_threads_arg,
                                 char *num_loops_arg, char *method_name_arg);
index 95eed442703f27e6e719e69d0a508d86d1f75bb5..45ef3f5dc9ad29543cf3ff4fdf72a9715fdb711c 100644 (file)
@@ -46,7 +46,7 @@
 
 /*****************************************************************************
  *
- * Globals related to the ACPI tables
+ * Globals related to the incoming ACPI tables
  *
  ****************************************************************************/
 
@@ -87,7 +87,7 @@ ACPI_GLOBAL(u8, acpi_gbl_integer_nybble_width);
 
 /*****************************************************************************
  *
- * Mutual exclusion within ACPICA subsystem
+ * Mutual exclusion within the ACPICA subsystem
  *
  ****************************************************************************/
 
@@ -167,7 +167,7 @@ ACPI_GLOBAL(u8, acpi_gbl_next_owner_id_offset);
 
 ACPI_INIT_GLOBAL(u8, acpi_gbl_namespace_initialized, FALSE);
 
-/* Misc */
+/* Miscellaneous */
 
 ACPI_GLOBAL(u32, acpi_gbl_original_mode);
 ACPI_GLOBAL(u32, acpi_gbl_ns_lookup_count);
@@ -191,10 +191,9 @@ extern const char acpi_gbl_lower_hex_digits[];
 extern const char acpi_gbl_upper_hex_digits[];
 extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
 
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-
 /* Lists for tracking memory allocations (debug only) */
 
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_global_list);
 ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_ns_node_list);
 ACPI_GLOBAL(u8, acpi_gbl_display_final_mem_stats);
@@ -203,7 +202,7 @@ ACPI_GLOBAL(u8, acpi_gbl_disable_mem_tracking);
 
 /*****************************************************************************
  *
- * Namespace globals
+ * ACPI Namespace
  *
  ****************************************************************************/
 
@@ -234,15 +233,20 @@ ACPI_INIT_GLOBAL(u32, acpi_gbl_nesting_level, 0);
 
 /*****************************************************************************
  *
- * Interpreter globals
+ * Interpreter/Parser globals
  *
  ****************************************************************************/
 
-ACPI_GLOBAL(struct acpi_thread_state *, acpi_gbl_current_walk_list);
-
 /* Control method single step flag */
 
 ACPI_GLOBAL(u8, acpi_gbl_cm_single_step);
+ACPI_GLOBAL(struct acpi_thread_state *, acpi_gbl_current_walk_list);
+ACPI_INIT_GLOBAL(union acpi_parse_object, *acpi_gbl_current_scope, NULL);
+
+/* ASL/ASL+ converter */
+
+ACPI_INIT_GLOBAL(u8, acpi_gbl_capture_comments, FALSE);
+ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_last_list_head, NULL);
 
 /*****************************************************************************
  *
@@ -252,7 +256,6 @@ ACPI_GLOBAL(u8, acpi_gbl_cm_single_step);
 
 extern struct acpi_bit_register_info
     acpi_gbl_bit_register_info[ACPI_NUM_BITREG];
-
 ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a);
 ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b);
 
@@ -263,7 +266,6 @@ ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b);
  ****************************************************************************/
 
 #if (!ACPI_REDUCED_HARDWARE)
-
 ACPI_GLOBAL(u8, acpi_gbl_all_gpes_initialized);
 ACPI_GLOBAL(struct acpi_gpe_xrupt_info *, acpi_gbl_gpe_xrupt_list_head);
 ACPI_GLOBAL(struct acpi_gpe_block_info *,
@@ -272,10 +274,8 @@ ACPI_GLOBAL(acpi_gbl_event_handler, acpi_gbl_global_event_handler);
 ACPI_GLOBAL(void *, acpi_gbl_global_event_handler_context);
 ACPI_GLOBAL(struct acpi_fixed_event_handler,
            acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]);
-
 extern struct acpi_fixed_event_info
     acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
-
 #endif                         /* !ACPI_REDUCED_HARDWARE */
 
 /*****************************************************************************
@@ -291,14 +291,14 @@ ACPI_GLOBAL(u32, acpi_gpe_count);
 ACPI_GLOBAL(u32, acpi_sci_count);
 ACPI_GLOBAL(u32, acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS]);
 
-/* Support for dynamic control method tracing mechanism */
+/* Dynamic control method tracing mechanism */
 
 ACPI_GLOBAL(u32, acpi_gbl_original_dbg_level);
 ACPI_GLOBAL(u32, acpi_gbl_original_dbg_layer);
 
 /*****************************************************************************
  *
- * Debugger and Disassembler globals
+ * Debugger and Disassembler
  *
  ****************************************************************************/
 
@@ -326,7 +326,6 @@ ACPI_GLOBAL(struct acpi_external_file *, acpi_gbl_external_file_list);
 #endif
 
 #ifdef ACPI_DEBUGGER
-
 ACPI_INIT_GLOBAL(u8, acpi_gbl_abort_method, FALSE);
 ACPI_INIT_GLOBAL(acpi_thread_id, acpi_gbl_db_thread_id, ACPI_INVALID_THREAD_ID);
 
@@ -340,7 +339,6 @@ ACPI_GLOBAL(u32, acpi_gbl_db_console_debug_level);
 ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_db_scope_node);
 ACPI_GLOBAL(u8, acpi_gbl_db_terminate_loop);
 ACPI_GLOBAL(u8, acpi_gbl_db_threads_terminated);
-
 ACPI_GLOBAL(char *, acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]);
 ACPI_GLOBAL(acpi_object_type, acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]);
 
@@ -350,32 +348,33 @@ ACPI_GLOBAL(char, acpi_gbl_db_parsed_buf[ACPI_DB_LINE_BUFFER_SIZE]);
 ACPI_GLOBAL(char, acpi_gbl_db_scope_buf[ACPI_DB_LINE_BUFFER_SIZE]);
 ACPI_GLOBAL(char, acpi_gbl_db_debug_filename[ACPI_DB_LINE_BUFFER_SIZE]);
 
-/*
- * Statistic globals
- */
+/* Statistics globals */
+
 ACPI_GLOBAL(u16, acpi_gbl_obj_type_count[ACPI_TOTAL_TYPES]);
 ACPI_GLOBAL(u16, acpi_gbl_node_type_count[ACPI_TOTAL_TYPES]);
 ACPI_GLOBAL(u16, acpi_gbl_obj_type_count_misc);
 ACPI_GLOBAL(u16, acpi_gbl_node_type_count_misc);
 ACPI_GLOBAL(u32, acpi_gbl_num_nodes);
 ACPI_GLOBAL(u32, acpi_gbl_num_objects);
-
 #endif                         /* ACPI_DEBUGGER */
 
 #if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
-
 ACPI_GLOBAL(const char, *acpi_gbl_pld_panel_list[]);
 ACPI_GLOBAL(const char, *acpi_gbl_pld_vertical_position_list[]);
 ACPI_GLOBAL(const char, *acpi_gbl_pld_horizontal_position_list[]);
 ACPI_GLOBAL(const char, *acpi_gbl_pld_shape_list[]);
-
 ACPI_INIT_GLOBAL(u8, acpi_gbl_disasm_flag, FALSE);
-
 #endif
 
-/*
- * Meant for the -ca option.
- */
+/*****************************************************************************
+ *
+ * ACPICA application-specific globals
+ *
+ ****************************************************************************/
+
+/* ASL-to-ASL+ conversion utility (implemented within the iASL compiler) */
+
+#ifdef ACPI_ASL_COMPILER
 ACPI_INIT_GLOBAL(char *, acpi_gbl_current_inline_comment, NULL);
 ACPI_INIT_GLOBAL(char *, acpi_gbl_current_end_node_comment, NULL);
 ACPI_INIT_GLOBAL(char *, acpi_gbl_current_open_brace_comment, NULL);
@@ -386,23 +385,18 @@ ACPI_INIT_GLOBAL(char *, acpi_gbl_current_filename, NULL);
 ACPI_INIT_GLOBAL(char *, acpi_gbl_current_parent_filename, NULL);
 ACPI_INIT_GLOBAL(char *, acpi_gbl_current_include_filename, NULL);
 
-ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_last_list_head, NULL);
-
 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_head,
                 NULL);
 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_tail,
                 NULL);
-
 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_head,
                 NULL);
 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_tail,
                 NULL);
-
 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_head,
                 NULL);
 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_tail,
                 NULL);
-
 ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_head,
                 NULL);
 ACPI_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,
 
 ACPI_INIT_GLOBAL(struct acpi_comment_addr_node,
                 *acpi_gbl_comment_addr_list_head, NULL);
-
-ACPI_INIT_GLOBAL(union acpi_parse_object, *acpi_gbl_current_scope, NULL);
-
 ACPI_INIT_GLOBAL(struct acpi_file_node, *acpi_gbl_file_tree_root, NULL);
 
 ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_reg_comment_cache);
 ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_comment_addr_cache);
 ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_file_cache);
 
-ACPI_INIT_GLOBAL(u8, gbl_capture_comments, FALSE);
-
 ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_asl_conversion, FALSE);
 ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_conv_debug_file, NULL);
-
 ACPI_GLOBAL(char, acpi_gbl_table_sig[4]);
-
-/*****************************************************************************
- *
- * Application globals
- *
- ****************************************************************************/
+#endif
 
 #ifdef ACPI_APPLICATION
-
 ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_debug_file, NULL);
 ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_output_file, NULL);
 ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_timeout, FALSE);
@@ -442,16 +424,6 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_timeout, FALSE);
 
 ACPI_GLOBAL(acpi_spinlock, acpi_gbl_print_lock);       /* For print buffer */
 ACPI_GLOBAL(char, acpi_gbl_print_buffer[1024]);
-
 #endif                         /* ACPI_APPLICATION */
 
-/*****************************************************************************
- *
- * Info/help support
- *
- ****************************************************************************/
-
-extern const struct ah_predefined_name asl_predefined_info[];
-extern const struct ah_device_id asl_device_ids[];
-
 #endif                         /* __ACGLOBAL_H__ */
index 0d45b8bb1678945eb296cdabce11f229cb349b65..a56675f0661eb18b13adf49a27b1cfeb68f7b8d5 100644 (file)
@@ -622,7 +622,7 @@ struct acpi_control_state {
        union acpi_parse_object *predicate_op;
        u8 *aml_predicate_start;        /* Start of if/while predicate */
        u8 *package_end;        /* End of if/while block */
-       u32 loop_count;         /* While() loop counter */
+       u64 loop_timeout;       /* While() loop timeout */
 };
 
 /*
@@ -1218,16 +1218,17 @@ struct acpi_db_method_info {
        acpi_object_type *types;
 
        /*
-        * Arguments to be passed to method for the command
-        * Threads -
-        *   the Number of threads, ID of current thread and
-        *   Index of current thread inside all them created.
+        * Arguments to be passed to method for the commands Threads and
+        * Background. Note, ACPI specifies a maximum of 7 arguments (0 - 6).
+        *
+        * For the Threads command, the Number of threads, ID of current
+        * thread and Index of current thread inside all them created.
         */
        char init_args;
 #ifdef ACPI_DEBUGGER
-       acpi_object_type arg_types[4];
+       acpi_object_type arg_types[ACPI_METHOD_NUM_ARGS];
 #endif
-       char *arguments[4];
+       char *arguments[ACPI_METHOD_NUM_ARGS];
        char num_threads_str[11];
        char id_of_thread_str[11];
        char index_of_thread_str[11];
index c7f0c96cc00fcb113fa02f482762ad9dc49fcfd3..128a3d71b5986523bcaa1ec9c33fa351030b96d6 100644 (file)
  * the plist contains a set of parens to allow variable-length lists.
  * These macros are used for both the debug and non-debug versions of the code.
  */
-#define ACPI_ERROR_NAMESPACE(s, e)          acpi_ut_namespace_error (AE_INFO, s, e);
+#define ACPI_ERROR_NAMESPACE(s, p, e)       acpi_ut_prefixed_namespace_error (AE_INFO, s, p, e);
 #define ACPI_ERROR_METHOD(s, n, p, e)       acpi_ut_method_error (AE_INFO, s, n, p, e);
 #define ACPI_WARN_PREDEFINED(plist)         acpi_ut_predefined_warning plist
 #define ACPI_INFO_PREDEFINED(plist)         acpi_ut_predefined_info plist
index 54a0c51b3e37ef7d3ca2856318d3c7740d0fd738..2fb1bb78d85c60c61b274f4eae83cbd8d00a5ea5 100644 (file)
@@ -289,6 +289,9 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node,
 char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node,
                                      u8 no_trailing);
 
+char *acpi_ns_build_prefixed_pathname(union acpi_generic_state *prefix_scope,
+                                     const char *internal_path);
+
 char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
 
 acpi_status
index 83b75e9db7efc88003ffa6de681439e6bfa61b2d..b6b29d717824615dd2fe018db837b0e075ea5866 100644 (file)
@@ -118,9 +118,6 @@ extern const char *acpi_gbl_ptyp_decode[];
 #ifndef ACPI_MSG_ERROR
 #define ACPI_MSG_ERROR          "ACPI Error: "
 #endif
-#ifndef ACPI_MSG_EXCEPTION
-#define ACPI_MSG_EXCEPTION      "ACPI Exception: "
-#endif
 #ifndef ACPI_MSG_WARNING
 #define ACPI_MSG_WARNING        "ACPI Warning: "
 #endif
@@ -129,10 +126,10 @@ extern const char *acpi_gbl_ptyp_decode[];
 #endif
 
 #ifndef ACPI_MSG_BIOS_ERROR
-#define ACPI_MSG_BIOS_ERROR     "ACPI BIOS Error (bug): "
+#define ACPI_MSG_BIOS_ERROR     "Firmware Error (ACPI): "
 #endif
 #ifndef ACPI_MSG_BIOS_WARNING
-#define ACPI_MSG_BIOS_WARNING   "ACPI BIOS Warning (bug): "
+#define ACPI_MSG_BIOS_WARNING   "Firmware Warning (ACPI): "
 #endif
 
 /*
@@ -233,10 +230,10 @@ u64 acpi_ut_implicit_strtoul64(char *string);
  */
 acpi_status acpi_ut_init_globals(void);
 
-#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
-
 const char *acpi_ut_get_mutex_name(u32 mutex_id);
 
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
 const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type);
 #endif
 
@@ -641,9 +638,11 @@ void ut_convert_backslashes(char *pathname);
 
 void acpi_ut_repair_name(char *name);
 
-#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
+#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) || defined (ACPI_DEBUG_OUTPUT)
 u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source);
 
+void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size);
+
 u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source);
 
 u8
@@ -737,9 +736,11 @@ acpi_ut_predefined_bios_error(const char *module_name,
                              u8 node_flags, const char *format, ...);
 
 void
-acpi_ut_namespace_error(const char *module_name,
-                       u32 line_number,
-                       const char *internal_name, acpi_status lookup_status);
+acpi_ut_prefixed_namespace_error(const char *module_name,
+                                u32 line_number,
+                                union acpi_generic_state *prefix_scope,
+                                const char *internal_name,
+                                acpi_status lookup_status);
 
 void
 acpi_ut_method_error(const char *module_name,
index 3b30319752f046e4a8f20782d6a59596b575ccbd..ed088fceb18d3c98b8bb59d1903186ad991afb30 100644 (file)
@@ -67,6 +67,8 @@ static acpi_status
 acpi_db_execution_walk(acpi_handle obj_handle,
                       u32 nesting_level, void *context, void **return_value);
 
+static void ACPI_SYSTEM_XFACE acpi_db_single_execution_thread(void *context);
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_db_delete_objects
@@ -229,7 +231,7 @@ static acpi_status acpi_db_execute_setup(struct acpi_db_method_info *info)
 
        ACPI_FUNCTION_NAME(db_execute_setup);
 
-       /* Catenate the current scope to the supplied name */
+       /* Concatenate the current scope to the supplied name */
 
        info->pathname[0] = 0;
        if ((info->name[0] != '\\') && (info->name[0] != '/')) {
@@ -609,6 +611,112 @@ static void ACPI_SYSTEM_XFACE acpi_db_method_thread(void *context)
        }
 }
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_db_single_execution_thread
+ *
+ * PARAMETERS:  context                 - Method info struct
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Create one thread and execute a method
+ *
+ ******************************************************************************/
+
+static void ACPI_SYSTEM_XFACE acpi_db_single_execution_thread(void *context)
+{
+       struct acpi_db_method_info *info = context;
+       acpi_status status;
+       struct acpi_buffer return_obj;
+
+       acpi_os_printf("\n");
+
+       status = acpi_db_execute_method(info, &return_obj);
+       if (ACPI_FAILURE(status)) {
+               acpi_os_printf("%s During evaluation of %s\n",
+                              acpi_format_exception(status), info->pathname);
+               return;
+       }
+
+       /* Display a return object, if any */
+
+       if (return_obj.length) {
+               acpi_os_printf("Evaluation of %s returned object %p, "
+                              "external buffer length %X\n",
+                              acpi_gbl_db_method_info.pathname,
+                              return_obj.pointer, (u32)return_obj.length);
+
+               acpi_db_dump_external_object(return_obj.pointer, 1);
+       }
+
+       acpi_os_printf("\nBackground thread completed\n%c ",
+                      ACPI_DEBUGGER_COMMAND_PROMPT);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_db_create_execution_thread
+ *
+ * PARAMETERS:  method_name_arg         - Control method to execute
+ *              arguments               - Array of arguments to the method
+ *              types                   - Corresponding array of object types
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Create a single thread to evaluate a namespace object. Handles
+ *              arguments passed on command line for control methods.
+ *
+ ******************************************************************************/
+
+void
+acpi_db_create_execution_thread(char *method_name_arg,
+                               char **arguments, acpi_object_type *types)
+{
+       acpi_status status;
+       u32 i;
+
+       memset(&acpi_gbl_db_method_info, 0, sizeof(struct acpi_db_method_info));
+       acpi_gbl_db_method_info.name = method_name_arg;
+       acpi_gbl_db_method_info.init_args = 1;
+       acpi_gbl_db_method_info.args = acpi_gbl_db_method_info.arguments;
+       acpi_gbl_db_method_info.types = acpi_gbl_db_method_info.arg_types;
+
+       /* Setup method arguments, up to 7 (0-6) */
+
+       for (i = 0; (i < ACPI_METHOD_NUM_ARGS) && *arguments; i++) {
+               acpi_gbl_db_method_info.arguments[i] = *arguments;
+               arguments++;
+
+               acpi_gbl_db_method_info.arg_types[i] = *types;
+               types++;
+       }
+
+       status = acpi_db_execute_setup(&acpi_gbl_db_method_info);
+       if (ACPI_FAILURE(status)) {
+               return;
+       }
+
+       /* Get the NS node, determines existence also */
+
+       status = acpi_get_handle(NULL, acpi_gbl_db_method_info.pathname,
+                                &acpi_gbl_db_method_info.method);
+       if (ACPI_FAILURE(status)) {
+               acpi_os_printf("%s Could not get handle for %s\n",
+                              acpi_format_exception(status),
+                              acpi_gbl_db_method_info.pathname);
+               return;
+       }
+
+       status = acpi_os_execute(OSL_DEBUGGER_EXEC_THREAD,
+                                acpi_db_single_execution_thread,
+                                &acpi_gbl_db_method_info);
+       if (ACPI_FAILURE(status)) {
+               return;
+       }
+
+       acpi_os_printf("\nBackground thread started\n");
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_db_create_execution_threads
index 4d81ea291d9388c391de2dd3c74c82523ef2e5b9..cf9607945704cf438d1449141f7acad3c5385dfa 100644 (file)
@@ -99,8 +99,8 @@ void acpi_db_open_debug_file(char *name)
        }
 
        acpi_os_printf("Debug output file %s opened\n", name);
-       strncpy(acpi_gbl_db_debug_filename, name,
-               sizeof(acpi_gbl_db_debug_filename));
+       acpi_ut_safe_strncpy(acpi_gbl_db_debug_filename, name,
+                            sizeof(acpi_gbl_db_debug_filename));
        acpi_gbl_db_output_to_file = TRUE;
 }
 #endif
index 2626d79db064efa6a93516a7f23e7b16326c6817..954ca3b981a73286ef1953defd11dc9a2ba8d851 100644 (file)
@@ -136,6 +136,7 @@ enum acpi_ex_debugger_commands {
        CMD_UNLOAD,
 
        CMD_TERMINATE,
+       CMD_BACKGROUND,
        CMD_THREADS,
 
        CMD_TEST,
@@ -212,6 +213,7 @@ static const struct acpi_db_command_info acpi_gbl_db_commands[] = {
        {"UNLOAD", 1},
 
        {"TERMINATE", 0},
+       {"BACKGROUND", 1},
        {"THREADS", 3},
 
        {"TEST", 1},
@@ -222,9 +224,56 @@ static const struct acpi_db_command_info acpi_gbl_db_commands[] = {
 /*
  * Help for all debugger commands. First argument is the number of lines
  * of help to output for the command.
+ *
+ * Note: Some commands are not supported by the kernel-level version of
+ * the debugger.
  */
 static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
-       {0, "\nGeneral-Purpose Commands:", "\n"},
+       {0, "\nNamespace Access:", "\n"},
+       {1, "  Businfo", "Display system bus info\n"},
+       {1, "  Disassemble <Method>", "Disassemble a control method\n"},
+       {1, "  Find <AcpiName> (? is wildcard)",
+        "Find ACPI name(s) with wildcards\n"},
+       {1, "  Integrity", "Validate namespace integrity\n"},
+       {1, "  Methods", "Display list of loaded control methods\n"},
+       {1, "  Namespace [Object] [Depth]",
+        "Display loaded namespace tree/subtree\n"},
+       {1, "  Notify <Object> <Value>", "Send a notification on Object\n"},
+       {1, "  Objects [ObjectType]",
+        "Display summary of all objects or just given type\n"},
+       {1, "  Owner <OwnerId> [Depth]",
+        "Display loaded namespace by object owner\n"},
+       {1, "  Paths", "Display full pathnames of namespace objects\n"},
+       {1, "  Predefined", "Check all predefined names\n"},
+       {1, "  Prefix [<Namepath>]", "Set or Get current execution prefix\n"},
+       {1, "  References <Addr>", "Find all references to object at addr\n"},
+       {1, "  Resources [DeviceName]",
+        "Display Device resources (no arg = all devices)\n"},
+       {1, "  Set N <NamedObject> <Value>", "Set value for named integer\n"},
+       {1, "  Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
+       {1, "  Type <Object>", "Display object type\n"},
+
+       {0, "\nControl Method Execution:", "\n"},
+       {1, "  Evaluate <Namepath> [Arguments]",
+        "Evaluate object or control method\n"},
+       {1, "  Execute <Namepath> [Arguments]", "Synonym for Evaluate\n"},
+#ifdef ACPI_APPLICATION
+       {1, "  Background <Namepath> [Arguments]",
+        "Evaluate object/method in a separate thread\n"},
+       {1, "  Thread <Threads><Loops><NamePath>",
+        "Spawn threads to execute method(s)\n"},
+#endif
+       {1, "  Debug <Namepath> [Arguments]", "Single-Step a control method\n"},
+       {7, "  [Arguments] formats:", "Control method argument formats\n"},
+       {1, "     Hex Integer", "Integer\n"},
+       {1, "     \"Ascii String\"", "String\n"},
+       {1, "     (Hex Byte List)", "Buffer\n"},
+       {1, "         (01 42 7A BF)", "Buffer example (4 bytes)\n"},
+       {1, "     [Package Element List]", "Package\n"},
+       {1, "         [0x01 0x1234 \"string\"]",
+        "Package example (3 elements)\n"},
+
+       {0, "\nMiscellaneous:", "\n"},
        {1, "  Allocations", "Display list of current memory allocations\n"},
        {2, "  Dump <Address>|<Namepath>", "\n"},
        {0, "       [Byte|Word|Dword|Qword]",
@@ -248,46 +297,30 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
        {1, "     Stack", "Display CPU stack usage\n"},
        {1, "     Tables", "Info about current ACPI table(s)\n"},
        {1, "  Tables", "Display info about loaded ACPI tables\n"},
+#ifdef ACPI_APPLICATION
+       {1, "  Terminate", "Delete namespace and all internal objects\n"},
+#endif
        {1, "  ! <CommandNumber>", "Execute command from history buffer\n"},
        {1, "  !!", "Execute last command again\n"},
 
-       {0, "\nNamespace Access Commands:", "\n"},
-       {1, "  Businfo", "Display system bus info\n"},
-       {1, "  Disassemble <Method>", "Disassemble a control method\n"},
-       {1, "  Find <AcpiName> (? is wildcard)",
-        "Find ACPI name(s) with wildcards\n"},
-       {1, "  Integrity", "Validate namespace integrity\n"},
-       {1, "  Methods", "Display list of loaded control methods\n"},
-       {1, "  Namespace [Object] [Depth]",
-        "Display loaded namespace tree/subtree\n"},
-       {1, "  Notify <Object> <Value>", "Send a notification on Object\n"},
-       {1, "  Objects [ObjectType]",
-        "Display summary of all objects or just given type\n"},
-       {1, "  Owner <OwnerId> [Depth]",
-        "Display loaded namespace by object owner\n"},
-       {1, "  Paths", "Display full pathnames of namespace objects\n"},
-       {1, "  Predefined", "Check all predefined names\n"},
-       {1, "  Prefix [<Namepath>]", "Set or Get current execution prefix\n"},
-       {1, "  References <Addr>", "Find all references to object at addr\n"},
-       {1, "  Resources [DeviceName]",
-        "Display Device resources (no arg = all devices)\n"},
-       {1, "  Set N <NamedObject> <Value>", "Set value for named integer\n"},
-       {1, "  Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
-       {1, "  Type <Object>", "Display object type\n"},
+       {0, "\nMethod and Namespace Debugging:", "\n"},
+       {5, "  Trace <State> [<Namepath>] [Once]",
+        "Trace control method execution\n"},
+       {1, "     Enable", "Enable all messages\n"},
+       {1, "     Disable", "Disable tracing\n"},
+       {1, "     Method", "Enable method execution messages\n"},
+       {1, "     Opcode", "Enable opcode execution messages\n"},
+       {3, "  Test <TestName>", "Invoke a debug test\n"},
+       {1, "     Objects", "Read/write/compare all namespace data objects\n"},
+       {1, "     Predefined",
+        "Validate all ACPI predefined names (_STA, etc.)\n"},
+       {1, "  Execute predefined",
+        "Execute all predefined (public) methods\n"},
 
-       {0, "\nControl Method Execution Commands:", "\n"},
+       {0, "\nControl Method Single-Step Execution:", "\n"},
        {1, "  Arguments (or Args)", "Display method arguments\n"},
        {1, "  Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"},
        {1, "  Call", "Run to next control method invocation\n"},
-       {1, "  Debug <Namepath> [Arguments]", "Single Step a control method\n"},
-       {6, "  Evaluate", "Synonym for Execute\n"},
-       {5, "  Execute <Namepath> [Arguments]", "Execute control method\n"},
-       {1, "     Hex Integer", "Integer method argument\n"},
-       {1, "     \"Ascii String\"", "String method argument\n"},
-       {1, "     (Hex Byte List)", "Buffer method argument\n"},
-       {1, "     [Package Element List]", "Package method argument\n"},
-       {5, "  Execute predefined",
-        "Execute all predefined (public) methods\n"},
        {1, "  Go", "Allow method to run to completion\n"},
        {1, "  Information", "Display info about the current method\n"},
        {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[] = {
        {1, "  Results", "Display method result stack\n"},
        {1, "  Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"},
        {1, "  Stop", "Terminate control method\n"},
-       {5, "  Trace <State> [<Namepath>] [Once]",
-        "Trace control method execution\n"},
-       {1, "     Enable", "Enable all messages\n"},
-       {1, "     Disable", "Disable tracing\n"},
-       {1, "     Method", "Enable method execution messages\n"},
-       {1, "     Opcode", "Enable opcode execution messages\n"},
        {1, "  Tree", "Display control method calling tree\n"},
        {1, "  <Enter>", "Single step next AML opcode (over calls)\n"},
 
 #ifdef ACPI_APPLICATION
-       {0, "\nHardware Simulation Commands:", "\n"},
-       {1, "  EnableAcpi", "Enable ACPI (hardware) mode\n"},
-       {1, "  Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
-       {1, "  Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"},
-       {1, "  Gpes", "Display info on all GPE devices\n"},
-       {1, "  Sci", "Generate an SCI\n"},
-       {1, "  Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
-
-       {0, "\nFile I/O Commands:", "\n"},
+       {0, "\nFile Operations:", "\n"},
        {1, "  Close", "Close debug output file\n"},
        {1, "  Load <Input Filename>", "Load ACPI table from a file\n"},
        {1, "  Open <Output Filename>", "Open a file for debug output\n"},
        {1, "  Unload <Namepath>",
         "Unload an ACPI table via namespace object\n"},
 
-       {0, "\nUser Space Commands:", "\n"},
-       {1, "  Terminate", "Delete namespace and all internal objects\n"},
-       {1, "  Thread <Threads><Loops><NamePath>",
-        "Spawn threads to execute method(s)\n"},
-
-       {0, "\nDebug Test Commands:", "\n"},
-       {3, "  Test <TestName>", "Invoke a debug test\n"},
-       {1, "     Objects", "Read/write/compare all namespace data objects\n"},
-       {1, "     Predefined",
-        "Execute all ACPI predefined names (_STA, etc.)\n"},
+       {0, "\nHardware Simulation:", "\n"},
+       {1, "  EnableAcpi", "Enable ACPI (hardware) mode\n"},
+       {1, "  Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
+       {1, "  Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"},
+       {1, "  Gpes", "Display info on all GPE devices\n"},
+       {1, "  Sci", "Generate an SCI\n"},
+       {1, "  Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
 #endif
        {0, NULL, NULL}
 };
@@ -442,11 +458,15 @@ static void acpi_db_display_help(char *command)
 
                /* No argument to help, display help for all commands */
 
+               acpi_os_printf("\nSummary of AML Debugger Commands\n\n");
+
                while (next->invocation) {
                        acpi_os_printf("%-38s%s", next->invocation,
                                       next->description);
                        next++;
                }
+               acpi_os_printf("\n");
+
        } else {
                /* Display help for all commands that match the subtring */
 
@@ -1087,6 +1107,13 @@ acpi_db_command_dispatch(char *input_buffer,
                /*  acpi_initialize (NULL); */
                break;
 
+       case CMD_BACKGROUND:
+
+               acpi_db_create_execution_thread(acpi_gbl_db_args[1],
+                                               &acpi_gbl_db_args[2],
+                                               &acpi_gbl_db_arg_types[2]);
+               break;
+
        case CMD_THREADS:
 
                acpi_db_create_execution_threads(acpi_gbl_db_args[1],
index f470e81b0499789f63bba32b7e2ae617a169f646..4b6ebc2a28510432a661c95de26a989e459e7cbf 100644 (file)
@@ -118,6 +118,8 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
                control_state->control.package_end =
                    walk_state->parser_state.pkg_end;
                control_state->control.opcode = op->common.aml_opcode;
+               control_state->control.loop_timeout = acpi_os_get_timer() +
+                   (u64)(acpi_gbl_max_loop_iterations * ACPI_100NSEC_PER_SEC);
 
                /* Push the control state on this walk's control stack */
 
@@ -206,15 +208,15 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state,
                        /* Predicate was true, the body of the loop was just executed */
 
                        /*
-                        * This loop counter mechanism allows the interpreter to escape
-                        * possibly infinite loops. This can occur in poorly written AML
-                        * when the hardware does not respond within a while loop and the
-                        * loop does not implement a timeout.
+                        * This infinite loop detection mechanism allows the interpreter
+                        * to escape possibly infinite loops. This can occur in poorly
+                        * written AML when the hardware does not respond within a while
+                        * loop and the loop does not implement a timeout.
                         */
-                       control_state->control.loop_count++;
-                       if (control_state->control.loop_count >
-                           acpi_gbl_max_loop_iterations) {
-                               status = AE_AML_INFINITE_LOOP;
+                       if (ACPI_TIME_AFTER(acpi_os_get_timer(),
+                                           control_state->control.
+                                           loop_timeout)) {
+                               status = AE_AML_LOOP_TIMEOUT;
                                break;
                        }
 
index 7bcf5f5ea0297ffcec2cbd39b9171e4ba93afd50..0cab34a593d504a77c70221bde482232c83bd0ad 100644 (file)
@@ -209,7 +209,8 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
                                        ACPI_IMODE_LOAD_PASS1, flags,
                                        walk_state, &node);
                if (ACPI_FAILURE(status)) {
-                       ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
+                       ACPI_ERROR_NAMESPACE(walk_state->scope_info,
+                                            arg->common.value.string, status);
                        return_ACPI_STATUS(status);
                }
        }
@@ -383,7 +384,9 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
                                                        walk_state,
                                                        &info->connection_node);
                                if (ACPI_FAILURE(status)) {
-                                       ACPI_ERROR_NAMESPACE(child->common.
+                                       ACPI_ERROR_NAMESPACE(walk_state->
+                                                            scope_info,
+                                                            child->common.
                                                             value.name,
                                                             status);
                                        return_ACPI_STATUS(status);
@@ -402,7 +405,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
                                                ACPI_NS_DONT_OPEN_SCOPE,
                                                walk_state, &info->field_node);
                        if (ACPI_FAILURE(status)) {
-                               ACPI_ERROR_NAMESPACE((char *)&arg->named.name,
+                               ACPI_ERROR_NAMESPACE(walk_state->scope_info,
+                                                    (char *)&arg->named.name,
                                                     status);
                                return_ACPI_STATUS(status);
                        } else {
@@ -498,7 +502,8 @@ acpi_ds_create_field(union acpi_parse_object *op,
                                                        &region_node);
 #endif
                if (ACPI_FAILURE(status)) {
-                       ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
+                       ACPI_ERROR_NAMESPACE(walk_state->scope_info,
+                                            arg->common.value.name, status);
                        return_ACPI_STATUS(status);
                }
        }
@@ -618,7 +623,8 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
                                                ACPI_IMODE_LOAD_PASS1, flags,
                                                walk_state, &node);
                        if (ACPI_FAILURE(status)) {
-                               ACPI_ERROR_NAMESPACE((char *)&arg->named.name,
+                               ACPI_ERROR_NAMESPACE(walk_state->scope_info,
+                                                    (char *)&arg->named.name,
                                                     status);
                                if (status != AE_ALREADY_EXISTS) {
                                        return_ACPI_STATUS(status);
@@ -681,7 +687,8 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
                                                        &region_node);
 #endif
                if (ACPI_FAILURE(status)) {
-                       ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
+                       ACPI_ERROR_NAMESPACE(walk_state->scope_info,
+                                            arg->common.value.name, status);
                        return_ACPI_STATUS(status);
                }
        }
@@ -695,7 +702,8 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
                           ACPI_NS_SEARCH_PARENT, walk_state,
                           &info.register_node);
        if (ACPI_FAILURE(status)) {
-               ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
+               ACPI_ERROR_NAMESPACE(walk_state->scope_info,
+                                    arg->common.value.string, status);
                return_ACPI_STATUS(status);
        }
 
@@ -765,7 +773,8 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
                           ACPI_NS_SEARCH_PARENT, walk_state,
                           &info.register_node);
        if (ACPI_FAILURE(status)) {
-               ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
+               ACPI_ERROR_NAMESPACE(walk_state->scope_info,
+                                    arg->common.value.string, status);
                return_ACPI_STATUS(status);
        }
 
@@ -778,7 +787,8 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
                           ACPI_NS_SEARCH_PARENT, walk_state,
                           &info.data_register_node);
        if (ACPI_FAILURE(status)) {
-               ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
+               ACPI_ERROR_NAMESPACE(walk_state->scope_info,
+                                    arg->common.value.string, status);
                return_ACPI_STATUS(status);
        }
 
index 82448551781b43bf3d276df6ee9378416cb2a08b..b21fe084ffc8cd2937a4059b4237bd99d17f01aa 100644 (file)
@@ -112,7 +112,9 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
                                                         acpi_namespace_node,
                                                         &(op->common.node)));
                                if (ACPI_FAILURE(status)) {
-                                       ACPI_ERROR_NAMESPACE(op->common.value.
+                                       ACPI_ERROR_NAMESPACE(walk_state->
+                                                            scope_info,
+                                                            op->common.value.
                                                             string, status);
                                        return_ACPI_STATUS(status);
                                }
index 6d487edfe2de3471186122cef5579d4c7d511184..5a602b75084ef861a77bda7fe0a7dfb696e3cf42 100644 (file)
@@ -297,8 +297,10 @@ acpi_ds_init_package_element(u8 object_type,
 {
        union acpi_operand_object **element_ptr;
 
+       ACPI_FUNCTION_TRACE(ds_init_package_element);
+
        if (!source_object) {
-               return (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /*
@@ -329,7 +331,7 @@ acpi_ds_init_package_element(u8 object_type,
                source_object->package.flags |= AOPOBJ_DATA_VALID;
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
 /*******************************************************************************
@@ -352,6 +354,7 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
        union acpi_generic_state scope_info;
        union acpi_operand_object *element = *element_ptr;
        struct acpi_namespace_node *resolved_node;
+       struct acpi_namespace_node *original_node;
        char *external_path = NULL;
        acpi_object_type type;
 
@@ -441,6 +444,7 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
         * will remain as named references. This behavior is not described
         * in the ACPI spec, but it appears to be an oversight.
         */
+       original_node = resolved_node;
        status = acpi_ex_resolve_node_to_value(&resolved_node, NULL);
        if (ACPI_FAILURE(status)) {
                return_VOID;
@@ -468,26 +472,27 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
                 */
        case ACPI_TYPE_DEVICE:
        case ACPI_TYPE_THERMAL:
-
-               /* TBD: This may not be necesssary */
-
-               acpi_ut_add_reference(resolved_node->object);
+       case ACPI_TYPE_METHOD:
                break;
 
        case ACPI_TYPE_MUTEX:
-       case ACPI_TYPE_METHOD:
        case ACPI_TYPE_POWER:
        case ACPI_TYPE_PROCESSOR:
        case ACPI_TYPE_EVENT:
        case ACPI_TYPE_REGION:
 
+               /* acpi_ex_resolve_node_to_value gave these an extra reference */
+
+               acpi_ut_remove_reference(original_node->object);
                break;
 
        default:
                /*
                 * For all other types - the node was resolved to an actual
-                * operand object with a value, return the object
+                * operand object with a value, return the object. Remove
+                * a reference on the existing object.
                 */
+               acpi_ut_remove_reference(element);
                *element_ptr = (union acpi_operand_object *)resolved_node;
                break;
        }
index 0dabd9b95684c9fd527f163606de9a9a24f09e46..4c5faf629a83187a760298a7f7f7803435df150c 100644 (file)
@@ -583,7 +583,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
                        }
 
                        if (ACPI_FAILURE(status)) {
-                               ACPI_ERROR_NAMESPACE(name_string, status);
+                               ACPI_ERROR_NAMESPACE(walk_state->scope_info,
+                                                    name_string, status);
                        }
                }
 
index eaa859a89702a2290d62e87ecf5ef9131afe708a..5771e4e4a99af2c9b98650e3b87af093034b2901 100644 (file)
@@ -207,7 +207,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
                }
 #endif
                if (ACPI_FAILURE(status)) {
-                       ACPI_ERROR_NAMESPACE(path, status);
+                       ACPI_ERROR_NAMESPACE(walk_state->scope_info, path,
+                                            status);
                        return_ACPI_STATUS(status);
                }
 
@@ -375,7 +376,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
                        }
 
                        if (ACPI_FAILURE(status)) {
-                               ACPI_ERROR_NAMESPACE(path, status);
+                               ACPI_ERROR_NAMESPACE(walk_state->scope_info,
+                                                    path, status);
                                return_ACPI_STATUS(status);
                        }
                }
index aad83ef5a4ecb6529906e4fa132c31a38be018c6..b3d0aaec8203a063f3bc051375e67b849c350fa2 100644 (file)
@@ -184,11 +184,14 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
                                if (status == AE_NOT_FOUND) {
                                        status = AE_OK;
                                } else {
-                                       ACPI_ERROR_NAMESPACE(buffer_ptr,
+                                       ACPI_ERROR_NAMESPACE(walk_state->
+                                                            scope_info,
+                                                            buffer_ptr,
                                                             status);
                                }
 #else
-                               ACPI_ERROR_NAMESPACE(buffer_ptr, status);
+                               ACPI_ERROR_NAMESPACE(walk_state->scope_info,
+                                                    buffer_ptr, status);
 #endif
                                return_ACPI_STATUS(status);
                        }
@@ -343,7 +346,8 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
        }
 
        if (ACPI_FAILURE(status)) {
-               ACPI_ERROR_NAMESPACE(buffer_ptr, status);
+               ACPI_ERROR_NAMESPACE(walk_state->scope_info,
+                                    buffer_ptr, status);
                return_ACPI_STATUS(status);
        }
 
@@ -719,7 +723,8 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
                         */
                        op->common.node = new_node;
                } else {
-                       ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
+                       ACPI_ERROR_NAMESPACE(walk_state->scope_info,
+                                            arg->common.value.string, status);
                }
                break;
 
index 28b447ff92df6ef7803026ca99a22d974729109a..bb58419f0d610e559eca0ed93458241acaa5af81 100644 (file)
@@ -298,6 +298,16 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                ACPI_EXCEPTION((AE_INFO, status, "Returned by Handler for [%s]",
                                acpi_ut_get_region_name(region_obj->region.
                                                        space_id)));
+
+               /*
+                * Special case for an EC timeout. These are seen so frequently
+                * that an additional error message is helpful
+                */
+               if ((region_obj->region.space_id == ACPI_ADR_SPACE_EC) &&
+                   (status == AE_TIME)) {
+                       ACPI_ERROR((AE_INFO,
+                                   "Timeout from EC hardware or EC device driver"));
+               }
        }
 
        if (!(handler_desc->address_space.handler_flags &
index 83398dc4b7c288fbe8ecac3b98f3b5bb55efefc5..b2ff61bdb9a8fe603f9d3b0cb15eef9355f636a2 100644 (file)
@@ -617,10 +617,11 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
        u32 length;
        u32 index;
 
-       ACPI_FUNCTION_NAME(ex_dump_operand)
+       ACPI_FUNCTION_NAME(ex_dump_operand);
 
-           /* Check if debug output enabled */
-           if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_EXEC, _COMPONENT)) {
+       /* Check if debug output enabled */
+
+       if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_EXEC, _COMPONENT)) {
                return;
        }
 
@@ -904,7 +905,7 @@ void
 acpi_ex_dump_operands(union acpi_operand_object **operands,
                      const char *opcode_name, u32 num_operands)
 {
-       ACPI_FUNCTION_NAME(ex_dump_operands);
+       ACPI_FUNCTION_TRACE(ex_dump_operands);
 
        if (!opcode_name) {
                opcode_name = "UNKNOWN";
@@ -928,7 +929,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands,
 
        ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
                          "**** End operand dump for [%s]\n", opcode_name));
-       return;
+       return_VOID;
 }
 
 /*******************************************************************************
index a2f4e25d45b18e5c241a02890d3302256b68c0d0..5b4282902a839df2e0f1f49b2960ba8fa098194e 100644 (file)
@@ -150,10 +150,10 @@ ACPI_EXPORT_SYMBOL(acpi_get_timer)
  *
  ******************************************************************************/
 acpi_status
-acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
+acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 *time_elapsed)
 {
        acpi_status status;
-       u32 delta_ticks;
+       u64 delta_ticks;
        u64 quotient;
 
        ACPI_FUNCTION_TRACE(acpi_get_timer_duration);
@@ -168,30 +168,29 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
                return_ACPI_STATUS(AE_SUPPORT);
        }
 
+       if (start_ticks == end_ticks) {
+               *time_elapsed = 0;
+               return_ACPI_STATUS(AE_OK);
+       }
+
        /*
         * Compute Tick Delta:
         * Handle (max one) timer rollovers on 24-bit versus 32-bit timers.
         */
-       if (start_ticks < end_ticks) {
-               delta_ticks = end_ticks - start_ticks;
-       } else if (start_ticks > end_ticks) {
+       delta_ticks = end_ticks;
+       if (start_ticks > end_ticks) {
                if ((acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) == 0) {
 
                        /* 24-bit Timer */
 
-                       delta_ticks =
-                           (((0x00FFFFFF - start_ticks) +
-                             end_ticks) & 0x00FFFFFF);
+                       delta_ticks |= (u64)1 << 24;
                } else {
                        /* 32-bit Timer */
 
-                       delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks;
+                       delta_ticks |= (u64)1 << 32;
                }
-       } else {                /* start_ticks == end_ticks */
-
-               *time_elapsed = 0;
-               return_ACPI_STATUS(AE_OK);
        }
+       delta_ticks -= start_ticks;
 
        /*
         * 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)
         * time_elapsed (microseconds) =
         *  (delta_ticks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY;
         */
-       status = acpi_ut_short_divide(((u64)delta_ticks) * ACPI_USEC_PER_SEC,
+       status = acpi_ut_short_divide(delta_ticks * ACPI_USEC_PER_SEC,
                                      ACPI_PM_TIMER_FREQUENCY, &quotient, NULL);
 
-       *time_elapsed = (u32) quotient;
+       *time_elapsed = (u32)quotient;
        return_ACPI_STATUS(status);
 }
 
index 3094cec4eab47aea503dfbadd55a019cc971ecce..d1679035d5f31bb9ec17b39f5bad61a410af98a2 100644 (file)
@@ -128,14 +128,14 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
        acpi_io_address last_address;
        const struct acpi_port_info *port_info;
 
-       ACPI_FUNCTION_NAME(hw_validate_io_request);
+       ACPI_FUNCTION_TRACE(hw_validate_io_request);
 
        /* Supported widths are 8/16/32 */
 
        if ((bit_width != 8) && (bit_width != 16) && (bit_width != 32)) {
                ACPI_ERROR((AE_INFO,
                            "Bad BitWidth parameter: %8.8X", bit_width));
-               return (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        port_info = acpi_protected_ports;
@@ -153,13 +153,13 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
                ACPI_ERROR((AE_INFO,
                            "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X",
                            ACPI_FORMAT_UINT64(address), byte_width));
-               return (AE_LIMIT);
+               return_ACPI_STATUS(AE_LIMIT);
        }
 
        /* Exit if requested address is not within the protected port table */
 
        if (address > acpi_protected_ports[ACPI_PORT_INFO_ENTRIES - 1].end) {
-               return (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* 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)
                        /* Port illegality may depend on the _OSI calls made by the BIOS */
 
                        if (acpi_gbl_osi_data >= port_info->osi_dependency) {
-                               ACPI_DEBUG_PRINT((ACPI_DB_IO,
-                                                 "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)",
+                               ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
+                                                 "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)\n",
                                                  ACPI_FORMAT_UINT64(address),
                                                  byte_width, port_info->name,
                                                  port_info->start,
@@ -198,7 +198,7 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
                }
        }
 
-       return (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
 /******************************************************************************
index f2733f51ca8d12bebda8eff34323d7393b1bf3be..33e652a12fca53b4920e127b08bf21f345d32203 100644 (file)
@@ -644,17 +644,18 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
                                            this_node->object;
                                }
                        }
-#ifdef ACPI_ASL_COMPILER
-                       if (!acpi_gbl_disasm_flag &&
-                           (this_node->flags & ANOBJ_IS_EXTERNAL)) {
-                               this_node->flags |= IMPLICIT_EXTERNAL;
-                       }
-#endif
                }
 
                /* Special handling for the last segment (num_segments == 0) */
 
                else {
+#ifdef ACPI_ASL_COMPILER
+                       if (!acpi_gbl_disasm_flag
+                           && (this_node->flags & ANOBJ_IS_EXTERNAL)) {
+                               this_node->flags &= ~IMPLICIT_EXTERNAL;
+                       }
+#endif
+
                        /*
                         * Sanity typecheck of the target object:
                         *
index 539d775bbc92344ae719e0e1da38dbed9580419a..d55dcc82f4348f92d5e29c9ba899aa3d18c92f45 100644 (file)
@@ -495,7 +495,8 @@ acpi_ns_convert_to_reference(struct acpi_namespace_node *scope,
 
                /* Check if we are resolving a named reference within a package */
 
-               ACPI_ERROR_NAMESPACE(original_object->string.pointer, status);
+               ACPI_ERROR_NAMESPACE(&scope_info,
+                                    original_object->string.pointer, status);
                goto error_exit;
        }
 
index a410760a03089f63c8a9a4b9b26c6e44bffe7583..22c92d1a24d8f8e48567b5c06c5540e67da4b456 100644 (file)
@@ -49,6 +49,9 @@
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsnames")
 
+/* Local Prototypes */
+static void acpi_ns_normalize_pathname(char *original_path);
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_external_pathname
@@ -63,6 +66,7 @@ ACPI_MODULE_NAME("nsnames")
  *              for error and debug statements.
  *
  ******************************************************************************/
+
 char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
 {
        char *name_buffer;
@@ -352,3 +356,148 @@ char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node,
 
        return_PTR(name_buffer);
 }
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_build_prefixed_pathname
+ *
+ * PARAMETERS:  prefix_scope        - Scope/Path that prefixes the internal path
+ *              internal_path       - Name or path of the namespace node
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Construct a fully qualified pathname from a concatenation of:
+ *              1) Path associated with the prefix_scope namespace node
+ *              2) External path representation of the Internal path
+ *
+ ******************************************************************************/
+
+char *acpi_ns_build_prefixed_pathname(union acpi_generic_state *prefix_scope,
+                                     const char *internal_path)
+{
+       acpi_status status;
+       char *full_path = NULL;
+       char *external_path = NULL;
+       char *prefix_path = NULL;
+       u32 prefix_path_length = 0;
+
+       /* If there is a prefix, get the pathname to it */
+
+       if (prefix_scope && prefix_scope->scope.node) {
+               prefix_path =
+                   acpi_ns_get_normalized_pathname(prefix_scope->scope.node,
+                                                   TRUE);
+               if (prefix_path) {
+                       prefix_path_length = strlen(prefix_path);
+               }
+       }
+
+       status = acpi_ns_externalize_name(ACPI_UINT32_MAX, internal_path,
+                                         NULL, &external_path);
+       if (ACPI_FAILURE(status)) {
+               goto cleanup;
+       }
+
+       /* Merge the prefix path and the path. 2 is for one dot and trailing null */
+
+       full_path =
+           ACPI_ALLOCATE_ZEROED(prefix_path_length + strlen(external_path) +
+                                2);
+       if (!full_path) {
+               goto cleanup;
+       }
+
+       /* Don't merge if the External path is already fully qualified */
+
+       if (prefix_path && (*external_path != '\\') && (*external_path != '^')) {
+               strcat(full_path, prefix_path);
+               if (prefix_path[1]) {
+                       strcat(full_path, ".");
+               }
+       }
+
+       acpi_ns_normalize_pathname(external_path);
+       strcat(full_path, external_path);
+
+cleanup:
+       if (prefix_path) {
+               ACPI_FREE(prefix_path);
+       }
+       if (external_path) {
+               ACPI_FREE(external_path);
+       }
+
+       return (full_path);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_normalize_pathname
+ *
+ * PARAMETERS:  original_path       - Path to be normalized, in External format
+ *
+ * RETURN:      The original path is processed in-place
+ *
+ * DESCRIPTION: Remove trailing underscores from each element of a path.
+ *
+ *              For example:  \A___.B___.C___ becomes \A.B.C
+ *
+ ******************************************************************************/
+
+static void acpi_ns_normalize_pathname(char *original_path)
+{
+       char *input_path = original_path;
+       char *new_path_buffer;
+       char *new_path;
+       u32 i;
+
+       /* Allocate a temp buffer in which to construct the new path */
+
+       new_path_buffer = ACPI_ALLOCATE_ZEROED(strlen(input_path) + 1);
+       new_path = new_path_buffer;
+       if (!new_path_buffer) {
+               return;
+       }
+
+       /* Special characters may appear at the beginning of the path */
+
+       if (*input_path == '\\') {
+               *new_path = *input_path;
+               new_path++;
+               input_path++;
+       }
+
+       while (*input_path == '^') {
+               *new_path = *input_path;
+               new_path++;
+               input_path++;
+       }
+
+       /* Remainder of the path */
+
+       while (*input_path) {
+
+               /* Do one nameseg at a time */
+
+               for (i = 0; (i < ACPI_NAME_SIZE) && *input_path; i++) {
+                       if ((i == 0) || (*input_path != '_')) { /* First char is allowed to be underscore */
+                               *new_path = *input_path;
+                               new_path++;
+                       }
+
+                       input_path++;
+               }
+
+               /* Dot means that there are more namesegs to come */
+
+               if (*input_path == '.') {
+                       *new_path = *input_path;
+                       new_path++;
+                       input_path++;
+               }
+       }
+
+       *new_path = 0;
+       strcpy(original_path, new_path_buffer);
+       ACPI_FREE(new_path_buffer);
+}
index 5de8957f5ef025ecb8ba5d16d8c880feffc20eb3..e91dbee9235f3696d661756ddc896c8c4c7611e3 100644 (file)
@@ -417,6 +417,7 @@ acpi_ns_search_and_enter(u32 target_name,
        if (flags & ACPI_NS_EXTERNAL ||
            (walk_state && walk_state->opcode == AML_SCOPE_OP)) {
                new_node->flags |= ANOBJ_IS_EXTERNAL;
+               new_node->flags |= IMPLICIT_EXTERNAL;
        }
 #endif
 
index 783f4c838aee4c1daabdea8ac8d6f21e75060492..9b51f65823b2946893e97cf1d0c9926d0c996e12 100644 (file)
@@ -61,10 +61,10 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info);
  *
  * PARAMETERS:  handle              - Object handle (optional)
  *              pathname            - Object pathname (optional)
- *              external_params     - List of parameters to pass to method,
+ *              external_params     - List of parameters to pass to method,
  *                                    terminated by NULL. May be NULL
  *                                    if no parameters are being passed.
- *              return_buffer       - Where to put method's return value (if
+ *              return_buffer       - Where to put the object's return value (if
  *                                    any). If NULL, no value is returned.
  *              return_type         - Expected type of return object
  *
@@ -100,13 +100,14 @@ acpi_evaluate_object_typed(acpi_handle handle,
                free_buffer_on_error = TRUE;
        }
 
+       /* Get a handle here, in order to build an error message if needed */
+
+       target_handle = handle;
        if (pathname) {
                status = acpi_get_handle(handle, pathname, &target_handle);
                if (ACPI_FAILURE(status)) {
                        return_ACPI_STATUS(status);
                }
-       } else {
-               target_handle = handle;
        }
 
        full_pathname = acpi_ns_get_external_pathname(target_handle);
index eb9dfaca555fe31d0a0c318c682268fa3ffece11..171e2faa7c50640aa82f490fde8bc284ebed2d43 100644 (file)
@@ -361,7 +361,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
        /* Final exception check (may have been changed from code above) */
 
        if (ACPI_FAILURE(status)) {
-               ACPI_ERROR_NAMESPACE(path, status);
+               ACPI_ERROR_NAMESPACE(walk_state->scope_info, path, status);
 
                if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
                    ACPI_PARSE_EXECUTE) {
index 0bef6df71bba9cd0f61b036cbd349e03e0fd1979..c0b179883ff25ffe8e4f5c8789570a76a3e6cd97 100644 (file)
@@ -372,16 +372,10 @@ acpi_ps_create_op(struct acpi_walk_state *walk_state,
                         * external declaration opcode. Setting walk_state->Aml to
                         * walk_state->parser_state.Aml + 2 moves increments the
                         * walk_state->Aml past the object type and the paramcount of the
-                        * external opcode. For the error message, only print the AML
-                        * offset. We could attempt to print the name but this may cause
-                        * a segmentation fault when printing the namepath because the
-                        * AML may be incorrect.
+                        * external opcode.
                         */
-                       acpi_os_printf
-                           ("// Invalid external declaration at AML offset 0x%x.\n",
-                            walk_state->aml -
-                            walk_state->parser_state.aml_start);
                        walk_state->aml = walk_state->parser_state.aml + 2;
+                       walk_state->parser_state.aml = walk_state->aml;
                        return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
                }
 #endif
index 02642760cb93128f77af1e05cc2db489fe0101bd..cd59dfe6a47d9141da6a736162298447d6f17b24 100644 (file)
@@ -94,9 +94,11 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
        op->common.descriptor_type = ACPI_DESC_TYPE_PARSER;
        op->common.aml_opcode = opcode;
 
-       ACPI_DISASM_ONLY_MEMBERS(strncpy(op->common.aml_op_name,
-                                        (acpi_ps_get_opcode_info(opcode))->
-                                        name, sizeof(op->common.aml_op_name)));
+       ACPI_DISASM_ONLY_MEMBERS(acpi_ut_safe_strncpy(op->common.aml_op_name,
+                                                     (acpi_ps_get_opcode_info
+                                                      (opcode))->name,
+                                                     sizeof(op->common.
+                                                            aml_op_name)));
 }
 
 /*******************************************************************************
@@ -158,10 +160,10 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode, u8 *aml)
                if (opcode == AML_SCOPE_OP) {
                        acpi_gbl_current_scope = op;
                }
-       }
 
-       if (gbl_capture_comments) {
-               ASL_CV_TRANSFER_COMMENTS(op);
+               if (acpi_gbl_capture_comments) {
+                       ASL_CV_TRANSFER_COMMENTS(op);
+               }
        }
 
        return (op);
index 615a885e2ca3c6fc276d5eae53793242adbf56b8..cff7154b7feeae988406e4aed2c3518178009563 100644 (file)
@@ -163,6 +163,9 @@ acpi_debug_print(u32 requested_debug_level,
 {
        acpi_thread_id thread_id;
        va_list args;
+#ifdef ACPI_APPLICATION
+       int fill_count;
+#endif
 
        /* Check if debug output enabled */
 
@@ -202,10 +205,21 @@ acpi_debug_print(u32 requested_debug_level,
                acpi_os_printf("[%u] ", (u32)thread_id);
        }
 
-       acpi_os_printf("[%02ld] ", acpi_gbl_nesting_level);
-#endif
+       fill_count = 48 - acpi_gbl_nesting_level -
+           strlen(acpi_ut_trim_function_name(function_name));
+       if (fill_count < 0) {
+               fill_count = 0;
+       }
+
+       acpi_os_printf("[%02ld] %*s",
+                      acpi_gbl_nesting_level, acpi_gbl_nesting_level + 1, " ");
+       acpi_os_printf("%s%*s: ",
+                      acpi_ut_trim_function_name(function_name), fill_count,
+                      " ");
 
+#else
        acpi_os_printf("%-22.22s: ", acpi_ut_trim_function_name(function_name));
+#endif
 
        va_start(args, format);
        acpi_os_vprintf(format, args);
index 02cd2c2d961a185cd0e698b7569b64c1cfef9a39..55debbad487dc7979089988c9212d89a422a6718 100644 (file)
@@ -395,11 +395,6 @@ const char *acpi_ut_get_reference_name(union acpi_operand_object *object)
        return (acpi_gbl_ref_class_names[object->reference.class]);
 }
 
-#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
-/*
- * Strings and procedures used for debug only
- */
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_get_mutex_name
@@ -433,6 +428,12 @@ const char *acpi_ut_get_mutex_name(u32 mutex_id)
        return (acpi_gbl_mutex_names[mutex_id]);
 }
 
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
+/*
+ * Strings and procedures used for debug only
+ */
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_get_notify_name
index e3368186e1c1bd72e903a0625a3d6639cb55ebaf..42388dcb5ccc9f42fb434eaf9d6938d3d1e59fb4 100644 (file)
@@ -180,6 +180,78 @@ acpi_ut_predefined_bios_error(const char *module_name,
        va_end(arg_list);
 }
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_prefixed_namespace_error
+ *
+ * PARAMETERS:  module_name         - Caller's module name (for error output)
+ *              line_number         - Caller's line number (for error output)
+ *              prefix_scope        - Scope/Path that prefixes the internal path
+ *              internal_path       - Name or path of the namespace node
+ *              lookup_status       - Exception code from NS lookup
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print error message with the full pathname constructed this way:
+ *
+ *                  prefix_scope_node_full_path.externalized_internal_path
+ *
+ * NOTE:        10/2017: Treat the major ns_lookup errors as firmware errors
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_prefixed_namespace_error(const char *module_name,
+                                u32 line_number,
+                                union acpi_generic_state *prefix_scope,
+                                const char *internal_path,
+                                acpi_status lookup_status)
+{
+       char *full_path;
+       const char *message;
+
+       /*
+        * Main cases:
+        * 1) Object creation, object must not already exist
+        * 2) Object lookup, object must exist
+        */
+       switch (lookup_status) {
+       case AE_ALREADY_EXISTS:
+
+               acpi_os_printf(ACPI_MSG_BIOS_ERROR);
+               message = "Failure creating";
+               break;
+
+       case AE_NOT_FOUND:
+
+               acpi_os_printf(ACPI_MSG_BIOS_ERROR);
+               message = "Failure looking up";
+               break;
+
+       default:
+
+               acpi_os_printf(ACPI_MSG_ERROR);
+               message = "Failure looking up";
+               break;
+       }
+
+       /* Concatenate the prefix path and the internal path */
+
+       full_path =
+           acpi_ns_build_prefixed_pathname(prefix_scope, internal_path);
+
+       acpi_os_printf("%s [%s], %s", message,
+                      full_path ? full_path : "Could not get pathname",
+                      acpi_format_exception(lookup_status));
+
+       if (full_path) {
+               ACPI_FREE(full_path);
+       }
+
+       ACPI_MSG_SUFFIX;
+}
+
+#ifdef __OBSOLETE_FUNCTION
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_namespace_error
@@ -240,6 +312,7 @@ acpi_ut_namespace_error(const char *module_name,
        ACPI_MSG_SUFFIX;
        ACPI_MSG_REDIRECT_END;
 }
+#endif
 
 /*******************************************************************************
  *
index 23e766d1691d25bef090dfed3d1db25c3a481281..45eeb0dcf283b78f2ba7cc45ec5dbaa6af579763 100644 (file)
@@ -206,7 +206,6 @@ acpi_status acpi_ut_init_globals(void)
        acpi_gbl_next_owner_id_offset = 0;
        acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
        acpi_gbl_osi_mutex = NULL;
-       acpi_gbl_max_loop_iterations = ACPI_MAX_LOOP_COUNT;
 
        /* Hardware oriented */
 
index 5f9c680076c4f95943b28a0b4f34fecacfd6f99b..2055a858e5f5961cf42cdf1c2c6e8dd0fb4fc1a4 100644 (file)
@@ -134,7 +134,7 @@ acpi_status acpi_ut_short_shift_left(u64 operand, u32 count, u64 *out_result)
 
        if ((count & 63) >= 32) {
                operand_ovl.part.hi = operand_ovl.part.lo;
-               operand_ovl.part.lo ^= operand_ovl.part.lo;
+               operand_ovl.part.lo = 0;
                count = (count & 63) - 32;
        }
        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)
 
        if ((count & 63) >= 32) {
                operand_ovl.part.lo = operand_ovl.part.hi;
-               operand_ovl.part.hi ^= operand_ovl.part.hi;
+               operand_ovl.part.hi = 0;
                count = (count & 63) - 32;
        }
        ACPI_SHIFT_RIGHT_64_BY_32(operand_ovl.part.hi,
index 5863547880182423b8917d7d458496f8b5ac9438..524ba931d5e834e859f39393d268931944a49307 100644 (file)
@@ -286,8 +286,9 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
                acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id;
        } else {
                ACPI_EXCEPTION((AE_INFO, status,
-                               "Thread %u could not acquire Mutex [0x%X]",
-                               (u32)this_thread_id, mutex_id));
+                               "Thread %u could not acquire Mutex [%s] (0x%X)",
+                               (u32)this_thread_id,
+                               acpi_ut_get_mutex_name(mutex_id), mutex_id));
        }
 
        return (status);
@@ -322,8 +323,8 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
         */
        if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) {
                ACPI_ERROR((AE_INFO,
-                           "Mutex [0x%X] is not acquired, cannot release",
-                           mutex_id));
+                           "Mutex [%s] (0x%X) is not acquired, cannot release",
+                           acpi_ut_get_mutex_name(mutex_id), mutex_id));
 
                return (AE_NOT_ACQUIRED);
        }
index 792664982ea3c0d610cd7f439910230c461ff4ab..33a0970646df5358b5d1c21b2d91b32e2ce6ace1 100644 (file)
@@ -140,7 +140,7 @@ int acpi_ut_stricmp(char *string1, char *string2)
        return (c1 - c2);
 }
 
-#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
+#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) || defined (ACPI_DEBUG_OUTPUT)
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_safe_strcpy, acpi_ut_safe_strcat, acpi_ut_safe_strncat
@@ -199,4 +199,13 @@ acpi_ut_safe_strncat(char *dest,
        strncat(dest, source, max_transfer_length);
        return (FALSE);
 }
+
+void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size)
+{
+       /* Always terminate destination string */
+
+       strncpy(dest, source, dest_size);
+       dest[dest_size - 1] = 0;
+}
+
 #endif
index 3175b133c0e4fb87ea0bbe606e615364984e1f7a..f6b8dd24b006c06af923f774167b8ace05802e6d 100644 (file)
@@ -101,6 +101,8 @@ static struct acpi_interface_info acpi_default_supported_interfaces[] = {
        {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8},      /* Windows 8 and Server 2012 - Added 08/2012 */
        {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8},      /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */
        {"Windows 2015", NULL, 0, ACPI_OSI_WIN_10},     /* Windows 10 - Added 03/2015 */
+       {"Windows 2016", NULL, 0, ACPI_OSI_WIN_10_RS1}, /* Windows 10 version 1607 - Added 12/2017 */
+       {"Windows 2017", NULL, 0, ACPI_OSI_WIN_10_RS2}, /* Windows 10 version 1703 - Added 12/2017 */
 
        /* Feature Group Strings */
 
index 965fb5cec94f33aed654862715652c18f751fc25..97f48d71f9e603670e40ef4920f1a083e6e86d73 100644 (file)
@@ -52,10 +52,9 @@ static acpi_status
 acpi_ut_insert_digit(u64 *accumulated_value, u32 base, int ascii_digit);
 
 static acpi_status
-acpi_ut_strtoul_multiply64(u64 multiplicand, u64 multiplier, u64 *out_product);
+acpi_ut_strtoul_multiply64(u64 multiplicand, u32 base, u64 *out_product);
 
-static acpi_status
-acpi_ut_strtoul_add64(u64 addend1, u64 addend2, u64 *out_sum);
+static acpi_status acpi_ut_strtoul_add64(u64 addend1, u32 digit, u64 *out_sum);
 
 /*******************************************************************************
  *
@@ -357,7 +356,7 @@ acpi_ut_insert_digit(u64 *accumulated_value, u32 base, int ascii_digit)
  * FUNCTION:    acpi_ut_strtoul_multiply64
  *
  * PARAMETERS:  multiplicand            - Current accumulated converted integer
- *              multiplier              - Base/Radix
+ *              base                    - Base/Radix
  *              out_product             - Where the product is returned
  *
  * RETURN:      Status and 64-bit product
@@ -369,33 +368,40 @@ acpi_ut_insert_digit(u64 *accumulated_value, u32 base, int ascii_digit)
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_strtoul_multiply64(u64 multiplicand, u64 multiplier, u64 *out_product)
+acpi_ut_strtoul_multiply64(u64 multiplicand, u32 base, u64 *out_product)
 {
-       u64 val;
+       u64 product;
+       u64 quotient;
 
        /* Exit if either operand is zero */
 
        *out_product = 0;
-       if (!multiplicand || !multiplier) {
+       if (!multiplicand || !base) {
                return (AE_OK);
        }
 
-       /* Check for 64-bit overflow before the actual multiplication */
-
-       acpi_ut_short_divide(ACPI_UINT64_MAX, (u32)multiplier, &val, NULL);
-       if (multiplicand > val) {
+       /*
+        * Check for 64-bit overflow before the actual multiplication.
+        *
+        * Notes: 64-bit division is often not supported on 32-bit platforms
+        * (it requires a library function), Therefore ACPICA has a local
+        * 64-bit divide function. Also, Multiplier is currently only used
+        * as the radix (8/10/16), to the 64/32 divide will always work.
+        */
+       acpi_ut_short_divide(ACPI_UINT64_MAX, base, &quotient, NULL);
+       if (multiplicand > quotient) {
                return (AE_NUMERIC_OVERFLOW);
        }
 
-       val = multiplicand * multiplier;
+       product = multiplicand * base;
 
        /* Check for 32-bit overflow if necessary */
 
-       if ((acpi_gbl_integer_bit_width == 32) && (val > ACPI_UINT32_MAX)) {
+       if ((acpi_gbl_integer_bit_width == 32) && (product > ACPI_UINT32_MAX)) {
                return (AE_NUMERIC_OVERFLOW);
        }
 
-       *out_product = val;
+       *out_product = product;
        return (AE_OK);
 }
 
@@ -404,7 +410,7 @@ acpi_ut_strtoul_multiply64(u64 multiplicand, u64 multiplier, u64 *out_product)
  * FUNCTION:    acpi_ut_strtoul_add64
  *
  * PARAMETERS:  addend1                 - Current accumulated converted integer
- *              addend2                 - New hex value/char
+ *              digit                   - New hex value/char
  *              out_sum                 - Where sum is returned (Accumulator)
  *
  * RETURN:      Status and 64-bit sum
@@ -415,17 +421,17 @@ acpi_ut_strtoul_multiply64(u64 multiplicand, u64 multiplier, u64 *out_product)
  *
  ******************************************************************************/
 
-static acpi_status acpi_ut_strtoul_add64(u64 addend1, u64 addend2, u64 *out_sum)
+static acpi_status acpi_ut_strtoul_add64(u64 addend1, u32 digit, u64 *out_sum)
 {
        u64 sum;
 
        /* Check for 64-bit overflow before the actual addition */
 
-       if ((addend1 > 0) && (addend2 > (ACPI_UINT64_MAX - addend1))) {
+       if ((addend1 > 0) && (digit > (ACPI_UINT64_MAX - addend1))) {
                return (AE_NUMERIC_OVERFLOW);
        }
 
-       sum = addend1 + addend2;
+       sum = addend1 + digit;
 
        /* Check for 32-bit overflow if necessary */
 
index 3c8de88ecbd5ff776f670a2b6b741e5d1a53eae6..633b4e2c669f65a90575679facb10902a36f7b54 100644 (file)
@@ -402,8 +402,8 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
        allocation->component = component;
        allocation->line = line;
 
-       strncpy(allocation->module, module, ACPI_MAX_MODULE_NAME);
-       allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0;
+       acpi_ut_safe_strncpy(allocation->module, (char *)module,
+                            ACPI_MAX_MODULE_NAME);
 
        if (!element) {
 
@@ -717,7 +717,7 @@ exit:
        if (!num_outstanding) {
                ACPI_INFO(("No outstanding allocations"));
        } else {
-               ACPI_ERROR((AE_INFO, "%u(0x%X) Outstanding allocations",
+               ACPI_ERROR((AE_INFO, "%u (0x%X) Outstanding cache allocations",
                            num_outstanding, num_outstanding));
        }
 
index 950a1e500bfa2f09e0c72e69e9a73bef65f1f1d8..9da4f8ef2e77bae10a07d766db2ae86899093c33 100644 (file)
@@ -96,8 +96,8 @@ ACPI_EXPORT_SYMBOL(acpi_error)
  *
  * RETURN:      None
  *
- * DESCRIPTION: Print "ACPI Exception" message with module/line/version info
- *              and decoded acpi_status.
+ * DESCRIPTION: Print an "ACPI Error" message with module/line/version
+ *              info as well as decoded acpi_status.
  *
  ******************************************************************************/
 void ACPI_INTERNAL_VAR_XFACE
@@ -111,10 +111,10 @@ acpi_exception(const char *module_name,
        /* For AE_OK, just print the message */
 
        if (ACPI_SUCCESS(status)) {
-               acpi_os_printf(ACPI_MSG_EXCEPTION);
+               acpi_os_printf(ACPI_MSG_ERROR);
 
        } else {
-               acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ",
+               acpi_os_printf(ACPI_MSG_ERROR "%s, ",
                               acpi_format_exception(status));
        }
 
index 6db3b4668b1a2b1e6c618d49565f96b1c4521021..ffe364fa4040c646c16edfaf3b2e827be62050ca 100644 (file)
 
 #define ACPI_ADDRESS_RANGE_MAX          2
 
-/* Maximum number of While() loops before abort */
+/* Maximum time (default 30s) of While() loops before abort */
 
-#define ACPI_MAX_LOOP_COUNT             0x000FFFFF
+#define ACPI_MAX_LOOP_TIMEOUT           30
 
 /******************************************************************************
  *
index 17d61b1f2511ad71881b6ff4a182c10dcdf5191a..3c46f0ef5f7a7c07ed46b6497fa5ea4471549cbf 100644 (file)
@@ -130,8 +130,9 @@ struct acpi_exception_info {
 #define AE_HEX_OVERFLOW                 EXCEP_ENV (0x0020)
 #define AE_DECIMAL_OVERFLOW             EXCEP_ENV (0x0021)
 #define AE_OCTAL_OVERFLOW               EXCEP_ENV (0x0022)
+#define AE_END_OF_TABLE                 EXCEP_ENV (0x0023)
 
-#define AE_CODE_ENV_MAX                 0x0022
+#define AE_CODE_ENV_MAX                 0x0023
 
 /*
  * Programmer exceptions
@@ -195,7 +196,7 @@ struct acpi_exception_info {
 #define AE_AML_CIRCULAR_REFERENCE       EXCEP_AML (0x001E)
 #define AE_AML_BAD_RESOURCE_LENGTH      EXCEP_AML (0x001F)
 #define AE_AML_ILLEGAL_ADDRESS          EXCEP_AML (0x0020)
-#define AE_AML_INFINITE_LOOP            EXCEP_AML (0x0021)
+#define AE_AML_LOOP_TIMEOUT             EXCEP_AML (0x0021)
 #define AE_AML_UNINITIALIZED_NODE       EXCEP_AML (0x0022)
 #define AE_AML_TARGET_TYPE              EXCEP_AML (0x0023)
 
@@ -275,7 +276,8 @@ static const struct acpi_exception_info acpi_gbl_exception_names_env[] = {
        EXCEP_TXT("AE_DECIMAL_OVERFLOW",
                  "Overflow during ASCII decimal-to-binary conversion"),
        EXCEP_TXT("AE_OCTAL_OVERFLOW",
-                 "Overflow during ASCII octal-to-binary conversion")
+                 "Overflow during ASCII octal-to-binary conversion"),
+       EXCEP_TXT("AE_END_OF_TABLE", "Reached the end of table")
 };
 
 static 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[] = {
                  "The length of a Resource Descriptor in the AML is incorrect"),
        EXCEP_TXT("AE_AML_ILLEGAL_ADDRESS",
                  "A memory, I/O, or PCI configuration address is invalid"),
-       EXCEP_TXT("AE_AML_INFINITE_LOOP",
-                 "An apparent infinite AML While loop, method was aborted"),
+       EXCEP_TXT("AE_AML_LOOP_TIMEOUT",
+                 "An AML While loop exceeded the maximum execution time"),
        EXCEP_TXT("AE_AML_UNINITIALIZED_NODE",
                  "A namespace node is uninitialized or unresolved"),
        EXCEP_TXT("AE_AML_TARGET_TYPE",
index e1dd1a8d42b60eb155796819b9518c34855cbfa5..c589c3e12d90bc7b496b19df4a598b18c6afbf9e 100644 (file)
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20170831
+#define ACPI_CA_VERSION                 0x20171215
 
 #include <acpi/acconfig.h>
 #include <acpi/actypes.h>
@@ -260,11 +260,11 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_osi_data, 0);
 ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE);
 
 /*
- * Maximum number of While() loop iterations before forced method abort.
+ * Maximum timeout for While() loop iterations before forced method abort.
  * This mechanism is intended to prevent infinite loops during interpreter
  * execution within a host kernel.
  */
-ACPI_INIT_GLOBAL(u32, acpi_gbl_max_loop_iterations, ACPI_MAX_LOOP_COUNT);
+ACPI_INIT_GLOBAL(u32, acpi_gbl_max_loop_iterations, ACPI_MAX_LOOP_TIMEOUT);
 
 /*
  * This mechanism is used to trace a specified AML method. The method is
index 7a89e6de94da938e450aa10623e76a86dbe6602d..4c304bf4d591513abf28a91bd82d3b80baa29c78 100644 (file)
 #define ACPI_SIG_HEST           "HEST" /* Hardware Error Source Table */
 #define ACPI_SIG_MADT           "APIC" /* Multiple APIC Description Table */
 #define ACPI_SIG_MSCT           "MSCT" /* Maximum System Characteristics Table */
-#define ACPI_SIG_PDTT           "PDTT" /* Processor Debug Trigger Table */
+#define ACPI_SIG_PDTT           "PDTT" /* Platform Debug Trigger Table */
 #define ACPI_SIG_PPTT           "PPTT" /* Processor Properties Topology Table */
 #define ACPI_SIG_SBST           "SBST" /* Smart Battery Specification Table */
+#define ACPI_SIG_SDEV           "SDEV" /* Secure Devices table */
 #define ACPI_SIG_SLIT           "SLIT" /* System Locality Distance Information Table */
 #define ACPI_SIG_SRAT           "SRAT" /* System Resource Affinity Table */
 #define ACPI_SIG_NFIT           "NFIT" /* NVDIMM Firmware Interface Table */
@@ -1149,7 +1150,8 @@ enum acpi_nfit_type {
        ACPI_NFIT_TYPE_CONTROL_REGION = 4,
        ACPI_NFIT_TYPE_DATA_REGION = 5,
        ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6,
-       ACPI_NFIT_TYPE_RESERVED = 7     /* 7 and greater are reserved */
+       ACPI_NFIT_TYPE_CAPABILITIES = 7,
+       ACPI_NFIT_TYPE_RESERVED = 8     /* 8 and greater are reserved */
 };
 
 /*
@@ -1162,7 +1164,7 @@ struct acpi_nfit_system_address {
        struct acpi_nfit_header header;
        u16 range_index;
        u16 flags;
-       u32 reserved;           /* Reseved, must be zero */
+       u32 reserved;           /* Reserved, must be zero */
        u32 proximity_domain;
        u8 range_guid[16];
        u64 address;
@@ -1281,9 +1283,72 @@ struct acpi_nfit_flush_address {
        u64 hint_address[1];    /* Variable length */
 };
 
+/* 7: Platform Capabilities Structure */
+
+struct acpi_nfit_capabilities {
+       struct acpi_nfit_header header;
+       u8 highest_capability;
+       u8 reserved[3];         /* Reserved, must be zero */
+       u32 capabilities;
+       u32 reserved2;
+};
+
+/* Capabilities Flags */
+
+#define ACPI_NFIT_CAPABILITY_CACHE_FLUSH       (1)     /* 00: Cache Flush to NVDIMM capable */
+#define ACPI_NFIT_CAPABILITY_MEM_FLUSH         (1<<1)  /* 01: Memory Flush to NVDIMM capable */
+#define ACPI_NFIT_CAPABILITY_MEM_MIRRORING     (1<<2)  /* 02: Memory Mirroring capable */
+
+/*
+ * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM
+ */
+struct nfit_device_handle {
+       u32 handle;
+};
+
+/* Device handle construction and extraction macros */
+
+#define ACPI_NFIT_DIMM_NUMBER_MASK              0x0000000F
+#define ACPI_NFIT_CHANNEL_NUMBER_MASK           0x000000F0
+#define ACPI_NFIT_MEMORY_ID_MASK                0x00000F00
+#define ACPI_NFIT_SOCKET_ID_MASK                0x0000F000
+#define ACPI_NFIT_NODE_ID_MASK                  0x0FFF0000
+
+#define ACPI_NFIT_DIMM_NUMBER_OFFSET            0
+#define ACPI_NFIT_CHANNEL_NUMBER_OFFSET         4
+#define ACPI_NFIT_MEMORY_ID_OFFSET              8
+#define ACPI_NFIT_SOCKET_ID_OFFSET              12
+#define ACPI_NFIT_NODE_ID_OFFSET                16
+
+/* Macro to construct a NFIT/NVDIMM device handle */
+
+#define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \
+       ((dimm)                                         | \
+       ((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET)  | \
+       ((memory)  << ACPI_NFIT_MEMORY_ID_OFFSET)       | \
+       ((socket)  << ACPI_NFIT_SOCKET_ID_OFFSET)       | \
+       ((node)    << ACPI_NFIT_NODE_ID_OFFSET))
+
+/* Macros to extract individual fields from a NFIT/NVDIMM device handle */
+
+#define ACPI_NFIT_GET_DIMM_NUMBER(handle) \
+       ((handle) & ACPI_NFIT_DIMM_NUMBER_MASK)
+
+#define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \
+       (((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET)
+
+#define ACPI_NFIT_GET_MEMORY_ID(handle) \
+       (((handle) & ACPI_NFIT_MEMORY_ID_MASK)      >> ACPI_NFIT_MEMORY_ID_OFFSET)
+
+#define ACPI_NFIT_GET_SOCKET_ID(handle) \
+       (((handle) & ACPI_NFIT_SOCKET_ID_MASK)      >> ACPI_NFIT_SOCKET_ID_OFFSET)
+
+#define ACPI_NFIT_GET_NODE_ID(handle) \
+       (((handle) & ACPI_NFIT_NODE_ID_MASK)        >> ACPI_NFIT_NODE_ID_OFFSET)
+
 /*******************************************************************************
  *
- * PDTT - Processor Debug Trigger Table (ACPI 6.2)
+ * PDTT - Platform Debug Trigger Table (ACPI 6.2)
  *        Version 0
  *
  ******************************************************************************/
@@ -1301,14 +1366,14 @@ struct acpi_table_pdtt {
  * starting at array_offset.
  */
 struct acpi_pdtt_channel {
-       u16 sub_channel_id;
+       u8 subchannel_id;
+       u8 flags;
 };
 
-/* Mask and Flags for above */
+/* Flags for above */
 
-#define ACPI_PDTT_SUBCHANNEL_ID_MASK        0x00FF
-#define ACPI_PDTT_RUNTIME_TRIGGER           (1<<8)
-#define ACPI_PPTT_WAIT_COMPLETION           (1<<9)
+#define ACPI_PDTT_RUNTIME_TRIGGER           (1)
+#define ACPI_PDTT_WAIT_COMPLETION           (1<<1)
 
 /*******************************************************************************
  *
@@ -1376,6 +1441,20 @@ struct acpi_pptt_cache {
 #define ACPI_PPTT_MASK_CACHE_TYPE           (0x0C)     /* Cache type */
 #define ACPI_PPTT_MASK_WRITE_POLICY         (0x10)     /* Write policy */
 
+/* Attributes describing cache */
+#define ACPI_PPTT_CACHE_READ_ALLOCATE       (0x0)      /* Cache line is allocated on read */
+#define ACPI_PPTT_CACHE_WRITE_ALLOCATE      (0x01)     /* Cache line is allocated on write */
+#define ACPI_PPTT_CACHE_RW_ALLOCATE         (0x02)     /* Cache line is allocated on read and write */
+#define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT     (0x03)     /* Alternate representation of above */
+
+#define ACPI_PPTT_CACHE_TYPE_DATA           (0x0)      /* Data cache */
+#define ACPI_PPTT_CACHE_TYPE_INSTR          (1<<2)     /* Instruction cache */
+#define ACPI_PPTT_CACHE_TYPE_UNIFIED        (2<<2)     /* Unified I & D cache */
+#define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT    (3<<2)     /* Alternate representation of above */
+
+#define ACPI_PPTT_CACHE_POLICY_WB           (0x0)      /* Cache is write back */
+#define ACPI_PPTT_CACHE_POLICY_WT           (1<<4)     /* Cache is write through */
+
 /* 2: ID Structure */
 
 struct acpi_pptt_id {
@@ -1403,6 +1482,68 @@ struct acpi_table_sbst {
        u32 critical_level;
 };
 
+/*******************************************************************************
+ *
+ * SDEV - Secure Devices Table (ACPI 6.2)
+ *        Version 1
+ *
+ ******************************************************************************/
+
+struct acpi_table_sdev {
+       struct acpi_table_header header;        /* Common ACPI table header */
+};
+
+struct acpi_sdev_header {
+       u8 type;
+       u8 flags;
+       u16 length;
+};
+
+/* Values for subtable type above */
+
+enum acpi_sdev_type {
+       ACPI_SDEV_TYPE_NAMESPACE_DEVICE = 0,
+       ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1,
+       ACPI_SDEV_TYPE_RESERVED = 2     /* 2 and greater are reserved */
+};
+
+/* Values for flags above */
+
+#define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS    (1)
+
+/*
+ * SDEV subtables
+ */
+
+/* 0: Namespace Device Based Secure Device Structure */
+
+struct acpi_sdev_namespace {
+       struct acpi_sdev_header header;
+       u16 device_id_offset;
+       u16 device_id_length;
+       u16 vendor_data_offset;
+       u16 vendor_data_length;
+};
+
+/* 1: PCIe Endpoint Device Based Device Structure */
+
+struct acpi_sdev_pcie {
+       struct acpi_sdev_header header;
+       u16 segment;
+       u16 start_bus;
+       u16 path_offset;
+       u16 path_length;
+       u16 vendor_data_offset;
+       u16 vendor_data_length;
+};
+
+/* 1a: PCIe Endpoint path entry */
+
+struct acpi_sdev_pcie_path {
+       u8 device;
+       u8 function;
+};
+
 /*******************************************************************************
  *
  * SLIT - System Locality Distance Information Table
index 686b6f8c09dc7fd013853c8991cd08a0ee744069..0d60d5df14f8b7d4ecabe4383c6f8438b2d3f3d9 100644 (file)
@@ -810,6 +810,7 @@ struct acpi_iort_smmu_v3 {
        u8 pxm;
        u8 reserved1;
        u16 reserved2;
+       u32 id_mapping_index;
 };
 
 /* Values for Model field above */
@@ -1246,6 +1247,8 @@ enum acpi_spmi_interface_types {
  * TCPA - Trusted Computing Platform Alliance table
  *        Version 2
  *
+ * TCG Hardware Interface Table for TPM 1.2 Clients and Servers
+ *
  * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
  * Version 1.2, Revision 8
  * February 27, 2017
@@ -1310,6 +1313,8 @@ struct acpi_table_tcpa_server {
  * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
  *        Version 4
  *
+ * TCG Hardware Interface Table for TPM 2.0 Clients and Servers
+ *
  * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
  * Version 1.2, Revision 8
  * February 27, 2017
@@ -1329,15 +1334,23 @@ struct acpi_table_tpm2 {
 /* Values for start_method above */
 
 #define ACPI_TPM2_NOT_ALLOWED                       0
+#define ACPI_TPM2_RESERVED1                         1
 #define ACPI_TPM2_START_METHOD                      2
+#define ACPI_TPM2_RESERVED3                         3
+#define ACPI_TPM2_RESERVED4                         4
+#define ACPI_TPM2_RESERVED5                         5
 #define ACPI_TPM2_MEMORY_MAPPED                     6
 #define ACPI_TPM2_COMMAND_BUFFER                    7
 #define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD  8
+#define ACPI_TPM2_RESERVED9                         9
+#define ACPI_TPM2_RESERVED10                        10
 #define ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC       11 /* V1.2 Rev 8 */
+#define ACPI_TPM2_RESERVED                          12
 
-/* Trailer appears after any start_method subtables */
+/* Optional trailer appears after any start_method subtables */
 
 struct acpi_tpm2_trailer {
+       u8 method_parameters[12];
        u32 minimum_log_length; /* Minimum length for the event log area */
        u64 log_address;        /* Address of the event log area */
 };
index 4f077edb9b81b8086153609d6b4b22b4a22b96e0..31f1be74dd1657ea7047eb7039646dffc3e8d29f 100644 (file)
@@ -468,6 +468,8 @@ typedef void *acpi_handle;  /* Actually a ptr to a NS Node */
 #define ACPI_NSEC_PER_MSEC              1000000L
 #define ACPI_NSEC_PER_SEC               1000000000L
 
+#define ACPI_TIME_AFTER(a, b)           ((s64)((b) - (a)) < 0)
+
 /* Owner IDs are used to track namespace nodes for selective deletion */
 
 typedef u8 acpi_owner_id;
@@ -1299,6 +1301,8 @@ typedef enum {
 #define ACPI_OSI_WIN_7                  0x0B
 #define ACPI_OSI_WIN_8                  0x0C
 #define ACPI_OSI_WIN_10                 0x0D
+#define ACPI_OSI_WIN_10_RS1             0x0E
+#define ACPI_OSI_WIN_10_RS2             0x0F
 
 /* Definitions of getopt */
 
index 22c3b4ee1617b8c83cde926d5e9e9fb1f37ee882..be418fba9441b88ed959152cee477dafafef6ae9 100644 (file)
@@ -79,7 +79,7 @@ struct ap_dump_action action_table[AP_MAX_ACTIONS];
 u32 current_action = 0;
 
 #define AP_UTILITY_NAME             "ACPI Binary Table Dump Utility"
-#define AP_SUPPORTED_OPTIONS        "?a:bc:f:hn:o:r:svxz"
+#define AP_SUPPORTED_OPTIONS        "?a:bc:f:hn:o:r:sv^xz"
 
 /******************************************************************************
  *
@@ -100,6 +100,7 @@ static void ap_display_usage(void)
        ACPI_OPTION("-r <Address>", "Dump tables from specified RSDP");
        ACPI_OPTION("-s", "Print table summaries only");
        ACPI_OPTION("-v", "Display version information");
+       ACPI_OPTION("-vd", "Display build date and time");
        ACPI_OPTION("-z", "Verbose mode");
 
        ACPI_USAGE_TEXT("\nTable Options:\n");
@@ -231,10 +232,29 @@ static int ap_do_options(int argc, char **argv)
                        }
                        continue;
 
-               case 'v':       /* Revision/version */
+               case 'v':       /* -v: (Version): signon already emitted, just exit */
 
-                       acpi_os_printf(ACPI_COMMON_SIGNON(AP_UTILITY_NAME));
-                       return (1);
+                       switch (acpi_gbl_optarg[0]) {
+                       case '^':       /* -v: (Version) */
+
+                               fprintf(stderr,
+                                       ACPI_COMMON_SIGNON(AP_UTILITY_NAME));
+                               return (1);
+
+                       case 'd':
+
+                               fprintf(stderr,
+                                       ACPI_COMMON_SIGNON(AP_UTILITY_NAME));
+                               printf(ACPI_COMMON_BUILD_TIME);
+                               return (1);
+
+                       default:
+
+                               printf("Unknown option: -v%s\n",
+                                      acpi_gbl_optarg);
+                               return (-1);
+                       }
+                       break;
 
                case 'z':       /* Verbose mode */