diff --git a/sys/compat/linuxkpi/common/include/linux/cpufreq.h b/sys/compat/linuxkpi/common/include/linux/cpufreq.h new file mode 100644 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/cpufreq.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2026 The FreeBSD Foundation + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#ifndef _LINUXKPI_LINUX_CPUFREQ_H_ +#define _LINUXKPI_LINUX_CPUFREQ_H_ + +#include +#include +#include + +#include + +/* + * Return the maximum frequency of a CPU in kHz, or 0 when it is unknown. + * The hw.clockrate sysctl is used for all CPUs. + */ +static inline unsigned int +cpufreq_quick_get_max(unsigned int cpu __unused) +{ + size_t len; + int clockrate; + + pr_debug("%s: TODO\n", __func__); + len = sizeof(clockrate); + if (kernel_sysctlbyname(curthread, "hw.clockrate", &clockrate, &len, + NULL, 0, NULL, 0) != 0 || clockrate <= 0) + return (0); + /* hw.clockrate is in MHz. */ + return ((unsigned int)clockrate * 1000); +} + +#endif /* _LINUXKPI_LINUX_CPUFREQ_H_ */ diff --git a/sys/compat/linuxkpi/dummy/include/linux/cpufreq.h b/sys/compat/linuxkpi/dummy/include/linux/cpufreq.h deleted file mode 100644