patch-2.4.0-test6 linux/arch/mips/sgi/kernel/setup.c

Next file: linux/arch/mips/tools/offset.c
Previous file: linux/arch/mips/sgi/kernel/indy_int.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test5/linux/arch/mips/sgi/kernel/setup.c linux/arch/mips/sgi/kernel/setup.c
@@ -130,9 +130,9 @@
 
 int __init page_is_ram(unsigned long pagenr)
 {
-	if (pagenr < MAP_NR(PAGE_OFFSET + 0x2000UL))
+	if ((pagenr<<PAGE_SHIFT) < 0x2000UL)
 		return 1;
-	if (pagenr > MAP_NR(PAGE_OFFSET + 0x08002000))
+	if ((pagenr<<PAGE_SHIFT) > 0x08002000)
 		return 1;
 	return 0;
 }
@@ -180,7 +180,7 @@
 	 */
         struct sgi_ioc_timers *p;
         volatile unsigned char *tcwp, *tc2p;
-	unsigned long r4k_ticks[3];
+	unsigned long r4k_ticks[3] = { 0, 0, 0 };
 	unsigned long r4k_next;
 
         /* Figure out the r4k offset, the algorithm is very simple
@@ -198,15 +198,16 @@
         tc2p = &p->tcnt2;
 
         printk("Calibrating system timer... ");
-        dosample(tcwp, tc2p);                   /* First sample. */
-        dosample(tcwp, tc2p);                   /* Eat one.     */
-        r4k_ticks[0] = dosample(tcwp, tc2p);      /* Second sample. */
-	dosample(tcwp, tc2p);			/* Eat another. */
-	r4k_ticks[1] += dosample (tcwp, tc2p);	/* Third sample. */
+        dosample(tcwp, tc2p);                   /* Prime cache. */
+        dosample(tcwp, tc2p);                   /* Prime cache. */
+	/* Zero is NOT an option. */
+	while (!r4k_ticks[0])
+		r4k_ticks[0] = dosample (tcwp, tc2p);
+	while (!r4k_ticks[1])
+		r4k_ticks[1] = dosample (tcwp, tc2p);
 
 	if (r4k_ticks[0] != r4k_ticks[1]) {
 		printk ("warning: timer counts differ, retrying...");
-		dosample (tcwp, tc2p);
 		r4k_ticks[2] = dosample (tcwp, tc2p);
 		if (r4k_ticks[2] == r4k_ticks[0] 
 		    || r4k_ticks[2] == r4k_ticks[1])

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