summaryrefslogtreecommitdiffstats
path: root/arch/m68k/mm/init.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-04-29 21:13:14 +0000
committer <ralf@linux-mips.org>1997-04-29 21:13:14 +0000
commit19c9bba94152148523ba0f7ef7cffe3d45656b11 (patch)
tree40b1cb534496a7f1ca0f5c314a523c69f1fee464 /arch/m68k/mm/init.c
parent7206675c40394c78a90e74812bbdbf8cf3cca1be (diff)
Import of Linux/MIPS 2.1.36
Diffstat (limited to 'arch/m68k/mm/init.c')
-rw-r--r--arch/m68k/mm/init.c65
1 files changed, 32 insertions, 33 deletions
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 3fcc2d904..01cd315dd 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -71,12 +71,12 @@ void show_mem(void)
total++;
if (PageReserved(mem_map+i))
reserved++;
- else if (!mem_map[i].count)
+ else if (!atomic_read(&mem_map[i].count))
free++;
- else if (mem_map[i].count == 1)
+ else if (atomic_read(&mem_map[i].count) == 1)
nonshared++;
else
- shared += mem_map[i].count-1;
+ shared += atomic_read(&mem_map[i].count) - 1;
}
printk("%d pages of RAM\n",total);
printk("%d free pages\n",free);
@@ -102,9 +102,15 @@ pte_t *kernel_page_table (unsigned long *memavailp)
{
pte_t *ptablep;
- ptablep = (pte_t *)*memavailp;
- *memavailp += PAGE_SIZE;
+ if (memavailp) {
+ ptablep = (pte_t *)*memavailp;
+ *memavailp += PAGE_SIZE;
+ }
+ else
+ ptablep = (pte_t *)__get_free_page(GFP_KERNEL);
+ flush_page_to_ram((unsigned long) ptablep);
+ flush_tlb_kernel_page((unsigned long) ptablep);
nocache_page ((unsigned long)ptablep);
return ptablep;
@@ -289,8 +295,6 @@ unsigned long paging_init(unsigned long start_mem, unsigned long end_mem)
{
int chunk;
unsigned long mem_avail = 0;
- /* pointer to page table for kernel stacks */
- extern unsigned long availmem;
#ifdef DEBUG
{
@@ -318,24 +322,14 @@ unsigned long paging_init(unsigned long start_mem, unsigned long end_mem)
* tables and thus modify availmem.
*/
- for (chunk = 0; chunk < boot_info.num_memory; chunk++) {
- mem_avail = map_chunk (boot_info.memory[chunk].addr,
- boot_info.memory[chunk].size,
- &availmem);
+ for (chunk = 0; chunk < m68k_num_memory; chunk++) {
+ mem_avail = map_chunk (m68k_memory[chunk].addr,
+ m68k_memory[chunk].size, &start_mem);
}
flush_tlb_all();
#ifdef DEBUG
printk ("memory available is %ldKB\n", mem_avail >> 10);
-#endif
-
- /*
- * virtual address after end of kernel
- * "availmem" is setup by the code in head.S.
- */
- start_mem = availmem;
-
-#ifdef DEBUG
printk ("start_mem is %#lx\nvirtual_end is %#lx\n",
start_mem, end_mem);
#endif
@@ -374,17 +368,17 @@ unsigned long paging_init(unsigned long start_mem, unsigned long end_mem)
#endif
if (CPU_IS_040_OR_060)
- asm __volatile__ ("movel %0,%/d0\n\t"
- ".long 0x4e7b0806" /* movec d0,urp */
+ asm __volatile__ (".chip 68040\n\t"
+ "movec %0,%%urp\n\t"
+ ".chip 68k"
: /* no outputs */
- : "g" (task[0]->tss.crp[1])
- : "d0");
+ : "r" (task[0]->tss.crp[1]));
else
- asm __volatile__ ("movel %0,%/a0\n\t"
- ".long 0xf0104c00" /* pmove %/a0@,%/crp */
+ asm __volatile__ (".chip 68030\n\t"
+ "pmove %0,%%crp\n\t"
+ ".chip 68k"
: /* no outputs */
- : "g" (task[0]->tss.crp)
- : "a0");
+ : "m" (task[0]->tss.crp[0]));
#ifdef DEBUG
printk ("set crp\n");
#endif
@@ -398,7 +392,7 @@ unsigned long paging_init(unsigned long start_mem, unsigned long end_mem)
printk ("before free_area_init\n");
#endif
- return free_area_init (start_mem, end_mem);
+ return PAGE_ALIGN(free_area_init (start_mem, end_mem));
}
void mem_init(unsigned long start_mem, unsigned long end_mem)
@@ -410,7 +404,7 @@ void mem_init(unsigned long start_mem, unsigned long end_mem)
end_mem &= PAGE_MASK;
high_memory = (void *) end_mem;
- max_mapnr = MAP_NR(end_mem);
+ max_mapnr = num_physpages = MAP_NR(end_mem);
start_mem = PAGE_ALIGN(start_mem);
while (start_mem < end_mem) {
@@ -460,7 +454,7 @@ void mem_init(unsigned long start_mem, unsigned long end_mem)
datapages++;
continue;
}
- mem_map[MAP_NR(tmp)].count = 1;
+ atomic_set(&mem_map[MAP_NR(tmp)].count, 1);
#ifdef CONFIG_BLK_DEV_INITRD
if (!initrd_start ||
(tmp < (initrd_start & PAGE_MASK) || tmp >= initrd_end))
@@ -474,6 +468,11 @@ void mem_init(unsigned long start_mem, unsigned long end_mem)
datapages << (PAGE_SHIFT-10));
}
+void free_initmem(void)
+{
+ /* To be written */
+}
+
void si_meminfo(struct sysinfo *val)
{
unsigned long i;
@@ -487,9 +486,9 @@ void si_meminfo(struct sysinfo *val)
if (PageReserved(mem_map+i))
continue;
val->totalram++;
- if (!mem_map[i].count)
+ if (!atomic_read(&mem_map[i].count))
continue;
- val->sharedram += mem_map[i].count-1;
+ val->sharedram += atomic_read(&mem_map[i].count) - 1;
}
val->totalram <<= PAGE_SHIFT;
val->sharedram <<= PAGE_SHIFT;