Pull kmalloc into release branch
[pandora-kernel.git] / arch / i386 / kernel / srat.c
index 516bf56..b1809c9 100644 (file)
@@ -23,7 +23,6 @@
  *
  * Send feedback to Pat Gaughen <gone@us.ibm.com>
  */
-#include <linux/config.h>
 #include <linux/mm.h>
 #include <linux/bootmem.h>
 #include <linux/mmzone.h>
@@ -39,7 +38,6 @@
 #define NODE_ARRAY_OFFSET(x)   ((x) % 8)       /* 8 bits/char */
 #define BMAP_SET(bmap, bit)    ((bmap)[NODE_ARRAY_INDEX(bit)] |= 1 << NODE_ARRAY_OFFSET(bit))
 #define BMAP_TEST(bmap, bit)   ((bmap)[NODE_ARRAY_INDEX(bit)] & (1 << NODE_ARRAY_OFFSET(bit)))
-#define MAX_PXM_DOMAINS                256     /* 1 byte and no promises about values */
 /* bitmap length; _PXM is at most 255 */
 #define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8) 
 static u8 pxm_bitmap[PXM_BITMAP_LEN];  /* bitmap of proximity domains */
@@ -137,8 +135,8 @@ static void __init parse_memory_affinity_structure (char *sratp)
                 "enabled and removable" : "enabled" ) );
 }
 
-#if MAX_NR_ZONES != 3
-#error "MAX_NR_ZONES != 3, chunk_to_zone requires review"
+#if MAX_NR_ZONES != 4
+#error "MAX_NR_ZONES != 4, chunk_to_zone requires review"
 #endif
 /* Take a chunk of pages from page frame cstart to cend and count the number
  * of pages in each zone, returned via zones[].
@@ -213,19 +211,11 @@ static __init void node_read_chunk(int nid, struct node_memory_chunk_s *memory_c
                node_end_pfn[nid] = memory_chunk->end_pfn;
 }
 
-static u8 pxm_to_nid_map[MAX_PXM_DOMAINS];/* _PXM to logical node ID map */
-
-int pxm_to_node(int pxm)
-{
-       return pxm_to_nid_map[pxm];
-}
-
 /* Parse the ACPI Static Resource Affinity Table */
 static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
 {
        u8 *start, *end, *p;
        int i, j, nid;
-       u8 nid_to_pxm_map[MAX_NUMNODES];/* logical node ID to _PXM map */
 
        start = (u8 *)(&(sratp->reserved) + 1); /* skip header */
        p = start;
@@ -235,10 +225,6 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
        memset(node_memory_chunk, 0, sizeof(node_memory_chunk));
        memset(zholes_size, 0, sizeof(zholes_size));
 
-       /* -1 in these maps means not available */
-       memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map));
-       memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map));
-
        num_memory_chunks = 0;
        while (p < end) {
                switch (*p) {
@@ -278,9 +264,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
        nodes_clear(node_online_map);
        for (i = 0; i < MAX_PXM_DOMAINS; i++) {
                if (BMAP_TEST(pxm_bitmap, i)) {
-                       nid = num_online_nodes();
-                       pxm_to_nid_map[i] = nid;
-                       nid_to_pxm_map[nid] = i;
+                       int nid = acpi_map_pxm_to_node(i);
                        node_set_online(nid);
                }
        }
@@ -288,7 +272,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
 
        /* 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];
+               node_memory_chunk[i].nid = pxm_to_node(node_memory_chunk[i].pxm);
 
        printk("pxm bitmap: ");
        for (i = 0; i < sizeof(pxm_bitmap); i++) {
@@ -327,7 +311,12 @@ int __init get_memcfg_from_srat(void)
        int tables = 0;
        int i = 0;
 
-       acpi_find_root_pointer(ACPI_PHYSICAL_ADDRESSING, rsdp_address);
+       if (ACPI_FAILURE(acpi_find_root_pointer(ACPI_PHYSICAL_ADDRESSING,
+                                               rsdp_address))) {
+               printk("%s: System description tables not found\n",
+                      __FUNCTION__);
+               goto out_err;
+       }
 
        if (rsdp_address->pointer_type == ACPI_PHYSICAL_POINTER) {
                printk("%s: assigning address to rsdp\n", __FUNCTION__);