diff options
author | Magnus Damm <magnus.damm@gmail.com> | 2008-02-19 07:35:22 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-04-16 03:00:14 -0400 |
commit | ef339f241b08a16af58897e6288ba200e0c7a8c7 (patch) | |
tree | 6e9984ccbccc87017c3beb97567002926b5ae549 /arch/sh/include/asm/pci.h | |
parent | ef53fdeb7e0cb139aff33665635b886700137abb (diff) |
sh: pci memory range checking code
This patch changes the code to use __is_pci_memory() instead of
is_pci_memaddr(). __is_pci_memory() loops through all the pci
channels on the system to match memory windows.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/include/asm/pci.h')
-rw-r--r-- | arch/sh/include/asm/pci.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h index 84d12ebef084..ccf5c5ff62ff 100644 --- a/arch/sh/include/asm/pci.h +++ b/arch/sh/include/asm/pci.h | |||
@@ -61,12 +61,8 @@ extern unsigned long PCI_IO_AREA; | |||
61 | #define is_pci_ioaddr(port) \ | 61 | #define is_pci_ioaddr(port) \ |
62 | (((port) >= PCIBIOS_MIN_IO) && \ | 62 | (((port) >= PCIBIOS_MIN_IO) && \ |
63 | ((port) < (PCIBIOS_MIN_IO + PCI_IO_SIZE))) | 63 | ((port) < (PCIBIOS_MIN_IO + PCI_IO_SIZE))) |
64 | #define is_pci_memaddr(port) \ | ||
65 | (((port) >= PCIBIOS_MIN_MEM) && \ | ||
66 | ((port) < (PCIBIOS_MIN_MEM + PCI_MEM_SIZE))) | ||
67 | #else | 64 | #else |
68 | #define is_pci_ioaddr(port) (0) | 65 | #define is_pci_ioaddr(port) (0) |
69 | #define is_pci_memaddr(port) (0) | ||
70 | #endif | 66 | #endif |
71 | 67 | ||
72 | struct pci_dev; | 68 | struct pci_dev; |
@@ -127,6 +123,25 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev, | |||
127 | *strat = PCI_DMA_BURST_INFINITY; | 123 | *strat = PCI_DMA_BURST_INFINITY; |
128 | *strategy_parameter = ~0UL; | 124 | *strategy_parameter = ~0UL; |
129 | } | 125 | } |
126 | |||
127 | static inline int __is_pci_memory(unsigned long phys_addr, unsigned long size) | ||
128 | { | ||
129 | struct pci_channel *p; | ||
130 | struct resource *res; | ||
131 | |||
132 | for (p = board_pci_channels; p->init; p++) { | ||
133 | res = p->mem_resource; | ||
134 | if (p->enabled && (phys_addr >= res->start) && | ||
135 | (phys_addr + size) <= (res->end + 1)) | ||
136 | return 1; | ||
137 | } | ||
138 | return 0; | ||
139 | } | ||
140 | #else | ||
141 | static inline int __is_pci_memory(unsigned long phys_addr, unsigned long size) | ||
142 | { | ||
143 | return 0; | ||
144 | } | ||
130 | #endif | 145 | #endif |
131 | 146 | ||
132 | /* Board-specific fixup routines. */ | 147 | /* Board-specific fixup routines. */ |