diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2003-12-24 00:25:43 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2003-12-24 00:25:43 +0000 |
commit | 15ce1d8b703048fc51e07e1c03f05be3d023630f (patch) | |
tree | aaed9bc939117bb229dd7dfd0b12c1629b8057b2 | |
parent | 845c86507975f46ffc453ac1a787634c2cf7f298 (diff) |
support cpu_cpuspeed on macppc.
-rw-r--r-- | sys/arch/macppc/macppc/cpu.c | 16 | ||||
-rw-r--r-- | sys/arch/powerpc/include/cpu.h | 5 |
2 files changed, 18 insertions, 3 deletions
diff --git a/sys/arch/macppc/macppc/cpu.c b/sys/arch/macppc/macppc/cpu.c index 977d60fdf0c..5629a967503 100644 --- a/sys/arch/macppc/macppc/cpu.c +++ b/sys/arch/macppc/macppc/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.16 2003/10/30 03:17:32 itojun Exp $ */ +/* $OpenBSD: cpu.c,v 1.17 2003/12/24 00:25:42 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(); diff --git a/sys/arch/powerpc/include/cpu.h b/sys/arch/powerpc/include/cpu.h index 6a716efe2e7..8764a885601 100644 --- a/sys/arch/powerpc/include/cpu.h +++ b/sys/arch/powerpc/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.16 2003/07/08 21:46:19 drahn Exp $ */ +/* $OpenBSD: cpu.h,v 1.17 2003/12/24 00:25:42 drahn Exp $ */ /* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */ /* @@ -219,4 +219,7 @@ ppc_intr_disable(void) ppc_mtmsr(dmsr); return (emsr & PSL_EE); } + +int ppc_cpuspeed(void *oldp, size_t *oldlenp, void *newp, size_t newlen); + #endif /* _POWERPC_CPU_H_ */ |