X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fi386%2Fkernel%2Fsrat.c;h=74b0c8e03fb8078e0513aa148d5d023ceb32ac00;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=8c0bd561f4d6ce0b6ed8aec574bfe9ce0e5faef5;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/arch/i386/kernel/srat.c b/arch/i386/kernel/srat.c index 8c0bd561f..74b0c8e03 100644 --- a/arch/i386/kernel/srat.c +++ b/arch/i386/kernel/srat.c @@ -28,6 +28,7 @@ #include #include #include +#include #include /* @@ -181,23 +182,6 @@ static __init void chunk_to_zones(unsigned long cstart, unsigned long cend, } } -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) { @@ -248,31 +232,33 @@ 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++){ @@ -283,7 +269,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) } /*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++){ @@ -415,7 +401,7 @@ static void __init get_zholes_init(void) 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) { @@ -443,8 +429,8 @@ unsigned long * __init get_zholes_size(int 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]; }