|
@@ -135,23 +135,16 @@ void pci_disable_bridge_window(struct pci_dev *dev)
|
|
}
|
|
}
|
|
#endif /* CONFIG_PCI_QUIRKS */
|
|
#endif /* CONFIG_PCI_QUIRKS */
|
|
|
|
|
|
-int pci_assign_resource(struct pci_dev *dev, int resno)
|
|
|
|
|
|
+static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev,
|
|
|
|
+ int resno)
|
|
{
|
|
{
|
|
- struct pci_bus *bus = dev->bus;
|
|
|
|
struct resource *res = dev->resource + resno;
|
|
struct resource *res = dev->resource + resno;
|
|
resource_size_t size, min, align;
|
|
resource_size_t size, min, align;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
size = resource_size(res);
|
|
size = resource_size(res);
|
|
min = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM;
|
|
min = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM;
|
|
-
|
|
|
|
align = resource_alignment(res);
|
|
align = resource_alignment(res);
|
|
- if (!align) {
|
|
|
|
- dev_info(&dev->dev, "BAR %d: can't allocate resource (bogus "
|
|
|
|
- "alignment) %pR flags %#lx\n",
|
|
|
|
- resno, res, res->flags);
|
|
|
|
- return -EINVAL;
|
|
|
|
- }
|
|
|
|
|
|
|
|
/* First, try exact prefetching match.. */
|
|
/* First, try exact prefetching match.. */
|
|
ret = pci_bus_alloc_resource(bus, res, size, align, min,
|
|
ret = pci_bus_alloc_resource(bus, res, size, align, min,
|
|
@@ -169,10 +162,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
|
|
pcibios_align_resource, dev);
|
|
pcibios_align_resource, dev);
|
|
}
|
|
}
|
|
|
|
|
|
- if (ret) {
|
|
|
|
- dev_info(&dev->dev, "BAR %d: can't allocate %s resource %pR\n",
|
|
|
|
- resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res);
|
|
|
|
- } else {
|
|
|
|
|
|
+ if (!ret) {
|
|
res->flags &= ~IORESOURCE_STARTALIGN;
|
|
res->flags &= ~IORESOURCE_STARTALIGN;
|
|
if (resno < PCI_BRIDGE_RESOURCES)
|
|
if (resno < PCI_BRIDGE_RESOURCES)
|
|
pci_update_resource(dev, resno);
|
|
pci_update_resource(dev, resno);
|
|
@@ -181,6 +171,39 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int pci_assign_resource(struct pci_dev *dev, int resno)
|
|
|
|
+{
|
|
|
|
+ struct resource *res = dev->resource + resno;
|
|
|
|
+ resource_size_t align;
|
|
|
|
+ struct pci_bus *bus;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ align = resource_alignment(res);
|
|
|
|
+ if (!align) {
|
|
|
|
+ dev_info(&dev->dev, "BAR %d: can't allocate resource (bogus "
|
|
|
|
+ "alignment) %pR flags %#lx\n",
|
|
|
|
+ resno, res, res->flags);
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bus = dev->bus;
|
|
|
|
+ while ((ret = __pci_assign_resource(bus, dev, resno))) {
|
|
|
|
+ if (bus->parent && bus->self->transparent)
|
|
|
|
+ bus = bus->parent;
|
|
|
|
+ else
|
|
|
|
+ bus = NULL;
|
|
|
|
+ if (bus)
|
|
|
|
+ continue;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (ret)
|
|
|
|
+ dev_info(&dev->dev, "BAR %d: can't allocate %s resource %pR\n",
|
|
|
|
+ resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
#if 0
|
|
#if 0
|
|
int pci_assign_resource_fixed(struct pci_dev *dev, int resno)
|
|
int pci_assign_resource_fixed(struct pci_dev *dev, int resno)
|
|
{
|
|
{
|