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
This commit is contained in:
parent
51242982da
commit
74b8e10dc8
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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_ */
|
||||
|
@ -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 *
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user