]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pci/setup-res.c
Merge branches 'x86/cleanups', 'x86/kexec', 'x86/mce2' and 'linus' into x86/core
[linux-2.6-omap-h63xx.git] / drivers / pci / setup-res.c
index 2dbd96cce2d8469e82198ec3d29ae3604ef104de..32e8d88a46192fcdd2ab2248f4feb71fe987ec1d 100644 (file)
 #include "pci.h"
 
 
-void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
+void pci_update_resource(struct pci_dev *dev, int resno)
 {
        struct pci_bus_region region;
        u32 new, check, mask;
        int reg;
+       enum pci_bar_type type;
+       struct resource *res = dev->resource + resno;
 
        /*
         * Ignore resources for unimplemented BARs and unused resource slots
@@ -61,17 +63,13 @@ void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
        else
                mask = (u32)PCI_BASE_ADDRESS_MEM_MASK;
 
-       if (resno < 6) {
-               reg = PCI_BASE_ADDRESS_0 + 4 * resno;
-       } else if (resno == PCI_ROM_RESOURCE) {
+       reg = pci_resource_bar(dev, resno, &type);
+       if (!reg)
+               return;
+       if (type != pci_bar_unknown) {
                if (!(res->flags & IORESOURCE_ROM_ENABLE))
                        return;
                new |= PCI_ROM_ADDRESS_ENABLE;
-               reg = dev->rom_base_reg;
-       } else {
-               /* Hmm, non-standard resource. */
-       
-               return;         /* kill uninitialised var warning */
        }
 
        pci_write_config_dword(dev, reg, new);
@@ -134,7 +132,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
 
        align = resource_alignment(res);
        if (!align) {
-               dev_err(&dev->dev, "BAR %d: can't allocate resource (bogus "
+               dev_info(&dev->dev, "BAR %d: can't allocate resource (bogus "
                        "alignment) %pR flags %#lx\n",
                        resno, res, res->flags);
                return -EINVAL;
@@ -157,12 +155,12 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
        }
 
        if (ret) {
-               dev_err(&dev->dev, "BAR %d: can't allocate %s resource %pR\n",
+               dev_info(&dev->dev, "BAR %d: can't allocate %s resource %pR\n",
                        resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res);
        } else {
                res->flags &= ~IORESOURCE_STARTALIGN;
                if (resno < PCI_BRIDGE_RESOURCES)
-                       pci_update_resource(dev, res, resno);
+                       pci_update_resource(dev, resno);
        }
 
        return ret;
@@ -197,7 +195,7 @@ int pci_assign_resource_fixed(struct pci_dev *dev, int resno)
                dev_err(&dev->dev, "BAR %d: can't allocate %s resource %pR\n",
                        resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res);
        } else if (resno < PCI_BRIDGE_RESOURCES) {
-               pci_update_resource(dev, res, resno);
+               pci_update_resource(dev, resno);
        }
 
        return ret;