patch-2.1.120 linux/arch/m68k/mm/memory.c

Next file: linux/drivers/block/ide-pmac.c
Previous file: linux/arch/m68k/mm/kmap.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.119/linux/arch/m68k/mm/memory.c linux/arch/m68k/mm/memory.c
@@ -17,6 +17,7 @@
 #include <asm/pgtable.h>
 #include <asm/system.h>
 #include <asm/traps.h>
+#include <asm/io.h>
 #ifdef CONFIG_AMIGA
 #include <asm/amigahw.h>
 #endif
@@ -299,14 +300,14 @@
     return( (vaddr & mask) == (base & mask) );
 }
 
-static unsigned long mm_vtop_fallback (unsigned long);
-
+#ifndef CONFIG_SINGLE_MEMORY_CHUNK
 /*
  * The following two routines map from a physical address to a kernel
  * virtual address and vice versa.
  */
 unsigned long mm_vtop (unsigned long vaddr)
 {
+#ifndef CONFIG_SINGLE_MEMORY_CHUNK
 	int i=0;
 	unsigned long voff = vaddr;
 	unsigned long offset = 0;
@@ -322,12 +323,18 @@
 			offset += m68k_memory[i].size;
 		i++;
 	}while (i < m68k_num_memory);
+#else
+	if (vaddr < m68k_memory[0].size)
+		return m68k_memory[0].addr + vaddr;
+#endif
+
 	return mm_vtop_fallback(vaddr);
 }
+#endif
 
 /* Separate function to make the common case faster (needs to save less
    registers) */
-static unsigned long mm_vtop_fallback (unsigned long vaddr)
+unsigned long mm_vtop_fallback (unsigned long vaddr)
 {
 	/* not in one of the memory chunks; test for applying transparent
 	 * translation */
@@ -420,7 +427,7 @@
 	  if (mmusr & (MMU_I|MMU_B|MMU_L))
 	    panic ("VTOP030: bad virtual address %08lx (%x)", vaddr, mmusr);
 
-	  descaddr = (unsigned long *)PTOV(descaddr);
+	  descaddr = phys_to_virt((unsigned long)descaddr);
 
 	  switch (mmusr & MMU_NUM) {
 	  case 1:
@@ -438,8 +445,10 @@
 	panic ("VTOP: bad virtual address %08lx", vaddr);
 }
 
+#ifndef CONFIG_SINGLE_MEMORY_CHUNK
 unsigned long mm_ptov (unsigned long paddr)
 {
+#ifndef CONFIG_SINGLE_MEMORY_CHUNK
 	int i = 0;
 	unsigned long offset = 0;
 
@@ -456,6 +465,11 @@
 			offset += m68k_memory[i].size;
 		i++;
 	}while (i < m68k_num_memory);
+#else
+	unsigned long base = m68k_memory[0].addr;
+	if (paddr >= base && paddr < (base + m68k_memory[0].size))
+		return (paddr - base);
+#endif
 
 	/*
 	 * assume that the kernel virtual address is the same as the
@@ -482,6 +496,7 @@
 #endif
 	return paddr;
 }
+#endif
 
 /* invalidate page in both caches */
 #define	clear040(paddr)					\
@@ -635,6 +650,7 @@
 #undef pushcl040
 #undef pushcli040
 
+#ifndef CONFIG_SINGLE_MEMORY_CHUNK
 int mm_end_of_chunk (unsigned long addr, int len)
 {
 	int i;
@@ -644,4 +660,4 @@
 			return 1;
 	return 0;
 }
-
+#endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov