diff options
author | Aleksandr Rybalko <ray@FreeBSD.org> | 2014-07-07 14:16:05 +0000 |
---|---|---|
committer | Aleksandr Rybalko <ray@FreeBSD.org> | 2014-07-07 14:16:05 +0000 |
commit | ab81866c29126cefba65c01c6ad619ee5471c00b (patch) | |
tree | 7d808123341a80f55c4f3e9f60035f4df44fc403 | |
parent | f24dd33c777a9b1b19c115a2da75df3fa96da7b2 (diff) |
Notes
-rw-r--r-- | share/man/man4/vt.4 | 7 | ||||
-rw-r--r-- | sys/amd64/conf/GENERIC | 5 | ||||
-rw-r--r-- | sys/amd64/conf/VT | 14 | ||||
-rw-r--r-- | sys/conf/files | 2 | ||||
-rw-r--r-- | sys/conf/files.i386 | 1 | ||||
-rw-r--r-- | sys/dev/syscons/syscons.c | 12 | ||||
-rw-r--r-- | sys/dev/syscons/sysmouse.c | 3 | ||||
-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.h | 5 | ||||
-rw-r--r-- | sys/dev/vt/vt_consolectl.c | 2 | ||||
-rw-r--r-- | sys/dev/vt/vt_core.c | 11 | ||||
-rw-r--r-- | sys/dev/vt/vt_sysmouse.c | 2 | ||||
-rw-r--r-- | sys/i386/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/i386/conf/VT | 14 | ||||
-rw-r--r-- | sys/kern/kern_cons.c | 43 | ||||
-rw-r--r-- | sys/sys/cons.h | 5 | ||||
-rw-r--r-- | usr.sbin/kbdcontrol/kbdcontrol.c | 9 | ||||
-rw-r--r-- | usr.sbin/vidcontrol/vidcontrol.c | 9 |
19 files changed, 106 insertions, 44 deletions
diff --git a/share/man/man4/vt.4 b/share/man/man4/vt.4 index 859970445470..afa56d4fe9b0 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 cb4fc042b58c..12b0b2d99911 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 7d0547f11456..000000000000 --- 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 34efb4311c97..ea0f82990237 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 acbfe9f1521d..6e6098c2ec04 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 b44dd537105b..35b3ca8d8078 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 c58e9aeae895..e66849787929 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 a13e094a1075..15bed12c804f 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 5bfb8ce585da..5bfb8ce585da 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 176c05311fd5..b216499b735f 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 df8b341d4132..32e3ba6a9ce5 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 476fb4e4ea54..ad90463eee51 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 92eee3c4b8c1..21b2400816f2 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 db904efedcec..642336e0f12a 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 7d0547f11456..000000000000 --- 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 ad2ba201551c..8d23befd0577 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 8442bf3a76e9..485f8c06bd0d 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 d38eda091357..0f927ef3cf03 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 2096e2abcbb6..32e4de64fbe6 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); } /* |