1 |
1624 |
jcastillo |
/* $Id: loadmmu.c,v 1.1 2005-12-20 09:50:49 jcastillo Exp $
|
2 |
|
|
* loadmmu.c: This code loads up all the mm function pointers once the
|
3 |
|
|
* machine type has been determined. It also sets the static
|
4 |
|
|
* mmu values such as PAGE_NONE, etc.
|
5 |
|
|
*
|
6 |
|
|
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
7 |
|
|
*/
|
8 |
|
|
|
9 |
|
|
#include <linux/kernel.h>
|
10 |
|
|
#include <linux/mm.h>
|
11 |
|
|
|
12 |
|
|
#include <asm/system.h>
|
13 |
|
|
#include <asm/page.h>
|
14 |
|
|
#include <asm/pgtable.h>
|
15 |
|
|
|
16 |
|
|
struct ctx_list *ctx_list_pool;
|
17 |
|
|
struct ctx_list ctx_free;
|
18 |
|
|
struct ctx_list ctx_used;
|
19 |
|
|
|
20 |
|
|
unsigned long (*alloc_kernel_stack)(struct task_struct *tsk);
|
21 |
|
|
void (*free_kernel_stack)(unsigned long stack);
|
22 |
|
|
struct task_struct *(*alloc_task_struct)(void);
|
23 |
|
|
void (*free_task_struct)(struct task_struct *tsk);
|
24 |
|
|
|
25 |
|
|
void (*quick_kernel_fault)(unsigned long);
|
26 |
|
|
|
27 |
|
|
void (*mmu_exit_hook)(void);
|
28 |
|
|
void (*mmu_flush_hook)(void);
|
29 |
|
|
|
30 |
|
|
/* translate between physical and virtual addresses */
|
31 |
|
|
unsigned long (*mmu_v2p)(unsigned long);
|
32 |
|
|
unsigned long (*mmu_p2v)(unsigned long);
|
33 |
|
|
|
34 |
|
|
char *(*mmu_lockarea)(char *, unsigned long);
|
35 |
|
|
void (*mmu_unlockarea)(char *, unsigned long);
|
36 |
|
|
|
37 |
|
|
char *(*mmu_get_scsi_one)(char *, unsigned long, struct linux_sbus *sbus);
|
38 |
|
|
void (*mmu_get_scsi_sgl)(struct mmu_sglist *, int, struct linux_sbus *sbus);
|
39 |
|
|
void (*mmu_release_scsi_one)(char *, unsigned long, struct linux_sbus *sbus);
|
40 |
|
|
void (*mmu_release_scsi_sgl)(struct mmu_sglist *, int, struct linux_sbus *sbus);
|
41 |
|
|
|
42 |
|
|
void (*update_mmu_cache)(struct vm_area_struct *vma, unsigned long address, pte_t pte);
|
43 |
|
|
|
44 |
|
|
#ifdef __SMP__
|
45 |
|
|
void (*local_flush_cache_all)(void);
|
46 |
|
|
void (*local_flush_cache_mm)(struct mm_struct *);
|
47 |
|
|
void (*local_flush_cache_range)(struct mm_struct *, unsigned long start,
|
48 |
|
|
unsigned long end);
|
49 |
|
|
void (*local_flush_cache_page)(struct vm_area_struct *, unsigned long address);
|
50 |
|
|
|
51 |
|
|
void (*local_flush_tlb_all)(void);
|
52 |
|
|
void (*local_flush_tlb_mm)(struct mm_struct *);
|
53 |
|
|
void (*local_flush_tlb_range)(struct mm_struct *, unsigned long start,
|
54 |
|
|
unsigned long end);
|
55 |
|
|
void (*local_flush_tlb_page)(struct vm_area_struct *, unsigned long address);
|
56 |
|
|
void (*local_flush_page_to_ram)(unsigned long address);
|
57 |
|
|
#endif
|
58 |
|
|
|
59 |
|
|
void (*flush_cache_all)(void);
|
60 |
|
|
void (*flush_cache_mm)(struct mm_struct *);
|
61 |
|
|
void (*flush_cache_range)(struct mm_struct *, unsigned long start,
|
62 |
|
|
unsigned long end);
|
63 |
|
|
void (*flush_cache_page)(struct vm_area_struct *, unsigned long address);
|
64 |
|
|
|
65 |
|
|
void (*flush_tlb_all)(void);
|
66 |
|
|
void (*flush_tlb_mm)(struct mm_struct *);
|
67 |
|
|
void (*flush_tlb_range)(struct mm_struct *, unsigned long start,
|
68 |
|
|
unsigned long end);
|
69 |
|
|
void (*flush_tlb_page)(struct vm_area_struct *, unsigned long address);
|
70 |
|
|
|
71 |
|
|
void (*flush_page_to_ram)(unsigned long page);
|
72 |
|
|
|
73 |
|
|
void (*set_pte)(pte_t *pteptr, pte_t pteval);
|
74 |
|
|
|
75 |
|
|
unsigned int pmd_shift, pmd_size, pmd_mask;
|
76 |
|
|
unsigned int (*pmd_align)(unsigned int);
|
77 |
|
|
unsigned int pgdir_shift, pgdir_size, pgdir_mask;
|
78 |
|
|
unsigned int (*pgdir_align)(unsigned int);
|
79 |
|
|
unsigned int ptrs_per_pte, ptrs_per_pmd, ptrs_per_pgd;
|
80 |
|
|
unsigned int pg_iobits;
|
81 |
|
|
|
82 |
|
|
pgprot_t page_none, page_shared, page_copy, page_readonly, page_kernel;
|
83 |
|
|
|
84 |
|
|
unsigned long (*pte_page)(pte_t);
|
85 |
|
|
unsigned long (*pmd_page)(pmd_t);
|
86 |
|
|
unsigned long (*pgd_page)(pgd_t);
|
87 |
|
|
|
88 |
|
|
void (*sparc_update_rootmmu_dir)(struct task_struct *, pgd_t *pgdir);
|
89 |
|
|
unsigned long (*(vmalloc_start))(void);
|
90 |
|
|
void (*switch_to_context)(struct task_struct *tsk);
|
91 |
|
|
|
92 |
|
|
int (*pte_none)(pte_t);
|
93 |
|
|
int (*pte_present)(pte_t);
|
94 |
|
|
void (*pte_clear)(pte_t *);
|
95 |
|
|
|
96 |
|
|
int (*pmd_none)(pmd_t);
|
97 |
|
|
int (*pmd_bad)(pmd_t);
|
98 |
|
|
int (*pmd_present)(pmd_t);
|
99 |
|
|
void (*pmd_clear)(pmd_t *);
|
100 |
|
|
|
101 |
|
|
int (*pgd_none)(pgd_t);
|
102 |
|
|
int (*pgd_bad)(pgd_t);
|
103 |
|
|
int (*pgd_present)(pgd_t);
|
104 |
|
|
void (*pgd_clear)(pgd_t *);
|
105 |
|
|
|
106 |
|
|
pte_t (*mk_pte)(unsigned long, pgprot_t);
|
107 |
|
|
pte_t (*mk_pte_io)(unsigned long, pgprot_t, int);
|
108 |
|
|
void (*pgd_set)(pgd_t *, pmd_t *);
|
109 |
|
|
pte_t (*pte_modify)(pte_t, pgprot_t);
|
110 |
|
|
pgd_t * (*pgd_offset)(struct mm_struct *, unsigned long);
|
111 |
|
|
pmd_t * (*pmd_offset)(pgd_t *, unsigned long);
|
112 |
|
|
pte_t * (*pte_offset)(pmd_t *, unsigned long);
|
113 |
|
|
void (*pte_free_kernel)(pte_t *);
|
114 |
|
|
pte_t * (*pte_alloc_kernel)(pmd_t *, unsigned long);
|
115 |
|
|
|
116 |
|
|
void (*pmd_free_kernel)(pmd_t *);
|
117 |
|
|
pmd_t * (*pmd_alloc_kernel)(pgd_t *, unsigned long);
|
118 |
|
|
void (*pte_free)(pte_t *);
|
119 |
|
|
pte_t * (*pte_alloc)(pmd_t *, unsigned long);
|
120 |
|
|
|
121 |
|
|
void (*pmd_free)(pmd_t *);
|
122 |
|
|
pmd_t * (*pmd_alloc)(pgd_t *, unsigned long);
|
123 |
|
|
void (*pgd_free)(pgd_t *);
|
124 |
|
|
|
125 |
|
|
pgd_t * (*pgd_alloc)(void);
|
126 |
|
|
|
127 |
|
|
int (*pte_write)(pte_t);
|
128 |
|
|
int (*pte_dirty)(pte_t);
|
129 |
|
|
int (*pte_young)(pte_t);
|
130 |
|
|
|
131 |
|
|
pte_t (*pte_wrprotect)(pte_t);
|
132 |
|
|
pte_t (*pte_mkclean)(pte_t);
|
133 |
|
|
pte_t (*pte_mkold)(pte_t);
|
134 |
|
|
pte_t (*pte_mkwrite)(pte_t);
|
135 |
|
|
pte_t (*pte_mkdirty)(pte_t);
|
136 |
|
|
pte_t (*pte_mkyoung)(pte_t);
|
137 |
|
|
|
138 |
|
|
char *(*mmu_info)(void);
|
139 |
|
|
|
140 |
|
|
extern void ld_mmu_sun4c(void);
|
141 |
|
|
extern void ld_mmu_srmmu(void);
|
142 |
|
|
|
143 |
|
|
void
|
144 |
|
|
load_mmu(void)
|
145 |
|
|
{
|
146 |
|
|
switch(sparc_cpu_model) {
|
147 |
|
|
case sun4c:
|
148 |
|
|
ld_mmu_sun4c();
|
149 |
|
|
break;
|
150 |
|
|
case sun4m:
|
151 |
|
|
case sun4d:
|
152 |
|
|
case sun4e:
|
153 |
|
|
ld_mmu_srmmu();
|
154 |
|
|
break;
|
155 |
|
|
default:
|
156 |
|
|
printk("load_mmu:MMU support not available for this architecture\n");
|
157 |
|
|
printk("load_mmu:sparc_cpu_model = %d\n", (int) sparc_cpu_model);
|
158 |
|
|
printk("load_mmu:Halting...\n");
|
159 |
|
|
panic("load_mmu()");
|
160 |
|
|
}
|
161 |
|
|
}
|