sh: pci: Consolidate pci_iomap() and use the generic I/O base.

This consolidates the pci_iomap() definitions and reworks how the I/O
port base is handled. PCI channels can register their own I/O map base,
or if none is provided, the system-wide generic I/O base is used instead.

Functionally nothing changes, while this allows us to kill off lots of
I/O address special casing and lookups.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
Paul Mundt
2009-04-20 16:38:00 +09:00
parent 394b6d2fe6
commit 0bb34a6bf1
5 changed files with 53 additions and 94 deletions

View File

@@ -26,6 +26,8 @@ struct pci_channel {
int enabled;
unsigned long reg_base;
unsigned long io_base;
unsigned long io_map_base;
};
/*
@@ -110,31 +112,11 @@ static inline int __is_pci_memory(unsigned long phys_addr, unsigned long size)
}
return 0;
}
static inline void __iomem *__get_pci_io_base(unsigned long port,
unsigned long size)
{
struct pci_channel *p;
struct resource *res;
for (p = board_pci_channels; p->init; p++) {
res = p->io_resource;
if (p->enabled && (port >= res->start) &&
(port + size) <= (res->end + 1))
return (void __iomem *)(p->io_base + port);
}
return NULL;
}
#else
static inline int __is_pci_memory(unsigned long phys_addr, unsigned long size)
{
return 0;
}
static inline void __iomem *__get_pci_io_base(unsigned long port,
unsigned long size)
{
return NULL;
}
#endif
/* Board-specific fixup routines. */