* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
- * Copyright (C) 2000 by Ralf Baechle
+ * Copyright (C) 2000, 05 by Ralf Baechle (ralf@linux-mips.org)
* Copyright (C) 2000 by Silicon Graphics, Inc.
* Copyright (C) 2004 by Christoph Hellwig
*
* On SGI IP27 the ARC memory configuration data is completly bogus but
* alternate easier to use mechanisms are available.
*/
+#include <linux/config.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/mmzone.h>
#include <linux/module.h>
+#include <linux/nodemask.h>
#include <linux/swap.h>
#include <linux/bootmem.h>
#include <asm/page.h>
static hubreg_t region_mask;
-static void gen_region_mask(hubreg_t *region_mask, int maxnodes)
+static void gen_region_mask(hubreg_t *region_mask)
{
cnodeid_t cnode;
(*region_mask) = 0;
- for (cnode = 0; cnode < maxnodes; cnode++) {
+ for_each_online_node(cnode) {
(*region_mask) |= 1ULL << get_region(cnode);
}
}
int port;
/* Figure out which routers nodes in question are connected to */
- for (cnode = 0; cnode < numnodes; cnode++) {
+ for_each_online_node(cnode) {
nasid = COMPACT_TO_NASID_NODEID(cnode);
if (nasid == -1) continue;
for (col = 0; col < MAX_COMPACT_NODES; col++)
__node_distances[row][col] = -1;
- for (row = 0; row < numnodes; row++) {
+ for_each_online_node(row) {
nasid = COMPACT_TO_NASID_NODEID(row);
- for (col = 0; col < numnodes; col++) {
+ for_each_online_node(col) {
nasid2 = COMPACT_TO_NASID_NODEID(col);
__node_distances[row][col] =
compute_node_distance(nasid, nasid2);
printk("************** Topology ********************\n");
printk(" ");
- for (col = 0; col < numnodes; col++)
+ for_each_online_node(col)
printk("%02d ", col);
printk("\n");
- for (row = 0; row < numnodes; row++) {
+ for_each_online_node(row) {
printk("%02d ", row);
- for (col = 0; col < numnodes; col++)
+ for_each_online_node(col)
printk("%2d ", node_distance(row, col));
printk("\n");
}
- for (cnode = 0; cnode < numnodes; cnode++) {
+ for_each_online_node(cnode) {
nasid = COMPACT_TO_NASID_NODEID(cnode);
if (nasid == -1) continue;
init_topology_matrix();
dump_topology();
- gen_region_mask(®ion_mask, numnodes);
+ gen_region_mask(®ion_mask);
- setup_replication_mask(numnodes);
+ setup_replication_mask();
/*
* Set all nodes' calias sizes to 8k
*/
- for (i = 0; i < numnodes; i++) {
+ for_each_online_node(i) {
nasid_t nasid;
nasid = COMPACT_TO_NASID_NODEID(i);
num_physpages = 0;
- for (node = 0; node < numnodes; node++) {
+ for_each_online_node(node) {
ignore = nodebytes = 0;
for (slot = 0; slot < MAX_MEM_SLOTS; slot++) {
slot_psize = slot_psize_compute(node, slot);
szmem();
for (node = 0; node < MAX_COMPACT_NODES; node++) {
- if (node < numnodes) {
+ if (node_online(node)) {
node_mem_init(node);
continue;
}
pagetable_init();
- for (node = 0; node < numnodes; node++) {
+ for_each_online_node(node) {
pfn_t start_pfn = slot_getbasepfn(node, 0);
pfn_t end_pfn = node_getmaxclick(node) + 1;
high_memory = (void *) __va(num_physpages << PAGE_SHIFT);
- for (node = 0; node < numnodes; node++) {
+ for_each_online_node(node) {
unsigned slot, numslots;
struct page *end, *p;
-
+
/*
* This will free up the bootmem, ie, slot 0 memory.
*/
*/
numslots = node_getlastslot(node);
for (slot = 1; slot <= numslots; slot++) {
- p = NODE_DATA(node)->node_mem_map +
- (slot_getbasepfn(node, slot) -
- slot_getbasepfn(node, 0));
+ p = nid_page_nr(node, slot_getbasepfn(node, slot) -
+ slot_getbasepfn(node, 0));
/*
* Free valid memory in current slot.