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