From: Pat Gefre <pfg@sgi.com>

A few small clean ups



---

 25-akpm/arch/ia64/sn/io/platform_init/irix_io_init.c |    2 +
 25-akpm/arch/ia64/sn/io/sn2/klgraph.c                |    5 +--
 25-akpm/arch/ia64/sn/io/sn2/ml_SN_init.c             |   29 ++++++++++++++-----
 25-akpm/arch/ia64/sn/kernel/setup.c                  |    6 +++
 25-akpm/include/asm-ia64/sn/ioerror.h                |    4 --
 5 files changed, 32 insertions(+), 14 deletions(-)

diff -puN arch/ia64/sn/io/platform_init/irix_io_init.c~sn31 arch/ia64/sn/io/platform_init/irix_io_init.c
--- 25/arch/ia64/sn/io/platform_init/irix_io_init.c~sn31	Thu Jan  8 15:22:56 2004
+++ 25-akpm/arch/ia64/sn/io/platform_init/irix_io_init.c	Thu Jan  8 15:22:56 2004
@@ -26,6 +26,8 @@ extern vertex_hdl_t hwgraph_root;
 extern void io_module_init(void);
 extern int pci_bus_to_hcl_cvlink(void);
 
+nasid_t master_baseio_nasid;
+nasid_t master_nasid = INVALID_NASID;           /* This is the partition master nasid */
 
 /*
  * This routine is responsible for the setup of all the IRIX hwgraph style
diff -puN arch/ia64/sn/io/sn2/klgraph.c~sn31 arch/ia64/sn/io/sn2/klgraph.c
--- 25/arch/ia64/sn/io/sn2/klgraph.c~sn31	Thu Jan  8 15:22:56 2004
+++ 25-akpm/arch/ia64/sn/io/sn2/klgraph.c	Thu Jan  8 15:22:56 2004
@@ -29,7 +29,6 @@
 #define GRPRINTF(x)
 #endif
 
-extern char arg_maxnodes[];
 void mark_cpuvertex_as_cpu(vertex_hdl_t vhdl, cpuid_t cpuid);
 
 
@@ -159,7 +158,7 @@ klhwg_add_xbow(cnodeid_t cnode, nasid_t 
                                 printk(KERN_WARNING  "klhwg_add_xbow: Check for "
                                         "working routers and router links!");
 
-                        panic("klhwg_add_xbow: Failed to add "
+                        printk("klhwg_add_xbow: Failed to add "
                                 "edge: vertex 0x%p to vertex 0x%p,"
                                 "error %d\n",
                                 (void *)hubv, (void *)xbow_v, err);
@@ -346,7 +345,7 @@ klhwg_connect_one_router(vertex_hdl_t hw
 
 	/* We don't know what to do with multiple router components */
 	if (brd->brd_numcompts != 1) {
-		panic("klhwg_connect_one_router: %d cmpts on router\n",
+		printk("klhwg_connect_one_router: %d cmpts on router\n",
 			brd->brd_numcompts);
 		return;
 	}
diff -puN arch/ia64/sn/io/sn2/ml_SN_init.c~sn31 arch/ia64/sn/io/sn2/ml_SN_init.c
--- 25/arch/ia64/sn/io/sn2/ml_SN_init.c~sn31	Thu Jan  8 15:22:56 2004
+++ 25-akpm/arch/ia64/sn/io/sn2/ml_SN_init.c	Thu Jan  8 15:22:56 2004
@@ -23,10 +23,6 @@ int		maxcpus;
 
 extern xwidgetnum_t hub_widget_id(nasid_t);
 
-nasid_t master_nasid = INVALID_NASID;		/* This is the partition master nasid */
-nasid_t master_baseio_nasid = INVALID_NASID;	/* This is the master base I/O nasid */
-
-
 /* XXX - Move the meat of this to intr.c ? */
 /*
  * Set up the platform-dependent fields in the nodepda.
@@ -34,22 +30,26 @@ nasid_t master_baseio_nasid = INVALID_NA
 void init_platform_nodepda(nodepda_t *npda, cnodeid_t node)
 {
 	hubinfo_t hubinfo;
+	nasid_t nasid;
 
 	extern void router_map_init(nodepda_t *);
 	extern void router_queue_init(nodepda_t *,cnodeid_t);
 	extern void intr_init_vecblk(nodepda_t *, cnodeid_t, int);
 
 	/* Allocate per-node platform-dependent data */
-	hubinfo = (hubinfo_t)alloc_bootmem_node(NODE_DATA(node), sizeof(struct hubinfo_s));
+	
+	nasid = COMPACT_TO_NASID_NODEID(node);
+	if (node >= numnodes) /* Headless/memless IO nodes */
+		hubinfo = (hubinfo_t)alloc_bootmem_node(NODE_DATA(0), sizeof(struct hubinfo_s));
+	else
+		hubinfo = (hubinfo_t)alloc_bootmem_node(NODE_DATA(node), sizeof(struct hubinfo_s));
 
 	npda->pdinfo = (void *)hubinfo;
 	hubinfo->h_nodepda = npda;
 	hubinfo->h_cnodeid = node;
-	hubinfo->h_nasid = COMPACT_TO_NASID_NODEID(node);
 
 	spin_lock_init(&hubinfo->h_crblock);
 
-	hubinfo->h_widgetid = hub_widget_id(hubinfo->h_nasid);
 	npda->xbow_peer = INVALID_NASID;
 
 	/* 
@@ -70,6 +70,21 @@ void init_platform_nodepda(nodepda_t *np
 }
 
 void
+init_platform_hubinfo(nodepda_t **nodepdaindr) {
+	cnodeid_t       cnode;
+	hubinfo_t hubinfo;
+	nodepda_t *npda;
+	extern int numionodes;
+
+	for (cnode = 0; cnode < numionodes; cnode++) {
+		npda = nodepdaindr[cnode];
+		hubinfo = (hubinfo_t)npda->pdinfo;
+		hubinfo->h_nasid = COMPACT_TO_NASID_NODEID(cnode);
+		hubinfo->h_widgetid = hub_widget_id(hubinfo->h_nasid);
+	}
+}
+
+void
 update_node_information(cnodeid_t cnodeid)
 {
 	nodepda_t *npda = NODEPDA(cnodeid);
diff -puN arch/ia64/sn/kernel/setup.c~sn31 arch/ia64/sn/kernel/setup.c
--- 25/arch/ia64/sn/kernel/setup.c~sn31	Thu Jan  8 15:22:56 2004
+++ 25-akpm/arch/ia64/sn/kernel/setup.c	Thu Jan  8 15:22:56 2004
@@ -287,6 +287,12 @@ sn_setup(char **cmdline_p)
 	 */
 	sn_cpu_init();
 
+	/*
+	 * Setup hubinfo stuff. Has to happen AFTER sn_cpu_init(),
+	 * because it uses the cnode to nasid tables.
+	 */
+	init_platform_hubinfo(nodepdaindr);
+
 #ifdef CONFIG_SMP
 	init_smp_config();
 #endif
diff -puN include/asm-ia64/sn/ioerror.h~sn31 include/asm-ia64/sn/ioerror.h
--- 25/include/asm-ia64/sn/ioerror.h~sn31	Thu Jan  8 15:22:56 2004
+++ 25-akpm/include/asm-ia64/sn/ioerror.h	Thu Jan  8 15:22:56 2004
@@ -184,13 +184,9 @@ typedef enum {
 typedef int             error_handler_f(void *, int, ioerror_mode_t, ioerror_t *);
 typedef void           *error_handler_arg_t;
 
-extern void             sn_ioerror_dump(char *, int, int, ioerror_t *);
-
 #ifdef	ERROR_DEBUG
-#define	IOERROR_DUMP(x, y, z, t)	sn_ioerror_dump((x), (y), (z), (t))
 #define	IOERR_PRINTF(x)	(x)
 #else
-#define	IOERROR_DUMP(x, y, z, t)
 #define	IOERR_PRINTF(x)
 #endif				/* ERROR_DEBUG */
 

_