NetBSD Problem Report #13803
Received: (qmail 27736 invoked from network); 28 Aug 2001 01:47:50 -0000
Message-Id: <200108280152.f7S1qdh26542@atom.nagoya.ydc.co.jp>
Date: Tue, 28 Aug 2001 10:52:39 +0900 (JST)
From: hamajima@nagoya.ydc.co.jp
Reply-To: hamajima@nagoya.ydc.co.jp
To: gnats-bugs@gnats.netbsd.org
Subject: print cpu clock frequency on powerpc
X-Send-Pr-Version: 3.95
>Number: 13803
>Category: port-powerpc
>Synopsis: print cpu clock frequency on powerpc
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: port-powerpc-maintainer
>State: closed
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Tue Aug 28 01:48:01 +0000 2001
>Closed-Date: Thu Mar 25 04:04:21 +0000 2004
>Last-Modified: Thu Mar 25 04:04:21 +0000 2004
>Originator: Katsuomi Hamajima
>Release: NetBSD 1.5X
>Organization:
>Environment:
sys/arch/powerpc/mpc6xx/cpu_subr.c:1.1
System: NetBSD ppc 1.5X NetBSD 1.5X (8500) #39: Mon Aug 27 21:34:49 JST 2001 hamajima@ppc:/usr/src/sys/arch/macppc/compile/8500 macppc
>Description:
Print cpu clock frequency in boot time.
This code copied from sys/arch/powerpc/powerpc/cpu.c of OpenBSD.
>How-To-Repeat:
>Fix:
one part of dmesg
cpu0 at mainbus0: 750 195MHz (Revision 201), ID 0 (primary)
--- cpu_subr.c.orig Sun Aug 26 11:47:39 2001
+++ cpu_subr.c Mon Aug 27 21:31:41 2001
@@ -43,6 +43,7 @@
#include <uvm/uvm_extern.h>
#include <powerpc/mpc6xx/hid.h>
#include <powerpc/spr.h>
+#include <dev/ofw/openfirm.h>
static void cpu_config_l2cr(int);
@@ -239,6 +240,9 @@
{
u_int pvr, vers, rev;
const struct cputab *cp;
+ char name[32];
+ int qhandle, phandle;
+ unsigned int clock_freq = 0;
asm ("mfpvr %0" : "=r"(pvr));
vers = pvr >> 16;
@@ -250,6 +254,23 @@
cp++;
}
+ for (qhandle = OF_peer(0); qhandle; qhandle = phandle) {
+ if (OF_getprop(qhandle, "device_type", name, sizeof name) >= 0
+ && !strcmp(name, "cpu")
+ && OF_getprop(qhandle, "clock-frequency",
+ &clock_freq , sizeof clock_freq ) >= 0)
+ {
+ break;
+ }
+ if ((phandle = OF_child(qhandle)))
+ continue;
+ while (qhandle) {
+ if ((phandle = OF_peer(qhandle)))
+ break;
+ qhandle = OF_parent(qhandle);
+ }
+ }
+
if (str == NULL) {
str = cpu_model;
len = sizeof(cpu_model);
@@ -257,7 +278,11 @@
}
if (cp->name != NULL) {
- snprintf(str, len, "%s (Revision %x)", cp->name, rev);
+ if (clock_freq != 0)
+ snprintf(str, len, "%s %dMHz (Revision %x)",
+ cp->name, clock_freq/1000000, rev);
+ else
+ snprintf(str, len, "%s (Revision %x)", cp->name, rev);
} else {
snprintf(str, len, "Version %x (Revision %x)", vers, rev);
}
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: matt
State-Changed-When: Thu Mar 25 04:03:23 UTC 2004
State-Changed-Why:
The suggestion to print the cpu clock frequency has added
but using a different technique.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.