Merge branch 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspe...
[safe/jmp/linux-2.6] / arch / x86 / pci / i386.c
index 52e656f..46fd43f 100644 (file)
@@ -60,22 +60,20 @@ skip_isa_ioresource_align(struct pci_dev *dev) {
  * but we want to try to avoid allocating at 0x2900-0x2bff
  * which might have be mirrored at 0x0100-0x03ff..
  */
-void
-pcibios_align_resource(void *data, struct resource *res,
+resource_size_t
+pcibios_align_resource(void *data, const struct resource *res,
                        resource_size_t size, resource_size_t align)
 {
        struct pci_dev *dev = data;
+       resource_size_t start = res->start;
 
        if (res->flags & IORESOURCE_IO) {
-               resource_size_t start = res->start;
-
                if (skip_isa_ioresource_align(dev))
-                       return;
-               if (start & 0x300) {
+                       return start;
+               if (start & 0x300)
                        start = (start + 0x3ff) & ~0x3ff;
-                       res->start = start;
-               }
        }
+       return start;
 }
 EXPORT_SYMBOL(pcibios_align_resource);
 
@@ -129,7 +127,6 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
                                        continue;
                                if (!r->start ||
                                    pci_claim_resource(dev, idx) < 0) {
-                                       dev_info(&dev->dev, "BAR %d: can't allocate %pRt\n", idx, r);
                                        /*
                                         * Something is wrong with the region.
                                         * Invalidate the resource to prevent
@@ -144,16 +141,29 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
        }
 }
 
+struct pci_check_idx_range {
+       int start;
+       int end;
+};
+
 static void __init pcibios_allocate_resources(int pass)
 {
        struct pci_dev *dev = NULL;
-       int idx, disabled;
+       int idx, disabled, i;
        u16 command;
        struct resource *r;
 
+       struct pci_check_idx_range idx_range[] = {
+               { PCI_STD_RESOURCES, PCI_STD_RESOURCE_END },
+#ifdef CONFIG_PCI_IOV
+               { PCI_IOV_RESOURCES, PCI_IOV_RESOURCE_END },
+#endif
+       };
+
        for_each_pci_dev(dev) {
                pci_read_config_word(dev, PCI_COMMAND, &command);
-               for (idx = 0; idx < PCI_ROM_RESOURCE; idx++) {
+               for (i = 0; i < ARRAY_SIZE(idx_range); i++)
+               for (idx = idx_range[i].start; idx <= idx_range[i].end; idx++) {
                        r = &dev->resource[idx];
                        if (r->parent)          /* Already allocated */
                                continue;
@@ -164,10 +174,10 @@ static void __init pcibios_allocate_resources(int pass)
                        else
                                disabled = !(command & PCI_COMMAND_MEMORY);
                        if (pass == disabled) {
-                               dev_dbg(&dev->dev, "%pRf (d=%d, p=%d)\n", r,
-                                       disabled, pass);
+                               dev_dbg(&dev->dev,
+                                       "BAR %d: reserving %pr (d=%d, p=%d)\n",
+                                       idx, r, disabled, pass);
                                if (pci_claim_resource(dev, idx) < 0) {
-                                       dev_info(&dev->dev, "BAR %d: can't allocate %pRt\n", idx, r);
                                        /* We'll assign a new address later */
                                        r->end -= r->start;
                                        r->start = 0;
@@ -180,7 +190,7 @@ static void __init pcibios_allocate_resources(int pass)
                                /* Turn the ROM off, leave the resource region,
                                 * but keep it unregistered. */
                                u32 reg;
-                               dev_dbg(&dev->dev, "disabling ROM %pRt\n", r);
+                               dev_dbg(&dev->dev, "disabling ROM %pR\n", r);
                                r->flags &= ~IORESOURCE_ROM_ENABLE;
                                pci_read_config_dword(dev,
                                                dev->rom_base_reg, &reg);
@@ -240,10 +250,6 @@ void __init pcibios_resource_survey(void)
  */
 fs_initcall(pcibios_assign_resources);
 
-void __weak x86_pci_root_bus_res_quirks(struct pci_bus *b)
-{
-}
-
 /*
  *  If we set up a device for bus mastering, we need to check the latency
  *  timer as certain crappy BIOSes forget to set it properly.