Module: xenomai-forge
Branch: master
Commit: 68849751859836505f3f2eca0e418af4f46aa8ef
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=68849751859836505f3f2eca0e418af4f46aa8ef

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Dec 22 11:08:31 2011 +0100

hal: remove last references to CPU frequency

Now that all architectures implement the sysinfo v2 format including
x86 (ipipe), we may safely remove all references to the CPU frequency,
which used to be a wrong placeholder for the clock frequency inherited
from the x86 dark ages.

We only need to know about the timer and clock devices frequencies,
for timing duties.

---

 include/asm-blackfin/bits/init.h  |    2 +-
 include/asm-generic/hal.h         |   11 -----------
 include/asm-generic/system.h      |    5 -----
 include/asm-sim/system.h          |    5 -----
 include/asm-x86/bits/init_32.h    |    2 +-
 include/asm-x86/bits/init_64.h    |    2 +-
 include/asm-x86/bits/timer.h      |    2 +-
 include/asm-x86/hal_32.h          |    2 --
 include/asm-x86/hal_64.h          |    1 -
 kernel/cobalt/arch/arm/hal.c      |    3 ---
 kernel/cobalt/arch/blackfin/hal.c |    5 +----
 kernel/cobalt/arch/generic/hal.c  |   14 +++++---------
 kernel/cobalt/arch/nios2/hal.c    |    3 ---
 kernel/cobalt/arch/powerpc/hal.c  |    3 ---
 kernel/cobalt/arch/sh/hal.c       |    3 ---
 kernel/cobalt/arch/x86/hal_32.c   |    9 +++------
 kernel/cobalt/arch/x86/hal_64.c   |    7 ++-----
 17 files changed, 15 insertions(+), 64 deletions(-)

diff --git a/include/asm-blackfin/bits/init.h b/include/asm-blackfin/bits/init.h
index 0a641a9..28acbca 100644
--- a/include/asm-blackfin/bits/init.h
+++ b/include/asm-blackfin/bits/init.h
@@ -79,7 +79,7 @@ static inline int xnarch_init(void)
        if (ret)
                return ret;
 
-       xnarch_init_timeconv(RTHAL_CPU_FREQ);
+       xnarch_init_timeconv(RTHAL_CLOCK_FREQ);
 
        ret = xnarch_calibrate_sched();
        if (ret)
diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index 5c68a76..650e6ec 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -43,7 +43,6 @@
 
 struct rthal_archdata {
        struct ipipe_domain domain;
-       unsigned long cpu_freq;
        unsigned long timer_freq;
        unsigned long clock_freq;
        volatile int sync_op;
@@ -65,7 +64,6 @@ struct rthal_archdata {
 
 #define RTHAL_TIMER_FREQ       (rthal_archdata.timer_freq)
 #define RTHAL_CLOCK_FREQ       (rthal_archdata.clock_freq)
-#define RTHAL_CPU_FREQ         (rthal_archdata.cpu_freq)
 
 enum rthal_ktimer_mode { /* <!> Must follow enum clock_event_mode */
        KTIMER_MODE_UNUSED = 0,
@@ -88,13 +86,6 @@ enum rthal_ktimer_mode { /* <!> Must follow enum 
clock_event_mode */
                ipipe_set_printk_sync(ipipe_current_domain);    \
        } while (0)
 
-static inline unsigned long rthal_get_cpufreq(void)
-{
-       struct ipipe_sysinfo sysinfo;
-       ipipe_get_sysinfo(&sysinfo);
-       return (unsigned long)sysinfo.sys_cpu_freq;
-}
-
 static inline unsigned long rthal_get_timerfreq(void)
 {
        struct ipipe_sysinfo sysinfo;
@@ -128,8 +119,6 @@ void rthal_critical_exit(unsigned long flags);
 
 extern struct rthal_archdata rthal_archdata;
 
-extern unsigned long rthal_cpufreq_arg;
-
 extern unsigned long rthal_timerfreq_arg;
 
 extern unsigned long rthal_clockfreq_arg;
diff --git a/include/asm-generic/system.h b/include/asm-generic/system.h
index a3cc199..c9ef307 100644
--- a/include/asm-generic/system.h
+++ b/include/asm-generic/system.h
@@ -225,11 +225,6 @@ unsigned long long xnarch_get_host_time(void);
 
 unsigned long long xnarch_get_cpu_time(void);
 
-static inline unsigned long long xnarch_get_cpu_freq(void)
-{
-       return RTHAL_CPU_FREQ;
-}
-
 static inline unsigned long long xnarch_get_clock_freq(void)
 {
        return RTHAL_CLOCK_FREQ;
diff --git a/include/asm-sim/system.h b/include/asm-sim/system.h
index a80761d..7acf4d9 100644
--- a/include/asm-sim/system.h
+++ b/include/asm-sim/system.h
@@ -438,11 +438,6 @@ static inline unsigned long long xnarch_get_cpu_tsc (void)
     return mvm_get_cpu_time();
 }
 
-static inline unsigned long xnarch_get_cpu_freq (void)
-{
-    return mvm_get_cpu_freq();
-}
-
 static inline void xnarch_begin_panic (void)
 {
 }
diff --git a/include/asm-x86/bits/init_32.h b/include/asm-x86/bits/init_32.h
index 86d82b2..264fe38 100644
--- a/include/asm-x86/bits/init_32.h
+++ b/include/asm-x86/bits/init_32.h
@@ -82,7 +82,7 @@ static inline int xnarch_init(void)
        if (ret)
                return ret;
 
-       xnarch_init_timeconv(RTHAL_CPU_FREQ);
+       xnarch_init_timeconv(RTHAL_CLOCK_FREQ);
 
        ret = xnarch_calibrate_sched();
        if (ret)
diff --git a/include/asm-x86/bits/init_64.h b/include/asm-x86/bits/init_64.h
index 5d6825e..e9f8111 100644
--- a/include/asm-x86/bits/init_64.h
+++ b/include/asm-x86/bits/init_64.h
@@ -81,7 +81,7 @@ static inline int xnarch_init(void)
        if (ret)
                return ret;
 
-       xnarch_init_timeconv(RTHAL_CPU_FREQ);
+       xnarch_init_timeconv(RTHAL_CLOCK_FREQ);
 
        ret = xnarch_calibrate_sched();
        if (ret)
diff --git a/include/asm-x86/bits/timer.h b/include/asm-x86/bits/timer.h
index 1e61bf1..3f67f9f 100644
--- a/include/asm-x86/bits/timer.h
+++ b/include/asm-x86/bits/timer.h
@@ -33,7 +33,7 @@ static inline void xnarch_program_timer_shot(unsigned long 
delay)
         * handler would simply occur after 4 billions ticks.
         */
        rthal_timer_program_shot(rthal_imuldiv_ceil
-                                (delay, RTHAL_TIMER_FREQ, RTHAL_CPU_FREQ));
+                                (delay, RTHAL_TIMER_FREQ, RTHAL_CLOCK_FREQ));
 }
 
 static inline int xnarch_send_timer_ipi(xnarch_cpumask_t mask)
diff --git a/include/asm-x86/hal_32.h b/include/asm-x86/hal_32.h
index 0e8bd0c..ebb2729 100644
--- a/include/asm-x86/hal_32.h
+++ b/include/asm-x86/hal_32.h
@@ -96,8 +96,6 @@ static inline __attribute_const__ unsigned long ffnz(unsigned 
long ul)
 #define RTHAL_HOST_TICK_IRQ    0       /* Host tick is emulated by Xenomai. */
 #endif /* CONFIG_X86_LOCAL_APIC */
 
-#define RTHAL_NMICLK_FREQ      RTHAL_CPU_FREQ
-
 static inline void rthal_grab_control(void)
 {
        rthal_smi_init();
diff --git a/include/asm-x86/hal_64.h b/include/asm-x86/hal_64.h
index ab39cfa..62d7b67 100644
--- a/include/asm-x86/hal_64.h
+++ b/include/asm-x86/hal_64.h
@@ -53,7 +53,6 @@ static inline __attribute_const__ unsigned long ffnz(unsigned 
long ul)
 #define RTHAL_APIC_TIMER_IPI           IPIPE_SERVICE_IPI3
 #define RTHAL_APIC_ICOUNT              ((RTHAL_TIMER_FREQ + HZ/2)/HZ)
 #define RTHAL_TIMER_IRQ                        RTHAL_APIC_TIMER_IPI
-#define RTHAL_NMICLK_FREQ              RTHAL_CPU_FREQ
 #define RTHAL_HOST_TICK_IRQ            
ipipe_apic_vector_irq(LOCAL_TIMER_VECTOR)
 #define RTHAL_BCAST_TICK_IRQ           0
 
diff --git a/kernel/cobalt/arch/arm/hal.c b/kernel/cobalt/arch/arm/hal.c
index 9b82179..02ea56d 100644
--- a/kernel/cobalt/arch/arm/hal.c
+++ b/kernel/cobalt/arch/arm/hal.c
@@ -311,9 +311,6 @@ void __rthal_arm_fault_range(struct vm_area_struct *vma)
 
 int rthal_arch_init(void)
 {
-       if (rthal_cpufreq_arg == 0)
-               rthal_cpufreq_arg = rthal_get_cpufreq();
-
        if (rthal_timerfreq_arg == 0)
                rthal_timerfreq_arg = rthal_get_timerfreq();
 
diff --git a/kernel/cobalt/arch/blackfin/hal.c 
b/kernel/cobalt/arch/blackfin/hal.c
index e247b5c..6626443 100644
--- a/kernel/cobalt/arch/blackfin/hal.c
+++ b/kernel/cobalt/arch/blackfin/hal.c
@@ -208,14 +208,11 @@ EXPORT_SYMBOL_GPL(rthal_timer_notify_switch);
 
 unsigned long rthal_timer_calibrate(void)
 {
-       return (1000000000 / RTHAL_CPU_FREQ) * 100;     /* 100 CPU cycles -- 
FIXME */
+       return (1000000000 / RTHAL_CLOCK_FREQ) * 100;   /* 100 clock cycles -- 
FIXME */
 }
 
 int rthal_arch_init(void)
 {
-       if (rthal_cpufreq_arg == 0)
-               rthal_cpufreq_arg = rthal_get_cpufreq();
-
        if (rthal_clockfreq_arg == 0)
                rthal_clockfreq_arg = rthal_get_clockfreq();
 
diff --git a/kernel/cobalt/arch/generic/hal.c b/kernel/cobalt/arch/generic/hal.c
index b65ef64..c741659 100644
--- a/kernel/cobalt/arch/generic/hal.c
+++ b/kernel/cobalt/arch/generic/hal.c
@@ -47,9 +47,6 @@
 
 MODULE_LICENSE("GPL");
 
-unsigned long rthal_cpufreq_arg;
-module_param_named(cpufreq, rthal_cpufreq_arg, ulong, 0444);
-
 unsigned long rthal_timerfreq_arg;
 module_param_named(timerfreq, rthal_timerfreq_arg, ulong, 0444);
 
@@ -413,12 +410,11 @@ int rthal_init(void)
         * The arch-dependent support must have updated the various
         * frequency args as required.
         */
-       if (rthal_cpufreq_arg == 0) {
-               printk(KERN_ERR "Xenomai has detected a CPU frequency of 0. 
Aborting.\n");
+       if (rthal_clockfreq_arg == 0) {
+               printk(KERN_ERR "Xenomai: null clock frequency? Aborting.\n");
                return -ENODEV;
        }
 
-       rthal_archdata.cpu_freq = rthal_cpufreq_arg;
        rthal_archdata.timer_freq = rthal_timerfreq_arg;
        rthal_archdata.clock_freq = rthal_clockfreq_arg;
 
@@ -428,7 +424,7 @@ int rthal_init(void)
         */
        rthal_archdata.apc_virq = ipipe_alloc_virq();
        if (rthal_archdata.apc_virq == 0) {
-               printk(KERN_ERR "Xenomai: No virtual interrupt available.\n");
+               printk(KERN_ERR "Xenomai: no virtual interrupt available.\n");
                ret = -EBUSY;
                goto out_arch_cleanup;
        }
@@ -438,7 +434,7 @@ int rthal_init(void)
                                   &rthal_apc_handler,
                                   NULL, NULL, IPIPE_HANDLE_MASK);
        if (ret) {
-               printk(KERN_ERR "Xenomai: Failed to virtualize IRQ.\n");
+               printk(KERN_ERR "Xenomai: failed to virtualize IRQ.\n");
                goto out_free_irq;
        }
 
@@ -453,7 +449,7 @@ int rthal_init(void)
                return 0;
        }
 
-       printk(KERN_ERR "Xenomai: Domain registration failed (%d).\n", ret);
+       printk(KERN_ERR "Xenomai: domain registration failed (%d).\n", ret);
        ipipe_virtualize_irq(ipipe_current_domain, rthal_archdata.apc_virq,
                             NULL, NULL, NULL, 0);
 out_free_irq:
diff --git a/kernel/cobalt/arch/nios2/hal.c b/kernel/cobalt/arch/nios2/hal.c
index 41be959..52869c8 100644
--- a/kernel/cobalt/arch/nios2/hal.c
+++ b/kernel/cobalt/arch/nios2/hal.c
@@ -87,9 +87,6 @@ unsigned long rthal_timer_calibrate(void)
 
 int rthal_arch_init(void)
 {
-       if (rthal_cpufreq_arg == 0)
-               rthal_cpufreq_arg = (unsigned long)rthal_get_cpufreq();
-
        if (rthal_timerfreq_arg == 0)
                rthal_timerfreq_arg = (unsigned long)rthal_get_timerfreq();
 
diff --git a/kernel/cobalt/arch/powerpc/hal.c b/kernel/cobalt/arch/powerpc/hal.c
index c144192..3e8ae47 100644
--- a/kernel/cobalt/arch/powerpc/hal.c
+++ b/kernel/cobalt/arch/powerpc/hal.c
@@ -258,9 +258,6 @@ int rthal_arch_init(void)
        }
 #endif /* CONFIG_ALTIVEC */
 
-       if (rthal_cpufreq_arg == 0)
-               rthal_cpufreq_arg = (unsigned long)rthal_get_cpufreq();
-
        if (rthal_timerfreq_arg == 0)
                rthal_timerfreq_arg = (unsigned long)rthal_get_timerfreq();
 
diff --git a/kernel/cobalt/arch/sh/hal.c b/kernel/cobalt/arch/sh/hal.c
index 1f8abf3..884b543 100644
--- a/kernel/cobalt/arch/sh/hal.c
+++ b/kernel/cobalt/arch/sh/hal.c
@@ -125,9 +125,6 @@ unsigned long rthal_timer_calibrate(void)
 
 int rthal_arch_init(void)
 {
-       if (rthal_cpufreq_arg == 0)
-               rthal_cpufreq_arg = (unsigned long)rthal_get_cpufreq();
-
        if (rthal_timerfreq_arg == 0)
                rthal_timerfreq_arg = (unsigned long)rthal_get_timerfreq();
 
diff --git a/kernel/cobalt/arch/x86/hal_32.c b/kernel/cobalt/arch/x86/hal_32.c
index 5edc282..23b2f9f 100644
--- a/kernel/cobalt/arch/x86/hal_32.c
+++ b/kernel/cobalt/arch/x86/hal_32.c
@@ -76,7 +76,7 @@ unsigned long rthal_timer_calibrate(void)
         */
        ipipe_trace_max_reset();
 
-       return rthal_imuldiv(dt, 20, RTHAL_CPU_FREQ);
+       return rthal_imuldiv(dt, 20, RTHAL_CLOCK_FREQ);
 }
 
 #else /* !CONFIG_X86_LOCAL_APIC */
@@ -123,7 +123,7 @@ unsigned long rthal_timer_calibrate(void)
         */
        ipipe_trace_max_reset();
 
-       return rthal_imuldiv(dt, 20, RTHAL_CPU_FREQ);
+       return rthal_imuldiv(dt, 20, RTHAL_CLOCK_FREQ);
 }
 
 static void rthal_timer_set_oneshot(void)
@@ -247,10 +247,7 @@ int rthal_arch_init(void)
        }
 #endif /* CONFIG_X86_LOCAL_APIC */
 
-       if (rthal_cpufreq_arg == 0)
-               /* FIXME: 4Ghz barrier is close... */
-               rthal_cpufreq_arg = rthal_get_cpufreq();
-
+       /* FIXME: 4Ghz barrier is close... */
        if (rthal_clockfreq_arg == 0)
                rthal_clockfreq_arg = rthal_get_clockfreq();
 
diff --git a/kernel/cobalt/arch/x86/hal_64.c b/kernel/cobalt/arch/x86/hal_64.c
index d335231..9270f44 100644
--- a/kernel/cobalt/arch/x86/hal_64.c
+++ b/kernel/cobalt/arch/x86/hal_64.c
@@ -65,15 +65,12 @@ unsigned long rthal_timer_calibrate(void)
         */
        ipipe_trace_max_reset();
 
-       return rthal_imuldiv(dt, 20, RTHAL_CPU_FREQ);
+       return rthal_imuldiv(dt, 20, RTHAL_CLOCK_FREQ);
 }
 
 int rthal_arch_init(void)
 {
-       if (rthal_cpufreq_arg == 0)
-               /* FIXME: 4Ghz barrier is close... */
-               rthal_cpufreq_arg = rthal_get_cpufreq();
-
+       /* FIXME: 4Ghz barrier is close... */
        if (rthal_clockfreq_arg == 0)
                rthal_clockfreq_arg = rthal_get_clockfreq();
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to