diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2024-06-11 15:44:56 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2024-06-11 15:44:56 +0000 |
commit | 566a2f7787693879f83a360a7eab0a7c68e182d4 (patch) | |
tree | 00d9d8fe6c86c194866332ad5e736a67e48c12ed /sys/arch/arm | |
parent | cd6b1fe3ebc362532f9298551555cfdf3522cf5d (diff) |
Clamp CPU clock frequencies to [min, max] range when determining the
initial perflevel.
ok deraadt@, phessler@, patrick@, jca@
Diffstat (limited to 'sys/arch/arm')
-rw-r--r-- | sys/arch/arm/arm/cpu.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/arch/arm/arm/cpu.c b/sys/arch/arm/arm/cpu.c index cedce406d8d..f51404f73be 100644 --- a/sys/arch/arm/arm/cpu.c +++ b/sys/arch/arm/arm/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.59 2023/10/24 13:20:09 claudio Exp $ */ +/* $OpenBSD: cpu.c,v 1.60 2024/06/11 15:44:55 kettenis Exp $ */ /* $NetBSD: cpu.c,v 1.56 2004/04/14 04:01:49 bsh Exp $ */ @@ -836,6 +836,10 @@ cpu_opp_mountroot(struct device *self) min = ot->ot_opp_hz_min; max = ot->ot_opp_hz_max; level_hz = clock_get_frequency(ci->ci_node, NULL); + if (level_hz < min) + level_hz = min; + if (level_hz > max) + level_hz = max; level = howmany(100 * (level_hz - min), (max - min)); } |