diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-12-14 23:00:57 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-01-08 23:05:56 -0500 |
commit | f2c4583a381c584c8c025048071a120cc9562ded (patch) | |
tree | 53d6a1d30a3be72f021738c97853cff55a800070 /arch/ppc | |
parent | a04c8780fd234aeeba5e87f7e37beffd05ef21ae (diff) |
[PATCH] powerpc: pci_address_to_pio fix
This fixes pci_address_to_pio() to return an unsigned long (to be safe)
and fixes a bug in the implementation that caused it to return a bogus
IO port number
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc')
-rw-r--r-- | arch/ppc/kernel/pci.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c index 8de320308e87..c8b48f171699 100644 --- a/arch/ppc/kernel/pci.c +++ b/arch/ppc/kernel/pci.c | |||
@@ -1811,7 +1811,7 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *addr) | |||
1811 | EXPORT_SYMBOL(pci_iomap); | 1811 | EXPORT_SYMBOL(pci_iomap); |
1812 | EXPORT_SYMBOL(pci_iounmap); | 1812 | EXPORT_SYMBOL(pci_iounmap); |
1813 | 1813 | ||
1814 | unsigned int pci_address_to_pio(phys_addr_t address) | 1814 | unsigned long pci_address_to_pio(phys_addr_t address) |
1815 | { | 1815 | { |
1816 | struct pci_controller* hose = hose_head; | 1816 | struct pci_controller* hose = hose_head; |
1817 | 1817 | ||
@@ -1819,9 +1819,11 @@ unsigned int pci_address_to_pio(phys_addr_t address) | |||
1819 | unsigned int size = hose->io_resource.end - | 1819 | unsigned int size = hose->io_resource.end - |
1820 | hose->io_resource.start + 1; | 1820 | hose->io_resource.start + 1; |
1821 | if (address >= hose->io_base_phys && | 1821 | if (address >= hose->io_base_phys && |
1822 | address < (hose->io_base_phys + size)) | 1822 | address < (hose->io_base_phys + size)) { |
1823 | return (unsigned int)hose->io_base_virt + | 1823 | unsigned long base = |
1824 | (address - hose->io_base_phys); | 1824 | (unsigned long)hose->io_base_virt - _IO_BASE; |
1825 | return base + (address - hose->io_base_phys); | ||
1826 | |||
1825 | } | 1827 | } |
1826 | return (unsigned int)-1; | 1828 | return (unsigned int)-1; |
1827 | } | 1829 | } |