diff options
author | Mark Goodwin <markgw@sgi.com> | 2005-08-16 03:50:00 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2005-08-24 19:23:39 -0400 |
commit | ecc3c30ae39c4d3cbf249a1ebd599465e0e25708 (patch) | |
tree | 0a5ee4e1400fc05abc230e99e4d633d9f27304bd /arch/ia64 | |
parent | 470ceb05d9a2b4d61c19fac615a79e56e8401565 (diff) |
[IA64] - SGI SN hwperf enhancements - export_pci_topology
Bugfix to export PCI topology information in /proc/sgi_sn/sn_topology.
Signed-off-by: Mark Goodwin <markgw@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64')
-rw-r--r-- | arch/ia64/sn/kernel/sn2/sn_hwperf.c | 50 |
1 files changed, 16 insertions, 34 deletions
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c index 833e700fdac9..58e48fdf5b47 100644 --- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c +++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c | |||
@@ -174,29 +174,22 @@ static const char *sn_hwperf_get_slabname(struct sn_hwperf_object_info *obj, | |||
174 | return slabname; | 174 | return slabname; |
175 | } | 175 | } |
176 | 176 | ||
177 | static void print_pci_topology(struct seq_file *s, | 177 | static void print_pci_topology(struct seq_file *s) |
178 | struct sn_hwperf_object_info *obj, int *ordinal, | ||
179 | u64 rack, u64 bay, u64 slot, u64 slab) | ||
180 | { | 178 | { |
181 | char *p1; | 179 | char *p; |
182 | char *p2; | 180 | size_t sz; |
183 | char *pg; | 181 | int e; |
184 | 182 | ||
185 | if (!(pg = (char *)get_zeroed_page(GFP_KERNEL))) | 183 | for (sz = PAGE_SIZE; sz < 16 * PAGE_SIZE; sz += PAGE_SIZE) { |
186 | return; /* ignore */ | 184 | if (!(p = (char *)kmalloc(sz, GFP_KERNEL))) |
187 | if (ia64_sn_ioif_get_pci_topology(rack, bay, slot, slab, | 185 | break; |
188 | __pa(pg), PAGE_SIZE) == SN_HWPERF_OP_OK) { | 186 | e = ia64_sn_ioif_get_pci_topology(__pa(p), sz); |
189 | for (p1=pg; *p1 && p1 < pg + PAGE_SIZE;) { | 187 | if (e == SALRET_OK) |
190 | if (!(p2 = strchr(p1, '\n'))) | 188 | seq_puts(s, p); |
191 | break; | 189 | kfree(p); |
192 | *p2 = '\0'; | 190 | if (e == SALRET_OK || e == SALRET_NOT_IMPLEMENTED) |
193 | seq_printf(s, "pcibus %d %s-%s\n", | 191 | break; |
194 | *ordinal, obj->location, p1); | ||
195 | (*ordinal)++; | ||
196 | p1 = p2 + 1; | ||
197 | } | ||
198 | } | 192 | } |
199 | free_page((unsigned long)pg); | ||
200 | } | 193 | } |
201 | 194 | ||
202 | static int sn_topology_show(struct seq_file *s, void *d) | 195 | 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) | |||
215 | struct sn_hwperf_object_info *p; | 208 | struct sn_hwperf_object_info *p; |
216 | struct sn_hwperf_object_info *obj = d; /* this object */ | 209 | struct sn_hwperf_object_info *obj = d; /* this object */ |
217 | struct sn_hwperf_object_info *objs = s->private; /* all objects */ | 210 | struct sn_hwperf_object_info *objs = s->private; /* all objects */ |
218 | int rack, bay, slot, slab; | ||
219 | u8 shubtype; | 211 | u8 shubtype; |
220 | u8 system_size; | 212 | u8 system_size; |
221 | u8 sharing_size; | 213 | u8 sharing_size; |
@@ -225,7 +217,6 @@ static int sn_topology_show(struct seq_file *s, void *d) | |||
225 | u8 region_size; | 217 | u8 region_size; |
226 | u16 nasid_mask; | 218 | u16 nasid_mask; |
227 | int nasid_msb; | 219 | int nasid_msb; |
228 | int pci_bus_ordinal = 0; | ||
229 | 220 | ||
230 | if (obj == objs) { | 221 | if (obj == objs) { |
231 | seq_printf(s, "# sn_topology version 2\n"); | 222 | seq_printf(s, "# sn_topology version 2\n"); |
@@ -253,6 +244,8 @@ static int sn_topology_show(struct seq_file *s, void *d) | |||
253 | shubtype ? "shub2" : "shub1", | 244 | shubtype ? "shub2" : "shub1", |
254 | (u64)nasid_mask << nasid_shift, nasid_msb, nasid_shift, | 245 | (u64)nasid_mask << nasid_shift, nasid_msb, nasid_shift, |
255 | system_size, sharing_size, coher, region_size); | 246 | system_size, sharing_size, coher, region_size); |
247 | |||
248 | print_pci_topology(s); | ||
256 | } | 249 | } |
257 | 250 | ||
258 | if (SN_HWPERF_FOREIGN(obj)) { | 251 | if (SN_HWPERF_FOREIGN(obj)) { |
@@ -300,17 +293,6 @@ static int sn_topology_show(struct seq_file *s, void *d) | |||
300 | seq_putc(s, '\n'); | 293 | seq_putc(s, '\n'); |
301 | } | 294 | } |
302 | } | 295 | } |
303 | |||
304 | /* | ||
305 | * PCI busses attached to this node, if any | ||
306 | */ | ||
307 | if (sn_hwperf_location_to_bpos(obj->location, | ||
308 | &rack, &bay, &slot, &slab)) { | ||
309 | /* export pci bus info */ | ||
310 | print_pci_topology(s, obj, &pci_bus_ordinal, | ||
311 | rack, bay, slot, slab); | ||
312 | |||
313 | } | ||
314 | } | 296 | } |
315 | 297 | ||
316 | if (obj->ports) { | 298 | if (obj->ports) { |