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

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

diff -u --recursive --new-file v2.2.7/linux/arch/m68k/mm/kmap.c linux/arch/m68k/mm/kmap.c
@@ -116,6 +116,14 @@
 	if (!size || size > physaddr + size)
 		return NULL;
 
+#ifdef CONFIG_AMIGA
+	if (MACH_IS_AMIGA) {
+		if ((physaddr >= 0x40000000) && (physaddr + size < 0x60000000)
+		    && (cacheflag == IOMAP_NOCACHE_SER))
+			return (void *)physaddr;
+	}
+#endif
+
 #ifdef DEBUG
 	printk("ioremap: 0x%lx,0x%lx(%d) - ", physaddr, size, cacheflag);
 #endif
@@ -174,7 +182,7 @@
 		}
 	}
 
-	while (size > 0) {
+	while ((long)size > 0) {
 #ifdef DEBUG
 		if (!(virtaddr & (PTRTREESIZE-1)))
 			printk ("\npa=%#lx va=%#lx ", physaddr, virtaddr);
@@ -187,7 +195,7 @@
 		}
 
 		if (CPU_IS_020_OR_030) {
-			pmd_dir->pmd[(virtaddr/PTRTREESIZE)&-16] = physaddr;
+			pmd_dir->pmd[(virtaddr/PTRTREESIZE) & 15] = physaddr;
 			physaddr += PTRTREESIZE;
 			virtaddr += PTRTREESIZE;
 			size -= PTRTREESIZE;
@@ -217,7 +225,14 @@
  */
 void iounmap(void *addr)
 {
+#ifdef CONFIG_AMIGA
+	if ((!MACH_IS_AMIGA) ||
+	    (((unsigned long)addr < 0x40000000) ||
+	     ((unsigned long)addr > 0x60000000)))
+			free_io_area(addr);
+#else
 	free_io_area(addr);
+#endif
 }
 
 /*
@@ -232,7 +247,7 @@
 	pmd_t *pmd_dir;
 	pte_t *pte_dir;
 
-	while (size > 0) {
+	while ((long)size > 0) {
 		pgd_dir = pgd_offset_k(virtaddr);
 		if (pgd_bad(*pgd_dir)) {
 			printk("iounmap: bad pgd(%08lx)\n", pgd_val(*pgd_dir));
@@ -242,7 +257,7 @@
 		pmd_dir = pmd_offset(pgd_dir, virtaddr);
 
 		if (CPU_IS_020_OR_030) {
-			int pmd_off = (virtaddr/PTRTREESIZE) & -16;
+			int pmd_off = (virtaddr/PTRTREESIZE) & 15;
 
 			if ((pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK) == _PAGE_PRESENT) {
 				pmd_dir->pmd[pmd_off] = 0;
@@ -308,7 +323,7 @@
 		}
 	}
 
-	while (size > 0) {
+	while ((long)size > 0) {
 		pgd_dir = pgd_offset_k(virtaddr);
 		if (pgd_bad(*pgd_dir)) {
 			printk("iocachemode: bad pgd(%08lx)\n", pgd_val(*pgd_dir));
@@ -318,7 +333,7 @@
 		pmd_dir = pmd_offset(pgd_dir, virtaddr);
 
 		if (CPU_IS_020_OR_030) {
-			int pmd_off = (virtaddr/PTRTREESIZE) & -16;
+			int pmd_off = (virtaddr/PTRTREESIZE) & 15;
 
 			if ((pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK) == _PAGE_PRESENT) {
 				pmd_dir->pmd[pmd_off] = (pmd_dir->pmd[pmd_off] &

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