x86: work around PAGE_KERNEL_WC not getting WC in iomap_atomic_prot_pfn.
[safe/jmp/linux-2.6] / arch / x86 / mm / k8topology_64.c
index 1f476e4..268f825 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/numa.h>
 #include <asm/mpspec.h>
 #include <asm/apic.h>
+#include <asm/k8.h>
 
 static __init int find_northbridge(void)
 {
@@ -56,34 +57,32 @@ static __init void early_get_boot_cpu_id(void)
        /*
         * Find possible boot-time SMP configuration:
         */
+#ifdef CONFIG_X86_MPPARSE
        early_find_smp_config();
+#endif
 #ifdef CONFIG_ACPI
        /*
         * Read APIC information from ACPI tables.
         */
        early_acpi_boot_init();
 #endif
+#ifdef CONFIG_X86_MPPARSE
        /*
         * get boot-time SMP configuration:
         */
        if (smp_found_config)
                early_get_smp_config();
+#endif
        early_init_lapic_mapping();
 }
 
 int __init k8_scan_nodes(unsigned long start, unsigned long end)
 {
+       unsigned numnodes, cores, bits, apicid_base;
        unsigned long prevbase;
        struct bootnode nodes[8];
-       int nodeid, i, nb;
-       unsigned char nodeids[8];
-       int found = 0;
-       u32 reg;
-       unsigned numnodes;
-       unsigned cores;
-       unsigned bits;
-       int j;
-       unsigned apicid_base;
+       int i, j, nb, found = 0;
+       u32 nodeid, reg;
 
        if (!early_pci_allowed())
                return -1;
@@ -105,13 +104,11 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
        prevbase = 0;
        for (i = 0; i < 8; i++) {
                unsigned long base, limit;
-               u32 nodeid;
 
                base = read_pci_config(0, nb, 1, 0x40 + i*8);
                limit = read_pci_config(0, nb, 1, 0x44 + i*8);
 
                nodeid = limit & 7;
-               nodeids[i] = nodeid;
                if ((base & 3) == 0) {
                        if (i < numnodes)
                                printk("Skipping disabled node %d\n", i);
@@ -144,8 +141,8 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
                limit |= (1<<24)-1;
                limit++;
 
-               if (limit > end_pfn << PAGE_SHIFT)
-                       limit = end_pfn << PAGE_SHIFT;
+               if (limit > max_pfn << PAGE_SHIFT)
+                       limit = max_pfn << PAGE_SHIFT;
                if (limit <= base)
                        continue;
 
@@ -180,9 +177,6 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
 
                nodes[nodeid].start = base;
                nodes[nodeid].end = limit;
-               e820_register_active_regions(nodeid,
-                               nodes[nodeid].start >> PAGE_SHIFT,
-                               nodes[nodeid].end >> PAGE_SHIFT);
 
                prevbase = base;
 
@@ -212,12 +206,15 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
        }
 
        for (i = 0; i < 8; i++) {
-               if (nodes[i].start != nodes[i].end) {
-                       nodeid = nodeids[i];
-                       for (j = apicid_base; j < cores + apicid_base; j++)
-                               apicid_to_node[(nodeid << bits) + j] = i;
-                       setup_node_bootmem(i, nodes[i].start, nodes[i].end);
-               }
+               if (nodes[i].start == nodes[i].end)
+                       continue;
+
+               e820_register_active_regions(i,
+                               nodes[i].start >> PAGE_SHIFT,
+                               nodes[i].end >> PAGE_SHIFT);
+               for (j = apicid_base; j < cores + apicid_base; j++)
+                       apicid_to_node[(i << bits) + j] = i;
+               setup_node_bootmem(i, nodes[i].start, nodes[i].end);
        }
 
        numa_init_array();