diff options
author | 2000-10-20 15:18:27 +0000 | |
---|---|---|
committer | 2000-10-20 15:18:27 +0000 | |
commit | a59b62e093ee2dc20222d37d76f0dd9c7442d53c (patch) | |
tree | 935f39fbc3820e613449a61b9151b46a3f1520a2 | |
parent | Correct FILES section, since our sendbug(1) uses mktemp(1) for generating (diff) | |
download | wireguard-openbsd-a59b62e093ee2dc20222d37d76f0dd9c7442d53c.tar.xz wireguard-openbsd-a59b62e093ee2dc20222d37d76f0dd9c7442d53c.zip |
Add Mhz to cpu information.
Ok'd deraadt@
-rw-r--r-- | sys/arch/powerpc/powerpc/cpu.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/sys/arch/powerpc/powerpc/cpu.c b/sys/arch/powerpc/powerpc/cpu.c index 30cc387d1c3..f284cd8d199 100644 --- a/sys/arch/powerpc/powerpc/cpu.c +++ b/sys/arch/powerpc/powerpc/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.4 2000/09/14 18:26:43 deraadt Exp $ */ +/* $OpenBSD: cpu.c,v 1.5 2000/10/20 15:18:27 drahn Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -79,6 +79,8 @@ cpuattach(parent, dev, aux) { int cpu, pvr; char name[32]; + int qhandle, phandle; + unsigned int clock_freq = 0; __asm__ ("mfpvr %0" : "=r"(pvr)); cpu = pvr >> 16; @@ -108,7 +110,7 @@ cpuattach(parent, dev, aux) sprintf(cpu_model, "604ev"); break; case 12: - sprintf(cpu_model, "7400"); + sprintf(cpu_model, "7400(G4)"); break; case 20: sprintf(cpu_model, "620"); @@ -118,6 +120,35 @@ cpuattach(parent, dev, aux) break; } sprintf(cpu_model + strlen(cpu_model), " (Revision %x)", pvr & 0xffff); - printf(": %s\n", cpu_model); + printf(": %s", cpu_model); + + /* This should only be executed on openfirmware systems... */ + + 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 (clock_freq != 0) { + /* Openfirmware stores clock in HZ, not Mhz */ + clock_freq /= 1000000; + printf(": %d Mhz", clock_freq); + + } + printf("\n"); + + } |