patch-2.3.39 linux/arch/ppc/kernel/time.h

Next file: linux/arch/ppc/kernel/traps.c
Previous file: linux/arch/ppc/kernel/time.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.38/linux/arch/ppc/kernel/time.h linux/arch/ppc/kernel/time.h
@@ -6,8 +6,11 @@
  * Paul Mackerras' version and mine for PReP and Pmac.
  */
 
+#include <linux/config.h>
 #include <linux/mc146818rtc.h>
 
+#include <asm/processor.h>
+
 /* time.c */
 extern unsigned decrementer_count;
 extern unsigned count_period_num;
@@ -22,13 +25,18 @@
 /* Accessor functions for the decrementer register. */
 static __inline__ unsigned int get_dec(void)
 {
-	unsigned int ret;
-
-	asm volatile("mfspr %0,22" : "=r" (ret) :);
-	return ret;
+#if defined(CONFIG_4xx)
+	return (mfspr(SPRN_PIT));
+#else
+	return (mfspr(SPRN_DEC));
+#endif
 }
 
 static __inline__ void set_dec(unsigned int val)
 {
-	asm volatile("mtspr 22,%0" : : "r" (val));
+#if defined(CONFIG_4xx)
+	mtspr(SPRN_PIT, val);
+#else
+	mtspr(SPRN_DEC, val);
+#endif
 }

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