|
@@ -646,6 +646,41 @@ void pci_setup_bridge(struct pci_bus *bus)
|
|
__pci_setup_bridge(bus, type);
|
|
__pci_setup_bridge(bus, type);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+int pci_claim_bridge_resource(struct pci_dev *bridge, int i)
|
|
|
|
+{
|
|
|
|
+ if (i < PCI_BRIDGE_RESOURCES || i > PCI_BRIDGE_RESOURCE_END)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ if (pci_claim_resource(bridge, i) == 0)
|
|
|
|
+ return 0; /* claimed the window */
|
|
|
|
+
|
|
|
|
+ if ((bridge->class >> 8) != PCI_CLASS_BRIDGE_PCI)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ if (!pci_bus_clip_resource(bridge, i))
|
|
|
|
+ return -EINVAL; /* clipping didn't change anything */
|
|
|
|
+
|
|
|
|
+ switch (i - PCI_BRIDGE_RESOURCES) {
|
|
|
|
+ case 0:
|
|
|
|
+ pci_setup_bridge_io(bridge);
|
|
|
|
+ break;
|
|
|
|
+ case 1:
|
|
|
|
+ pci_setup_bridge_mmio(bridge);
|
|
|
|
+ break;
|
|
|
|
+ case 2:
|
|
|
|
+ pci_setup_bridge_mmio_pref(bridge);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (pci_claim_resource(bridge, i) == 0)
|
|
|
|
+ return 0; /* claimed a smaller window */
|
|
|
|
+
|
|
|
|
+ return -EINVAL;
|
|
|
|
+}
|
|
|
|
+
|
|
/* Check whether the bridge supports optional I/O and
|
|
/* Check whether the bridge supports optional I/O and
|
|
prefetchable memory ranges. If not, the respective
|
|
prefetchable memory ranges. If not, the respective
|
|
base/limit registers must be read-only and read as 0. */
|
|
base/limit registers must be read-only and read as 0. */
|