diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sh/include/asm/io.h | 6 | ||||
-rw-r--r-- | arch/sh/mm/ioremap.c | 2 | ||||
-rw-r--r-- | arch/sh/mm/ioremap_fixed.c | 22 |
3 files changed, 8 insertions, 22 deletions
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h index 13696dfccc16..70269813cef1 100644 --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h | |||
@@ -239,12 +239,14 @@ void __iomem *__ioremap_caller(unsigned long offset, unsigned long size, | |||
239 | void __iounmap(void __iomem *addr); | 239 | void __iounmap(void __iomem *addr); |
240 | 240 | ||
241 | #ifdef CONFIG_IOREMAP_FIXED | 241 | #ifdef CONFIG_IOREMAP_FIXED |
242 | extern void __iomem *ioremap_fixed(resource_size_t, unsigned long, pgprot_t); | 242 | extern void __iomem *ioremap_fixed(resource_size_t, unsigned long, |
243 | unsigned long, pgprot_t); | ||
243 | extern int iounmap_fixed(void __iomem *); | 244 | extern int iounmap_fixed(void __iomem *); |
244 | extern void ioremap_fixed_init(void); | 245 | extern void ioremap_fixed_init(void); |
245 | #else | 246 | #else |
246 | static inline void __iomem * | 247 | static inline void __iomem * |
247 | ioremap_fixed(resource_size t phys_addr, unsigned long size, pgprot_t prot) | 248 | ioremap_fixed(resource_size t phys_addr, unsigned long offset, |
249 | unsigned long size, pgprot_t prot) | ||
248 | { | 250 | { |
249 | BUG(); | 251 | BUG(); |
250 | } | 252 | } |
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c index 85b420d00622..bb03308e8408 100644 --- a/arch/sh/mm/ioremap.c +++ b/arch/sh/mm/ioremap.c | |||
@@ -68,7 +68,7 @@ __ioremap_caller(unsigned long phys_addr, unsigned long size, | |||
68 | * If we can't yet use the regular approach, go the fixmap route. | 68 | * If we can't yet use the regular approach, go the fixmap route. |
69 | */ | 69 | */ |
70 | if (!mem_init_done) | 70 | if (!mem_init_done) |
71 | return ioremap_fixed(phys_addr, size, pgprot); | 71 | return ioremap_fixed(phys_addr, offset, size, pgprot); |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * Ok, go for it.. | 74 | * Ok, go for it.. |
diff --git a/arch/sh/mm/ioremap_fixed.c b/arch/sh/mm/ioremap_fixed.c index 425f6c6bf250..551b513e8fce 100644 --- a/arch/sh/mm/ioremap_fixed.c +++ b/arch/sh/mm/ioremap_fixed.c | |||
@@ -45,12 +45,11 @@ void __init ioremap_fixed_init(void) | |||
45 | } | 45 | } |
46 | 46 | ||
47 | void __init __iomem * | 47 | void __init __iomem * |
48 | ioremap_fixed(resource_size_t phys_addr, unsigned long size, pgprot_t prot) | 48 | ioremap_fixed(resource_size_t phys_addr, unsigned long offset, |
49 | unsigned long size, pgprot_t prot) | ||
49 | { | 50 | { |
50 | enum fixed_addresses idx0, idx; | 51 | enum fixed_addresses idx0, idx; |
51 | resource_size_t last_addr; | ||
52 | struct ioremap_map *map; | 52 | struct ioremap_map *map; |
53 | unsigned long offset; | ||
54 | unsigned int nrpages; | 53 | unsigned int nrpages; |
55 | int i, slot; | 54 | int i, slot; |
56 | 55 | ||
@@ -67,18 +66,6 @@ ioremap_fixed(resource_size_t phys_addr, unsigned long size, pgprot_t prot) | |||
67 | if (slot < 0) | 66 | if (slot < 0) |
68 | return NULL; | 67 | return NULL; |
69 | 68 | ||
70 | /* Don't allow wraparound or zero size */ | ||
71 | last_addr = phys_addr + size - 1; | ||
72 | if (!size || last_addr < phys_addr) | ||
73 | return NULL; | ||
74 | |||
75 | /* | ||
76 | * Fixmap mappings have to be page-aligned | ||
77 | */ | ||
78 | offset = phys_addr & ~PAGE_MASK; | ||
79 | phys_addr &= PAGE_MASK; | ||
80 | size = PAGE_ALIGN(last_addr + 1) - phys_addr; | ||
81 | |||
82 | /* | 69 | /* |
83 | * Mappings have to fit in the FIX_IOREMAP area. | 70 | * Mappings have to fit in the FIX_IOREMAP area. |
84 | */ | 71 | */ |
@@ -111,7 +98,6 @@ int iounmap_fixed(void __iomem *addr) | |||
111 | unsigned long offset; | 98 | unsigned long offset; |
112 | unsigned int nrpages; | 99 | unsigned int nrpages; |
113 | int i, slot; | 100 | int i, slot; |
114 | pgprot_t prot; | ||
115 | 101 | ||
116 | slot = -1; | 102 | slot = -1; |
117 | for (i = 0; i < FIX_N_IOREMAPS; i++) { | 103 | for (i = 0; i < FIX_N_IOREMAPS; i++) { |
@@ -133,11 +119,9 @@ int iounmap_fixed(void __iomem *addr) | |||
133 | offset = virt_addr & ~PAGE_MASK; | 119 | offset = virt_addr & ~PAGE_MASK; |
134 | nrpages = PAGE_ALIGN(offset + map->size - 1) >> PAGE_SHIFT; | 120 | nrpages = PAGE_ALIGN(offset + map->size - 1) >> PAGE_SHIFT; |
135 | 121 | ||
136 | pgprot_val(prot) = _PAGE_WIRED; | ||
137 | |||
138 | idx = FIX_IOREMAP_BEGIN + slot + nrpages; | 122 | idx = FIX_IOREMAP_BEGIN + slot + nrpages; |
139 | while (nrpages > 0) { | 123 | while (nrpages > 0) { |
140 | __clear_fixmap(idx, prot); | 124 | __clear_fixmap(idx, __pgprot(_PAGE_WIRED)); |
141 | --idx; | 125 | --idx; |
142 | --nrpages; | 126 | --nrpages; |
143 | } | 127 | } |