#include <linux/bootmem.h>
#include <linux/mmzone.h>
#include <linux/acpi.h>
+#include <linux/nodemask.h>
#include <asm/srat.h>
/*
}
}
-static void __init initialize_physnode_map(void)
-{
- int i;
- unsigned long pfn;
- struct node_memory_chunk_s *nmcp;
-
- /* Run the list of memory chunks and fill in the phymap. */
- nmcp = node_memory_chunk;
- for (i = num_memory_chunks; --i >= 0; nmcp++) {
- for (pfn = nmcp->start_pfn; pfn <= nmcp->end_pfn;
- pfn += PAGES_PER_ELEMENT)
- {
- physnode_map[pfn / PAGES_PER_ELEMENT] = (int)nmcp->nid;
- }
- }
-}
-
/* Parse the ACPI Static Resource Affinity Table */
static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
{
* a set of sequential node IDs starting at zero. (ACPI doesn't seem
* to specify the range of _PXM values.)
*/
- numnodes = 0; /* init total nodes in system */
+ /*
+ * MCD - we no longer HAVE to number nodes sequentially. PXM domain
+ * numbers could go as high as 256, and MAX_NUMNODES for i386 is typically
+ * 32, so we will continue numbering them in this manner until MAX_NUMNODES
+ * approaches MAX_PXM_DOMAINS for i386.
+ */
+ nodes_clear(node_online_map);
for (i = 0; i < MAX_PXM_DOMAINS; i++) {
if (BMAP_TEST(pxm_bitmap, i)) {
- pxm_to_nid_map[i] = numnodes;
- nid_to_pxm_map[numnodes] = i;
- node_set_online(numnodes);
- ++numnodes;
+ nid = num_online_nodes();
+ pxm_to_nid_map[i] = nid;
+ nid_to_pxm_map[nid] = i;
+ node_set_online(nid);
}
}
-
- if (numnodes == 0)
- BUG();
+ BUG_ON(num_online_nodes() == 0);
/* set cnode id in memory chunk structure */
for (i = 0; i < num_memory_chunks; i++)
node_memory_chunk[i].nid = pxm_to_nid_map[node_memory_chunk[i].pxm];
- initialize_physnode_map();
-
printk("pxm bitmap: ");
for (i = 0; i < sizeof(pxm_bitmap); i++) {
printk("%02X ", pxm_bitmap[i]);
}
printk("\n");
- printk("Number of logical nodes in system = %d\n", numnodes);
+ printk("Number of logical nodes in system = %d\n", num_online_nodes());
printk("Number of memory chunks in system = %d\n", num_memory_chunks);
for (j = 0; j < num_memory_chunks; j++){
}
/*calculate node_start_pfn/node_end_pfn arrays*/
- for (nid = 0; nid < numnodes; nid++) {
+ for_each_online_node(nid) {
int been_here_before = 0;
for (j = 0; j < num_memory_chunks; j++){
int first;
unsigned long end = 0;
- for (nid = 0; nid < numnodes; nid++) {
+ for_each_online_node(nid) {
first = 1;
for (c = 0; c < num_memory_chunks; c++){
if (node_memory_chunk[c].nid == nid) {
zholes_size_init++;
get_zholes_init();
}
- if((nid >= numnodes) | (nid >= MAX_NUMNODES))
- printk("%s: nid = %d is invalid. numnodes = %d",
- __FUNCTION__, nid, numnodes);
+ if (nid >= MAX_NUMNODES || !node_online(nid))
+ printk("%s: nid = %d is invalid/offline. num_online_nodes = %d",
+ __FUNCTION__, nid, num_online_nodes());
return &zholes_size[nid * MAX_NR_ZONES];
}