From 3877c32ec9f9af5242b3f055eeb6ee4d4624a5d6 Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Mon, 16 Apr 2018 04:02:53 +0000 Subject: [PATCH] Use a resource hint instead of environment variable for DIU mode This makes it more consistent with FreeBSD norms, rather than using Linux's norms. Now, instead of needing an environment variable video-mode=fslfb:1280x1024@60 Now one would use a hint: hint.fb.0.mode=1280x1024@60 --- sys/powerpc/mpc85xx/fsl_diu.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sys/powerpc/mpc85xx/fsl_diu.c b/sys/powerpc/mpc85xx/fsl_diu.c index b899bdbe752f..a31497ab8734 100644 --- a/sys/powerpc/mpc85xx/fsl_diu.c +++ b/sys/powerpc/mpc85xx/fsl_diu.c @@ -363,12 +363,9 @@ diu_attach(device_t dev) /* TODO: Eventually, allow EDID to be dynamically provided. */ if (OF_getprop_alloc(node, "edid", &edid_cells) <= 0) { - /* - * u-boot uses the environment variable name 'video-mode', so - * just use the same name here. Should allow another variable - * that better fits our design model, but this is fine. - */ - if ((vm_name = kern_getenv("video-mode")) == NULL) { + /* Get a resource hint: hint.fb.N.mode */ + if (resource_string_value(device_get_name(dev), + device_get_unit(dev), "mode", &vm_name) != 0) { device_printf(dev, "No EDID data and no video-mode env set\n"); return (ENXIO); @@ -383,7 +380,7 @@ diu_attach(device_t dev) videomode = edid.edid_preferred_mode; } else { /* Parse video-mode kenv variable. */ - if ((err = sscanf(vm_name, "fslfb:%dx%d@%d", &w, &h, &r)) != 3) { + if ((err = sscanf(vm_name, "%dx%d@%d", &w, &h, &r)) != 3) { device_printf(dev, "Cannot parse video mode: %s\n", vm_name); return (ENXIO);