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

Subversion Repositories or1k

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

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

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * This file is subject to the terms and conditions of the GNU General Public
3
 * License.  See the file "COPYING" in the main directory of this archive
4
 * for more details.
5
 *
6
 * Copyright (C) 1994 - 1999, 2000 by Ralf Baechle
7
 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8
 */
9
#ifndef _ASM_PAGE_H
10
#define _ASM_PAGE_H
11
 
12
#include <linux/config.h>
13
#include <asm/break.h>
14
 
15
#ifdef __KERNEL__
16
 
17
/*
18
 * PAGE_SHIFT determines the page size
19
 */
20
#ifdef CONFIG_PAGE_SIZE_4KB
21
#define PAGE_SHIFT      12
22
#endif
23
#ifdef CONFIG_PAGE_SIZE_16KB
24
#define PAGE_SHIFT      14
25
#endif
26
#ifdef CONFIG_PAGE_SIZE_64KB
27
#define PAGE_SHIFT      16
28
#endif
29
#define PAGE_SIZE       (1UL << PAGE_SHIFT)
30
#define PAGE_MASK       (~(PAGE_SIZE-1))
31
 
32
#ifndef __ASSEMBLY__
33
 
34
#include <asm/cacheflush.h>
35
 
36
#define BUG()                                                           \
37
do {                                                                    \
38
        __asm__ __volatile__("break %0" : : "i" (BRK_BUG));             \
39
} while (0)
40
 
41
#define PAGE_BUG(page) do {  BUG(); } while (0)
42
 
43
extern void clear_page(void * page);
44
extern void copy_page(void * to, void * from);
45
 
46
extern unsigned long shm_align_mask;
47
 
48
static inline unsigned long pages_do_alias(unsigned long addr1,
49
        unsigned long addr2)
50
{
51
        return (addr1 ^ addr2) & shm_align_mask;
52
}
53
 
54
static inline void clear_user_page(void *page, unsigned long vaddr)
55
{
56
        unsigned long kaddr = (unsigned long) page;
57
 
58
        clear_page(page);
59
        if (pages_do_alias(kaddr, vaddr))
60
                flush_data_cache_page(kaddr);
61
}
62
 
63
static inline void copy_user_page(void * to, void * from, unsigned long vaddr)
64
{
65
        unsigned long kto = (unsigned long) to;
66
 
67
        copy_page(to, from);
68
        if (pages_do_alias(kto, vaddr))
69
                flush_data_cache_page(kto);
70
}
71
 
72
/*
73
 * These are used to make use of C type-checking..
74
 */
75
typedef struct { unsigned long pte; } pte_t;
76
typedef struct { unsigned long pmd; } pmd_t;
77
typedef struct { unsigned long pgd; } pgd_t;
78
typedef struct { unsigned long pgprot; } pgprot_t;
79
 
80
#define pte_val(x)      ((x).pte)
81
#define pmd_val(x)      ((x).pmd)
82
#define pgd_val(x)      ((x).pgd)
83
#define pgprot_val(x)   ((x).pgprot)
84
 
85
#define ptep_buddy(x)   ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t)))
86
 
87
#define __pte(x)        ((pte_t) { (x) } )
88
#define __pmd(x)        ((pmd_t) { (x) } )
89
#define __pgd(x)        ((pgd_t) { (x) } )
90
#define __pgprot(x)     ((pgprot_t) { (x) } )
91
 
92
/* Pure 2^n version of get_order */
93
static __inline__ int get_order(unsigned long size)
94
{
95
        int order;
96
 
97
        size = (size-1) >> (PAGE_SHIFT-1);
98
        order = -1;
99
        do {
100
                size >>= 1;
101
                order++;
102
        } while (size);
103
        return order;
104
}
105
 
106
#endif /* !__ASSEMBLY__ */
107
 
108
/* to align the pointer to the (next) page boundary */
109
#define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
110
 
111
/*
112
 * This handles the memory map.
113
 * We handle pages at KSEG0 for kernels with upto 512mb of memory,
114
 * at XKPHYS with a suitable caching mode for kernels with more than that.
115
 */
116
#if defined(CONFIG_SGI_IP22) || defined(CONFIG_MIPS_ATLAS) || \
117
    defined(CONFIG_MIPS_MALTA) || defined(CONFIG_MIPS_SEAD) || \
118
    defined(CONFIG_DECSTATION) || defined(CONFIG_MIPS_COBALT)
119
#define PAGE_OFFSET     0xffffffff80000000UL
120
#define UNCAC_BASE      0xffffffffa0000000UL
121
#endif
122
#if defined(CONFIG_SGI_IP27)
123
#define PAGE_OFFSET     0xa800000000000000UL
124
#define UNCAC_BASE      0x9600000000000000UL
125
#endif
126
#if defined(CONFIG_SIBYTE_SB1xxx_SOC)
127
#define PAGE_OFFSET     0xa800000000000000UL
128
#endif
129
#if defined(CONFIG_MOMENCO_OCELOT_C)
130
#define PAGE_OFFSET     0x9800000000000000UL
131
#define UNCAC_BASE      0x9000000000000000UL
132
#endif
133
#if defined(CONFIG_MOMENCO_JAGUAR_ATX)
134
#define PAGE_OFFSET     0xa800000000000000UL    /* cached, coherent writeback */
135
#define UNCAC_BASE      0x9000000000000000UL    /* uncac, blocking */
136
#endif
137
 
138
#define __pa(x)         ((unsigned long) (x) - PAGE_OFFSET)
139
#define __va(x)         ((void *)((unsigned long) (x) + PAGE_OFFSET))
140
#ifndef CONFIG_DISCONTIGMEM
141
#define virt_to_page(kaddr)     (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
142
#define VALID_PAGE(page)        ((page - mem_map) < max_mapnr)
143
#endif
144
 
145
#define UNCAC_ADDR(addr)        ((addr) - PAGE_OFFSET + UNCAC_BASE)
146
#define CAC_ADDR(addr)          ((addr) - UNCAC_BASE + PAGE_OFFSET)
147
 
148
#define VM_DATA_DEFAULT_FLAGS   (VM_READ | VM_WRITE | VM_EXEC | \
149
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
150
 
151
#endif /* defined (__KERNEL__) */
152
 
153
#endif /* _ASM_PAGE_H */

powered by: WebSVN 2.1.0

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