Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/evbarm/rpi Add machdep.cpu.frequency.available node...



details:   https://anonhg.NetBSD.org/src/rev/e93a228e415c
branches:  trunk
changeset: 995120:e93a228e415c
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Dec 08 06:53:11 2018 +0000

description:
Add machdep.cpu.frequency.available node to support estd.

While the RPI can run at many intermediate clock frequencies,
this is sufficient for estd and is known to work with every
firmware revision.

diffstat:

 sys/arch/evbarm/rpi/rpi_vcmbox.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (43 lines):

diff -r dd5f5d894f40 -r e93a228e415c sys/arch/evbarm/rpi/rpi_vcmbox.c
--- a/sys/arch/evbarm/rpi/rpi_vcmbox.c  Sat Dec 08 01:47:21 2018 +0000
+++ b/sys/arch/evbarm/rpi/rpi_vcmbox.c  Sat Dec 08 06:53:11 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rpi_vcmbox.c,v 1.4 2014/10/04 13:18:34 mlelstv Exp $ */
+/* $NetBSD: rpi_vcmbox.c,v 1.5 2018/12/08 06:53:11 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2013 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.4 2014/10/04 13:18:34 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.5 2018/12/08 06:53:11 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -233,6 +233,7 @@
 {
        const struct sysctlnode *node, *cpunode, *freqnode;
        int error;
+       static char available[20];
 
        error = vcmbox_read_clockrate(sc, VCPROPTAG_GET_MIN_CLOCKRATE,
            VCPROP_CLK_ARM, &sc->sc_cpu_minrate);
@@ -297,6 +298,16 @@
                goto sysctl_failed;
        sc->sc_node_max = node->sysctl_num;
 
+       snprintf(available, sizeof(available), "%" PRIu32 " %" PRIu32,
+           RATE2MHZ(sc->sc_cpu_minrate), RATE2MHZ(sc->sc_cpu_maxrate));
+
+       error = sysctl_createv(&sc->sc_log, 0, &freqnode, &node,
+           CTLFLAG_PERMANENT, CTLTYPE_STRING, "available", NULL,
+           NULL, 0, available, strlen(available),
+           CTL_CREATE, CTL_EOL);
+       if (error)
+               goto sysctl_failed;
+
        return 0;
 
 sysctl_failed:



Home | Main Index | Thread Index | Old Index