Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ecc3c30a authored by Mark Goodwin's avatar Mark Goodwin Committed by Tony Luck
Browse files

[IA64] - SGI SN hwperf enhancements - export_pci_topology



Bugfix to export PCI topology information in /proc/sgi_sn/sn_topology.

Signed-off-by: default avatarMark Goodwin <markgw@sgi.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 470ceb05
Loading
Loading
Loading
Loading
+16 −34
Original line number Original line Diff line number Diff line
@@ -174,29 +174,22 @@ static const char *sn_hwperf_get_slabname(struct sn_hwperf_object_info *obj,
	return slabname;
	return slabname;
}
}


static void print_pci_topology(struct seq_file *s,
static void print_pci_topology(struct seq_file *s)
	struct sn_hwperf_object_info *obj, int *ordinal,
	u64 rack, u64 bay, u64 slot, u64 slab)
{
{
	char *p1;
	char *p;
	char *p2;
	size_t sz;
	char *pg;
	int e;


	if (!(pg = (char *)get_zeroed_page(GFP_KERNEL)))
	for (sz = PAGE_SIZE; sz < 16 * PAGE_SIZE; sz += PAGE_SIZE) {
		return; /* ignore */
		if (!(p = (char *)kmalloc(sz, GFP_KERNEL)))
	if (ia64_sn_ioif_get_pci_topology(rack, bay, slot, slab,
			break;
		__pa(pg), PAGE_SIZE) == SN_HWPERF_OP_OK) {
		e = ia64_sn_ioif_get_pci_topology(__pa(p), sz);
		for (p1=pg; *p1 && p1 < pg + PAGE_SIZE;) {
		if (e == SALRET_OK)
			if (!(p2 = strchr(p1, '\n')))
			seq_puts(s, p);
		kfree(p);
		if (e == SALRET_OK || e == SALRET_NOT_IMPLEMENTED)
			break;
			break;
			*p2 = '\0';
			seq_printf(s, "pcibus %d %s-%s\n",
				*ordinal, obj->location, p1);
			(*ordinal)++;
			p1 = p2 + 1;
		}
	}
	}
	free_page((unsigned long)pg);
}
}


static int sn_topology_show(struct seq_file *s, void *d)
static int sn_topology_show(struct seq_file *s, void *d)
@@ -215,7 +208,6 @@ static int sn_topology_show(struct seq_file *s, void *d)
	struct sn_hwperf_object_info *p;
	struct sn_hwperf_object_info *p;
	struct sn_hwperf_object_info *obj = d;	/* this object */
	struct sn_hwperf_object_info *obj = d;	/* this object */
	struct sn_hwperf_object_info *objs = s->private; /* all objects */
	struct sn_hwperf_object_info *objs = s->private; /* all objects */
	int rack, bay, slot, slab;
	u8 shubtype;
	u8 shubtype;
	u8 system_size;
	u8 system_size;
	u8 sharing_size;
	u8 sharing_size;
@@ -225,7 +217,6 @@ static int sn_topology_show(struct seq_file *s, void *d)
	u8 region_size;
	u8 region_size;
	u16 nasid_mask;
	u16 nasid_mask;
	int nasid_msb;
	int nasid_msb;
	int pci_bus_ordinal = 0;


	if (obj == objs) {
	if (obj == objs) {
		seq_printf(s, "# sn_topology version 2\n");
		seq_printf(s, "# sn_topology version 2\n");
@@ -253,6 +244,8 @@ static int sn_topology_show(struct seq_file *s, void *d)
			shubtype ? "shub2" : "shub1", 
			shubtype ? "shub2" : "shub1", 
			(u64)nasid_mask << nasid_shift, nasid_msb, nasid_shift,
			(u64)nasid_mask << nasid_shift, nasid_msb, nasid_shift,
			system_size, sharing_size, coher, region_size);
			system_size, sharing_size, coher, region_size);

		print_pci_topology(s);
	}
	}


	if (SN_HWPERF_FOREIGN(obj)) {
	if (SN_HWPERF_FOREIGN(obj)) {
@@ -300,17 +293,6 @@ static int sn_topology_show(struct seq_file *s, void *d)
				seq_putc(s, '\n');
				seq_putc(s, '\n');
			}
			}
		}
		}

		/*
		 * PCI busses attached to this node, if any
		 */
		if (sn_hwperf_location_to_bpos(obj->location,
			&rack, &bay, &slot, &slab)) {
			/* export pci bus info */
			print_pci_topology(s, obj, &pci_bus_ordinal,
				rack, bay, slot, slab);

		}
	}
	}


	if (obj->ports) {
	if (obj->ports) {
+4 −5
Original line number Original line Diff line number Diff line
@@ -78,7 +78,8 @@


#define SN_SAL_HUB_ERROR_INTERRUPT		   0x02000060
#define SN_SAL_HUB_ERROR_INTERRUPT		   0x02000060
#define SN_SAL_BTE_RECOVER			   0x02000061
#define SN_SAL_BTE_RECOVER			   0x02000061
#define SN_SAL_IOIF_GET_PCI_TOPOLOGY	           0x02000062
#define SN_SAL_RESERVED_DO_NOT_USE		   0x02000062
#define SN_SAL_IOIF_GET_PCI_TOPOLOGY		   0x02000064


/*
/*
 * Service-specific constants
 * Service-specific constants
@@ -1069,12 +1070,10 @@ ia64_sn_hwperf_op(nasid_t nasid, u64 opcode, u64 a0, u64 a1, u64 a2,
}
}


static inline int
static inline int
ia64_sn_ioif_get_pci_topology(u64 rack, u64 bay, u64 slot, u64 slab,
ia64_sn_ioif_get_pci_topology(u64 buf, u64 len)
			      u64 buf, u64 len)
{
{
	struct ia64_sal_retval rv;
	struct ia64_sal_retval rv;
	SAL_CALL_NOLOCK(rv, SN_SAL_IOIF_GET_PCI_TOPOLOGY,
	SAL_CALL_NOLOCK(rv, SN_SAL_IOIF_GET_PCI_TOPOLOGY, buf, len, 0, 0, 0, 0, 0);
		rack, bay, slot, slab, buf, len, 0);
	return (int) rv.status;
	return (int) rv.status;
}
}