Commit 99f95f11 authored by Paul Mundt's avatar Paul Mundt

sh: pci: Rework fixed region checks in ioremap().

Not all PCI channels have non-translatable memory windows, this is a
special property of the on-chip PCIC with its 0xfd00... mapping, handle
this explicitly.
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 0bb34a6b
...@@ -90,7 +90,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active) ...@@ -90,7 +90,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
#endif #endif
#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev, static inline void pci_dma_burst_advice(struct pci_dev *pdev,
enum pci_dma_burst_strategy *strat, enum pci_dma_burst_strategy *strat,
unsigned long *strategy_parameter) unsigned long *strategy_parameter)
...@@ -99,24 +98,18 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev, ...@@ -99,24 +98,18 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
*strategy_parameter = ~0UL; *strategy_parameter = ~0UL;
} }
static inline int __is_pci_memory(unsigned long phys_addr, unsigned long size) #ifdef CONFIG_SUPERH32
{ /*
struct pci_channel *p; * If we're on an SH7751 or SH7780 PCI controller, PCI memory is mapped
struct resource *res; * at the end of the address space in a special non-translatable area.
*/
for (p = board_pci_channels; p->init; p++) { #define PCI_MEM_FIXED_START 0xfd000000
res = p->mem_resource; #define PCI_MEM_FIXED_END (PCI_MEM_FIXED_START + 0x01000000)
if (p->enabled && (phys_addr >= res->start) &&
(phys_addr + size) <= (res->end + 1)) #define is_pci_memory_fixed_range(s, e) \
return 1; ((s) >= PCI_MEM_FIXED_START && (e) < PCI_MEM_FIXED_END)
}
return 0;
}
#else #else
static inline int __is_pci_memory(unsigned long phys_addr, unsigned long size) #define is_pci_memory_fixed_range(s, e) (0)
{
return 0;
}
#endif #endif
/* Board-specific fixup routines. */ /* Board-specific fixup routines. */
......
...@@ -46,17 +46,15 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, ...@@ -46,17 +46,15 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
return NULL; return NULL;
/* /*
* If we're on an SH7751 or SH7780 PCI controller, PCI memory is * If we're in the fixed PCI memory range, mapping through page
* mapped at the end of the address space (typically 0xfd000000) * tables is not only pointless, but also fundamentally broken.
* in a non-translatable area, so mapping through page tables for * Just return the physical address instead.
* this area is not only pointless, but also fundamentally
* broken. Just return the physical address instead.
* *
* For boards that map a small PCI memory aperture somewhere in * For boards that map a small PCI memory aperture somewhere in
* P1/P2 space, ioremap() will already do the right thing, * P1/P2 space, ioremap() will already do the right thing,
* and we'll never get this far. * and we'll never get this far.
*/ */
if (__is_pci_memory(phys_addr, size)) if (is_pci_memory_fixed_range(phys_addr, size))
return (void __iomem *)phys_addr; return (void __iomem *)phys_addr;
#if !defined(CONFIG_PMB_FIXED) #if !defined(CONFIG_PMB_FIXED)
...@@ -121,7 +119,9 @@ void __iounmap(void __iomem *addr) ...@@ -121,7 +119,9 @@ void __iounmap(void __iomem *addr)
unsigned long seg = PXSEG(vaddr); unsigned long seg = PXSEG(vaddr);
struct vm_struct *p; struct vm_struct *p;
if (seg < P3SEG || vaddr >= P3_ADDR_MAX || __is_pci_memory(vaddr, 0)) if (seg < P3SEG || vaddr >= P3_ADDR_MAX)
return;
if (is_pci_memory_fixed_range(vaddr, 0))
return; return;
#ifdef CONFIG_PMB #ifdef CONFIG_PMB
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment