X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fm68k%2Fmm%2Fmemory.c;h=d6d582a5abb001b49114a05a71e6204a37a9f39e;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=4af152355322367787ead67b34a5441f9fc84e8d;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/arch/m68k/mm/memory.c b/arch/m68k/mm/memory.c index 4af152355..d6d582a5a 100644 --- a/arch/m68k/mm/memory.c +++ b/arch/m68k/mm/memory.c @@ -54,7 +54,7 @@ void __init init_pointer_table(unsigned long ptable) /* unreserve the page so it's possible to free that page */ PD_PAGE(dp)->flags &= ~(1 << PG_reserved); - atomic_set(&PD_PAGE(dp)->count, 1); + init_page_count(PD_PAGE(dp)); return; } @@ -77,7 +77,7 @@ pmd_t *get_pointer_table (void) ptable_desc *new; if (!(page = (void *)get_zeroed_page(GFP_KERNEL))) - return 0; + return NULL; flush_tlb_kernel_page(page); nocache_page(page); @@ -129,7 +129,7 @@ int free_pointer_table (pmd_t *ptable) return 0; } -#if DEBUG_INVALID_PTOV +#ifdef DEBUG_INVALID_PTOV int mm_inv_cnt = 5; #endif @@ -179,7 +179,7 @@ unsigned long mm_ptov (unsigned long paddr) voff += m68k_memory[i].size; } while (++i < m68k_num_memory); -#if DEBUG_INVALID_PTOV +#ifdef DEBUG_INVALID_PTOV if (mm_inv_cnt > 0) { mm_inv_cnt--; printk("Invalid use of phys_to_virt(0x%lx) at 0x%p!\n", @@ -298,7 +298,7 @@ void cache_clear (unsigned long paddr, int len) : "d0"); #ifdef CONFIG_M68K_L2_CACHE if(mach_l2_flush) - mach_l2_flush(0); + mach_l2_flush(0); #endif } @@ -350,114 +350,10 @@ void cache_push (unsigned long paddr, int len) : "d0"); #ifdef CONFIG_M68K_L2_CACHE if(mach_l2_flush) - mach_l2_flush(1); + mach_l2_flush(1); #endif } -static unsigned long virt_to_phys_slow(unsigned long vaddr) -{ - if (CPU_IS_060) { - mm_segment_t fs = get_fs(); - unsigned long paddr; - - set_fs(get_ds()); - - /* The PLPAR instruction causes an access error if the translation - * is not possible. To catch this we use the same exception mechanism - * as for user space accesses in . */ - asm volatile (".chip 68060\n" - "1: plpar (%0)\n" - ".chip 68k\n" - "2:\n" - ".section .fixup,\"ax\"\n" - " .even\n" - "3: sub.l %0,%0\n" - " jra 2b\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .align 4\n" - " .long 1b,3b\n" - ".previous" - : "=a" (paddr) - : "0" (vaddr)); - set_fs(fs); - return paddr; - } else if (CPU_IS_040) { - mm_segment_t fs = get_fs(); - unsigned long mmusr; - - set_fs(get_ds()); - - asm volatile (".chip 68040\n\t" - "ptestr (%1)\n\t" - "movec %%mmusr, %0\n\t" - ".chip 68k" - : "=r" (mmusr) - : "a" (vaddr)); - set_fs(fs); - - if (mmusr & MMU_R_040) - return (mmusr & PAGE_MASK) | (vaddr & ~PAGE_MASK); - } else { - unsigned short mmusr; - unsigned long *descaddr; - - asm volatile ("ptestr #5,%2@,#7,%0\n\t" - "pmove %%psr,%1@" - : "=a&" (descaddr) - : "a" (&mmusr), "a" (vaddr)); - if (mmusr & (MMU_I|MMU_B|MMU_L)) - return 0; - descaddr = phys_to_virt((unsigned long)descaddr); - switch (mmusr & MMU_NUM) { - case 1: - return (*descaddr & 0xfe000000) | (vaddr & 0x01ffffff); - case 2: - return (*descaddr & 0xfffc0000) | (vaddr & 0x0003ffff); - case 3: - return (*descaddr & PAGE_MASK) | (vaddr & ~PAGE_MASK); - } - } - return 0; -} - -/* Push n pages at kernel virtual address and clear the icache */ -/* RZ: use cpush %bc instead of cpush %dc, cinv %ic */ -void flush_icache_range(unsigned long address, unsigned long endaddr) -{ - if (CPU_IS_040_OR_060) { - address &= PAGE_MASK; - - if (address >= PAGE_OFFSET && address < (unsigned long)high_memory) { - do { - asm volatile ("nop\n\t" - ".chip 68040\n\t" - "cpushp %%bc,(%0)\n\t" - ".chip 68k" - : : "a" (virt_to_phys((void *)address))); - address += PAGE_SIZE; - } while (address < endaddr); - } else { - do { - asm volatile ("nop\n\t" - ".chip 68040\n\t" - "cpushp %%bc,(%0)\n\t" - ".chip 68k" - : : "a" (virt_to_phys_slow(address))); - address += PAGE_SIZE; - } while (address < endaddr); - } - } else { - unsigned long tmp; - asm volatile ("movec %%cacr,%0\n\t" - "orw %1,%0\n\t" - "movec %0,%%cacr" - : "=&d" (tmp) - : "di" (FLUSH_I)); - } -} - - #ifndef CONFIG_SINGLE_MEMORY_CHUNK int mm_end_of_chunk (unsigned long addr, int len) {