patch-2.2.18 linux/arch/m68k/mm/kmap.c

Next file: linux/arch/m68k/mvme147/config.c
Previous file: linux/arch/m68k/mm/init.c
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/arch/m68k/mm/kmap.c linux/arch/m68k/mm/kmap.c
@@ -25,6 +25,7 @@
 #undef DEBUG
 
 #define PTRTREESIZE	(256*1024)
+#define ROOTTREESIZE (32*1024*1024)
 
 /*
  * For 040/060 we can use the virtual memory area like other architectures,
@@ -189,7 +190,20 @@
 			printk ("\npa=%#lx va=%#lx ", physaddr, virtaddr);
 #endif
 		pgd_dir = pgd_offset_k(virtaddr);
-		pmd_dir = pmd_alloc_kernel(pgd_dir, virtaddr);
+		if (CPU_IS_020_OR_030) {
+			if (!(virtaddr & (ROOTTREESIZE-1)) &&
+			    size >= ROOTTREESIZE) {
+				pgd_val(*pgd_dir) = physaddr;
+				size -= ROOTTREESIZE;
+				virtaddr += ROOTTREESIZE;
+				physaddr += ROOTTREESIZE;
+				continue;
+			}
+		}
+		if (!pgd_present(*pgd_dir))
+			pmd_dir = pmd_alloc_kernel(pgd_dir, virtaddr);
+		else
+			pmd_dir = pmd_offset(pgd_dir, virtaddr);
 		if (!pmd_dir) {
 			printk("ioremap: no mem for pmd_dir\n");
 			return NULL;
@@ -201,7 +215,10 @@
 			virtaddr += PTRTREESIZE;
 			size -= PTRTREESIZE;
 		} else {
-			pte_dir = pte_alloc_kernel(pmd_dir, virtaddr);
+			if (!pmd_present(*pmd_dir))
+				pte_dir = pte_alloc_kernel(pmd_dir, virtaddr);
+			else
+				pte_dir = pte_offset(pmd_dir, virtaddr);
 			if (!pte_dir) {
 				printk("ioremap: no mem for pte_dir\n");
 				return NULL;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)