summaryrefslogtreecommitdiff
path: root/arch/sh/drivers
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-09-27 11:45:22 +0400
committerPaul Mundt <lethal@linux-sh.org>2006-09-27 11:45:22 +0400
commita3e61d50dc82475ebca3ff8b18c174c02c5ff511 (patch)
treed7a39867983b0bca5619cfe7493358e6bde6f3ba /arch/sh/drivers
parent959f85f8a3223c116bbe95dd8a9b207790b5d4d3 (diff)
downloadlinux-a3e61d50dc82475ebca3ff8b18c174c02c5ff511.tar.xz
sh: Inhibit mapping PCI apertures through page tables.
Inhibit mapping through page tables in __ioremap() for PCI memory apertures on SH7751 and SH7780-style PCI controllers, translation is not possible for these areas. For other users that map a small window in P1/P2 space, ioremap() traps that already, and should never make it to __ioremap(). Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/drivers')
-rw-r--r--arch/sh/drivers/pci/pci.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 7377a8a8e161..d439336d2e18 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -195,7 +195,7 @@ void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
unsigned long len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);
- if (!len || !start)
+ if (unlikely(!len || !start))
return NULL;
if (maxlen && len > maxlen)
len = maxlen;
@@ -204,18 +204,16 @@ void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
* Presently the IORESOURCE_MEM case is a bit special, most
* SH7751 style PCI controllers have PCI memory at a fixed
* location in the address space where no remapping is desired
- * (traditionally at 0xfd000000). Once this changes, the
- * IORESOURCE_MEM case will have to switch to using ioremap() and
- * more care will have to be taken to inhibit page table mapping
- * for legacy cores.
- *
- * For now everything wraps to ioport_map(), since boards that
- * have PCI will be able to check the address range properly on
- * their own.
- * -- PFM.
+ * (typically at 0xfd000000, but is_pci_memaddr() will know
+ * best). With the IORESOURCE_MEM case more care has to be taken
+ * to inhibit page table mapping for legacy cores, but this is
+ * punted off to __ioremap().
+ * -- PFM.
*/
- if (flags & (IORESOURCE_IO | IORESOURCE_MEM))
+ if (flags & IORESOURCE_IO)
return ioport_map(start, len);
+ if (flags & IORESOURCE_MEM)
+ return ioremap(start, len);
return NULL;
}