patch-2.3.48 linux/include/asm-mips/param.h

Next file: linux/include/asm-mips/parport.h
Previous file: linux/include/asm-mips/page.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.47/linux/include/asm-mips/param.h linux/include/asm-mips/param.h
@@ -2,7 +2,35 @@
 #define __ASM_MIPS_PARAM_H
 
 #ifndef HZ
-#define HZ 100
+
+#include <linux/config.h>
+
+#ifdef CONFIG_DECSTATION
+   /*
+    * log2(HZ), change this here if you want another
+    * HZ value. This is also used in dec_time_init.
+    * Minimum is 1, Maximum is 15.
+    */
+#  define LOG_2_HZ 7
+#  define HZ (1 << LOG_2_HZ)
+   /*
+    * Ye olde division-by-multiplication trick.
+    *
+    * This works only if 100 / HZ <= 1
+    */
+#  define QUOTIENT ((1UL << (32 - LOG_2_HZ)) * 100)
+#  define HZ_TO_STD(a)                            \
+   ({ int __res;                                  \
+        __asm__(                                  \
+           "multu\t%0,%2\n\t"			  \
+           "mfhi\t%0"				  \
+        : "=r" (__res): "0" (a), "r" (QUOTIENT)); \
+        __res;})
+#else
+#  define HZ 100
+#  define HZ_TO_STD(a) (a)
+#endif
+
 #endif
 
 #define EXEC_PAGESIZE	4096

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