]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ACPICA: acpi_exec: fixing -fi option
authorErik Schmauss <erik.schmauss@intel.com>
Fri, 10 Aug 2018 21:43:00 +0000 (14:43 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 14 Aug 2018 21:49:13 +0000 (23:49 +0200)
Field elements listed in the init file used to be initialized after
the table load and before executing module-level code blocks. The
recent changes in module-level code mean that the table load becomes
a method execution. If fields are used within module-level code and
we are executing with -fi option, then these values are populated
after the table has finished loading. This commit changes the
initialization of objects listed in the init file so that field unit
values are populated during the table load.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/aclocal.h
drivers/acpi/acpica/acnamesp.h
drivers/acpi/acpica/dsfield.c
drivers/acpi/acpica/nsaccess.c

index c5367bf5487fcf3a1ac466e990675871a7af16ae..0f28a38a43ea1dadaeafbbefa478637deb1de90d 100644 (file)
@@ -164,6 +164,7 @@ struct acpi_namespace_node {
 #define ANOBJ_SUBTREE_HAS_INI           0x10   /* Used to optimize device initialization */
 #define ANOBJ_EVALUATED                 0x20   /* Set on first evaluation of node */
 #define ANOBJ_ALLOCATED_BUFFER          0x40   /* Method AML buffer is dynamic (install_method) */
+#define ANOBJ_NODE_EARLY_INIT           0x80   /* acpi_exec only: Node was create via init file (-fi) */
 
 #define ANOBJ_IS_EXTERNAL               0x08   /* iASL only: This object created via External() */
 #define ANOBJ_METHOD_NO_RETVAL          0x10   /* iASL only: Method has no return value */
index 3825df9234803a84cd5bc9ddd6892452eb87160f..bbb3b4d1e796cef48aad9362ca7d3022d3acab17 100644 (file)
 /* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
 
 #define ACPI_NS_NO_UPSEARCH         0
-#define ACPI_NS_SEARCH_PARENT       0x01
-#define ACPI_NS_DONT_OPEN_SCOPE     0x02
-#define ACPI_NS_NO_PEER_SEARCH      0x04
-#define ACPI_NS_ERROR_IF_FOUND      0x08
-#define ACPI_NS_PREFIX_IS_SCOPE     0x10
-#define ACPI_NS_EXTERNAL            0x20
-#define ACPI_NS_TEMPORARY           0x40
-#define ACPI_NS_OVERRIDE_IF_FOUND   0x80
+#define ACPI_NS_SEARCH_PARENT       0x0001
+#define ACPI_NS_DONT_OPEN_SCOPE     0x0002
+#define ACPI_NS_NO_PEER_SEARCH      0x0004
+#define ACPI_NS_ERROR_IF_FOUND      0x0008
+#define ACPI_NS_PREFIX_IS_SCOPE     0x0010
+#define ACPI_NS_EXTERNAL            0x0020
+#define ACPI_NS_TEMPORARY           0x0040
+#define ACPI_NS_OVERRIDE_IF_FOUND   0x0080
+#define ACPI_NS_EARLY_INIT          0x0100
 
 /* Flags for acpi_ns_walk_namespace */
 
index 7c937595dfcbd5d594a13eb9233851bdda0527b4..5581300927ded87caacbad249250871bd3ccf691 100644 (file)
 #include "acnamesp.h"
 #include "acparser.h"
 
+#ifdef ACPI_EXEC_APP
+#include "aecommon.h"
+#endif
+
 #define _COMPONENT          ACPI_DISPATCHER
 ACPI_MODULE_NAME("dsfield")
 
@@ -259,6 +263,13 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
        u64 position;
        union acpi_parse_object *child;
 
+#ifdef ACPI_EXEC_APP
+       u64 value = 0;
+       union acpi_operand_object *result_desc;
+       union acpi_operand_object *obj_desc;
+       char *name_path;
+#endif
+
        ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info);
 
        /* First field starts at bit zero */
@@ -391,6 +402,26 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
                                        if (ACPI_FAILURE(status)) {
                                                return_ACPI_STATUS(status);
                                        }
+#ifdef ACPI_EXEC_APP
+                                       name_path =
+                                           acpi_ns_get_external_pathname(info->
+                                                                         field_node);
+                                       obj_desc =
+                                           acpi_ut_create_integer_object
+                                           (value);
+                                       if (ACPI_SUCCESS
+                                           (ae_lookup_init_file_entry
+                                            (name_path, &value))) {
+                                               acpi_ex_write_data_to_field
+                                                   (obj_desc,
+                                                    acpi_ns_get_attached_object
+                                                    (info->field_node),
+                                                    &result_desc);
+                                               ACPI_FREE(name_path);
+                                               acpi_ut_remove_reference
+                                                   (obj_desc);
+                                       }
+#endif
                                }
                        }
 
@@ -573,7 +604,9 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
            !(walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
                flags |= ACPI_NS_TEMPORARY;
        }
-
+#ifdef ACPI_EXEC_APP
+       flags |= ACPI_NS_OVERRIDE_IF_FOUND;
+#endif
        /*
         * Walk the list of entries in the field_list
         * Note: field_list can be of zero length. In this case, Arg will be NULL.
index 83a593e2155d7a71db823ab341acf903fb30cbea..e3f10afde5ffae47deb166544cf8f5ded393f726 100644 (file)
@@ -558,6 +558,14 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
                                                  (char *)&current_node->name,
                                                  current_node));
                        }
+#ifdef ACPI_EXEC_APP
+                       if ((status == AE_ALREADY_EXISTS) &&
+                           (this_node->flags & ANOBJ_NODE_EARLY_INIT)) {
+                               this_node->flags &= ~ANOBJ_NODE_EARLY_INIT;
+                               status = AE_OK;
+                       }
+#endif
+
 #ifdef ACPI_ASL_COMPILER
                        /*
                         * If this ACPI name already exists within the namespace as an
@@ -676,6 +684,11 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
                        }
                }
        }
+#ifdef ACPI_EXEC_APP
+       if (flags & ACPI_NS_EARLY_INIT) {
+               this_node->flags |= ANOBJ_NODE_EARLY_INIT;
+       }
+#endif
 
        *return_node = this_node;
        return_ACPI_STATUS(AE_OK);