also add sched/tsc patch for ar7
[openwrt.git] / openwrt / 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-01-19 15:09:29.000000000 +0100
3 +++ linux.dev/arch/mips/kernel/time.c 2005-11-09 23:10:04.233756250 +0100
4 @@ -151,6 +150,15 @@
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 + return (((__u64) timerhi) << 32) | ((__u64) ((__u32) read_c0_count()));
16 +}
17
18 /*
19 * timeofday services, for syscalls.
20 @@ -761,3 +769,5 @@
21 EXPORT_SYMBOL(to_tm);
22 EXPORT_SYMBOL(rtc_set_time);
23 EXPORT_SYMBOL(rtc_get_time);
24 +EXPORT_SYMBOL(get_htscl);
25 +EXPORT_SYMBOL(get_tscll);
26 diff -urN linux.old/include/asm-mips/timex.h linux.dev/include/asm-mips/timex.h
27 --- linux.old/include/asm-mips/timex.h 2003-08-25 13:44:44.000000000 +0200
28 +++ linux.dev/include/asm-mips/timex.h 2005-11-09 22:15:59.352633250 +0100
29 @@ -31,6 +31,19 @@
30 return read_c0_count();
31 }
32
33 +extern __u32 get_htscl(void);
34 +extern __u64 get_tscll(void);
35 +
36 +#define rdtsc(low, high) \
37 + high = get_htscl(); \
38 + low = read_c0_count();
39 +
40 +#define rdtscl(low) \
41 + low = read_c0_count();
42 +
43 +#define rdtscll(val) \
44 + val = get_tscll();
45 +
46 #define vxtime_lock() do {} while (0)
47 #define vxtime_unlock() do {} while (0)
48
49 diff -urN linux.old/include/net/pkt_sched.h linux.dev/include/net/pkt_sched.h
50 --- linux.old/include/net/pkt_sched.h 2005-11-09 21:25:10.686721000 +0100
51 +++ linux.dev/include/net/pkt_sched.h 2005-11-09 21:54:26.063807750 +0100
52 @@ -5,7 +5,11 @@
53 #define PSCHED_JIFFIES 2
54 #define PSCHED_CPU 3
55
56 +#ifdef __mips__
57 +#define PSCHED_CLOCK_SOURCE PSCHED_CPU
58 +#else
59 #define PSCHED_CLOCK_SOURCE PSCHED_JIFFIES
60 +#endif
61
62 #include <linux/config.h>
63 #include <linux/types.h>
64 @@ -271,7 +275,7 @@
65 #define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz)
66 #define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz)
67
68 -#ifdef CONFIG_X86_TSC
69 +#if defined(CONFIG_X86_TSC) || defined(__mips__)
70
71 #define PSCHED_GET_TIME(stamp) \
72 ({ u64 __cur; \
This page took 0.043402 seconds and 5 git commands to generate.