mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-08 17:40:31 +00:00
Merged from the following changes.
sys/dev/syscons/scvgarndr.c revision 1.11 sys/dev/syscons/scvtb.c revision 1.8 sys/dev/syscons/syscons.c revisions 1.361, 1.363, 1.364, 1.365 and 1.366 sys/isa/atkbd_isa.c revision 1.9 sys/isa/syscons_isa.c revision 1.17
This commit is contained in:
parent
dd080a65a2
commit
c713c25620
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=79702
|
@ -57,12 +57,14 @@ static devclass_t pckbd_devclass;
|
|||
|
||||
static int pckbdprobe(device_t dev);
|
||||
static int pckbdattach(device_t dev);
|
||||
static int pckbdresume(device_t dev);
|
||||
static void pckbd_isa_intr(void *arg);
|
||||
|
||||
static device_method_t pckbd_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, pckbdprobe),
|
||||
DEVMETHOD(device_attach, pckbdattach),
|
||||
DEVMETHOD(device_resume, pckbdresume),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
@ -139,6 +141,19 @@ pckbdattach(device_t dev)
|
|||
BUS_SETUP_INTR(device_get_parent(dev), dev, res, INTR_TYPE_TTY,
|
||||
pckbd_isa_intr, kbd, &ih);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
pckbdresume(device_t dev)
|
||||
{
|
||||
keyboard_t *kbd;
|
||||
|
||||
kbd = kbd_get_keyboard(kbd_find_keyboard(DRIVER_NAME,
|
||||
device_get_unit(dev)));
|
||||
if (kbd)
|
||||
(*kbdsw[kbd->kb_index]->clear_state)(kbd);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
|
@ -110,6 +110,7 @@ sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, void *buf, int wait)
|
|||
if (vtb->vtb_buffer != NULL) {
|
||||
bzero((void *)sc_vtb_pointer(vtb, 0),
|
||||
cols*rows*sizeof(u_int16_t)*2);
|
||||
vtb->vtb_flags |= VTB_ALLOCED;
|
||||
}
|
||||
} else {
|
||||
vtb->vtb_buffer = (vm_offset_t)buf;
|
||||
|
@ -130,7 +131,6 @@ sc_vtb_destroy(sc_vtb_t *vtb)
|
|||
{
|
||||
vm_offset_t p;
|
||||
|
||||
vtb->vtb_flags = 0;
|
||||
vtb->vtb_cols = 0;
|
||||
vtb->vtb_rows = 0;
|
||||
vtb->vtb_size = 0;
|
||||
|
@ -141,12 +141,13 @@ sc_vtb_destroy(sc_vtb_t *vtb)
|
|||
switch (vtb->vtb_type) {
|
||||
case VTB_MEMORY:
|
||||
case VTB_RINGBUFFER:
|
||||
if (p != NULL)
|
||||
if ((vtb->vtb_flags & VTB_ALLOCED) && (p != NULL))
|
||||
free((void *)p, M_DEVBUF);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
vtb->vtb_flags = 0;
|
||||
vtb->vtb_type = VTB_INVALID;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,12 +74,6 @@ scattach(device_t dev)
|
|||
return sc_attach_unit(device_get_unit(dev), device_get_flags(dev));
|
||||
}
|
||||
|
||||
static int
|
||||
scresume(device_t dev)
|
||||
{
|
||||
return sc_resume_unit(device_get_unit(dev));
|
||||
}
|
||||
|
||||
int
|
||||
sc_max_unit(void)
|
||||
{
|
||||
|
@ -205,7 +199,6 @@ static device_method_t sc_methods[] = {
|
|||
DEVMETHOD(device_identify, scidentify),
|
||||
DEVMETHOD(device_probe, scprobe),
|
||||
DEVMETHOD(device_attach, scattach),
|
||||
DEVMETHOD(device_resume, scresume),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
|
|
@ -57,12 +57,14 @@ static devclass_t pckbd_devclass;
|
|||
|
||||
static int pckbdprobe(device_t dev);
|
||||
static int pckbdattach(device_t dev);
|
||||
static int pckbdresume(device_t dev);
|
||||
static void pckbd_isa_intr(void *arg);
|
||||
|
||||
static device_method_t pckbd_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, pckbdprobe),
|
||||
DEVMETHOD(device_attach, pckbdattach),
|
||||
DEVMETHOD(device_resume, pckbdresume),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
@ -139,6 +141,19 @@ pckbdattach(device_t dev)
|
|||
BUS_SETUP_INTR(device_get_parent(dev), dev, res, INTR_TYPE_TTY,
|
||||
pckbd_isa_intr, kbd, &ih);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
pckbdresume(device_t dev)
|
||||
{
|
||||
keyboard_t *kbd;
|
||||
|
||||
kbd = kbd_get_keyboard(kbd_find_keyboard(DRIVER_NAME,
|
||||
device_get_unit(dev)));
|
||||
if (kbd)
|
||||
(*kbdsw[kbd->kb_index]->clear_state)(kbd);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
|
@ -110,6 +110,7 @@ sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, void *buf, int wait)
|
|||
if (vtb->vtb_buffer != NULL) {
|
||||
bzero((void *)sc_vtb_pointer(vtb, 0),
|
||||
cols*rows*sizeof(u_int16_t)*2);
|
||||
vtb->vtb_flags |= VTB_ALLOCED;
|
||||
}
|
||||
} else {
|
||||
vtb->vtb_buffer = (vm_offset_t)buf;
|
||||
|
@ -130,7 +131,6 @@ sc_vtb_destroy(sc_vtb_t *vtb)
|
|||
{
|
||||
vm_offset_t p;
|
||||
|
||||
vtb->vtb_flags = 0;
|
||||
vtb->vtb_cols = 0;
|
||||
vtb->vtb_rows = 0;
|
||||
vtb->vtb_size = 0;
|
||||
|
@ -141,12 +141,13 @@ sc_vtb_destroy(sc_vtb_t *vtb)
|
|||
switch (vtb->vtb_type) {
|
||||
case VTB_MEMORY:
|
||||
case VTB_RINGBUFFER:
|
||||
if (p != NULL)
|
||||
if ((vtb->vtb_flags & VTB_ALLOCED) && (p != NULL))
|
||||
free((void *)p, M_DEVBUF);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
vtb->vtb_flags = 0;
|
||||
vtb->vtb_type = VTB_INVALID;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ static char init_done = COLD;
|
|||
static char shutdown_in_progress = FALSE;
|
||||
static char sc_malloc = FALSE;
|
||||
|
||||
static int saver_mode = CONS_LKM_SAVER; /* LKM/user saver */
|
||||
static int saver_mode = CONS_NO_SAVER; /* LKM/user saver */
|
||||
static int run_scrn_saver = FALSE; /* should run the saver? */
|
||||
static long scrn_blank_time = 0; /* screen saver timeout value */
|
||||
#if NSPLASH > 0
|
||||
|
@ -126,6 +126,7 @@ SYSCTL_INT(_machdep, OID_AUTO, enable_panic_key, CTLFLAG_RW, &enable_panic_key,
|
|||
|
||||
#define VIRTUAL_TTY(sc, x) (SC_DEV((sc), (x)) != NULL ? \
|
||||
SC_DEV((sc), (x))->si_tty : NULL)
|
||||
#define ISTTYOPEN(tp) ((tp) && ((tp)->t_state & TS_ISOPEN))
|
||||
|
||||
static int debugger;
|
||||
|
||||
|
@ -409,9 +410,7 @@ scmeminit(void *arg)
|
|||
sc_alloc_scr_buffer(sc_console, FALSE, FALSE);
|
||||
|
||||
#ifndef SC_NO_CUTPASTE
|
||||
/* cut buffer is available only when the mouse pointer is used */
|
||||
if (ISMOUSEAVAIL(sc_console->sc->adp->va_flags))
|
||||
sc_alloc_cut_buffer(sc_console, FALSE);
|
||||
sc_alloc_cut_buffer(sc_console, FALSE);
|
||||
#endif
|
||||
|
||||
#ifndef SC_NO_HISTORY
|
||||
|
@ -423,18 +422,6 @@ scmeminit(void *arg)
|
|||
/* XXX */
|
||||
SYSINIT(sc_mem, SI_SUB_KMEM, SI_ORDER_ANY, scmeminit, NULL);
|
||||
|
||||
int
|
||||
sc_resume_unit(int unit)
|
||||
{
|
||||
/* XXX should be moved to the keyboard driver? */
|
||||
sc_softc_t *sc;
|
||||
|
||||
sc = sc_get_softc(unit, (sc_console_unit == unit) ? SC_KERNEL_CONSOLE : 0);
|
||||
if (sc->kbd != NULL)
|
||||
kbd_clear_state(sc->kbd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
scdevtounit(dev_t dev)
|
||||
{
|
||||
|
@ -470,11 +457,11 @@ scopen(dev_t dev, int flag, int mode, struct proc *p)
|
|||
tp->t_param = scparam;
|
||||
tp->t_stop = nottystop;
|
||||
tp->t_dev = dev;
|
||||
if (!(tp->t_state & TS_ISOPEN)) {
|
||||
if (!ISTTYOPEN(tp)) {
|
||||
ttychars(tp);
|
||||
/* Use the current setting of the <-- key as default VERASE. */
|
||||
/* If the Delete key is preferable, an stty is necessary */
|
||||
if (sc != NULL) {
|
||||
if (sc->kbd != NULL) {
|
||||
key.keynum = KEYCODE_BS;
|
||||
kbd_ioctl(sc->kbd, GIO_KEYMAPENT, (caddr_t)&key);
|
||||
tp->t_cc[VERASE] = key.key.map[0];
|
||||
|
@ -602,11 +589,11 @@ sckbdevent(keyboard_t *thiskbd, int event, void *arg)
|
|||
while ((c = scgetc(sc, SCGETC_NONBLOCK)) != NOKEY) {
|
||||
|
||||
cur_tty = VIRTUAL_TTY(sc, sc->cur_scp->index);
|
||||
/* XXX */
|
||||
if (!(cur_tty->t_state & TS_ISOPEN))
|
||||
if (((cur_tty = sc_console_tty) == NULL)
|
||||
|| !(cur_tty->t_state & TS_ISOPEN))
|
||||
if (!ISTTYOPEN(cur_tty)) {
|
||||
cur_tty = sc_console_tty;
|
||||
if (!ISTTYOPEN(cur_tty))
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((*sc->cur_scp->tsw->te_input)(sc->cur_scp, c, cur_tty))
|
||||
continue;
|
||||
|
@ -801,6 +788,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||
|
||||
case CONS_SAVERMODE: /* set saver mode */
|
||||
switch(*(int *)data) {
|
||||
case CONS_NO_SAVER:
|
||||
case CONS_USR_SAVER:
|
||||
/* if a LKM screen saver is running, stop it first. */
|
||||
scsplash_stick(FALSE);
|
||||
|
@ -813,7 +801,10 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||
}
|
||||
#endif /* NSPLASH */
|
||||
run_scrn_saver = TRUE;
|
||||
scp->status |= SAVER_RUNNING;
|
||||
if (saver_mode == CONS_USR_SAVER)
|
||||
scp->status |= SAVER_RUNNING;
|
||||
else
|
||||
scp->status &= ~SAVER_RUNNING;
|
||||
scsplash_stick(TRUE);
|
||||
splx(s);
|
||||
break;
|
||||
|
@ -974,7 +965,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||
case VT_OPENQRY: /* return free virtual console */
|
||||
for (i = sc->first_vty; i < sc->first_vty + sc->vtys; i++) {
|
||||
tp = VIRTUAL_TTY(sc, i);
|
||||
if ((tp == NULL) || !(tp->t_state & TS_ISOPEN)) {
|
||||
if (!ISTTYOPEN(tp)) {
|
||||
*(int *)data = i + 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1474,7 +1465,7 @@ sccnputc(dev_t dev, int c)
|
|||
sc_draw_cursor_image(scp);
|
||||
}
|
||||
tp = VIRTUAL_TTY(scp->sc, scp->index);
|
||||
if (tp->t_state & TS_ISOPEN)
|
||||
if (ISTTYOPEN(tp))
|
||||
scstart(tp);
|
||||
}
|
||||
#endif /* !SC_NO_HISTORY */
|
||||
|
@ -1626,7 +1617,7 @@ sccnupdate(scr_stat *scp)
|
|||
* when write_in_progress is non-zero. XXX
|
||||
*/
|
||||
|
||||
if (!ISGRAPHSC(scp) && !(scp->status & SAVER_RUNNING))
|
||||
if (!ISGRAPHSC(scp) && !(scp->sc->flags & SC_SCRN_BLANKED))
|
||||
scrn_update(scp, TRUE);
|
||||
}
|
||||
|
||||
|
@ -1711,7 +1702,7 @@ scrn_timer(void *arg)
|
|||
|
||||
/* Update the screen */
|
||||
scp = sc->cur_scp; /* cur_scp may have changed... */
|
||||
if (!ISGRAPHSC(scp) && !(scp->status & SAVER_RUNNING))
|
||||
if (!ISGRAPHSC(scp) && !(sc->flags & SC_SCRN_BLANKED))
|
||||
scrn_update(scp, TRUE);
|
||||
|
||||
#if NSPLASH > 0
|
||||
|
@ -2236,7 +2227,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr)
|
|||
*/
|
||||
tp = VIRTUAL_TTY(sc, sc->cur_scp->index);
|
||||
if ((sc->cur_scp->index != next_scr)
|
||||
&& (tp->t_state & TS_ISOPEN)
|
||||
&& ISTTYOPEN(tp)
|
||||
&& (sc->cur_scp->smode.mode == VT_AUTO)
|
||||
&& ISGRAPHSC(sc->cur_scp)) {
|
||||
splx(s);
|
||||
|
@ -2247,17 +2238,23 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr)
|
|||
|
||||
/*
|
||||
* Is the wanted vty open? Don't allow switching to a closed vty.
|
||||
* If we are in DDB, don't switch to a vty in the VT_PROCESS mode.
|
||||
* Note that we always allow the user to switch to the kernel
|
||||
* console even if it is closed.
|
||||
*/
|
||||
if ((sc_console == NULL) || (next_scr != sc_console->index)) {
|
||||
tp = VIRTUAL_TTY(sc, next_scr);
|
||||
if ((tp == NULL) || !(tp->t_state & TS_ISOPEN)) {
|
||||
if (!ISTTYOPEN(tp)) {
|
||||
splx(s);
|
||||
sc_bell(sc->cur_scp, bios_value.bell_pitch, BELL_DURATION);
|
||||
DPRINTF(5, ("error 2, requested vty isn't open!\n"));
|
||||
return EINVAL;
|
||||
}
|
||||
if ((debugger > 0) && (SC_STAT(tp->t_dev)->smode.mode == VT_PROCESS)) {
|
||||
splx(s);
|
||||
DPRINTF(5, ("error 3, requested vty is in the VT_PROCESS mode\n"));
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
/* this is the start of vty switching process... */
|
||||
|
@ -2770,11 +2767,13 @@ sc_clean_up(scr_stat *scp)
|
|||
int error;
|
||||
#endif /* NSPLASH */
|
||||
|
||||
sc_touch_scrn_saver();
|
||||
if (scp->sc->flags & SC_SCRN_BLANKED) {
|
||||
sc_touch_scrn_saver();
|
||||
#if NSPLASH > 0
|
||||
if ((error = wait_scrn_saver_stop(scp->sc)))
|
||||
return error;
|
||||
if ((error = wait_scrn_saver_stop(scp->sc)))
|
||||
return error;
|
||||
#endif /* NSPLASH */
|
||||
}
|
||||
scp->status &= ~MOUSE_VISIBLE;
|
||||
sc_remove_cutmarking(scp);
|
||||
return 0;
|
||||
|
@ -2822,9 +2821,8 @@ static scr_stat
|
|||
if (sc_init_emulator(scp, SC_DFLT_TERM))
|
||||
sc_init_emulator(scp, "*");
|
||||
|
||||
#ifndef SC_NO_SYSMOUSE
|
||||
if (ISMOUSEAVAIL(sc->adp->va_flags))
|
||||
sc_alloc_cut_buffer(scp, TRUE);
|
||||
#ifndef SC_NO_CUTPASTE
|
||||
sc_alloc_cut_buffer(scp, TRUE);
|
||||
#endif
|
||||
|
||||
#ifndef SC_NO_HISTORY
|
||||
|
@ -3113,7 +3111,7 @@ scgetc(sc_softc_t *sc, u_int flags)
|
|||
sc_draw_cursor_image(scp);
|
||||
}
|
||||
tp = VIRTUAL_TTY(sc, scp->index);
|
||||
if (tp->t_state & TS_ISOPEN)
|
||||
if (ISTTYOPEN(tp))
|
||||
scstart(tp);
|
||||
#endif
|
||||
}
|
||||
|
@ -3210,7 +3208,7 @@ scgetc(sc_softc_t *sc, u_int flags)
|
|||
sc->first_vty + i != this_scr;
|
||||
i = (i + 1)%sc->vtys) {
|
||||
struct tty *tp = VIRTUAL_TTY(sc, sc->first_vty + i);
|
||||
if (tp && tp->t_state & TS_ISOPEN) {
|
||||
if (ISTTYOPEN(tp)) {
|
||||
sc_switch_scr(scp->sc, sc->first_vty + i);
|
||||
break;
|
||||
}
|
||||
|
@ -3223,7 +3221,7 @@ scgetc(sc_softc_t *sc, u_int flags)
|
|||
sc->first_vty + i != this_scr;
|
||||
i = (i + sc->vtys - 1)%sc->vtys) {
|
||||
struct tty *tp = VIRTUAL_TTY(sc, sc->first_vty + i);
|
||||
if (tp && tp->t_state & TS_ISOPEN) {
|
||||
if (ISTTYOPEN(tp)) {
|
||||
sc_switch_scr(scp->sc, sc->first_vty + i);
|
||||
break;
|
||||
}
|
||||
|
@ -3412,7 +3410,7 @@ sc_paste(scr_stat *scp, u_char *p, int count)
|
|||
|
||||
if (scp->status & MOUSE_VISIBLE) {
|
||||
tp = VIRTUAL_TTY(scp->sc, scp->sc->cur_scp->index);
|
||||
if (!(tp->t_state & TS_ISOPEN))
|
||||
if (!ISTTYOPEN(tp))
|
||||
return;
|
||||
rmap = scp->sc->scr_rmap;
|
||||
for (; count > 0; --count)
|
||||
|
@ -3453,7 +3451,7 @@ blink_screen(void *arg)
|
|||
scp->sc->blink_in_progress = 0;
|
||||
mark_all(scp);
|
||||
tp = VIRTUAL_TTY(scp->sc, scp->index);
|
||||
if (tp->t_state & TS_ISOPEN)
|
||||
if (ISTTYOPEN(tp))
|
||||
scstart(tp);
|
||||
if (scp->sc->delayed_next_scr)
|
||||
sc_switch_scr(scp->sc, scp->sc->delayed_next_scr - 1);
|
||||
|
|
|
@ -74,12 +74,6 @@ scattach(device_t dev)
|
|||
return sc_attach_unit(device_get_unit(dev), device_get_flags(dev));
|
||||
}
|
||||
|
||||
static int
|
||||
scresume(device_t dev)
|
||||
{
|
||||
return sc_resume_unit(device_get_unit(dev));
|
||||
}
|
||||
|
||||
int
|
||||
sc_max_unit(void)
|
||||
{
|
||||
|
@ -205,7 +199,6 @@ static device_method_t sc_methods[] = {
|
|||
DEVMETHOD(device_identify, scidentify),
|
||||
DEVMETHOD(device_probe, scprobe),
|
||||
DEVMETHOD(device_attach, scattach),
|
||||
DEVMETHOD(device_resume, scresume),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue