summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/pci_64.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-12-15 15:00:57 +1100
committerPaul Mackerras <paulus@samba.org>2006-01-09 15:05:56 +1100
commitf2c4583a381c584c8c025048071a120cc9562ded (patch)
tree53d6a1d30a3be72f021738c97853cff55a800070 /arch/powerpc/kernel/pci_64.c
parenta04c8780fd234aeeba5e87f7e37beffd05ef21ae (diff)
downloadblackbird-op-linux-f2c4583a381c584c8c025048071a120cc9562ded.tar.gz
blackbird-op-linux-f2c4583a381c584c8c025048071a120cc9562ded.zip
[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/powerpc/kernel/pci_64.c')
-rw-r--r--arch/powerpc/kernel/pci_64.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index f73a16e9867a..fc60a773af7d 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -1365,16 +1365,17 @@ struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node)
#endif /* CONFIG_PPC_MULTIPLATFORM */
-unsigned int pci_address_to_pio(phys_addr_t address)
+unsigned long pci_address_to_pio(phys_addr_t address)
{
struct pci_controller *hose, *tmp;
list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
if (address >= hose->io_base_phys &&
- address < (hose->io_base_phys + hose->pci_io_size))
- return (unsigned int)
- ((unsigned long)hose->io_base_virt +
- (address - hose->io_base_phys));
+ address < (hose->io_base_phys + hose->pci_io_size)) {
+ unsigned long base =
+ (unsigned long)hose->io_base_virt - pci_io_base;
+ return base + (address - hose->io_base_phys);
+ }
}
return (unsigned int)-1;
}
OpenPOWER on IntegriCloud