Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146633
b: refs/heads/master
c: ef339f2
h: refs/heads/master
i:
  146631: 23a838a
v: v3
  • Loading branch information
Magnus Damm authored and Paul Mundt committed Apr 16, 2009
1 parent b3a95a0 commit a04ca0e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ef53fdeb7e0cb139aff33665635b886700137abb
refs/heads/master: ef339f241b08a16af58897e6288ba200e0c7a8c7
2 changes: 1 addition & 1 deletion trunk/arch/sh/boards/mach-titan/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void titan_outsl(unsigned long port, const void *src, unsigned long count)

void __iomem *titan_ioport_map(unsigned long port, unsigned int size)
{
if (PXSEG(port) || is_pci_memaddr(port))
if (PXSEG(port))
return (void __iomem *)port;
else if (is_pci_ioaddr(port))
return (void __iomem *)pci_ioaddr(port);
Expand Down
5 changes: 2 additions & 3 deletions trunk/arch/sh/drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,8 @@ 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
* (typically at 0xfd000000, but is_pci_memaddr() will know
* best). With the IORESOURCE_MEM case more care has to be taken
* location in the address space where no remapping is desired.
* 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.
Expand Down
23 changes: 19 additions & 4 deletions trunk/arch/sh/include/asm/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,8 @@ extern unsigned long PCI_IO_AREA;
#define is_pci_ioaddr(port) \
(((port) >= PCIBIOS_MIN_IO) && \
((port) < (PCIBIOS_MIN_IO + PCI_IO_SIZE)))
#define is_pci_memaddr(port) \
(((port) >= PCIBIOS_MIN_MEM) && \
((port) < (PCIBIOS_MIN_MEM + PCI_MEM_SIZE)))
#else
#define is_pci_ioaddr(port) (0)
#define is_pci_memaddr(port) (0)
#endif

struct pci_dev;
Expand Down Expand Up @@ -127,6 +123,25 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
*strat = PCI_DMA_BURST_INFINITY;
*strategy_parameter = ~0UL;
}

static inline int __is_pci_memory(unsigned long phys_addr, unsigned long size)
{
struct pci_channel *p;
struct resource *res;

for (p = board_pci_channels; p->init; p++) {
res = p->mem_resource;
if (p->enabled && (phys_addr >= res->start) &&
(phys_addr + size) <= (res->end + 1))
return 1;
}
return 0;
}
#else
static inline int __is_pci_memory(unsigned long phys_addr, unsigned long size)
{
return 0;
}
#endif

/* Board-specific fixup routines. */
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/sh/mm/ioremap_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
* P1/P2 space, ioremap() will already do the right thing,
* and we'll never get this far.
*/
if (is_pci_memaddr(phys_addr) && is_pci_memaddr(last_addr))
if (__is_pci_memory(phys_addr, size))
return (void __iomem *)phys_addr;

#if !defined(CONFIG_PMB_FIXED)
Expand Down Expand Up @@ -121,7 +121,7 @@ void __iounmap(void __iomem *addr)
unsigned long seg = PXSEG(vaddr);
struct vm_struct *p;

if (seg < P3SEG || vaddr >= P3_ADDR_MAX || is_pci_memaddr(vaddr))
if (seg < P3SEG || vaddr >= P3_ADDR_MAX || __is_pci_memory(vaddr, 0))
return;

#ifdef CONFIG_PMB
Expand Down

0 comments on commit a04ca0e

Please sign in to comment.