Page MenuHomeFreeBSD

D54528.id171345.diff
No OneTemporary

D54528.id171345.diff

diff --git a/sys/conf/files.x86 b/sys/conf/files.x86
--- a/sys/conf/files.x86
+++ b/sys/conf/files.x86
@@ -342,6 +342,7 @@
x86/bios/vpd.c optional vpd
x86/cpufreq/est.c optional cpufreq
x86/cpufreq/hwpstate_amd.c optional cpufreq
+x86/cpufreq/hwpstate_common.c optional cpufreq
x86/cpufreq/hwpstate_intel.c optional cpufreq
x86/cpufreq/p4tcc.c optional cpufreq
x86/cpufreq/powernow.c optional cpufreq
diff --git a/sys/modules/cpufreq/Makefile b/sys/modules/cpufreq/Makefile
--- a/sys/modules/cpufreq/Makefile
+++ b/sys/modules/cpufreq/Makefile
@@ -9,7 +9,8 @@
.PATH: ${SRCTOP}/sys/x86/cpufreq
SRCS+= acpi_if.h opt_acpi.h
-SRCS+= est.c hwpstate_amd.c p4tcc.c powernow.c hwpstate_intel.c
+SRCS+= est.c p4tcc.c powernow.c
+SRCS+= hwpstate_amd.c hwpstate_common.c hwpstate_intel.c
.endif
.if ${MACHINE} == "i386"
diff --git a/sys/x86/cpufreq/hwpstate_amd.c b/sys/x86/cpufreq/hwpstate_amd.c
--- a/sys/x86/cpufreq/hwpstate_amd.c
+++ b/sys/x86/cpufreq/hwpstate_amd.c
@@ -68,6 +68,8 @@
#include <dev/acpica/acpivar.h>
+#include <x86/cpufreq/hwpstate_common.h>
+
#include "acpi_if.h"
#include "cpufreq_if.h"
@@ -162,10 +164,6 @@
static int hwpstate_get_info_from_msr(device_t dev);
static int hwpstate_goto_pstate(device_t dev, int pstate_id);
-static int hwpstate_verbose;
-SYSCTL_INT(_debug, OID_AUTO, hwpstate_verbose, CTLFLAG_RWTUN,
- &hwpstate_verbose, 0, "Debug hwpstate");
-
static int hwpstate_verify;
SYSCTL_INT(_debug, OID_AUTO, hwpstate_verify, CTLFLAG_RWTUN,
&hwpstate_verify, 0, "Verify P-state after setting");
@@ -176,11 +174,6 @@
"If enabled (1), limit administrative control of P-states to the value in "
"CurPstateLimit");
-static bool hwpstate_pkg_ctrl_enable = true;
-SYSCTL_BOOL(_machdep, OID_AUTO, hwpstate_pkg_ctrl, CTLFLAG_RDTUN,
- &hwpstate_pkg_ctrl_enable, 0,
- "Set 1 (default) to enable package-level control, 0 to disable");
-
static bool hwpstate_amd_cppc_enable = true;
SYSCTL_BOOL(_machdep, OID_AUTO, hwpstate_amd_cppc_enable, CTLFLAG_RDTUN,
&hwpstate_amd_cppc_enable, 0,
diff --git a/sys/x86/cpufreq/hwpstate_common.h b/sys/x86/cpufreq/hwpstate_common.h
new file mode 100644
--- /dev/null
+++ b/sys/x86/cpufreq/hwpstate_common.h
@@ -0,0 +1,13 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2026 The FreeBSD Foundation
+ *
+ * This software was developed by Olivier Certner <olce@FreeBSD.org> at Kumacom
+ * SARL under sponsorship from the FreeBSD Foundation.
+ */
+
+/* Stuff common to hwpstate_amd(4) and hwpstate_intel(4). */
+
+extern int hwpstate_verbose;
+extern bool hwpstate_pkg_ctrl_enable;
diff --git a/sys/x86/cpufreq/hwpstate_common.c b/sys/x86/cpufreq/hwpstate_common.c
new file mode 100644
--- /dev/null
+++ b/sys/x86/cpufreq/hwpstate_common.c
@@ -0,0 +1,22 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2026 The FreeBSD Foundation
+ *
+ * This software was developed by Olivier Certner <olce@FreeBSD.org> at Kumacom
+ * SARL under sponsorship from the FreeBSD Foundation.
+ */
+
+#include <sys/sysctl.h>
+
+#include <x86/cpufreq/hwpstate_common.h>
+
+
+int hwpstate_verbose;
+SYSCTL_INT(_debug, OID_AUTO, hwpstate_verbose, CTLFLAG_RWTUN,
+ &hwpstate_verbose, 0, "Debug hwpstate");
+
+bool hwpstate_pkg_ctrl_enable = true;
+SYSCTL_BOOL(_machdep, OID_AUTO, hwpstate_pkg_ctrl, CTLFLAG_RDTUN,
+ &hwpstate_pkg_ctrl_enable, 0,
+ "Set 1 (default) to enable package-level control, 0 to disable");
diff --git a/sys/x86/cpufreq/hwpstate_intel.c b/sys/x86/cpufreq/hwpstate_intel.c
--- a/sys/x86/cpufreq/hwpstate_intel.c
+++ b/sys/x86/cpufreq/hwpstate_intel.c
@@ -48,6 +48,7 @@
#include <dev/acpica/acpivar.h>
+#include <x86/cpufreq/hwpstate_common.h>
#include <x86/cpufreq/hwpstate_intel_internal.h>
#include "acpi_if.h"
@@ -108,11 +109,6 @@
DRIVER_MODULE(hwpstate_intel, cpu, hwpstate_intel_driver, NULL, NULL);
MODULE_VERSION(hwpstate_intel, 1);
-static bool hwpstate_pkg_ctrl_enable = true;
-SYSCTL_BOOL(_machdep, OID_AUTO, hwpstate_pkg_ctrl, CTLFLAG_RDTUN,
- &hwpstate_pkg_ctrl_enable, 0,
- "Set 1 (default) to enable package-level control, 0 to disable");
-
static int
intel_hwp_dump_sysctl_handler(SYSCTL_HANDLER_ARGS)
{

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 16, 1:50 AM (18 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31569367
Default Alt Text
D54528.id171345.diff (4 KB)

Event Timeline