diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-04-27 16:58:53 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-04-27 16:58:53 -0700 |
commit | 7bef0df7e8db98ef5139ab6295a36940a2f806c8 (patch) | |
tree | 99699cb9c01878c9ee365be0d8bce51d20469341 /pci | |
parent | a615fe02db67e84a9b206f47a5e888f1d2638637 (diff) | |
download | patches-7bef0df7e8db98ef5139ab6295a36940a2f806c8.tar.gz |
patches added
Diffstat (limited to 'pci')
-rw-r--r-- | pci/pci-add-pci_assign_resource_fixed-allow-fixed-address-assignments.patch | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/pci/pci-add-pci_assign_resource_fixed-allow-fixed-address-assignments.patch b/pci/pci-add-pci_assign_resource_fixed-allow-fixed-address-assignments.patch new file mode 100644 index 0000000000000..dee90be0b29d1 --- /dev/null +++ b/pci/pci-add-pci_assign_resource_fixed-allow-fixed-address-assignments.patch @@ -0,0 +1,92 @@ +From galak@kernel.crashing.org Thu Apr 27 10:46:44 2006 +Date: Thu, 27 Apr 2006 12:43:31 -0500 (CDT) +From: Kumar Gala <galak@kernel.crashing.org> +To: Greg KH <greg@kroah.com>, Andrew Morton <akpm@osdl.org> +Subject: PCI: Add pci_assign_resource_fixed -- allow fixed address assignments +Message-ID: <Pine.LNX.4.44.0604271242410.25641-100000@gate.crashing.org> + +On some embedded systems the PCI address for hotplug devices are not only +known a priori but are required to be at a given PCI address for other +master in the system to be able to access. + +An example of such a system would be an FPGA which is setup from user space +after the system has booted. The FPGA may be access by DSPs in the system +and those DSPs expect the FPGA at a fixed PCI address. + +Added pci_assign_resource_fixed() as a way to allow assignment of the PCI +devices's BARs at fixed PCI addresses. + +Signed-off-by: Kumar Gala <galak@kernel.crashing.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- +--- + drivers/pci/pci.c | 1 + + drivers/pci/setup-res.c | 35 +++++++++++++++++++++++++++++++++++ + include/linux/pci.h | 1 + + 3 files changed, 37 insertions(+) + +--- gregkh-2.6.orig/drivers/pci/pci.c ++++ gregkh-2.6/drivers/pci/pci.c +@@ -995,6 +995,7 @@ EXPORT_SYMBOL_GPL(pci_intx); + EXPORT_SYMBOL(pci_set_dma_mask); + EXPORT_SYMBOL(pci_set_consistent_dma_mask); + EXPORT_SYMBOL(pci_assign_resource); ++EXPORT_SYMBOL(pci_assign_resource_fixed); + EXPORT_SYMBOL(pci_find_parent_resource); + EXPORT_SYMBOL(pci_select_bars); + +--- gregkh-2.6.orig/drivers/pci/setup-res.c ++++ gregkh-2.6/drivers/pci/setup-res.c +@@ -160,6 +160,41 @@ int pci_assign_resource(struct pci_dev * + return ret; + } + ++int pci_assign_resource_fixed(struct pci_dev *dev, int resno) ++{ ++ struct pci_bus *bus = dev->bus; ++ struct resource *res = dev->resource + resno; ++ unsigned int type_mask; ++ int i, ret = -EBUSY; ++ ++ type_mask = IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH; ++ ++ for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { ++ struct resource *r = bus->resource[i]; ++ if (!r) ++ continue; ++ ++ /* type_mask must match */ ++ if ((res->flags ^ r->flags) & type_mask) ++ continue; ++ ++ ret = request_resource(r, res); ++ ++ if (ret == 0) ++ break; ++ } ++ ++ if (ret) { ++ printk(KERN_ERR "PCI: Failed to allocate %s resource #%d:%lx@%lx for %s\n", ++ res->flags & IORESOURCE_IO ? "I/O" : "mem", ++ resno, res->end - res->start + 1, res->start, pci_name(dev)); ++ } else if (resno < PCI_BRIDGE_RESOURCES) { ++ pci_update_resource(dev, res, resno); ++ } ++ ++ return ret; ++} ++ + /* Sort resources by alignment */ + void __devinit + pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) +--- gregkh-2.6.orig/include/linux/pci.h ++++ gregkh-2.6/include/linux/pci.h +@@ -497,6 +497,7 @@ int pci_set_dma_mask(struct pci_dev *dev + int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); + void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); + int pci_assign_resource(struct pci_dev *dev, int i); ++int pci_assign_resource_fixed(struct pci_dev *dev, int i); + void pci_restore_bars(struct pci_dev *dev); + int pci_select_bars(struct pci_dev *dev, unsigned long flags); + |