aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include/asm
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-01-13 04:31:48 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-01-13 04:31:48 -0500
commita0ab36689a36e583b6e736f1c99ac8c9aebdad59 (patch)
tree3efc6236d7ec0b5dbeeb311b8cd923c8e1e7f88c /arch/sh/include/asm
parent7f33306ee57bce9c79825e89c457a91025aa5aad (diff)
sh: fixed PMB mode refactoring.
This introduces some much overdue chainsawing of the fixed PMB support. fixed PMB was introduced initially to work around the fact that dynamic PMB mode was relatively broken, though they were never intended to converge. The main areas where there are differences are whether the system is booted in 29-bit mode or 32-bit mode, and whether legacy mappings are to be preserved. Any system booting in true 32-bit mode will not care about legacy mappings, so these are roughly decoupled. Regardless of the entry point, PMB and 32BIT are directly related as far as the kernel is concerned, so we also switch back to having one select the other. With legacy mappings iterated through and applied in the initialization path it's now possible to finally merge the two implementations and permit dynamic remapping overtop of remaining entries regardless of whether boot mappings are crafted by hand or inherited from the boot loader. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/include/asm')
-rw-r--r--arch/sh/include/asm/addrspace.h4
-rw-r--r--arch/sh/include/asm/io.h27
-rw-r--r--arch/sh/include/asm/mmu.h18
-rw-r--r--arch/sh/include/asm/page.h2
4 files changed, 39 insertions, 12 deletions
diff --git a/arch/sh/include/asm/addrspace.h b/arch/sh/include/asm/addrspace.h
index 99d6b3ecbe22..bcd7d4d78f6b 100644
--- a/arch/sh/include/asm/addrspace.h
+++ b/arch/sh/include/asm/addrspace.h
@@ -28,7 +28,7 @@
28/* Returns the privileged segment base of a given address */ 28/* Returns the privileged segment base of a given address */
29#define PXSEG(a) (((unsigned long)(a)) & 0xe0000000) 29#define PXSEG(a) (((unsigned long)(a)) & 0xe0000000)
30 30
31#if defined(CONFIG_29BIT) || defined(CONFIG_PMB_FIXED) 31#ifdef CONFIG_29BIT
32/* 32/*
33 * Map an address to a certain privileged segment 33 * Map an address to a certain privileged segment
34 */ 34 */
@@ -40,7 +40,7 @@
40 ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P3SEG)) 40 ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P3SEG))
41#define P4SEGADDR(a) \ 41#define P4SEGADDR(a) \
42 ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P4SEG)) 42 ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P4SEG))
43#endif /* 29BIT || PMB_FIXED */ 43#endif /* 29BIT */
44#endif /* P1SEG */ 44#endif /* P1SEG */
45 45
46/* Check if an address can be reached in 29 bits */ 46/* Check if an address can be reached in 29 bits */
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 026dd659a640..f4314d8b05b8 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -244,18 +244,11 @@ __ioremap(unsigned long offset, unsigned long size, unsigned long flags)
244} 244}
245 245
246static inline void __iomem * 246static inline void __iomem *
247__ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags) 247__ioremap_29bit(unsigned long offset, unsigned long size, unsigned long flags)
248{ 248{
249#if defined(CONFIG_SUPERH32) && !defined(CONFIG_PMB_FIXED) && !defined(CONFIG_PMB) 249#ifdef CONFIG_29BIT
250 unsigned long last_addr = offset + size - 1; 250 unsigned long last_addr = offset + size - 1;
251#endif
252 void __iomem *ret;
253 251
254 ret = __ioremap_trapped(offset, size);
255 if (ret)
256 return ret;
257
258#if defined(CONFIG_SUPERH32) && !defined(CONFIG_PMB_FIXED) && !defined(CONFIG_PMB)
259 /* 252 /*
260 * For P1 and P2 space this is trivial, as everything is already 253 * For P1 and P2 space this is trivial, as everything is already
261 * mapped. Uncached access for P1 addresses are done through P2. 254 * mapped. Uncached access for P1 addresses are done through P2.
@@ -274,6 +267,22 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
274 return (void __iomem *)P4SEGADDR(offset); 267 return (void __iomem *)P4SEGADDR(offset);
275#endif 268#endif
276 269
270 return NULL;
271}
272
273static inline void __iomem *
274__ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
275{
276 void __iomem *ret;
277
278 ret = __ioremap_trapped(offset, size);
279 if (ret)
280 return ret;
281
282 ret = __ioremap_29bit(offset, size, flags);
283 if (ret)
284 return ret;
285
277 return __ioremap(offset, size, flags); 286 return __ioremap(offset, size, flags);
278} 287}
279#else 288#else
diff --git a/arch/sh/include/asm/mmu.h b/arch/sh/include/asm/mmu.h
index c7426ad9926e..4b0882bf5183 100644
--- a/arch/sh/include/asm/mmu.h
+++ b/arch/sh/include/asm/mmu.h
@@ -65,11 +65,29 @@ struct pmb_entry {
65 struct pmb_entry *link; 65 struct pmb_entry *link;
66}; 66};
67 67
68#ifdef CONFIG_PMB
68/* arch/sh/mm/pmb.c */ 69/* arch/sh/mm/pmb.c */
69long pmb_remap(unsigned long virt, unsigned long phys, 70long pmb_remap(unsigned long virt, unsigned long phys,
70 unsigned long size, unsigned long flags); 71 unsigned long size, unsigned long flags);
71void pmb_unmap(unsigned long addr); 72void pmb_unmap(unsigned long addr);
72int pmb_init(void); 73int pmb_init(void);
74#else
75static inline long pmb_remap(unsigned long virt, unsigned long phys,
76 unsigned long size, unsigned long flags)
77{
78 return -EINVAL
79}
80
81static inline void pmb_unmap(unsigned long addr)
82{
83}
84
85static inline int pmb_init(void)
86{
87 return -ENODEV;
88}
89#endif /* CONFIG_PMB */
90
73#endif /* __ASSEMBLY__ */ 91#endif /* __ASSEMBLY__ */
74 92
75#endif /* __MMU_H */ 93#endif /* __MMU_H */
diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h
index 81bffc0d6860..a86c0f1d05d4 100644
--- a/arch/sh/include/asm/page.h
+++ b/arch/sh/include/asm/page.h
@@ -127,7 +127,7 @@ typedef struct page *pgtable_t;
127 * is not visible (it is part of the PMB mapping) and so needs to be 127 * is not visible (it is part of the PMB mapping) and so needs to be
128 * added or subtracted as required. 128 * added or subtracted as required.
129 */ 129 */
130#if defined(CONFIG_PMB_FIXED) 130#if defined(CONFIG_PMB_LEGACY)
131/* phys = virt - PAGE_OFFSET - (__MEMORY_START & 0xe0000000) */ 131/* phys = virt - PAGE_OFFSET - (__MEMORY_START & 0xe0000000) */
132#define PMB_OFFSET (PAGE_OFFSET - PXSEG(__MEMORY_START)) 132#define PMB_OFFSET (PAGE_OFFSET - PXSEG(__MEMORY_START))
133#define __pa(x) ((unsigned long)(x) - PMB_OFFSET) 133#define __pa(x) ((unsigned long)(x) - PMB_OFFSET)