diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2004-01-15 05:19:47 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2004-01-15 05:19:47 +0000 |
commit | 4a5ea36e8aa1bbbdf65907ca2106ec619ccb1b15 (patch) | |
tree | fbdbd06c8b4d264f5be831f41b910c76572f8e59 | |
parent | 95bd5daab35f20a34b1500468a7ade3f0afb0a2f (diff) |
Add 'sysctl hw.cpuspeed' support. copied from macppc.
-rw-r--r-- | sys/arch/pegasos/pegasos/cpu.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/arch/pegasos/pegasos/cpu.c b/sys/arch/pegasos/pegasos/cpu.c index e2cc9ca161e..7b3f31f726d 100644 --- a/sys/arch/pegasos/pegasos/cpu.c +++ b/sys/arch/pegasos/pegasos/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.1 2003/10/31 03:54:33 drahn Exp $ */ +/* $OpenBSD: cpu.c,v 1.2 2004/01/15 05:19:46 drahn Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -99,6 +99,17 @@ cpumatch(parent, cfdata, aux) return (1); } +extern int (*cpu_cpuspeed)(void *, size_t *, void *, size_t); +static u_int32_t ppc_curfreq; + + +int +ppc_cpuspeed(void *oldp, size_t *oldlenp, void *newp, size_t newlen) +{ + return (sysctl_rdint(oldp, oldlenp, newp, ppc_curfreq)); +} + + void cpuattach(struct device *parent, struct device *dev, void *aux) { @@ -181,7 +192,8 @@ cpuattach(struct device *parent, struct device *dev, void *aux) /* Openfirmware stores clock in Hz, not MHz */ clock_freq /= 1000000; printf(": %d MHz", clock_freq); - + ppc_curfreq = clock_freq; + cpu_cpuspeed = ppc_cpuspeed; } /* power savings mode */ hid0 = ppc_mfhid0(); |