Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[sfrench/cifs-2.6.git] / arch / ppc / mm / init.c
index 99b48abd32969d8cfb485dc87b105bce9482bfb7..386e000bcb737845f17fe9935d54c4292365fddf 100644 (file)
@@ -67,10 +67,6 @@ unsigned long ppc_memoffset = PAGE_OFFSET;
 int mem_init_done;
 int init_bootmem_done;
 int boot_mapsize;
-#ifdef CONFIG_PPC_PMAC
-unsigned long agp_special_page;
-EXPORT_SYMBOL(agp_special_page);
-#endif
 
 extern char _end[];
 extern char etext[], _stext[];
@@ -144,7 +140,7 @@ static void free_sec(unsigned long start, unsigned long end, const char *name)
 
        while (start < end) {
                ClearPageReserved(virt_to_page(start));
-               set_page_count(virt_to_page(start), 1);
+               init_page_count(virt_to_page(start));
                free_page(start);
                cnt++;
                start += PAGE_SIZE;
@@ -176,7 +172,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
 
        for (; start < end; start += PAGE_SIZE) {
                ClearPageReserved(virt_to_page(start));
-               set_page_count(virt_to_page(start), 1);
+               init_page_count(virt_to_page(start));
                free_page(start);
                totalram_pages++;
        }
@@ -416,18 +412,6 @@ void __init mem_init(void)
        }
 #endif /* CONFIG_BLK_DEV_INITRD */
 
-#ifdef CONFIG_PPC_OF
-       /* mark the RTAS pages as reserved */
-       if ( rtas_data )
-               for (addr = (ulong)__va(rtas_data);
-                    addr < PAGE_ALIGN((ulong)__va(rtas_data)+rtas_size) ;
-                    addr += PAGE_SIZE)
-                       SetPageReserved(virt_to_page(addr));
-#endif
-#ifdef CONFIG_PPC_PMAC
-       if (agp_special_page)
-               SetPageReserved(virt_to_page(agp_special_page));
-#endif
        for (addr = PAGE_OFFSET; addr < (unsigned long)high_memory;
             addr += PAGE_SIZE) {
                if (!PageReserved(virt_to_page(addr)))
@@ -449,7 +433,7 @@ void __init mem_init(void)
                        struct page *page = mem_map + pfn;
 
                        ClearPageReserved(page);
-                       set_page_count(page, 1);
+                       init_page_count(page);
                        __free_page(page);
                        totalhigh_pages++;
                }
@@ -463,11 +447,6 @@ void __init mem_init(void)
               initpages<< (PAGE_SHIFT-10),
               (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)));
 
-#ifdef CONFIG_PPC_PMAC
-       if (agp_special_page)
-               printk(KERN_INFO "AGP special page: 0x%08lx\n", agp_special_page);
-#endif
-
        mem_init_done = 1;
 }
 
@@ -507,27 +486,6 @@ set_phys_avail(unsigned long total_memory)
                                  initrd_end - initrd_start, 1);
        }
 #endif /* CONFIG_BLK_DEV_INITRD */
-#ifdef CONFIG_PPC_OF
-       /* remove the RTAS pages from the available memory */
-       if (rtas_data)
-               mem_pieces_remove(&phys_avail, rtas_data, rtas_size, 1);
-#endif
-#ifdef CONFIG_PPC_PMAC
-       /* Because of some uninorth weirdness, we need a page of
-        * memory as high as possible (it must be outside of the
-        * bus address seen as the AGP aperture). It will be used
-        * by the r128 DRM driver
-        *
-        * FIXME: We need to make sure that page doesn't overlap any of the\
-        * above. This could be done by improving mem_pieces_find to be able
-        * to do a backward search from the end of the list.
-        */
-       if (_machine == _MACH_Pmac && find_devices("uni-north-agp")) {
-               agp_special_page = (total_memory - PAGE_SIZE);
-               mem_pieces_remove(&phys_avail, agp_special_page, PAGE_SIZE, 0);
-               agp_special_page = (unsigned long)__va(agp_special_page);
-       }
-#endif /* CONFIG_PPC_PMAC */
 }
 
 /* Mark some memory as reserved by removing it from phys_avail. */
@@ -597,21 +555,20 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
 
        if (pfn_valid(pfn)) {
                struct page *page = pfn_to_page(pfn);
-               if (!PageReserved(page)
-                   && !test_bit(PG_arch_1, &page->flags)) {
-                       if (vma->vm_mm == current->active_mm) {
 #ifdef CONFIG_8xx
-                       /* On 8xx, cache control instructions (particularly 
-                        * "dcbst" from flush_dcache_icache) fault as write 
-                        * operation if there is an unpopulated TLB entry 
-                        * for the address in question. To workaround that, 
-                        * we invalidate the TLB here, thus avoiding dcbst 
-                        * misbehaviour.
-                        */
-                               _tlbie(address);
+               /* On 8xx, the TLB handlers work in 2 stages:
+                * First, a zeroed entry is loaded by TLBMiss handler,
+                * which causes the TLBError handler to be triggered.
+                * That means the zeroed TLB has to be invalidated
+                * whenever a page miss occurs.
+                */
+               _tlbie(address);
 #endif
+               if (!PageReserved(page)
+                   && !test_bit(PG_arch_1, &page->flags)) {
+                       if (vma->vm_mm == current->active_mm)
                                __flush_dcache_icache((void *) address);
-                       else
+                       else
                                flush_dcache_icache_page(page);
                        set_bit(PG_arch_1, &page->flags);
                }