Merge branches 'apei', 'bz-13195' and 'doc' into acpi
[pandora-kernel.git] / arch / x86 / pci / bus_numa.c
index f939d60..64a1228 100644 (file)
@@ -1,11 +1,11 @@
 #include <linux/init.h>
 #include <linux/pci.h>
+#include <linux/range.h>
 
 #include "bus_numa.h"
 
 int pci_root_num;
 struct pci_root_info pci_root_info[PCI_ROOT_NR];
-int found_all_numa_early;
 
 void x86_pci_root_bus_res_quirks(struct pci_bus *b)
 {
@@ -21,10 +21,6 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b)
        if (!pci_root_num)
                return;
 
-       /* for amd, if only one root bus, don't need to do anything */
-       if (pci_root_num < 2 && found_all_numa_early)
-               return;
-
        for (i = 0; i < pci_root_num; i++) {
                if (pci_root_info[i].bus_min == b->number)
                        break;
@@ -36,13 +32,14 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b)
        printk(KERN_DEBUG "PCI: peer root bus %02x res updated from pci conf\n",
                        b->number);
 
+       pci_bus_remove_resources(b);
        info = &pci_root_info[i];
        for (j = 0; j < info->res_num; j++) {
                struct resource *res;
                struct resource *root;
 
                res = &info->res[j];
-               b->resource[j] = res;
+               pci_bus_add_resource(b, res, 0);
                if (res->flags & IORESOURCE_IO)
                        root = &ioport_resource;
                else
@@ -51,8 +48,8 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b)
        }
 }
 
-void __devinit update_res(struct pci_root_info *info, size_t start,
-                             size_t end, unsigned long flags, int merge)
+void __devinit update_res(struct pci_root_info *info, resource_size_t start,
+                         resource_size_t end, unsigned long flags, int merge)
 {
        int i;
        struct resource *res;
@@ -60,25 +57,28 @@ void __devinit update_res(struct pci_root_info *info, size_t start,
        if (start > end)
                return;
 
+       if (start == MAX_RESOURCE)
+               return;
+
        if (!merge)
                goto addit;
 
        /* try to merge it with old one */
        for (i = 0; i < info->res_num; i++) {
-               size_t final_start, final_end;
-               size_t common_start, common_end;
+               resource_size_t final_start, final_end;
+               resource_size_t common_start, common_end;
 
                res = &info->res[i];
                if (res->flags != flags)
                        continue;
 
-               common_start = max((size_t)res->start, start);
-               common_end = min((size_t)res->end, end);
+               common_start = max(res->start, start);
+               common_end = min(res->end, end);
                if (common_start > common_end + 1)
                        continue;
 
-               final_start = min((size_t)res->start, start);
-               final_end = max((size_t)res->end, end);
+               final_start = min(res->start, start);
+               final_end = max(res->end, end);
 
                res->start = final_start;
                res->end = final_end;