aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c71
-rw-r--r--include/asm-ia64/sn/geo.h45
-rw-r--r--include/asm-ia64/sn/sn_sal.h4
-rw-r--r--include/asm-ia64/sn/types.h3
4 files changed, 55 insertions, 68 deletions
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index e731fcb95f90..833e700fdac9 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -116,7 +116,7 @@ static int sn_hwperf_geoid_to_cnode(char *location)
116 module_id = geo_module(geoid); 116 module_id = geo_module(geoid);
117 this_rack = MODULE_GET_RACK(module_id); 117 this_rack = MODULE_GET_RACK(module_id);
118 this_bay = MODULE_GET_BPOS(module_id); 118 this_bay = MODULE_GET_BPOS(module_id);
119 this_slot = 0; /* XXX */ 119 this_slot = geo_slot(geoid);
120 this_slab = geo_slab(geoid); 120 this_slab = geo_slab(geoid);
121 if (rack == this_rack && bay == this_bay && 121 if (rack == this_rack && bay == this_bay &&
122 slot == this_slot && slab == this_slab) { 122 slot == this_slot && slab == this_slab) {
@@ -176,20 +176,27 @@ static const char *sn_hwperf_get_slabname(struct sn_hwperf_object_info *obj,
176 176
177static void print_pci_topology(struct seq_file *s, 177static void print_pci_topology(struct seq_file *s,
178 struct sn_hwperf_object_info *obj, int *ordinal, 178 struct sn_hwperf_object_info *obj, int *ordinal,
179 char *pci_topo_buf, int len) 179 u64 rack, u64 bay, u64 slot, u64 slab)
180{ 180{
181 char *p1; 181 char *p1;
182 char *p2; 182 char *p2;
183 183 char *pg;
184 for (p1=pci_topo_buf; *p1 && p1 < pci_topo_buf + len;) { 184
185 if (!(p2 = strchr(p1, '\n'))) 185 if (!(pg = (char *)get_zeroed_page(GFP_KERNEL)))
186 break; 186 return; /* ignore */
187 *p2 = '\0'; 187 if (ia64_sn_ioif_get_pci_topology(rack, bay, slot, slab,
188 seq_printf(s, "pcibus %d %s-%s\n", 188 __pa(pg), PAGE_SIZE) == SN_HWPERF_OP_OK) {
189 *ordinal, obj->location, p1); 189 for (p1=pg; *p1 && p1 < pg + PAGE_SIZE;) {
190 (*ordinal)++; 190 if (!(p2 = strchr(p1, '\n')))
191 p1 = p2 + 1; 191 break;
192 *p2 = '\0';
193 seq_printf(s, "pcibus %d %s-%s\n",
194 *ordinal, obj->location, p1);
195 (*ordinal)++;
196 p1 = p2 + 1;
197 }
192 } 198 }
199 free_page((unsigned long)pg);
193} 200}
194 201
195static int sn_topology_show(struct seq_file *s, void *d) 202static int sn_topology_show(struct seq_file *s, void *d)
@@ -218,9 +225,7 @@ static int sn_topology_show(struct seq_file *s, void *d)
218 u8 region_size; 225 u8 region_size;
219 u16 nasid_mask; 226 u16 nasid_mask;
220 int nasid_msb; 227 int nasid_msb;
221 char *pci_topo_buf;
222 int pci_bus_ordinal = 0; 228 int pci_bus_ordinal = 0;
223 static int pci_topo_buf_len = 256;
224 229
225 if (obj == objs) { 230 if (obj == objs) {
226 seq_printf(s, "# sn_topology version 2\n"); 231 seq_printf(s, "# sn_topology version 2\n");
@@ -299,41 +304,13 @@ static int sn_topology_show(struct seq_file *s, void *d)
299 /* 304 /*
300 * PCI busses attached to this node, if any 305 * PCI busses attached to this node, if any
301 */ 306 */
302 do { 307 if (sn_hwperf_location_to_bpos(obj->location,
303 if (sn_hwperf_location_to_bpos(obj->location, 308 &rack, &bay, &slot, &slab)) {
304 &rack, &bay, &slot, &slab)) { 309 /* export pci bus info */
305 break; 310 print_pci_topology(s, obj, &pci_bus_ordinal,
306 } 311 rack, bay, slot, slab);
307
308 if (!(pci_topo_buf = vmalloc(pci_topo_buf_len))) {
309 printk("sn_topology_show: vmalloc failed\n");
310 break;
311 }
312 312
313 e = ia64_sn_ioif_get_pci_topology(rack, bay, slot, slab, 313 }
314 pci_topo_buf, pci_topo_buf_len);
315
316 switch (e) {
317 case SALRET_NOT_IMPLEMENTED:
318 case SALRET_INVALID_ARG:
319 /* ignore, don't print anything */
320 e = SN_HWPERF_OP_OK;
321 break;
322
323 case SALRET_ERROR:
324 /* retry with a bigger buffer */
325 pci_topo_buf_len += 256;
326 break;
327
328 case SN_HWPERF_OP_OK:
329 default:
330 /* export pci bus info */
331 print_pci_topology(s, obj, &pci_bus_ordinal,
332 pci_topo_buf, pci_topo_buf_len);
333 break;
334 }
335 vfree(pci_topo_buf);
336 } while (e != SN_HWPERF_OP_OK && pci_topo_buf_len < 0x200000);
337 } 314 }
338 315
339 if (obj->ports) { 316 if (obj->ports) {
diff --git a/include/asm-ia64/sn/geo.h b/include/asm-ia64/sn/geo.h
index f566343d25f8..84b254603b8d 100644
--- a/include/asm-ia64/sn/geo.h
+++ b/include/asm-ia64/sn/geo.h
@@ -18,32 +18,34 @@
18#define GEOID_SIZE 8 /* Would 16 be better? The size can 18#define GEOID_SIZE 8 /* Would 16 be better? The size can
19 be different on different platforms. */ 19 be different on different platforms. */
20 20
21#define MAX_SLABS 0xe /* slabs per module */ 21#define MAX_SLOTS 0xf /* slots per module */
22#define MAX_SLABS 0xf /* slabs per slot */
22 23
23typedef unsigned char geo_type_t; 24typedef unsigned char geo_type_t;
24 25
25/* Fields common to all substructures */ 26/* Fields common to all substructures */
26typedef struct geo_any_s { 27typedef struct geo_common_s {
27 moduleid_t module; /* The module (box) this h/w lives in */ 28 moduleid_t module; /* The module (box) this h/w lives in */
28 geo_type_t type; /* What type of h/w is named by this geoid_t */ 29 geo_type_t type; /* What type of h/w is named by this geoid_t */
29 slabid_t slab; /* The logical assembly within the module */ 30 slabid_t slab:4; /* slab (ASIC), 0 .. 15 within slot */
30} geo_any_t; 31 slotid_t slot:4; /* slot (Blade), 0 .. 15 within module */
32} geo_common_t;
31 33
32/* Additional fields for particular types of hardware */ 34/* Additional fields for particular types of hardware */
33typedef struct geo_node_s { 35typedef struct geo_node_s {
34 geo_any_t any; /* No additional fields needed */ 36 geo_common_t common; /* No additional fields needed */
35} geo_node_t; 37} geo_node_t;
36 38
37typedef struct geo_rtr_s { 39typedef struct geo_rtr_s {
38 geo_any_t any; /* No additional fields needed */ 40 geo_common_t common; /* No additional fields needed */
39} geo_rtr_t; 41} geo_rtr_t;
40 42
41typedef struct geo_iocntl_s { 43typedef struct geo_iocntl_s {
42 geo_any_t any; /* No additional fields needed */ 44 geo_common_t common; /* No additional fields needed */
43} geo_iocntl_t; 45} geo_iocntl_t;
44 46
45typedef struct geo_pcicard_s { 47typedef struct geo_pcicard_s {
46 geo_iocntl_t any; 48 geo_iocntl_t common;
47 char bus; /* Bus/widget number */ 49 char bus; /* Bus/widget number */
48 char slot; /* PCI slot number */ 50 char slot; /* PCI slot number */
49} geo_pcicard_t; 51} geo_pcicard_t;
@@ -62,14 +64,14 @@ typedef struct geo_mem_s {
62 64
63 65
64typedef union geoid_u { 66typedef union geoid_u {
65 geo_any_t any; 67 geo_common_t common;
66 geo_node_t node; 68 geo_node_t node;
67 geo_iocntl_t iocntl; 69 geo_iocntl_t iocntl;
68 geo_pcicard_t pcicard; 70 geo_pcicard_t pcicard;
69 geo_rtr_t rtr; 71 geo_rtr_t rtr;
70 geo_cpu_t cpu; 72 geo_cpu_t cpu;
71 geo_mem_t mem; 73 geo_mem_t mem;
72 char padsize[GEOID_SIZE]; 74 char padsize[GEOID_SIZE];
73} geoid_t; 75} geoid_t;
74 76
75 77
@@ -104,19 +106,26 @@ typedef union geoid_u {
104#define INVALID_CNODEID ((cnodeid_t)-1) 106#define INVALID_CNODEID ((cnodeid_t)-1)
105#define INVALID_PNODEID ((pnodeid_t)-1) 107#define INVALID_PNODEID ((pnodeid_t)-1)
106#define INVALID_SLAB (slabid_t)-1 108#define INVALID_SLAB (slabid_t)-1
109#define INVALID_SLOT (slotid_t)-1
107#define INVALID_MODULE ((moduleid_t)-1) 110#define INVALID_MODULE ((moduleid_t)-1)
108#define INVALID_PARTID ((partid_t)-1) 111#define INVALID_PARTID ((partid_t)-1)
109 112
110static inline slabid_t geo_slab(geoid_t g) 113static inline slabid_t geo_slab(geoid_t g)
111{ 114{
112 return (g.any.type == GEO_TYPE_INVALID) ? 115 return (g.common.type == GEO_TYPE_INVALID) ?
113 INVALID_SLAB : g.any.slab; 116 INVALID_SLAB : g.common.slab;
117}
118
119static inline slotid_t geo_slot(geoid_t g)
120{
121 return (g.common.type == GEO_TYPE_INVALID) ?
122 INVALID_SLOT : g.common.slot;
114} 123}
115 124
116static inline moduleid_t geo_module(geoid_t g) 125static inline moduleid_t geo_module(geoid_t g)
117{ 126{
118 return (g.any.type == GEO_TYPE_INVALID) ? 127 return (g.common.type == GEO_TYPE_INVALID) ?
119 INVALID_MODULE : g.any.module; 128 INVALID_MODULE : g.common.module;
120} 129}
121 130
122extern geoid_t cnodeid_get_geoid(cnodeid_t cnode); 131extern geoid_t cnodeid_get_geoid(cnodeid_t cnode);
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
index 581f9a783045..123c1a50a9dc 100644
--- a/include/asm-ia64/sn/sn_sal.h
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -74,10 +74,10 @@
74#define SN_SAL_IOIF_GET_PCIBUS_INFO 0x02000056 74#define SN_SAL_IOIF_GET_PCIBUS_INFO 0x02000056
75#define SN_SAL_IOIF_GET_PCIDEV_INFO 0x02000057 75#define SN_SAL_IOIF_GET_PCIDEV_INFO 0x02000057
76#define SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST 0x02000058 76#define SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST 0x02000058
77#define SN_SAL_IOIF_GET_PCI_TOPOLOGY 0x02000059
78 77
79#define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060 78#define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060
80#define SN_SAL_BTE_RECOVER 0x02000061 79#define SN_SAL_BTE_RECOVER 0x02000061
80#define SN_SAL_IOIF_GET_PCI_TOPOLOGY 0x02000062
81 81
82/* 82/*
83 * Service-specific constants 83 * Service-specific constants
@@ -1015,7 +1015,7 @@ ia64_sn_hwperf_op(nasid_t nasid, u64 opcode, u64 a0, u64 a1, u64 a2,
1015 1015
1016static inline int 1016static inline int
1017ia64_sn_ioif_get_pci_topology(u64 rack, u64 bay, u64 slot, u64 slab, 1017ia64_sn_ioif_get_pci_topology(u64 rack, u64 bay, u64 slot, u64 slab,
1018 char *buf, u64 len) 1018 u64 buf, u64 len)
1019{ 1019{
1020 struct ia64_sal_retval rv; 1020 struct ia64_sal_retval rv;
1021 SAL_CALL_NOLOCK(rv, SN_SAL_IOIF_GET_PCI_TOPOLOGY, 1021 SAL_CALL_NOLOCK(rv, SN_SAL_IOIF_GET_PCI_TOPOLOGY,
diff --git a/include/asm-ia64/sn/types.h b/include/asm-ia64/sn/types.h
index 586ed47cae9c..8e04ee211e59 100644
--- a/include/asm-ia64/sn/types.h
+++ b/include/asm-ia64/sn/types.h
@@ -16,7 +16,8 @@ typedef signed short nasid_t; /* node id in numa-as-id space */
16typedef signed char partid_t; /* partition ID type */ 16typedef signed char partid_t; /* partition ID type */
17typedef unsigned int moduleid_t; /* user-visible module number type */ 17typedef unsigned int moduleid_t; /* user-visible module number type */
18typedef unsigned int cmoduleid_t; /* kernel compact module id type */ 18typedef unsigned int cmoduleid_t; /* kernel compact module id type */
19typedef signed char slabid_t; 19typedef unsigned char slotid_t; /* slot (blade) within module */
20typedef unsigned char slabid_t; /* slab (asic) within slot */
20typedef u64 nic_t; 21typedef u64 nic_t;
21typedef unsigned long iopaddr_t; 22typedef unsigned long iopaddr_t;
22typedef unsigned long paddr_t; 23typedef unsigned long paddr_t;