Support "nomodeset" kernel cmdline flag to disable sunxidrm

This commit is contained in:
jmcneill 2019-02-03 15:43:57 +00:00
parent 1ac16be5ff
commit 3e0436162c
2 changed files with 19 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunxi_drm.c,v 1.4 2019/01/31 01:49:28 jmcneill Exp $ */
/* $NetBSD: sunxi_drm.c,v 1.5 2019/02/03 15:43:57 jmcneill Exp $ */
/*-
* Copyright (c) 2019 Jared D. McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sunxi_drm.c,v 1.4 2019/01/31 01:49:28 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: sunxi_drm.c,v 1.5 2019/02/03 15:43:57 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -121,6 +121,8 @@ sunxi_drm_attach(device_t parent, device_t self, void *aux)
struct sunxi_drm_softc * const sc = device_private(self);
struct fdt_attach_args * const faa = aux;
struct drm_driver * const driver = &sunxi_drm_driver;
prop_dictionary_t dict = device_properties(self);
bool is_disabled;
sc->sc_dev = self;
sc->sc_dmat = faa->faa_dmat;
@ -128,6 +130,12 @@ sunxi_drm_attach(device_t parent, device_t self, void *aux)
sc->sc_phandle = faa->faa_phandle;
aprint_naive("\n");
if (prop_dictionary_get_bool(dict, "disabled", &is_disabled) && is_disabled) {
aprint_normal(": Display Engine Pipeline (disabled)\n");
return;
}
aprint_normal(": Display Engine Pipeline\n");
sc->sc_ddev = drm_dev_alloc(driver, sc->sc_dev);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunxi_platform.c,v 1.34 2019/01/03 14:44:21 jmcneill Exp $ */
/* $NetBSD: sunxi_platform.c,v 1.35 2019/02/03 15:43:57 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@ -31,7 +31,7 @@
#include "opt_console.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.34 2019/01/03 14:44:21 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.35 2019/02/03 15:43:57 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -201,6 +201,7 @@ static void
sunxi_platform_device_register(device_t self, void *aux)
{
prop_dictionary_t prop = device_properties(self);
int val;
if (device_is_a(self, "rgephy")) {
/* Pine64+ and NanoPi NEO Plus2 gigabit ethernet workaround */
@ -224,6 +225,12 @@ sunxi_platform_device_register(device_t self, void *aux)
prop_dictionary_set_bool(prop, "sun50i-a64-unstable-timer", true);
}
}
if (device_is_a(self, "sunxidrm")) {
if (get_bootconf_option(boot_args, "nomodeset", BOOTOPT_TYPE_BOOLEAN, &val))
if (val)
prop_dictionary_set_bool(prop, "disabled", true);
}
}
static u_int