summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorray <ray@FreeBSD.org>2014-07-07 14:16:05 +0000
committerray <ray@FreeBSD.org>2014-07-07 14:16:05 +0000
commit74b8e10dc8320877d77c972a0f9a432c58388311 (patch)
tree7d808123341a80f55c4f3e9f60035f4df44fc403
parent51242982dad67c86d8775c0abc241de6f2dc768d (diff)
downloadFreeBSD-src-74b8e10dc8320877d77c972a0f9a432c58388311.zip
FreeBSD-src-74b8e10dc8320877d77c972a0f9a432c58388311.tar.gz
267622 Log:
Rename vt(4) vga module to dismiss interference with syscons(4) vga module. 267623 Log: Remove stale link to deleted vt(4) xboxfb driver. 267624 Log: syscons(4) and vt(4) can be built together now. 267625 Log: Allow to disable syscons(4) if "hw.syscons.disable" kenv is set. 267626 Log: Suspend vt(4) initialization if "kern.vt.disable" kenv is set. 267965 by emaste@ Log: Use a common tunable to choose between vt(4)/sc(4) With this change and previous work from ray@ it will be possible to put both in GENERIC, and have one enabled by default, but allow the other to be selected via the loader. (The previous implementation had separate kern.vt.disable and hw.syscons.disable tunables, and would panic if both drivers were compiled in and neither was explicitly disabled.) 268175 by emaste@ Log: Fix vt(4) detection in kbdcontrol and vidcontrol As sc(4) and vt(4) coexist and are both enabled in GENERIC, the existence of a vt(4) sysctl is not sufficient to determine that vt(4) is in use. Reported by: Trond Endrestøl 268045 by emaste@ Log: Add vt(4) to GENERIC and retire the separate VT config vt(4) and sc(4) can now coexist in the same kernel. To choose the vt driver, set the loader tunable kern.vty=vt . Sponsored by: The FreeBSD Foundation
-rw-r--r--share/man/man4/vt.47
-rw-r--r--sys/amd64/conf/GENERIC5
-rw-r--r--sys/amd64/conf/VT14
-rw-r--r--sys/conf/files2
-rw-r--r--sys/conf/files.i3861
-rw-r--r--sys/dev/syscons/syscons.c12
-rw-r--r--sys/dev/syscons/sysmouse.c3
-rw-r--r--sys/dev/vt/hw/vga/vt_vga.c (renamed from sys/dev/vt/hw/vga/vga.c)2
-rw-r--r--sys/dev/vt/hw/vga/vt_vga_reg.h (renamed from sys/dev/vt/hw/vga/vga_reg.h)0
-rw-r--r--sys/dev/vt/vt.h5
-rw-r--r--sys/dev/vt/vt_consolectl.c2
-rw-r--r--sys/dev/vt/vt_core.c11
-rw-r--r--sys/dev/vt/vt_sysmouse.c2
-rw-r--r--sys/i386/conf/GENERIC4
-rw-r--r--sys/i386/conf/VT14
-rw-r--r--sys/kern/kern_cons.c43
-rw-r--r--sys/sys/cons.h5
-rw-r--r--usr.sbin/kbdcontrol/kbdcontrol.c9
-rw-r--r--usr.sbin/vidcontrol/vidcontrol.c9
19 files changed, 106 insertions, 44 deletions
diff --git a/share/man/man4/vt.4 b/share/man/man4/vt.4
index 8599704..afa56d4 100644
--- a/share/man/man4/vt.4
+++ b/share/man/man4/vt.4
@@ -44,6 +44,7 @@
In
.Xr loader.conf 5 :
.Cd hw.vga.textmode=1
+.Cd kern.vty=vt
.Sh DESCRIPTION
The
.Nm
@@ -182,6 +183,12 @@ prompt or in
Set to 1 to use virtual terminals in text mode instead of graphics mode.
Features that require graphics mode, like loadable fonts, will be
disabled.
+.It Va kern.vty
+Set to vt to choose the
+.Nm
+driver for the system console, if the
+.Xr syscons 4
+driver is also compiled in and is the default.
.El
.Sh EXAMPLES
The following line will change the default color of normal text.
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index cb4fc04..12b0b2d 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -176,6 +176,11 @@ device splash # Splash screen and screen saver support
device sc
options SC_PIXEL_MODE # add support for the raster text mode
+# vt is the new video console driver
+device vt
+device vt_vga
+device vt_efifb
+
device agp # support several AGP chipsets
# PCCARD (PCMCIA) support
diff --git a/sys/amd64/conf/VT b/sys/amd64/conf/VT
deleted file mode 100644
index 7d0547f..0000000
--- a/sys/amd64/conf/VT
+++ /dev/null
@@ -1,14 +0,0 @@
-# VT -- kernel config using the vt(9) system console instead of legacy syscons
-#
-# For more information see https://wiki.freebsd.org/Newcons
-#
-# $FreeBSD$
-
-include GENERIC
-ident VT
-
-nodevice sc
-nodevice vga
-
-device vt
-device vt_vga
diff --git a/sys/conf/files b/sys/conf/files
index 34efb43..ea0f829 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -2535,7 +2535,7 @@ dev/vt/colors/vt_termcolors.c optional vt
dev/vt/font/vt_font_default.c optional vt
dev/vt/font/vt_mouse_cursor.c optional vt
dev/vt/hw/fb/vt_fb.c optional vt
-dev/vt/hw/vga/vga.c optional vt vt_vga
+dev/vt/hw/vga/vt_vga.c optional vt vt_vga
dev/vt/logo/logo_freebsd.c optional vt splash
dev/vt/vt_buf.c optional vt
dev/vt/vt_consolectl.c optional vt
diff --git a/sys/conf/files.i386 b/sys/conf/files.i386
index acbfe9f..6e6098c 100644
--- a/sys/conf/files.i386
+++ b/sys/conf/files.i386
@@ -293,7 +293,6 @@ dev/viawd/viawd.c optional viawd
dev/vmware/vmxnet3/if_vmx.c optional vmx
dev/acpica/acpi_if.m standard
dev/acpi_support/acpi_wmi_if.m standard
-dev/vt/hw/xboxfb/xboxfb.c optional vt_xboxfb
dev/wbwd/wbwd.c optional wbwd
dev/wpi/if_wpi.c optional wpi
dev/isci/isci.c optional isci
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index b44dd53..35b3ca8 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -267,6 +267,8 @@ static struct cdevsw consolectl_devsw = {
int
sc_probe_unit(int unit, int flags)
{
+ if (!vty_enabled(VTY_SC))
+ return ENXIO;
if (!scvidprobe(unit, flags, FALSE)) {
if (bootverbose)
printf("%s%d: no video adapter found.\n", SC_DRIVER_NAME, unit);
@@ -492,6 +494,9 @@ sc_attach_unit(int unit, int flags)
struct cdev *dev;
int vc;
+ if (!vty_enabled(VTY_SC))
+ return ENXIO;
+
flags &= ~SC_KERNEL_CONSOLE;
if (sc_console_unit == unit) {
@@ -576,6 +581,8 @@ sc_attach_unit(int unit, int flags)
static void
scmeminit(void *arg)
{
+ if (!vty_enabled(VTY_SC))
+ return;
if (sc_malloc)
return;
sc_malloc = TRUE;
@@ -1589,6 +1596,11 @@ sc_cnprobe(struct consdev *cp)
int unit;
int flags;
+ if (!vty_enabled(VTY_SC)) {
+ cp->cn_pri = CN_DEAD;
+ return;
+ }
+
cp->cn_pri = sc_get_cons_priority(&unit, &flags);
/* a video card is always required */
diff --git a/sys/dev/syscons/sysmouse.c b/sys/dev/syscons/sysmouse.c
index c58e9ae..e668497 100644
--- a/sys/dev/syscons/sysmouse.c
+++ b/sys/dev/syscons/sysmouse.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/tty.h>
#include <sys/ttydefaults.h>
#include <sys/kernel.h>
+#include <sys/cons.h>
#include <sys/consio.h>
#include <sys/mouse.h>
@@ -165,6 +166,8 @@ static struct ttydevsw smdev_ttydevsw = {
static void
sm_attach_mouse(void *unused)
{
+ if (!vty_enabled(VTY_SC))
+ return;
sysmouse_tty = tty_alloc(&smdev_ttydevsw, NULL);
tty_makedev(sysmouse_tty, NULL, "sysmouse");
}
diff --git a/sys/dev/vt/hw/vga/vga.c b/sys/dev/vt/hw/vga/vt_vga.c
index a13e094..15bed12 100644
--- a/sys/dev/vt/hw/vga/vga.c
+++ b/sys/dev/vt/hw/vga/vt_vga.c
@@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <dev/vt/vt.h>
-#include <dev/vt/hw/vga/vga_reg.h>
+#include <dev/vt/hw/vga/vt_vga_reg.h>
#include <machine/bus.h>
diff --git a/sys/dev/vt/hw/vga/vga_reg.h b/sys/dev/vt/hw/vga/vt_vga_reg.h
index 5bfb8ce..5bfb8ce 100644
--- a/sys/dev/vt/hw/vga/vga_reg.h
+++ b/sys/dev/vt/hw/vga/vt_vga_reg.h
diff --git a/sys/dev/vt/vt.h b/sys/dev/vt/vt.h
index 176c053..b216499 100644
--- a/sys/dev/vt/vt.h
+++ b/sys/dev/vt/vt.h
@@ -50,11 +50,6 @@
#include "opt_syscons.h"
#include "opt_splash.h"
-#ifdef DEV_SC
-#error "Build with both syscons and vt is not supported. Please enable only \
-one 'device sc' or 'device vt'"
-#endif
-
#ifndef VT_MAXWINDOWS
#ifdef MAXCONS
#define VT_MAXWINDOWS MAXCONS
diff --git a/sys/dev/vt/vt_consolectl.c b/sys/dev/vt/vt_consolectl.c
index df8b341..32e3ba6 100644
--- a/sys/dev/vt/vt_consolectl.c
+++ b/sys/dev/vt/vt_consolectl.c
@@ -73,6 +73,8 @@ static void
consolectl_drvinit(void *unused)
{
+ if (!vty_enabled(VTY_VT))
+ return;
make_dev(&consolectl_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
"consolectl");
}
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index 476fb4e4..ad90463 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -215,6 +215,8 @@ static void
vt_update_static(void *dummy)
{
+ if (!vty_enabled(VTY_VT))
+ return;
if (main_vd->vd_driver != NULL)
printf("VT: running with driver \"%s\".\n",
main_vd->vd_driver->vd_name);
@@ -959,6 +961,9 @@ vtterm_cnprobe(struct terminal *tm, struct consdev *cp)
term_attr_t attr;
term_char_t c;
+ if (!vty_enabled(VTY_VT))
+ return;
+
if (vd->vd_flags & VDF_INITIALIZED)
/* Initialization already done. */
return;
@@ -1998,6 +2003,9 @@ vt_upgrade(struct vt_device *vd)
struct vt_window *vw;
unsigned int i;
+ if (!vty_enabled(VTY_VT))
+ return;
+
for (i = 0; i < VT_MAXWINDOWS; i++) {
vw = vd->vd_windows[i];
if (vw == NULL) {
@@ -2063,6 +2071,9 @@ vt_allocate(struct vt_driver *drv, void *softc)
struct vt_device *vd;
struct winsize wsz;
+ if (!vty_enabled(VTY_VT))
+ return;
+
if (main_vd->vd_driver == NULL) {
main_vd->vd_driver = drv;
printf("VT: initialize with new VT driver \"%s\".\n",
diff --git a/sys/dev/vt/vt_sysmouse.c b/sys/dev/vt/vt_sysmouse.c
index 92eee3c..21b2400 100644
--- a/sys/dev/vt/vt_sysmouse.c
+++ b/sys/dev/vt/vt_sysmouse.c
@@ -405,6 +405,8 @@ static void
sysmouse_drvinit(void *unused)
{
+ if (!vty_enabled(VTY_VT))
+ return;
mtx_init(&sysmouse_lock, "sysmouse", NULL, MTX_DEF);
cv_init(&sysmouse_sleep, "sysmrd");
make_dev(&sysmouse_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC
index db904ef..642336e 100644
--- a/sys/i386/conf/GENERIC
+++ b/sys/i386/conf/GENERIC
@@ -181,6 +181,10 @@ device splash # Splash screen and screen saver support
device sc
options SC_PIXEL_MODE # add support for the raster text mode
+# vt is the new video console driver
+device vt
+device vt_vga
+
device agp # support several AGP chipsets
# Power management support (see NOTES for more options)
diff --git a/sys/i386/conf/VT b/sys/i386/conf/VT
deleted file mode 100644
index 7d0547f..0000000
--- a/sys/i386/conf/VT
+++ /dev/null
@@ -1,14 +0,0 @@
-# VT -- kernel config using the vt(9) system console instead of legacy syscons
-#
-# For more information see https://wiki.freebsd.org/Newcons
-#
-# $FreeBSD$
-
-include GENERIC
-ident VT
-
-nodevice sc
-nodevice vga
-
-device vt
-device vt_vga
diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c
index ad2ba20..8d23bef 100644
--- a/sys/kern/kern_cons.c
+++ b/sys/kern/kern_cons.c
@@ -41,6 +41,7 @@
__FBSDID("$FreeBSD$");
#include "opt_ddb.h"
+#include "opt_syscons.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -648,3 +649,45 @@ sysbeep(int pitch __unused, int period __unused)
#endif
+/*
+ * Temporary support for sc(4) to vt(4) transition.
+ */
+static char vty_name[16] = "";
+SYSCTL_STRING(_kern, OID_AUTO, vty, CTLFLAG_RDTUN, vty_name, 0,
+ "Console vty driver");
+
+int
+vty_enabled(unsigned vty)
+{
+ static unsigned vty_selected = 0;
+
+ if (vty_selected == 0) {
+ TUNABLE_STR_FETCH("kern.vty", vty_name, sizeof(vty_name));
+ do {
+#if defined(DEV_SC)
+ if (strcmp(vty_name, "sc") == 0) {
+ vty_selected = VTY_SC;
+ break;
+ }
+#endif
+#if defined(DEV_VT)
+ if (strcmp(vty_name, "vt") == 0) {
+ vty_selected = VTY_VT;
+ break;
+ }
+#endif
+#if defined(DEV_SC)
+ vty_selected = VTY_SC;
+#elif defined(DEV_VT)
+ vty_selected = VTY_VT;
+#endif
+ } while (0);
+
+ if (vty_selected == VTY_VT)
+ strcpy(vty_name, "vt");
+ else if (vty_selected == VTY_SC)
+ strcpy(vty_name, "sc");
+ }
+ return ((vty_selected & vty) != 0);
+}
+
diff --git a/sys/sys/cons.h b/sys/sys/cons.h
index 8442bf3..485f8c0 100644
--- a/sys/sys/cons.h
+++ b/sys/sys/cons.h
@@ -133,6 +133,11 @@ int cnunavailable(void);
void constty_set(struct tty *tp);
void constty_clear(void);
+/* sc(4) / vt(4) coexistence shim */
+#define VTY_SC 0x01
+#define VTY_VT 0x02
+int vty_enabled(unsigned int);
+
#endif /* _KERNEL */
#endif /* !_MACHINE_CONS_H_ */
diff --git a/usr.sbin/kbdcontrol/kbdcontrol.c b/usr.sbin/kbdcontrol/kbdcontrol.c
index d38eda0..0f927ef 100644
--- a/usr.sbin/kbdcontrol/kbdcontrol.c
+++ b/usr.sbin/kbdcontrol/kbdcontrol.c
@@ -146,11 +146,12 @@ static void usage(void) __dead2;
static int
is_vt4(void)
{
+ char vty_name[4] = "";
+ size_t len = sizeof(vty_name);
- if (sysctlbyname("kern.vt.deadtimer", NULL, NULL, NULL, 0) == 0)
- return (1);
-
- return (0);
+ if (sysctlbyname("kern.vty", vty_name, &len, NULL, 0) != 0)
+ return (0);
+ return (strcmp(vty_name, "vt") == 0);
}
static char *
diff --git a/usr.sbin/vidcontrol/vidcontrol.c b/usr.sbin/vidcontrol/vidcontrol.c
index 2096e2a..32e4de6 100644
--- a/usr.sbin/vidcontrol/vidcontrol.c
+++ b/usr.sbin/vidcontrol/vidcontrol.c
@@ -216,11 +216,12 @@ usage(void)
static int
is_vt4(void)
{
+ char vty_name[4] = "";
+ size_t len = sizeof(vty_name);
- if (sysctlbyname("kern.vt.deadtimer", NULL, NULL, NULL, 0) == 0)
- return (1);
-
- return (0);
+ if (sysctlbyname("kern.vty", vty_name, &len, NULL, 0) != 0)
+ return (0);
+ return (strcmp(vty_name, "vt") == 0);
}
/*
OpenPOWER on IntegriCloud