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