diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-02-23 02:20:53 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-03-02 02:40:06 -0500 |
commit | 90e7d649d86f21d478dc134f74c88e19dd472393 (patch) | |
tree | 7526b5320c01da9efd2ce581369b000baa91e0da /arch/sh/include/asm | |
parent | 94316cdadb0067ba6d1f08b9a6f84fe755bdaa38 (diff) |
sh: reworked dynamic PMB mapping.
This implements a fairly significant overhaul of the dynamic PMB mapping
code. The primary change here is that the PMB gets its own VMA that
follows the uncached mapping and we attempt to be a bit more intelligent
with dynamic sizing, multi-entry mapping, and so forth.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/include/asm')
-rw-r--r-- | arch/sh/include/asm/io.h | 23 | ||||
-rw-r--r-- | arch/sh/include/asm/mmu.h | 31 |
2 files changed, 34 insertions, 20 deletions
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h index 7dab7b23a5ec..f689554e17c1 100644 --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h | |||
@@ -291,21 +291,21 @@ unsigned long long poke_real_address_q(unsigned long long addr, | |||
291 | * doesn't exist, so everything must go through page tables. | 291 | * doesn't exist, so everything must go through page tables. |
292 | */ | 292 | */ |
293 | #ifdef CONFIG_MMU | 293 | #ifdef CONFIG_MMU |
294 | void __iomem *__ioremap_caller(unsigned long offset, unsigned long size, | 294 | void __iomem *__ioremap_caller(phys_addr_t offset, unsigned long size, |
295 | pgprot_t prot, void *caller); | 295 | pgprot_t prot, void *caller); |
296 | void __iounmap(void __iomem *addr); | 296 | void __iounmap(void __iomem *addr); |
297 | 297 | ||
298 | static inline void __iomem * | 298 | static inline void __iomem * |
299 | __ioremap(unsigned long offset, unsigned long size, pgprot_t prot) | 299 | __ioremap(phys_addr_t offset, unsigned long size, pgprot_t prot) |
300 | { | 300 | { |
301 | return __ioremap_caller(offset, size, prot, __builtin_return_address(0)); | 301 | return __ioremap_caller(offset, size, prot, __builtin_return_address(0)); |
302 | } | 302 | } |
303 | 303 | ||
304 | static inline void __iomem * | 304 | static inline void __iomem * |
305 | __ioremap_29bit(unsigned long offset, unsigned long size, pgprot_t prot) | 305 | __ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot) |
306 | { | 306 | { |
307 | #ifdef CONFIG_29BIT | 307 | #ifdef CONFIG_29BIT |
308 | unsigned long last_addr = offset + size - 1; | 308 | phys_addr_t last_addr = offset + size - 1; |
309 | 309 | ||
310 | /* | 310 | /* |
311 | * For P1 and P2 space this is trivial, as everything is already | 311 | * For P1 and P2 space this is trivial, as everything is already |
@@ -329,7 +329,7 @@ __ioremap_29bit(unsigned long offset, unsigned long size, pgprot_t prot) | |||
329 | } | 329 | } |
330 | 330 | ||
331 | static inline void __iomem * | 331 | static inline void __iomem * |
332 | __ioremap_mode(unsigned long offset, unsigned long size, pgprot_t prot) | 332 | __ioremap_mode(phys_addr_t offset, unsigned long size, pgprot_t prot) |
333 | { | 333 | { |
334 | void __iomem *ret; | 334 | void __iomem *ret; |
335 | 335 | ||
@@ -349,35 +349,32 @@ __ioremap_mode(unsigned long offset, unsigned long size, pgprot_t prot) | |||
349 | #define __iounmap(addr) do { } while (0) | 349 | #define __iounmap(addr) do { } while (0) |
350 | #endif /* CONFIG_MMU */ | 350 | #endif /* CONFIG_MMU */ |
351 | 351 | ||
352 | static inline void __iomem * | 352 | static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size) |
353 | ioremap(unsigned long offset, unsigned long size) | ||
354 | { | 353 | { |
355 | return __ioremap_mode(offset, size, PAGE_KERNEL_NOCACHE); | 354 | return __ioremap_mode(offset, size, PAGE_KERNEL_NOCACHE); |
356 | } | 355 | } |
357 | 356 | ||
358 | static inline void __iomem * | 357 | static inline void __iomem * |
359 | ioremap_cache(unsigned long offset, unsigned long size) | 358 | ioremap_cache(phys_addr_t offset, unsigned long size) |
360 | { | 359 | { |
361 | return __ioremap_mode(offset, size, PAGE_KERNEL); | 360 | return __ioremap_mode(offset, size, PAGE_KERNEL); |
362 | } | 361 | } |
363 | 362 | ||
364 | #ifdef CONFIG_HAVE_IOREMAP_PROT | 363 | #ifdef CONFIG_HAVE_IOREMAP_PROT |
365 | static inline void __iomem * | 364 | static inline void __iomem * |
366 | ioremap_prot(resource_size_t offset, unsigned long size, unsigned long flags) | 365 | ioremap_prot(phys_addr_t offset, unsigned long size, unsigned long flags) |
367 | { | 366 | { |
368 | return __ioremap_mode(offset, size, __pgprot(flags)); | 367 | return __ioremap_mode(offset, size, __pgprot(flags)); |
369 | } | 368 | } |
370 | #endif | 369 | #endif |
371 | 370 | ||
372 | #ifdef CONFIG_IOREMAP_FIXED | 371 | #ifdef CONFIG_IOREMAP_FIXED |
373 | extern void __iomem *ioremap_fixed(resource_size_t, unsigned long, | 372 | extern void __iomem *ioremap_fixed(phys_addr_t, unsigned long, pgprot_t); |
374 | unsigned long, pgprot_t); | ||
375 | extern int iounmap_fixed(void __iomem *); | 373 | extern int iounmap_fixed(void __iomem *); |
376 | extern void ioremap_fixed_init(void); | 374 | extern void ioremap_fixed_init(void); |
377 | #else | 375 | #else |
378 | static inline void __iomem * | 376 | static inline void __iomem * |
379 | ioremap_fixed(resource_size_t phys_addr, unsigned long offset, | 377 | ioremap_fixed(phys_addr_t phys_addr, unsigned long size, pgprot_t prot) |
380 | unsigned long size, pgprot_t prot) | ||
381 | { | 378 | { |
382 | BUG(); | 379 | BUG(); |
383 | return NULL; | 380 | return NULL; |
diff --git a/arch/sh/include/asm/mmu.h b/arch/sh/include/asm/mmu.h index 15a05b615ba7..19fe84550b49 100644 --- a/arch/sh/include/asm/mmu.h +++ b/arch/sh/include/asm/mmu.h | |||
@@ -55,19 +55,29 @@ typedef struct { | |||
55 | 55 | ||
56 | #ifdef CONFIG_PMB | 56 | #ifdef CONFIG_PMB |
57 | /* arch/sh/mm/pmb.c */ | 57 | /* arch/sh/mm/pmb.c */ |
58 | long pmb_remap(unsigned long virt, unsigned long phys, | ||
59 | unsigned long size, pgprot_t prot); | ||
60 | void pmb_unmap(unsigned long addr); | ||
61 | void pmb_init(void); | ||
62 | bool __in_29bit_mode(void); | 58 | bool __in_29bit_mode(void); |
59 | |||
60 | void pmb_init(void); | ||
61 | int pmb_bolt_mapping(unsigned long virt, phys_addr_t phys, | ||
62 | unsigned long size, pgprot_t prot); | ||
63 | void __iomem *pmb_remap_caller(phys_addr_t phys, unsigned long size, | ||
64 | pgprot_t prot, void *caller); | ||
65 | int pmb_unmap(void __iomem *addr); | ||
66 | |||
63 | #else | 67 | #else |
64 | static inline long pmb_remap(unsigned long virt, unsigned long phys, | 68 | |
65 | unsigned long size, pgprot_t prot) | 69 | static inline void __iomem * |
70 | pmb_remap_caller(phys_addr_t phys, unsigned long size, | ||
71 | pgprot_t prot, void *caller) | ||
72 | { | ||
73 | return NULL; | ||
74 | } | ||
75 | |||
76 | static inline int pmb_unmap(void __iomem *addr) | ||
66 | { | 77 | { |
67 | return -EINVAL; | 78 | return -EINVAL; |
68 | } | 79 | } |
69 | 80 | ||
70 | #define pmb_unmap(addr) do { } while (0) | ||
71 | #define pmb_init(addr) do { } while (0) | 81 | #define pmb_init(addr) do { } while (0) |
72 | 82 | ||
73 | #ifdef CONFIG_29BIT | 83 | #ifdef CONFIG_29BIT |
@@ -77,6 +87,13 @@ static inline long pmb_remap(unsigned long virt, unsigned long phys, | |||
77 | #endif | 87 | #endif |
78 | 88 | ||
79 | #endif /* CONFIG_PMB */ | 89 | #endif /* CONFIG_PMB */ |
90 | |||
91 | static inline void __iomem * | ||
92 | pmb_remap(phys_addr_t phys, unsigned long size, pgprot_t prot) | ||
93 | { | ||
94 | return pmb_remap_caller(phys, size, prot, __builtin_return_address(0)); | ||
95 | } | ||
96 | |||
80 | #endif /* __ASSEMBLY__ */ | 97 | #endif /* __ASSEMBLY__ */ |
81 | 98 | ||
82 | #endif /* __MMU_H */ | 99 | #endif /* __MMU_H */ |