diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2005-05-13 03:44:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-06-28 00:52:45 -0400 |
commit | 2311b1f2bbd36fa5f366a7448c718b2556e0f02c (patch) | |
tree | 10e836c5c34893f8098464a5ae15aba351a7bb2a /arch/ppc/kernel/pci.c | |
parent | a0d399a808916d22c1c222c6b5ca4e8edd6d91a9 (diff) |
[PATCH] PCI: fix-pci-mmap-on-ppc-and-ppc64.patch
This is an updated version of Ben's fix-pci-mmap-on-ppc-and-ppc64.patch
which is in 2.6.12-rc4-mm1.
It fixes the patch to work on PPC iSeries, removes some debug printks
at Ben's request, and incorporates your
fix-pci-mmap-on-ppc-and-ppc64-fix.patch also.
Originally from Benjamin Herrenschmidt <benh@kernel.crashing.org>
This patch was discussed at length on linux-pci and so far, the last
iteration of it didn't raise any comment. It's effect is a nop on
architecture that don't define the new pci_resource_to_user() callback
anyway. It allows architecture like ppc who put weird things inside of
PCI resource structures to convert to some different value for user
visible ones. It also fixes mmap'ing of IO space on those archs.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch/ppc/kernel/pci.c')
-rw-r--r-- | arch/ppc/kernel/pci.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c index 6d7b92d72458..70cfb6ffd877 100644 --- a/arch/ppc/kernel/pci.c +++ b/arch/ppc/kernel/pci.c | |||
@@ -1495,7 +1495,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | |||
1495 | *offset += hose->pci_mem_offset; | 1495 | *offset += hose->pci_mem_offset; |
1496 | res_bit = IORESOURCE_MEM; | 1496 | res_bit = IORESOURCE_MEM; |
1497 | } else { | 1497 | } else { |
1498 | io_offset = (unsigned long)hose->io_base_virt; | 1498 | io_offset = hose->io_base_virt - ___IO_BASE; |
1499 | *offset += io_offset; | 1499 | *offset += io_offset; |
1500 | res_bit = IORESOURCE_IO; | 1500 | res_bit = IORESOURCE_IO; |
1501 | } | 1501 | } |
@@ -1522,7 +1522,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | |||
1522 | 1522 | ||
1523 | /* found it! construct the final physical address */ | 1523 | /* found it! construct the final physical address */ |
1524 | if (mmap_state == pci_mmap_io) | 1524 | if (mmap_state == pci_mmap_io) |
1525 | *offset += hose->io_base_phys - _IO_BASE; | 1525 | *offset += hose->io_base_phys - io_offset; |
1526 | return rp; | 1526 | return rp; |
1527 | } | 1527 | } |
1528 | 1528 | ||
@@ -1739,6 +1739,23 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn) | |||
1739 | return result; | 1739 | return result; |
1740 | } | 1740 | } |
1741 | 1741 | ||
1742 | void pci_resource_to_user(const struct pci_dev *dev, int bar, | ||
1743 | const struct resource *rsrc, | ||
1744 | u64 *start, u64 *end) | ||
1745 | { | ||
1746 | struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); | ||
1747 | unsigned long offset = 0; | ||
1748 | |||
1749 | if (hose == NULL) | ||
1750 | return; | ||
1751 | |||
1752 | if (rsrc->flags & IORESOURCE_IO) | ||
1753 | offset = ___IO_BASE - hose->io_base_virt + hose->io_base_phys; | ||
1754 | |||
1755 | *start = rsrc->start + offset; | ||
1756 | *end = rsrc->end + offset; | ||
1757 | } | ||
1758 | |||
1742 | void __init | 1759 | void __init |
1743 | pci_init_resource(struct resource *res, unsigned long start, unsigned long end, | 1760 | pci_init_resource(struct resource *res, unsigned long start, unsigned long end, |
1744 | int flags, char *name) | 1761 | int flags, char *name) |