patch-2.4.0-prerelease linux/drivers/acpi/namespace/nsload.c

Next file: linux/drivers/acpi/namespace/nsnames.c
Previous file: linux/drivers/acpi/namespace/nsinit.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test12/linux/drivers/acpi/namespace/nsload.c linux/drivers/acpi/namespace/nsload.c
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: nsload - namespace loading/expanding/contracting procedures
- *              $Revision: 28 $
+ *              $Revision: 33 $
  *
  *****************************************************************************/
 
@@ -37,6 +37,123 @@
 	 MODULE_NAME         ("nsload")
 
 
+/******************************************************************************
+ *
+ * FUNCTION:    Acpi_load_namespace
+ *
+ * PARAMETERS:  Display_aml_during_load
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Load the name space from what ever is pointed to by DSDT.
+ *              (DSDT points to either the BIOS or a buffer.)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ns_load_namespace (
+	void)
+{
+	ACPI_STATUS             status;
+
+
+	/* There must be at least a DSDT installed */
+
+	if (acpi_gbl_DSDT == NULL) {
+		return (AE_NO_ACPI_TABLES);
+	}
+
+
+	/*
+	 * Load the namespace.  The DSDT is required,
+	 * but the SSDT and PSDT tables are optional.
+	 */
+
+	status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT);
+	if (ACPI_FAILURE (status)) {
+		return (status);
+	}
+
+	/* Ignore exceptions from these */
+
+	acpi_ns_load_table_by_type (ACPI_TABLE_SSDT);
+	acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
+
+
+	return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Acpi_ns_one_parse_pass
+ *
+ * PARAMETERS:
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+acpi_ns_one_complete_parse (
+	u32                     pass_number,
+	ACPI_TABLE_DESC         *table_desc)
+{
+	ACPI_PARSE_DOWNWARDS    descending_callback;
+	ACPI_PARSE_UPWARDS      ascending_callback;
+	ACPI_PARSE_OBJECT       *parse_root;
+	ACPI_STATUS             status;
+
+
+	switch (pass_number)
+	{
+	case 1:
+		descending_callback = acpi_ds_load1_begin_op;
+		ascending_callback = acpi_ds_load1_end_op;
+		break;
+
+	case 2:
+		descending_callback = acpi_ds_load2_begin_op;
+		ascending_callback = acpi_ds_load2_end_op;
+		break;
+
+	case 3:
+		descending_callback = acpi_ds_exec_begin_op;
+		ascending_callback = acpi_ds_exec_end_op;
+		break;
+
+	default:
+		return (AE_BAD_PARAMETER);
+	}
+
+	/* Create and init a Root Node */
+
+	parse_root = acpi_ps_alloc_op (AML_SCOPE_OP);
+	if (!parse_root) {
+		return (AE_NO_MEMORY);
+	}
+
+	((ACPI_PARSE2_OBJECT *) parse_root)->name = ACPI_ROOT_NAME;
+
+
+	/* Pass 1:  Parse everything except control method bodies */
+
+	status = acpi_ps_parse_aml (parse_root,
+			 table_desc->aml_pointer,
+			 table_desc->aml_length,
+			 ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
+			 NULL, NULL, NULL,
+			 descending_callback,
+			 ascending_callback);
+
+	acpi_ps_delete_parse_tree (parse_root);
+
+	return (status);
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    Acpi_ns_parse_table
@@ -69,32 +186,11 @@
 	 * performs another complete parse of the AML..
 	 */
 
-	/* Create and init a Root Node */
-
-	acpi_gbl_parsed_namespace_root = acpi_ps_alloc_op (AML_SCOPE_OP);
-	if (!acpi_gbl_parsed_namespace_root) {
-		return (AE_NO_MEMORY);
-	}
-
-	((ACPI_PARSE2_OBJECT *) acpi_gbl_parsed_namespace_root)->name = ACPI_ROOT_NAME;
-
-
-	/* Pass 1:  Parse everything except control method bodies */
-
-	status = acpi_ps_parse_aml (acpi_gbl_parsed_namespace_root,
-			 table_desc->aml_pointer,
-			 table_desc->aml_length,
-			 ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
-			 NULL, NULL, NULL,
-			 acpi_ds_load1_begin_op,
-			 acpi_ds_load1_end_op);
-
+	status = acpi_ns_one_complete_parse (1, table_desc);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
 
-	acpi_ps_delete_parse_tree (acpi_gbl_parsed_namespace_root);
-
 
 	/*
 	 * AML Parse, pass 2
@@ -106,34 +202,11 @@
 	 * parse objects are all cached.
 	 */
 
-	/* Create and init a Root Node */
-
-	acpi_gbl_parsed_namespace_root = acpi_ps_alloc_op (AML_SCOPE_OP);
-	if (!acpi_gbl_parsed_namespace_root) {
-		return (AE_NO_MEMORY);
-	}
-
-	((ACPI_PARSE2_OBJECT *) acpi_gbl_parsed_namespace_root)->name = ACPI_ROOT_NAME;
-
-
-	/* Pass 2: Resolve forward references */
-
-	status = acpi_ps_parse_aml (acpi_gbl_parsed_namespace_root,
-			 table_desc->aml_pointer,
-			 table_desc->aml_length,
-			 ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
-			 NULL, NULL, NULL,
-			 acpi_ds_load2_begin_op,
-			 acpi_ds_load2_end_op);
-
+	status = acpi_ns_one_complete_parse (2, table_desc);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
 
-	acpi_ps_delete_parse_tree (acpi_gbl_parsed_namespace_root);
-	acpi_gbl_parsed_namespace_root = NULL;
-
-
 	return (status);
 }
 
@@ -147,8 +220,7 @@
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Mainline of the AML load/dump subsystem. Sets up the
- *              input engine, calls handler for outermost object type.
+ * DESCRIPTION: Load one ACPI table into the namespace
  *
  ****************************************************************************/
 
@@ -247,13 +319,6 @@
 		}
 
 		table_desc->table_id = TABLE_ID_DSDT;
-
-		/* Initialize the root of the namespace tree */
-
-		status = acpi_ns_root_initialize ();
-		if (ACPI_FAILURE (status)) {
-			goto unlock_and_exit;
-		}
 
 		/* Now load the single DSDT */
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)