Module Name:    src
Committed By:   nia
Date:           Sun Oct 25 16:39:00 UTC 2020

Modified Files:
        src/share/man/man4: acpicpu.4
        src/share/man/man4/man4.x86: est.4 powernow.4
        src/sys/arch/evbmips/loongson: loongson_clock.c
        src/sys/arch/macppc/dev: obio.c
        src/sys/arch/x86/acpi: acpi_cpu_md.c
        src/sys/arch/x86/x86: est.c powernow.c

Log Message:
Normalize some machine dependent CPU frequenct sysctl variables.

This moves machdep.*.frequency.* to machdep.cpu.frequency.*.

This was proposed on tech-kern some time ago. The intention is to allow
third-party tools such as estd and conky to more easily and reliably
fetch or modify the current CPU frequency without iterating through
various machine-dependent variables to check their presence.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/share/man/man4/acpicpu.4
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/man4.x86/est.4
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/man4.x86/powernow.4
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbmips/loongson/loongson_clock.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/macppc/dev/obio.c
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/x86/acpi/acpi_cpu_md.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/x86/x86/est.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/x86/x86/powernow.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/acpicpu.4
diff -u src/share/man/man4/acpicpu.4:1.35 src/share/man/man4/acpicpu.4:1.36
--- src/share/man/man4/acpicpu.4:1.35	Fri Aug 31 19:34:44 2018
+++ src/share/man/man4/acpicpu.4	Sun Oct 25 16:39:00 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: acpicpu.4,v 1.35 2018/08/31 19:34:44 sevan Exp $
+.\" $NetBSD: acpicpu.4,v 1.36 2020/10/25 16:39:00 nia Exp $
 .\"
 .\" Copyright (c) 2010 Jukka Ruohonen <jruoho...@iki.fi>
 .\" All rights reserved.
@@ -257,10 +257,6 @@ controls for P-states as the ones provid
 .Xr est 4
 and
 .Xr powernow 4 .
-Depending on the processor, the second-level node is either
-.Ic machdep.est
-or
-.Ic machdep.powernow .
 Please note that future versions of
 .Nm
 may however remove these system control variables without further notice.

Index: src/share/man/man4/man4.x86/est.4
diff -u src/share/man/man4/man4.x86/est.4:1.5 src/share/man/man4/man4.x86/est.4:1.6
--- src/share/man/man4/man4.x86/est.4:1.5	Fri Feb 17 22:10:47 2017
+++ src/share/man/man4/man4.x86/est.4	Sun Oct 25 16:39:00 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: est.4,v 1.5 2017/02/17 22:10:47 christos Exp $
+.\" $NetBSD: est.4,v 1.6 2020/10/25 16:39:00 nia Exp $
 .\"
 .\" Copyright (c) 2011 Jukka Ruohonen <jruoho...@iki.fi>
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 17, 2017
+.Dd September 7, 2020
 .Dt EST 4
 .Os
 .Sh NAME
@@ -41,13 +41,13 @@ The following
 .Xr sysctl 8
 variables are available with
 .Nm :
-.Bl -tag -width "machdep.est.frequency.available" -offset indent
-.It Ic machdep.est.frequency.target
+.Bl -tag -width "machdep.cpu.frequency.available" -offset indent
+.It Ic machdep.cpu.frequency.target
 The target frequency of the
 .Tn CPUs .
-.It Ic machdep.est.frequency.current
+.It Ic machdep.cpu.frequency.current
 The current frequency.
-.It Ic machdep.est.frequency.available
+.It Ic machdep.cpu.frequency.available
 The frequencies recognized by
 .Nm .
 .El

Index: src/share/man/man4/man4.x86/powernow.4
diff -u src/share/man/man4/man4.x86/powernow.4:1.3 src/share/man/man4/man4.x86/powernow.4:1.4
--- src/share/man/man4/man4.x86/powernow.4:1.3	Fri Feb 17 22:10:47 2017
+++ src/share/man/man4/man4.x86/powernow.4	Sun Oct 25 16:39:00 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: powernow.4,v 1.3 2017/02/17 22:10:47 christos Exp $
+.\" $NetBSD: powernow.4,v 1.4 2020/10/25 16:39:00 nia Exp $
 .\"
 .\" Copyright (c) 2011 Jukka Ruohonen <jruoho...@iki.fi>
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 17, 2017
+.Dd September 7, 2020
 .Dt POWERNOW 4
 .Os
 .Sh NAME
@@ -46,13 +46,13 @@ The following
 .Xr sysctl 8
 variables are available with
 .Nm :
-.Bl -tag -width "machdep.powernow.frequency.available" -offset 2n
-.It Ic machdep.powernow.frequency.target
+.Bl -tag -width "machdep.cpu.frequency.available" -offset 2n
+.It Ic machdep.cpu.frequency.target
 The target frequency of the
 .Tn CPUs .
-.It Ic machdep.powernow.frequency.current
+.It Ic machdep.cpu.frequency.current
 The current frequency.
-.It Ic machdep.powernow.frequency.available
+.It Ic machdep.cpu.frequency.available
 The available frequencies.
 .El
 .Pp

Index: src/sys/arch/evbmips/loongson/loongson_clock.c
diff -u src/sys/arch/evbmips/loongson/loongson_clock.c:1.2 src/sys/arch/evbmips/loongson/loongson_clock.c:1.3
--- src/sys/arch/evbmips/loongson/loongson_clock.c:1.2	Fri May 29 12:30:40 2020
+++ src/sys/arch/evbmips/loongson/loongson_clock.c	Sun Oct 25 16:39:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: loongson_clock.c,v 1.2 2020/05/29 12:30:40 rin Exp $	*/
+/*	$NetBSD: loongson_clock.c,v 1.3 2020/10/25 16:39:00 nia Exp $	*/
 
 /*
  * Copyright (c) 2011, 2016 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: loongson_clock.c,v 1.2 2020/05/29 12:30:40 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: loongson_clock.c,v 1.3 2020/10/25 16:39:00 nia Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -110,9 +110,9 @@ loongson_initclocks(void)
 	/* now setup sysctl */
 	if (sysctl_createv(NULL, 0, NULL, 
 	    &me, 
-	    CTLFLAG_READWRITE, CTLTYPE_NODE, "loongson", NULL, NULL,
+	    CTLFLAG_READWRITE, CTLTYPE_NODE, "cpu", NULL, NULL,
 	    0, NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL) != 0)
-		aprint_error("couldn't create 'loongson' node\n");
+		aprint_error("couldn't create 'cpu' node\n");
 
 	if (sysctl_createv(NULL, 0, NULL, 
 	    &freq, 

Index: src/sys/arch/macppc/dev/obio.c
diff -u src/sys/arch/macppc/dev/obio.c:1.46 src/sys/arch/macppc/dev/obio.c:1.47
--- src/sys/arch/macppc/dev/obio.c:1.46	Fri Jun  8 23:39:31 2018
+++ src/sys/arch/macppc/dev/obio.c	Sun Oct 25 16:39:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: obio.c,v 1.46 2018/06/08 23:39:31 macallan Exp $	*/
+/*	$NetBSD: obio.c,v 1.47 2020/10/25 16:39:00 nia Exp $	*/
 
 /*-
  * Copyright (C) 1998	Internet Research Institute, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.46 2018/06/08 23:39:31 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.47 2020/10/25 16:39:00 nia Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -431,9 +431,9 @@ obio_setup_gpios(struct obio_softc *sc, 
 
 	if (sysctl_createv(NULL, 0, NULL, 
 	    &me, 
-	    CTLFLAG_READWRITE, CTLTYPE_NODE, "intrepid", NULL, NULL,
+	    CTLFLAG_READWRITE, CTLTYPE_NODE, "cpu", NULL, NULL,
 	    0, NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL) != 0)
-		printf("couldn't create 'intrepid' node\n");
+		printf("couldn't create 'cpu' node\n");
 	
 	if (sysctl_createv(NULL, 0, NULL, 
 	    &freq, 

Index: src/sys/arch/x86/acpi/acpi_cpu_md.c
diff -u src/sys/arch/x86/acpi/acpi_cpu_md.c:1.83 src/sys/arch/x86/acpi/acpi_cpu_md.c:1.84
--- src/sys/arch/x86/acpi/acpi_cpu_md.c:1.83	Thu Mar 19 19:55:34 2020
+++ src/sys/arch/x86/acpi/acpi_cpu_md.c	Sun Oct 25 16:39:00 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.83 2020/03/19 19:55:34 ad Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.84 2020/10/25 16:39:00 nia Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen <jruoho...@iki.fi>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.83 2020/03/19 19:55:34 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.84 2020/10/25 16:39:00 nia Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -1003,25 +1003,8 @@ static int
 acpicpu_md_pstate_sysctl_init(void)
 {
 	const struct sysctlnode	*fnode, *mnode, *rnode;
-	const char *str;
 	int rv;
 
-	switch (cpu_vendor) {
-
-	case CPUVENDOR_IDT:
-	case CPUVENDOR_INTEL:
-		str = "est";
-		break;
-
-	case CPUVENDOR_AMD:
-		str = "powernow";
-		break;
-
-	default:
-		return ENODEV;
-	}
-
-
 	rv = sysctl_createv(&acpicpu_log, 0, NULL, &rnode,
 	    CTLFLAG_PERMANENT, CTLTYPE_NODE, "machdep", NULL,
 	    NULL, 0, NULL, 0, CTL_MACHDEP, CTL_EOL);
@@ -1030,7 +1013,7 @@ acpicpu_md_pstate_sysctl_init(void)
 		goto fail;
 
 	rv = sysctl_createv(&acpicpu_log, 0, &rnode, &mnode,
-	    0, CTLTYPE_NODE, str, NULL,
+	    0, CTLTYPE_NODE, "cpu", NULL,
 	    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
 
 	if (rv != 0)

Index: src/sys/arch/x86/x86/est.c
diff -u src/sys/arch/x86/x86/est.c:1.31 src/sys/arch/x86/x86/est.c:1.32
--- src/sys/arch/x86/x86/est.c:1.31	Thu Jun  1 02:45:08 2017
+++ src/sys/arch/x86/x86/est.c	Sun Oct 25 16:39:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: est.c,v 1.31 2017/06/01 02:45:08 chs Exp $	*/
+/*	$NetBSD: est.c,v 1.32 2020/10/25 16:39:00 nia Exp $	*/
 /*
  * Copyright (c) 2003 Michael Eriksson.
  * All rights reserved.
@@ -76,7 +76,7 @@
  *   http://www.codemonkey.org.uk/projects/cpufreq/cpufreq-2.4.22-pre6-1.gz
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: est.c,v 1.31 2017/06/01 02:45:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: est.c,v 1.32 2020/10/25 16:39:00 nia Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -1296,11 +1296,11 @@ static bool
 est_sysctl(device_t self)
 {
 	struct est_softc *sc = device_private(self);
-	const struct sysctlnode	*node, *estnode, *freqnode;
+	const struct sysctlnode	*node, *cpunode, *freqnode;
 	int rv;
 
 	/*
-	 * Setup the sysctl sub-tree machdep.est.*
+	 * Setup the sysctl sub-tree machdep.cpu.*
 	 */
 	rv = sysctl_createv(&sc->sc_log, 0, NULL, &node,
 	    CTLFLAG_PERMANENT, CTLTYPE_NODE, "machdep", NULL,
@@ -1309,14 +1309,14 @@ est_sysctl(device_t self)
 	if (rv != 0)
 		goto fail;
 
-	rv = sysctl_createv(&sc->sc_log, 0, &node, &estnode,
-	    0, CTLTYPE_NODE, "est", NULL,
+	rv = sysctl_createv(&sc->sc_log, 0, &node, &cpunode,
+	    0, CTLTYPE_NODE, "cpu", NULL,
 	    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
 
 	if (rv != 0)
 		goto fail;
 
-	rv = sysctl_createv(&sc->sc_log, 0, &estnode, &freqnode,
+	rv = sysctl_createv(&sc->sc_log, 0, &cpunode, &freqnode,
 	    0, CTLTYPE_NODE, "frequency", NULL,
 	    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
 

Index: src/sys/arch/x86/x86/powernow.c
diff -u src/sys/arch/x86/x86/powernow.c:1.10 src/sys/arch/x86/x86/powernow.c:1.11
--- src/sys/arch/x86/x86/powernow.c:1.10	Thu Jun  1 02:45:08 2017
+++ src/sys/arch/x86/x86/powernow.c	Sun Oct 25 16:39:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: powernow.c,v 1.10 2017/06/01 02:45:08 chs Exp $ */
+/*	$NetBSD: powernow.c,v 1.11 2020/10/25 16:39:00 nia Exp $ */
 /*	$OpenBSD: powernow-k8.c,v 1.8 2006/06/16 05:58:50 gwk Exp $ */
 
 /*-
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: powernow.c,v 1.10 2017/06/01 02:45:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: powernow.c,v 1.11 2020/10/25 16:39:00 nia Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -249,7 +249,7 @@ powernow_detach(device_t self, int flags
 static int
 powernow_sysctl(device_t self)
 {
-	const struct sysctlnode *freqnode, *node, *pnownode;
+	const struct sysctlnode *freqnode, *node, *cpunode;
 	struct powernow_softc *sc = device_private(self);
 	int rv;
 
@@ -263,14 +263,14 @@ powernow_sysctl(device_t self)
 	if (rv != 0)
 		goto fail;
 
-	rv = sysctl_createv(&sc->sc_log, 0, &node, &pnownode,
-	    0, CTLTYPE_NODE, "powernow", NULL,
+	rv = sysctl_createv(&sc->sc_log, 0, &node, &cpunode,
+	    0, CTLTYPE_NODE, "cpu", NULL,
 	    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
 
 	if (rv != 0)
 		goto fail;
 
-	rv = sysctl_createv(&sc->sc_log, 0, &pnownode, &freqnode,
+	rv = sysctl_createv(&sc->sc_log, 0, &cpunode, &freqnode,
 	    0, CTLTYPE_NODE, "frequency", NULL,
 	    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
 

Reply via email to