This source file includes following definitions.
- probe_memory
- map_the_prom
- do_page_fault
1 #include <linux/string.h>
2 #include <linux/types.h>
3 #include <linux/ptrace.h>
4 #include <linux/mman.h>
5 #include <linux/signal.h>
6 #include <linux/mm.h>
7
8 #include <asm/system.h>
9 #include <asm/segment.h>
10 #include <asm/openprom.h>
11 #include <asm/page.h>
12 #include <asm/pgtable.h>
13
14 extern unsigned long pg0[1024];
15 extern struct sparc_phys_banks sp_banks[14];
16
17 extern void die_if_kernel(char *,struct pt_regs *,long);
18
19 struct linux_romvec *romvec;
20
21
22
23 int tbase_needs_unmapping;
24
25
26
27
28
29 int num_segmaps, num_contexts;
30 int invalid_segment;
31
32
33
34 int vac_size, vac_linesize, vac_do_hw_vac_flushes;
35 int vac_entries_per_context, vac_entries_per_segment;
36 int vac_entries_per_page;
37
38
39
40
41
42
43 #undef CONFIG_TEST_VERIFY_AREA
44
45
46
47
48
49 unsigned long
50 probe_memory(void)
51 {
52 register struct linux_romvec *lprom;
53 register struct linux_mlist_v0 *mlist;
54 register unsigned long bytes, base_paddr, tally;
55 register int i;
56
57 bytes = tally = 0;
58 base_paddr = 0;
59 i=0;
60 lprom = romvec;
61 switch(lprom->pv_romvers)
62 {
63 case 0:
64 mlist=(*(lprom->pv_v0mem.v0_totphys));
65 bytes = tally = mlist->num_bytes;
66 base_paddr = (unsigned long) mlist->start_adr;
67
68 sp_banks[0].base_addr = base_paddr;
69 sp_banks[0].num_bytes = bytes;
70
71 if(mlist->theres_more != (void *)0) {
72 i++;
73 mlist=mlist->theres_more;
74 bytes=mlist->num_bytes;
75 tally += bytes;
76 sp_banks[i].base_addr = (unsigned long) mlist->start_adr;
77 sp_banks[i].num_bytes = mlist->num_bytes;
78 }
79 break;
80 case 2:
81 printk("no v2 memory probe support yet.\n");
82 (*(lprom->pv_halt))();
83 break;
84 }
85
86 i++;
87 sp_banks[i].base_addr = 0xdeadbeef;
88 sp_banks[i].num_bytes = 0;
89
90 return tally;
91 }
92
93
94
95
96
97
98 int
99 map_the_prom(int curr_num_segs)
100 {
101 register unsigned long prom_va_begin;
102 register unsigned long prom_va_end;
103 register int segmap_entry, i;
104
105 prom_va_begin = LINUX_OPPROM_BEGVM;
106 prom_va_end = LINUX_OPPROM_ENDVM;
107
108 #ifdef DEBUG_MAP_PROM
109 printk("\ncurr_num_segs = 0x%x\n", curr_num_segs);
110 #endif
111
112 while( prom_va_begin < prom_va_end)
113 {
114 segmap_entry=get_segmap(prom_va_begin);
115
116 curr_num_segs = ((segmap_entry<curr_num_segs)
117 ? segmap_entry : curr_num_segs);
118
119 for(i = num_contexts; --i > 0;)
120 (*romvec->pv_setctxt)(i, (char *) prom_va_begin,
121 segmap_entry);
122
123 if(segmap_entry == invalid_segment)
124 {
125
126 #ifdef DEBUG_MAP_PROM
127 printk("invalid_segments, virt_addr 0x%x\n", prom_va_begin);
128 #endif
129
130 prom_va_begin += 0x40000;
131 continue;
132 }
133
134
135
136
137
138 #ifdef DEBUG_MAP_PROM
139 printk("making segmap for prom privileged, va = 0x%x\n",
140 prom_va_begin);
141 #endif
142
143 for(i = 0x40; --i >= 0; prom_va_begin+=4096)
144 {
145 put_pte(prom_va_begin, get_pte(prom_va_begin) | 0x20000000);
146 }
147
148 }
149
150 printk("Mapped the PROM in all contexts...\n");
151
152 #ifdef DEBUG_MAP_PROM
153 printk("curr_num_segs = 0x%x\n", curr_num_segs);
154 #endif
155
156 return curr_num_segs;
157
158 }
159
160
161
162
163
164
165 asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code)
166 {
167 die_if_kernel("Oops", regs, error_code);
168 do_exit(SIGKILL);
169 }
170
171
172
173