patch-2.3.34 linux/arch/ppc/mm/init.c

Next file: linux/arch/sparc/ap1000/Makefile
Previous file: linux/arch/ppc/mbxboot/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.33/linux/arch/ppc/mm/init.c linux/arch/ppc/mm/init.c
@@ -324,23 +324,24 @@
 
 void si_meminfo(struct sysinfo *val)
 {
-	int i, c;
+	int i;
 
 	i = max_mapnr;
-	val->totalram = totalram_pages;
+	val->totalram = 0;
+	val->sharedram = 0;
 	val->freeram = nr_free_pages();
 	val->bufferram = atomic_read(&buffermem_pages);
-	val->sharedram = 0;
 	while (i-- > 0)  {
 		if (PageReserved(mem_map+i))
 			continue;
-		c = atomic_read(&mem_map[i].count);
-		if (c > 1)
-			val->sharedram += c - 1;
-	}
-	val->totalhigh = 0;
-	val->freehigh = 0;
-	val->mem_unit = PAGE_SIZE;
+		val->totalram++;
+		if (!atomic_read(&mem_map[i].count))
+			continue;
+		val->sharedram += atomic_read(&mem_map[i].count) - 1;
+	}
+	val->totalram <<= PAGE_SHIFT;
+	val->sharedram <<= PAGE_SHIFT;
+	return;
 }
 
 void *
@@ -498,6 +499,9 @@
 {
 	__clear_user(Hash, Hash_size);
 	_tlbia();
+#ifdef __SMP__
+	smp_send_tlb_invalidate(0);
+#endif	
 }
 
 /*
@@ -511,6 +515,9 @@
 	mm->context = NO_CONTEXT;
 	if (mm == current->mm)
 		activate_mm(mm, mm);
+#ifdef __SMP__
+	smp_send_tlb_invalidate(0);
+#endif	
 }
 
 void
@@ -520,6 +527,9 @@
 		flush_hash_page(vma->vm_mm->context, vmaddr);
 	else
 		flush_hash_page(0, vmaddr);
+#ifdef __SMP__
+	smp_send_tlb_invalidate(0);
+#endif	
 }
 
 
@@ -545,6 +555,9 @@
 	{
 		flush_hash_page(mm->context, start);
 	}
+#ifdef __SMP__
+	smp_send_tlb_invalidate(0);
+#endif	
 }
 
 /*
@@ -566,6 +579,9 @@
 	}
 	read_unlock(&tasklist_lock);
 	flush_hash_segments(0x10, 0xffffff);
+#ifdef __SMP__
+	smp_send_tlb_invalidate(0);
+#endif	
 	atomic_set(&next_mmu_context, 0);
 	/* make sure current always has a context */
 	current->mm->context = MUNGE_CONTEXT(atomic_inc_return(&next_mmu_context));
@@ -715,7 +731,7 @@
 				f |= _PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE;
 #ifndef CONFIG_8xx
 			else
-				/* On the powerpc, denying user access
+				/* On the powerpc (not 8xx), no user access
 				   forces R/W kernel access */
 				f |= _PAGE_USER;
 #endif /* CONFIG_8xx */
@@ -874,7 +890,7 @@
 		setbat(3, 0x90000000, 0x90000000, 0x10000000, IO_PAGE);
 		break;
 	case _MACH_Pmac:
-#if 1
+#if 0
 		{
 			unsigned long base = 0xf3000000;
 			struct device_node *macio = find_devices("mac-io");
@@ -967,7 +983,6 @@
 
 	/* remove the bootmem bitmap from the available memory */
 	mem_pieces_remove(&phys_avail, start, boot_mapsize, 1);
-
 	/* add everything in phys_avail into the bootmem map */
 	for (i = 0; i < phys_avail.n_regions; ++i)
 		free_bootmem(phys_avail.regions[i].address,
@@ -1053,9 +1068,9 @@
 	int codepages = 0;
 	int datapages = 0;
 	int initpages = 0;
-#if defined(CONFIG_CHRP) || defined(CONFIG_PMAC) || defined(CONFIG_ALL_PPC)
+#if defined(CONFIG_CHRP) || defined(CONFIG_ALL_PPC)	
 	extern unsigned int rtas_data, rtas_size;
-#endif /* CONFIG_CHRP || CONFIG_PMAC || CONFIG_ALL_PPC */
+#endif /* defined(CONFIG_CHRP) || defined(CONFIG_ALL_PPC) */
 	max_mapnr = max_low_pfn;
 	high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
 	num_physpages = max_mapnr;	/* RAM is assumed contiguous */
@@ -1071,13 +1086,13 @@
 	}
 #endif /* CONFIG_BLK_DEV_INITRD */
 
-#if defined(CONFIG_CHRP) || defined(CONFIG_PMAC) || defined(CONFIG_ALL_PPC)
+#if defined(CONFIG_CHRP) || defined(CONFIG_ALL_PPC)	
 	/* mark the RTAS pages as reserved */
 	if ( rtas_data )
 		for (addr = rtas_data; addr < PAGE_ALIGN(rtas_data+rtas_size) ;
 		     addr += PAGE_SIZE)
 			SetPageReserved(mem_map + MAP_NR(addr));
-#endif /* CONFIG_CHRP || CONFIG_PMAC || CONFIG_ALL_PPC */
+#endif /* defined(CONFIG_CHRP) || defined(CONFIG_ALL_PPC) */
 	
 	for (addr = PAGE_OFFSET; addr < (unsigned long)end_of_DRAM;
 	     addr += PAGE_SIZE) {
@@ -1088,12 +1103,12 @@
 		else if (addr >= (unsigned long)&__init_begin
 			 && addr < (unsigned long)&__init_end)
 			initpages++;
-		else
+		else if (addr < (ulong) klimit)
 			datapages++;
 	}
 
         printk("Memory: %luk available (%dk kernel code, %dk data, %dk init) [%08x,%08lx]\n",
-	       (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
+	       (unsigned long) nr_free_pages << (PAGE_SHIFT-10),
 	       codepages << (PAGE_SHIFT-10),
 	       datapages << (PAGE_SHIFT-10), 
 	       initpages << (PAGE_SHIFT-10),

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