OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-sh64/] [page.h] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
#ifndef __ASM_SH64_PAGE_H
2
#define __ASM_SH64_PAGE_H
3
 
4
/*
5
 * This file is subject to the terms and conditions of the GNU General Public
6
 * License.  See the file "COPYING" in the main directory of this archive
7
 * for more details.
8
 *
9
 * include/asm-sh64/page.h
10
 *
11
 * Copyright (C) 2000, 2001  Paolo Alberelli
12
 * Copyright (C) 2003  Paul Mundt
13
 *
14
 * benedict.gaster@superh.com 19th, 24th July 2002.
15
 *
16
 * Modified to take account of enabling for D-CACHE support.
17
 *
18
 */
19
 
20
#include <linux/config.h>
21
 
22
/* PAGE_SHIFT determines the page size */
23
#define PAGE_SHIFT      12
24
#ifdef __ASSEMBLY__
25
#define PAGE_SIZE       4096
26
#else
27
#define PAGE_SIZE       (1UL << PAGE_SHIFT)
28
#endif
29
#define PAGE_MASK       (~(PAGE_SIZE-1))
30
#define PTE_MASK        PAGE_MASK
31
 
32
#ifdef __KERNEL__
33
#ifndef __ASSEMBLY__
34
 
35
extern void sh64_page_clear(void *page);
36
extern void sh64_page_copy(void *from, void *to);
37
 
38
#define clear_page(page)                sh64_page_clear(page)
39
#define copy_page(to,from)              sh64_page_copy(from, to)
40
 
41
#if defined(CONFIG_DCACHE_DISABLED)
42
 
43
#define clear_user_page(page, vaddr)    clear_page(page)
44
#define copy_user_page(to, from, vaddr) copy_page(to, from)
45
 
46
#else
47
 
48
extern void clear_user_page(void *to, unsigned long address);
49
extern void copy_user_page(void *to, void *from, unsigned long address);
50
 
51
#endif /* defined(CONFIG_DCACHE_DISABLED) */
52
 
53
/*
54
 * These are used to make use of C type-checking..
55
 */
56
typedef struct { unsigned long long pte; } pte_t;
57
typedef struct { unsigned long pmd; } pmd_t;
58
typedef struct { unsigned long pgd; } pgd_t;
59
typedef struct { unsigned long pgprot; } pgprot_t;
60
 
61
#define pte_val(x)      ((x).pte)
62
#define pmd_val(x)      ((x).pmd)
63
#define pgd_val(x)      ((x).pgd)
64
#define pgprot_val(x)   ((x).pgprot)
65
 
66
#define __pte(x) ((pte_t) { (x) } )
67
#define __pmd(x) ((pmd_t) { (x) } )
68
#define __pgd(x) ((pgd_t) { (x) } )
69
#define __pgprot(x)     ((pgprot_t) { (x) } )
70
 
71
#endif /* !__ASSEMBLY__ */
72
 
73
/* to align the pointer to the (next) page boundary */
74
#define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
75
 
76
/*
77
 * config.in defined.
78
 */
79
#define __MEMORY_START          (CONFIG_MEMORY_START)
80
#define PAGE_OFFSET             (CONFIG_CACHED_MEMORY_OFFSET)
81
 
82
#define __pa(x)                 ((unsigned long)(x)-PAGE_OFFSET)
83
#define __va(x)                 ((void *)((unsigned long)(x)+PAGE_OFFSET))
84
#define MAP_NR(addr)            ((__pa(addr)-__MEMORY_START) >> PAGE_SHIFT)
85
 
86
#define VALID_PAGE(page)        ((page - mem_map) < max_mapnr)
87
#define phys_to_page(phys)      (mem_map + (((phys)-__MEMORY_START) >> PAGE_SHIFT))
88
#define virt_to_page(kaddr)  (mem_map + MAP_NR(kaddr))
89
#define page_to_phys(page)      (((page - mem_map) << PAGE_SHIFT) + __MEMORY_START)
90
 
91
 
92
#ifndef __ASSEMBLY__
93
 
94
 
95
/*
96
 * Tell the user there is some problem.
97
 */
98
#define BUG() do { \
99
        printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
100
        asm volatile("nop"); \
101
} while (0)
102
 
103
#define PAGE_BUG(page) do { \
104
        BUG(); \
105
} while (0)
106
 
107
/* Pure 2^n version of get_order */
108
extern __inline__ int get_order(unsigned long size)
109
{
110
        int order;
111
 
112
        size = (size-1) >> (PAGE_SHIFT-1);
113
        order = -1;
114
        do {
115
                size >>= 1;
116
                order++;
117
        } while (size);
118
        return order;
119
}
120
 
121
 
122
#define VM_DATA_DEFAULT_FLAGS   (VM_READ | VM_WRITE | VM_EXEC | \
123
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
124
 
125
#endif
126
 
127
#endif /* __KERNEL__ */
128
 
129
#endif /* __ASM_SH64_PAGE_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.