aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2005-10-28 16:24:06 -0400
committerTony Luck <tony.luck@intel.com>2005-10-28 16:24:06 -0400
commita1e78db3f54d3481726ed2d3d58d8ad5b19b13d0 (patch)
tree5793f26d8787ee8462a0ac4316b4a07d7cfa04af /arch
parentfbbb0bd1f6eb2d8b28d246a4821453bdc3d01b2f (diff)
parent59c422358d6573716f2bf2e78e5b12c20eff5a31 (diff)
Pull define-node-cleanup into release branch
Diffstat (limited to 'arch')
-rw-r--r--arch/ia64/sn/kernel/io_init.c4
-rw-r--r--arch/ia64/sn/kernel/setup.c160
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c4
-rw-r--r--arch/ia64/sn/kernel/tiocx.c5
-rw-r--r--arch/ia64/sn/kernel/xpc_partition.c2
5 files changed, 57 insertions, 118 deletions
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 906622d9f933..b4f5053f5e1b 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -22,8 +22,6 @@
22#include "xtalk/hubdev.h" 22#include "xtalk/hubdev.h"
23#include "xtalk/xwidgetdev.h" 23#include "xtalk/xwidgetdev.h"
24 24
25nasid_t master_nasid = INVALID_NASID; /* Partition Master */
26
27static struct list_head sn_sysdata_list; 25static struct list_head sn_sysdata_list;
28 26
29/* sysdata list struct */ 27/* sysdata list struct */
@@ -165,7 +163,7 @@ static void sn_fixup_ionodes(void)
165 * Get SGI Specific HUB chipset information. 163 * Get SGI Specific HUB chipset information.
166 * Inform Prom that this kernel can support domain bus numbering. 164 * Inform Prom that this kernel can support domain bus numbering.
167 */ 165 */
168 for (i = 0; i < numionodes; i++) { 166 for (i = 0; i < num_cnodes; i++) {
169 hubdev = (struct hubdev_info *)(NODEPDA(i)->pdinfo); 167 hubdev = (struct hubdev_info *)(NODEPDA(i)->pdinfo);
170 nasid = cnodeid_to_nasid(i); 168 nasid = cnodeid_to_nasid(i);
171 hubdev->max_segment_number = 0xffffffff; 169 hubdev->max_segment_number = 0xffffffff;
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 6f8c5883716b..0fb579ef18c2 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -59,8 +59,6 @@ DEFINE_PER_CPU(struct pda_s, pda_percpu);
59 59
60#define MAX_PHYS_MEMORY (1UL << IA64_MAX_PHYS_BITS) /* Max physical address supported */ 60#define MAX_PHYS_MEMORY (1UL << IA64_MAX_PHYS_BITS) /* Max physical address supported */
61 61
62lboard_t *root_lboard[MAX_COMPACT_NODES];
63
64extern void bte_init_node(nodepda_t *, cnodeid_t); 62extern void bte_init_node(nodepda_t *, cnodeid_t);
65 63
66extern void sn_timer_init(void); 64extern void sn_timer_init(void);
@@ -97,15 +95,15 @@ u8 sn_region_size;
97EXPORT_SYMBOL(sn_region_size); 95EXPORT_SYMBOL(sn_region_size);
98int sn_prom_type; /* 0=hardware, 1=medusa/realprom, 2=medusa/fakeprom */ 96int sn_prom_type; /* 0=hardware, 1=medusa/realprom, 2=medusa/fakeprom */
99 97
100short physical_node_map[MAX_PHYSNODE_ID]; 98short physical_node_map[MAX_NUMALINK_NODES];
101static unsigned long sn_prom_features[MAX_PROM_FEATURE_SETS]; 99static unsigned long sn_prom_features[MAX_PROM_FEATURE_SETS];
102 100
103EXPORT_SYMBOL(physical_node_map); 101EXPORT_SYMBOL(physical_node_map);
104 102
105int numionodes; 103int num_cnodes;
106 104
107static void sn_init_pdas(char **); 105static void sn_init_pdas(char **);
108static void scan_for_ionodes(void); 106static void build_cnode_tables(void);
109 107
110static nodepda_t *nodepdaindr[MAX_COMPACT_NODES]; 108static nodepda_t *nodepdaindr[MAX_COMPACT_NODES];
111 109
@@ -140,19 +138,6 @@ char drive_info[4 * 16];
140#endif 138#endif
141 139
142/* 140/*
143 * Get nasid of current cpu early in boot before nodepda is initialized
144 */
145static int
146boot_get_nasid(void)
147{
148 int nasid;
149
150 if (ia64_sn_get_sapic_info(get_sapicid(), &nasid, NULL, NULL))
151 BUG();
152 return nasid;
153}
154
155/*
156 * This routine can only be used during init, since 141 * This routine can only be used during init, since
157 * smp_boot_data is an init data structure. 142 * smp_boot_data is an init data structure.
158 * We have to use smp_boot_data.cpu_phys_id to find 143 * We have to use smp_boot_data.cpu_phys_id to find
@@ -223,7 +208,6 @@ void __init early_sn_setup(void)
223} 208}
224 209
225extern int platform_intr_list[]; 210extern int platform_intr_list[];
226extern nasid_t master_nasid;
227static int __initdata shub_1_1_found = 0; 211static int __initdata shub_1_1_found = 0;
228 212
229/* 213/*
@@ -269,7 +253,6 @@ static void __init sn_check_for_wars(void)
269void __init sn_setup(char **cmdline_p) 253void __init sn_setup(char **cmdline_p)
270{ 254{
271 long status, ticks_per_sec, drift; 255 long status, ticks_per_sec, drift;
272 int pxm;
273 u32 version = sn_sal_rev(); 256 u32 version = sn_sal_rev();
274 extern void sn_cpu_init(void); 257 extern void sn_cpu_init(void);
275 258
@@ -300,11 +283,10 @@ void __init sn_setup(char **cmdline_p)
300 283
301 MAX_DMA_ADDRESS = PAGE_OFFSET + MAX_PHYS_MEMORY; 284 MAX_DMA_ADDRESS = PAGE_OFFSET + MAX_PHYS_MEMORY;
302 285
303 memset(physical_node_map, -1, sizeof(physical_node_map)); 286 /*
304 for (pxm = 0; pxm < MAX_PXM_DOMAINS; pxm++) 287 * Build the tables for managing cnodes.
305 if (pxm_to_nid_map[pxm] != -1) 288 */
306 physical_node_map[pxm_to_nasid(pxm)] = 289 build_cnode_tables();
307 pxm_to_nid_map[pxm];
308 290
309 /* 291 /*
310 * Old PROMs do not provide an ACPI FADT. Disable legacy keyboard 292 * Old PROMs do not provide an ACPI FADT. Disable legacy keyboard
@@ -319,8 +301,6 @@ void __init sn_setup(char **cmdline_p)
319 301
320 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF); 302 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF);
321 303
322 master_nasid = boot_get_nasid();
323
324 status = 304 status =
325 ia64_sal_freq_base(SAL_FREQ_BASE_REALTIME_CLOCK, &ticks_per_sec, 305 ia64_sal_freq_base(SAL_FREQ_BASE_REALTIME_CLOCK, &ticks_per_sec,
326 &drift); 306 &drift);
@@ -378,15 +358,6 @@ static void __init sn_init_pdas(char **cmdline_p)
378{ 358{
379 cnodeid_t cnode; 359 cnodeid_t cnode;
380 360
381 memset(sn_cnodeid_to_nasid, -1,
382 sizeof(__ia64_per_cpu_var(__sn_cnodeid_to_nasid)));
383 for_each_online_node(cnode)
384 sn_cnodeid_to_nasid[cnode] =
385 pxm_to_nasid(nid_to_pxm_map[cnode]);
386
387 numionodes = num_online_nodes();
388 scan_for_ionodes();
389
390 /* 361 /*
391 * Allocate & initalize the nodepda for each node. 362 * Allocate & initalize the nodepda for each node.
392 */ 363 */
@@ -402,7 +373,7 @@ static void __init sn_init_pdas(char **cmdline_p)
402 /* 373 /*
403 * Allocate & initialize nodepda for TIOs. For now, put them on node 0. 374 * Allocate & initialize nodepda for TIOs. For now, put them on node 0.
404 */ 375 */
405 for (cnode = num_online_nodes(); cnode < numionodes; cnode++) { 376 for (cnode = num_online_nodes(); cnode < num_cnodes; cnode++) {
406 nodepdaindr[cnode] = 377 nodepdaindr[cnode] =
407 alloc_bootmem_node(NODE_DATA(0), sizeof(nodepda_t)); 378 alloc_bootmem_node(NODE_DATA(0), sizeof(nodepda_t));
408 memset(nodepdaindr[cnode], 0, sizeof(nodepda_t)); 379 memset(nodepdaindr[cnode], 0, sizeof(nodepda_t));
@@ -411,7 +382,7 @@ static void __init sn_init_pdas(char **cmdline_p)
411 /* 382 /*
412 * Now copy the array of nodepda pointers to each nodepda. 383 * Now copy the array of nodepda pointers to each nodepda.
413 */ 384 */
414 for (cnode = 0; cnode < numionodes; cnode++) 385 for (cnode = 0; cnode < num_cnodes; cnode++)
415 memcpy(nodepdaindr[cnode]->pernode_pdaindr, nodepdaindr, 386 memcpy(nodepdaindr[cnode]->pernode_pdaindr, nodepdaindr,
416 sizeof(nodepdaindr)); 387 sizeof(nodepdaindr));
417 388
@@ -428,7 +399,7 @@ static void __init sn_init_pdas(char **cmdline_p)
428 * Initialize the per node hubdev. This includes IO Nodes and 399 * Initialize the per node hubdev. This includes IO Nodes and
429 * headless/memless nodes. 400 * headless/memless nodes.
430 */ 401 */
431 for (cnode = 0; cnode < numionodes; cnode++) { 402 for (cnode = 0; cnode < num_cnodes; cnode++) {
432 hubdev_init_node(nodepdaindr[cnode], cnode); 403 hubdev_init_node(nodepdaindr[cnode], cnode);
433 } 404 }
434} 405}
@@ -553,87 +524,58 @@ void __init sn_cpu_init(void)
553} 524}
554 525
555/* 526/*
556 * Scan klconfig for ionodes. Add the nasids to the 527 * Build tables for converting between NASIDs and cnodes.
557 * physical_node_map and the pda and increment numionodes.
558 */ 528 */
529static inline int __init board_needs_cnode(int type)
530{
531 return (type == KLTYPE_SNIA || type == KLTYPE_TIO);
532}
559 533
560static void __init scan_for_ionodes(void) 534void __init build_cnode_tables(void)
561{ 535{
562 int nasid = 0; 536 int nasid;
537 int node;
563 lboard_t *brd; 538 lboard_t *brd;
564 539
565 /* fakeprom does not support klgraph */ 540 memset(physical_node_map, -1, sizeof(physical_node_map));
566 if (IS_RUNNING_ON_FAKE_PROM()) 541 memset(sn_cnodeid_to_nasid, -1,
567 return; 542 sizeof(__ia64_per_cpu_var(__sn_cnodeid_to_nasid)));
568
569 /* Setup ionodes with memory */
570 for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid += 2) {
571 char *klgraph_header;
572 cnodeid_t cnodeid;
573
574 if (physical_node_map[nasid] == -1)
575 continue;
576 543
577 cnodeid = -1; 544 /*
578 klgraph_header = __va(ia64_sn_get_klconfig_addr(nasid)); 545 * First populate the tables with C/M bricks. This ensures that
579 if (!klgraph_header) { 546 * cnode == node for all C & M bricks.
580 BUG(); /* All nodes must have klconfig tables! */ 547 */
581 } 548 for_each_online_node(node) {
582 cnodeid = nasid_to_cnodeid(nasid); 549 nasid = pxm_to_nasid(nid_to_pxm_map[node]);
583 root_lboard[cnodeid] = (lboard_t *) 550 sn_cnodeid_to_nasid[node] = nasid;
584 NODE_OFFSET_TO_LBOARD((nasid), 551 physical_node_map[nasid] = node;
585 ((kl_config_hdr_t
586 *) (klgraph_header))->
587 ch_board_info);
588 } 552 }
589 553
590 /* Scan headless/memless IO Nodes. */ 554 /*
591 for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid += 2) { 555 * num_cnodes is total number of C/M/TIO bricks. Because of the 256 node
592 /* if there's no nasid, don't try to read the klconfig on the node */ 556 * limit on the number of nodes, we can't use the generic node numbers
593 if (physical_node_map[nasid] == -1) 557 * for this. Note that num_cnodes is incremented below as TIOs or
594 continue; 558 * headless/memoryless nodes are discovered.
595 brd = find_lboard_any((lboard_t *) 559 */
596 root_lboard[nasid_to_cnodeid(nasid)], 560 num_cnodes = num_online_nodes();
597 KLTYPE_SNIA);
598 if (brd) {
599 brd = KLCF_NEXT_ANY(brd); /* Skip this node's lboard */
600 if (!brd)
601 continue;
602 }
603
604 brd = find_lboard_any(brd, KLTYPE_SNIA);
605 561
606 while (brd) { 562 /* fakeprom does not support klgraph */
607 sn_cnodeid_to_nasid[numionodes] = brd->brd_nasid; 563 if (IS_RUNNING_ON_FAKE_PROM())
608 physical_node_map[brd->brd_nasid] = numionodes; 564 return;
609 root_lboard[numionodes] = brd;
610 numionodes++;
611 brd = KLCF_NEXT_ANY(brd);
612 if (!brd)
613 break;
614
615 brd = find_lboard_any(brd, KLTYPE_SNIA);
616 }
617 }
618 565
619 /* Scan for TIO nodes. */ 566 /* Find TIOs & headless/memoryless nodes and add them to the tables */
620 for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid += 2) { 567 for_each_online_node(node) {
621 /* if there's no nasid, don't try to read the klconfig on the node */ 568 kl_config_hdr_t *klgraph_header;
622 if (physical_node_map[nasid] == -1) 569 nasid = cnodeid_to_nasid(node);
623 continue; 570 if ((klgraph_header = ia64_sn_get_klconfig_addr(nasid)) == NULL)
624 brd = find_lboard_any((lboard_t *) 571 BUG();
625 root_lboard[nasid_to_cnodeid(nasid)], 572 brd = NODE_OFFSET_TO_LBOARD(nasid, klgraph_header->ch_board_info);
626 KLTYPE_TIO);
627 while (brd) { 573 while (brd) {
628 sn_cnodeid_to_nasid[numionodes] = brd->brd_nasid; 574 if (board_needs_cnode(brd->brd_type) && physical_node_map[brd->brd_nasid] < 0) {
629 physical_node_map[brd->brd_nasid] = numionodes; 575 sn_cnodeid_to_nasid[num_cnodes] = brd->brd_nasid;
630 root_lboard[numionodes] = brd; 576 physical_node_map[brd->brd_nasid] = num_cnodes++;
631 numionodes++; 577 }
632 brd = KLCF_NEXT_ANY(brd); 578 brd = find_lboard_next(brd);
633 if (!brd)
634 break;
635
636 brd = find_lboard_any(brd, KLTYPE_TIO);
637 } 579 }
638 } 580 }
639} 581}
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 0513aacac8c1..6c6fbca3229c 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -476,8 +476,8 @@ static int sn_topology_show(struct seq_file *s, void *d)
476 for_each_online_cpu(j) { 476 for_each_online_cpu(j) {
477 seq_printf(s, j ? ":%d" : ", dist %d", 477 seq_printf(s, j ? ":%d" : ", dist %d",
478 node_distance( 478 node_distance(
479 cpuid_to_cnodeid(i), 479 cpu_to_node(i),
480 cpuid_to_cnodeid(j))); 480 cpu_to_node(j)));
481 } 481 }
482 seq_putc(s, '\n'); 482 seq_putc(s, '\n');
483 } 483 }
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index e0819ec53116..0d8592a745a7 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -489,12 +489,11 @@ static int __init tiocx_init(void)
489 489
490 bus_register(&tiocx_bus_type); 490 bus_register(&tiocx_bus_type);
491 491
492 for (cnodeid = 0; cnodeid < MAX_COMPACT_NODES; cnodeid++) { 492 for (cnodeid = 0; cnodeid < num_cnodes; cnodeid++) {
493 nasid_t nasid; 493 nasid_t nasid;
494 int bt; 494 int bt;
495 495
496 if ((nasid = cnodeid_to_nasid(cnodeid)) < 0) 496 nasid = cnodeid_to_nasid(cnodeid);
497 break; /* No more nasids .. bail out of loop */
498 497
499 if ((nasid & 0x1) && is_fpga_tio(nasid, &bt)) { 498 if ((nasid & 0x1) && is_fpga_tio(nasid, &bt)) {
500 struct hubdev_info *hubdev; 499 struct hubdev_info *hubdev;
diff --git a/arch/ia64/sn/kernel/xpc_partition.c b/arch/ia64/sn/kernel/xpc_partition.c
index 578265ea9e67..72ef330fb784 100644
--- a/arch/ia64/sn/kernel/xpc_partition.c
+++ b/arch/ia64/sn/kernel/xpc_partition.c
@@ -44,7 +44,7 @@ static u64 xpc_sh2_IPI_access3;
44 44
45 45
46/* original protection values for each node */ 46/* original protection values for each node */
47u64 xpc_prot_vec[MAX_COMPACT_NODES]; 47u64 xpc_prot_vec[MAX_NUMNODES];
48 48
49 49
50/* this partition's reserved page */ 50/* this partition's reserved page */