From: Pat Gefre <pfg@sgi.com>

Added cbrick_type_get_nasid() function



---

 25-akpm/arch/ia64/sn/io/machvec/pci_bus_cvlink.c |    2 -
 25-akpm/arch/ia64/sn/io/sn2/klconflib.c          |   24 +++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff -puN arch/ia64/sn/io/machvec/pci_bus_cvlink.c~sn51 arch/ia64/sn/io/machvec/pci_bus_cvlink.c
--- 25/arch/ia64/sn/io/machvec/pci_bus_cvlink.c~sn51	Thu Jan  8 15:25:20 2004
+++ 25-akpm/arch/ia64/sn/io/machvec/pci_bus_cvlink.c	Thu Jan  8 15:25:20 2004
@@ -27,6 +27,7 @@ vertex_hdl_t devfn_to_vertex(unsigned ch
 extern void register_pcibr_intr(int irq, pcibr_intr_t intr);
 
 void sn_dma_flush_init(unsigned long start, unsigned long end, int idx, int pin, int slot);
+extern int cbrick_type_get_nasid(nasid_t);
 
 #define IS_OPUS(nasid) (cbrick_type_get_nasid(nasid) == MODULE_OPUSBRICK)
 #define IS_ALTIX(nasid) (cbrick_type_get_nasid(nasid) == MODULE_CBRICK)
@@ -344,7 +345,6 @@ sn_pci_fixup(int arg)
 	struct sn_device_sysdata *device_sysdata;
 	pcibr_intr_t intr_handle;
 	pciio_provider_t *pci_provider;
-	int cpuid;
 	vertex_hdl_t device_vertex;
 	pciio_intr_line_t lines;
 	extern int numnodes;
diff -puN arch/ia64/sn/io/sn2/klconflib.c~sn51 arch/ia64/sn/io/sn2/klconflib.c
--- 25/arch/ia64/sn/io/sn2/klconflib.c~sn51	Thu Jan  8 15:25:20 2004
+++ 25-akpm/arch/ia64/sn/io/sn2/klconflib.c	Thu Jan  8 15:25:20 2004
@@ -645,3 +645,27 @@ parse_module_id(char *buffer)
 	/* avoid sign extending the moduleid_t */
 	return (int)(unsigned short)m;
 }
+
+int
+cbrick_type_get_nasid(nasid_t nasid)
+{
+	lboard_t *brd;
+	moduleid_t module;
+	uint type;
+	int t;
+
+	brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_SNIA);
+	module = geo_module(brd->brd_geoid);
+	type = (module & MODULE_BTYPE_MASK) >> MODULE_BTYPE_SHFT;
+	/* convert brick_type to lower case */
+	if ((type >= 'A') && (type <= 'Z'))
+		type = type - 'A' + 'a';
+    
+	/* convert to a module.h brick type */
+	for( t = 0; t < MAX_BRICK_TYPES; t++ ) {
+		if( brick_types[t] == type ) {
+			return t;
+		}
+	} 
+	return -1;
+}

_