patch-2.4.10 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.9/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: 41 $
+ *              $Revision: 43 $
  *
  *****************************************************************************/
 
@@ -50,17 +50,21 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_load_namespace (
 	void)
 {
-	ACPI_STATUS             status;
+	acpi_status             status;
+
+
+	FUNCTION_TRACE ("Acpi_load_name_space");
 
 
 	/* There must be at least a DSDT installed */
 
 	if (acpi_gbl_DSDT == NULL) {
-		return (AE_NO_ACPI_TABLES);
+		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
+		return_ACPI_STATUS (AE_NO_ACPI_TABLES);
 	}
 
 
@@ -68,10 +72,9 @@
 	 * 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);
+		return_ACPI_STATUS (status);
 	}
 
 	/* Ignore exceptions from these */
@@ -80,7 +83,12 @@
 	acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
 
 
-	return (status);
+	ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+		"ACPI Namespace successfully loaded at root %p\n",
+		acpi_gbl_root_node));
+
+
+	return_ACPI_STATUS (status);
 }
 
 
@@ -96,15 +104,18 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_one_complete_parse (
 	u32                     pass_number,
-	ACPI_TABLE_DESC         *table_desc)
+	acpi_table_desc         *table_desc)
 {
-	ACPI_PARSE_DOWNWARDS    descending_callback;
-	ACPI_PARSE_UPWARDS      ascending_callback;
-	ACPI_PARSE_OBJECT       *parse_root;
-	ACPI_STATUS             status;
+	acpi_parse_downwards    descending_callback;
+	acpi_parse_upwards      ascending_callback;
+	acpi_parse_object       *parse_root;
+	acpi_status             status;
+
+
+	FUNCTION_TRACE ("Ns_one_complete_parse");
 
 
 	switch (pass_number) {
@@ -131,14 +142,16 @@
 
 	parse_root = acpi_ps_alloc_op (AML_SCOPE_OP);
 	if (!parse_root) {
-		return (AE_NO_MEMORY);
+		return_ACPI_STATUS (AE_NO_MEMORY);
 	}
 
-	((ACPI_PARSE2_OBJECT *) parse_root)->name = ACPI_ROOT_NAME;
+	((acpi_parse2_object *) parse_root)->name = ACPI_ROOT_NAME;
 
 
 	/* Pass 1:  Parse everything except control method bodies */
 
+	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", pass_number));
+
 	status = acpi_ps_parse_aml (parse_root, table_desc->aml_pointer,
 			 table_desc->aml_length,
 			 ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
@@ -146,7 +159,7 @@
 			 ascending_callback);
 
 	acpi_ps_delete_parse_tree (parse_root);
-	return (status);
+	return_ACPI_STATUS (status);
 }
 
 
@@ -163,12 +176,15 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_parse_table (
-	ACPI_TABLE_DESC         *table_desc,
-	ACPI_NAMESPACE_NODE     *start_node)
+	acpi_table_desc         *table_desc,
+	acpi_namespace_node     *start_node)
 {
-	ACPI_STATUS             status;
+	acpi_status             status;
+
+
+	FUNCTION_TRACE ("Ns_parse_table");
 
 
 	/*
@@ -181,10 +197,9 @@
 	 * to service the entire parse.  The second pass of the parse then
 	 * performs another complete parse of the AML..
 	 */
-
 	status = acpi_ns_one_complete_parse (1, table_desc);
 	if (ACPI_FAILURE (status)) {
-		return (status);
+		return_ACPI_STATUS (status);
 	}
 
 
@@ -197,13 +212,12 @@
 	 * overhead of this is compensated for by the fact that the
 	 * parse objects are all cached.
 	 */
-
 	status = acpi_ns_one_complete_parse (2, table_desc);
 	if (ACPI_FAILURE (status)) {
-		return (status);
+		return_ACPI_STATUS (status);
 	}
 
-	return (status);
+	return_ACPI_STATUS (status);
 }
 
 
@@ -220,21 +234,28 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_load_table (
-	ACPI_TABLE_DESC         *table_desc,
-	ACPI_NAMESPACE_NODE     *node)
+	acpi_table_desc         *table_desc,
+	acpi_namespace_node     *node)
 {
-	ACPI_STATUS             status;
+	acpi_status             status;
+
+
+	FUNCTION_TRACE ("Ns_load_table");
 
 
 	if (!table_desc->aml_pointer) {
-		return (AE_BAD_PARAMETER);
+		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n"));
+		return_ACPI_STATUS (AE_BAD_PARAMETER);
 	}
 
+	ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", table_desc->aml_pointer));
+
 
 	if (!table_desc->aml_length) {
-		return (AE_BAD_PARAMETER);
+		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Zero-length AML block\n"));
+		return_ACPI_STATUS (AE_BAD_PARAMETER);
 	}
 
 
@@ -247,13 +268,14 @@
 	 * to another control method, we can't continue parsing
 	 * because we don't know how many arguments to parse next!
 	 */
+	ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Loading table into namespace ****\n"));
 
 	acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
 	status = acpi_ns_parse_table (table_desc, node->child);
 	acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
 	if (ACPI_FAILURE (status)) {
-		return (status);
+		return_ACPI_STATUS (status);
 	}
 
 	/*
@@ -262,10 +284,15 @@
 	 * just-in-time parsing, we delete the control method
 	 * parse trees.
 	 */
+	ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+		"**** Begin Table Method Parsing and Object Initialization ****\n"));
 
 	status = acpi_ds_initialize_objects (table_desc, node);
 
-	return (status);
+	ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+		"**** Completed Table Method Parsing and Object Initialization ****\n"));
+
+	return_ACPI_STATUS (status);
 }
 
 
@@ -283,13 +310,16 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_load_table_by_type (
-	ACPI_TABLE_TYPE         table_type)
+	acpi_table_type         table_type)
 {
 	u32                     i;
-	ACPI_STATUS             status = AE_OK;
-	ACPI_TABLE_DESC         *table_desc;
+	acpi_status             status = AE_OK;
+	acpi_table_desc         *table_desc;
+
+
+	FUNCTION_TRACE ("Ns_load_table_by_type");
 
 
 	acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
@@ -299,11 +329,12 @@
 	 * Table types supported are:
 	 * DSDT (one), SSDT/PSDT (multiple)
 	 */
-
 	switch (table_type) {
 
 	case ACPI_TABLE_DSDT:
 
+		ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n"));
+
 		table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_DSDT];
 
 		/* If table already loaded into namespace, just return */
@@ -326,17 +357,18 @@
 
 	case ACPI_TABLE_SSDT:
 
+		ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n",
+			acpi_gbl_acpi_tables[ACPI_TABLE_SSDT].count));
+
 		/*
 		 * Traverse list of SSDT tables
 		 */
-
 		table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_SSDT];
 		for (i = 0; i < acpi_gbl_acpi_tables[ACPI_TABLE_SSDT].count; i++) {
 			/*
 			 * Only attempt to load table if it is not
 			 * already loaded!
 			 */
-
 			if (!table_desc->loaded_into_namespace) {
 				status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
 				if (ACPI_FAILURE (status)) {
@@ -353,10 +385,12 @@
 
 	case ACPI_TABLE_PSDT:
 
+		ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n",
+			acpi_gbl_acpi_tables[ACPI_TABLE_PSDT].count));
+
 		/*
 		 * Traverse list of PSDT tables
 		 */
-
 		table_desc = &acpi_gbl_acpi_tables[ACPI_TABLE_PSDT];
 
 		for (i = 0; i < acpi_gbl_acpi_tables[ACPI_TABLE_PSDT].count; i++) {
@@ -387,7 +421,7 @@
 
 	acpi_ut_release_mutex (ACPI_MTX_TABLES);
 
-	return (status);
+	return_ACPI_STATUS (status);
 
 }
 
@@ -408,18 +442,21 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_delete_subtree (
-	ACPI_HANDLE             start_handle)
+	acpi_handle             start_handle)
 {
-	ACPI_STATUS             status;
-	ACPI_HANDLE             child_handle;
-	ACPI_HANDLE             parent_handle;
-	ACPI_HANDLE             next_child_handle;
-	ACPI_HANDLE             dummy;
+	acpi_status             status;
+	acpi_handle             child_handle;
+	acpi_handle             parent_handle;
+	acpi_handle             next_child_handle;
+	acpi_handle             dummy;
 	u32                     level;
 
 
+	FUNCTION_TRACE ("Ns_delete_subtree");
+
+
 	parent_handle = start_handle;
 	child_handle = 0;
 	level        = 1;
@@ -428,7 +465,6 @@
 	 * Traverse the tree of objects until we bubble back up
 	 * to where we started.
 	 */
-
 	while (level > 0) {
 		/* Attempt to get the next object in this scope */
 
@@ -449,7 +485,6 @@
 				 * There is at least one child of this object,
 				 * visit the object
 				 */
-
 				level++;
 				parent_handle = child_handle;
 				child_handle = 0;
@@ -476,7 +511,7 @@
 
 	acpi_ns_delete_node (child_handle);
 
-	return (AE_OK);
+	return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -494,21 +529,24 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ns_unload_namespace (
-	ACPI_HANDLE             handle)
+	acpi_handle             handle)
 {
-	ACPI_STATUS             status;
+	acpi_status             status;
+
+
+	FUNCTION_TRACE ("Ns_unload_name_space");
 
 
 	/* Parameter validation */
 
 	if (!acpi_gbl_root_node) {
-		return (AE_NO_NAMESPACE);
+		return_ACPI_STATUS (AE_NO_NAMESPACE);
 	}
 
 	if (!handle) {
-		return (AE_BAD_PARAMETER);
+		return_ACPI_STATUS (AE_BAD_PARAMETER);
 	}
 
 
@@ -516,7 +554,7 @@
 
 	status = acpi_ns_delete_subtree (handle);
 
-	return (status);
+	return_ACPI_STATUS (status);
 }
 
 

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