]> git.karo-electronics.de Git - linux-beck.git/blobdiff - drivers/misc/sgi-gru/gruhandles.c
gru: expicitly set instruction status to active
[linux-beck.git] / drivers / misc / sgi-gru / gruhandles.c
index f1117a7637a21465e338a87f4971946ca836e6cc..66d67d9bc9b6e58861a6e9b9965f16a4335a8c37 100644 (file)
 #ifdef CONFIG_IA64
 #include <asm/processor.h>
 #define GRU_OPERATION_TIMEOUT  (((cycles_t) local_cpu_data->itc_freq)*10)
+#define CLKS2NSEC(c)           ((c) *1000000000 / local_cpu_data->itc_freq)
 #else
 #include <asm/tsc.h>
 #define GRU_OPERATION_TIMEOUT  ((cycles_t) tsc_khz*10*1000)
+#define CLKS2NSEC(c)           ((c) * 1000000 / tsc_khz)
 #endif
 
 /* Extract the status field from a kernel handle */
@@ -39,18 +41,21 @@ struct mcs_op_statistic mcs_op_statistics[mcsop_last];
 
 static void update_mcs_stats(enum mcs_op op, unsigned long clks)
 {
+       unsigned long nsec;
+
+       nsec = CLKS2NSEC(clks);
        atomic_long_inc(&mcs_op_statistics[op].count);
-       atomic_long_add(clks, &mcs_op_statistics[op].total);
-       if (mcs_op_statistics[op].max < clks)
-               mcs_op_statistics[op].max = clks;
+       atomic_long_add(nsec, &mcs_op_statistics[op].total);
+       if (mcs_op_statistics[op].max < nsec)
+               mcs_op_statistics[op].max = nsec;
 }
 
 static void start_instruction(void *h)
 {
        unsigned long *w0 = h;
 
-       wmb();          /* setting CMD bit must be last */
-       *w0 = *w0 | 1;
+       wmb();          /* setting CMD/STATUS bits must be last */
+       *w0 = *w0 | 0x20001;
        gru_flush_cache(h);
 }