Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc Keep track of the CPU's current speed (in k...



details:   https://anonhg.NetBSD.org/src/rev/45ccab092c0e
branches:  trunk
changeset: 573617:45ccab092c0e
user:      briggs <briggs%NetBSD.org@localhost>
date:      Thu Feb 03 14:47:09 2005 +0000

description:
Keep track of the CPU's current speed (in kHz) in the cpu info structure,
if we can get it.  May want to expand this in the future to include min
and max speeds for systems where we can adjust the speed.

diffstat:

 sys/arch/powerpc/include/cpu.h  |   3 ++-
 sys/arch/powerpc/oea/cpu_subr.c |  16 ++++++++++------
 2 files changed, 12 insertions(+), 7 deletions(-)

diffs (82 lines):

diff -r cf9d36de4561 -r 45ccab092c0e sys/arch/powerpc/include/cpu.h
--- a/sys/arch/powerpc/include/cpu.h    Thu Feb 03 04:39:32 2005 +0000
+++ b/sys/arch/powerpc/include/cpu.h    Thu Feb 03 14:47:09 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.43 2005/01/19 22:22:56 matt Exp $    */
+/*     $NetBSD: cpu.h,v 1.44 2005/02/03 14:47:09 briggs Exp $  */
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -94,6 +94,7 @@
        struct cache_info ci_ci;                
        void *ci_sysmon_cookie;
        void (*ci_idlespin)(void);
+       uint32_t ci_khz;
        struct evcnt ci_ev_clock;       /* clock intrs */
        struct evcnt ci_ev_softclock;   /* softclock intrs */
        struct evcnt ci_ev_softnet;     /* softnet intrs */
diff -r cf9d36de4561 -r 45ccab092c0e sys/arch/powerpc/oea/cpu_subr.c
--- a/sys/arch/powerpc/oea/cpu_subr.c   Thu Feb 03 04:39:32 2005 +0000
+++ b/sys/arch/powerpc/oea/cpu_subr.c   Thu Feb 03 14:47:09 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu_subr.c,v 1.22 2005/01/21 00:58:34 matt Exp $       */
+/*     $NetBSD: cpu_subr.c,v 1.23 2005/02/03 14:47:09 briggs Exp $     */
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.22 2005/01/21 00:58:34 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.23 2005/02/03 14:47:09 briggs Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_multiprocessor.h"
@@ -58,7 +58,7 @@
 static void cpu_enable_l3cr(register_t);
 static void cpu_config_l2cr(int);
 static void cpu_config_l3cr(int);
-static void cpu_print_speed(void);
+static void cpu_probe_speed(struct cpu_info *);
 static void cpu_idlespin(void);
 #if NSYSMON_ENVSYS > 0
 static void cpu_tau_setup(struct cpu_info *);
@@ -479,6 +479,8 @@
        bitmask_snprintf(hid0, bitmask, hidbuf, sizeof hidbuf);
        aprint_normal("%s: HID0 %s\n", self->dv_xname, hidbuf);
 
+       ci->ci_khz = 0;
+
        /*
         * Display speed and cache configuration.
         */
@@ -496,7 +498,9 @@
        case MPC7455:
        case MPC7457:
                aprint_normal("%s: ", self->dv_xname);
-               cpu_print_speed();
+               cpu_probe_speed(ci);
+               aprint_normal("%u.%02u MHz",
+                             ci->ci_khz / 1000, (ci->ci_khz / 10) % 100);
 
                if (vers == IBM750FX || vers == MPC750 ||
                    vers == MPC7400  || vers == MPC7410 || MPC745X_P(vers)) {
@@ -822,7 +826,7 @@
 }
 
 void
-cpu_print_speed(void)
+cpu_probe_speed(struct cpu_info *ci)
 {
        uint64_t cps;
 
@@ -834,7 +838,7 @@
 
        mtspr(SPR_MMCR0, MMCR0_FC);
 
-       aprint_normal("%lld.%02lld MHz", cps / 1000000, (cps / 10000) % 100);
+       ci->ci_khz = cps / 1000;
 }
 
 #if NSYSMON_ENVSYS > 0



Home | Main Index | Thread Index | Old Index