cpuid_to_cnodeid(i), cpuid_to_cnodeid(j))); 
cpu_to_node(i), cpu_to_node(j))); 
static int sn_topology_show(struct seq_file *s, void *d){	int sz;	int pt;	int e = 0;	int i;	int j;	const char *slabname;	int ordinal;	cpumask_t cpumask;	char slice;	struct cpuinfo_ia64 *c;	struct sn_hwperf_port_info *ptdata;	struct sn_hwperf_object_info *p;	struct sn_hwperf_object_info *obj = d;	/* this object */	struct sn_hwperf_object_info *objs = s->private; /* all objects */	u8 shubtype;	u8 system_size;	u8 sharing_size;	u8 partid;	u8 coher;	u8 nasid_shift;	u8 region_size;	u16 nasid_mask;	int nasid_msb;	if (obj == objs) {		seq_printf(s, "# sn_topology version 2\n");		seq_printf(s, "# objtype ordinal location partition"			" [attribute value [, ...]]\n");		if (ia64_sn_get_sn_info(0,			&shubtype, &nasid_mask, &nasid_shift, &system_size,			&sharing_size, &partid, &coher, &region_size))			BUG();		for (nasid_msb=63; nasid_msb > 0; nasid_msb--) {			if (((u64)nasid_mask << nasid_shift) & (1ULL << nasid_msb))				break;		}		seq_printf(s, "partition %u %s local "			"shubtype %s, "			"nasid_mask 0x%016lx, "			"nasid_bits %d:%d, "			"system_size %d, "			"sharing_size %d, "			"coherency_domain %d, "			"region_size %d\n",			partid, system_utsname.nodename,			shubtype ? "shub2" : "shub1", 			(u64)nasid_mask << nasid_shift, nasid_msb, nasid_shift,			system_size, sharing_size, coher, region_size);		print_pci_topology(s);	}	if (SN_HWPERF_FOREIGN(obj)) {		/* private in another partition: not interesting */		return 0;	}	for (i = 0; i < SN_HWPERF_MAXSTRING && obj->name[i]; i++) {		if (obj->name[i] == ' ')			obj->name[i] = '_';	}	slabname = sn_hwperf_get_slabname(obj, objs, &ordinal);	seq_printf(s, "%s %d %s %s asic %s", slabname, ordinal, obj->location,		obj->sn_hwp_this_part ? "local" : "shared", obj->name);	if (!SN_HWPERF_IS_NODE(obj) && !SN_HWPERF_IS_IONODE(obj))		seq_putc(s, '\n');	else {		cnodeid_t near_mem = -1;		cnodeid_t near_cpu = -1;		seq_printf(s, ", nasid 0x%x", cnodeid_to_nasid(ordinal));		if (sn_hwperf_get_nearest_node_objdata(objs, sn_hwperf_obj_cnt,			ordinal, &near_mem, &near_cpu) == 0) {			seq_printf(s, ", near_mem_nodeid %d, near_cpu_nodeid %d",				near_mem, near_cpu);		}		if (!SN_HWPERF_IS_IONODE(obj)) {			for_each_online_node(i) {				seq_printf(s, i ? ":%d" : ", dist %d",					node_distance(ordinal, i));			}		}		seq_putc(s, '\n');		/*		 * CPUs on this node, if any		 */		cpumask = node_to_cpumask(ordinal);		for_each_online_cpu(i) {			if (cpu_isset(i, cpumask)) {				slice = 'a' + cpuid_to_slice(i);				c = cpu_data(i);				seq_printf(s, "cpu %d %s%c local"					" freq %luMHz, arch ia64",					i, obj->location, slice,					c->proc_freq / 1000000);				for_each_online_cpu(j) {					seq_printf(s, j ? ":%d" : ", dist %d",						node_distance(						    cpuid_to_cnodeid(i),						    cpuid_to_cnodeid(j)));				}				seq_putc(s, '\n');			}		}	}	if (obj->ports) {		/*		 * numalink ports		 */		sz = obj->ports * sizeof(struct sn_hwperf_port_info);		if ((ptdata = vmalloc(sz)) == NULL)			return -ENOMEM;		e = ia64_sn_hwperf_op(sn_hwperf_master_nasid,				      SN_HWPERF_ENUM_PORTS, obj->id, sz,				      (u64) ptdata, 0, 0, NULL);		if (e != SN_HWPERF_OP_OK)			return -EINVAL;		for (ordinal=0, p=objs; p != obj; p++) {			if (!SN_HWPERF_FOREIGN(p))				ordinal += p->ports;		}		for (pt = 0; pt < obj->ports; pt++) {			for (p = objs, i = 0; i < sn_hwperf_obj_cnt; i++, p++) {				if (ptdata[pt].conn_id == p->id) {					break;				}			}			seq_printf(s, "numalink %d %s-%d",			    ordinal+pt, obj->location, ptdata[pt].port);			if (i >= sn_hwperf_obj_cnt) {				/* no connection */				seq_puts(s, " local endpoint disconnected"					    ", protocol unknown\n");				continue;			}			if (obj->sn_hwp_this_part && p->sn_hwp_this_part)				/* both ends local to this partition */				seq_puts(s, " local");			else if (!obj->sn_hwp_this_part && !p->sn_hwp_this_part)				/* both ends of the link in foreign partiton */				seq_puts(s, " foreign");			else				/* link straddles a partition */				seq_puts(s, " shared");			/*			 * Unlikely, but strictly should query the LLP config			 * registers because an NL4R can be configured to run			 * NL3 protocol, even when not talking to an NL3 router.			 * Ditto for node-node.			 */			seq_printf(s, " endpoint %s-%d, protocol %s\n",				p->location, ptdata[pt].conn_port,				(SN_HWPERF_IS_NL3ROUTER(obj) ||				SN_HWPERF_IS_NL3ROUTER(p)) ?  "LLP3" : "LLP4");		}		vfree(ptdata);	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/24ee0a6d7b0a52b140c880aae24c255de3b4a9a1/sn_hwperf.c/buggy/arch/ia64/sn/kernel/sn2/sn_hwperf.c