Deleted Added
full compact
syscons.c (50477) syscons.c (50652)
1/*-
2 * Copyright (c) 1992-1998 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 1992-1998 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/dev/syscons/syscons.c 50477 1999-08-28 01:08:13Z peter $
28 * $FreeBSD: head/sys/dev/syscons/syscons.c 50652 1999-08-30 10:35:37Z phk $
29 */
30
31#include "sc.h"
32#include "splash.h"
33#include "opt_syscons.h"
34#include "opt_ddb.h"
35#ifdef __i386__
36#include "apm.h"

--- 331 unchanged lines hidden (view full) ---

368 * pcvt share the same major number, their cdevsw cannot be
369 * registered at module loading/initialization time or by SYSINIT.
370 */
371 cdevsw_add(&sc_cdevsw); /* XXX do this just once... */
372
373 for (vc = 0; vc < MAXCONS; vc++) {
374 dev = make_dev(&sc_cdevsw, vc,
375 UID_ROOT, GID_WHEEL, 0600, "ttyv%r", vc + unit * MAXCONS);
29 */
30
31#include "sc.h"
32#include "splash.h"
33#include "opt_syscons.h"
34#include "opt_ddb.h"
35#ifdef __i386__
36#include "apm.h"

--- 331 unchanged lines hidden (view full) ---

368 * pcvt share the same major number, their cdevsw cannot be
369 * registered at module loading/initialization time or by SYSINIT.
370 */
371 cdevsw_add(&sc_cdevsw); /* XXX do this just once... */
372
373 for (vc = 0; vc < MAXCONS; vc++) {
374 dev = make_dev(&sc_cdevsw, vc,
375 UID_ROOT, GID_WHEEL, 0600, "ttyv%r", vc + unit * MAXCONS);
376 dev->si_tty_tty = &sc->tty[vc];
376 dev->si_tty = &sc->tty[vc];
377 }
378 if (scp == sc_console) {
379#ifndef SC_NO_SYSMOUSE
380 dev = make_dev(&sc_cdevsw, SC_MOUSE,
381 UID_ROOT, GID_WHEEL, 0600, "sysmouse");
377 }
378 if (scp == sc_console) {
379#ifndef SC_NO_SYSMOUSE
380 dev = make_dev(&sc_cdevsw, SC_MOUSE,
381 UID_ROOT, GID_WHEEL, 0600, "sysmouse");
382 dev->si_tty_tty = MOUSE_TTY;
382 dev->si_tty = MOUSE_TTY;
383#endif /* SC_NO_SYSMOUSE */
384 dev = make_dev(&sc_cdevsw, SC_CONSOLECTL,
385 UID_ROOT, GID_WHEEL, 0600, "consolectl");
383#endif /* SC_NO_SYSMOUSE */
384 dev = make_dev(&sc_cdevsw, SC_CONSOLECTL,
385 UID_ROOT, GID_WHEEL, 0600, "consolectl");
386 dev->si_tty_tty = CONSOLE_TTY;
386 dev->si_tty = CONSOLE_TTY;
387 }
388
389 return 0;
390}
391
392static void
393scmeminit(void *arg)
394{

--- 38 unchanged lines hidden (view full) ---

433 kbd_clear_state(sc->kbd);
434 return 0;
435}
436
437struct tty
438*scdevtotty(dev_t dev)
439{
440
387 }
388
389 return 0;
390}
391
392static void
393scmeminit(void *arg)
394{

--- 38 unchanged lines hidden (view full) ---

433 kbd_clear_state(sc->kbd);
434 return 0;
435}
436
437struct tty
438*scdevtotty(dev_t dev)
439{
440
441 return (dev->si_tty_tty);
441 return (dev->si_tty);
442}
443
444static int
445scdevtounit(dev_t dev)
446{
447 int vty = SC_VTY(dev);
448
449 if (vty == SC_CONSOLECTL)

--- 4 unchanged lines hidden (view full) ---

454 return -1;
455 else
456 return vty/MAXCONS;
457}
458
459int
460scopen(dev_t dev, int flag, int mode, struct proc *p)
461{
442}
443
444static int
445scdevtounit(dev_t dev)
446{
447 int vty = SC_VTY(dev);
448
449 if (vty == SC_CONSOLECTL)

--- 4 unchanged lines hidden (view full) ---

454 return -1;
455 else
456 return vty/MAXCONS;
457}
458
459int
460scopen(dev_t dev, int flag, int mode, struct proc *p)
461{
462 struct tty *tp = dev->si_tty_tty;
462 struct tty *tp = dev->si_tty;
463 int unit = scdevtounit(dev);
464 sc_softc_t *sc;
465 keyarg_t key;
466 int error;
467
468 if (!tp)
469 return(ENXIO);
470

--- 50 unchanged lines hidden (view full) ---

521 }
522 }
523 return error;
524}
525
526int
527scclose(dev_t dev, int flag, int mode, struct proc *p)
528{
463 int unit = scdevtounit(dev);
464 sc_softc_t *sc;
465 keyarg_t key;
466 int error;
467
468 if (!tp)
469 return(ENXIO);
470

--- 50 unchanged lines hidden (view full) ---

521 }
522 }
523 return error;
524}
525
526int
527scclose(dev_t dev, int flag, int mode, struct proc *p)
528{
529 struct tty *tp = dev->si_tty_tty;
529 struct tty *tp = dev->si_tty;
530 struct scr_stat *scp;
531 int s;
532
533 if (!tp)
534 return(ENXIO);
535 if ((SC_VTY(dev) != SC_CONSOLECTL) && (SC_VTY(dev) != SC_MOUSE)) {
536 scp = sc_get_scr_stat(tp->t_dev);
537 /* were we in the middle of the VT switching process? */

--- 41 unchanged lines hidden (view full) ---

579 ttyclose(tp);
580 spl0();
581 return(0);
582}
583
584int
585scread(dev_t dev, struct uio *uio, int flag)
586{
530 struct scr_stat *scp;
531 int s;
532
533 if (!tp)
534 return(ENXIO);
535 if ((SC_VTY(dev) != SC_CONSOLECTL) && (SC_VTY(dev) != SC_MOUSE)) {
536 scp = sc_get_scr_stat(tp->t_dev);
537 /* were we in the middle of the VT switching process? */

--- 41 unchanged lines hidden (view full) ---

579 ttyclose(tp);
580 spl0();
581 return(0);
582}
583
584int
585scread(dev_t dev, struct uio *uio, int flag)
586{
587 struct tty *tp = dev->si_tty_tty;
587 struct tty *tp = dev->si_tty;
588
589 if (!tp)
590 return(ENXIO);
591 sc_touch_scrn_saver();
592 return((*linesw[tp->t_line].l_read)(tp, uio, flag));
593}
594
595int
596scwrite(dev_t dev, struct uio *uio, int flag)
597{
588
589 if (!tp)
590 return(ENXIO);
591 sc_touch_scrn_saver();
592 return((*linesw[tp->t_line].l_read)(tp, uio, flag));
593}
594
595int
596scwrite(dev_t dev, struct uio *uio, int flag)
597{
598 struct tty *tp = dev->si_tty_tty;
598 struct tty *tp = dev->si_tty;
599
600 if (!tp)
601 return(ENXIO);
602 return((*linesw[tp->t_line].l_write)(tp, uio, flag));
603}
604
605static int
606sckbdevent(keyboard_t *thiskbd, int event, void *arg)

--- 79 unchanged lines hidden (view full) ---

686{
687 int error;
688 int i;
689 struct tty *tp;
690 sc_softc_t *sc;
691 scr_stat *scp;
692 int s;
693
599
600 if (!tp)
601 return(ENXIO);
602 return((*linesw[tp->t_line].l_write)(tp, uio, flag));
603}
604
605static int
606sckbdevent(keyboard_t *thiskbd, int event, void *arg)

--- 79 unchanged lines hidden (view full) ---

686{
687 int error;
688 int i;
689 struct tty *tp;
690 sc_softc_t *sc;
691 scr_stat *scp;
692 int s;
693
694 tp = dev->si_tty_tty;
694 tp = dev->si_tty;
695 if (!tp)
696 return ENXIO;
697
698 /* If there is a user_ioctl function call that first */
699 if (sc_user_ioctl) {
700 error = (*sc_user_ioctl)(dev, cmd, data, flag, p);
701 if (error != ENOIOCTL)
702 return error;

--- 3133 unchanged lines hidden (view full) ---

3836}
3837
3838int
3839scmmap(dev_t dev, vm_offset_t offset, int nprot)
3840{
3841 struct tty *tp;
3842 struct scr_stat *scp;
3843
695 if (!tp)
696 return ENXIO;
697
698 /* If there is a user_ioctl function call that first */
699 if (sc_user_ioctl) {
700 error = (*sc_user_ioctl)(dev, cmd, data, flag, p);
701 if (error != ENOIOCTL)
702 return error;

--- 3133 unchanged lines hidden (view full) ---

3836}
3837
3838int
3839scmmap(dev_t dev, vm_offset_t offset, int nprot)
3840{
3841 struct tty *tp;
3842 struct scr_stat *scp;
3843
3844 tp = dev->si_tty_tty;
3844 tp = dev->si_tty;
3845 if (!tp)
3846 return ENXIO;
3847 scp = sc_get_scr_stat(tp->t_dev);
3848 return (*vidsw[scp->sc->adapter]->mmap)(scp->sc->adp, offset, nprot);
3849}
3850
3851/*
3852 * Calculate hardware attributes word using logical attributes mask and

--- 231 unchanged lines hidden ---
3845 if (!tp)
3846 return ENXIO;
3847 scp = sc_get_scr_stat(tp->t_dev);
3848 return (*vidsw[scp->sc->adapter]->mmap)(scp->sc->adp, offset, nprot);
3849}
3850
3851/*
3852 * Calculate hardware attributes word using logical attributes mask and

--- 231 unchanged lines hidden ---