diff -Nru a/arch/ia64/sn/io/hwgfs/hcl.c b/arch/ia64/sn/io/hwgfs/hcl.c
--- a/arch/ia64/sn/io/hwgfs/hcl.c	Thu Nov  6 13:42:50 2003
+++ b/arch/ia64/sn/io/hwgfs/hcl.c	Thu Nov  6 13:42:50 2003
@@ -23,41 +23,16 @@
 #include <asm/io.h>
 #include <asm/sn/iograph.h>
 #include <asm/sn/hwgfs.h>
-#include <asm/sn/invent.h>
 #include <asm/sn/hcl.h>
 #include <asm/sn/labelcl.h>
 #include <asm/sn/simulator.h>
 
-#define HCL_NAME "SGI-HWGRAPH COMPATIBILITY DRIVER"
-#define HCL_TEMP_NAME "HCL_TEMP_NAME_USED_FOR_HWGRAPH_VERTEX_CREATE"
-#define HCL_TEMP_NAME_LEN 44 
-#define HCL_VERSION "1.0"
-
 #define vertex_hdl_t hwgfs_handle_t
+
 vertex_hdl_t hwgraph_root;
 vertex_hdl_t linux_busnum;
-
 extern void pci_bus_cvlink_init(void);
-
-/*
- * Debug flag definition.
- */
-#define OPTION_NONE             0x00
-#define HCL_DEBUG_NONE 0x00000
-#define HCL_DEBUG_ALL  0x0ffff
-#if defined(CONFIG_HCL_DEBUG)
-static unsigned int hcl_debug_init __initdata = HCL_DEBUG_NONE;
-#endif
-static unsigned int hcl_debug = HCL_DEBUG_NONE;
-#if defined(CONFIG_HCL_DEBUG) && !defined(MODULE)
-static unsigned int boot_options = OPTION_NONE;
-#endif
-
-invplace_t invplace_none = {
-	GRAPH_VERTEX_NONE,
-	GRAPH_VERTEX_PLACE_NONE,
-	NULL
-};
+unsigned long hwgraph_debug_mask;
 
 /*
  * init_hcl() - Boot time initialization.
@@ -71,11 +46,6 @@
 	extern int init_hwgfs_fs(void);
 	int rv = 0;
 
-	if (IS_RUNNING_ON_SIMULATOR()) {
-		extern u64 klgraph_addr[];
-		klgraph_addr[0] = 0xe000003000030000;
-	}
-
 	init_hwgfs_fs();
 
 	/*
@@ -83,7 +53,7 @@
 	 */
 	rv = hwgraph_path_add(NULL, EDGE_LBL_HW, &hwgraph_root);
 	if (rv)
-		printk ("WARNING: init_hcl: Failed to create hwgraph_root. Error = %d.\n", rv);
+		panic("init_hcl: Failed to create hwgraph_root.\n");
 
 	/*
 	 * Initialize the HCL string table.
@@ -103,7 +73,6 @@
 	pci_bus_cvlink_init();
 
 	/*
-	 * Initialize the ifconfgi_net driver that does network devices 
 	 * Persistent Naming.
 	 */
 	init_ioconfig_bus();
@@ -112,50 +81,6 @@
 
 }
 
-
-/*
- * hcl_setup() - Process boot time parameters if given.
- *	"hcl="
- *	This routine gets called only if "hcl=" is given in the 
- *	boot line and before init_hcl().
- *
- *	We currently do not have any boot options .. when we do, 
- *	functionalities can be added here.
- *
- */
-static int __init hcl_setup(char *str)
-{
-    while ( (*str != '\0') && !isspace (*str) )
-    {
-#ifdef CONFIG_HCL_DEBUG
-        if (strncmp (str, "all", 3) == 0) {
-            hcl_debug_init |= HCL_DEBUG_ALL;
-            str += 3;
-        } else 
-        	return 0;
-#endif
-        if (*str != ',') return 0;
-        ++str;
-    }
-
-    return 1;
-
-}
-
-__setup("hcl=", hcl_setup);
-
-
-/*
- * Set device specific "fast information".
- *
- */
-void
-hwgraph_fastinfo_set(vertex_hdl_t de, arbitrary_info_t fastinfo)
-{
-	labelcl_info_replace_IDX(de, HWGRAPH_FASTINFO, fastinfo, NULL);
-}
-
-
 /*
  * Get device specific "fast information".
  *
@@ -181,25 +106,6 @@
 
 
 /*
- * hwgraph_connectpt_set - Sets the connect point handle in de to the 
- *	given connect_de handle.  By default, the connect point of the 
- *	node is the parent.  This effectively changes this assumption.
- */
-int
-hwgraph_connectpt_set(vertex_hdl_t de, vertex_hdl_t connect_de)
-{
-	int rv;
-
-	if (!de)
-		return(-1);
-
-	rv = labelcl_info_connectpt_set(de, connect_de);
-
-	return(rv);
-}
-
-
-/*
  * hwgraph_connectpt_get: Returns the entry's connect point.
  *
  */
@@ -403,39 +309,6 @@
 	return(0);
 }
 
-#if 0
-/*
- * hwgraph_edge_add - This routines has changed from the original conext.
- * All it does now is to create a symbolic link from "from" to "to".
- */
-/* ARGSUSED */
-int
-hwgraph_edge_add(vertex_hdl_t from, vertex_hdl_t to, char *name)
-{
-
-	char *path, *link;
-	vertex_hdl_t handle = NULL;
-	int rv, i;
-
-	handle = hwgfs_find_handle(from, name, 0, 0, 0, 1);
-	if (handle) {
-		return(0);
-	}
-
-	path = kmalloc(1024, GFP_KERNEL);
-	memset(path, 0x0, 1024);
-	link = kmalloc(1024, GFP_KERNEL);
-	memset(path, 0x0, 1024);
-	i = hwgfs_generate_path (to, link, 1024);
-	rv = hwgfs_mk_symlink (from, (const char *)name, 
-			       DEVFS_FL_DEFAULT, link,
-			       &handle, NULL);
-	return(0);
-
-
-}
-#endif
-
 int
 hwgraph_edge_add(vertex_hdl_t from, vertex_hdl_t to, char *name)
 {
@@ -448,8 +321,14 @@
 	int i, count;
 
 	path = kmalloc(1024, GFP_KERNEL);
+	if (!path)
+		return -ENOMEM;
 	memset((char *)path, 0x0, 1024);
 	link = kmalloc(1024, GFP_KERNEL);
+	if (!link) {
+		kfree(path);
+		return -ENOMEM;
+	}
 	memset((char *)link, 0x0, 1024);
 
 	i = hwgfs_generate_path (from, path, 1024);
@@ -683,6 +562,28 @@
 }
 
 /*
+ * hwgraph_path_lookup - return the handle for the given path.
+ *
+ */
+int
+hwgraph_path_lookup(vertex_hdl_t start_vertex_handle,
+			char *lookup_path,
+			vertex_hdl_t *vertex_handle_ptr,
+			char **remainder)
+{
+	*vertex_handle_ptr = hwgfs_find_handle(start_vertex_handle,	/* start dir */
+					lookup_path,		/* path */
+					0,			/* major */
+					0,			/* minor */
+					0,			/* char | block */
+					1);			/* traverse symlinks */
+	if (*vertex_handle_ptr == NULL)
+		return(-1);
+	else
+		return(0);
+}
+
+/*
  * hwgraph_traverse - Find and return the handle starting from de.
  *
  */
@@ -706,39 +607,6 @@
 }
 
 /*
- * hwgraph_path_to_vertex - Return the entry handle for the given 
- *	pathname .. assume traverse symlinks too!.
- */
-vertex_hdl_t
-hwgraph_path_to_vertex(char *path)
-{
-	return(hwgfs_find_handle(NULL,	/* start dir */
-			path,		/* path */
-		    	0,		/* major */
-		    	0,		/* minor */
-		    	0,		/* char | block */
-		    	1));		/* traverse symlinks */
-}
-
-/*
- * hwgraph_inventory_remove - Removes an inventory entry.
- *
- *	Remove an inventory item associated with a vertex.   It is the caller's
- *	responsibility to make sure that there are no races between removing
- *	inventory from a vertex and simultaneously removing that vertex.
-*/
-int
-hwgraph_inventory_remove(	vertex_hdl_t de,
-				int class,
-				int type,
-				major_t controller,
-				minor_t unit,
-				int state)
-{
-	return(0); /* Just a Stub for IRIX code. */
-}
-
-/*
  * Find the canonical name for a given vertex by walking back through
  * connectpt's until we hit the hwgraph root vertex (or until we run
  * out of buffer space or until something goes wrong).
@@ -787,32 +655,56 @@
 char *
 vertex_to_name(vertex_hdl_t vhdl, char *buf, uint buflen)
 {
-	if (hwgraph_vertex_name_get(vhdl, buf, buflen) == GRAPH_SUCCESS)
-		return(buf);
-	else
-		return(DEVNAME_UNKNOWN);
+        if (hwgraph_vertex_name_get(vhdl, buf, buflen) == GRAPH_SUCCESS)
+                return(buf);
+        else
+                return(DEVNAME_UNKNOWN);
 }
 
-graph_error_t
-hwgraph_edge_remove(vertex_hdl_t from, char *name, vertex_hdl_t *toptr)
-{
-	return(GRAPH_ILLEGAL_REQUEST);
-}
 
-graph_error_t
-hwgraph_vertex_unref(vertex_hdl_t vhdl)
+void
+hwgraph_debug(char *file, char * function, int line, vertex_hdl_t vhdl1, vertex_hdl_t vhdl2, char *format, ...)
 {
-	return(GRAPH_ILLEGAL_REQUEST);
-}
 
+	int pos;
+	char *hwpath;
+	va_list ap;
+
+	if ( !hwgraph_debug_mask )
+		return;
+
+	hwpath = kmalloc(MAXDEVNAME, GFP_KERNEL);
+	if (!hwpath)
+		BUG();
+
+	printk("HWGRAPH_DEBUG %s %s %d : ", file, function, line);
+
+	if (vhdl1){
+		memset(hwpath, 0, MAXDEVNAME);
+		pos = hwgfs_generate_path(vhdl1, hwpath, MAXDEVNAME);
+		printk("vhdl1 = %s : ", &hwpath[pos]);
+	}
+
+	if (vhdl2){
+		memset(hwpath, 0, MAXDEVNAME);
+		pos = hwgfs_generate_path(vhdl2, hwpath, MAXDEVNAME);
+		printk("vhdl2 = %s :", &hwpath[pos]);
+	}
+
+	memset(hwpath, 0, MAXDEVNAME);
+        va_start(ap, format);
+        vsnprintf(hwpath, 500, format, ap);
+        va_end(ap);
+	hwpath[MAXDEVNAME -1] = (char)0; /* Just in case. */
+        printk(" %s", hwpath);
+	kfree(hwpath);
+}
 
 EXPORT_SYMBOL(hwgraph_mk_dir);
 EXPORT_SYMBOL(hwgraph_path_add);
 EXPORT_SYMBOL(hwgraph_register);
 EXPORT_SYMBOL(hwgraph_vertex_destroy);
 EXPORT_SYMBOL(hwgraph_fastinfo_get);
-EXPORT_SYMBOL(hwgraph_fastinfo_set);
-EXPORT_SYMBOL(hwgraph_connectpt_set);
 EXPORT_SYMBOL(hwgraph_connectpt_get);
 EXPORT_SYMBOL(hwgraph_info_add_LBL);
 EXPORT_SYMBOL(hwgraph_info_remove_LBL);
@@ -822,5 +714,6 @@
 EXPORT_SYMBOL(hwgraph_info_get_next_LBL);
 EXPORT_SYMBOL(hwgraph_info_export_LBL);
 EXPORT_SYMBOL(hwgraph_info_unexport_LBL);
+EXPORT_SYMBOL(hwgraph_path_lookup);
 EXPORT_SYMBOL(hwgraph_traverse);
 EXPORT_SYMBOL(hwgraph_vertex_name_get);
diff -Nru a/arch/ia64/sn/io/hwgfs/hcl_util.c b/arch/ia64/sn/io/hwgfs/hcl_util.c
--- a/arch/ia64/sn/io/hwgfs/hcl_util.c	Thu Nov  6 13:42:50 2003
+++ b/arch/ia64/sn/io/hwgfs/hcl_util.c	Thu Nov  6 13:42:50 2003
@@ -14,10 +13,8 @@
 #include <asm/sn/io.h>
 #include <asm/sn/iograph.h>
 #include <asm/sn/hwgfs.h>
-#include <asm/sn/invent.h>
 #include <asm/sn/hcl.h>
 #include <asm/sn/labelcl.h>
-#include <asm/sn/invent.h>
 #include <asm/sn/hcl_util.h>
 #include <asm/sn/nodepda.h>
 
@@ -102,25 +99,19 @@
 void
 mark_cpuvertex_as_cpu(vertex_hdl_t vhdl, cpuid_t cpuid)
 {
+	char cpuid_buffer[10];
+
 	if (cpuid == CPU_NONE)
 		return;
 
-	(void)labelcl_info_add_LBL(vhdl, INFO_LBL_CPUID, INFO_DESC_EXPORT,
-			(arbitrary_info_t)cpuid);
-	{
-		char cpuid_buffer[10];
-
-		if (hwgraph_all_cpuids == GRAPH_VERTEX_NONE) {
-			(void)hwgraph_path_add( hwgraph_root,
-						EDGE_LBL_CPUNUM,
-						&hwgraph_all_cpuids);
-		}
-
-		sprintf(cpuid_buffer, "%ld", cpuid);
-		(void)hwgraph_edge_add( hwgraph_all_cpuids,
-							vhdl,
-							cpuid_buffer);
+	if (hwgraph_all_cpuids == GRAPH_VERTEX_NONE) {
+		(void)hwgraph_path_add( hwgraph_root,
+					EDGE_LBL_CPUNUM,
+					&hwgraph_all_cpuids);
 	}
+
+	sprintf(cpuid_buffer, "%ld", cpuid);
+	(void)hwgraph_edge_add( hwgraph_all_cpuids, vhdl, cpuid_buffer);
 }
 
 /*
@@ -161,25 +152,11 @@
 		(void)hwgraph_edge_add( hwgraph_all_cnodes,
 					vhdl,
 					cnodeid_buffer);
+		HWGRAPH_DEBUG((__FILE__, __FUNCTION__, __LINE__, hwgraph_all_cnodes, NULL, "Creating path vhdl1\n"));
 	}
 }
 
 /*
-** If the specified device represents a CPU, return its cpuid;
-** otherwise, return CPU_NONE.
-*/
-cpuid_t
-cpuvertex_to_cpuid(vertex_hdl_t vhdl)
-{
-	arbitrary_info_t cpuid = CPU_NONE;
-
-	(void)labelcl_info_get_LBL(vhdl, INFO_LBL_CPUID, NULL, &cpuid);
-
-	return((cpuid_t)cpuid);
-}
-
-
-/*
 ** dev_to_name converts a vertex_hdl_t into a canonical name.  If the vertex_hdl_t
 ** represents a vertex in the hardware graph, it is converted in the
 ** normal way for vertices.  If the vertex_hdl_t is an old vertex_hdl_t (one which
@@ -196,5 +173,4 @@
 {
         return(vertex_to_name(dev, buf, buflen));
 }
-
 
