14 #include <linux/kernel.h>
18 #include <linux/module.h>
25 #include <asm/pgalloc.h>
26 #include <asm/sections.h>
28 #include <asm/sn/arch.h>
30 #include <asm/sn/klconfig.h>
34 #define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT)
35 #define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT)
43 static int is_fine_dirmode(
void)
59 static void gen_region_mask(
hubreg_t *region_mask)
65 (*region_mask) |= 1ULL << get_region(cnode);
69 #define rou_rflag rou_flags
71 static int router_distance;
79 if (router_a->rou_rflag == 1)
82 if (depth >= router_distance)
85 router_a->rou_rflag = 1;
87 for (port = 1; port <= MAX_ROUTER_PORTS; port++) {
97 if (router == router_b) {
98 if (depth < router_distance)
99 router_distance =
depth;
102 router_recurse(router, router_b, depth + 1);
106 router_a->rou_rflag = 0;
123 if (nasid == -1)
continue;
136 router->rou_rflag = 0;
138 for (port = 1; port <= MAX_ROUTER_PORTS; port++) {
157 if (router_a ==
NULL) {
158 printk(
"node_distance: router_a NULL\n");
161 if (router_b ==
NULL) {
162 printk(
"node_distance: router_b NULL\n");
166 if (nasid_a == nasid_b)
169 if (router_a == router_b)
172 router_distance = 100;
173 router_recurse(router_a, router_b, 2);
175 return router_distance;
178 static void __init init_topology_matrix(
void)
185 __node_distances[row][col] = -1;
191 __node_distances[row][col] =
192 compute_node_distance(nasid, nasid2);
197 static void __init dump_topology(
void)
207 printk(
"************** Topology ********************\n");
223 if (nasid == -1)
continue;
234 printk(
"Router %d:", router_num);
239 for (port = 1; port <= MAX_ROUTER_PORTS; port++) {
300 static void __init mlreset(
void)
305 fine_mode = is_fine_dirmode();
315 init_topology_matrix();
318 gen_region_mask(®ion_mask);
336 #ifdef CONFIG_REPLICATE_EXHANDLERS
354 static void __init szmem(
void)
356 pfn_t slot_psize, slot0sz = 0, nodebytes;
365 slot_psize = slot_psize_compute(node, slot);
367 slot0sz = slot_psize;
379 printk(
"Ignoring slot %d onwards on node %d\n",
393 pfn_t slot_firstpfn = slot_getbasepfn(node, 0);
395 unsigned long bootmap_size;
396 pfn_t start_pfn, end_pfn;
398 get_pfn_range_for_nid(node, &start_pfn, &end_pfn);
407 NODE_DATA(node)->node_start_pfn = start_pfn;
408 NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn;
417 free_bootmem_with_active_regions(node, end_pfn);
419 ((slot_freepfn - slot_firstpfn) <<
PAGE_SHIFT) + bootmap_size,
421 sparse_memory_present_with_active_regions(node);
451 __node_data[
node] = &null_node;
464 unsigned long zones_size[MAX_NR_ZONES] = {0, };
470 pfn_t start_pfn, end_pfn;
472 get_pfn_range_for_nid(node, &start_pfn, &end_pfn);
478 free_area_init_nodes(zones_size);
483 unsigned long codesize, datasize, initsize,
tmp;
501 tmp = nr_free_pages();
503 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",