5b64310738e8138468be7593fa16fa256b89c387
[openwrt.git] / target / linux / linux-2.4 / patches / ar7 / 006-sched_use_tsc.patch
1 diff -urN linux.old/arch/mips/kernel/time.c linux.dev/arch/mips/kernel/time.c
2 --- linux.old/arch/mips/kernel/time.c 2005-11-14 11:06:38.661262000 +0100
3 +++ linux.dev/arch/mips/kernel/time.c 2005-11-15 20:02:50.059676750 +0100
4 @@ -151,6 +151,27 @@
5 unsigned int (*mips_hpt_read)(void);
6 void (*mips_hpt_init)(unsigned int);
7
8 +extern __u32 get_htscl(void)
9 +{
10 + return timerhi;
11 +}
12 +
13 +static __u64 tscll_last = 0;
14 +
15 +extern __u64 get_tscll(void)
16 +{
17 + __u64 h = (__u64) timerhi;
18 + __u32 c = read_c0_count();
19 +
20 + h <<= 32;
21 + h += c;
22 +
23 + while (h < tscll_last)
24 + h += (((__u64) 1) << 32);
25 +
26 + tscll_last = h;
27 + return h;
28 +}
29
30 /*
31 * timeofday services, for syscalls.
32 @@ -761,3 +782,5 @@
33 EXPORT_SYMBOL(to_tm);
34 EXPORT_SYMBOL(rtc_set_time);
35 EXPORT_SYMBOL(rtc_get_time);
36 +EXPORT_SYMBOL(get_htscl);
37 +EXPORT_SYMBOL(get_tscll);
38 diff -urN linux.old/include/asm-mips/timex.h linux.dev/include/asm-mips/timex.h
39 --- linux.old/include/asm-mips/timex.h 2005-11-14 11:06:38.685263500 +0100
40 +++ linux.dev/include/asm-mips/timex.h 2005-11-14 11:02:21.069163500 +0100
41 @@ -31,6 +31,19 @@
42 return read_c0_count();
43 }
44
45 +extern __u32 get_htscl(void);
46 +extern __u64 get_tscll(void);
47 +
48 +#define rdtsc(low, high) \
49 + high = get_htscl(); \
50 + low = read_c0_count();
51 +
52 +#define rdtscl(low) \
53 + low = read_c0_count();
54 +
55 +#define rdtscll(val) \
56 + val = get_tscll();
57 +
58 #define vxtime_lock() do {} while (0)
59 #define vxtime_unlock() do {} while (0)
60
61 diff -urN linux.old/include/net/pkt_sched.h linux.dev/include/net/pkt_sched.h
62 --- linux.old/include/net/pkt_sched.h 2005-11-14 11:06:38.709265000 +0100
63 +++ linux.dev/include/net/pkt_sched.h 2005-11-14 11:02:21.069163500 +0100
64 @@ -5,7 +5,11 @@
65 #define PSCHED_JIFFIES 2
66 #define PSCHED_CPU 3
67
68 +#ifdef __mips__
69 +#define PSCHED_CLOCK_SOURCE PSCHED_CPU
70 +#else
71 #define PSCHED_CLOCK_SOURCE PSCHED_JIFFIES
72 +#endif
73
74 #include <linux/config.h>
75 #include <linux/types.h>
76 @@ -271,7 +275,7 @@
77 #define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz)
78 #define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz)
79
80 -#ifdef CONFIG_X86_TSC
81 +#if defined(CONFIG_X86_TSC) || defined(__mips__)
82
83 #define PSCHED_GET_TIME(stamp) \
84 ({ u64 __cur; \
This page took 0.04117 seconds and 3 git commands to generate.