Module Name:    src
Committed By:   jmcneill
Date:           Sun Oct 18 17:07:36 UTC 2015

Modified Files:
        src/sys/arch/arm/nvidia: tegra_nouveau.c
        src/sys/arch/evbarm/tegra: tegra_machdep.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/nvidia/tegra_nouveau.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/tegra/tegra_machdep.c

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

Modified files:

Index: src/sys/arch/arm/nvidia/tegra_nouveau.c
diff -u src/sys/arch/arm/nvidia/tegra_nouveau.c:1.5 src/sys/arch/arm/nvidia/tegra_nouveau.c:1.6
--- src/sys/arch/arm/nvidia/tegra_nouveau.c:1.5	Sun Oct 18 14:31:33 2015
+++ src/sys/arch/arm/nvidia/tegra_nouveau.c	Sun Oct 18 17:07:36 2015
@@ -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 <[email protected]>
@@ -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 @@ tegra_nouveau_attach(device_t parent, de
 #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 @@ tegra_nouveau_attach(device_t parent, de
 	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,

Index: src/sys/arch/evbarm/tegra/tegra_machdep.c
diff -u src/sys/arch/evbarm/tegra/tegra_machdep.c:1.19 src/sys/arch/evbarm/tegra/tegra_machdep.c:1.20
--- src/sys/arch/evbarm/tegra/tegra_machdep.c:1.19	Sat Aug 22 15:10:04 2015
+++ src/sys/arch/evbarm/tegra/tegra_machdep.c	Sun Oct 18 17:07:36 2015
@@ -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 <[email protected]>
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: tegra_machde
 #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 @@ tegra_bootconf_match(const char *key, co
 	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 @@ tegra_device_register(device_t self, voi
 		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")) {

Reply via email to