From 566a2f7787693879f83a360a7eab0a7c68e182d4 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Tue, 11 Jun 2024 15:44:56 +0000 Subject: Clamp CPU clock frequencies to [min, max] range when determining the initial perflevel. ok deraadt@, phessler@, patrick@, jca@ --- sys/arch/arm/arm/cpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sys/arch/arm') 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)); } -- cgit v1.2.3