aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include/asm/page.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/include/asm/page.h')
-rw-r--r--arch/sh/include/asm/page.h34
1 files changed, 21 insertions, 13 deletions
diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h
index 81bffc0d6860..fb703d120d09 100644
--- a/arch/sh/include/asm/page.h
+++ b/arch/sh/include/asm/page.h
@@ -45,10 +45,11 @@
45#endif 45#endif
46 46
47#ifndef __ASSEMBLY__ 47#ifndef __ASSEMBLY__
48#include <asm/uncached.h>
48 49
49extern unsigned long shm_align_mask; 50extern unsigned long shm_align_mask;
50extern unsigned long max_low_pfn, min_low_pfn; 51extern unsigned long max_low_pfn, min_low_pfn;
51extern unsigned long memory_start, memory_end; 52extern unsigned long memory_start, memory_end, memory_limit;
52 53
53static inline unsigned long 54static inline unsigned long
54pages_do_alias(unsigned long addr1, unsigned long addr2) 55pages_do_alias(unsigned long addr1, unsigned long addr2)
@@ -56,7 +57,6 @@ pages_do_alias(unsigned long addr1, unsigned long addr2)
56 return (addr1 ^ addr2) & shm_align_mask; 57 return (addr1 ^ addr2) & shm_align_mask;
57} 58}
58 59
59
60#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) 60#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
61extern void copy_page(void *to, void *from); 61extern void copy_page(void *to, void *from);
62 62
@@ -88,7 +88,7 @@ typedef struct { unsigned long pgd; } pgd_t;
88#define __pte(x) ((pte_t) { (x) } ) 88#define __pte(x) ((pte_t) { (x) } )
89#else 89#else
90typedef struct { unsigned long long pte_low; } pte_t; 90typedef struct { unsigned long long pte_low; } pte_t;
91typedef struct { unsigned long pgprot; } pgprot_t; 91typedef struct { unsigned long long pgprot; } pgprot_t;
92typedef struct { unsigned long pgd; } pgd_t; 92typedef struct { unsigned long pgd; } pgd_t;
93#define pte_val(x) ((x).pte_low) 93#define pte_val(x) ((x).pte_low)
94#define __pte(x) ((pte_t) { (x) } ) 94#define __pte(x) ((pte_t) { (x) } )
@@ -127,17 +127,25 @@ 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#ifdef CONFIG_PMB
131/* phys = virt - PAGE_OFFSET - (__MEMORY_START & 0xe0000000) */ 131#define ___pa(x) ((x)-PAGE_OFFSET+__MEMORY_START)
132#define PMB_OFFSET (PAGE_OFFSET - PXSEG(__MEMORY_START)) 132#define ___va(x) ((x)+PAGE_OFFSET-__MEMORY_START)
133#define __pa(x) ((unsigned long)(x) - PMB_OFFSET) 133#else
134#define __va(x) ((void *)((unsigned long)(x) + PMB_OFFSET)) 134#define ___pa(x) ((x)-PAGE_OFFSET)
135#elif defined(CONFIG_32BIT) 135#define ___va(x) ((x)+PAGE_OFFSET)
136#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET+__MEMORY_START) 136#endif
137#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET-__MEMORY_START)) 137
138#ifndef __ASSEMBLY__
139#define __pa(x) ___pa((unsigned long)x)
140#define __va(x) (void *)___va((unsigned long)x)
141#endif /* !__ASSEMBLY__ */
142
143#ifdef CONFIG_UNCACHED_MAPPING
144#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + uncached_start)
145#define CAC_ADDR(addr) ((addr) - uncached_start + PAGE_OFFSET)
138#else 146#else
139#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) 147#define UNCAC_ADDR(addr) ((addr))
140#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) 148#define CAC_ADDR(addr) ((addr))
141#endif 149#endif
142 150
143#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 151#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)