Source-Changes-HG archive

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

[src/trunk]: src/sys/arch support passing nouveau.config= and nouveau.debug= ...



details:   https://anonhg.NetBSD.org/src/rev/0ffd5ef57554
branches:  trunk
changeset: 341112:0ffd5ef57554
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Oct 18 17:07:36 2015 +0000

description:
support passing nouveau.config= and nouveau.debug= on the kernel cmdline

diffstat:

 sys/arch/arm/nvidia/tegra_nouveau.c   |   8 +++++-
 sys/arch/evbarm/tegra/tegra_machdep.c |  37 +++++++++++++++++++++++++++++++++-
 2 files changed, 41 insertions(+), 4 deletions(-)

diffs (108 lines):

diff -r c9c981e584c9 -r 0ffd5ef57554 sys/arch/arm/nvidia/tegra_nouveau.c
--- a/sys/arch/arm/nvidia/tegra_nouveau.c       Sun Oct 18 16:59:19 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_nouveau.c       Sun Oct 18 17:07:36 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_nouveau.c,v 1.5 2015/10/18 14:31:33 jmcneill Exp $ */
+/* $NetBSD: tegra_nouveau.c,v 1.6 2015/10/18 17:07:36 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_nouveau.c,v 1.5 2015/10/18 14:31:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_nouveau.c,v 1.6 2015/10/18 17:07:36 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -99,6 +99,7 @@
 #if notyet
        const struct tegra_locators * const loc = &tio->tio_loc;
 #endif
+       prop_dictionary_t prop = device_properties(self);
        int error;
 
        sc->sc_dev = self;
@@ -107,6 +108,9 @@
        aprint_naive("\n");
        aprint_normal(": GPU\n");
 
+       prop_dictionary_get_cstring(prop, "debug", &nouveau_debug);
+       prop_dictionary_get_cstring(prop, "config", &nouveau_config);
+
        tegra_car_gpu_enable();
 
        error = -nouveau_device_create(&sc->sc_platform_dev,
diff -r c9c981e584c9 -r 0ffd5ef57554 sys/arch/evbarm/tegra/tegra_machdep.c
--- a/sys/arch/evbarm/tegra/tegra_machdep.c     Sun Oct 18 16:59:19 2015 +0000
+++ b/sys/arch/evbarm/tegra/tegra_machdep.c     Sun Oct 18 17:07:36 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_machdep.c,v 1.19 2015/08/22 15:10:04 jmcneill Exp $ */
+/* $NetBSD: tegra_machdep.c,v 1.20 2015/10/18 17:07:36 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.19 2015/08/22 15:10:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.20 2015/10/18 17:07:36 jmcneill Exp $");
 
 #include "opt_tegra.h"
 #include "opt_machdep.h"
@@ -49,6 +49,7 @@
 #include <sys/device.h>
 #include <sys/exec.h>
 #include <sys/kernel.h>
+#include <sys/kmem.h>
 #include <sys/ksyms.h>
 #include <sys/msgbuf.h>
 #include <sys/proc.h>
@@ -370,6 +371,29 @@
        return strncmp(s, val, strlen(val)) == 0;
 }
 
+static char *
+tegra_bootconf_strdup(const char *key)
+{
+       char *s, *ret;
+       int i = 0;
+
+       if (!get_bootconf_option(boot_args, key, BOOTOPT_TYPE_STRING, &s))
+               return NULL;
+
+       for (;;) {
+               if (s[i] == ' ' || s[i] == '\t' || s[i] == '\0')
+                       break;
+               ++i;
+       }
+
+       ret = kmem_alloc(i + 1, KM_SLEEP);
+       if (ret == NULL)
+               return NULL;
+
+       strncpy(ret, s, i + 1);
+       return ret;
+}
+
 void
 tegra_device_register(device_t self, void *aux)
 {
@@ -403,6 +427,15 @@
                prop_dictionary_set_cstring(dict, "hdmi-device", "tegrahdmi0");
        }
 
+       if (device_is_a(self, "nouveau")) {
+               const char *config = tegra_bootconf_strdup("nouveau.config");
+               const char *debug = tegra_bootconf_strdup("nouveau.debug");
+               if (config)
+                       prop_dictionary_set_cstring(dict, "config", config);
+               if (debug)
+                       prop_dictionary_set_cstring(dict, "debug", debug);
+       }
+
 #ifdef BOARD_JETSONTK1
        if (device_is_a(self, "sdhc")
            && device_is_a(device_parent(self), "tegraio")) {



Home | Main Index | Thread Index | Old Index