]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/namespace/nsparse.c
PCI hotplug: rpaphp: make debug var unique
[linux-2.6-omap-h63xx.git] / drivers / acpi / namespace / nsparse.c
index e696aa8479909a5cf273813d008fa2366e9d8fd7..a82271a9dbb3d5b42495f7f10a809313730fc1c3 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2007, R. Byron Moore
+ * Copyright (C) 2000 - 2008, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -63,12 +63,13 @@ ACPI_MODULE_NAME("nsparse")
  *
  ******************************************************************************/
 acpi_status
-acpi_ns_one_complete_parse(acpi_native_uint pass_number,
-                          acpi_native_uint table_index)
+acpi_ns_one_complete_parse(u32 pass_number,
+                          u32 table_index,
+                          struct acpi_namespace_node *start_node)
 {
        union acpi_parse_object *parse_root;
        acpi_status status;
-       acpi_native_uint aml_length;
+       u32 aml_length;
        u8 *aml_start;
        struct acpi_walk_state *walk_state;
        struct acpi_table_header *table;
@@ -117,8 +118,19 @@ acpi_ns_one_complete_parse(acpi_native_uint pass_number,
 
        if (ACPI_FAILURE(status)) {
                acpi_ds_delete_walk_state(walk_state);
-               acpi_ps_delete_parse_tree(parse_root);
-               return_ACPI_STATUS(status);
+               goto cleanup;
+       }
+
+       /* start_node is the default location to load the table */
+
+       if (start_node && start_node != acpi_gbl_root_node) {
+               status =
+                   acpi_ds_scope_stack_push(start_node, ACPI_TYPE_METHOD,
+                                            walk_state);
+               if (ACPI_FAILURE(status)) {
+                       acpi_ds_delete_walk_state(walk_state);
+                       goto cleanup;
+               }
        }
 
        /* Parse the AML */
@@ -127,6 +139,7 @@ acpi_ns_one_complete_parse(acpi_native_uint pass_number,
                          (unsigned)pass_number));
        status = acpi_ps_parse_aml(walk_state);
 
+      cleanup:
        acpi_ps_delete_parse_tree(parse_root);
        return_ACPI_STATUS(status);
 }
@@ -145,8 +158,7 @@ acpi_ns_one_complete_parse(acpi_native_uint pass_number,
  ******************************************************************************/
 
 acpi_status
-acpi_ns_parse_table(acpi_native_uint table_index,
-                   struct acpi_namespace_node *start_node)
+acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node)
 {
        acpi_status status;
 
@@ -163,7 +175,9 @@ acpi_ns_parse_table(acpi_native_uint table_index,
         * performs another complete parse of the AML.
         */
        ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n"));
-       status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, table_index);
+       status =
+           acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, table_index,
+                                      start_node);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
@@ -178,7 +192,9 @@ acpi_ns_parse_table(acpi_native_uint table_index,
         * parse objects are all cached.
         */
        ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n"));
-       status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2, table_index);
+       status =
+           acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2, table_index,
+                                      start_node);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }