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.h58
1 files changed, 32 insertions, 26 deletions
diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h
index 49592c780a6e..c4e0b3d472b9 100644
--- a/arch/sh/include/asm/page.h
+++ b/arch/sh/include/asm/page.h
@@ -45,31 +45,29 @@
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
53extern void clear_page(void *to); 54static inline unsigned long
55pages_do_alias(unsigned long addr1, unsigned long addr2)
56{
57 return (addr1 ^ addr2) & shm_align_mask;
58}
59
60#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
54extern void copy_page(void *to, void *from); 61extern void copy_page(void *to, void *from);
55 62
56#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \
57 (defined(CONFIG_CPU_SH5) || defined(CONFIG_CPU_SH4) || \
58 defined(CONFIG_SH7705_CACHE_32KB))
59struct page; 63struct page;
60struct vm_area_struct; 64struct vm_area_struct;
61extern void clear_user_page(void *to, unsigned long address, struct page *page); 65
62extern void copy_user_page(void *to, void *from, unsigned long address,
63 struct page *page);
64#if defined(CONFIG_CPU_SH4)
65extern void copy_user_highpage(struct page *to, struct page *from, 66extern void copy_user_highpage(struct page *to, struct page *from,
66 unsigned long vaddr, struct vm_area_struct *vma); 67 unsigned long vaddr, struct vm_area_struct *vma);
67#define __HAVE_ARCH_COPY_USER_HIGHPAGE 68#define __HAVE_ARCH_COPY_USER_HIGHPAGE
68#endif 69extern void clear_user_highpage(struct page *page, unsigned long vaddr);
69#else 70#define clear_user_highpage clear_user_highpage
70#define clear_user_page(page, vaddr, pg) clear_page(page)
71#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
72#endif
73 71
74/* 72/*
75 * These are used to make use of C type-checking.. 73 * These are used to make use of C type-checking..
@@ -90,7 +88,7 @@ typedef struct { unsigned long pgd; } pgd_t;
90#define __pte(x) ((pte_t) { (x) } ) 88#define __pte(x) ((pte_t) { (x) } )
91#else 89#else
92typedef struct { unsigned long long pte_low; } pte_t; 90typedef struct { unsigned long long pte_low; } pte_t;
93typedef struct { unsigned long pgprot; } pgprot_t; 91typedef struct { unsigned long long pgprot; } pgprot_t;
94typedef struct { unsigned long pgd; } pgd_t; 92typedef struct { unsigned long pgd; } pgd_t;
95#define pte_val(x) ((x).pte_low) 93#define pte_val(x) ((x).pte_low)
96#define __pte(x) ((pte_t) { (x) } ) 94#define __pte(x) ((pte_t) { (x) } )
@@ -129,17 +127,25 @@ typedef struct page *pgtable_t;
129 * 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
130 * added or subtracted as required. 128 * added or subtracted as required.
131 */ 129 */
132#if defined(CONFIG_PMB_FIXED) 130#ifdef CONFIG_PMB
133/* phys = virt - PAGE_OFFSET - (__MEMORY_START & 0xe0000000) */ 131#define ___pa(x) ((x)-PAGE_OFFSET+__MEMORY_START)
134#define PMB_OFFSET (PAGE_OFFSET - PXSEG(__MEMORY_START)) 132#define ___va(x) ((x)+PAGE_OFFSET-__MEMORY_START)
135#define __pa(x) ((unsigned long)(x) - PMB_OFFSET) 133#else
136#define __va(x) ((void *)((unsigned long)(x) + PMB_OFFSET)) 134#define ___pa(x) ((x)-PAGE_OFFSET)
137#elif defined(CONFIG_32BIT) 135#define ___va(x) ((x)+PAGE_OFFSET)
138#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET+__MEMORY_START) 136#endif
139#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)
140#else 146#else
141#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) 147#define UNCAC_ADDR(addr) ((addr))
142#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) 148#define CAC_ADDR(addr) ((addr))
143#endif 149#endif
144 150
145#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 151#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
@@ -174,7 +180,7 @@ typedef struct page *pgtable_t;
174 * Some drivers need to perform DMA into kmalloc'ed buffers 180 * Some drivers need to perform DMA into kmalloc'ed buffers
175 * and so we have to increase the kmalloc minalign for this. 181 * and so we have to increase the kmalloc minalign for this.
176 */ 182 */
177#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES 183#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
178 184
179#ifdef CONFIG_SUPERH64 185#ifdef CONFIG_SUPERH64
180/* 186/*