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 | |
| 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>
| -rw-r--r-- | arch/ia64/sn/kernel/sn2/sn_hwperf.c | 50 | ||||
| -rw-r--r-- | include/asm-ia64/sn/sn_sal.h | 9 |
2 files changed, 20 insertions, 39 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) { |
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h index 99cb9ed34312..02d16e34fd0c 100644 --- a/include/asm-ia64/sn/sn_sal.h +++ b/include/asm-ia64/sn/sn_sal.h | |||
| @@ -78,7 +78,8 @@ | |||
| 78 | 78 | ||
| 79 | #define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060 | 79 | #define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060 |
| 80 | #define SN_SAL_BTE_RECOVER 0x02000061 | 80 | #define SN_SAL_BTE_RECOVER 0x02000061 |
| 81 | #define SN_SAL_IOIF_GET_PCI_TOPOLOGY 0x02000062 | 81 | #define SN_SAL_RESERVED_DO_NOT_USE 0x02000062 |
| 82 | #define SN_SAL_IOIF_GET_PCI_TOPOLOGY 0x02000064 | ||
| 82 | 83 | ||
| 83 | /* | 84 | /* |
| 84 | * Service-specific constants | 85 | * Service-specific constants |
| @@ -1069,12 +1070,10 @@ ia64_sn_hwperf_op(nasid_t nasid, u64 opcode, u64 a0, u64 a1, u64 a2, | |||
| 1069 | } | 1070 | } |
| 1070 | 1071 | ||
| 1071 | static inline int | 1072 | static inline int |
| 1072 | ia64_sn_ioif_get_pci_topology(u64 rack, u64 bay, u64 slot, u64 slab, | 1073 | ia64_sn_ioif_get_pci_topology(u64 buf, u64 len) |
| 1073 | u64 buf, u64 len) | ||
| 1074 | { | 1074 | { |
| 1075 | struct ia64_sal_retval rv; | 1075 | struct ia64_sal_retval rv; |
| 1076 | SAL_CALL_NOLOCK(rv, SN_SAL_IOIF_GET_PCI_TOPOLOGY, | 1076 | SAL_CALL_NOLOCK(rv, SN_SAL_IOIF_GET_PCI_TOPOLOGY, buf, len, 0, 0, 0, 0, 0); |
| 1077 | rack, bay, slot, slab, buf, len, 0); | ||
| 1078 | return (int) rv.status; | 1077 | return (int) rv.status; |
| 1079 | } | 1078 | } |
| 1080 | 1079 | ||
